From 587ca48312f709275fd495504700bed2f76e2672 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 4 Aug 2020 17:25:35 +0200 Subject: [PATCH 1/3] Fix filter warehouse list on status --- htdocs/product/stock/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index f0b94f99bdb..820572dc601 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -50,7 +50,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ' $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("sref", "alpha") ?GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha"); $search_label = GETPOST("snom", "alpha") ?GETPOST("snom", "alpha") : GETPOST("search_label", "alpha"); -$search_status = GETPOST("search_status", "int"); +$search_status = GETPOST("search_statut", "int"); if (!empty($conf->categorie->enabled)) { @@ -232,7 +232,7 @@ foreach ($search as $key => $val) if ($search[$key] == '-1') $search[$key] = ''; $mode_search = 2; } - if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'statut') ? 2 : $mode_search)); } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields @@ -449,7 +449,7 @@ print $hookmanager->resPrint; // Status if (!empty($arrayfields['t.statut']['checked'])) { print ''; - print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); + print $form->selectarray('search_statut', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; } From 4376ca4c94830a44ba481dbe58c305388a85f5e5 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 7 Aug 2020 14:16:49 +0200 Subject: [PATCH 2/3] Revert "Fix filter warehouse list on status" This reverts commit 587ca48312f709275fd495504700bed2f76e2672. --- htdocs/product/stock/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 820572dc601..f0b94f99bdb 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -50,7 +50,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ' $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("sref", "alpha") ?GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha"); $search_label = GETPOST("snom", "alpha") ?GETPOST("snom", "alpha") : GETPOST("search_label", "alpha"); -$search_status = GETPOST("search_statut", "int"); +$search_status = GETPOST("search_status", "int"); if (!empty($conf->categorie->enabled)) { @@ -232,7 +232,7 @@ foreach ($search as $key => $val) if ($search[$key] == '-1') $search[$key] = ''; $mode_search = 2; } - if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'statut') ? 2 : $mode_search)); + if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields @@ -449,7 +449,7 @@ print $hookmanager->resPrint; // Status if (!empty($arrayfields['t.statut']['checked'])) { print ''; - print $form->selectarray('search_statut', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); + print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; } From dec0e418e32a964273365a678a02301e622b7e32 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 7 Aug 2020 15:11:36 +0200 Subject: [PATCH 3/3] Convert search key status to class key statut. Add comment to refactor class statut to class status --- htdocs/product/stock/list.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index f0b94f99bdb..036fba2be76 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -101,7 +101,9 @@ $search_all = trim(GETPOST("search_all", 'alpha')); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); + $search_key = $key; + if ($search_key == 'statut') $search_key = 'status'; // remove this after refactor entrepot.class property statut to status + if (GETPOST('search_'.$search_key, 'alpha') !== '') $search[$search_key] = GETPOST('search_'.$search_key, 'alpha'); } // Definition of fields for list @@ -226,13 +228,15 @@ if (!empty($conf->categorie->enabled)) } foreach ($search as $key => $val) { + $class_key = $key; + if ($class_key == 'status') $class_key = 'statut'; // remove this after refactor entrepot.class property statut to status if (($key == 'status' && $search[$key] == -1) || $key=='entity') continue; $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if (strpos($object->fields[$key]['type'], 'integer:') === 0) { if ($search[$key] == '-1') $search[$key] = ''; $mode_search = 2; } - if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'status') ? 2 : $mode_search)); + if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $class_key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); // Add where from extra fields