diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index e42e58ec2fc..d8c8694ede9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 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 @@ -75,7 +75,7 @@ class ActionComm extends CommonObject public $id; /** - * @var int Id of the event. Use $id as possible + * @var string Id of the event. Use $id as possible */ public $ref; @@ -614,7 +614,8 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::add", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $this->ref = $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); + $this->ref = (string) $this->id; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ref='".$this->db->escape($this->ref)."' WHERE id=".$this->id; $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6f4eb3e8a35..0b07926aad8 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -7,7 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro - * Copyright (C) 2015-2021 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 Anthony Berton diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 9345f0f339e..708e198ac98 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5c4c243610d..c0c257ecbab 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5720,7 +5720,7 @@ function print_liste_field_titre($name, $file = "", $field = "", $begin = "", $m * @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id') * @param string $sortorder Current sort order (Ex: 'asc,desc') * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '. - * @param string $disablesortlink 1=Disable sort link + * @param int $disablesortlink 1=Disable sort link * @param string $tooltip Tooltip * @param int $forcenowrapcolumntitle No need for use 'wrapcolumntitle' css style * @return string @@ -6546,7 +6546,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round * @return mixed 0 if not found, localtax rate if found * @see get_default_tva() */ -function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_seller = "", $vatnpr = 0) +function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_seller = null, $vatnpr = 0) { global $db, $conf, $mysoc; diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 43498d01606..d6c0ec80d1c 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 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 @@ -306,7 +307,7 @@ class DataPolicy if ($resultmail) { $resultmasssend .= $langs->trans("MailSent").': '.$sendto."
"; $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $societe->update($societe->id); + $societe->update($societe->id, $user); } else { dol_print_error($db); } diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 187eba32b6b..87a4ba5df97 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman * @@ -315,7 +315,10 @@ if (empty($reshook) && $action == 'add') { $company->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); } - $company->update(0); + $res = $company->update(0, $user); + if ($res < 0) { + setEventMessages($company->error, $company->errors, 'errors'); + } } // Fill array 'array_options' with data from add form diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index abdd447f9a1..73b871bc7f0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1347,7 +1347,7 @@ class Societe extends CommonObject * @param int $nosyncmember Do not synchronize info of linked member * @return int Return integer <0 if KO, >=0 if OK */ - public function update($id, $user = '', $call_trigger = 1, $allowmodcodeclient = 0, $allowmodcodefournisseur = 0, $action = 'update', $nosyncmember = 1) + public function update($id, User $user, $call_trigger = 1, $allowmodcodeclient = 0, $allowmodcodefournisseur = 0, $action = 'update', $nosyncmember = 1) { global $langs, $conf, $hookmanager; @@ -2490,9 +2490,9 @@ class Societe extends CommonObject * @param string $filter Other filter * @param integer $maxvalue Filter on max value for discount * @param int $discount_type 0 => customer discount, 1 => supplier discount - * @return int Return integer <0 if KO, Credit note amount otherwise + * @return int Return integer <0 if KO, Credit note amount otherwise */ - public function getAvailableDiscounts($user = '', $filter = '', $maxvalue = 0, $discount_type = 0) + public function getAvailableDiscounts($user = null, $filter = '', $maxvalue = 0, $discount_type = 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -3391,7 +3391,7 @@ class Societe extends CommonObject * @param int $type Should be 0 to say customer * @return void */ - public function get_codeclient($objsoc = 0, $type = 0) + public function get_codeclient($objsoc = null, $type = 0) { // phpcs:enable global $conf; @@ -3405,6 +3405,7 @@ class Societe extends CommonObject break; } } + /** @var ModeleThirdPartyCode $mod */ $mod = new $module($this->db); $this->code_client = $mod->getNextValue($objsoc, $type); @@ -3423,7 +3424,7 @@ class Societe extends CommonObject * @param int $type Should be 1 to say supplier * @return void */ - public function get_codefournisseur($objsoc = 0, $type = 1) + public function get_codefournisseur($objsoc = null, $type = 1) { // phpcs:enable global $conf; @@ -3437,6 +3438,7 @@ class Societe extends CommonObject break; } } + /** @var ModeleThirdPartyCode $mod */ $mod = new $module($this->db); $this->code_fournisseur = $mod->getNextValue($objsoc, $type);