forked from Wavyzz/dolibarr
Qual: Fix phan/stan notices for conferenceorbooth, facture-re, productcustomerprice (#31541)
This commit is contained in:
@@ -491,7 +491,7 @@ return [
|
|||||||
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
|
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
|
||||||
'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'],
|
'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||||
'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'],
|
'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||||
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
|
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
|
||||||
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
|
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
|
||||||
'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
|
||||||
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||||
@@ -639,7 +639,6 @@ return [
|
|||||||
'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
|
'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
|
||||||
'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
|
'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
|
||||||
'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
|
'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
|
||||||
'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
|
|
||||||
'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
|
'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
|
||||||
'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'],
|
'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'],
|
||||||
'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'],
|
'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'],
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$productdesc = $prod->description;
|
$productdesc = $prod->description;
|
||||||
|
|
||||||
$tva_tx = get_default_tva($mysoc, $this->thirdparty, $prod->id);
|
$tva_tx = (string) get_default_tva($mysoc, $this->thirdparty, $prod->id);
|
||||||
$tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
|
$tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
|
||||||
if (empty($tva_tx)) {
|
if (empty($tva_tx)) {
|
||||||
$tva_npr = 0;
|
$tva_npr = 0;
|
||||||
@@ -1488,14 +1488,14 @@ class Propal extends CommonObject
|
|||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
if ($update_prices === true) {
|
if ($update_prices === true) {
|
||||||
$pu_ht = $prod->price;
|
$pu_ht = $prod->price;
|
||||||
$tva_tx = get_default_tva($mysoc, $objsoc, $prod->id);
|
$tva_tx = (string) get_default_tva($mysoc, $objsoc, $prod->id);
|
||||||
$remise_percent = $objsoc->remise_percent;
|
$remise_percent = $objsoc->remise_percent;
|
||||||
|
|
||||||
if (getDolGlobalString('PRODUIT_MULTIPRICES') && $objsoc->price_level > 0) {
|
if (getDolGlobalString('PRODUIT_MULTIPRICES') && $objsoc->price_level > 0) {
|
||||||
$pu_ht = $prod->multiprices[$objsoc->price_level];
|
$pu_ht = $prod->multiprices[$objsoc->price_level];
|
||||||
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility
|
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility
|
||||||
if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) {
|
if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) {
|
||||||
$tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level];
|
$tva_tx = (string) $prod->multiprices_tva_tx[$objsoc->price_level];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
|
} elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
|
||||||
|
|||||||
@@ -859,7 +859,7 @@ if (empty($reshook)) {
|
|||||||
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
|
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
|
||||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
|
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', (string) $tva_tx)) {
|
||||||
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||||
}
|
}
|
||||||
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
||||||
@@ -871,7 +871,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment
|
if (!$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment
|
||||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
|
|||||||
/**
|
/**
|
||||||
* Add a delay to a date
|
* Add a delay to a date
|
||||||
*
|
*
|
||||||
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
|
* @param int|string $time Date timestamp (or string with format YYYY-MM-DD)
|
||||||
* @param float $duration_value Value of delay to add
|
* @param float $duration_value Value of delay to add
|
||||||
* @param string $duration_unit Unit of added delay (d, m, y, w, h, i)
|
* @param string $duration_unit Unit of added delay (d, m, y, w, h, i)
|
||||||
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
|
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
|
||||||
|
|||||||
@@ -12700,7 +12700,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
|||||||
* An function to complete dropdown url in dolGetButtonAction
|
* An function to complete dropdown url in dolGetButtonAction
|
||||||
*
|
*
|
||||||
* @param string $url the Url to complete
|
* @param string $url the Url to complete
|
||||||
* @param array|array<string> $params params of dolGetButtonAction function
|
* @param array<string,mixed> $params params of dolGetButtonAction function
|
||||||
* @param bool $addDolUrlRoot to add root url
|
* @param bool $addDolUrlRoot to add root url
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $picto = 'contact';
|
public $picto = 'contact';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int<0,1>
|
||||||
|
*/
|
||||||
public $paid = 0;
|
public $paid = 0;
|
||||||
|
|
||||||
const STATUS_DRAFT = 0;
|
const STATUS_DRAFT = 0;
|
||||||
@@ -116,25 +119,85 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => 1, 'position' => 900, 'notnull' => -1, 'visible' => -2,),
|
'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => 1, 'position' => 900, 'notnull' => -1, 'visible' => -2,),
|
||||||
'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),),
|
'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),),
|
||||||
);
|
);
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $rowid;
|
public $rowid;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $ref;
|
public $ref;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_actioncomm;
|
public $fk_actioncomm;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_project;
|
public $fk_project;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $email;
|
public $email;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $firstname;
|
public $firstname;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $lastname;
|
public $lastname;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_soc;
|
public $fk_soc;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $email_company;
|
public $email_company;
|
||||||
|
/**
|
||||||
|
* @var int|string
|
||||||
|
*/
|
||||||
public $date_subscription;
|
public $date_subscription;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_invoice;
|
public $fk_invoice;
|
||||||
|
/**
|
||||||
|
* @var string|float (Price)
|
||||||
|
*/
|
||||||
public $amount;
|
public $amount;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $note_public;
|
public $note_public;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $note_private;
|
public $note_private;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_user_creat;
|
public $fk_user_creat;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $fk_user_modif;
|
public $fk_user_modif;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $last_main_doc;
|
public $last_main_doc;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $import_key;
|
public $import_key;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $model_pdf;
|
public $model_pdf;
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
@@ -556,12 +619,12 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Define new ref
|
// Define new ref
|
||||||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
$num = (string) $this->ref;
|
||||||
|
if (!$error && (preg_match('/^[\(]?PROV/i', $num) || empty($num))) { // empty should not happened, but when it occurs, the test saves life
|
||||||
$num = $this->getNextNumRef();
|
$num = $this->getNextNumRef();
|
||||||
} else {
|
|
||||||
$num = $this->ref;
|
|
||||||
}
|
}
|
||||||
$this->newref = $num;
|
|
||||||
|
$this->newref = (string) $num;
|
||||||
|
|
||||||
if (!empty($num)) {
|
if (!empty($num)) {
|
||||||
// Validate
|
// Validate
|
||||||
@@ -1108,7 +1171,7 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param Translate $langs Language object for translation of civility (used only if option is 1)
|
* @param Translate $langs Language object for translation of civility (used only if option is 1)
|
||||||
* @param int $option 0=No option
|
* @param int $option 0=No option
|
||||||
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
|
* @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
|
||||||
* @param int $maxlen Maximum length
|
* @param int $maxlen Maximum length
|
||||||
* @return string String with full name
|
* @return string String with full name
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ if (empty($reshook)) {
|
|||||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||||
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
||||||
$object->usenewprice = GETPOST('usenewprice', 'alpha');
|
$object->usenewprice = GETPOSTINT('usenewprice');
|
||||||
|
|
||||||
$object->frequency = $frequency;
|
$object->frequency = $frequency;
|
||||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $datec = '';
|
public $datec = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,18 +84,57 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $ref_customer;
|
public $ref_customer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float|''
|
||||||
|
*/
|
||||||
public $price;
|
public $price;
|
||||||
|
/**
|
||||||
|
* @var float|''
|
||||||
|
*/
|
||||||
public $price_ttc;
|
public $price_ttc;
|
||||||
|
/**
|
||||||
|
* @var float|string|''
|
||||||
|
*/
|
||||||
public $price_min;
|
public $price_min;
|
||||||
|
/**
|
||||||
|
* @var float|string|''
|
||||||
|
*/
|
||||||
public $price_min_ttc;
|
public $price_min_ttc;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $price_base_type;
|
public $price_base_type;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $default_vat_code;
|
public $default_vat_code;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $tva_tx;
|
public $tva_tx;
|
||||||
|
/**
|
||||||
|
* @var int|string
|
||||||
|
*/
|
||||||
public $recuperableonly;
|
public $recuperableonly;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $localtax1_type;
|
public $localtax1_type;
|
||||||
|
/**
|
||||||
|
* @var float|''
|
||||||
|
*/
|
||||||
public $localtax1_tx;
|
public $localtax1_tx;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $localtax2_type;
|
public $localtax2_type;
|
||||||
|
/**
|
||||||
|
* @var float|''
|
||||||
|
*/
|
||||||
public $localtax2_tx;
|
public $localtax2_tx;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $price_label;
|
public $price_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,7 +201,7 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
$this->price_base_type = trim($this->price_base_type);
|
$this->price_base_type = trim($this->price_base_type);
|
||||||
}
|
}
|
||||||
if (isset($this->tva_tx)) {
|
if (isset($this->tva_tx)) {
|
||||||
$this->tva_tx = (float) $this->tva_tx;
|
$this->tva_tx = trim($this->tva_tx);
|
||||||
}
|
}
|
||||||
if (isset($this->recuperableonly)) {
|
if (isset($this->recuperableonly)) {
|
||||||
$this->recuperableonly = trim($this->recuperableonly);
|
$this->recuperableonly = trim($this->recuperableonly);
|
||||||
@@ -184,14 +226,15 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
if ($this->price != '' || $this->price == 0) {
|
if ($this->price != '' || $this->price == 0) {
|
||||||
|
$vatRate = (float) $this->tva_tx;
|
||||||
if ($this->price_base_type == 'TTC') {
|
if ($this->price_base_type == 'TTC') {
|
||||||
$this->price_ttc = price2num($this->price, 'MU');
|
$this->price_ttc = price2num($this->price, 'MU');
|
||||||
$this->price = (float) price2num($this->price) / (1 + ($this->tva_tx / 100));
|
$this->price = (float) price2num($this->price) / (1 + ($vatRate / 100));
|
||||||
$this->price = price2num($this->price, 'MU');
|
$this->price = price2num($this->price, 'MU');
|
||||||
|
|
||||||
if ($this->price_min != '' || $this->price_min == 0) {
|
if ($this->price_min != '' || $this->price_min == 0) {
|
||||||
$this->price_min_ttc = price2num($this->price_min, 'MU');
|
$this->price_min_ttc = price2num($this->price_min, 'MU');
|
||||||
$this->price_min = (float) price2num($this->price_min) / (1 + ($this->tva_tx / 100));
|
$this->price_min = (float) price2num($this->price_min) / (1 + ($vatRate / 100));
|
||||||
$this->price_min = price2num($this->price_min, 'MU');
|
$this->price_min = price2num($this->price_min, 'MU');
|
||||||
} else {
|
} else {
|
||||||
$this->price_min = 0;
|
$this->price_min = 0;
|
||||||
@@ -199,12 +242,12 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->price = price2num($this->price, 'MU');
|
$this->price = price2num($this->price, 'MU');
|
||||||
$this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($this->tva_tx / 100)) : $this->price;
|
$this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($vatRate / 100)) : $this->price;
|
||||||
$this->price_ttc = price2num($this->price_ttc, 'MU');
|
$this->price_ttc = price2num($this->price_ttc, 'MU');
|
||||||
|
|
||||||
if ($this->price_min != '' || $this->price_min == 0) {
|
if ($this->price_min != '' || $this->price_min == 0) {
|
||||||
$this->price_min = price2num($this->price_min, 'MU');
|
$this->price_min = price2num($this->price_min, 'MU');
|
||||||
$this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($this->tva_tx / 100));
|
$this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($vatRate / 100));
|
||||||
$this->price_min_ttc = price2num($this->price_min_ttc, 'MU');
|
$this->price_min_ttc = price2num($this->price_min_ttc, 'MU');
|
||||||
// print 'X'.$newminprice.'-'.$price_min;
|
// print 'X'.$newminprice.'-'.$price_min;
|
||||||
} else {
|
} else {
|
||||||
@@ -383,7 +426,7 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param int $limit Limit page
|
* @param int $limit Limit page
|
||||||
* @param int $offset offset
|
* @param int $offset offset
|
||||||
* @param string|array $filter Filter USF.
|
* @param string|array<string,string> $filter Filter USF.
|
||||||
* @return int Return integer <0 if KO, >0 if OK
|
* @return int Return integer <0 if KO, >0 if OK
|
||||||
* @since dolibarr v17
|
* @since dolibarr v17
|
||||||
*/
|
*/
|
||||||
@@ -513,12 +556,12 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load all objects in memory from database
|
* Load all objects in memory from database
|
||||||
*
|
*
|
||||||
* @param string $sortorder order
|
* @param string $sortorder order
|
||||||
* @param string $sortfield field
|
* @param string $sortfield field
|
||||||
* @param int $limit page
|
* @param int $limit page
|
||||||
* @param int $offset offset
|
* @param int $offset offset
|
||||||
* @param array $filter Filter for sql request
|
* @param array<string,mixed> $filter Filter for sql request
|
||||||
* @return int Return integer <0 if KO, >0 if OK
|
* @return int Return integer <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAllLog($sortorder, $sortfield, $limit, $offset, $filter = array())
|
public function fetchAllLog($sortorder, $sortfield, $limit, $offset, $filter = array())
|
||||||
{
|
{
|
||||||
@@ -622,10 +665,10 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Update object into database
|
* Update object into database
|
||||||
*
|
*
|
||||||
* @param User $user that modifies
|
* @param User $user User making modification
|
||||||
* @param int $notrigger triggers after, 1=disable triggers
|
* @param int<0,1> $notrigger Triggers after, 1=disable triggers
|
||||||
* @param int $forceupdateaffiliate update price on each soc child
|
* @param int<0,1> $forceupdateaffiliate Update price on each soc child
|
||||||
* @return int Return integer <0 if KO, >0 if OK
|
* @return int Return integer <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0)
|
public function update(User $user, $notrigger = 0, $forceupdateaffiliate = 0)
|
||||||
{
|
{
|
||||||
@@ -647,31 +690,31 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
$this->ref_customer = trim($this->ref_customer);
|
$this->ref_customer = trim($this->ref_customer);
|
||||||
}
|
}
|
||||||
if (isset($this->price)) {
|
if (isset($this->price)) {
|
||||||
$this->price = trim($this->price);
|
$this->price = trim((string) $this->price);
|
||||||
}
|
}
|
||||||
if (isset($this->price_ttc)) {
|
if (isset($this->price_ttc)) {
|
||||||
$this->price_ttc = trim($this->price_ttc);
|
$this->price_ttc = trim((string) $this->price_ttc);
|
||||||
}
|
}
|
||||||
if (isset($this->price_min)) {
|
if (isset($this->price_min)) {
|
||||||
$this->price_min = trim($this->price_min);
|
$this->price_min = trim((string) $this->price_min);
|
||||||
}
|
}
|
||||||
if (isset($this->price_min_ttc)) {
|
if (isset($this->price_min_ttc)) {
|
||||||
$this->price_min_ttc = trim($this->price_min_ttc);
|
$this->price_min_ttc = trim((string) $this->price_min_ttc);
|
||||||
}
|
}
|
||||||
if (isset($this->price_base_type)) {
|
if (isset($this->price_base_type)) {
|
||||||
$this->price_base_type = trim($this->price_base_type);
|
$this->price_base_type = trim($this->price_base_type);
|
||||||
}
|
}
|
||||||
if (isset($this->tva_tx)) {
|
if (isset($this->tva_tx)) {
|
||||||
$this->tva_tx = (float) $this->tva_tx;
|
$this->tva_tx = trim($this->tva_tx);
|
||||||
}
|
}
|
||||||
if (isset($this->recuperableonly)) {
|
if (isset($this->recuperableonly)) {
|
||||||
$this->recuperableonly = trim($this->recuperableonly);
|
$this->recuperableonly = trim((string) $this->recuperableonly);
|
||||||
}
|
}
|
||||||
if (isset($this->localtax1_tx)) {
|
if (isset($this->localtax1_tx)) {
|
||||||
$this->localtax1_tx = trim($this->localtax1_tx);
|
$this->localtax1_tx = trim((string) $this->localtax1_tx);
|
||||||
}
|
}
|
||||||
if (isset($this->localtax2_tx)) {
|
if (isset($this->localtax2_tx)) {
|
||||||
$this->localtax2_tx = trim($this->localtax2_tx);
|
$this->localtax2_tx = trim((string) $this->localtax2_tx);
|
||||||
}
|
}
|
||||||
if (isset($this->fk_user)) {
|
if (isset($this->fk_user)) {
|
||||||
$this->fk_user = (int) $this->fk_user;
|
$this->fk_user = (int) $this->fk_user;
|
||||||
@@ -687,14 +730,15 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
if ($this->price != '' || $this->price == 0) {
|
if ($this->price != '' || $this->price == 0) {
|
||||||
|
$vatRate = (float) $this->tva_tx;
|
||||||
if ($this->price_base_type == 'TTC') {
|
if ($this->price_base_type == 'TTC') {
|
||||||
$this->price_ttc = price2num($this->price, 'MU');
|
$this->price_ttc = price2num($this->price, 'MU');
|
||||||
$this->price = (float) price2num($this->price) / (1 + ($this->tva_tx / 100));
|
$this->price = (float) price2num($this->price) / (1 + ($vatRate / 100));
|
||||||
$this->price = price2num($this->price, 'MU');
|
$this->price = price2num($this->price, 'MU');
|
||||||
|
|
||||||
if ($this->price_min != '' || $this->price_min == 0) {
|
if ($this->price_min != '' || $this->price_min == 0) {
|
||||||
$this->price_min_ttc = price2num($this->price_min, 'MU');
|
$this->price_min_ttc = price2num($this->price_min, 'MU');
|
||||||
$this->price_min = (float) price2num($this->price_min) / (1 + ($this->tva_tx / 100));
|
$this->price_min = (float) price2num($this->price_min) / (1 + ($vatRate / 100));
|
||||||
$this->price_min = price2num($this->price_min, 'MU');
|
$this->price_min = price2num($this->price_min, 'MU');
|
||||||
} else {
|
} else {
|
||||||
$this->price_min = 0;
|
$this->price_min = 0;
|
||||||
@@ -702,12 +746,12 @@ class ProductCustomerPrice extends CommonObject
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->price = price2num($this->price, 'MU');
|
$this->price = price2num($this->price, 'MU');
|
||||||
$this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($this->tva_tx / 100)) : $this->price;
|
$this->price_ttc = ($this->recuperableonly != 1) ? (float) price2num($this->price) * (1 + ($vatRate / 100)) : $this->price;
|
||||||
$this->price_ttc = price2num($this->price_ttc, 'MU');
|
$this->price_ttc = price2num($this->price_ttc, 'MU');
|
||||||
|
|
||||||
if ($this->price_min != '' || $this->price_min == 0) {
|
if ($this->price_min != '' || $this->price_min == 0) {
|
||||||
$this->price_min = price2num($this->price_min, 'MU');
|
$this->price_min = price2num($this->price_min, 'MU');
|
||||||
$this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($this->tva_tx / 100));
|
$this->price_min_ttc = (float) price2num($this->price_min) * (1 + ($vatRate / 100));
|
||||||
$this->price_min_ttc = price2num($this->price_min_ttc, 'MU');
|
$this->price_min_ttc = price2num($this->price_min_ttc, 'MU');
|
||||||
// print 'X'.$newminprice.'-'.$price_min;
|
// print 'X'.$newminprice.'-'.$price_min;
|
||||||
} else {
|
} else {
|
||||||
@@ -1083,6 +1127,9 @@ class PriceByCustomerLine extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string|int
|
||||||
|
*/
|
||||||
public $datec = '';
|
public $datec = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1100,24 +1147,66 @@ class PriceByCustomerLine extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
public $fk_soc;
|
public $fk_soc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $price;
|
public $price;
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $price_ttc;
|
public $price_ttc;
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $price_min;
|
public $price_min;
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $price_min_ttc;
|
public $price_min_ttc;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $price_base_type;
|
public $price_base_type;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $default_vat_code;
|
public $default_vat_code;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $tva_tx;
|
public $tva_tx;
|
||||||
|
/**
|
||||||
|
* @var int|string
|
||||||
|
*/
|
||||||
public $recuperableonly;
|
public $recuperableonly;
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $localtax1_tx;
|
public $localtax1_tx;
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $localtax2_tx;
|
public $localtax2_tx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int User ID
|
* @var int User ID
|
||||||
*/
|
*/
|
||||||
public $fk_user;
|
public $fk_user;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $price_label;
|
public $price_label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $import_key;
|
public $import_key;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $socname;
|
public $socname;
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $prodref;
|
public $prodref;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ parameters:
|
|||||||
reportMagicProperties: false
|
reportMagicProperties: false
|
||||||
treatPhpDocTypesAsCertain: false
|
treatPhpDocTypesAsCertain: false
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
|
- '#Unable to resolve the template type T#'
|
||||||
- '#Offset .* (?:isset\(\)) always exists and is not nullable#'
|
- '#Offset .* (?:isset\(\)) always exists and is not nullable#'
|
||||||
- '#(?:Variable \$(?:_(?:FILES|POST|SERVER)|array_propal_object|baseUri|current_fiscal_period|d(?:b_create_(?:database|user)|olibarr_main_(?:db_prefix|url_root)|raftchecked)|erreur_ajout_date|isImageValid|keyforstripeterminalbank|(?:lo|mar)gin|max|n(?:ewProperty|um)|p(?:ermsgroupbyentitypluszero|ro(?:gressCalculated|parrayofkeyval)|ublic)|t(?:(?:itl|otal_tim)e|va_tx)|var)) in isset\(\) always exists and is not nullable#'
|
- '#(?:Variable \$(?:_(?:FILES|POST|SERVER)|array_propal_object|baseUri|current_fiscal_period|d(?:b_create_(?:database|user)|olibarr_main_(?:db_prefix|url_root)|raftchecked)|erreur_ajout_date|isImageValid|keyforstripeterminalbank|(?:lo|mar)gin|max|n(?:ewProperty|um)|p(?:ermsgroupbyentitypluszero|ro(?:gressCalculated|parrayofkeyval)|ublic)|t(?:(?:itl|otal_tim)e|va_tx)|var)) in isset\(\) always exists and is not nullable#'
|
||||||
- '#(?:Property CommonOrderLine::\$multicurrency_subprice \(float\) on left side of \?\?|isset\(\)) is not nullable#'
|
- '#(?:Property CommonOrderLine::\$multicurrency_subprice \(float\) on left side of \?\?|isset\(\)) is not nullable#'
|
||||||
|
|||||||
Reference in New Issue
Block a user