From 39b03ef962ec1c000d28dc0e226cdb2b699b29fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Jan 2021 18:00:23 +0100 Subject: [PATCH 1/5] Update setup.php --- htdocs/modulebuilder/template/admin/setup.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 0db6b9b7648..417eb5a4e0f 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -145,7 +145,9 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity); + if ($conf->global->$constforval == "$value") { + dolibarr_del_const($db, $constforval, $conf->entity); + } } } } elseif ($action == 'setdoc') { @@ -338,9 +340,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { $nextval = $langs->trans($nextval); - $htmltooltip .= $nextval.'
'; + } + $htmltooltip .= $nextval.'
'; } else { $htmltooltip .= $langs->trans($module->error).'
'; } From e3271ed4288be6b9c097a567dd28781928675c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Jan 2021 18:01:53 +0100 Subject: [PATCH 2/5] Update mymodule.js.php --- htdocs/modulebuilder/template/js/mymodule.js.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/js/mymodule.js.php b/htdocs/modulebuilder/template/js/mymodule.js.php index b257e23fb48..fea88d695ec 100644 --- a/htdocs/modulebuilder/template/js/mymodule.js.php +++ b/htdocs/modulebuilder/template/js/mymodule.js.php @@ -53,8 +53,11 @@ if (!$res) die("Include of main fails"); header('Content-Type: application/javascript'); // Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. // You can use CTRL+F5 to refresh your browser cache. -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); -else header('Cache-Control: no-cache'); +if (empty($dolibarr_nocache)) { + header('Cache-Control: max-age=3600, public, must-revalidate'); +} else { + header('Cache-Control: no-cache'); +} ?> /* Javascript library of module MyModule */ From ffef95d628e4536518996962801c5e78a0b5038a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Jan 2021 18:02:29 +0100 Subject: [PATCH 3/5] Update myobject_agenda.php --- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 27c7e1de90b..fbd156f2a97 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -81,7 +81,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); From 5ee6c139745805180a3f0c248e928707cffd2255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Jan 2021 18:04:15 +0100 Subject: [PATCH 4/5] Update myobject_card.php --- htdocs/modulebuilder/template/myobject_card.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index af0751f416c..dc4426f7df9 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -128,7 +128,9 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object- $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} if (empty($reshook)) { $error = 0; @@ -137,8 +139,11 @@ if (empty($reshook)) { if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } } } @@ -476,7 +481,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Validate if ($object->status == $object::STATUS_DRAFT) { - if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); From 39453b720e3d2f4a555610fb1482ae95959e5e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Jan 2021 18:06:10 +0100 Subject: [PATCH 5/5] Update myobject_contact.php --- .../template/myobject_contact.php | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_contact.php b/htdocs/modulebuilder/template/myobject_contact.php index c48a997aba4..35e5be2716a 100644 --- a/htdocs/modulebuilder/template/myobject_contact.php +++ b/htdocs/modulebuilder/template/myobject_contact.php @@ -73,36 +73,30 @@ $permission = $user->rights->mymodule->myobject->write; * Add a new contact */ -if ($action == 'addcontact' && $permission) -{ +if ($action == 'addcontact' && $permission) { $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); - if ($result >= 0) - { + if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } else { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } else { setEventMessages($object->error, $object->errors, 'errors'); } } -} // Toggle the status of a contact -elseif ($action == 'swapstatut' && $permission) -{ +} elseif ($action == 'swapstatut' && $permission) { + // Toggle the status of a contact $result = $object->swapContactStatus(GETPOST('ligne')); -} // Deletes a contact -elseif ($action == 'deletecontact' && $permission) -{ +} elseif ($action == 'deletecontact' && $permission) { + // Deletes a contact $result = $object->delete_contact($lineid); - if ($result >= 0) - { + if ($result >= 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } else { @@ -132,8 +126,7 @@ $userstatic = new User($db); /* */ /* *************************************************************************** */ -if ($object->id) -{ +if ($object->id) { /* * Show tabs */ @@ -191,10 +184,11 @@ if ($object->id) // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); - foreach ($dirtpls as $reldir) - { + foreach ($dirtpls as $reldir) { $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); - if ($res) break; + if ($res) { + break; + } } }