From d3d06179969926ca51b9f4526e5b36506cffbcc0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Feb 2021 13:43:33 +0100 Subject: [PATCH 1/5] fix: manage price min for PRODUIT_CUSTOMER_PRICES --- htdocs/comm/propal/card.php | 1 + htdocs/commande/card.php | 1 + htdocs/product/class/product.class.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index eddf967c7d1..ae4437004e6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -942,6 +942,7 @@ if (empty($reshook)) if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx); if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 36f9705aabc..7e16760c489 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -777,6 +777,7 @@ if (empty($reshook)) { $pu_ht = price($prodcustprice->lines[0]->price); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_min = price($prodcustprice->lines[0]->price_min); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0ec669afad8..e4724eb051c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1666,6 +1666,7 @@ class Product extends CommonObject if ($result) { if (count($prodcustprice->lines) > 0) { $pu_ht = price($prodcustprice->lines[0]->price); + $price_min = price($prodcustprice->lines[0]->price_min); $pu_ttc = price($prodcustprice->lines[0]->price_ttc); $price_base_type = $prodcustprice->lines[0]->price_base_type; $tva_tx = $prodcustprice->lines[0]->tva_tx; From dbbebba4977fca4fa93dfe9fe6a3d96f61df30a1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 8 Feb 2021 20:44:40 +0100 Subject: [PATCH 2/5] this->errors is set on triggers action must be set by callers --- htdocs/comm/propal/class/propal.class.php | 5 ++++- htdocs/commande/class/commande.class.php | 1 + htdocs/compta/bank/class/account.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 2 ++ htdocs/expensereport/class/expensereport.class.php | 3 +++ htdocs/supplier_proposal/class/supplier_proposal.class.php | 1 + 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 9d6b6c201c5..34987cc1b0a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -483,6 +483,7 @@ class Propal extends CommonObject else { $this->error = $line->error; + $this->errors = $line->errors; $this->db->rollback(); return -2; } @@ -727,6 +728,7 @@ class Propal extends CommonObject else { $this->error = $this->line->error; + $this->errors = $this->line->errors; $this->db->rollback(); return -2; } @@ -924,7 +926,7 @@ class Propal extends CommonObject else { $this->error = $this->line->error; - + $this->errors = $this->line->errors; $this->db->rollback(); return -1; } @@ -4424,3 +4426,4 @@ class PropaleLigne extends CommonObjectLine } } } + diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 49f8005980f..4dae8711b34 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2002,6 +2002,7 @@ class Commande extends CommonOrder else { $this->error = $line->error; + $this->errors = $line->errors; $this->db->rollback(); return -2; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 31d7749a430..ef81ef452c7 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -581,7 +581,8 @@ class Account extends CommonObject return $accline->id; } else { - $this->error = $this->db->lasterror(); + $this->error = $accline->error; + $this->errors = $accline->errors; $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 392817b0368..8eb749b1d6b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -783,6 +783,7 @@ class Facture extends CommonInvoice if ($result < 0) { $this->error = $newinvoiceline->error; + $this->errors = $newinvoiceline->errors; $error++; break; } @@ -3227,6 +3228,7 @@ class Facture extends CommonInvoice else { $this->error = $this->line->error; + $this->errors = $this->line->errors; $this->db->rollback(); return -2; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 3c18805362f..abb91fe5a6b 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -318,6 +318,7 @@ class ExpenseReport extends CommonObject if ($result < 0) { $this->error = $newndfline->error; + $this->errors = $newndfline->errors; $error++; break; } @@ -2948,3 +2949,5 @@ function select_type_fees_id($selected = '', $htmlname = 'type', $showempty = 0, } print ''; } + + diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 9822c171cd8..d28a0ef3b72 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -636,6 +636,7 @@ class SupplierProposal extends CommonObject else { $this->error = $this->line->error; + $this->errors = $this->line->errors; $this->db->rollback(); return -2; } From ff6b5c768dfd29a388de125b7c9c028e3844980b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 8 Feb 2021 20:46:21 +0100 Subject: [PATCH 3/5] fix indent --- htdocs/expensereport/class/expensereport.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index abb91fe5a6b..be32483deea 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2949,5 +2949,3 @@ function select_type_fees_id($selected = '', $htmlname = 'type', $showempty = 0, } print ''; } - - From 6bcb63c53d3e349e9ee4fd28667757f1066eef97 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 8 Feb 2021 20:46:59 +0100 Subject: [PATCH 4/5] fix indent --- htdocs/comm/propal/class/propal.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 34987cc1b0a..7bdb531ec9b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4426,4 +4426,3 @@ class PropaleLigne extends CommonObjectLine } } } - From 8acc5e148678fcf0d40d4c77c57b8adb86187bbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Feb 2021 23:37:32 +0100 Subject: [PATCH 5/5] Fix calculation of profit --- htdocs/projet/element.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index c513123c9bf..3d6f954f439 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -777,7 +777,6 @@ foreach ($listofreferent as $key => $value) // Each element with at least one line is output $qualifiedforfinalprofit = true; if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit = false; - if ($key == 'propal' && $element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedforfinalprofit = false; //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin @@ -787,8 +786,7 @@ foreach ($listofreferent as $key => $value) $total_revenue_ht += $total_ht; } - if ($margin != "add") // Revert sign - { + if ($margin != "add") { // Revert sign $total_ht = -$total_ht; $total_ttc = -$total_ttc; }