-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32994 from mdeweerd/phan/fix2025.2.8.product-2
Qual: Fix phan (product-2)
- Loading branch information
Showing
25 changed files
with
200 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* Copyright (C) 2011-2015 Juanjo Menent <[email protected]> | ||
* Copyright (C) 2017 Ferran Marcet <[email protected]> | ||
* Copyright (C) 2018-2024 Charlene Benke <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
|
@@ -373,8 +373,8 @@ function convertDurationtoHour($duration_value, $duration_unit) | |
* @param int|string $month_date Month date (Can be 0 or '' for filter on a year) | ||
* @param int|string $year_date Year date | ||
* @param int $excludefirstand Exclude first and | ||
* @param mixed $gm False or 0 or 'tzserver' = Input date fields are date info in the server TZ. True or 1 or 'gmt' = Input are date info in GMT TZ. | ||
* Note: In database, dates are always for the server TZ. | ||
* @param bool|int<0,1>|'gmt'|'tzserver'|'tzref'|'tzuser'|'tzuserrel' $gm False or 0 or 'tzserver' = Input date fields are date info in the server TZ. True or 1 or 'gmt' = Input are date info in GMT TZ. | ||
* Note: In database, dates are always for the server TZ. | ||
* @return string $sqldate String with SQL filter | ||
* @see forgeSQLFromUniversalSearchCriteria() | ||
* @see natural_search() | ||
|
@@ -420,8 +420,8 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu | |
* YYYY-MM-DDTHH:MM:SSZ (RFC3339) | ||
* DD/MM/YY or DD/MM/YYYY (deprecated) | ||
* DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) | ||
* @param int|string $gm 'gmt' or 1 =Input date is GM date, | ||
* 'tzserver' or 0 =Input date is date using PHP server timezone | ||
* @param int<0,1>|'gmt'|'tzserver'|'tzref'|'tzuser'|'tzuserrel'|'dayrfc' $gm 'gmt' or 1 =Input date is GM date, | ||
* 'tzserver' or 0 =Input date is date using PHP server timezone | ||
* @return int Date as a timestamp | ||
* 19700101020000 -> 7200 with gm=1 | ||
* 19700101000000 -> 0 with gm=1 | ||
|
@@ -589,12 +589,12 @@ function dol_get_next_week($day, $week, $month, $year) | |
/** | ||
* Return GMT time for first day of a month or year | ||
* | ||
* @param int $year Year | ||
* @param int $month Month | ||
* @param bool|int|string $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* Example: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, a dol_print_date on it will return 1970-01-01 00:00:00 | ||
* Example: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, a dol_print_date on it will return 1970-01-01 00:00:00 | ||
* @param int $year Year | ||
* @param int $month Month | ||
* @param bool|int<0,1>|'gmt'|'tzserver'|'tzref'|'tzuser'|'tzuserrel' $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* Example: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, a dol_print_date on it will return 1970-01-01 00:00:00 | ||
* Example: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, a dol_print_date on it will return 1970-01-01 00:00:00 | ||
* @return int|string Date as a timestamp, '' if error | ||
*/ | ||
function dol_get_first_day($year, $month = 1, $gm = false) | ||
|
@@ -612,8 +612,8 @@ function dol_get_first_day($year, $month = 1, $gm = false) | |
* | ||
* @param int $year Year | ||
* @param int $month Month | ||
* @param bool|int|string $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* @param bool|int<0,1>|'gmt'|'tzserver'|'tzref'|'tzuser'|'tzuserrel' $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* @return int|string Date as a timestamp, '' if error | ||
*/ | ||
function dol_get_last_day($year, $month = 12, $gm = false) | ||
|
@@ -665,11 +665,11 @@ function dol_get_first_hour($date, $gm = 'tzserver') | |
|
||
/** Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1. | ||
* | ||
* @param int $day Day | ||
* @param int $month Month | ||
* @param int $year Year | ||
* @param bool|int|'tzserver' $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* @param int $day Day | ||
* @param int $month Month | ||
* @param int $year Year | ||
* @param bool|int<0,1>|'gmt'|'tzserver'|'tzref'|'tzuser'|'tzuserrel' $gm False or 0 or 'tzserver' = Return date to compare with server TZ, | ||
* True or 1 or 'gmt' to compare with GMT date. | ||
* @return array{year:int,month:int,week:string,first_day:int,first_month:int,first_year:int,prev_year:int,prev_month:int,prev_day:int} | ||
*/ | ||
function dol_get_first_day_week($day, $month, $year, $gm = false) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/* Copyright (C) 2007-2012 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2014 Florian Henry <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -282,8 +282,8 @@ public function create($user, $notrigger = 0, $forceupdateaffiliate = 0) | |
$sql .= ") VALUES ("; | ||
$sql .= " ".((int) $conf->entity).","; | ||
$sql .= " '".$this->db->idate(dol_now())."',"; | ||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").","; | ||
$sql .= " ".(!isset($this->fk_soc) ? 'NULL' : "'".$this->db->escape($this->fk_soc)."'").","; | ||
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : ((int) $this->fk_product)).","; | ||
$sql .= " ".(!isset($this->fk_soc) ? 'NULL' : ((int) $this->fk_soc)).","; | ||
$sql .= " ".(!isset($this->ref_customer) ? 'NULL' : "'".$this->db->escape($this->ref_customer)."'").","; | ||
$sql .= " ".(empty($this->price) ? '0' : "'".$this->db->escape($this->price)."'").","; | ||
$sql .= " ".(empty($this->price_ttc) ? '0' : "'".$this->db->escape($this->price_ttc)."'").","; | ||
|
@@ -918,7 +918,7 @@ public function setPriceOnAffiliateThirdparty($user, $forceupdateaffiliate) | |
$prodsocprice = new ProductCustomerPrice($this->db); | ||
|
||
$filter = array( | ||
't.fk_product' => $this->fk_product, 't.fk_soc' => $obj->rowid | ||
't.fk_product' => (string) $this->fk_product, 't.fk_soc' => (string) $obj->rowid | ||
); | ||
|
||
$result = $prodsocprice->fetchAll('', '', 0, 0, $filter); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
* Copyright (C) 2015 Raphaël Doursenaud <[email protected]> | ||
* Copyright (C) 2023 Benjamin Falière <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -113,7 +113,7 @@ | |
for ($i = 0; $i < $maxprod; $i++) { | ||
$qty = price2num(GETPOST("prod_qty_" . $i, 'alpha'), 'MS'); | ||
if ($qty > 0) { | ||
if ($object->add_sousproduit($id, GETPOSTINT("prod_id_" . $i), $qty, GETPOSTINT("prod_incdec_" . $i)) > 0) { | ||
if ($object->add_sousproduit($id, GETPOSTINT("prod_id_" . $i), (float) $qty, GETPOSTINT("prod_incdec_" . $i)) > 0) { | ||
//var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')); | ||
$action = 'edit'; | ||
} else { | ||
|
@@ -262,7 +262,7 @@ | |
if (isModEnabled("product") && isModEnabled("service")) { | ||
$typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); | ||
print '<tr><td class="titlefield">'; | ||
print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); | ||
print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', (string) $object->type, $object, (int) $usercancreate, $typeformat) : $langs->trans('Type'); | ||
print '</td><td>'; | ||
print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); | ||
print '</td></tr>'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* Copyright (C) 2013 Cédric Salvador <[email protected]> | ||
* Copyright (C) 2017 Ferran Marcet <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2025 MDW <[email protected]> | ||
* Copyright (C) 2025 MDW <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -89,6 +89,8 @@ | |
$sortfield = "position_name"; | ||
} | ||
|
||
$upload_dir = ''; | ||
$upload_dirold = ''; | ||
// Initialize objects | ||
$object = new Product($db); | ||
if ($id > 0 || !empty($ref)) { | ||
|
@@ -172,7 +174,7 @@ | |
// Delete all file already associated | ||
$filetomerge = new Propalmergepdfproduct($db); | ||
|
||
if (getDolGlobalInt('MAIN_MULTILANGS')) { | ||
if (getDolGlobalInt('MAIN_MULTILANGS') && $lang_id !== null) { | ||
$result = $filetomerge->delete_by_product($user, $object->id, $lang_id); | ||
} else { | ||
$result = $filetomerge->delete_by_product($user, $object->id); | ||
|
@@ -338,6 +340,7 @@ | |
|
||
print '<table class="noborder">'; | ||
|
||
$default_lang = null; | ||
// Get language | ||
if (getDolGlobalInt('MAIN_MULTILANGS')) { | ||
$langs->load("languages"); | ||
|
@@ -363,7 +366,7 @@ | |
$checked = ''; | ||
$filename = $filetoadd['name']; | ||
|
||
if (getDolGlobalInt('MAIN_MULTILANGS')) { | ||
if (getDolGlobalInt('MAIN_MULTILANGS') && $default_lang !== null) { | ||
if (array_key_exists($filetoadd['name'].'_'.$default_lang, $filetomerge->lines)) { | ||
$filename = $filetoadd['name'].' - '.$langs->trans('Language_'.$default_lang); | ||
$checked = ' checked '; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2015 Ion Agorria <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -345,7 +345,7 @@ public function testExpression($product_id, $expression, $extra_values = array() | |
{ | ||
//Get the product data | ||
$product = new Product($this->db); | ||
$product->fetch($product_id, '', '', 1); | ||
$product->fetch($product_id, '', '', '1'); | ||
|
||
//Values for product expressions | ||
$extra_values = array_merge($extra_values, array( | ||
|
Oops, something went wrong.