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', ...) $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 // The language file dedicated to your module
$this->langfiles = array("webhook"); $this->langfiles = array();
// Prerequisites // Prerequisites
$this->phpmin = array(5, 6); // Minimum version of PHP required by module $this->phpmin = array(5, 6); // Minimum version of PHP required by module

View File

@ -833,7 +833,7 @@ class Target extends CommonObject
// phpcs:enable // phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
//$langs->load("webhook@webhook");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
@ -928,7 +928,6 @@ class Target extends CommonObject
public function getNextNumRef() public function getNextNumRef()
{ {
global $langs, $conf; global $langs, $conf;
$langs->load("webhook@webhook");
if (empty($conf->global->WEBHOOK_TARGET_ADDON)) { if (empty($conf->global->WEBHOOK_TARGET_ADDON)) {
$conf->global->WEBHOOK_TARGET_ADDON = 'mod_target_standard'; $conf->global->WEBHOOK_TARGET_ADDON = 'mod_target_standard';
@ -993,8 +992,6 @@ class Target extends CommonObject
$result = 0; $result = 0;
$includedocgeneration = 0; $includedocgeneration = 0;
$langs->load("webhook@webhook");
if (!dol_strlen($modele)) { if (!dol_strlen($modele)) {
$modele = 'standard_target'; $modele = 'standard_target';

View File

@ -1,5 +1,5 @@
<?php <?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 * 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 * it under the terms of the GNU General Public License as published by
@ -30,8 +30,6 @@ function webhookAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf;
$langs->load("webhook@webhook");
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath("/admin/webhook.php", 1); $head[$h][0] = dol_buildpath("/admin/webhook.php", 1);

View File

@ -1,5 +1,5 @@
<?php <?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 * 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 * it under the terms of the GNU General Public License as published by
@ -30,8 +30,6 @@ function targetPrepareHead($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;
$langs->load("webhook@webhook");
$h = 0; $h = 0;
$head = array(); $head = array();

View File

@ -32,7 +32,7 @@ dol_include_once('/webhook/lib/webhook_target.lib.php');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('webhook', 'other')); $langs->loadLangs(array('other'));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $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'); dol_include_once('/webhook/lib/webhook_target.lib.php');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('webhook', 'other')); $langs->loadLangs(array('other'));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $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'); dol_include_once('/webhook/lib/webhook_target.lib.php');
// Load translation files required by the page // 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 $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha'); $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'); //dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('webhook', 'other')); $langs->loadLangs(array('other'));
// Get Parameters // Get Parameters
$id = GETPOST('id', 'int'); $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'); dol_include_once('/webhook/lib/webhook_target.lib.php');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('webhook', 'companies')); $langs->loadLangs(array('companies'));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');

View File

@ -57,10 +57,6 @@ if (!$res) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array('webhook'));
// Security check // Security check
// if (! $user->rights->webhook->myobject->read) { // if (! $user->rights->webhook->myobject->read) {