Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Apr 7, 2024
2 parents b5de782 + 4d49620 commit bc8e4c1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 18 deletions.
22 changes: 15 additions & 7 deletions dev/tools/apstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@
$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';
Expand Down Expand Up @@ -139,15 +147,15 @@
$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);
}
Expand Down
22 changes: 22 additions & 0 deletions dev/tools/phan/baseline_extended.txt
Original file line number Diff line number Diff line change
@@ -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)
];
14 changes: 7 additions & 7 deletions htdocs/compta/bank/class/account.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -1051,6 +1053,7 @@ public function fetch($id, $ref = '')
$this->courant = $obj->courant;
$this->bank = $obj->bank;
$this->clos = $obj->clos;
$this->status = $obj->clos;
$this->rappro = $obj->rappro;
$this->url = $obj->url;

Expand Down Expand Up @@ -1857,6 +1860,8 @@ public function initAsSpecimen()
$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';
Expand Down Expand Up @@ -1945,11 +1950,6 @@ public function getKanbanView($option = '', $arraydata = null)
*/
class AccountLine extends CommonObjectLine
{
/**
* @var string Error code (or message)
*/
public $error = '';

/**
* @var DoliDB Database handler.
*/
Expand Down
8 changes: 4 additions & 4 deletions htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp
* @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';
Expand Down Expand Up @@ -305,7 +305,7 @@ private function create($attrname, $type = 'varchar', $length = '255', $elementt
* @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;
Expand Down Expand Up @@ -437,7 +437,7 @@ private function create_label($attrname, $label = '', $type = '', $pos = 0, $siz
* @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';
Expand Down Expand Up @@ -495,7 +495,7 @@ public function delete($attrname, $elementtype = 'member')
* @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;
Expand Down

0 comments on commit bc8e4c1

Please sign in to comment.