diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 2c4995989e1..e86e221bbb7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1630,9 +1630,9 @@ class Invoices extends DolibarrApi if ($is_multicurrency) { $amounts[$id] = null; // Multicurrency - $multicurrency_amounts[$id] = $amount; + $multicurrency_amounts[$id] = (float) $amount; } else { - $amounts[$id] = $amount; + $amounts[$id] = (float) $amount; // Multicurrency $multicurrency_amounts[$id] = null; } @@ -1644,7 +1644,7 @@ class Invoices extends DolibarrApi $paymentobj->amounts = $amounts; // Array with all payments dispatching with invoice id $paymentobj->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paymentobj->paiementid = $paymentid; - $paymentobj->paiementcode = dol_getIdFromCode($this->db, $paymentid, 'c_paiement', 'id', 'code', 1); + $paymentobj->paiementcode = (string) dol_getIdFromCode($this->db, $paymentid, 'c_paiement', 'id', 'code', 1); $paymentobj->num_payment = $num_payment; $paymentobj->note_private = $comment; $paymentobj->ref_ext = $ref_ext; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5c8ea19dc73..ce7594a56f1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4323,7 +4323,7 @@ class Form * 0 : use default deposit percentage from entry * > 0 : force deposit percentage (for example, from company object) * @param int $noprint if set to one we return the html to print, if 0 (default) we print it - * @return void + * @return void|string * @deprecated */ public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1, $noprint = 0) diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 5841f5035e1..34a1961bc84 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -136,7 +136,7 @@ class FormCategory extends Form return $num_rows; } else { dol_print_error($this->db); - return; + return null; } } } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index f142c22c87a..b3be55a633f 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -143,7 +143,7 @@ class FormCompany extends Form * @param int $empty Add empty value in list * @return void */ - public function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0) + public function form_prospect_level($page, $selected = 0, $htmlname = 'prospect_level_id', $empty = 0) { // phpcs:enable global $user, $langs; @@ -195,7 +195,7 @@ class FormCompany extends Form * @param int $empty Add empty value in list * @return void */ - public function formProspectContactLevel($page, $selected = '', $htmlname = 'prospect_contact_level_id', $empty = 0) + public function formProspectContactLevel($page, $selected = 0, $htmlname = 'prospect_contact_level_id', $empty = 0) { global $user, $langs; @@ -643,7 +643,7 @@ class FormCompany extends Form * @param string $morecss More CSS on select component * @return int The selected third party ID */ - public function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '') + public function selectCompaniesForNewContact($object, $var_id, $selected = 0, $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '') { global $conf, $hookmanager; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c8589d9b088..5c527e016c2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -332,7 +332,7 @@ class FormFile * @param int $hideifempty Hide section of generated files if there is no file * @param string $removeaction (optional) The action to remove a file * @param string $tooltipontemplatecombo Text to show on a tooltip after the combo list of templates - * @return string Output string with HTML array of documents (might be empty string) + * @return string|int Output string with HTML array of documents (might be empty string) */ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0, $removeaction = 'remove_file', $tooltipontemplatecombo = '') { diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index d6e0e56f688..32215871529 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -683,7 +683,7 @@ class FormSetupItem $this->fieldValue = getDolGlobalString($this->confKey); return true; } else { - $this->fieldValue = null; + $this->fieldValue = ''; return false; } } @@ -1103,7 +1103,7 @@ class FormSetupItem } elseif (!empty($errors)) { $this->errors[] = $errors; } - return; + return null; } /** diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 0484968f526..5cfbfe2ed09 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -2281,7 +2281,7 @@ class Lessc * * @param mixed $in Input * @param bool $force Force rebuild? - * @return array lessphp cache structure + * @return array|null lessphp cache structure */ public function cachedCompile($in, $force = false) { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 96cf95ceb6a..b86ee41f60f 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -126,12 +126,6 @@ class Menubase */ public $langs; - /** - * @var string Not used - * @deprecated - */ - public $level; - /** * @var string Name family/module for left menu (setup, info, ...) */ @@ -183,7 +177,7 @@ class Menubase */ public function create($user = null) { - global $conf, $langs; + global $conf; // Clean parameters if (!isset($this->enabled)) { @@ -209,9 +203,6 @@ class Menubase if (empty($this->position)) { $this->position = 0; } - if (!$this->level) { - $this->level = 0; - } // Check parameters if (empty($this->menu_handler)) { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 1e218d9cd1f..35ce3ff072b 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1332,7 +1332,7 @@ class DoliDBPgsql extends DoliDB /** * Return list of available charset that can be used to store data in database * - * @return array List of Charset + * @return array|null List of Charset */ public function getListOfCharacterSet() { @@ -1371,7 +1371,7 @@ class DoliDBPgsql extends DoliDB /** * Return list of available collation that can be used for database * - * @return array Liste of Collation + * @return array|null Liste of Collation */ public function getListOfCollation() { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1619f147c3b..6f47523cc3c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -219,7 +219,7 @@ define( 'entrepot' => 'stock', 'expedition' => 'delivery_note', 'facture' => 'invoice', - 'fichinter' => 'intervention', + 'ficheinter' => 'intervention', 'product_fournisseur_price' => 'productsupplierprice', 'product_price' => 'productprice', 'projet' => 'project', @@ -240,6 +240,7 @@ function isModEnabled($module) // Fix old names (map to new names) $arrayconv = DEPRECATED_MODULE_MAPPING; + $arrayconvbis = array_flip(DEPRECATED_MODULE_MAPPING); if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) { // Special cases: both use the same module. @@ -251,8 +252,12 @@ function isModEnabled($module) if (!empty($arrayconv[$module])) { $module_alt = $arrayconv[$module]; } + $module_bis = $module; + if (!empty($arrayconvbis[$module])) { + $module_bis = $arrayconvbis[$module]; + } - return !empty($conf->modules[$module]) || !empty($conf->modules[$module_alt]); + return !empty($conf->modules[$module]) || !empty($conf->modules[$module_alt]) || !empty($conf->modules[$module_bis]); //return !empty($conf->$module->enabled); } @@ -2800,7 +2805,7 @@ function dol_bc($var, $moreclass = '') */ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = null, $mode = 0, $extralangcode = '') { - global $conf, $langs, $hookmanager; + global $langs, $hookmanager; $ret = ''; $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS @@ -2889,6 +2894,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs * @param int $ts Timestamp (If is_gmt is true, timestamp is already includes timezone and daylight saving offset, if is_gmt is false, timestamp is a GMT timestamp and we must compensate with server PHP TZ) * @param bool $is_gmt See comment of timestamp parameter * @return string A formatted string + * @see dol_stringtotime() */ function dol_strftime($fmt, $ts = false, $is_gmt = false) { @@ -3552,7 +3558,7 @@ function getArrayOfSocialNetworks() */ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetworks = array()) { - global $conf, $user, $langs; + global $user, $langs; $htmllink = $value; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 6194a540789..8621c398af9 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -209,13 +209,13 @@ if ($action == 'create') { if ($backtopage) { print ''; } - if ($backtopageforcancel) { + if (!empty($backtopageforcancel)) { print ''; } - if ($backtopagejsfields) { + if (!empty($backtopagejsfields)) { print ''; } - if ($dol_openinpopup) { + if (!empty($dol_openinpopup)) { print ''; }