From 8be2bd60a2d6e52affd2bac27e222f6f0b59a195 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 26 Aug 2022 11:46:03 +0200 Subject: [PATCH 1/2] Update contact.php --- htdocs/resource/contact.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index aca47d49743..12ee8b6ff03 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -1,10 +1,13 @@ * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Gilles Poirier - * + */ + +/** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -22,7 +25,7 @@ /** * \file htdocs/resource/contact.php * \ingroup resource - * \brief Onglet de gestion des contacts des resources + * \brief Contacts management tab for resources */ require '../main.inc.php'; @@ -32,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; // Load translation files required by the page -$langs->loadLangs(array('resource', 'sendings', 'companies')); +$langs->loadLangs(array('companies', 'resource', 'sendings')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -41,7 +44,7 @@ $action = GETPOST('action', 'aZ09'); $object = new DolResource($db); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Security check if ($user->socid) { @@ -55,10 +58,12 @@ if (!$user->rights->resource->read) { } + /* - * Add a new contact + * Actions */ +// Add a new contact if ($action == 'addcontact' && $user->rights->resource->write) { if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); @@ -80,10 +85,12 @@ if ($action == 'addcontact' && $user->rights->resource->write) { setEventMessages($mesg, null, 'errors'); } } elseif ($action == 'swapstatut' && $user->rights->resource->write) { - // Toggle the status of a contact + +// Toggle the status of a contact $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } elseif ($action == 'deletecontact' && $user->rights->resource->write) { - // Erase a contact + +// Erase a contact $result = $object->delete_contact(GETPOST('lineid', 'int')); if ($result >= 0) { @@ -106,7 +113,7 @@ $userstatic = new User($db); llxHeader('', $langs->trans("Resource")); -// Mode vue et edition +// View and edit mode if ($id > 0 || !empty($ref)) { $soc = new Societe($db); From c4ca2e7b9507c180bb6c4ac4830f6304f6696f08 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 26 Aug 2022 09:51:09 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/resource/contact.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 12ee8b6ff03..cf291cce28c 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -6,7 +6,7 @@ * Copyright (C) 2016 Gilles Poirier * */ - + /** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,12 +85,10 @@ if ($action == 'addcontact' && $user->rights->resource->write) { setEventMessages($mesg, null, 'errors'); } } elseif ($action == 'swapstatut' && $user->rights->resource->write) { - -// Toggle the status of a contact + // Toggle the status of a contact $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } elseif ($action == 'deletecontact' && $user->rights->resource->write) { - -// Erase a contact + // Erase a contact $result = $object->delete_contact(GETPOST('lineid', 'int')); if ($result >= 0) {