From 1f7cd1a3f8043e0a804dc949168fec5aa25a2535 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 26 Jul 2019 11:05:16 +0200 Subject: [PATCH 01/13] 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 32d35edb70a62..32d5100c0f79b 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 @@ function Header(&$pdf, $page, $pages, $outputlangs) $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 02/13] 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 5bb557cac2cf0..9e66d391e0f05 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5928,6 +5928,12 @@ function showOutputField($val, $key, $value, $moreparam='', $keysuffix='', $keyp $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 03/13] 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 cc553f1e5de90..21e716d7ac16d 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1904,7 +1904,7 @@ 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 04/13] 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 e478e26565286..5c13e3726402f 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf 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 05/13] 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 5c13e3726402f..2c7ee724d2fb0 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 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf * 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 @@ private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht) 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')); } } From d495f7969faafe133545f15384ed6f15302ce1aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 13:11:20 +0200 Subject: [PATCH 06/13] FIX #11412 --- htdocs/ticket/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index f40d3afce33b0..2a4195cb07b9c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -533,7 +533,9 @@ } print ''; //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); - print Form::multiselectarray('search_fk_statut', $arrayofstatus, array_values($search[$key]), 0, 0, 'minwidth150', 1, 0, '', '', ''); + $selectedarray = null; + if ($search[$key]) $selectedarray = array_values($search[$key]); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); print ''; } elseif ($key == "fk_soc") From dfc2bebbb6dd660eb8850755ad6e04f2ff55ac7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 13:27:07 +0200 Subject: [PATCH 07/13] FIX #11400 --- htdocs/accountancy/bookkeeping/card.php | 14 ++++++++--- .../class/accountancyexport.class.php | 24 ++++++------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 1f38171f19937..0328eba010c79 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -38,6 +38,7 @@ $langs->loadLangs(array("accountancy", "bills", "compta")); $action = GETPOST('action', 'aZ09'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); // id of record $mode = GETPOST('mode', 'aZ09'); // '' or 'tmp' @@ -346,6 +347,8 @@ } print '
'; + if ($optioncss != '') print ''; + print ''; print '' . "\n"; print '' . "\n"; print '' . "\n"; @@ -441,7 +444,8 @@ print ''; if ($action == 'editdate') { print ''; - print ''; + if ($optioncss != '') print ''; + print ''; print ''; print ''; print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); @@ -464,7 +468,8 @@ print ''; if ($action == 'editjournal') { print ''; - print ''; + if ($optioncss != '') print ''; + print ''; print ''; print ''; print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1); @@ -487,7 +492,8 @@ print ''; if ($action == 'editdocref') { print ''; - print ''; + if ($optioncss != '') print ''; + print ''; print ''; print ''; print ''; @@ -583,6 +589,8 @@ print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print ''; + if ($optioncss != '') print ''; + print ''; print '' . "\n"; print '' . "\n"; print '' . "\n"; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3169d3737d963..b3f5c3acfda76 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -274,7 +274,6 @@ public function export(&$TData) * Export format : CEGID * * @param array $objectLines data - * * @return void */ public function exportCegid($objectLines) @@ -300,7 +299,6 @@ public function exportCegid($objectLines) * Export format : COGILOG * * @param array $objectLines data - * * @return void */ public function exportCogilog($objectLines) @@ -334,7 +332,6 @@ public function exportCogilog($objectLines) * Export format : COALA * * @param array $objectLines data - * * @return void */ public function exportCoala($objectLines) @@ -362,7 +359,6 @@ public function exportCoala($objectLines) * Export format : BOB50 * * @param array $objectLines data - * * @return void */ public function exportBob50($objectLines) @@ -401,7 +397,6 @@ public function exportBob50($objectLines) * Export format : CIEL * * @param array $TData data - * * @return void */ public function exportCiel(&$TData) @@ -442,7 +437,6 @@ public function exportCiel(&$TData) * Export format : Quadratus * * @param array $TData data - * * @return void */ public function exportQuadratus(&$TData) @@ -526,7 +520,6 @@ public function exportQuadratus(&$TData) * Export format : EBP * * @param array $objectLines data - * * @return void */ public function exportEbp($objectLines) @@ -563,7 +556,6 @@ public function exportEbp($objectLines) * Export format : Agiris Isacompta * * @param array $objectLines data - * * @return void */ public function exportAgiris($objectLines) @@ -604,7 +596,6 @@ public function exportAgiris($objectLines) * Export format : OpenConcerto * * @param array $objectLines data - * * @return void */ public function exportOpenConcerto($objectLines) @@ -634,16 +625,17 @@ public function exportOpenConcerto($objectLines) } /** - * Export format : Configurable + * Export format : Configurable CSV * * @param array $objectLines data - * * @return void */ public function exportConfigurable($objectLines) { global $conf; + $separator = $this->separator; + foreach ($objectLines as $line) { $tab = array(); // export configurable @@ -651,15 +643,14 @@ public function exportConfigurable($objectLines) $tab[] = $line->piece_num; $tab[] = $date; $tab[] = $line->doc_ref; - $tab[] = $line->label_operation; + $tab[] = preg_match('/'.$separator.'/', $line->label_operation) ? "'".$line->label_operation."'" : $line->label_operation; $tab[] = length_accountg($line->numero_compte); $tab[] = length_accounta($line->subledger_account); - $tab[] = price($line->debit); - $tab[] = price($line->credit); - $tab[] = price($line->montant); + $tab[] = price2num($line->debit); + $tab[] = price2num($line->credit); + $tab[] = price2num($line->montant); $tab[] = $line->code_journal; - $separator = $this->separator; print implode($separator, $tab) . $this->end_line; } } @@ -668,7 +659,6 @@ public function exportConfigurable($objectLines) * Export format : FEC * * @param array $objectLines data - * * @return void */ public function exportFEC($objectLines) From a260e7391fb71c6f1396a97980dbbcf7d9e44512 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 14:22:45 +0200 Subject: [PATCH 08/13] FIX for #11232 --- htdocs/core/class/html.formmargin.class.php | 32 ++++++++++----------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index f9b0a59280fb0..ea038fa813190 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -199,8 +199,6 @@ public function displayMarginInfos($object, $force_price = false) if (! $user->rights->margins->liretous) return; - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); - $marginInfo = $this->getMarginInfosArray($object, $force_price); if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better @@ -240,13 +238,13 @@ public function displayMarginInfos($object, $force_price = false) //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { print ''; print ''.$langs->trans('MarginOnProducts').''; - print ''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''; + print ''.price($marginInfo['pv_products']).''; + print ''.price($marginInfo['pa_products']).''; + print ''.price($marginInfo['margin_on_products']).''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, 2).'%').''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, 2).'%').''; print ''; } @@ -254,13 +252,13 @@ public function displayMarginInfos($object, $force_price = false) { print ''; print ''.$langs->trans('MarginOnServices').''; - print ''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''; + print ''.price($marginInfo['pv_services']).''; + print ''.price($marginInfo['pa_services']).''; + print ''.price($marginInfo['margin_on_services']).''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, 2).'%').''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, 2).'%').''; print ''; } @@ -268,13 +266,13 @@ public function displayMarginInfos($object, $force_price = false) { print ''; print ''.$langs->trans('TotalMargin').''; - print ''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''; - print ''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''; + print ''.price($marginInfo['pv_total']).''; + print ''.price($marginInfo['pa_total']).''; + print ''.price($marginInfo['total_margin']).''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').''; + print ''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; print ''; } print ''; From 90ddc0a214ade20d36a7478f6634e27928444b2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 14:27:57 +0200 Subject: [PATCH 09/13] FIX #10930 --- htdocs/core/modules/project/doc/pdf_beluga.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index dfbe97c3fd5a9..8b6cd68f343cc 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -260,7 +260,7 @@ public function write_file($object, $outputlangs) complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - + $tab_top -= 2; $pdf->SetFont('', '', $default_font_size - 1); @@ -438,7 +438,7 @@ public function write_file($object, $outputlangs) $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R'); } $pdf->SetXY($this->posxstatut, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Status"), 1, 'R'); if (is_array($elementarray) && count($elementarray) > 0) { From d6ae62478c8841fdfe58971494818b599f396d4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 15:42:44 +0200 Subject: [PATCH 10/13] FIX #10984 FIX reposition on "Build backup" button FIX Fatal error on dol_htmloutput_mesg with corrupted array --- htdocs/admin/tools/dolibarr_export.php | 11 ++++----- htdocs/admin/tools/export.php | 33 +++++++++++++------------- htdocs/core/js/lib_foot.js.php | 3 ++- htdocs/core/lib/functions.lib.php | 15 ++++++++---- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index e63aec50dca5e..c06314daa9aa1 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -446,8 +446,10 @@ function hideoptions () {
-
" id="buttonGo" />
+
+ " id="buttonGo"> + +

'.$langs->trans("BackupResult").': '; print $_SESSION["commandbackupresult"]; @@ -598,9 +600,6 @@ function hideoptions () { - - - trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod")))); + header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):'')); exit; } @@ -122,25 +122,15 @@ // MYSQL if ($what == 'mysql') { - $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump=dol_sanitizePathName($cmddump); if (! empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); - $ok=0; dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); - foreach($arrayofallowedcommand as $allowedcommand) - { - $basenamecmddump=basename($cmddump); - if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command - { - $ok=1; - break; - } - } - if (! $ok) + $basenamecmddump=basename($cmddump); + if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command { $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); } @@ -176,6 +166,18 @@ $cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $cmddump=dol_sanitizePathName($cmddump); + /* Not required, the command is output on screen but not ran for pgsql + if (! empty($dolibarr_main_restrict_os_commands)) + { + $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); + $basenamecmddump=basename($cmddump); + if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command + { + $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); + } + } */ + if (! $errormsg && $cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity); @@ -193,7 +195,6 @@ } - if ($errormsg) { setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); @@ -230,8 +231,8 @@ print '
'; */ -// Redirect t backup page -header("Location: dolibarr_export.php"); +// Redirect to backup page +header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):'')); $time_end = time(); diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 14c69259b9894..79ad6d1911504 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -148,6 +148,7 @@ /* Set handler to add page_y param on output (click on href links or submit button) */ jQuery(".reposition").click(function() { var page_y = $(document).scrollTop(); + if (page_y > 0) { if (this.href) @@ -157,7 +158,7 @@ } else { - console.log("We click on tag with .reposition class but element is not an html tag, so we try to update form field page_y with value "+page_y); + console.log("We click on tag with .reposition class but element is not an html tag, so we try to update input form field page_y with value "+page_y); jQuery("input[type=hidden][name=page_y]").val(page_y); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9aa6177adf499..20dd423dd4ca9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6554,10 +6554,17 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o $newmesgarray=array(); foreach($mesgarray as $val) { - $tmpmesgstring=preg_replace('/<\/div>
/', '
', $val); - $tmpmesgstring=preg_replace('/
/', '', $tmpmesgstring); - $tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring); - $newmesgarray[]=$tmpmesgstring; + if (is_string($val)) + { + $tmpmesgstring=preg_replace('/<\/div>
/', '
', $val); + $tmpmesgstring=preg_replace('/
/', '', $tmpmesgstring); + $tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring); + $newmesgarray[]=$tmpmesgstring; + } + else + { + dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING); + } } $mesgarray=$newmesgarray; } From bf14b4b3d5cda59654e2ebac693bfaba119feda7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 16:20:18 +0200 Subject: [PATCH 11/13] Add Canada Dollar in currency that need symbol before --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20dd423dd4ca9..e9f4301f8f23e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4400,7 +4400,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ { if ($currency_code == 'auto') $currency_code=$conf->currency; - $listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY'); + $listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY','CAD'); $listoflanguagesbefore=array('nl_NL'); if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore)) { From 6693f9fbcab68129d60879c54816bedf3d23430c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 16:24:19 +0200 Subject: [PATCH 12/13] Fix phpcs --- htdocs/compta/sociales/list.php | 2 +- htdocs/install/step2.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index baa1f57a3074e..5f7f7d0fc0a77 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -281,7 +281,7 @@ print ''; if ($obj->periode) { - print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').''; + print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').''; } else { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index b553166e8bc14..172d251028761 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -453,7 +453,7 @@ // Replace the prefix in table names if ($dolibarr_main_db_prefix != 'llx_') { - $buffer=preg_replace('/llx_/i',$dolibarr_main_db_prefix,$buffer); + $buffer=preg_replace('/llx_/i', $dolibarr_main_db_prefix,$buffer); } dolibarr_install_syslog("step2: request: " . $buffer); print "\n"; From 5a719769bc3cca79dfb6d2b0320b09d626cc5e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2019 16:29:18 +0200 Subject: [PATCH 13/13] Fix phpcs --- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- test/phpunit/HolidayTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 10b2a5662f300..af9c0e2c4120a 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -622,7 +622,7 @@ public function import_insert($arrayrecord, $array_match_file_to_database, $obji if (! empty($objimport->array_import_regex[0][$val]) && ($newval != '')) { // If test is "Must exist in a field@table or field@table:..." - if (preg_match('/^(.+)@([^:]+)(:.+)?$/',$objimport->array_import_regex[0][$val],$reg)) + if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field=$reg[1]; $table=$reg[2]; diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index 3e7ddfb7f0f01..ce3312ba44133 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -365,5 +365,4 @@ public function testUpdateBalance() $localobjecta->updateBalance(); } - }