Merge pull request #28922 from mdeweerd/fix/printf

Fix & enable Phan printf checks
This commit is contained in:
Laurent Destailleur 2024-03-17 21:08:26 +01:00 committed by GitHub
commit bb0e18deae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 93 additions and 72 deletions

View File

@ -10105,7 +10105,7 @@ For developers:
WARNING:
- A lot of class files (*.class.php) has moved into subdirectories. So If you use
or develop non official modules that includes Dolibarr classes, you will have to rename
path to thoose classes into the include function.
path to those classes into the include function.
- Also, parameters of the "fetch()" method for class "User" has changed to reflect
other fetch methods.
- If you build a personalised themes, you must rename the style sheet into style.css.php.

View File

@ -14,6 +14,7 @@ dolibar->dolibarr
dolibarrr->dolibarr
dollibar->dolibarr
dollibarr->dolibarr
thoose->those
# fiche->card
mot de passe->password
not de passe->password

View File

@ -171,6 +171,7 @@ $VALID_MODULE_MAPPING = array(
'syslog' => 'Syslog',
'takepos' => 'TakePos',
'tax' => 'Tax',
'theme_datacolor' => 'array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}}',
'ticket' => 'Ticket',
'user' => 'User',
'variants' => 'Variants',
@ -488,7 +489,7 @@ return [
'PhanPluginEmptyStatementIf',
// 'PhanUndeclaredStaticMethod',
// 'PhanPluginDescriptionlessCommentOnPrivateMethod',
'PhanPluginPrintfIncompatibleArgumentType',
// 'PhanPluginPrintfIncompatibleArgumentType',
'PhanPossiblyNullTypeMismatchProperty',
'PhanRedefineClass',
'PhanRedefineFunction',
@ -505,7 +506,7 @@ return [
// 'PhanRedefinedExtendedClass',
'PhanTypeComparisonFromArray',
'PhanPluginConstantVariableBool',
'PhanPluginPrintfVariableFormatString',
// 'PhanPluginPrintfVariableFormatString',
'PhanTypeMismatchDimFetch',
'PhanTypeMismatchDimFetchNullable',
'PhanTypeSuspiciousNonTraversableForeach',

View File

@ -170,6 +170,7 @@ $VALID_MODULE_MAPPING = array(
'syslog' => 'Syslog',
'takepos' => 'TakePos',
'tax' => 'Tax',
'theme_datacolor' => 'array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}}',
'ticket' => 'Ticket',
'user' => 'User',
'variants' => 'Variants',

View File

@ -308,7 +308,7 @@ class ActionComm extends CommonObject
public $icalname;
/**
* @var string Ical color
* @var int<0,3> Ical color
*/
public $icalcolor;

View File

@ -1793,7 +1793,7 @@ $db->close();
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param int $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param array $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @param array{}|array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int}} $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @return void
*/
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())
@ -1804,6 +1804,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
global $hookmanager;
'@phan-var-force array{0:array{0:int,1:int,2:int},1:array{0:int,1:int,2:int},2:array{0:int,1:int,2:int},3:array{0:int,1:int,2:int}} $theme_datacolor
@phan-var-force User[] $cacheusers
@phan-var-force array<int<0,3>> $colorindexused';
if ($conf->use_javascript_ajax) { // Enable the "Show more button..."
$conf->global->MAIN_JS_SWITCH_AGENDA = 1;
}
@ -1954,7 +1958,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
}
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
// Define color
// Define color // @suppress-next-line PhanPluginPrintfIncompatibleArgumentType
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
}
$cssclass = $cssclass.' eventday_'.$ymd;

View File

@ -2136,7 +2136,7 @@ class BonPrelevement extends CommonObject
* @param string $row_cc pl.number AS cc, Not used for SEPA
* @param string $row_somme pl.amount AS somme,
* @param string $row_ref Invoice ref (f.ref) or Salary ref
* @param string $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary,
* @param int $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary,
* @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic,
* @param string $row_datec rib.datec,

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -73,7 +74,7 @@ class box_factures extends ModeleBoxes
$text = $langs->trans("BoxTitleLast".(getDolGlobalString('MAIN_LASTBOX_ON_OBJECT_DATE') ? "" : "Modified")."CustomerBills", $max);
$this->info_box_head = array(
'text' => $text,
'limit'=> dol_strlen($text)
'limit' => dol_strlen($text)
);
if ($user->hasRight('facture', 'lire')) {
@ -159,13 +160,14 @@ class box_factures extends ModeleBoxes
$late = '';
if ($facturestatic->hasDelay()) {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel')));
}
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1,
);
@ -196,7 +198,7 @@ class box_factures extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoRecordedInvoices").'</span>',
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedInvoices").'</span>',
);
}
@ -204,7 +206,7 @@ class box_factures extends ModeleBoxes
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -149,13 +150,14 @@ class box_factures_fourn extends ModeleBoxes
$late = '';
if ($facturestatic->hasDelay()) {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel')));
}
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1,
);
@ -193,7 +195,7 @@ class box_factures_fourn extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoModifiedSupplierBills").'</span>',
'text' => '<span class="opacitymedium">'.$langs->trans("NoModifiedSupplierBills").'</span>',
);
}
@ -201,7 +203,7 @@ class box_factures_fourn extends ModeleBoxes
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -158,6 +159,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$late = '';
if ($facturestatic->hasDelay()) {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel')));
}
@ -166,7 +168,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1,
);
@ -201,7 +203,7 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoUnpaidSupplierBills").'</span>',
'text' => '<span class="opacitymedium">'.$langs->trans("NoUnpaidSupplierBills").'</span>',
);
}
@ -238,7 +240,7 @@ class box_factures_fourn_imp extends ModeleBoxes
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 +76,7 @@ class box_factures_imp extends ModeleBoxes
$langs->load("bills");
$textHead = $langs->trans("BoxTitleOldestUnpaidCustomerBills");
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit'=> dol_strlen($textHead));
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit' => dol_strlen($textHead));
if ($user->hasRight('facture', 'lire')) {
$sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.code_client, s.client";
@ -171,13 +172,14 @@ class box_factures_imp extends ModeleBoxes
$late = '';
if ($facturestatic->hasDelay()) {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimite, 'day', 'tzuserrel')));
}
$this->info_box_contents[$line][] = array(
'td' => 'class="nowraponall"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'text2' => $late,
'asis' => 1,
);
@ -212,7 +214,7 @@ class box_factures_imp extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=> '<span class="opacitymedium">'.$langs->trans("NoUnpaidCustomerBills").'</span>'
'text' => '<span class="opacitymedium">'.$langs->trans("NoUnpaidCustomerBills").'</span>'
);
}
@ -249,7 +251,7 @@ class box_factures_imp extends ModeleBoxes
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'maxlength' => 500,
'text' => ($this->db->error().' sql='.$sql),
);
}

View File

@ -701,6 +701,7 @@ class Translate
if (strpos($key, 'Format') !== 0) {
try {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$str = sprintf($str, $param1, $param2, $param3, $param4); // Replace %s and %d except for FormatXXX strings.
} catch (Exception $e) {
// No exception managed
@ -786,6 +787,7 @@ class Translate
if (!preg_match('/^Format/', $key)) {
//print $str;
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$str = sprintf($str, $param1, $param2, $param3, $param4, $param5); // Replace %s and %d except for FormatXXX strings.
}
@ -810,7 +812,7 @@ class Translate
*/
public function transcountry($str, $countrycode)
{
$strLocaleKey=$str.$countrycode;
$strLocaleKey = $str.$countrycode;
if (!empty($this->tab_translate[$strLocaleKey])) {
return $this->trans($strLocaleKey);
} else {
@ -829,7 +831,7 @@ class Translate
*/
public function transcountrynoentities($str, $countrycode)
{
$strLocaleKey=$str.$countrycode;
$strLocaleKey = $str.$countrycode;
if (!empty($this->tab_translate[$strLocaleKey])) {
return $this->transnoentities($strLocaleKey);
} else {

View File

@ -35,31 +35,31 @@
function get_tz_array()
{
$tzarray = array(
-11=>"Pacific/Midway",
-10=>"Pacific/Fakaofo",
-9=>"America/Anchorage",
-8=>"America/Los_Angeles",
-7=>"America/Dawson_Creek",
-6=>"America/Chicago",
-5=>"America/Bogota",
-4=>"America/Anguilla",
-3=>"America/Araguaina",
-2=>"America/Noronha",
-1=>"Atlantic/Azores",
0=>"Africa/Abidjan",
1=>"Europe/Paris",
2=>"Europe/Helsinki",
3=>"Europe/Moscow",
4=>"Asia/Dubai",
5=>"Asia/Karachi",
6=>"Indian/Chagos",
7=>"Asia/Jakarta",
8=>"Asia/Hong_Kong",
9=>"Asia/Tokyo",
10=>"Australia/Sydney",
11=>"Pacific/Noumea",
12=>"Pacific/Auckland",
13=>"Pacific/Enderbury"
-11 => "Pacific/Midway",
-10 => "Pacific/Fakaofo",
-9 => "America/Anchorage",
-8 => "America/Los_Angeles",
-7 => "America/Dawson_Creek",
-6 => "America/Chicago",
-5 => "America/Bogota",
-4 => "America/Anguilla",
-3 => "America/Araguaina",
-2 => "America/Noronha",
-1 => "Atlantic/Azores",
0 => "Africa/Abidjan",
1 => "Europe/Paris",
2 => "Europe/Helsinki",
3 => "Europe/Moscow",
4 => "Asia/Dubai",
5 => "Asia/Karachi",
6 => "Indian/Chagos",
7 => "Asia/Jakarta",
8 => "Asia/Hong_Kong",
9 => "Asia/Tokyo",
10 => "Australia/Sydney",
11 => "Pacific/Noumea",
12 => "Pacific/Auckland",
13 => "Pacific/Enderbury"
);
return $tzarray;
}
@ -296,11 +296,11 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l
$sTime .= dol_print_date($iSecond, 'hourduration', true);
}
} elseif ($format == 'allhourminsec') {
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond/3600))).':'.sprintf("%02d", ((int) floor(($iSecond % 3600) / 60))).':'.sprintf("%02d", ((int) ($iSecond % 60)));
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond / 3600))).':'.sprintf("%02d", ((int) floor(($iSecond % 3600) / 60))).':'.sprintf("%02d", ((int) ($iSecond % 60)));
} elseif ($format == 'allhourmin') {
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond/3600))).':'.sprintf("%02d", ((int) floor(($iSecond % 3600)/60)));
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond / 3600))).':'.sprintf("%02d", ((int) floor(($iSecond % 3600) / 60)));
} elseif ($format == 'allhour') {
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond/3600)));
return sprintf("%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (int) floor($iSecond / 3600)));
}
} elseif ($format == 'hour') { // only hour part
$sTime = dol_print_date($iSecond, '%H', true);
@ -431,12 +431,12 @@ function dol_stringtotime($string, $gm = 1)
dol_syslog("dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
// Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS'
// Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS'
$sday = $reg[1];
$smonth = $reg[2];
$syear = $reg[3];
$shour = $reg[4];
$smin = $reg[5];
$ssec = $reg[6];
$sday = (int) $reg[1];
$smonth = (int) $reg[2];
$syear = (int) $reg[3];
$shour = (int) $reg[4];
$smin = (int) $reg[5];
$ssec = (int) $reg[6];
if ($syear < 50) {
$syear += 1900;
}
@ -448,12 +448,12 @@ function dol_stringtotime($string, $gm = 1)
|| preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i', $string, $reg) // Convert date with format YYYY-MM-DD HH:MM:SS
|| preg_match('/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$/i', $string, $reg) // Convert date with format YYYYMMDDTHHMMSSZ
) {
$syear = $reg[1];
$smonth = $reg[2];
$sday = $reg[3];
$shour = $reg[4];
$smin = $reg[5];
$ssec = $reg[6];
$syear = (int) $reg[1];
$smonth = (int) $reg[2];
$sday = (int) $reg[3];
$shour = (int) $reg[4];
$smin = (int) $reg[5];
$ssec = (int) $reg[6];
$string = sprintf("%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
}
@ -950,7 +950,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
$jour_1sunsept = date("d", $date_1sunsept);
$mois_1sunsept = date("m", $date_1sunsept);
if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) {
$ferie=true;
$ferie = true;
}
// Geneva fast in Switzerland
}

View File

@ -3149,7 +3149,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$dtts = new DateTime();
$dtts->setTimestamp($timetouse);
$dtts->setTimezone($tzo);
$month = $dtts->format("m");
$month = (int) $dtts->format("m");
$month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
if ($encodetooutput) {
$monthtext = $outputlangs->transnoentities('Month'.$month);
@ -3946,7 +3946,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$newphoneastart = $newphoneaend = '';
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
if ($addlink == 'tel' || $conf->browser->layout == 'phone' || (isModEnabled('clicktodial') && getDolGlobalString('CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS'))) { // If phone or option for, we use link of phone
$newphoneastart = '<a href="tel:'.$phone.'">';
$newphoneastart = '<a href="tel:'.urlencode($phone).'">';
$newphoneaend .= '</a>';
} elseif (isModEnabled('clicktodial') && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
if (empty($user->clicktodial_loaded)) {
@ -3962,9 +3962,9 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$clicktodial_poste = (!empty($user->clicktodial_poste) ? urlencode($user->clicktodial_poste) : '');
$clicktodial_login = (!empty($user->clicktodial_login) ? urlencode($user->clicktodial_login) : '');
$clicktodial_password = (!empty($user->clicktodial_password) ? urlencode($user->clicktodial_password) : '');
// This line is for backward compatibility
// This line is for backward compatibility @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$url = sprintf($urlmask, urlencode($phone), $clicktodial_poste, $clicktodial_login, $clicktodial_password);
// Thoose lines are for substitution
// Those lines are for substitution
$substitarray = array('__PHONEFROM__' => $clicktodial_poste,
'__PHONETO__' => urlencode($phone),
'__LOGIN__' => $clicktodial_login,

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -463,6 +464,7 @@ class DataPolicyCron
foreach ($arrayofparameters as $key => $params) {
if (getDolGlobalInt($key) > 0) {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$sql = sprintf($params['sql'], (int) $conf->entity, (int) getDolGlobalInt($key), (int) getDolGlobalInt($key));
$resql = $this->db->query($sql);

View File

@ -2193,14 +2193,14 @@ class Expedition extends CommonObject
if (!empty($tracking) && !empty($value)) {
$url = str_replace('{TRACKID}', $value, $tracking);
$this->tracking_url = sprintf('<a target="_blank" rel="noopener noreferrer" href="%s">'.($value ? $value : 'url').'</a>', $url, $url);
$this->tracking_url = sprintf('<a target="_blank" rel="noopener noreferrer" href="%s">%s</a>', $url, ($value ? $value : 'url'));
} else {
$this->tracking_url = $value;
}
}
/**
* Classify the shipping as closed (this record also the stock movement)
* Classify the shipping as closed (this records also the stock movement)
*
* @return int Return integer <0 if KO, >0 if OK
*/

View File

@ -2332,8 +2332,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
}
$text .= '<a class="help" target="_blank" rel="noopener noreferrer" href="';
if ($mode == 'wiki') {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
} else {
// @phan-suppress-next-line PhanPluginPrintfVariableFormatString
$text .= sprintf($helpbaseurl, $helppage);
}
$text .= '">';

View File

@ -1588,14 +1588,14 @@ class Reception extends CommonObject
if (!empty($tracking) && !empty($value)) {
$url = str_replace('{TRACKID}', $value, $tracking);
$this->tracking_url = sprintf('<a target="_blank" rel="noopener noreferrer" href="%s">'.($value ? $value : 'url').'</a>', $url, $url);
$this->tracking_url = sprintf('<a target="_blank" rel="noopener noreferrer" href="%s">%s</a>', $url, ($value ? $value : 'url'));
} else {
$this->tracking_url = $value;
}
}
/**
* Classify the reception as closed (this record also the stock movement)
* Classify the reception as closed (this records also the stock movement)
*
* @return int Return integer <0 if KO, >0 if OK
*/