Fix fatal error

This commit is contained in:
Laurent Destailleur 2022-01-28 19:06:41 +01:00
parent d72538506f
commit 289ce87f6d
2 changed files with 13 additions and 11 deletions

View File

@ -2928,8 +2928,8 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
/**
* Format profIDs according to country
*
* @param string $profID value of profID to format
* @param string $profIDtype type of profID to format (ProfId1, ProfId2, ProfId3, ProfId4, ProfId5, ProfId6 or VATIntra)
* @param string $profID Value of profID to format
* @param string $profIDtype Type of profID to format ('1', '2', '3', '4', '5', '6' or 'VAT')
* @param string $countrycode Country code to use for formatting
* @param int $addcpButton Add button to copy to clipboard (1 => show only on hoover ; 2 => always display )
* @param string $separ Separation between numbers for a better visibility example : xxx xxx xxx xxxxx
@ -2939,7 +2939,9 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton
{
global $mysoc;
if (empty($profID) || empty($profIDtype)) return '';
if (empty($profID) || empty($profIDtype)) {
return '';
}
if (empty($countrycode)) $countrycode = $mysoc->country_code;
$newProfID = $profID;
$id = substr($profIDtype, -1);
@ -2948,7 +2950,7 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton
// France
if ($id == 1 && dol_strlen($newProfID) == 9) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3);
if ($id == 2 && dol_strlen($newProfID) == 14) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3).$separ.substr($newProfID, 9, 5);
if ($profIDtype == 'VATIntra' && dol_strlen($newProfID) == 13) $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3);
if ($profIDtype === 'VAT' && dol_strlen($newProfID) == 13) $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3);
}
if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID);
else $ret = $newProfID;

View File

@ -2073,24 +2073,24 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN"), 1).'</span>';
}
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET"), 2).'</span>';
}
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_APE")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_APE"), 3).'</span>';
}
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS"), 4).'</span>';
}
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5"), 5).'</span>';
}
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6")).'</span>';
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).'</span>';
}
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA")).'</span>';
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').'</span>';
$dropdownBody .= '</div>';