diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 82b0d2f97a1..9a0059317fa 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -66,7 +66,29 @@ if (! $sortorder) $sortorder="DESC"; $pdluoid=GETPOST('pdluoid','int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('movement'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + + +/* + * Actions + */ + +if ($cancel) $action=''; // Protection to avoid action for all cancel buttons + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $year=''; $month=''; @@ -77,15 +99,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_user=""; $search_batch=""; $sall=""; + $search_array_options=array(); } - -/* - * Actions - */ - -if ($cancel) $action=''; // Protection to avoid action for all cancel buttons - // Correct stock if ($action == "correct_stock") { @@ -547,22 +563,40 @@ if ($resql) $param=''; - if ($id > 0) $param.='&id='.$id; - if ($search_movement) $param.='&search_movement='.urlencode($search_movement); + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($id > 0) $param.='&id='.$id; + if ($search_movement) $param.='&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); - if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); - if ($search_product) $param.='&search_product='.urlencode($search_product); - if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse); - if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined - if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined - if ($search_user) $param.='&search_user='.urlencode($search_user); - if ($idproduct > 0) $param.='&idproduct='.$idproduct; - if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,''); - else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords); - - print '