Merge pull request #16151 from bb2a/mass_action_propal_nosigned
NEW: add massActions to set a commercial proposal to status "Refused"
This commit is contained in:
commit
369a835abb
@ -271,6 +271,98 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'validate') {
|
||||||
|
if (GETPOST('confirm') == 'yes') {
|
||||||
|
$tmpproposal = new Propal($db);
|
||||||
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
|
foreach ($toselect as $checked) {
|
||||||
|
if ($tmpproposal->fetch($checked)) {
|
||||||
|
if ($tmpproposal->statut == 0) {
|
||||||
|
if ($tmpproposal->valid($user)) {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if ($error) {
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "sign") {
|
||||||
|
if (GETPOST('confirm') == 'yes') {
|
||||||
|
$tmpproposal = new Propal($db);
|
||||||
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
|
foreach ($toselect as $checked) {
|
||||||
|
if ($tmpproposal->fetch($checked)) {
|
||||||
|
if ($tmpproposal->statut == 1) {
|
||||||
|
$tmpproposal->statut = 2;
|
||||||
|
if ($tmpproposal->update($user)) {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($error) {
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($action == "nosign") {
|
||||||
|
if (GETPOST('confirm') == 'yes') {
|
||||||
|
$tmpproposal = new Propal($db);
|
||||||
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
|
foreach ($toselect as $checked) {
|
||||||
|
if ($tmpproposal->fetch($checked)) {
|
||||||
|
if ($tmpproposal->statut == 1) {
|
||||||
|
$tmpproposal->statut = 3;
|
||||||
|
if ($tmpproposal->update($user)) {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($error) {
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -493,6 +585,7 @@ if ($resql)
|
|||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'prevalidate'=>$langs->trans("Validate"),
|
'prevalidate'=>$langs->trans("Validate"),
|
||||||
'presign'=>$langs->trans("Sign"),
|
'presign'=>$langs->trans("Sign"),
|
||||||
|
'nopresign'=>$langs->trans("NoSign"),
|
||||||
);
|
);
|
||||||
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
|
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
|
||||||
@ -531,6 +624,11 @@ if ($resql)
|
|||||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($massaction == 'nopresign')
|
||||||
|
{
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||||
@ -1389,67 +1487,6 @@ if ($resql)
|
|||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||||
|
|
||||||
if ($action == 'validate') {
|
|
||||||
if (GETPOST('confirm') == 'yes') {
|
|
||||||
$tmpproposal = new Propal($db);
|
|
||||||
$db->begin();
|
|
||||||
$error = 0;
|
|
||||||
foreach ($toselect as $checked) {
|
|
||||||
if ($tmpproposal->fetch($checked)) {
|
|
||||||
if ($tmpproposal->statut == 0) {
|
|
||||||
if ($tmpproposal->valid($user)) {
|
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
|
|
||||||
} else {
|
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dol_print_error($db);
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == "sign") {
|
|
||||||
if (GETPOST('confirm') == 'yes') {
|
|
||||||
$tmpproposal = new Propal($db);
|
|
||||||
$db->begin();
|
|
||||||
$error = 0;
|
|
||||||
foreach ($toselect as $checked) {
|
|
||||||
if ($tmpproposal->fetch($checked)) {
|
|
||||||
if ($tmpproposal->statut == 1) {
|
|
||||||
$tmpproposal->statut = 2;
|
|
||||||
if ($tmpproposal->update($user)) {
|
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,12 +90,17 @@ PassedInOpenStatus = passé au statut "ouvert"
|
|||||||
CantBeSign = ne peut pas être signée
|
CantBeSign = ne peut pas être signée
|
||||||
Sign = Signer
|
Sign = Signer
|
||||||
Signed = signé
|
Signed = signé
|
||||||
|
NoSign = Non signer
|
||||||
|
NoSigned = Non signé
|
||||||
CantBeSign = ne peut pas être signé
|
CantBeSign = ne peut pas être signé
|
||||||
|
CantBeSign = ne peut pas être non signé
|
||||||
CantBeValidated = Ne peut pas être validé
|
CantBeValidated = Ne peut pas être validé
|
||||||
ConfirmMassValidation = Confirmer la validation ?
|
ConfirmMassValidation = Confirmer la validation ?
|
||||||
ConfirmMassSignature = Confirmer la signature ?
|
ConfirmMassSignature = Confirmer la signature ?
|
||||||
|
ConfirmMassNoSignature = Confirmer la non signature ?
|
||||||
ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis brouillons selectionnés ?
|
ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis brouillons selectionnés ?
|
||||||
ConfirmMassSignatureQuestion = Voulez-vous confirmer la signature des devis ouvert selectionnés ?
|
ConfirmMassSignatureQuestion = Voulez-vous confirmer la signature des devis ouvert selectionnés ?
|
||||||
|
ConfirmMassNoSignatureQuestion = Voulez-vous confirmer la non signature des devis ouvert selectionnés ?
|
||||||
PropNoProductOrService = devis ne contient pas de produits ni de services
|
PropNoProductOrService = devis ne contient pas de produits ni de services
|
||||||
PropsNoProductOrService = devis ne contiennent pas de produits ni de services
|
PropsNoProductOrService = devis ne contiennent pas de produits ni de services
|
||||||
IdProposal=ID de proposition
|
IdProposal=ID de proposition
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user