From b074f580db12bfa24279e3b71e1b764c6a267ff1 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Thu, 8 Feb 2018 16:59:17 +0100 Subject: [PATCH 1/8] Fix can't update $nblignes on beforePDFCreation if we update $object->lines --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 2 +- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 5d07085378b..d8bfff2e528 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -179,7 +179,7 @@ class pdf_einstein extends ModelePDFCommandes */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager; + global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index de0b126b059..88a47095b8c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -168,7 +168,7 @@ class pdf_crabe extends ModelePDFFactures */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager; + global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index b2a0a522cc9..03d0db86d8f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -153,7 +153,7 @@ class pdf_azur extends ModelePDFPropales */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager; + global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index b488252f77c..85b3f7bd045 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -139,7 +139,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { - global $user,$langs,$conf,$mysoc,$hookmanager; + global $user,$langs,$conf,$mysoc,$hookmanager,$nblignes; // Get source company if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 78ecb9d52c2..9d0a76eb2b6 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -154,7 +154,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$hookmanager,$mysoc; + global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 0982a18f3d0..a6457dd7a2e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -141,7 +141,7 @@ class pdf_aurore extends ModelePDFSupplierProposal */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc,$db,$hookmanager; + global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO From 2817ace0d2e9a23de261202dc4a6a1d8e5acf3ce Mon Sep 17 00:00:00 2001 From: John Date: Fri, 9 Feb 2018 15:47:18 +0100 Subject: [PATCH 2/8] Fix contract line extrafields save on add line --- htdocs/contrat/class/contrat.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 470d86d6c7c..78071fe0242 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2987,7 +2987,16 @@ class ContratLigne extends CommonObjectLine { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet'); - // FIXME Missing insert of extrafields + // Insert of extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used + { + $result = $this->insertExtraFields(); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + } if (!$notrigger) { From fa3b1c74a901072f0a96c2028482837bde4f3b37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2018 02:25:34 +0100 Subject: [PATCH 3/8] Fix bad link --- htdocs/compta/bank/transfer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 3819e2acccb..61a4f524a1a 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -125,7 +125,7 @@ if ($action == 'add') if (! $error) { - $mesgs = $langs->trans("TransferFromToDone",''.$accountfrom->label."",''.$accountto->label."",$amount,$langs->transnoentities("Currency".$conf->currency)); + $mesgs = $langs->trans("TransferFromToDone",''.$accountfrom->label."",''.$accountto->label."",$amount,$langs->transnoentities("Currency".$conf->currency)); setEventMessages($mesgs, null, 'mesgs'); $db->commit(); } From 37ff46b05ad687c51b6672537e7f5bb82bfafd79 Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 9 Feb 2018 09:11:47 +0100 Subject: [PATCH 4/8] add missing links in supplier card boxes --- htdocs/fourn/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 724f90af228..5a47ce17089 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -305,7 +305,7 @@ if ($object->id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllSupplierProposals"); - $link=''; + $link=DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -323,7 +323,7 @@ if ($object->id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllOrders"); - $link=''; + $link=DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -341,7 +341,7 @@ if ($object->id > 0) $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllInvoices"); - $link=''; + $link=DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; From 8e42ed5824f24e6165c96791a0d3bc893472035b Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 9 Feb 2018 09:14:34 +0100 Subject: [PATCH 5/8] add missing links in cust. card boxes --- htdocs/comm/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 7e81d88adc1..2495d512c55 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -549,7 +549,7 @@ if ($id > 0) $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllProposals"); - $link=''; + $link=DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -561,13 +561,13 @@ if ($id > 0) if (! empty($conf->commande->enabled)) { - // Box proposals + // Box commandes $tmp = $object->getOutstandingOrders(); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllOrders"); - $link=''; + $link=DOL_URL_ROOT.'/commande/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; @@ -579,12 +579,13 @@ if ($id > 0) if (! empty($conf->facture->enabled)) { + // Box factures $tmp = $object->getOutstandingBills(); $outstandingOpened=$tmp['opened']; $outstandingTotal=$tmp['total_ht']; $outstandingTotalIncTax=$tmp['total_ttc']; $text=$langs->trans("OverAllInvoices"); - $link=''; + $link=DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id; $icon='bill'; if ($link) $boxstat.=''; $boxstat.='
'; From f88874c1f7fafe9aa3ee49aa0ab829cbc45be387 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2018 02:53:08 +0100 Subject: [PATCH 6/8] Code comment --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index e84eef83924..c204809e9a1 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -104,7 +104,7 @@ function dol_hash($chain,$type=0) * @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). - * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. + * @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param Canvas $objcanvas Object canvas From 671fbd3d55b1bcd9f339c021c6cd81e5a5682f43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2018 02:59:18 +0100 Subject: [PATCH 7/8] Code comment --- htdocs/contrat/class/contrat.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5165d1cdcb6..23ae71cb6f3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -881,7 +881,6 @@ class Contrat extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."contrat"); - // Load object modContract $module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis'); if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') From 975608b9d3f0812b6961fa230d371cdb93dfd5f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Feb 2018 03:21:04 +0100 Subject: [PATCH 8/8] FIX #8174 --- htdocs/compta/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 84898930ed9..0ff463f9ca5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -152,7 +152,7 @@ $arrayfields=array( 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0), + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled)?0:1)), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), @@ -162,8 +162,8 @@ $arrayfields=array( 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), - 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj=="1"), - 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj=="1"), + 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), + 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj=="1")), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),