Start to work on a common banner for tabs (goal is to have a nicer and

generic part for all element)
This commit is contained in:
Laurent Destailleur
2015-10-10 01:51:12 +02:00
parent 8db83a51b2
commit effba68511
6 changed files with 235 additions and 96 deletions

View File

@@ -434,6 +434,80 @@ abstract class CommonObject
}
/**
* Return full address of contact
*
* @param Societe $object Object Societe or null
* @return string Full address string
*/
function getBannerAddress($htmlkey, $object=null)
{
global $conf, $langs;
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
$out='';
$out.='<!-- BEGIN PHP TEMPLATE address_view.tpl.php -->';
$outdone=0;
$coords = $this->getFullAddress(1,', ');
if (! empty($conf->use_javascript_ajax))
{
$namecoords = $this->getFullName($langs,1).'<br>'.$coords;
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
$out.='<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
$out.=img_picto($langs->trans("Address"), 'object_address.png');
$out.='</a> ';
}
if ($coords) {
$out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++;
$outdone++;
}
if (! in_array($object->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
&& ! empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{
$out.=($outdone?'<br>':'').$this->state;
$outdone++;
}
if ($this->phone_pro || $this->phone_mobile || $this->phone_perso || $this->fax) $out.=($outdone?'<br>':'');
if ($this->phone_pro) {
$out.=dol_print_phone($this->phone_pro,$country_code['code'],$this->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++;
}
if ($this->phone_mobile) {
$out.=dol_print_phone($this->phone_mobile,$country_code['code'],$this->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++;
}
if ($this->phone_perso) {
$out.=dol_print_phone($this->phone_perso,$country_code['code'],$this->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++;
}
if ($this->fax) {
$out.=dol_print_phone($this->fax,$country_code['code'],$this->rowid,$object->id,'AC_FAX','&nbsp;','fax'); $outdone++;
}
$out.='<div style="clear: both;"></div>';
$outdone=0;
if ($this->email)
{
$out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1);
$outdone++;
}
if ($this->url)
{
$out.=dol_print_url($this->url,'',0,1);
$outdone++;
}
if (! empty($conf->skype->enabled))
{
if ($this->skype) $out.=($outdone?'<br>':'').dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE');
}
$out.='<!-- END PHP TEMPLATE address_view.tpl.php -->';
return $out;
}
/**
* Add a link between element $this->element and a contact
*