-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qual: Fixes for modulebuilder (phan, phpstan, bugs, format)
- Loading branch information
Showing
40 changed files
with
833 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <[email protected]> | ||
* Copyright (C) 2004-2008 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2004 Eric Seigne <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -390,6 +391,7 @@ public static function getEmailingSelectorsList($forcedir = null) | |
|
||
$objMod = new $modName($db); | ||
if (is_object($objMod)) { | ||
'@phan-var-force ModeleBoxes $objMod'; | ||
// Define disabledbyname and disabledbymodule | ||
$disabledbyname = 0; | ||
$disabledbymodule = 0; // TODO Set to 2 if module is not enabled | ||
|
@@ -400,7 +402,7 @@ public static function getEmailingSelectorsList($forcedir = null) | |
$disabledbyname = 1; | ||
} | ||
|
||
// We set info of modules | ||
// We set info of modules @phan-suppress-next-line PhanUndeclaredProperty | ||
$widget[$j]['picto'] = (empty($objMod->picto) ? (empty($objMod->boximg) ? img_object('', 'generic') : $objMod->boximg) : img_object('', $objMod->picto)); | ||
$widget[$j]['file'] = $files[$key]; | ||
$widget[$j]['fullpath'] = $fullpath[$key]; | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]> | ||
* Copyright (C) ---Put here your own copyright and developer email--- | ||
* Copyright (C) ---Replace with your own copyright and developer email--- | ||
* | ||
* 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 | ||
|
@@ -29,7 +29,10 @@ | |
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; | ||
} | ||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME | ||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; | ||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; | ||
$tmp2 = realpath(__FILE__); | ||
$i = strlen($tmp) - 1; | ||
$j = strlen($tmp2) - 1; | ||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { | ||
$i--; | ||
$j--; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2004-2017 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) ---Put here your own copyright and developer email--- | ||
* Copyright (C) ---Replace with your own copyright and developer email--- | ||
* | ||
* 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 | ||
|
@@ -218,26 +217,26 @@ | |
|
||
$className = $myTmpObjects[$tmpobjectkey]['class']; | ||
$tmpobject = new $className($db); | ||
'@phan-var-force MyObject $tmpobject'; | ||
$tmpobject->initAsSpecimen(); | ||
|
||
// Search template files | ||
$file = ''; | ||
$className = ''; | ||
$filefound = 0; | ||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); | ||
foreach ($dirmodels as $reldir) { | ||
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); | ||
if (file_exists($file)) { | ||
$filefound = 1; | ||
$className = "pdf_".$modele."_".strtolower($tmpobjectkey); | ||
break; | ||
} | ||
} | ||
|
||
if ($filefound) { | ||
if ($className !== '') { | ||
require_once $file; | ||
|
||
$module = new $className($db); | ||
'@phan-var-force ModelePDFMyObject $module'; | ||
|
||
'@phan-var-force ModelePDFMyObject $module'; | ||
|
||
|
@@ -372,8 +371,7 @@ | |
require_once $dir.'/'.$file.'.php'; | ||
|
||
$module = new $file($db); | ||
|
||
'@phan-var-force CommonNumRefGenerator $module'; | ||
'@phan-var-force ModeleNumRefMyObject $module'; | ||
|
||
// Show modules according to features level | ||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { | ||
|
@@ -416,6 +414,7 @@ | |
|
||
$className = $myTmpObjectArray['class']; | ||
$mytmpinstance = new $className($db); | ||
'@phan-var-force MyObject $mytmpinstance'; | ||
$mytmpinstance->initAsSpecimen(); | ||
|
||
// Info | ||
|
@@ -498,6 +497,7 @@ | |
if (is_dir($dir)) { | ||
$handle = opendir($dir); | ||
if (is_resource($handle)) { | ||
$filelist = array(); | ||
while (($file = readdir($handle)) !== false) { | ||
$filelist[] = $file; | ||
} | ||
|
@@ -512,7 +512,6 @@ | |
|
||
require_once $dir.'/'.$file; | ||
$module = new $className($db); | ||
|
||
'@phan-var-force ModelePDFMyObject $module'; | ||
|
||
$modulequalified = 1; | ||
|
Oops, something went wrong.