diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index dbb97b61656..a0e1da55c7f 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -62,8 +62,11 @@ class FormOrder extends Form $options[$value] = $tmpsupplierorder->getLibStatut($short); } - print Form::selectarray($hmlname, $options, $selected, 1, 0, 0, '', 0, 0, 0, '', '', 1); - } + if (is_array($selected)) $selectedarray = $selected; + else $selectedarray = explode(',', $selected); + + print Form::multiselectarray($hmlname, $options, $selectedarray, 0); + } /** * Return list of input method (mode used to receive order, like order received by email, fax, online) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e63ad81d891..4ccb090bf18 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -74,7 +74,6 @@ $search_user = GETPOST('search_user', 'int'); $search_request_author = GETPOST('search_request_author', 'alpha'); $search_ht = GETPOST('search_ht', 'alpha'); $search_ttc = GETPOST('search_ttc', 'alpha'); -$search_status = (GETPOST('search_status', 'alpha') != '' ?GETPOST('search_status', 'alpha') : GETPOST('statut', 'alpha')); // alpha and not intbecause it can be '6,7' $optioncss = GETPOST('optioncss', 'alpha'); $socid = GETPOST('socid', 'int'); $search_sale = GETPOST('search_sale', 'int'); @@ -92,7 +91,11 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); -$status = GETPOST('statut', 'alpha'); +if (is_array(GETPOST('search_status', 'intcomma'))) { + $search_status = join(',', GETPOST('search_status', 'intcomma')); +} else { + $search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); +} // Security check $orderid = GETPOST('orderid', 'int'); @@ -176,6 +179,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$error = 0; /* @@ -500,18 +504,21 @@ $formorder = new FormOrder($db); $formother = new FormOther($db); $formcompany = new FormCompany($db); -$title = $langs->trans("SuppliersOrders"); +$title = $langs->trans("ListOfSupplierOrders"); if ($socid > 0) { $fourn = new Fournisseur($db); $fourn->fetch($socid); $title .= ' - '.$fourn->name; } -if ($status) + +if ($search_status) { - if ($status == '1,2,3') $title .= ' - '.$langs->trans("StatusOrderToProcessShort"); - if ($status == '6,7') $title .= ' - '.$langs->trans("StatusOrderCanceled"); - else $title .= ' - '.$commandestatic->LibStatut($status); + if ($search_status == '1,2') $title .= ' - '.$langs->trans("SuppliersOrdersToProcess"); + elseif ($search_status == '3,4') $title .= ' - '.$langs->trans("SuppliersOrdersAwaitingReception"); + elseif ($search_status == '1,2,3') $title .= ' - '.$langs->trans("StatusOrderToProcessShort"); + elseif ($search_status == '6,7') $title .= ' - '.$langs->trans("StatusOrderCanceled"); + elseif(is_numeric($search_status)) $title .= ' - '.$commandestatic->LibStatut($search_status); } if ($search_billed > 0) $title .= ' - '.$langs->trans("Billed"); @@ -571,8 +578,8 @@ if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$db if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category; //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'intcomma') !== '') - $sql .= " AND cf.fk_statut IN (".$db->sanitize($db->escape(GETPOST('statut', 'intcomma'))).")"; -if ($search_status != '' && $search_status >= 0) + $sql .= " AND cf.fk_statut IN (".$db->sanitize($db->escape($db->escape(GETPOST('statut', 'intcomma')))).")"; +if ($search_status != '' && $search_status != '-1') $sql .= " AND cf.fk_statut IN (".$db->sanitize($db->escape($search_status)).")"; $sql .= dolSqlDateFilter("cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); $sql .= dolSqlDateFilter("cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); @@ -621,15 +628,6 @@ $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); if ($resql) { - if ($socid > 0) - { - $soc = new Societe($db); - $soc->fetch($socid); - $title = $langs->trans('ListOfSupplierOrders').' - '.$soc->name; - } else { - $title = $langs->trans('ListOfSupplierOrders'); - } - $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); @@ -669,7 +667,7 @@ if ($resql) if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); if ($search_refsupp) $param .= "&search_refsupp=".urlencode($search_refsupp); - if ($search_status >= 0) $param .= "&search_status=".urlencode($search_status); + if ($search_status != '' && $search_status != '-1') $param .= "&search_status=".urlencode($search_status); if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_billed != '') $param .= "&search_billed=".urlencode($search_billed); if ($show_files) $param .= '&show_files='.urlencode($show_files); @@ -969,7 +967,7 @@ if ($resql) if (!empty($arrayfields['cf.fk_statut']['checked'])) { print ''; - $formorder->selectSupplierOrderStatus((strstr($search_status, ',') ?-1 : $search_status), 1, 'search_status'); + $formorder->selectSupplierOrderStatus($search_status, 1, 'search_status'); print ''; } // Status billed