mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 02:42:33 +01:00
NEW Invoice - List - use select2 multiselect for status (#36834)
* NEW Invoice - List - use select2 multiselect for status * Optimize * CI * CI * Review * Duplicate line and last problem * CI --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
committed by
GitHub
parent
a1662ed122
commit
2af5a71c91
@@ -13,7 +13,7 @@
|
||||
* Copyright (C) 2015-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2019-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2021-2024 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2023 Nick Fragoulis
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
@@ -120,7 +120,18 @@ $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'a
|
||||
$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$search_dispute_status = GETPOST('search_dispute_status', 'intcomma');
|
||||
$search_status = GETPOST('search_status', 'intcomma');
|
||||
$search_status = GETPOST('search_status', 'array:intcomma');
|
||||
if (empty($search_status) && GETPOSTISSET('search_status')) {
|
||||
// The parameter exists in the URL but was not recognized as an array.
|
||||
$search_status = GETPOST('search_status', 'intcomma');
|
||||
if ($search_status !== '' && $search_status !== '-1') {
|
||||
$search_status = array($search_status);
|
||||
} else {
|
||||
$search_status = '';
|
||||
}
|
||||
} elseif (is_array($search_status) && count($search_status) == 0) {
|
||||
$search_status = '';
|
||||
}
|
||||
$search_paymentmode = GETPOST('search_paymentmode', 'intcomma');
|
||||
$search_paymentterms = GETPOST('search_paymentterms', 'intcomma');
|
||||
$search_bankaccount = GETPOST('search_bankaccount', 'intcomma');
|
||||
@@ -954,23 +965,9 @@ if ($search_dispute_status != '-1' && $search_dispute_status != '') {
|
||||
$sql .= " AND f.dispute_status IN (".$db->sanitize($search_dispute_status).")";
|
||||
}
|
||||
}
|
||||
if ($search_status != '-1' && $search_status != '') {
|
||||
if (is_numeric($search_status) && $search_status >= 0) {
|
||||
if ($search_status == '0') {
|
||||
$sql .= " AND f.fk_statut = 0"; // draft
|
||||
}
|
||||
if ($search_status == '1') {
|
||||
$sql .= " AND f.fk_statut = 1"; // unpayed
|
||||
}
|
||||
if ($search_status == '2') {
|
||||
$sql .= " AND f.fk_statut = 2"; // paid Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means paid too but should not happen. If yes, reopen and reclassify billed)
|
||||
}
|
||||
if ($search_status == '3') {
|
||||
$sql .= " AND f.fk_statut = 3"; // abandoned
|
||||
}
|
||||
} else {
|
||||
$sql .= " AND f.fk_statut IN (".$db->sanitize($search_status).")"; // When search_status is '1,2' for example
|
||||
}
|
||||
if (is_array($search_status) && count($search_status) > 0) {
|
||||
$search_statusArray = $search_status;
|
||||
$sql .= " AND f.fk_statut IN (" . $db->sanitize(implode(',', array_map('intval', $search_statusArray))) . ")";
|
||||
}
|
||||
|
||||
if ($search_paymentmode > 0) {
|
||||
@@ -1416,7 +1413,13 @@ if ($search_dispute_status != '') {
|
||||
$param .= '&search_dispute_status='.urlencode($search_dispute_status);
|
||||
}
|
||||
if ($search_status != '') {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
if (is_array($search_status)) {
|
||||
foreach ($search_status as $key => $val) {
|
||||
$param .= '&search_status[]='.urlencode($val);
|
||||
}
|
||||
} else {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
}
|
||||
if ($search_paymentmode > 0) {
|
||||
$param .= '&search_paymentmode='.urlencode((string) ($search_paymentmode));
|
||||
@@ -1966,9 +1969,13 @@ if (!empty($arrayfields['f.dispute_status']['checked'])) {
|
||||
// Status
|
||||
if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
||||
print '<td class="liste_titre center parentonrightofpage">';
|
||||
$liststatus = array('0' => $langs->trans("BillShortStatusDraft"), '0,1' => $langs->trans("BillShortStatusDraft").'+'.$langs->trans("BillShortStatusNotPaid"), '1' => $langs->trans("BillShortStatusNotPaid"), '1,2' => $langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '2' => $langs->trans("BillShortStatusPaid"), '3' => $langs->trans("BillShortStatusCanceled"));
|
||||
$liststatus = array(
|
||||
'0' => $langs->trans("BillShortStatusDraft"),
|
||||
'1' => $langs->trans("BillShortStatusNotPaid"),
|
||||
'2' => $langs->trans("BillShortStatusPaid"),
|
||||
'3' => $langs->trans("BillShortStatusCanceled"));
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage', 1);
|
||||
print $form->multiselectarray('search_status', $liststatus, (is_array($search_status) ? $search_status : array()), 0, 0, 'minwidth125', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
|
||||
Reference in New Issue
Block a user