2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-04-07 15:06:46 +02:00
4 changed files with 48 additions and 18 deletions

View File

@@ -95,7 +95,15 @@ while ($i < $argc) {
$i++;
}
if (!is_readable("{$path}phan/config.php")) {
// Configuration is required, otherwise phan is disabled.
$PHAN_CONFIG = "{$path}phan/config_extended.php";
// BASELINE is ignored if it does not exist
$PHAN_BASELINE = "{$path}phan/baseline_extended.txt";
$PHAN_MIN_PHP = "7.0";
$PHAN_MEMORY_OPT = "--memory-limit 5G";
if (!is_readable($PHAN_CONFIG)) {
print "Skipping phan - configuration not found\n";
// Disable phan while not integrated yet
$dir_phan = 'disabled';
@@ -139,15 +147,15 @@ if ($dirphpstan != 'disabled') {
$output_phan_json = array();
$res_exec_phan = 0;
if ($dir_phan != 'disabled') {
if (is_readable($PHAN_BASELINE)) {
$PHAN_BASELINE_OPT = "-B '${PHAN_BASELINE}'";
} else {
$PHAN_BASELINE_OPT = '';
}
// Get technical debt (phan)
$PHAN_CONFIG = "dev/tools/phan/config_extended.php";
$PHAN_BASELINE = "dev/tools/phan/baseline.txt";
$PHAN_MIN_PHP = "7.0";
$PHAN_MEMORY_OPT = "--memory-limit 5G";
$commandcheck
= ($dir_phan ? $dir_phan.DIRECTORY_SEPARATOR : '')
."phan --output-mode json $PHAN_MEMORY_OPT -k $PHAN_CONFIG -B $PHAN_BASELINE --analyze-twice --minimum-target-php-version $PHAN_MIN_PHP";
."phan --output-mode json $PHAN_MEMORY_OPT -k '$PHAN_CONFIG' $PHAN_BASELINE_OPT --analyze-twice --minimum-target-php-version $PHAN_MIN_PHP";
print 'Execute Phan to get the technical debt: '.$commandcheck."\n";
exec($commandcheck, $output_phan_json, $res_exec_phan);
}

View File

@@ -0,0 +1,22 @@
<?php
/**
* /!\ DO NOT generate this baseline - it should only suppress notices
* that are to be excluded from the technical debt and that can
* not be excluded using other methods.
* The 'internal' PhanUndeclaredConstant is such a case.
*
* When Phan is invoked with --load-baseline=path/to/baseline.php,
* The pre-existing issues listed in this file won't be emitted.
*
* This file can be updated by invoking Phan with --save-baseline=path/to/baseline.php
* (can be combined with --load-baseline)
*/
return [
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'internal' => ['PhanUndeclaredConstant'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
];

View File

@@ -76,13 +76,15 @@ class Account extends CommonObject
/**
* Bank account type. Check TYPE_ constants
* @deprecated
* @see $type
* @var int
*/
public $courant;
/**
* Bank account type. Check TYPE_ constants
* @var int
* Bank account type. Check TYPE_ constants. It's integer but Company bank account use string to identify type account
* @var int|string
*/
public $type;
@@ -1051,6 +1053,7 @@ class Account extends CommonObject
$this->courant = $obj->courant;
$this->bank = $obj->bank;
$this->clos = $obj->clos;
$this->status = $obj->clos;
$this->rappro = $obj->rappro;
$this->url = $obj->url;
@@ -1857,6 +1860,8 @@ class Account extends CommonObject
$this->label = 'My Big Company Bank account';
$this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN;
$this->type = Account::TYPE_CURRENT;
$this->status = Account::STATUS_OPEN;
$this->code_banque = '30001';
$this->code_guichet = '00794';
$this->number = '12345678901';
@@ -1945,11 +1950,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
*/
class AccountLine extends CommonObjectLine
{
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* @var DoliDB Database handler.
*/

View File

@@ -201,7 +201,7 @@ class ExtraFields
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
* @return int Return integer <=0 if KO, >0 if OK
*/
private function create($attrname, $type = 'varchar', $length = '255', $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = array(), $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array())
private function create($attrname, $type = 'varchar', $length = '255', $elementtype = '', $unique = 0, $required = 0, $default_value = '', $param = array(), $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array())
{
if ($elementtype == 'thirdparty') {
$elementtype = 'societe';
@@ -305,7 +305,7 @@ class ExtraFields
* @return int Return integer <=0 if KO, >0 if OK
* @throws Exception
*/
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = '', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
{
// phpcs:enable
global $conf, $user;
@@ -437,7 +437,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @return int Return integer < 0 if KO, 0 if nothing is done, 1 if OK
*/
public function delete($attrname, $elementtype = 'member')
public function delete($attrname, $elementtype = '')
{
if ($elementtype == 'thirdparty') {
$elementtype = 'societe';
@@ -495,7 +495,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @return int Return integer < 0 if KO, 0 if nothing is done, 1 if OK
*/
private function delete_label($attrname, $elementtype = 'member')
private function delete_label($attrname, $elementtype = '')
{
// phpcs:enable
global $conf;