From de8db34f435c74e3514308dc6b048f952afea36d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Sep 2021 01:42:15 +0200 Subject: [PATCH] Fix filter on status of order --- htdocs/commande/list.php | 15 +++------------ htdocs/filefunc.inc.php | 28 +++++++++++++++------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5f3568701e5..e8b76a94e42 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -33,7 +33,6 @@ * \brief Page to list orders */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -501,16 +500,13 @@ if ($search_billed != '' && $search_billed >= 0) { $sql .= ' AND c.facture = '.((int) $search_billed); } if ($search_status <> '') { - if ($search_status < 4 && $search_status > -4) { + if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination) if ($search_status == 1 && empty($conf->expedition->enabled)) { $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated' } else { $sql .= ' AND c.fk_statut = '.((int) $search_status); // brouillon, validee, en cours, annulee } } - if ($search_status == 4) { - $sql .= ' AND c.facture = 1'; // invoice created - } if ($search_status == -2) { // To process //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; $sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected @@ -520,8 +516,6 @@ if ($search_status <> '') { //$sql.= ' AND c.facture = 0'; // invoice not created $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } - - if ($search_status == -4) { // "validate and in progress" $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process } @@ -675,9 +669,6 @@ if ($resql) { if ($search_status == 3) { $title .= ' - '.$langs->trans('StatusOrderToBillShort'); } - if ($search_status == 4) { - $title .= ' - '.$langs->trans('StatusOrderProcessedShort'); - } if ($search_status == -1) { $title .= ' - '.$langs->trans('StatusOrderCanceledShort'); } @@ -1254,10 +1245,10 @@ if ($resql) { Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), -3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"), - -4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"), + -2=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); - print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); print ''; } // Action column diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 32442dcc330..4fcd5a91723 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -176,6 +176,21 @@ if (empty($dolibarr_strict_mode)) { $dolibarr_strict_mode = 0; // For debug in php strict mode } +define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) + +if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) { + print "Error: Dolibarr config file content seems to be not correctly defined.
\n"; + print "Please run dolibarr setup by calling page /install.
\n"; + exit; +} + + +// Included by default (must be before the CSRF check so wa can use the dol_syslog) +include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; +//print memory_get_usage(); + + // Security: CSRF protection // This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST']) // when we post forms (we allow GET and HEAD to accept direct link from a particular page). @@ -228,7 +243,6 @@ if (empty($dolibarr_main_data_root)) { // Define some constants define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter) define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents) -define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) // Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT. // Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works. $tmp = ''; @@ -333,18 +347,6 @@ if (!defined('ADODB_DATE_VERSION')) { include_once ADODB_PATH.'adodb-time.inc.php'; } -if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) { - print "Error: Dolibarr config file content seems to be not correctly defined.
\n"; - print "Please run dolibarr setup by calling page /install.
\n"; - exit; -} - - -// Included by default -include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; -include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; -//print memory_get_usage(); - // If password is encoded, we decode it. Note: When page is called for install, $dolibarr_main_db_pass may not be defined yet. if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) {