NEW Bulk action validate on customer invoices

This commit is contained in:
Laurent Destailleur 2017-10-12 02:25:17 +02:00
parent 5fd6a27c62
commit ca0af5cddf
2 changed files with 10 additions and 2 deletions

View File

@ -233,6 +233,7 @@ if (empty($reshook))
$objectclass='Facture'; $objectclass='Facture';
$objectlabel='Invoices'; $objectlabel='Invoices';
$permtoread = $user->rights->facture->lire; $permtoread = $user->rights->facture->lire;
$permtocreate = $user->rights->facture->creer;
$permtodelete = $user->rights->facture->supprimer; $permtodelete = $user->rights->facture->supprimer;
$uploaddir = $conf->facture->dir_output; $uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@ -573,6 +574,7 @@ if ($resql)
} }
$arrayofmassactions=array( $arrayofmassactions=array(
'validate'=>$langs->trans("Validate"),
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );

View File

@ -663,6 +663,12 @@ if ($action == 'remove_file')
// Validate records // Validate records
if (! $error && $massaction == 'validate' && $permtocreate) if (! $error && $massaction == 'validate' && $permtocreate)
{ {
if ($object->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
$langs->load("errors");
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
$error++;
}
if ($object->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) if ($object->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL))
{ {
$langs->load("errors"); $langs->load("errors");