FIX: Update mod_codeclient_* constructor to have $db argument as in callers.

None of the mod_codeclient_* constructors has an argument.
Reported by phan as `PhanParamTooMany: Call with 1 arg(s) to \mod_codeclient_leopard::__construct() which only takes 0 arg(s) defined at htdocs/core/modules/societe/mod_codeclient_leopard.php:69`
in all modified files.
One exception in the card.php file because the code has no explicit detail,
but it also uses a mod_codeclient_ constructor.
This commit is contained in:
MDW 2024-01-10 13:45:59 +01:00
parent 3fae1cc099
commit 9d2bc42ee3
5 changed files with 23 additions and 9 deletions

View file

@ -89,8 +89,10 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
/**
* Constructor
*
* @param DoliDB $db Database object
*/
public function __construct()
public function __construct($db)
{
$this->code_null = 0;
$this->code_modifiable = 1;

View file

@ -65,8 +65,10 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
/**
* Constructor
*
* @param DoliDB $db Database object
*/
public function __construct()
public function __construct($db)
{
$this->code_null = 1;
$this->code_modifiable = 1;

View file

@ -65,8 +65,10 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
/**
* Constructor
*
* @param DoliDB $db Database object
*/
public function __construct()
public function __construct($db)
{
$this->nom = "Monkey";
$this->name = "Monkey";

View file

@ -64,6 +64,14 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
*/
abstract class ModeleThirdPartyCode
{
/**
* Constructor
*
* @param DoliDB $db Database object
*/
abstract public function __construct($db);
/**
* @var string Error code (or message)
*/

View file

@ -3163,7 +3163,7 @@ class Societe extends CommonObject
break;
}
}
$mod = new $module();
$mod = new $module($this->db);
$this->code_client = $mod->getNextValue($objsoc, $type);
$this->prefixCustomerIsRequired = $mod->prefixIsRequired;
@ -3195,7 +3195,7 @@ class Societe extends CommonObject
break;
}
}
$mod = new $module();
$mod = new $module($this->db);
$this->code_fournisseur = $mod->getNextValue($objsoc, $type);
@ -3225,7 +3225,7 @@ class Societe extends CommonObject
}
}
$mod = new $module();
$mod = new $module($this->db);
dol_syslog(get_class($this)."::codeclient_modifiable code_client=".$this->code_client." module=".$module);
if ($mod->code_modifiable_null && !$this->code_client) {
@ -3265,7 +3265,7 @@ class Societe extends CommonObject
}
}
$mod = new $module();
$mod = new $module($this->db);
dol_syslog(get_class($this)."::codefournisseur_modifiable code_founisseur=".$this->code_fournisseur." module=".$module);
if ($mod->code_modifiable_null && !$this->code_fournisseur) {
@ -3311,7 +3311,7 @@ class Societe extends CommonObject
}
}
$mod = new $module();
$mod = new $module($this->db);
dol_syslog(get_class($this)."::check_codeclient code_client=".$this->code_client." module=".$module);
$result = $mod->verif($this->db, $this->code_client, $this, 0);
@ -3352,7 +3352,7 @@ class Societe extends CommonObject
}
}
$mod = new $module();
$mod = new $module($this->db);
dol_syslog(get_class($this)."::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$module);
$result = $mod->verif($this->db, $this->code_fournisseur, $this, 1);