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] 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; + } } }