From 4fb125703a73f9ea707ef89ce517a7311c062c89 Mon Sep 17 00:00:00 2001 From: 1ocate Date: Tue, 30 Nov 2021 17:46:06 +0700 Subject: [PATCH 1/6] For easy close shipment --- htdocs/expedition/list.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index ac5704511ef..2b73a8e54f0 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -211,6 +211,39 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +// If massaction is close +if ($massaction == 'classifyclose') +{ + $error=0; + $selectids = GETPOST('toselect', 'array'); + foreach ($selectids as $selectid) + { + // $object->fetch($selectid); + $object->fetch($selectid); + $result = $object->setClosed(); + + } + + $massaction = $action = 'classifyclose'; + + if ($result < 0) + { + $error++; + } + + + if (!$error) + { + $db->commit(); + + setEventMessage($langs->trans("Close Done")); + header('Location: '.$_SERVER["PHP_SELF"]); + exit; + } else { + $db->rollback(); + exit; + } +} /* * View @@ -473,7 +506,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $arrayofmassactions = array( 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged + 'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (in_array($massaction, array('presend'))) { From 48c4ddf3477983a63b9c7d9c9aad707ec72011d5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 30 Nov 2021 10:51:09 +0000 Subject: [PATCH 2/6] Fixing style errors. --- htdocs/expedition/list.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2b73a8e54f0..3787a8fa5a9 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -212,28 +212,23 @@ if (empty($reshook)) { } // If massaction is close -if ($massaction == 'classifyclose') -{ +if ($massaction == 'classifyclose') { $error=0; $selectids = GETPOST('toselect', 'array'); - foreach ($selectids as $selectid) - { - // $object->fetch($selectid); + foreach ($selectids as $selectid) { + // $object->fetch($selectid); $object->fetch($selectid); $result = $object->setClosed(); - } - $massaction = $action = 'classifyclose'; + $massaction = $action = 'classifyclose'; - if ($result < 0) - { + if ($result < 0) { $error++; } - if (!$error) - { + if (!$error) { $db->commit(); setEventMessage($langs->trans("Close Done")); From 169f5e6ad6f55176c921aa49726a82d525eb2207 Mon Sep 17 00:00:00 2001 From: Jay Yeo Date: Tue, 30 Nov 2021 20:08:56 +0700 Subject: [PATCH 3/6] Update list.php --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 3787a8fa5a9..2dc8513a361 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -501,7 +501,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $arrayofmassactions = array( 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged + 'classifyclose'=>$langs->trans("Close"), 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (in_array($massaction, array('presend'))) { From 31dd11c9c018004e10f7376870e583789909ac23 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 30 Nov 2021 13:11:28 +0000 Subject: [PATCH 4/6] Fixing style errors. --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2dc8513a361..0668a764ea4 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -501,7 +501,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $arrayofmassactions = array( 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'classifyclose'=>$langs->trans("Close"), + 'classifyclose'=>$langs->trans("Close"), 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (in_array($massaction, array('presend'))) { From dd6706e521dd70076659bc9caaa9a4d295ceb635 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 5 Apr 2022 17:31:34 +0200 Subject: [PATCH 5/6] NEW display errors in a message box after generating documents --- htdocs/core/class/commonobject.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 232aa6b5789..cc3ea5ae820 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5380,16 +5380,19 @@ abstract class CommonObject return 1; } else { $outputlangs->charset_output = $sav_charset_output; - dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors); + dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR); + setEventMessages($obj->error, $obj->errors, 'errors'); return -1; } } else { if (!$filefound) { $this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele; - dol_print_error('', $this->error); + dol_syslog($this->error, LOG_ERR); + setEventMessage($this->error, 'errors'); } else { $this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound); - dol_print_error('', $this->error); + dol_syslog($this->error, LOG_ERR); + setEventMessage($this->error, 'errors'); } return -1; } From e6a0ca5042e78631f24cfebf98d58513b2595a1d Mon Sep 17 00:00:00 2001 From: lvessiller Date: Thu, 7 Apr 2022 16:32:08 +0200 Subject: [PATCH 6/6] FIX errors to catch --- htdocs/core/class/commonobject.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cc3ea5ae820..ea7de60f67e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5380,19 +5380,20 @@ abstract class CommonObject return 1; } else { $outputlangs->charset_output = $sav_charset_output; + $this->error = $obj->error; + $this->errors = $obj->errors; dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR); - setEventMessages($obj->error, $obj->errors, 'errors'); return -1; } } else { if (!$filefound) { $this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele; + $this->errors[] = $this->error; dol_syslog($this->error, LOG_ERR); - setEventMessage($this->error, 'errors'); } else { $this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound); + $this->errors[] = $this->error; dol_syslog($this->error, LOG_ERR); - setEventMessage($this->error, 'errors'); } return -1; }