Merge pull request #17259 from bb2a/mass_action_propal_right
Workflo mass action propal sign or NotSigned and notification #17143
This commit is contained in:
commit
12e2055faa
@ -14,6 +14,7 @@
|
||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -217,7 +218,15 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$permissiontoread = $user->rights->propal->lire;
|
||||
$permissiontoadd = $user->rights->propal->write;
|
||||
$permissiontodelete = $user->rights->propal->supprimer;
|
||||
$permissiontoclose = $user->rights->propal->cloturer;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$permissiontovalidate = $user->rights->propale->propal_advance->validate;
|
||||
$permissiontoclose = $user->rights->propale->propal_advance->close;
|
||||
$permissiontosendbymail = $user->rights->propale->propal_advance->send;
|
||||
} else {
|
||||
$permissiontovalidate = $user->rights->propal->write;
|
||||
$permissiontoclose = $user->rights->propal->write;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -298,7 +307,7 @@ if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
if ($action == 'validate' && $permissiontoadd) {
|
||||
if ($action == 'validate' && $permissiontovalidate) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
$tmpproposal = new Propal($db);
|
||||
$db->begin();
|
||||
@ -316,9 +325,10 @@ if ($action == 'validate' && $permissiontoadd) {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
dol_print_error($db);
|
||||
$error++;
|
||||
}
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
@ -815,18 +825,23 @@ if ($resql) {
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'prevalidate'=>$langs->trans("Validate"),
|
||||
'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"),
|
||||
'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"),
|
||||
|
||||
);
|
||||
if ($user->rights->propal->cloturer) {
|
||||
$arrayofmassactions['presign']=$langs->trans("Sign");
|
||||
$arrayofmassactions['nopresign']=$langs->trans("NoSign");
|
||||
$arrayofmassactions['setbilled'] = $langs->trans("ClassifyBilled");
|
||||
if ($permissiontosendbymail) {
|
||||
$arrayofmassactions['presend']=img_picto('', 'email').' '.$langs->trans("SendByMail");
|
||||
}
|
||||
if ($user->rights->propal->supprimer) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if ($permissiontovalidate) {
|
||||
$arrayofmassactions['prevalidate']=img_picto('', 'check').' '.$langs->trans("Validate");
|
||||
}
|
||||
if ($permissiontoclose) {
|
||||
$arrayofmassactions['presign']=img_picto('', 'propal').' '.$langs->trans("Sign");
|
||||
$arrayofmassactions['nopresign']=img_picto('', 'propal').' '.$langs->trans("NoSign");
|
||||
$arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled");
|
||||
}
|
||||
if ($permissiontodelete) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete");
|
||||
}
|
||||
|
||||
if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user