diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 5b2fd338b9574df586cd7cd72b438babb8171581..d0be932390bcb07301315247fa68457cdba7f605 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1354,30 +1354,37 @@ function dol_user_country()
*/
function dol_print_address($address, $htmlid, $mode, $id)
{
- global $conf,$user,$langs;
+ global $conf, $user, $langs, $hookmanager;
if ($address)
{
- print nl2br($address);
- $showgmap=$showomap=0;
- if ($mode=='thirdparty' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
- if ($mode=='contact' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap=1;
- if ($mode=='member' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap=1;
- if ($mode=='thirdparty' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
- if ($mode=='contact' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap=1;
- if ($mode=='member' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap=1;
-
- // TODO Add a hook here
- if ($showgmap)
- {
- $url=dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id,1);
- print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" border="0" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
- }
- if ($showomap)
- {
- $url=dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id,1);
- print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" border="0" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
- }
+ if ($hookmanager) {
+ $parameters = array('element' => $mode, 'id' => $id);
+ $reshook = $hookmanager->executeHooks('printAddress', $parameters, $address, $action);
+ print $hookmanager->resPrint;
+ }
+ if (empty($reshook)) {
+ print nl2br($address);
+ $showgmap=$showomap=0;
+ if ($mode=='thirdparty' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
+ if ($mode=='contact' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap=1;
+ if ($mode=='member' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap=1;
+ if ($mode=='thirdparty' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
+ if ($mode=='contact' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap=1;
+ if ($mode=='member' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap=1;
+
+ // TODO Add a hook here
+ if ($showgmap)
+ {
+ $url=dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id,1);
+ print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" border="0" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
+ }
+ if ($showomap)
+ {
+ $url=dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id,1);
+ print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" border="0" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
+ }
+ }
}
}