From 009a4856b34ecfb87e43c6df4a904fe3baf3dbdb Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 22 Feb 2024 13:22:06 +0100 Subject: [PATCH] qual: phpstan - various fixes (#28351) * qual: phpstan for htdocs/compta/tva/class/paymentvat.class.php htdocs/compta/tva/class/paymentvat.class.php 540 Property CommonObject::$tms (int) does not accept string. * qual: phpstan - various "$enabled (int) does not accept bool." htdocs/core/boxes/box_actions.php 54 Property box_actions::$enabled (int) does not accept bool. htdocs/core/boxes/box_actions_future.php 54 Property box_actions_future::$enabled (int) does not accept bool. htdocs/core/boxes/box_activity.php 53 Property box_activity::$enabled (int) does not accept string. * qual: phpstan for htdocs/core/boxes/box_activity.php htdocs/core/boxes/box_activity.php 53 Property box_activity::$enabled (int) does not accept string. * qual: phpstan for htdocs/core/modules/modTakePos.class.php htdocs/core/modules/modTakePos.class.php 284 Property Societe::$code_client (string) does not accept int. htdocs/core/modules/modTakePos.class.php 285 Property Societe::$code_fournisseur (string) does not accept int. --- htdocs/compta/tva/class/paymentvat.class.php | 2 +- htdocs/core/boxes/box_activity.php | 2 +- htdocs/core/boxes/modules_boxes.php | 2 +- htdocs/core/modules/modTakePos.class.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index a8f38ccb9d5..be9df9fe313 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -537,7 +537,7 @@ class PaymentVAT extends CommonObject $this->id = 0; $this->fk_tva = 0; $this->datec = dol_now(); - $this->tms = ''; + $this->tms = dol_now(); $this->datep = ''; $this->amount = ''; $this->fk_typepaiement = 0; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 52b8cb65504..b84e74dfe18 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -50,7 +50,7 @@ class box_activity extends ModeleBoxes $this->db = $db; // FIXME: Pb into some status - $this->enabled = (getDolGlobalString('MAIN_FEATURES_LEVEL')); // Not enabled by default due to bugs (see previous comments) + $this->enabled = getDolGlobalInt('MAIN_FEATURES_LEVEL'); // Not enabled by default due to bugs (see previous comments) $this->hidden = !( (isModEnabled('facture') && $user->hasRight('facture', 'read')) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index e99f4660a30..1bfd9688e2c 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -64,7 +64,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $max = 5; /** - * @var int Condition to have widget enabled + * @var bool|int Condition to have widget enabled */ public $enabled = 1; diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index ed237feadf6..d61b3ba3628 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -281,8 +281,8 @@ class modTakePos extends DolibarrModules if ($searchcompanyid == 0) { $societe->name = $nametouse; $societe->client = 1; - $societe->code_client = -1; - $societe->code_fournisseur = -1; + $societe->code_client = '-1'; + $societe->code_fournisseur = '-1'; $societe->note_private = "Default customer automatically created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; $searchcompanyid = $societe->create($user);