forked from Wavyzz/dolibarr
New - Improve the reading of profIDs
This commit is contained in:
@@ -2925,6 +2925,36 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||||||
return $htmllink;
|
return $htmllink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 $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
|
||||||
|
* @return string Formated profID
|
||||||
|
*/
|
||||||
|
function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton = 1, $separ = ' ')
|
||||||
|
{
|
||||||
|
global $mysoc;
|
||||||
|
|
||||||
|
if (empty($profID) || empty($profIDtype)) return '';
|
||||||
|
if (empty($countrycode)) $countrycode = $mysoc->country_code;
|
||||||
|
$newProfID = $profID;
|
||||||
|
$id = substr($profIDtype, -1);
|
||||||
|
$ret = '';
|
||||||
|
if (strtoupper($countrycode) == 'FR') {
|
||||||
|
// 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 (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID);
|
||||||
|
else $ret = $newProfID;
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format phone numbers according to country
|
* Format phone numbers according to country
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2073,24 +2073,24 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
|||||||
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
|
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
|
||||||
|
|
||||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIREN")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN")).'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIRET")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET")).'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_APE")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_APE")).'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_RCS")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS")).'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID5")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5")).'</span>';
|
||||||
}
|
}
|
||||||
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
|
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
|
||||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID6")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6")).'</span>';
|
||||||
}
|
}
|
||||||
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_TVAINTRA")).'</span>';
|
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA")).'</span>';
|
||||||
|
|
||||||
$dropdownBody .= '</div>';
|
$dropdownBody .= '</div>';
|
||||||
|
|
||||||
|
|||||||
@@ -2542,7 +2542,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$idprof.'</td><td>';
|
print '<td>'.$idprof.'</td><td>';
|
||||||
$key = 'idprof'.$i;
|
$key = 'idprof'.$i;
|
||||||
print showValueWithClipboardCPButton(dol_escape_htmltag($object->$key));
|
print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1);
|
||||||
if ($object->$key) {
|
if ($object->$key) {
|
||||||
if ($object->id_prof_check($i, $object) > 0) {
|
if ($object->id_prof_check($i, $object) > 0) {
|
||||||
print ' '.$object->id_prof_url($i, $object);
|
print ' '.$object->id_prof_url($i, $object);
|
||||||
@@ -2655,7 +2655,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
|
print '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
|
||||||
if ($object->tva_intra) {
|
if ($object->tva_intra) {
|
||||||
$s = '';
|
$s = '';
|
||||||
$s .= showValueWithClipboardCPButton(dol_escape_htmltag($object->tva_intra));
|
$s .= dol_print_profids($object->tva_intra, 'VATIntra', $object->country_code, 1);
|
||||||
$s .= '<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.'">';
|
$s .= '<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.'">';
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
|
if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user