diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b91dbe00811..a0dbe0df5bd 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -268,11 +268,11 @@ class Commande extends CommonOrder /** - * @var string key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) + * @var ?string key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) */ public $module_source; /** - * @var string key of pos source ('0', '1', ...) + * @var ?string key of pos source ('0', '1', ...) */ public $pos_source; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 67bcfa869c5..e472225409a 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -322,7 +322,7 @@ if (empty($reshook)) { $search_billed = ''; $toselect = array(); $search_array_options = array(); - $search_categ_cus = 0; + $search_categ_cus = ''; $search_datecloture_start = ''; $search_datecloture_end = ''; $search_fk_cond_reglement = ''; @@ -596,7 +596,7 @@ if ($search_sale && $search_sale != '-1') { } // Search for tag/category ($searchCategoryCustomerList is an array of ID) $searchCategoryCustomerOperator = -1; -$searchCategoryCustomerList = array($search_categ_cus); +$searchCategoryCustomerList = ($search_categ_cus !== '-1' ? explode(',', $search_categ_cus) : array()); if (!empty($searchCategoryCustomerList)) { $searchCategoryCustomerSqlList = array(); $listofcategoryid = ''; diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index dfd2eb6fbb0..178780f9f5b 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -194,51 +194,6 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $timestamp = GETPOSTINT('timestamp', 2); $format = 'date'; $newvalue = ($timestamp / 1000); - } elseif ($type == 'select') { - $loadmethodname = 'load_cache_'.$loadmethod; - $loadcachename = 'cache_'.$loadmethod; - $loadviewname = 'view_'.$loadmethod; - - $form = new Form($db); - if (method_exists($form, $loadmethodname)) { - $ret = $form->$loadmethodname(); - if ($ret > 0) { - $loadcache = $form->$loadcachename; - $value = $loadcache[$newvalue]; - - if (!empty($form->$loadviewname)) { - $loadview = $form->$loadviewname; - $view = $loadview[$newvalue]; - } - } else { - $error++; - $return['error'] = $form->error; - } - } else { - $module = $subelement = $ext_element; - if (preg_match('/^([^_]+)_([^_]+)/i', $ext_element, $regs)) { - $module = $regs[1]; - $subelement = $regs[2]; - } - - dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php'); - $classname = 'Actions'.ucfirst($subelement); - $object = new $classname($db); - '@phan-var-force CommonHookActions $object'; - $ret = $object->$loadmethodname(); - if ($ret > 0) { - $loadcache = $object->$loadcachename; - $value = $loadcache[$newvalue]; - - if (!empty($object->$loadviewname)) { - $loadview = $object->$loadviewname; - $view = $loadview[$newvalue]; - } - } else { - $error++; - $return['error'] = $object->error; - } - } } if (!$error) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0f821b14bb3..95793b6fced 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3797,7 +3797,7 @@ class Form * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) * * @param int $socid Id third party - * @param string $selected Preselected product + * @param string|int $selected Preselected product * @param string $htmlname Name of HTML Select * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param string $filtre For a SQL filter @@ -3807,7 +3807,7 @@ class Form * @param string $morecss More CSS * @param string $placeholder Placeholder * @param int $nooutput 1=do not output but return string instead - * @return void + * @return string|void HTML select or nothing */ public function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '', $placeholder = '', $nooutput = 0) { @@ -3821,7 +3821,7 @@ class Form $selected_input_value = ''; if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { - if ($selected > 0) { + if ((int) $selected > 0) { require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $producttmpselect = new Product($this->db); $producttmpselect->fetch((int) $selected); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e02b87a418c..747c4866050 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -31,7 +31,7 @@ * The HTML field must be an input text with id=search_$htmlname. * This use the jQuery "autocomplete" function. If we want to use the select2, we must instead use input select into functions that call this method. * - * @param string $selected Preselected value + * @param string|int $selected Preselected value * @param string|int $htmlname HTML name of input field * @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list) * @param string $urloption More parameters on URL request