Add mass action on direct debit request list

Add mass action on direct debit request list into direct debit voucher create page
This commit is contained in:
LAURIER Alexis 2021-02-10 08:11:28 +01:00 committed by GitHub
parent f005ce7690
commit 653b0d6090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,8 @@ $type = GETPOST('type', 'aZ09');
// Get supervariables
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
$format = GETPOST('format', 'aZ09');
$id_bankaccount = GETPOST('id_bankaccount', 'int');
@ -61,6 +63,7 @@ $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $massaction = ''; }
$parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -121,7 +124,9 @@ if (empty($reshook)) {
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id);
exit;
}
}
$objectclass = "BonPrelevement";
$uploaddir = $conf->prelevement->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -138,6 +143,12 @@ if ($type != 'bank-transfer') {
$invoicestatic = new FactureFournisseur($db);
}
$bprev = new BonPrelevement($db);
$arrayofselected = is_array($toselect) ? $toselect : array();
// List of mass actions available
$arrayofmassactions = array(
);
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
llxHeader('', $langs->trans("NewStandingOrder"));
@ -273,7 +284,7 @@ print '<br>';
*/
$sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql .= " pfd.date_demande, pfd.amount";
$sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount";
if ($type == 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
} else {
@ -332,7 +343,7 @@ if ($resql)
if ($type == 'bank-transfer') {
$title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
}
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
$tradinvoice = "Invoice";
if ($type == 'bank-transfer') {
@ -347,6 +358,10 @@ if ($resql)
print '<td>'.$langs->trans("RUM").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td class="right">'.$langs->trans("DateRequest").'</td>';
if ($massactionbutton || $massaction ) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
print '<td align="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
}
print '</tr>';
if ($num)
@ -402,6 +417,15 @@ if ($resql)
print '<td class="right">';
print dol_print_date($db->jdate($obj->date_demande), 'day');
print '</td>';
// Action column
if ($massactionbutton || $massaction ) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
print '<td class="nowrap center">';
$selected = 0;
if (in_array($obj->request_row_id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->request_row_id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->request_row_id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '</tr>';
$i++;
}