add filter

This commit is contained in:
jpb 2021-07-05 08:55:03 +02:00
parent 5779a56ae0
commit ad62062cd5

View File

@ -494,7 +494,7 @@ if ($search_billed != '' && $search_billed >= 0) {
$sql .= ' AND c.facture = '.((int) $search_billed);
}
if ($search_status <> '') {
if ($search_status < 4 && $search_status > -3) {
if ($search_status < 4 && $search_status > -4) {
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 {
@ -513,6 +513,12 @@ 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) // To bill
{
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
}
if ($search_datecloture_start) {
@ -675,6 +681,9 @@ if ($resql) {
if ($search_status == -3) {
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
}
if ($search_status == -4) {
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");
}
$num = $db->num_rows($resql);
@ -1236,6 +1245,7 @@ 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"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);