From 781a55429a204d7e9429029d078bc07022961978 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Aug 2018 20:03:41 +0200 Subject: [PATCH 1/3] FIX API template to delete a record --- htdocs/modulebuilder/template/class/api_mymodule.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 87802d80ef2..5b77c477429 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi */ function delete($id) { - if(! DolibarrApiAccess::$user->rights->myobject->supprimer) { + if(! DolibarrApiAccess::$user->rights->myobject->delete) { throw new RestException(401); } $result = $this->myobject->fetch($id); @@ -267,7 +267,7 @@ class MyModuleApi extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( !$this->myobject->delete($id)) + if( !$this->myobject->delete(DolibarrApiAccess::$user, 0)) { throw new RestException(500); } From 64427dafb65e24f8993aceeffbf453ea89ebbec0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Aug 2018 20:21:27 +0200 Subject: [PATCH 2/3] Fix back to page when canceling an edit in the module template --- htdocs/modulebuilder/template/myobject_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 137e394fe08..cfc79b2f232 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -122,7 +122,7 @@ if (empty($reshook)) $permissiontoadd = $user->rights->mymodule->write; $permissiontodelete = $user->rights->mymodule->delete; - if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id=__ID__'; + if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id='.($id > 0 ? $id : '__ID__'); $backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1); $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record From a82d86cec4e070f8d75f15636be699c187208f0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Aug 2018 10:46:47 +0200 Subject: [PATCH 3/3] FIX warning for late template invoices to remove when suspended --- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/compta/facture/invoicetemplate_list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 6719e7091c8..fb70da42665 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1513,7 +1513,7 @@ else //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); if (! $object->isMaxNbGenReached()) { - if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); + if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); } else { diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 13db00a02c2..b7b985dd73c 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -607,7 +607,7 @@ if ($resql) print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'':'') : ''.$langs->trans('NA').''); if (! $invoicerectmp->isMaxNbGenReached()) { - if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); + if (! $objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); } else {