mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Add dol_print_address function
This commit is contained in:
@@ -1189,7 +1189,9 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'.nl2br($adh->adresse).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">';
|
||||
dol_print_address($adh->adresse,'gmap','member',$adh->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'</td></tr>';
|
||||
|
||||
@@ -187,7 +187,7 @@ if ($socid > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("Name").'</td><td width="70%" colspan="3">';
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||
$objsoc->next_prev_filter="te.client in (1,3)";
|
||||
print $form->showrefnav($objsoc,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
@@ -220,7 +220,9 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">'.nl2br($objsoc->address)."</td></tr>";
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
|
||||
dol_print_address($objsoc->address,'gmap','contact',$objsoc->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$objsoc->cp."</td>";
|
||||
|
||||
@@ -57,7 +57,6 @@ if ($_GET["action"] == 'cstc')
|
||||
// set prospect level
|
||||
if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
|
||||
$societe = new Societe($db, $_GET["socid"]);
|
||||
$societe->fk_prospectlevel=$_POST['prospect_level_id'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id'];
|
||||
@@ -100,12 +99,15 @@ if ($socid > 0)
|
||||
print '<tr><td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">';
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td width="80%" colspan="3">';
|
||||
$societe->next_prev_filter="te.client in (2,3)";
|
||||
print $form->showrefnav($societe,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->address)."</td></tr>";
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($societe->address,'gmap','thirdparty',$societe->id);
|
||||
print "</td></tr>";
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>'.$societe->cp.'</td>';
|
||||
@@ -127,8 +129,6 @@ if ($socid > 0)
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$societe->url\">$societe->url</a></td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">'.$societe->forme_juridique.'</td></tr>';
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
|
||||
@@ -808,7 +808,9 @@ else
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction" ).'</td><td colspan="3">'.$object->poste.'</td>';
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($object->address).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
|
||||
@@ -120,7 +120,9 @@ if ( $societe->fetch($socid) )
|
||||
}
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">'.nl2br($societe->address).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($societe->address,'gmap','thirdparty',$societe->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").'</td><td>'.$societe->cp.'</td>';
|
||||
@@ -178,6 +180,11 @@ if ( $societe->fetch($socid) )
|
||||
}
|
||||
}
|
||||
|
||||
// TVA Intra
|
||||
print '<tr><td nowrap>'.$langs->trans('VATIntraVeryShort').'</td><td colspan="3">';
|
||||
print $objsoc->tva_intra;
|
||||
print '</td></tr>';
|
||||
|
||||
// Module Adherent
|
||||
if ($conf->adherent->enabled)
|
||||
{
|
||||
|
||||
@@ -1101,6 +1101,52 @@ function dol_print_ip($ip,$mode=0)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format address string
|
||||
* @param address Address
|
||||
* @param htmlid Html ID
|
||||
* @param mode thirdparty|contact|member|other
|
||||
* @param id Id of object
|
||||
* @param address Address string
|
||||
*/
|
||||
function dol_print_address($address,$htmlid='gmap',$mode,$id)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
if ($address)
|
||||
{
|
||||
print nl2br($address);
|
||||
$showmap=0;
|
||||
if ($mode=='thirdparty' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS) $showmap=1;
|
||||
if ($mode=='contact' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS) $showmap=1;
|
||||
if ($mode=='member' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS) $showmap=1;
|
||||
|
||||
if ($showmap)
|
||||
{
|
||||
$url=dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id,1);
|
||||
/* print ' <img id="'.$htmlid.'" src="'.DOL_URL_ROOT.'/theme/common/gmap.png">';
|
||||
print '<script type="text/javascript">
|
||||
$(\'#gmap\').css(\'cursor\',\'pointer\');
|
||||
$(\'#gmap\').click(function() {
|
||||
$( \'<div>\').dialog({
|
||||
modal: true,
|
||||
open: function ()
|
||||
{
|
||||
$(this).load(\''.$url.'\');
|
||||
},
|
||||
height: 400,
|
||||
width: 600,
|
||||
title: \'GMap\'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
'; */
|
||||
print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if email syntax is ok.
|
||||
* @param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
@@ -1142,8 +1188,8 @@ function isValidPhone($address)
|
||||
*/
|
||||
function dol_strlen($string,$stringencoding='UTF-8')
|
||||
{
|
||||
// print $stringencoding."xxx";
|
||||
// $stringencoding='rrr';
|
||||
// print $stringencoding."xxx";
|
||||
// $stringencoding='rrr';
|
||||
if (function_exists('mb_strlen')) return mb_strlen($string,$stringencoding);
|
||||
else return strlen($string);
|
||||
}
|
||||
|
||||
@@ -1387,7 +1387,10 @@ else
|
||||
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->gencod.'</td></tr>';
|
||||
}
|
||||
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->address)."</td></tr>";
|
||||
// Address
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">";
|
||||
dol_print_address($soc->address,'gmap','thirdparty',$soc->id);
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->cp."</td>";
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$soc->ville."</td></tr>";
|
||||
|
||||
Reference in New Issue
Block a user