From 38d735341c47861c14aaae19778c02236132aef9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Feb 2018 10:24:16 +0100 Subject: [PATCH 1/8] Fix: remove lines with special code when convert to reduc --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e6c30abda2d..3a1ee89b366 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -636,7 +636,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if ($line->total_ht!=0) + if (empty($line->special_code) && $line->total_ht != 0) // Remove lines with special code { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From c1e6d884422187bd589eb8baa7f56740a0b2ff71 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Feb 2018 08:55:51 +0100 Subject: [PATCH 2/8] Fix: use product_type instead special_code --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3a1ee89b366..fe061cb2e3b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -636,7 +636,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if (empty($line->special_code) && $line->total_ht != 0) // Remove lines with special code + if (empty($line->product_type >= 9) && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From 8ee1186492b5db56c2a11045af26568c1a4d1ff5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 4 Feb 2018 09:05:35 +0100 Subject: [PATCH 3/8] Fix: wrong test --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index fe061cb2e3b..4d9486af815 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -636,7 +636,7 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if (empty($line->product_type >= 9) && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 + if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 { // no need to create discount if amount is null $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; From fd8f89c70839a750e3e30d4cbe525c6de36f01cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 11:13:47 +0100 Subject: [PATCH 4/8] FIX a discount is a percent, not an amount, so we use vatrate not price --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 54bf70981b7..73c0e8c74a7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1471,7 +1471,7 @@ function dol_print_reduction($reduction,$langs) } else { - $string = price($reduction).'%'; + $string = vatrate($reduction,true); } return $string; From f3700b66c699adc7933d0c04923f0a47e34d1306 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 11:17:45 +0100 Subject: [PATCH 5/8] Fix size of columns when using PRODUCT_USE_UNIT --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 8 ++++---- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 8 ++++---- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index abc4688ef5c..7e9535fb48c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -133,10 +133,10 @@ class pdf_einstein extends ModelePDFCommandes $this->posxdesc=$this->marge_gauche+1; if($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=99; - $this->posxup=114; - $this->posxqty=130; - $this->posxunit=147; + $this->posxtva=101; + $this->posxup=118; + $this->posxqty=135; + $this->posxunit=151; } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index bfecd773b27..d4872b000de 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -118,10 +118,10 @@ class pdf_crabe extends ModelePDFFactures $this->posxdesc=$this->marge_gauche+1; if($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=99; - $this->posxup=114; - $this->posxqty=130; - $this->posxunit=147; + $this->posxtva=101; + $this->posxup=118; + $this->posxqty=135; + $this->posxunit=151; } else { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 41e76ddbf3d..604940b017e 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -107,10 +107,10 @@ class pdf_azur extends ModelePDFPropales $this->posxdesc=$this->marge_gauche+1; if($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=99; - $this->posxup=114; - $this->posxqty=130; - $this->posxunit=147; + $this->posxtva=101; + $this->posxup=118; + $this->posxqty=135; + $this->posxunit=151; } else { From fe57cf697f8fc0f539f07f2f495e8e09461e66bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 14:34:31 +0100 Subject: [PATCH 6/8] Fix init category selected --- htdocs/product/card.php | 5 +++-- htdocs/societe/card.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a54f1d90885..861c46328df 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1106,11 +1106,11 @@ else print ""; //} - if($conf->categorie->enabled) { + if ($conf->categorie->enabled) { // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); print ""; } @@ -1464,6 +1464,7 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_PRODUCT); + $arrayselected=array(); foreach($cats as $cat) { $arrayselected[] = $cat->id; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9d0a58d3196..e858eaf9a6e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1893,6 +1893,7 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); + $arrayselected=array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } @@ -1907,6 +1908,7 @@ else $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected=array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } From 354fc4edd0424f1a4668031ea3ecbc338e1f4da1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 23:06:37 +0100 Subject: [PATCH 7/8] Fix: amount into form must be numeric without format --- htdocs/public/paybox/newpayment.php | 10 +++++----- htdocs/public/payment/newpayment.php | 10 +++++----- htdocs/public/paypal/newpayment.php | 10 +++++----- htdocs/public/stripe/newpayment.php | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index aea30184286..bd27554c500 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -305,7 +305,7 @@ if (! GETPOST("source") && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -392,7 +392,7 @@ if (GETPOST("source") == 'order' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -480,7 +480,7 @@ if (GETPOST("source") == 'invoice' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -656,7 +656,7 @@ if (GETPOST("source") == 'contractline' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -786,7 +786,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 4bc33756a51..74ffcfd120a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -647,7 +647,7 @@ if (! $source) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -738,7 +738,7 @@ if ($source == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -858,7 +858,7 @@ if ($source == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -1079,7 +1079,7 @@ if ($source == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -1239,7 +1239,7 @@ if ($source == 'membersubscription') //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 8261ba2d99a..b1ecfa43803 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -387,7 +387,7 @@ if (! GETPOST("source")) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -472,7 +472,7 @@ if (GETPOST("source") == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -582,7 +582,7 @@ if (GETPOST("source") == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -780,7 +780,7 @@ if (GETPOST("source") == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -936,7 +936,7 @@ if (GETPOST("source") == 'membersubscription') //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 8c1db0ea834..36cd64b4f01 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -455,7 +455,7 @@ if (! GETPOST("source")) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -541,7 +541,7 @@ if (GETPOST("source") == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -652,7 +652,7 @@ if (GETPOST("source") == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -852,7 +852,7 @@ if (GETPOST("source") == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -1008,7 +1008,7 @@ if (GETPOST("source") == 'membersubscription') //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; From dbe45d03d3ae570d9db36edc212ccf23e130443a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Feb 2018 23:12:19 +0100 Subject: [PATCH 8/8] Fix: amount into form must be numeric without format --- htdocs/projet/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 849ea5cd47d..fab93ff1634 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -783,14 +783,14 @@ elseif ($object->id > 0) // Opportunity probability print ''.$langs->trans("OpportunityProbability").''; - print ' %'; + print ' %'; print ''; print ''; print ''; // Opportunity amount print ''.$langs->trans("OpportunityAmount").''; - print ''; + print ''; print ''; }