Clean code
This commit is contained in:
parent
65a2093cd1
commit
57358b618b
@ -44,8 +44,6 @@ abstract class ModeleAction extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'action';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -84,8 +84,6 @@ abstract class ModelePDFAsset extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'asset';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -48,8 +48,6 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'bankaccount';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ abstract class ModelePDFBom extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'bom';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -146,8 +146,6 @@ abstract class ModeleChequeReceipts extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'chequereceipt';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -51,8 +51,6 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'order';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -54,8 +54,6 @@ abstract class ModelePDFContract extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'contract';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -52,8 +52,6 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'delivery';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ abstract class ModeleDon extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'donation';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -53,8 +53,6 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'shipping';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -75,8 +75,6 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'expensereport';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
/**
|
||||
* Parent class for export modules
|
||||
*/
|
||||
class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by liste_modeles
|
||||
class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by listOfAvailableExportFormat
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
@ -44,7 +44,6 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
|
||||
public $libversion = array();
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load into memory list of available export format
|
||||
*
|
||||
@ -52,10 +51,9 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates (same content than array this->driverlabel)
|
||||
*/
|
||||
public function liste_modeles($db, $maxfilenamelength = 0)
|
||||
public function listOfAvailableExportFormat($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::liste_modeles");
|
||||
dol_syslog(get_class($this)."::listOfAvailableExportFormat");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/export/";
|
||||
$handle = opendir($dir);
|
||||
|
||||
@ -61,8 +61,6 @@ abstract class ModelePDFFactures extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'invoice';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -51,8 +51,6 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'ficheinter';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ abstract class ModelePDFHoliday extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'holiday';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -49,8 +49,6 @@ abstract class ModelePDFEvaluation extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'evaluation';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -155,18 +155,16 @@ class ModeleImports
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Charge en memoire et renvoie la liste des modeles actifs
|
||||
* Load into memory list of available import format
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
public function liste_modeles($db, $maxfilenamelength = 0)
|
||||
public function listOfAvailableImportFormat($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::liste_modeles");
|
||||
dol_syslog(get_class($this)."::listOfAvailableImportFormat");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/import/";
|
||||
$handle = opendir($dir);
|
||||
|
||||
@ -51,8 +51,6 @@ class ModelePDFCards
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'member';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ abstract class ModelePDFMember extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
|
||||
$type = 'member';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -85,8 +85,6 @@ abstract class ModelePDFMovement extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'movement';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ abstract class ModelePDFMo extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'mrp';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -51,8 +51,6 @@ class ModelePDFLabels
|
||||
public function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'members_labels';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'product_batch';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -103,8 +103,6 @@ abstract class ModelePDFProjects extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'project';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -49,8 +49,6 @@ abstract class ModelePDFTask extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'project_task';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -190,21 +190,21 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) {
|
||||
// Model for creation
|
||||
$list = ModelePDFPropales::liste_modeles($this->db);
|
||||
$texte .= '<table width="50%;">';
|
||||
$texte .= '<table width="50%">';
|
||||
$texte .= '<tr>';
|
||||
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
|
||||
$texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalCreate").'</td>';
|
||||
$texte .= '<td colspan="">';
|
||||
$texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT);
|
||||
$texte .= "</td></tr>";
|
||||
|
||||
$texte .= '<tr>';
|
||||
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
|
||||
$texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalToBill").'</td>';
|
||||
$texte .= '<td colspan="">';
|
||||
$texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL);
|
||||
$texte .= "</td></tr>";
|
||||
$texte .= '<tr>';
|
||||
|
||||
$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
|
||||
$texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalClosed").'</td>';
|
||||
$texte .= '<td colspan="">';
|
||||
$texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED);
|
||||
$texte .= "</td></tr>";
|
||||
|
||||
@ -53,8 +53,6 @@ abstract class ModelePDFPropales extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'propal';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -43,8 +43,6 @@ abstract class ModelePdfReception extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'reception';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
|
||||
public static function liste_modeles($dbs, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
|
||||
$type = 'company';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -402,7 +402,7 @@ class pdf_standard extends ModelePDFStock
|
||||
|
||||
// Label
|
||||
$pdf->SetXY($this->posxlabel + 0.8, $curY);
|
||||
$pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3, dol_trunc($objp->produit, 24), 0, 'L');
|
||||
$pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3, dol_trunc($productstatic->label, 24), 0, 'L');
|
||||
|
||||
// Quantity
|
||||
$valtoshow = price2num($objp->value, 'MS');
|
||||
|
||||
@ -75,8 +75,6 @@ abstract class ModelePDFStock extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'stock';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ abstract class ModelePDFStockTransfer extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'stocktransfer';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -51,8 +51,6 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'invoice_supplier';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -54,8 +54,6 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'order_supplier';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -74,8 +74,6 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'supplier_payment';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -53,8 +53,6 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'supplier_proposal';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -44,8 +44,6 @@ abstract class ModelePDFTicket extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'ticket';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ abstract class ModelePDFUser extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'user';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'group';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -50,8 +50,6 @@ abstract class ModelePDFWorkstation extends CommonDocGenerator
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'workstation';
|
||||
$list = array();
|
||||
|
||||
|
||||
@ -1187,7 +1187,7 @@ if ($step == 5 && $datatoexport) {
|
||||
$htmltabloflibs .= '<td class="right">'.$langs->trans("LibraryVersion").'</td>';
|
||||
$htmltabloflibs .= '</tr>'."\n";
|
||||
|
||||
$liste = $objmodelexport->liste_modeles($db);
|
||||
$liste = $objmodelexport->listOfAvailableExportFormat($db);
|
||||
$listeall = $liste;
|
||||
foreach ($listeall as $key => $val) {
|
||||
if (preg_match('/__\(Disabled\)__/', $listeall[$key])) {
|
||||
|
||||
@ -72,7 +72,7 @@ print '</tr>';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php';
|
||||
$model = new ModeleExports($db);
|
||||
$liste = $model->liste_modeles($db); // This is not a static method for exports because method load non static properties
|
||||
$liste = $model->listOfAvailableExportFormat($db); // This is not a static method for exports because method load non static properties
|
||||
|
||||
foreach ($liste as $key => $val) {
|
||||
if (preg_match('/__\(Disabled\)__/', $liste[$key])) {
|
||||
|
||||
@ -485,7 +485,7 @@ if ($step == 2 && $datatoimport) {
|
||||
print '<tr class="liste_titre"><td colspan="5">';
|
||||
print $langs->trans("FileMustHaveOneOfFollowingFormat");
|
||||
print '</td></tr>';
|
||||
$list = $objmodelimport->liste_modeles($db);
|
||||
$list = $objmodelimport->listOfAvailableImportFormat($db);
|
||||
foreach ($list as $key) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_picto_common($key, $objmodelimport->getPictoForKey($key)).'</td>';
|
||||
@ -529,7 +529,7 @@ if ($step == 3 && $datatoimport) {
|
||||
$param .= '&enclosure='.urlencode($enclosure);
|
||||
}
|
||||
|
||||
$list = $objmodelimport->liste_modeles($db);
|
||||
$list = $objmodelimport->listOfAvailableImportFormat($db);
|
||||
|
||||
llxHeader('', $langs->trans("NewImport"), $help_url);
|
||||
|
||||
@ -763,7 +763,7 @@ if ($step == 4 && $datatoimport) {
|
||||
//var_dump($array_match_file_to_database);
|
||||
|
||||
$model = $format;
|
||||
$list = $objmodelimport->liste_modeles($db);
|
||||
$list = $objmodelimport->listOfAvailableImportFormat($db);
|
||||
|
||||
if (empty($separator)) {
|
||||
$separator = (empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE);
|
||||
@ -1547,7 +1547,7 @@ if ($step == 5 && $datatoimport) {
|
||||
}
|
||||
|
||||
$model = $format;
|
||||
$list = $objmodelimport->liste_modeles($db);
|
||||
$list = $objmodelimport->listOfAvailableImportFormat($db);
|
||||
|
||||
// Create classe to use for import
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/import/";
|
||||
@ -2010,7 +2010,7 @@ if ($step == 6 && $datatoimport) {
|
||||
}
|
||||
|
||||
$model = $format;
|
||||
$list = $objmodelimport->liste_modeles($db);
|
||||
$list = $objmodelimport->listOfAvailableImportFormat($db);
|
||||
$importid = GETPOST("importid", 'alphanohtml');
|
||||
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ print '</tr>';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php';
|
||||
$model = new ModeleImports();
|
||||
$list = $model->liste_modeles($db);
|
||||
$list = $model->listOfAvailableImportFormat($db);
|
||||
|
||||
foreach ($list as $key) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -72,6 +72,7 @@ exclude:
|
||||
- name: PhpConditionCheckedByNextConditionInspection
|
||||
- name: RegExpSingleCharAlternation
|
||||
- name: PhpSuspiciousNameCombinationInspection
|
||||
- name: PhpObjectFieldsAreOnlyWrittenInspection
|
||||
- name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user