From eb15c4d800857d2421b2583d7a88b3348da5db9b Mon Sep 17 00:00:00 2001
From: Anthony Berton <34568357+bb2a@users.noreply.github.com>
Date: Wed, 3 Feb 2021 11:29:54 +0100
Subject: [PATCH 1/3] 20200203
---
htdocs/comm/propal/list.php | 159 ++++++++++++++++++++-------------
htdocs/langs/fr_FR/propal.lang | 5 ++
2 files changed, 103 insertions(+), 61 deletions(-)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 07ff1c64dbb..16e6214cc98 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('CantBeSign'), '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
From 609428bc093343279c7b0a2c3cd99f041e6e6532 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Wed, 3 Feb 2021 10:37:15 +0000
Subject: [PATCH 2/3] Fixing style errors.
---
htdocs/comm/propal/list.php | 142 ++++++++++++++++++------------------
1 file changed, 71 insertions(+), 71 deletions(-)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 16e6214cc98..f7b42fae261 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -272,97 +272,97 @@ if (empty($reshook))
}
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++;
- }
+ 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($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
+ 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 ($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++;
- }
+}
+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 {
- setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
+ dol_print_error($db);
$error++;
}
} else {
- dol_print_error($db);
+ setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
- }
- if ($error) {
- $db->rollback();
} else {
- $db->commit();
+ dol_print_error($db);
+ $error++;
}
}
- }
- 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('CantBeSign'), 'errors');
- $error++;
- }
- } else {
- dol_print_error($db);
- $error++;
- }
- }
- if ($error) {
- $db->rollback();
- } else {
- $db->commit();
- }
+ if ($error) {
+ $db->rollback();
+ } else {
+ $db->commit();
}
}
+}
/*
From 47ac349f2dd183b153d0ecab724ef5fefc937e19 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Wed, 3 Feb 2021 20:34:57 +0100
Subject: [PATCH 3/3] Update list.php
---
htdocs/comm/propal/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index f7b42fae261..5160e6d46e7 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -348,7 +348,7 @@ if ($action == "nosign") {
$error++;
}
} else {
- setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
+ setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
$error++;
}
} else {