Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-06 16:18:42 +01:00
commit 3987fc6289
7 changed files with 15 additions and 13 deletions

View file

@ -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
}

View file

@ -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;
}

View file

@ -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'

View file

@ -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'
}

View file

@ -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;
}

View file

@ -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 .= ')';
}

View file

@ -3327,7 +3327,7 @@ if (!GETPOST('hide_websitemenu')) {
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_on').'</span>';
}
} 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 '</div>';
print '</span>';