This commit is contained in:
Maxime Kohlhaas 2017-07-17 11:38:37 +02:00
commit 843172ccc8
7 changed files with 79 additions and 56 deletions

View File

@ -169,9 +169,10 @@ if ($result) {
// Set accountancy code (for bank and thirdparty) // Set accountancy code (for bank and thirdparty)
$compta_bank = $obj->account_number; $compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)') $compta_soc = 'NotDefined';
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier); $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
if ($obj->label == '(CustomerInvoicePayment)') if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
$tabcompany[$obj->rowid] = array ( $tabcompany[$obj->rowid] = array (
@ -225,12 +226,12 @@ if ($result) {
$societestatic->id = $links[$key]['url_id']; $societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label']; $societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount; if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'user') { } else if ($links[$key]['type'] == 'user') {
$userstatic->id = $links[$key]['url_id']; $userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label']; $userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_user] += $obj->amount; if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') { } else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id']; $chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id'];
@ -542,10 +543,10 @@ if ($action == 'export_csv') {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$reflabel = $val["ref"]; $reflabel = $val["ref"];
if ($reflabel == '(SupplierInvoicePayment)') { if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
$reflabel = $langs->trans('Supplier'); $reflabel = $langs->trans('Supplier');
} }
if ($reflabel == '(CustomerInvoicePayment)') { if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
$reflabel = $langs->trans('Customer'); $reflabel = $langs->trans('Customer');
} }
if ($reflabel == '(SocialContributionPayment)') { if ($reflabel == '(SocialContributionPayment)') {
@ -769,10 +770,10 @@ if (empty($action) || $action == 'view') {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$reflabel = $val["ref"]; $reflabel = $val["ref"];
if ($reflabel == '(SupplierInvoicePayment)') { if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
$reflabel = $langs->trans('Supplier'); $reflabel = $langs->trans('Supplier');
} }
if ($reflabel == '(CustomerInvoicePayment)') { if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
$reflabel = $langs->trans('Customer'); $reflabel = $langs->trans('Customer');
} }
if ($reflabel == '(SocialContributionPayment)') { if ($reflabel == '(SocialContributionPayment)') {

View File

@ -102,7 +102,7 @@ $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
$pageplusone = GETPOST("pageplusone",'int'); $pageplusone = GETPOST("pageplusone",'int');
if ($pageplusone) $page = $pageplusone - 1; if ($pageplusone) $page = $pageplusone - 1;
if ($page == -1) { $page = 0; } if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref))
$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id); $contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
//var_dump($contextpage); //var_dump($contextpage);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('banktransactionlist', $contextpage)); $hookmanager->initHooks(array('banktransactionlist', $contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -580,6 +580,7 @@ if ($resql)
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">'; print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="ref" value="'.$ref.'">'; print '<input type="hidden" name="ref" value="'.$ref.'">';
if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">'; if (GETPOST('bid')) print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
@ -1212,6 +1213,7 @@ if ($resql)
{ {
print '<td align="right">-</td>'; print '<td align="right">-</td>';
} }
if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['b.num_releve']['checked'])) if (! empty($arrayfields['b.num_releve']['checked']))

View File

@ -1141,7 +1141,26 @@ class pdf_crabe extends ModelePDFFactures
} }
//} //}
// VAT // VAT
// Situations totals migth be wrong on huge amounts
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
$sum_pdf_tva = 0;
foreach($this->tva as $tvakey => $tvaval){
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
}
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
}
}
}
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey != 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0

View File

@ -134,7 +134,7 @@ CREATE TABLE llx_product_lot_extrafields
ALTER TABLE llx_product_lot_extrafields ADD INDEX idx_product_lot_extrafields (fk_object); ALTER TABLE llx_product_lot_extrafields ADD INDEX idx_product_lot_extrafields (fk_object);
ALTER TABLE llx_website_page MODIFY content MEDIUMTEXT; ALTER TABLE llx_website_page MODIFY COLUMN content MEDIUMTEXT;
CREATE TABLE llx_product_warehouse_properties CREATE TABLE llx_product_warehouse_properties
( (
@ -160,7 +160,7 @@ ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (accou
ALTER TABLE llx_expensereport_det ADD COLUMN fk_code_ventilation integer DEFAULT 0; ALTER TABLE llx_expensereport_det ADD COLUMN fk_code_ventilation integer DEFAULT 0;
ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint; ALTER TABLE llx_c_payment_term CHANGE COLUMN fdm type_cdr tinyint;
ALTER TABLE llx_facturedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; ALTER TABLE llx_facturedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
@ -173,11 +173,10 @@ ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT
ALTER TABLE llx_supplier_proposaldet ADD COLUMN fk_unit integer DEFAULT NULL; ALTER TABLE llx_supplier_proposaldet ADD COLUMN fk_unit integer DEFAULT NULL;
ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx; ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint; ALTER TABLE llx_c_payment_term CHANGE COLUMN fdm type_cdr TINYINT;
ALTER TABLE llx_entrepot ADD COLUMN fk_parent integer DEFAULT 0; ALTER TABLE llx_entrepot ADD COLUMN fk_parent integer DEFAULT 0;
create table llx_resource_extrafields create table llx_resource_extrafields
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -206,6 +205,8 @@ ALTER TABLE llx_overwrite_trans ADD COLUMN entity integer DEFAULT 1 NOT NULL AFT
ALTER TABLE llx_mailing_cibles ADD COLUMN error_text varchar(255); ALTER TABLE llx_mailing_cibles ADD COLUMN error_text varchar(255);
ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY COLUMN type varchar(50) DEFAULT 'system' NOT NULL;
-- VPGSQL8.2 ALTER TABLE llx_c_actioncomm ALTER COLUMN type SET DEFAULT 'system';
-- VPGSQL8.2 ALTER TABLE llx_c_actioncomm ALTER COLUMN type SET NOT NULL;
create table llx_user_employment create table llx_user_employment
( (
@ -240,12 +241,12 @@ ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_app
DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm);
-- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate.
drop table tmp_links_double; DROP TABLE tmp_links_double;
--select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2; --select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2;
create table tmp_links_double as (select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2); CREATE TABLE tmp_links_double AS (SELECT objectid, label, MAX(rowid) AS max_rowid, COUNT(rowid) AS count_rowid FROM llx_links WHERE label IS NOT NULL GROUP BY objectid, label HAVING COUNT(rowid) >= 2);
--select * from tmp_links_double; --select * from tmp_links_double;
delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_links_double); --update to avoid duplicate, delete to delete DELETE FROM llx_links WHERE (rowid, label) IN (SELECT max_rowid, label FROM tmp_links_double); --update to avoid duplicate, delete to delete
drop table tmp_links_double; DROP TABLE tmp_links_double;
ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label);
@ -256,8 +257,7 @@ ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity);
ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer; ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer;
UPDATE llx_accounting_account SET account_parent = 0 WHERE account_parent = '';
update llx_accounting_account set account_parent = 0 where account_parent = '';
-- VMYSQL4.3 ALTER TABLE llx_product_price MODIFY COLUMN date_price DATETIME NULL; -- VMYSQL4.3 ALTER TABLE llx_product_price MODIFY COLUMN date_price DATETIME NULL;
-- VPGSQL8.2 ALTER TABLE llx_product_price ALTER COLUMN date_price DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_product_price ALTER COLUMN date_price DROP NOT NULL;
@ -268,10 +268,8 @@ ALTER TABLE llx_product_customer_price ADD COLUMN default_vat_code varchar(10) a
ALTER TABLE llx_product_customer_price_log ADD COLUMN default_vat_code varchar(10) after tva_tx; ALTER TABLE llx_product_customer_price_log ADD COLUMN default_vat_code varchar(10) after tva_tx;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx; ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250); ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur'; UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client'; UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';

View File

@ -517,6 +517,7 @@ if (empty($reshook))
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef=''; $predef='';
$ref_fourn = GETPOST('fourn_ref');
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));

View File

@ -2801,6 +2801,7 @@ class SupplierProposalLine extends CommonObjectLine
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->fk_unit)) $this->fk_unit=0; if (empty($this->fk_unit)) $this->fk_unit=0;
if (empty($this->subprice)) $this->subprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;
@ -2985,6 +2986,7 @@ class SupplierProposalLine extends CommonObjectLine
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->fk_unit)) $this->fk_unit=0; if (empty($this->fk_unit)) $this->fk_unit=0;
if (empty($this->subprice)) $this->subprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;

View File

@ -104,7 +104,7 @@ function migrate_product_photospath($product)
global $conf; global $conf;
$dir = $conf->product->multidir_output[$product->entity]; $dir = $conf->product->multidir_output[$product->entity];
$origin = $dir .'/'. get_exdir($product->id,2) . $product->id ."/photos"; $origin = $dir .'/'. get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
$destin = $dir.'/'.dol_sanitizeFileName($product->ref); $destin = $dir.'/'.dol_sanitizeFileName($product->ref);
$error = 0; $error = 0;