From 1a2dd84cef445442335f6f1c1423f74aed3df0a2 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 2 May 2017 10:02:16 +0200 Subject: [PATCH 01/13] FIX MAIN_FEATURES_LEVEL --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dffc5f9af1b..3ce2a872658 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1253,7 +1253,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } // Inventory - if ($conf->global->MAIN_LEVEL_FEATURES >= 2) + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($conf->stock->enabled)) { From 3f7d488dd7c4001020e7c75eebe856ac4134b1e7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 2 May 2017 10:09:57 +0200 Subject: [PATCH 02/13] Fix inventory --- htdocs/product/inventory/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index dc279cc0929..827354b864c 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -127,8 +127,6 @@ if (empty($reshook)) header('Location: '.dol_buildpath('/product/inventory/card.php?action=create', 1)); exit; } - - break; } switch($action) { From d6113acfc8eee6b8abc25db9e36c3021a9695815 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 2 Sep 2020 15:20:10 +0200 Subject: [PATCH 03/13] action presign/prevalidate + action sign/validate + Traductions --- htdocs/comm/propal/list.php | 100 +++++++++++++++++++++++++++++++++ htdocs/langs/fr_FR/propal.lang | 12 ++++ 2 files changed, 112 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6710ac56b58..e89f7b5540a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -472,6 +472,8 @@ if ($resql) 'generate_doc'=>$langs->trans("ReGeneratePDF"), 'builddoc'=>$langs->trans("PDFMerge"), 'presend'=>$langs->trans("SendByMail"), + 'prevalidate'=>$langs->trans("Validate"), + 'presign'=>$langs->trans("Sign"), ); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close"); @@ -502,6 +504,45 @@ if ($resql) $trackid = 'pro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($massaction == 'prevalidate') + { + $cpt = 0; + $refs = array(); + $ids = array(); + foreach ($toselect as $checked){ + $sqlp = "SELECT ref, rowid FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " .$checked." AND rowid NOT IN"; + $sqlp .= " (SELECT fk_propal FROM " . MAIN_DB_PREFIX . "propaldet)"; + $resqlp = $db->query($sqlp); + if ($resqlp){ + $objp = $db->fetch_object($resqlp); + if ($db->num_rows($resqlp)){ + $cpt++; + $refs[] = $objp->ref; + $ids[] = $objp->rowid; + } + } else { + dol_print_error($db); + } + } + if ($cpt > 0) + { + if($cpt==1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropNoProductOrService'), 'warnings'); + if ($cpt>1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropsNoProductOrService'), 'warnings'); + $cpt2 = 0; + foreach ($ids as $r) + { + setEventMessage("".$refs[$cpt2]."", 'warnings'); + $cpt2++; + } + } + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + } + + if ($massaction == 'presign') + { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1); + } + if ($sall) { foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); @@ -1270,6 +1311,65 @@ if ($resql) $delallowed = $user->rights->propal->creer; 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'){ + foreach ($toselect as $checked){ + $sql = "SELECT ref, fk_statut AS statut FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$checked; + $resql = $db->query($sql); + if ($resql){ + $obj = $db->fetch_object($resql); + $ref = substr($obj->ref, 1, 4); + if ($ref == 'PROV') { + $numref = $object->getNextNumRef($soc); + if (empty($numref)) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + $numref = $obj->ref; + } + if ($obj->statut == 0){ + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 1, ref ='".$numref."' WHERE rowid = ".$checked; + $resql = $db->query($sql); + if ($resql){ + setEventMessage($numref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + dol_print_error($db); + } + }else { + setEventMessage($numref." ".$langs->trans('IsNotADraft'), 'errors'); + } + } else { + dol_print_error($db); + } + } + } + } + + if ($action == "sign") { + if (GETPOST('confirm') == 'yes'){ + foreach ($toselect as $checked) { + $sqlp = "SELECT ref, fk_statut AS statut FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $checked; + $resqlp = $db->query($sqlp); + if ($resqlp) { + $objp = $db->fetch_object($resqlp); + if ($objp->statut == 1) { + $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; + $resqlp = $db->query($sqlp); + if ($resqlp) { + setEventMessage($objp->ref . " " . $langs->trans('Signed'), 'mesgs'); + } else { + dol_print_error($db); + } + } else { + setEventMessage($objp->ref . " " . $langs->trans('CantBeSign'), 'errors'); + } + } else { + dol_print_error($db); + } + } + } + } } else { dol_print_error($db); } diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index fea0bcd75f0..63508c00582 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -85,3 +85,15 @@ ProposalCustomerSignature=Cachet, Date, Signature et mention "Bon pour Accord" ProposalsStatisticsSuppliers=Statistiques de propositions commerciales CaseFollowedBy=Affaire suivie par SignedOnly=Signé seulement +IsNotADraft = n'est pas un brouillon +PassedInOpenStatus = passé au statut "ouvert" +CantBeSign = ne peut pas être signée +Sign = Signer +Signed = signé +CantBeSign = ne peut pas être signé +ConfirmMassValidation = Confirmer la validation ? +ConfirmMassSignature = Confirmer la signature ? +ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis brouillons selectionnés ? +ConfirmMassSignatureQuestion = Voulez-vous confirmer la 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 From a71328657985d790ba13d25cde31cead69f43c3d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 2 Sep 2020 13:58:04 +0000 Subject: [PATCH 04/13] Fixing style errors. --- 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 e89f7b5540a..7845efe5823 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -526,7 +526,7 @@ if ($resql) } if ($cpt > 0) { - if($cpt==1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropNoProductOrService'), 'warnings'); + if ($cpt==1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropNoProductOrService'), 'warnings'); if ($cpt>1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropsNoProductOrService'), 'warnings'); $cpt2 = 0; foreach ($ids as $r) From ee003ed49913c0e6af687af429802664765e52b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Sep 2020 17:57:09 +0200 Subject: [PATCH 05/13] Update list.php --- htdocs/comm/propal/list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7845efe5823..e3097ea67d7 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -510,12 +510,11 @@ if ($resql) $refs = array(); $ids = array(); foreach ($toselect as $checked){ - $sqlp = "SELECT ref, rowid FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " .$checked." AND rowid NOT IN"; - $sqlp .= " (SELECT fk_propal FROM " . MAIN_DB_PREFIX . "propaldet)"; + $sqlp = "SELECT ref, rowid FROM ".MAIN_DB_PREFIX."propal WHERE rowid = " .$checked; $resqlp = $db->query($sqlp); if ($resqlp){ $objp = $db->fetch_object($resqlp); - if ($db->num_rows($resqlp)){ + if ($objp) { $cpt++; $refs[] = $objp->ref; $ids[] = $objp->rowid; From d913736bd1a6850d32bfe81bd958e3e17984100e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Sep 2020 17:59:21 +0200 Subject: [PATCH 06/13] Update list.php --- htdocs/comm/propal/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e3097ea67d7..511ba918a43 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1311,10 +1311,10 @@ 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'){ - foreach ($toselect as $checked){ - $sql = "SELECT ref, fk_statut AS statut FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$checked; + if ($action == 'validate') { + if (GETPOST('confirm') == 'yes') { + foreach ($toselect as $checked) { + $sql = "SELECT ref, fk_statut AS status FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$checked; $resql = $db->query($sql); if ($resql){ $obj = $db->fetch_object($resql); @@ -1327,7 +1327,7 @@ if ($resql) } else { $numref = $obj->ref; } - if ($obj->statut == 0){ + if ($obj->status == 0){ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 1, ref ='".$numref."' WHERE rowid = ".$checked; $resql = $db->query($sql); if ($resql){ @@ -1346,13 +1346,13 @@ if ($resql) } if ($action == "sign") { - if (GETPOST('confirm') == 'yes'){ + if (GETPOST('confirm') == 'yes') { foreach ($toselect as $checked) { - $sqlp = "SELECT ref, fk_statut AS statut FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $checked; + $sqlp = "SELECT ref, fk_statut AS status FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $checked; $resqlp = $db->query($sqlp); if ($resqlp) { $objp = $db->fetch_object($resqlp); - if ($objp->statut == 1) { + if ($objp->status == 1) { $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; $resqlp = $db->query($sqlp); if ($resqlp) { From 675fe05808021b129352278a6cf6456428dd377a Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 3 Sep 2020 09:51:49 +0200 Subject: [PATCH 07/13] Retours PR Standard --- htdocs/comm/propal/list.php | 50 +++++++++++++------------------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e89f7b5540a..3bef148a89b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1312,32 +1312,17 @@ 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'){ - foreach ($toselect as $checked){ - $sql = "SELECT ref, fk_statut AS statut FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$checked; - $resql = $db->query($sql); - if ($resql){ - $obj = $db->fetch_object($resql); - $ref = substr($obj->ref, 1, 4); - if ($ref == 'PROV') { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) { - setEventMessages($object->error, $object->errors, 'errors'); - } + if ($action == 'validate') { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + foreach ($toselect as $checked) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 0) { + $tmpproposal->valid($user); + setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); } else { - $numref = $obj->ref; - } - if ($obj->statut == 0){ - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 1, ref ='".$numref."' WHERE rowid = ".$checked; - $resql = $db->query($sql); - if ($resql){ - setEventMessage($numref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); - } else { - dol_print_error($db); - } - }else { - setEventMessage($numref." ".$langs->trans('IsNotADraft'), 'errors'); + setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); } } else { dol_print_error($db); @@ -1347,22 +1332,21 @@ if ($resql) } if ($action == "sign") { - if (GETPOST('confirm') == 'yes'){ + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); foreach ($toselect as $checked) { - $sqlp = "SELECT ref, fk_statut AS statut FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { - $objp = $db->fetch_object($resqlp); - if ($objp->statut == 1) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 1) { $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; $resqlp = $db->query($sqlp); if ($resqlp) { - setEventMessage($objp->ref . " " . $langs->trans('Signed'), 'mesgs'); + setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); } else { dol_print_error($db); } } else { - setEventMessage($objp->ref . " " . $langs->trans('CantBeSign'), 'errors'); + setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); } } else { dol_print_error($db); From c043501ee501e4eeb2f1f6d80b7f224cd210d2c3 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 3 Sep 2020 10:19:57 +0200 Subject: [PATCH 08/13] Retours PR standard --- htdocs/comm/propal/list.php | 40 ------------------------------------- 1 file changed, 40 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 9aca90d9b6d..f84f8652f96 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1313,7 +1313,6 @@ if ($resql) if ($action == 'validate') { if (GETPOST('confirm') == 'yes') { -<<<<<<< HEAD $tmpproposal = new Propal($db); foreach ($toselect as $checked) { $tmpproposal->fetch($checked); @@ -1323,56 +1322,17 @@ if ($resql) setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); -======= - foreach ($toselect as $checked) { - $sql = "SELECT ref, fk_statut AS status FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$checked; - $resql = $db->query($sql); - if ($resql){ - $obj = $db->fetch_object($resql); - $ref = substr($obj->ref, 1, 4); - if ($ref == 'PROV') { - $numref = $object->getNextNumRef($soc); - if (empty($numref)) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - $numref = $obj->ref; } - if ($obj->status == 0){ - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 1, ref ='".$numref."' WHERE rowid = ".$checked; - $resql = $db->query($sql); - if ($resql){ - setEventMessage($numref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); - } else { - dol_print_error($db); - } - }else { - setEventMessage($numref." ".$langs->trans('IsNotADraft'), 'errors'); ->>>>>>> d913736bd1a6850d32bfe81bd958e3e17984100e - } - } else { - dol_print_error($db); } } - } - } if ($action == "sign") { if (GETPOST('confirm') == 'yes') { -<<<<<<< HEAD $tmpproposal = new Propal($db); foreach ($toselect as $checked) { $tmpproposal->fetch($checked); if ($tmpproposal->fetch($checked)) { if ($tmpproposal->statut == 1) { -======= - foreach ($toselect as $checked) { - $sqlp = "SELECT ref, fk_statut AS status FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { - $objp = $db->fetch_object($resqlp); - if ($objp->status == 1) { ->>>>>>> d913736bd1a6850d32bfe81bd958e3e17984100e $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; $resqlp = $db->query($sqlp); if ($resqlp) { From 8c514c8025e5c2589bc52bf5dd05330d0e105ed5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 3 Sep 2020 08:24:12 +0000 Subject: [PATCH 09/13] Fixing style errors. --- htdocs/comm/propal/list.php | 78 ++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f84f8652f96..dfc16f4d810 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1312,47 +1312,47 @@ 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); - foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 0) { - $tmpproposal->valid($user); - setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); - } else { - setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); - } - } - } - - if ($action == "sign") { - if (GETPOST('confirm') == 'yes') { - $tmpproposal = new Propal($db); - foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 1) { - $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { - setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); - } else { - dol_print_error($db); - } - } else { - setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); - } + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + foreach ($toselect as $checked) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 0) { + $tmpproposal->valid($user); + setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); } else { - dol_print_error($db); + setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); } } } - } -} else { - dol_print_error($db); -} -// End of page -llxFooter(); -$db->close(); + if ($action == "sign") { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + foreach ($toselect as $checked) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 1) { + $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; + $resqlp = $db->query($sqlp); + if ($resqlp) { + setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); + } else { + dol_print_error($db); + } + } else { + setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); + } + } else { + dol_print_error($db); + } + } + } + } + } else { + dol_print_error($db); + } + + // End of page + llxFooter(); + $db->close(); From bcd9a0b29f4fed731eec1d5b6d8d390d6cfa12da Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 3 Sep 2020 14:25:17 +0200 Subject: [PATCH 10/13] Retours PR --- htdocs/comm/propal/list.php | 33 +++++++++++++++++++++------------ htdocs/langs/fr_FR/propal.lang | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dfc16f4d810..53b77b558ce 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1312,23 +1312,30 @@ 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); - foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 0) { - $tmpproposal->valid($user); - setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); - } else { - setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + $db->begin(); + 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'); + } + } else { + setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors'); + } } } + $db->commit(); } + } if ($action == "sign") { if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); + $db->begin(); foreach ($toselect as $checked) { $tmpproposal->fetch($checked); if ($tmpproposal->fetch($checked)) { @@ -1347,11 +1354,13 @@ if ($resql) dol_print_error($db); } } + $db->commit(); } } - } else { + +} else { dol_print_error($db); - } +} // End of page llxFooter(); diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 63508c00582..03981e2b17d 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -91,6 +91,7 @@ CantBeSign = ne peut pas être signée Sign = Signer Signed = signé CantBeSign = ne peut pas être signé +CantBeValidated = Ne peut pas être validé ConfirmMassValidation = Confirmer la validation ? ConfirmMassSignature = Confirmer la signature ? ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis brouillons selectionnés ? From 43590587e56efe5322057316fbf8552292cda8aa Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 3 Sep 2020 12:30:04 +0000 Subject: [PATCH 11/13] Fixing style errors. --- htdocs/comm/propal/list.php | 39 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 53b77b558ce..028d5559246 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1318,7 +1318,7 @@ if ($resql) foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked)) { if ($tmpproposal->statut == 0) { - if($tmpproposal->valid($user)){ + if ($tmpproposal->valid($user)){ setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -1332,32 +1332,31 @@ if ($resql) } } - if ($action == "sign") { - if (GETPOST('confirm') == 'yes') { - $tmpproposal = new Propal($db); - $db->begin(); - foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); - if ($tmpproposal->fetch($checked)) { - if ($tmpproposal->statut == 1) { - $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { - setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); - } else { - dol_print_error($db); - } + if ($action == "sign") { + if (GETPOST('confirm') == 'yes') { + $tmpproposal = new Propal($db); + $db->begin(); + foreach ($toselect as $checked) { + $tmpproposal->fetch($checked); + if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->statut == 1) { + $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; + $resqlp = $db->query($sqlp); + if ($resqlp) { + setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs'); } else { - setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); + dol_print_error($db); } } else { - dol_print_error($db); + setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors'); } + } else { + dol_print_error($db); } - $db->commit(); } + $db->commit(); } - + } } else { dol_print_error($db); } From c8c6be20382b050ed12b16aa3c07f1889eac4783 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 7 Sep 2020 10:50:01 +0200 Subject: [PATCH 12/13] Retours PR --- htdocs/comm/propal/list.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 028d5559246..f1dfaafaa62 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1315,6 +1315,7 @@ if ($resql) if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); + $error = 0; foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked)) { if ($tmpproposal->statut == 0) { @@ -1322,13 +1323,21 @@ if ($resql) 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(); } - $db->commit(); } } @@ -1336,25 +1345,31 @@ if ($resql) if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); + $error = 0; foreach ($toselect as $checked) { - $tmpproposal->fetch($checked); if ($tmpproposal->fetch($checked)) { if ($tmpproposal->statut == 1) { - $sqlp = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = 2 WHERE rowid = " . $checked; - $resqlp = $db->query($sqlp); - if ($resqlp) { + $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++; } } - $db->commit(); + if ($error){ + $db->rollback(); + } else { + $db->commit(); + } } } } else { From 570c72f6c9f64a3d2231a9e36dad70d77008bacc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Sep 2020 12:12:28 +0200 Subject: [PATCH 13/13] Update list.php --- htdocs/comm/propal/list.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f1dfaafaa62..504f669cd11 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -506,34 +506,6 @@ if ($resql) if ($massaction == 'prevalidate') { - $cpt = 0; - $refs = array(); - $ids = array(); - foreach ($toselect as $checked){ - $sqlp = "SELECT ref, rowid FROM ".MAIN_DB_PREFIX."propal WHERE rowid = " .$checked; - $resqlp = $db->query($sqlp); - if ($resqlp){ - $objp = $db->fetch_object($resqlp); - if ($objp) { - $cpt++; - $refs[] = $objp->ref; - $ids[] = $objp->rowid; - } - } else { - dol_print_error($db); - } - } - if ($cpt > 0) - { - if ($cpt==1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropNoProductOrService'), 'warnings'); - if ($cpt>1) setEventMessage($langs->trans('Warning').', '.$cpt.' '.$langs->trans('PropsNoProductOrService'), 'warnings'); - $cpt2 = 0; - foreach ($ids as $r) - { - setEventMessage("".$refs[$cpt2]."", 'warnings'); - $cpt2++; - } - } print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); }