From 2d794473a5aefac46d8f2fd03344a75b9e7b5a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 09:45:40 +0200 Subject: [PATCH] Clean code --- htdocs/core/modules/modWebhook.class.php | 2 +- htdocs/webhook/class/target.class.php | 5 +---- htdocs/webhook/lib/webhook.lib.php | 4 +--- htdocs/webhook/lib/webhook_target.lib.php | 4 +--- htdocs/webhook/target_agenda.php | 2 +- htdocs/webhook/target_card.php | 2 +- htdocs/webhook/target_contact.php | 2 +- htdocs/webhook/target_list.php | 2 +- htdocs/webhook/target_note.php | 2 +- htdocs/webhook/webhookindex.php | 4 ---- 10 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index fbcb5f81003..fd7f658bd48 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -141,7 +141,7 @@ class modWebhook extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) // The language file dedicated to your module - $this->langfiles = array("webhook"); + $this->langfiles = array(); // Prerequisites $this->phpmin = array(5, 6); // Minimum version of PHP required by module diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 7eabbe397ab..991201a8d91 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -833,7 +833,7 @@ class Target extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("webhook@webhook"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); @@ -928,7 +928,6 @@ class Target extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("webhook@webhook"); if (empty($conf->global->WEBHOOK_TARGET_ADDON)) { $conf->global->WEBHOOK_TARGET_ADDON = 'mod_target_standard'; @@ -993,8 +992,6 @@ class Target extends CommonObject $result = 0; $includedocgeneration = 0; - $langs->load("webhook@webhook"); - if (!dol_strlen($modele)) { $modele = 'standard_target'; diff --git a/htdocs/webhook/lib/webhook.lib.php b/htdocs/webhook/lib/webhook.lib.php index 6c511180b6e..6c48eccfdf8 100644 --- a/htdocs/webhook/lib/webhook.lib.php +++ b/htdocs/webhook/lib/webhook.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Laurent Destailleur * * 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 @@ -30,8 +30,6 @@ function webhookAdminPrepareHead() { global $langs, $conf; - $langs->load("webhook@webhook"); - $h = 0; $head = array(); $head[$h][0] = dol_buildpath("/admin/webhook.php", 1); diff --git a/htdocs/webhook/lib/webhook_target.lib.php b/htdocs/webhook/lib/webhook_target.lib.php index fb01a8f95aa..894e3134c0c 100644 --- a/htdocs/webhook/lib/webhook_target.lib.php +++ b/htdocs/webhook/lib/webhook_target.lib.php @@ -1,5 +1,5 @@ * * 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 @@ -30,8 +30,6 @@ function targetPrepareHead($object) { global $db, $langs, $conf; - $langs->load("webhook@webhook"); - $h = 0; $head = array(); diff --git a/htdocs/webhook/target_agenda.php b/htdocs/webhook/target_agenda.php index fd3464d3b67..bf4e883411b 100644 --- a/htdocs/webhook/target_agenda.php +++ b/htdocs/webhook/target_agenda.php @@ -32,7 +32,7 @@ dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 7e4ef4bb265..0b9ff450d44 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -31,7 +31,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_contact.php b/htdocs/webhook/target_contact.php index 9aa51b2c44e..460cc7d8ea7 100644 --- a/htdocs/webhook/target_contact.php +++ b/htdocs/webhook/target_contact.php @@ -30,7 +30,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'companies', 'other', 'mails')); +$langs->loadLangs(array('companies', 'other', 'mails')); $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index d80661906c0..2a4f2edfcf1 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -36,7 +36,7 @@ require_once __DIR__.'/class/target.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get Parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_note.php b/htdocs/webhook/target_note.php index c9fe74c8758..4b9be8aaea1 100644 --- a/htdocs/webhook/target_note.php +++ b/htdocs/webhook/target_note.php @@ -29,7 +29,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'companies')); +$langs->loadLangs(array('companies')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/webhookindex.php b/htdocs/webhook/webhookindex.php index 50a7ec6d9c1..77c717b628d 100644 --- a/htdocs/webhook/webhookindex.php +++ b/htdocs/webhook/webhookindex.php @@ -57,10 +57,6 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -// Load translation files required by the page -$langs->loadLangs(array('webhook')); - - // Security check // if (! $user->rights->webhook->myobject->read) {