Clean code

This commit is contained in:
Laurent Destailleur 2022-09-02 09:45:40 +02:00
parent c5f9990529
commit 2d794473a5
10 changed files with 9 additions and 20 deletions

View File

@ -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

View File

@ -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';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2022 SuperAdmin <test@dolibarr.com>
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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();

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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) {