diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3359667e3b2..31bb5a8dd73 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -666,7 +666,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 { @@ -894,7 +894,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 } diff --git a/htdocs/comm/propal/class/propaleligne.class.php b/htdocs/comm/propal/class/propaleligne.class.php index 534b9413c79..ea403b5b363 100644 --- a/htdocs/comm/propal/class/propaleligne.class.php +++ b/htdocs/comm/propal/class/propaleligne.class.php @@ -457,6 +457,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)) { @@ -501,9 +502,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; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 517a8698581..069b76a9c88 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3176,7 +3176,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' diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0d1435fa918..a3e40af94e9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3946,11 +3946,13 @@ class Facture extends CommonInvoice } $remise_percent = (float) price2num($remise_percent); + $qty = (float) price2num($qty); $pu_ht = (float) price2num($pu_ht); $pu_ht_devise = (float) price2num($pu_ht_devise); $pu_ttc = (float) price2num($pu_ttc); - $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 + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } @@ -4208,10 +4210,12 @@ class Facture extends CommonInvoice } $remise_percent = (float) price2num($remise_percent); + $qty = (float) price2num($qty); $pu = (float) price2num($pu); $pu_ht_devise = (float) price2num($pu_ht_devise); - $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 + if (!preg_match('/\((.*)\)/', (string) $txtva)) { $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' } diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php index 324cbf2175d..e4e2b1a3ae2 100644 --- a/htdocs/compta/facture/class/factureligne.class.php +++ b/htdocs/compta/facture/class/factureligne.class.php @@ -302,6 +302,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 but after checking if value is empty dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG); @@ -356,9 +357,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; } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 65fd4a1c1ce..11e577643bb 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -293,7 +293,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 .= ')'; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index aa9b1a64c50..fc11f5ec7ff 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3327,7 +3327,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 '';