From 672992a7912fbdfee3981dfb9d58b0c36309729b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 17:30:54 +0100 Subject: [PATCH 1/8] FIX same broken feature for propal and invoice --- htdocs/comm/propal/class/propal.class.php | 12 ++++-------- htdocs/commande/class/commande.class.php | 6 ++---- htdocs/compta/facture/class/facture.class.php | 6 ++++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c633ac44b74..6fa8a2bd379 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -612,7 +612,7 @@ class Propal extends CommonObject } $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if ($price_base_type == 'HT') { $pu = $pu_ht; } else { @@ -840,7 +840,7 @@ class Propal extends CommonObject } $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (empty($qty) && empty($special_code)) { $special_code = 3; // Set option tag } @@ -4234,6 +4234,7 @@ class PropaleLigne extends CommonObjectLine dol_syslog(get_class($this)."::insert rang=".$this->rang); $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters if (empty($this->tva_tx)) { @@ -4278,9 +4279,6 @@ class PropaleLigne extends CommonObjectLine if (!is_numeric($this->qty)) { $this->qty = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->multicurrency_subprice)) { $this->multicurrency_subprice = 0; } @@ -4453,6 +4451,7 @@ class PropaleLigne extends CommonObjectLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value if (empty($this->id) && !empty($this->rowid)) { $this->id = $this->rowid; @@ -4507,9 +4506,6 @@ class PropaleLigne extends CommonObjectLine if (empty($this->subprice)) { $this->subprice = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 26bb1125cbf..2ac0d52671a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3130,7 +3130,7 @@ class Commande extends CommonOrder $remise_percent = (float) price2num($remise_percent); $qty = (float) price2num($qty); $pu = price2num($pu); - $pa_ht = (float) price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring $pu_ht_devise = price2num($pu_ht_devise); if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' @@ -4629,6 +4629,7 @@ class OrderLine extends CommonOrderLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters if (empty($this->tva_tx)) { @@ -4679,9 +4680,6 @@ class OrderLine extends CommonOrderLine if (empty($this->fk_parent_line)) { $this->fk_parent_line = 0; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->ref_ext)) { $this->ref_ext = ''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 700f6fac245..00caede5161 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3877,7 +3877,7 @@ class Facture extends CommonInvoice $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -4137,7 +4137,7 @@ class Facture extends CommonInvoice $qty = price2num($qty); $pu = price2num($pu); $pu_ht_devise = price2num($pu_ht_devise); - $pa_ht = price2num($pa_ht); + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -6256,6 +6256,7 @@ class FactureLigne extends CommonInvoiceLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); @@ -6496,6 +6497,7 @@ class FactureLigne extends CommonInvoiceLine $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. + $this->pa_ht = (float) $this->pa_ht; // convert to float after check if empty value // Clean parameters $this->desc = trim($this->desc); From 350697832db7339e89343d4f5597fc47275b4d01 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 17:35:32 +0100 Subject: [PATCH 2/8] FIX remove unused code --- htdocs/compta/facture/class/facture.class.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 00caede5161..0b7681257a7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6311,9 +6311,6 @@ class FactureLigne extends CommonInvoiceLine $this->situation_percent = 100; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->multicurrency_subprice)) { $this->multicurrency_subprice = 0; } @@ -6543,9 +6540,6 @@ class FactureLigne extends CommonInvoiceLine if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') { $this->situation_percent = 100; } - if (empty($this->pa_ht)) { - $this->pa_ht = 0; - } if (empty($this->multicurrency_subprice)) { $this->multicurrency_subprice = 0; From b1c82f4dbbf0daafd61d3021c68edfd11554abae Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 5 Jan 2025 17:38:04 +0100 Subject: [PATCH 3/8] FIX phan --- htdocs/comm/propal/class/propal.class.php | 5 +++++ htdocs/compta/facture/class/facture.class.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6fa8a2bd379..a27eca21f18 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4025,6 +4025,11 @@ class PropaleLigne extends CommonObjectLine public $rang = 0; public $fk_fournprice; + + /** + * Buy price without taxes + * @var float|string|null + */ public $pa_ht; public $marge_tx; public $marque_tx; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0b7681257a7..375a9eb087a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6089,6 +6089,11 @@ class FactureLigne extends CommonInvoiceLine public $rang = 0; public $fk_fournprice; + + /** + * Buy price without taxes + * @var float|string|null + */ public $pa_ht; public $marge_tx; public $marque_tx; From 43db619e5e6267221da4eb906c6e4c6979546cc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Jan 2025 00:02:39 +0100 Subject: [PATCH 4/8] FIX Must not have both thirdparty and member. --- htdocs/partnership/class/partnership.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 0355ae0e9e8..3b1416a3615 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -151,7 +151,7 @@ class Partnership extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -159,9 +159,11 @@ class Partnership extends CommonObject $this->isextrafieldmanaged = 1; if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { - $this->fields['fk_member'] = array('type' => 'integer:Adherent:adherents/class/adherent.class.php:1', 'label' => 'Member', 'enabled' => '1', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'member', 'csslist' => 'tdoverflowmax150'); + $this->fields['fk_member'] = array('type' => 'integer:Adherent:adherents/class/adherent.class.php:1', 'label' => 'Member', 'enabled' => '1', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'member', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax150'); + unset($this->fields['fk_soc']); } else { $this->fields['fk_soc'] = array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'enabled' => '1', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax150'); + unset($this->fields['fk_member']); } if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { From fde52c9ae798e911aa2619bdc9b5cb45989bf4ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Jan 2025 01:28:01 +0100 Subject: [PATCH 5/8] FIX #32113 --- 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 508e4ec172a..2cbcca4b9a9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12861,7 +12861,7 @@ function getElementProperties($elementType) $classfile = 'mailing'; $classname = 'Mailing'; $subelement = ''; - } elseif ($elementType == 'member') { + } elseif ($elementType == 'member' || $elementType == 'adherent') { $classpath = 'adherents/class'; $module = 'adherent'; $subelement = 'adherent'; From 584a0a8afe911fd82cf186d57f7ba603f657aca3 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Mon, 6 Jan 2025 15:28:46 +0100 Subject: [PATCH 6/8] Empty child warehouse sql error --- htdocs/product/inventory/class/inventory.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index c1c7772f37a..a1e9da17a1c 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -297,7 +297,9 @@ class Inventory extends CommonObject if (!empty($include_sub_warehouse) && getDolGlobalInt('INVENTORY_INCLUDE_SUB_WAREHOUSE')) { $TChildWarehouses = array(); $this->getChildWarehouse($this->fk_warehouse, $TChildWarehouses); - $sql .= " OR ps.fk_entrepot IN (".$this->db->sanitize(implode(',', $TChildWarehouses)).")"; + if (!empty($TChildWarehouses)){ + $sql .= " OR ps.fk_entrepot IN (".$this->db->sanitize(implode(',', $TChildWarehouses)).")"; + } } $sql .= ')'; } From 39108e70c49b6ac9c2dadd312bb6eee64dcb9798 Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Mon, 6 Jan 2025 15:36:56 +0100 Subject: [PATCH 7/8] php error --- htdocs/product/inventory/class/inventory.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index a1e9da17a1c..890bce9870c 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -297,8 +297,8 @@ class Inventory extends CommonObject if (!empty($include_sub_warehouse) && getDolGlobalInt('INVENTORY_INCLUDE_SUB_WAREHOUSE')) { $TChildWarehouses = array(); $this->getChildWarehouse($this->fk_warehouse, $TChildWarehouses); - if (!empty($TChildWarehouses)){ - $sql .= " OR ps.fk_entrepot IN (".$this->db->sanitize(implode(',', $TChildWarehouses)).")"; + if (!empty($TChildWarehouses)) { + $sql .= " OR ps.fk_entrepot IN (" . $this->db->sanitize(implode(',', $TChildWarehouses)) . ")"; } } $sql .= ')'; From 40e59d853bfcc1ccec46928ca89248a8279a9629 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 6 Jan 2025 16:07:15 +0100 Subject: [PATCH 8/8] FIX: switch on/off status of a page of the second website. --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d2ffdb68c48..b17f0e6f92c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3295,7 +3295,7 @@ if (!GETPOST('hide_websitemenu')) { print ''.img_picto($langs->trans($text_off), 'switch_on').''; } } else { - print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.(empty($websitepage->id) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'pageid='.$websitepage->id); + print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.(empty($websitepage->id) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'website='.urlencode($website->ref).'&pageid='.((int) $websitepage->id)); } //print ''; print '';