forked from Wavyzz/dolibarr
clean code (#35677)
* clean code * clean code * clean code * clean code * clean code * clean code
This commit is contained in:
@@ -804,12 +804,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../htdocs/admin/modules.php
|
path: ../../../htdocs/admin/modules.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property DolibarrModules\:\:\$langfiles \(array\<string\>\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/admin/modules.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^Right side of && is always true\.$#'
|
message: '#^Right side of && is always true\.$#'
|
||||||
identifier: booleanAnd.rightAlwaysTrue
|
identifier: booleanAnd.rightAlwaysTrue
|
||||||
@@ -1104,12 +1098,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../htdocs/admin/tools/ui/class/documentation.class.php
|
path: ../../../htdocs/admin/tools/ui/class/documentation.class.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Ternary operator condition is always false\.$#'
|
|
||||||
identifier: ternary.alwaysFalse
|
|
||||||
count: 2
|
|
||||||
path: ../../../htdocs/admin/triggers.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^Variable \$label might not be defined\.$#'
|
message: '#^Variable \$label might not be defined\.$#'
|
||||||
identifier: variable.undefined
|
identifier: variable.undefined
|
||||||
@@ -13524,12 +13512,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../htdocs/product/stock/movement_list.php
|
path: ../../../htdocs/product/stock/movement_list.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Variable \$idAlreadyReverse might not be defined\.$#'
|
|
||||||
identifier: variable.undefined
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/product/stock/movement_list.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^Variable \$listofobjectref might not be defined\.$#'
|
message: '#^Variable \$listofobjectref might not be defined\.$#'
|
||||||
identifier: variable.undefined
|
identifier: variable.undefined
|
||||||
@@ -14607,7 +14589,7 @@ parameters:
|
|||||||
-
|
-
|
||||||
message: '#^Variable \$suffix might not be defined\.$#'
|
message: '#^Variable \$suffix might not be defined\.$#'
|
||||||
identifier: variable.undefined
|
identifier: variable.undefined
|
||||||
count: 2
|
count: 1
|
||||||
path: ../../../htdocs/public/eventorganization/subscriptionok.php
|
path: ../../../htdocs/public/eventorganization/subscriptionok.php
|
||||||
|
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -540,6 +540,7 @@ foreach ($modulesdir as $dir) {
|
|||||||
if (class_exists($modName)) {
|
if (class_exists($modName)) {
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
'@phan-var-force DolibarrModules $objMod';
|
'@phan-var-force DolibarrModules $objMod';
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
$modNameLoaded[$modName] = $dir;
|
$modNameLoaded[$modName] = $dir;
|
||||||
if (!$objMod->numero > 0 && $modName != 'modUser') {
|
if (!$objMod->numero > 0 && $modName != 'modUser') {
|
||||||
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
|
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
|
||||||
@@ -653,6 +654,7 @@ foreach ($modulesdir as $dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
'@phan-var-force array<string,DolibarrModules> $modules';
|
'@phan-var-force array<string,DolibarrModules> $modules';
|
||||||
|
/** @var array<string,DolibarrModules> $modules */
|
||||||
|
|
||||||
if ($action == 'reset_confirm' && $user->admin) {
|
if ($action == 'reset_confirm' && $user->admin) {
|
||||||
if (!empty($modules[$value])) {
|
if (!empty($modules[$value])) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -73,9 +73,9 @@ $align = '';
|
|||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder">';
|
print '<table class="noborder">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align ? 'align="'.$align.'"' : ''), $sortfield, $sortorder, '', 1)."\n";
|
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, '', $sortfield, $sortorder, '', 1)."\n";
|
||||||
print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n";
|
print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n";
|
||||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, ($align ? 'align="'.$align.'"' : ''), $sortfield, $sortorder, '', 1)."\n";
|
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, '', $sortfield, $sortorder, '', 1)."\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
foreach ($triggers as $trigger) {
|
foreach ($triggers as $trigger) {
|
||||||
@@ -83,11 +83,10 @@ foreach ($triggers as $trigger) {
|
|||||||
print '<td>'.$trigger['picto'].' '.$trigger['file'].'</td>';
|
print '<td>'.$trigger['picto'].' '.$trigger['file'].'</td>';
|
||||||
print '<td class="center">'.$trigger['status'].'</td>';
|
print '<td class="center">'.$trigger['status'].'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = $trigger['info'];
|
$htmltooltip = $trigger['info'];
|
||||||
$text .= "<br>\n<strong>".$langs->trans("File")."</strong>:<br>\n".$trigger['relpath'];
|
$htmltooltip .= "<br>\n<strong>".$langs->trans("File")."</strong>:<br>\n".$trigger['relpath'];
|
||||||
//$text.="\n".$langs->trans("ExternalModule",$trigger['isocreorexternal']);
|
//$htmltooltip.="\n".$langs->trans("ExternalModule",$trigger['isocreorexternal']);
|
||||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
print $form->textwithpicto('', $htmltooltip);
|
||||||
print $form->textwithpicto('', $text);
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1222,6 +1222,7 @@ function activateModule($value, $withdeps = 1, $noconfverification = 0)
|
|||||||
|
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
'@phan-var-force DolibarrModules $objMod';
|
'@phan-var-force DolibarrModules $objMod';
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
|
|
||||||
// Test if PHP version ok
|
// Test if PHP version ok
|
||||||
$verphp = versionphparray();
|
$verphp = versionphparray();
|
||||||
@@ -1364,6 +1365,7 @@ function unActivateModule($value, $requiredby = 1)
|
|||||||
if ($found) {
|
if ($found) {
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
'@phan-var-force DolibarrModules $objMod';
|
'@phan-var-force DolibarrModules $objMod';
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
$result = $objMod->remove();
|
$result = $objMod->remove();
|
||||||
if ($result <= 0) {
|
if ($result <= 0) {
|
||||||
$ret = $objMod->error;
|
$ret = $objMod->error;
|
||||||
@@ -1437,6 +1439,7 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
|
|||||||
include_once $dir.$file;
|
include_once $dir.$file;
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
'@phan-var-force DolibarrModules $objMod';
|
'@phan-var-force DolibarrModules $objMod';
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
|
|
||||||
if ($objMod->numero > 0) {
|
if ($objMod->numero > 0) {
|
||||||
$j = $objMod->numero;
|
$j = $objMod->numero;
|
||||||
@@ -1604,6 +1607,7 @@ function activateModulesRequiredByCountry($country_code)
|
|||||||
include_once $dir.$file;
|
include_once $dir.$file;
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
'@phan-var-force DolibarrModules $objMod';
|
'@phan-var-force DolibarrModules $objMod';
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
|
|
||||||
$modulequalified = 1;
|
$modulequalified = 1;
|
||||||
|
|
||||||
@@ -1680,6 +1684,7 @@ function complete_elementList_with_modules(&$elementList)
|
|||||||
if ($modName) {
|
if ($modName) {
|
||||||
include_once $dir.$file;
|
include_once $dir.$file;
|
||||||
$objMod = new $modName($db);
|
$objMod = new $modName($db);
|
||||||
|
/** @var DolibarrModules $objMod */
|
||||||
|
|
||||||
if ($objMod->numero > 0) {
|
if ($objMod->numero > 0) {
|
||||||
$j = $objMod->numero;
|
$j = $objMod->numero;
|
||||||
@@ -1930,7 +1935,7 @@ function form_constantes($tableau, $strictw3c = 2, $helptext = '', $text = 'Valu
|
|||||||
//var_dump($arrayofmessagename);
|
//var_dump($arrayofmessagename);
|
||||||
print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
print $form->selectarray('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/admin/mails_templates.php?action=create&type_template='.urlencode($tmp[1]).'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('', 'add').'</a>';
|
print '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/mails_templates.php', ['action' => 'create', 'type_template' => $tmp[1], 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"])]).'">'.img_picto('', 'add').'</a>';
|
||||||
} elseif (preg_match('/MAIL_FROM$/i', $const)) {
|
} elseif (preg_match('/MAIL_FROM$/i', $const)) {
|
||||||
print img_picto('', 'email', 'class="pictofixedwidth"').'<input type="text" class="flat minwidth300" name="constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')).'" value="'.dol_escape_htmltag($obj->value).'">';
|
print img_picto('', 'email', 'class="pictofixedwidth"').'<input type="text" class="flat minwidth300" name="constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')).'" value="'.dol_escape_htmltag($obj->value).'">';
|
||||||
} else { // type = 'string' ou 'chaine'
|
} else { // type = 'string' ou 'chaine'
|
||||||
|
|||||||
@@ -7245,7 +7245,7 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink);
|
$sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink);
|
||||||
$out .= '<a class="reposition" href="' . $file . '?sortfield=' . urlencode($field) . '&sortorder=' . urlencode($sortordertouseinlink) . '&begin=' . urlencode($begin) . $options . '"';
|
$out .= '<a class="reposition" href="' . dolBuildUrl($file, ['sortfield' => $field, 'sortorder' => $sortordertouseinlink, 'begin' => $begin]) . $options . '"';
|
||||||
//$out .= (getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') ? '' : ' title="'.dol_escape_htmltag($langs->trans($name)).'"');
|
//$out .= (getDolGlobalString('MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') ? '' : ' title="'.dol_escape_htmltag($langs->trans($name)).'"');
|
||||||
$out .= '>';
|
$out .= '>';
|
||||||
}
|
}
|
||||||
@@ -12670,8 +12670,11 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$url = preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
|
||||||
$newtab[0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1);
|
$link = parse_url($url);
|
||||||
|
$query = [];
|
||||||
|
parse_str($link['query'], $query);
|
||||||
|
$newtab[0] = dolBuildUrl(dol_buildpath($link['path'], 1), $query);
|
||||||
$newtab[1] = $label;
|
$newtab[1] = $label;
|
||||||
$newtab[2] = str_replace('+', '', $values[1]);
|
$newtab[2] = str_replace('+', '', $values[1]);
|
||||||
$h++;
|
$h++;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
|
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
|
||||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -423,7 +423,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]|array<string,string[]> List of module class names that must be enabled if this module is enabled. e.g.: array('modAnotherModule', 'FR'=>'modYetAnotherModule')
|
* @var null|string[]|array<string,string[]> List of module class names that must be enabled if this module is enabled. e.g.: array('modAnotherModule', 'FR'=>'modYetAnotherModule')
|
||||||
* Another example : array('always'=>array("modBanque", "modFacture", "modProduct", "modCategorie"), 'FR'=>array('modBlockedLog'));
|
* Another example : array('always'=>array("modBanque", "modFacture", "modProduct", "modCategorie"), 'FR'=>array('modBlockedLog'));
|
||||||
* Note: Example in modTakePos: array('always'=>array("modBanque", "modFacture", "modProduct", "modCategorie"), 'FR'=>array('modBlockedLog'));
|
* Note: Example in modTakePos: array('always'=>array("modBanque", "modFacture", "modProduct", "modCategorie"), 'FR'=>array('modBlockedLog'));
|
||||||
* Example in modAccounting: array("modFacture", "modBanque", "modTax");
|
* Example in modAccounting: array("modFacture", "modBanque", "modTax");
|
||||||
@@ -439,13 +439,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
public $requiredby;
|
public $requiredby;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] List of module class names as string this module is in conflict with.
|
* @var null|string[] List of module class names as string this module is in conflict with.
|
||||||
* @see $depends
|
* @see $depends
|
||||||
*/
|
*/
|
||||||
public $conflictwith;
|
public $conflictwith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Module language files
|
* @var null|string[] Module language files
|
||||||
*/
|
*/
|
||||||
public $langfiles;
|
public $langfiles;
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
public $warnings_unactivation;
|
public $warnings_unactivation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int[] Minimum version of PHP required by module.
|
* @var null|int[] Minimum version of PHP required by module.
|
||||||
* e.g.: PHP ≥ 7.0 = array(7, 0)
|
* e.g.: PHP ≥ 7.0 = array(7, 0)
|
||||||
*/
|
*/
|
||||||
public $phpmin;
|
public $phpmin;
|
||||||
@@ -482,7 +482,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||||||
public $phpmax;
|
public $phpmax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int[] Minimum version of Dolibarr required by module.
|
* @var null|int[] Minimum version of Dolibarr required by module.
|
||||||
* e.g.: Dolibarr ≥ 3.6 = array(3, 6)
|
* e.g.: Dolibarr ≥ 3.6 = array(3, 6)
|
||||||
*/
|
*/
|
||||||
public $need_dolibarr_version;
|
public $need_dolibarr_version;
|
||||||
|
|||||||
Reference in New Issue
Block a user