diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c633ac44b74..a27eca21f18 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 } @@ -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; @@ -4234,6 +4239,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 +4284,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 +4456,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 +4511,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..375a9eb087a 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' } @@ -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; @@ -6256,6 +6261,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); @@ -6310,9 +6316,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; } @@ -6496,6 +6499,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); @@ -6541,9 +6545,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; 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'; 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'])) {