From aaae4e7bc61167639b54602beb5f77e99e62ac08 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Tue, 25 Feb 2025 15:55:58 +0100 Subject: [PATCH] Fix CI-PULL-REQUEST / pre-commit / pre-commit (pull_request) --- htdocs/product/class/productcustomerprice.class.php | 8 ++++---- htdocs/product/price.php | 12 ++++++------ htdocs/societe/price.php | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index a4883362f8f..412e4c8121e 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -143,11 +143,11 @@ class ProductCustomerPrice extends CommonObject */ public $remise_percent; /** - * @var string + * @var string|int */ public $date_begin = ''; /** - * @var string + * @var string|int */ public $date_end = ''; @@ -896,7 +896,7 @@ class ProductCustomerPrice extends CommonObject $sql .= " localtax2_tx=".(isset($this->localtax2_tx) ? (empty($this->localtax2_tx) ? 0 : $this->localtax2_tx) : "null").","; $sql .= " localtax1_type=".(!empty($this->localtax1_type) ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'").","; $sql .= " localtax2_type=".(!empty($this->localtax2_type) ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'").","; - $sql .= " remise_percent=".(isset($this->remise_percent) ? price2num($this->remise_percent) : "null").","; + $sql .= " remise_percent=".(!empty($this->remise_percent) ? "'".price2num($this->remise_percent)."'" : "0").","; $sql .= " date_begin='".$this->db->idate(!empty($this->date_begin) ? $this->date_begin : $now)."',"; $sql .= " date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").","; $sql .= " fk_user=".((int) $user->id).","; @@ -1252,7 +1252,7 @@ class PriceByCustomerLine extends CommonObjectLine */ public $localtax2_tx; /** - * @var float + * @var float|string|'' */ public $remise_percent; /** diff --git a/htdocs/product/price.php b/htdocs/product/price.php index eff87f5f275..a107e7fe8e0 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -755,8 +755,8 @@ if (empty($reshook)) { $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->price_label = GETPOST("price_label", 'alpha'); $prodcustprice->remise_percent = price2num(GETPOST("remise_percent")); - $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; - $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server $extralabels = $extrafields->fetch_name_optionals_label("product_customer_price"); $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price"); @@ -910,8 +910,8 @@ if (empty($reshook)) { $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->price_label = GETPOST("price_label", 'alpha'); $prodcustprice->remise_percent = price2num(GETPOST("remise_percent")); - $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; - $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server $extralabels = $extrafields->fetch_name_optionals_label("product_customer_price"); $extrafield_values = $extrafields->getOptionalsFromPost("product_customer_price"); @@ -2049,13 +2049,13 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT print ''; // Applied Prices From - $date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; print ''.$langs->trans("AppliedPricesFrom").''; print $form->selectDate(!empty($date_begin) ? $date_begin : dol_now(), "date_begin", 0, 0, 1, "date_begin"); print ''; // Applied Prices To - $date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server print ''.$langs->trans("AppliedPricesTo").''; print $form->selectDate($date_end, "date_end", 0, 0, 1, "date_end"); print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index d8365b8640c..5ff8eed8a1b 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -116,8 +116,8 @@ if (empty($reshook)) { $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->remise_percent = price2num(GETPOST("remise_percent")); - $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; - $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' @@ -217,8 +217,8 @@ if (empty($reshook)) { $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); $prodcustprice->remise_percent = price2num(GETPOST("remise_percent")); - $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; - $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $prodcustprice->date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $prodcustprice->date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result > 0) { @@ -383,13 +383,13 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT print ''; // Applied Prices From - $date_begin = dol_mktime(0, 0, 0, GETPOST('date_beginmonth', 'int'), GETPOST('date_beginday', 'int'), GETPOST('date_beginyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; + $date_begin = dol_mktime(0, 0, 0, GETPOSTINT('date_beginmonth'), GETPOSTINT('date_beginday'), GETPOSTINT('date_beginyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server; print ''.$langs->trans("AppliedPricesFrom").''; print $form->selectDate(!empty($date_begin) ? $date_begin : dol_now(), "date_begin", 0, 0, 1, "date_begin"); print ''; // Applied Prices To - $date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server + $date_end = dol_mktime(0, 0, 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server print ''.$langs->trans("AppliedPricesTo").''; print $form->selectDate($date_end, "date_end", 0, 0, 1, "date_end"); print '';