diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e7af582d121..e660f32ec5d 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -271,6 +271,98 @@ if (empty($reshook)) 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"), 'prevalidate'=>$langs->trans("Validate"), 'presign'=>$langs->trans("Sign"), + 'nopresign'=>$langs->trans("NoSign"), ); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); 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); } + if ($massaction == 'nopresign') + { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassNoSignature"), $langs->trans("ConfirmMassNoSignatureQuestion"), "nosign", null, '', 0, 200, 500, 1); + } + if ($sall) { 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); - 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 { dol_print_error($db); } diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 64199c5248d..aaff4579427 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -90,12 +90,17 @@ PassedInOpenStatus = passé au statut "ouvert" CantBeSign = ne peut pas être signée Sign = Signer Signed = signé +NoSign = Non signer +NoSigned = Non signé CantBeSign = ne peut pas être signé +CantBeSign = ne peut pas être non signé CantBeValidated = Ne peut pas être validé ConfirmMassValidation = Confirmer la validation ? ConfirmMassSignature = Confirmer la signature ? +ConfirmMassNoSignature = Confirmer la non signature ? ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis brouillons 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 PropsNoProductOrService = devis ne contiennent pas de produits ni de services IdProposal=ID de proposition