Merge pull request #20907 from atm-quentin/NEW_hook_format_address
FIX : hook for dol_format_address
This commit is contained in:
commit
1196d6f48c
@ -2154,7 +2154,7 @@ function dol_bc($var, $moreclass = '')
|
|||||||
*/
|
*/
|
||||||
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '')
|
function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '')
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
$ret = '';
|
$ret = '';
|
||||||
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
||||||
@ -2220,6 +2220,14 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
|||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
$ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
|
$ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
|
||||||
}
|
}
|
||||||
|
if ($hookmanager) {
|
||||||
|
$parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode);
|
||||||
|
$reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object);
|
||||||
|
if ($reshook > 0) {
|
||||||
|
$ret = '';
|
||||||
|
}
|
||||||
|
$ret .= $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user