From 83259d9ddcaa6df7041aa4beee6fdc4e9d742949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 17 Aug 2025 01:58:17 +0200 Subject: [PATCH 1/3] clean code (#34979) --- htdocs/don/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 4fc1d728a2c..1b47356c86c 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018-2019 Thibault FOUCART - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -265,7 +265,7 @@ if (empty($reshook)) { $object->lastname = (string) GETPOST("lastname", 'alpha'); $object->societe = (string) GETPOST("societe", 'alpha'); $object->address = (string) GETPOST("address", 'alpha'); - $object->amount = price2num(GETPOST("amount", 'alpha'), '', 2); + $object->amount = (float) price2num(GETPOST("amount", 'alpha'), '', 2); $object->zip = (string) GETPOST("zipcode", 'alpha'); $object->town = (string) GETPOST("town", 'alpha'); $object->country_id = GETPOSTINT('country_id'); From a51d9d2398151cbb4b29c45c041e312437c5114f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 17 Aug 2025 01:58:28 +0200 Subject: [PATCH 2/3] PHPStan > Update baseline (#34980) Co-authored-by: Dolibot --- dev/build/phpstan/phpstan-baseline.neon | 36 ------------------------- 1 file changed, 36 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 666246a35eb..950883dfe67 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -11160,36 +11160,6 @@ parameters: count: 1 path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - - message: '#^Variable \$backtopage might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - - - message: '#^Variable \$filterabsolutediscount might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - - - message: '#^Variable \$filtercreditnote might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - - - message: '#^Variable \$resteapayer might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/object_discounts.tpl.php - - message: '#^Left side of \|\| is always true\.$#' identifier: booleanOr.leftAlwaysTrue @@ -11496,12 +11466,6 @@ parameters: count: 1 path: ../../../htdocs/cron/list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 3 - path: ../../../htdocs/datapolicy/class/datapolicy.class.php - - message: '#^Method CdavLib\:\:getFullCalendarObjects\(\) should return array\\> but returns list\\>\.$#' identifier: return.type From 1c6a40acbe402b16e94186525983470ca59d2019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 17 Aug 2025 02:00:29 +0200 Subject: [PATCH 3/3] Contact statut -> status (#34968) * deprecate contact statut for status * deprecate contact statut for status * fix * fix --- htdocs/contact/class/contact.class.php | 8 ++++---- htdocs/core/boxes/box_contacts.php | 1 + htdocs/projet/tasks/contact.php | 3 ++- htdocs/public/project/suggestbooth.php | 1 + htdocs/public/project/suggestconference.php | 1 + htdocs/societe/class/societe.class.php | 9 +++------ htdocs/ticket/class/ticket.class.php | 2 +- htdocs/webservices/server_contact.php | 10 +++++----- htdocs/webservices/server_user.php | 3 ++- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fd9c9042dba..80d6b38c21d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1024,7 +1024,7 @@ class Contact extends CommonObject $langs->loadLangs(array("dict", "companies")); $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.name_alias, c.lastname, c.firstname,"; - $sql .= " c.address, c.statut, c.zip, c.town,"; + $sql .= " c.address, c.statut as status, c.zip, c.town,"; $sql .= " c.fk_pays as country_id,"; $sql .= " c.fk_departement as state_id,"; $sql .= " c.birthday,"; @@ -1088,7 +1088,7 @@ class Contact extends CommonObject $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->user_creation_id = $obj->fk_user_creat; + $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; $this->state_id = $obj->state_id; @@ -1103,8 +1103,8 @@ class Contact extends CommonObject $this->socid = $obj->fk_soc; // Both fk_soc and socid are used $this->socname = $obj->socname; $this->poste = $obj->poste; - $this->status = $obj->statut; - $this->statut = $obj->statut; + $this->status = $obj->status; + $this->statut = $obj->status; // deprecated $this->fk_prospectlevel = $obj->fk_prospectlevel; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 42b759054d0..0b62bca1a20 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -137,6 +137,7 @@ class box_contacts extends ModeleBoxes $contactstatic->lastname = $objp->lastname; $contactstatic->firstname = $objp->firstname; $contactstatic->civility_id = $objp->civility_id; + $contactstatic->status = $objp->status; $contactstatic->statut = $objp->status; $contactstatic->phone_pro = $objp->phone; $contactstatic->phone_perso = $objp->phone_perso; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 9cc888ae89a..623714e09d2 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2006-2024 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -531,6 +531,7 @@ if ($id > 0 || !empty($ref)) { $contactstatic->lastname = $tab[$i]['lastname']; $contactstatic->firstname = $tab[$i]['firstname']; $contactstatic->email = $tab[$i]['email']; + $contactstatic->status = $tab[$i]['statuscontact']; $contactstatic->statut = $tab[$i]['statuscontact']; print $contactstatic->getNomUrl(1); } diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 85e51301266..8a8af851173 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -321,6 +321,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $contact->country_id = GETPOSTINT("country_id"); $contact->state_id = GETPOSTINT("state_id"); $contact->email = $email; + $contact->status = 1; //Default status to Actif $contact->statut = 1; //Default status to Actif $resultcreatecontact = $contact->create($user); diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index fa401c069f7..3fcb1b0a870 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -321,6 +321,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $contact->country_id = GETPOSTINT("country_id"); $contact->state_id = GETPOSTINT("state_id"); $contact->email = $email; + $contact->status = 1; //Default status to Actif $contact->statut = 1; //Default status to Actif $resultcreatecontact = $contact->create($user); if ($resultcreatecontact < 0) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3e819daba3c..d522dfe2423 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1354,8 +1354,6 @@ class Societe extends CommonObject } } } else { - //var_dump($conf->global->SOCIETE_EMAIL_UNIQUE); - //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') { // Check for mandatory if (getDolGlobalString('SOCIETE_EMAIL_MANDATORY') && !isValidEmail($this->email)) { @@ -1795,8 +1793,7 @@ class Societe extends CommonObject $result = $lmember->update($user, 0, 1, 1, 1); // Use nosync to 1 to avoid cyclic updates if ($result < 0) { - $this->error = $lmember->error; - $this->errors = array_merge($this->errors, $lmember->errors); + $this->setErrorsFromObject($lmember); dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); $error++; } @@ -2147,8 +2144,8 @@ class Societe extends CommonObject $this->cond_reglement_id = $obj->cond_reglement; $this->deposit_percent = $obj->deposit_percent; $this->transport_mode_id = $obj->transport_mode; - $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; - $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; + $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; + $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; $this->transport_mode_supplier_id = $obj->transport_mode_supplier; $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->fk_account = $obj->fk_account; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index a0c1bd65136..883f0ab04c7 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1866,7 +1866,7 @@ class Ticket extends CommonObject if (!empty($contacts)) { // Ensure that contact is active and select first active contact foreach ($contacts as $contact) { - if ((int) $contact->statut == 1) { + if ((int) $contact->status == 1) { $actioncomm->contact_id = $contact->id; break; } diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 5dc6cc0498c..46e682c4e6f 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2012 JF FERRY * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -318,7 +318,7 @@ function getContact($authentication, $id, $ref_ext) 'country_code' => $contact->country_code, 'country' => $contact->country, 'socid' => $contact->socid, - 'status' => $contact->statut, + 'status' => $contact->status, 'phone_pro' => $contact->phone_pro, 'fax' => $contact->fax, 'phone_perso' => $contact->phone_perso, @@ -428,7 +428,7 @@ function createContact($authentication, $contact) $newobject->country_code = $contact['country_code']; $newobject->country = $contact['country']; $newobject->socid = (int) $contact['socid']; - $newobject->statut = (int) $contact['status']; + $newobject->status = (int) $contact['status']; $newobject->phone_pro = $contact['phone_pro']; $newobject->fax = $contact['fax']; $newobject->phone_perso = $contact['phone_perso']; @@ -437,7 +437,7 @@ function createContact($authentication, $contact) $newobject->email = $contact['email']; $newobject->birthday = $contact['birthday']; $newobject->default_lang = $contact['default_lang']; - $newobject->note = $contact['note']; + $newobject->note_private = $contact['note']; $newobject->ref_facturation = (int) $contact['ref_facturation']; $newobject->ref_contrat = (int) $contact['ref_contrat']; $newobject->ref_commande = (int) $contact['ref_commande']; @@ -590,7 +590,7 @@ function getContactsForThirdParty($authentication, $idthirdparty) 'ref_propal' => $contact->ref_propal ? $contact->ref_propal : '', 'user_id' => $contact->user_id ? $contact->user_id : '', 'user_login' => $contact->user_login ? $contact->user_login : '', - 'status' => $contact->statut ? $contact->statut : '' + 'status' => $contact->status ? $contact->status : '' ); $i++; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 2dec629eae3..0728ddedaaf 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -606,6 +606,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $contact->phone_pro = $thirdparty->phone; $contact->phone_mobile = $thirdpartywithuser['phone_mobile']; $contact->fax = $thirdparty->fax; + $contact->status = 1; $contact->statut = 1; $contact->country_id = $thirdparty->country_id; $contact->country_code = $thirdparty->country_code;