From ab19bb24553820aa4e5fdb9d01566272806d6b6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 00:52:05 +0100 Subject: [PATCH 01/10] FIX default value of selectMasssAction broken --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e4c81435752..4be8c74ffac 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -646,12 +646,14 @@ class Form /* console.log( index + ": " + $( this ).text() ); */ if ($(this).is(\':checked\')) atleastoneselected++; }); + console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected); + if (atleastoneselected || '.$alwaysvisible.') { jQuery(".massaction").show(); - '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' - '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' + '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' + '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' } else { From a05f9fad33a18d515e7e64992b676050cdafe913 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:05 +0100 Subject: [PATCH 02/10] FIX Look and feel v11 --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/expensereport/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d52c4c51f07..c35468ea85a 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -332,7 +332,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -341,7 +341,7 @@ if ($result) { $product_static = new Product($db); while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; @@ -390,7 +390,7 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; + print ''; print $codecompta.' '; print img_edit(); print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index cc606555b37..4d96027f79a 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -287,7 +287,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codeCompta = length_accountg($objp->account_number).' - '.$objp->label; + $codeCompta = length_accountg($objp->account_number).' - '.$objp->label.''; $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -315,7 +315,7 @@ if ($result) { print ''.$codeCompta.''; - print ''; + print ''; print img_edit(); print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index a035aed2b1f..5b74311c310 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -336,7 +336,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $checkpicto = $form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -347,7 +347,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codecompta = length_accountg($objp->account_number).' - '.$objp->label; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label.''; $facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->id = $objp->facid; @@ -399,7 +399,7 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; + print ''; print $codecompta.' '; print img_edit(); print ''; From 88d98acbba9ec104192083e6c349b8508ca95320 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:27 +0100 Subject: [PATCH 03/10] FIX #13410 Conflicts: htdocs/compta/facture/card.php --- htdocs/compta/facture/card.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0b38c4eb7e7..d08c69e7638 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -302,11 +302,13 @@ if (empty($reshook)) // Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only). $array_of_total_ht_per_vat_rate = array(); $array_of_total_ht_devise_per_vat_rate = array(); - foreach($object->lines as $line) { - if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht; - $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht; + foreach ($object->lines as $line) { + //$vat_src_code_for_line = $line->vat_src_code; // TODO We chek sign of total per vat without taking into account the vat code because for the moment the vat code is lost/unknown when we add a down payment. + $vat_src_code_for_line = ''; + if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->total_ht; + $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->multicurrency_total_ht; } //var_dump($array_of_total_ht_per_vat_rate);exit; From d3debccabe2bd24fc405c8a14ad307ac172ac5fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:14:57 +0100 Subject: [PATCH 04/10] FIX bad value in currency into discount created from down payment --- htdocs/compta/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d08c69e7638..bf03ad2c3d6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -833,9 +833,9 @@ if (empty($reshook)) $amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU'); $amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU'); $amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ht[$vatrate] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_tva[$vatrate] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ttc[$vatrate] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); } } } From 004397304e4fa7ae65d90f7e42b283e5369235bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:32:24 +0100 Subject: [PATCH 05/10] FIX Foreign currency lost when splitting a discount --- htdocs/comm/remx.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 651fa556e8a..c7016f2dbab 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -129,6 +129,13 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount1->amount_tva = price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht); $newdiscount2->amount_tva = price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht); + $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); + $newdiscount2->multicurrency_amount_ttc = price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc); + $newdiscount1->multicurrency_amount_ht = price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); + $newdiscount2->multicurrency_amount_ht = price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100), 'MT'); + $newdiscount1->multicurrency_amount_tva = price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht); + $newdiscount2->multicurrency_amount_tva = price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht); + $db->begin(); $discount->fk_facture_source = 0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source From 84fc394e6fc84549dc07bed1ee538c3a6de6883c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:29:29 +0100 Subject: [PATCH 06/10] Fix exclude fucking composer dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39fce4fb1a7..2c55ef199e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -299,7 +299,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From 5fdf23bba8c53403a3e621e2982dc1c7b4df9aff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:36:16 +0100 Subject: [PATCH 07/10] Fix exclude fucking composer dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c55ef199e8..854925e9109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -299,7 +299,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From 386d478b659a4626efcad5bd5d16e8446c222fff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:44:58 +0100 Subject: [PATCH 08/10] Add os in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index eb767ea1b61..ff02f7330f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: trusty to have php 5.4+ available +os: linux dist: trusty sudo: required From 39f7742387b13ec59a3c3627c5b8430d3488ad8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:46:39 +0100 Subject: [PATCH 09/10] Update travis config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 854925e9109..ea26438b435 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: trusty to have php 5.4+ available +os: linux dist: trusty sudo: required From 81ae6c45ea6bda0f70c4fd5a95b861350a11ba5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:47:58 +0100 Subject: [PATCH 10/10] composer is a big mess --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea26438b435..4e947325633 100644 --- a/.travis.yml +++ b/.travis.yml @@ -300,7 +300,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo