From 1f7cd1a3f8043e0a804dc949168fec5aa25a2535 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 26 Jul 2019 11:05:16 +0200 Subject: [PATCH 1/5] FIX name was able to be in field but went back to new line --- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 32d35edb70a..32d5100c0f7 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -247,7 +247,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->MultiCell(22,2,$outputlangs->transnoentities("Owner"),0,'L'); $pdf->SetFont('','', $default_font_size); $pdf->SetXY(32,26); - $pdf->MultiCell(60,2,$outputlangs->convToOutputCharset($this->account->proprio),0,'L'); + $pdf->MultiCell(80,2,$outputlangs->convToOutputCharset($this->account->proprio),0,'L'); $pdf->SetFont('','', $default_font_size); $pdf->SetXY(10,32); From 581ae226ffbfe914e0f68a64d277cb3fc61a21a6 Mon Sep 17 00:00:00 2001 From: ATM john Date: Sat, 27 Jul 2019 18:25:25 +0200 Subject: [PATCH 2/5] Fix sellist showOuputField --- htdocs/core/class/commonobject.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5bb557cac2c..9e66d391e0f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5928,6 +5928,12 @@ abstract class CommonObject $type='link'; $param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]); } + elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) { + $param['options'] = array($reg[1] . ':' . $reg[2] . ':' . $reg[3] . ':' . $reg[4] => 'N'); + $type = 'sellist'; + } + + $langfile=$val['langfile']; $list=$val['list']; $help=$val['help']; From 43adb51932ac24ac3badac257855d7e8d8ad8e38 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 27 Jul 2019 22:06:08 +0200 Subject: [PATCH 3/5] Fix var declaration #11429 --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cc553f1e5de..21e716d7ac1 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1904,7 +1904,7 @@ else if ($resql) { $num = $db->num_rows($resql); - $i = 0; $total = 0; + $i = 0; $totalpaid = 0; while ($i < $num) { $objp = $db->fetch_object($resql); From 858e8a826f3a0a8ddab94061ffa574b029233148 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 26 Jul 2019 14:42:59 +0200 Subject: [PATCH 4/5] FIX: use rounding to compare the amounts --- ...e_20_modWorkflow_WorkflowManager.class.php | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index e478e265652..5c13e372640 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -105,8 +105,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) + { foreach($object->linkedObjects['propal'] as $element) { $ret=$element->classifyBilled($user); @@ -134,7 +134,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach($object->linkedObjects['commande'] as $element) { @@ -157,8 +157,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) + { foreach($object->linkedObjects['propal'] as $element) { $ret=$element->classifyBilled($user); @@ -186,8 +186,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) + { foreach($object->linkedObjects['order_supplier'] as $element) { $ret=$element->classifyBilled($user); @@ -209,8 +209,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) - { + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) + { foreach($object->linkedObjects['supplier_proposal'] as $element) { $ret=$element->classifyBilled($user); @@ -237,7 +237,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht; } dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) ); - if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) ) + if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht)) { foreach($object->linkedObjects['commande'] as $element) { @@ -310,4 +310,26 @@ class InterfaceWorkflowManager extends DolibarrTriggers return 0; } + /** + * @param Object $conf Dolibarr settings object + * @param float $totalonlinkedelements Sum of total amounts (excl VAT) of + * invoices linked to $object + * @param float $object_total_ht The total amount (excl VAT) of the object + * (an order, a proposal, a bill, etc.) + * @return bool True if the amounts are equal (arithmetic errors within tolerance margin) + * True if the module is configured to skip the amount equality check + * False otherwise. + */ + private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht) + { + // if the configuration allows unmatching amounts, allow classification anyway + if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) { + return true; + } + // if the rounded amount difference is zero, allow classification, else deny + return 0 == round( + $totalonlinkedelements - $object_total_ht, + $conf->global->MAIN_MAX_DECIMALS_UNIT + ); + } } From fe8ced58c8c1262ab51c81a8a878108cdec20392 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jul 2019 21:19:33 +0200 Subject: [PATCH 5/5] Update interface_20_modWorkflow_WorkflowManager.class.php --- .../interface_20_modWorkflow_WorkflowManager.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 5c13e372640..2c7ee724d2f 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -316,7 +316,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers * invoices linked to $object * @param float $object_total_ht The total amount (excl VAT) of the object * (an order, a proposal, a bill, etc.) - * @return bool True if the amounts are equal (arithmetic errors within tolerance margin) + * @return bool True if the amounts are equal (rounded on total amount) * True if the module is configured to skip the amount equality check * False otherwise. */ @@ -326,10 +326,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) { return true; } - // if the rounded amount difference is zero, allow classification, else deny - return 0 == round( - $totalonlinkedelements - $object_total_ht, - $conf->global->MAIN_MAX_DECIMALS_UNIT - ); + // if the amount are same, allow classification, else deny + return (price2num($totalonlinkedelements, 'MT') == price2num($object_total_ht, 'MT')); } }