NEW cancel orders on massaction

This commit is contained in:
atm-quentin 2018-05-02 14:37:35 +02:00
parent 2f2d17926d
commit a20ec7ba1e
2 changed files with 17 additions and 0 deletions

View File

@ -208,6 +208,7 @@ if (empty($reshook))
$uploaddir = $conf->commande->dir_output;
$trigger_name='ORDER_SENTBYMAIL';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -419,6 +420,8 @@ if ($resql)
$arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
'cancelorders'=>$langs->trans("Cancel"),
);
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");

View File

@ -736,6 +736,20 @@ if ($massaction == 'confirm_createbills')
}
}
if ($massaction == 'cancelorders')
{
$orders = GETPOST('toselect', 'array');
foreach ($orders as $id_order)
{
$cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0)
continue;
$cmd->cancel();
}
}
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
{
if (empty($diroutputmassaction))