From effba68511eb34dc8067c41f96366cc5865dcd12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Oct 2015 01:51:12 +0200 Subject: [PATCH] Start to work on a common banner for tabs (goal is to have a nicer and generic part for all element) --- htdocs/core/class/commonobject.class.php | 74 +++++++++++++++++++++ htdocs/core/class/html.form.class.php | 44 +++++++------ htdocs/core/lib/company.lib.php | 46 ++++--------- htdocs/core/lib/functions.lib.php | 39 +++++++---- htdocs/societe/soc.php | 84 +++++++++++++++++------- htdocs/theme/eldy/style.css.php | 44 ++++++++++++- 6 files changed, 235 insertions(+), 96 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bfa1595197e..76fd73a324d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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.=''; + + $outdone=0; + $coords = $this->getFullAddress(1,', '); + if (! empty($conf->use_javascript_ajax)) + { + $namecoords = $this->getFullName($langs,1).'
'.$coords; + // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile + $out.=''; + $out.=img_picto($langs->trans("Address"), 'object_address.png'); + $out.=' '; + } + 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?'
':'').$this->state; + $outdone++; + } + + if ($this->phone_pro || $this->phone_mobile || $this->phone_perso || $this->fax) $out.=($outdone?'
':''); + if ($this->phone_pro) { + $out.=dol_print_phone($this->phone_pro,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; + } + if ($this->phone_mobile) { + $out.=dol_print_phone($this->phone_mobile,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; + } + if ($this->phone_perso) { + $out.=dol_print_phone($this->phone_perso,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; + } + if ($this->fax) { + $out.=dol_print_phone($this->fax,$country_code['code'],$this->rowid,$object->id,'AC_FAX',' ','fax'); $outdone++; + } + + $out.='
'; + $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?'
':'').dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE'); + } + + $out.=''; + + return $out; + } + /** * Add a link between element $this->element and a contact * diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0d4bff05d42..8cc9eaa09a0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5042,16 +5042,18 @@ class Form * @param int $shownav Show Condition (navigation is shown if value is 1) * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field) * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous - * @param string $morehtmlref Code html supplementaire a afficher apres ref + * @param string $morehtmlref More html to show after ref * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name + * @param string $morehtmlleft More html code to show before ref + * @param string $morehtmlright More html code to show before navigation arrows * @return string Portion HTML avec ref + boutons nav */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) + function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlright='') { global $langs,$conf; - $ret=''; + $ret=''; if (empty($fieldid)) $fieldid='rowid'; if (empty($fieldref)) $fieldref='ref'; @@ -5064,14 +5066,18 @@ class Form $next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?'>':' ').'':''; //print "xx".$previous_ref."x".$next_ref; - $ret.='
'; + $ret.='
'; + + $ret.='
'.$morehtmlleft.'
'; + + $ret.='
'; $ret.=dol_htmlentities($object->$fieldref); if ($morehtmlref) { $ret.=' '.$morehtmlref; } - $ret.='
'; + $ret.='
'; if ($previous_ref || $next_ref || $morehtml) { @@ -5079,23 +5085,20 @@ class Form } if ($morehtml) { - //$ret.=''.$morehtml; $ret.='
  • '.$morehtml.'
  • '; } if ($shownav && ($previous_ref || $next_ref)) { - //$ret.=''.$previous_ref.''; - //$ret.=''.$next_ref; $ret.=''; $ret.=''; } if ($previous_ref || $next_ref || $morehtml) { - //$ret.=''; $ret.='
    '; } - $ret.='
    '; - + $ret.='
    '.$morehtmlright.'
    '; + $ret.=''; + return $ret; } @@ -5132,15 +5135,16 @@ class Form /** * Return HTML code to output a photo * - * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') - * @param object $object Object containing data to retrieve file name - * @param int $width Width of photo - * @param int $height Height of photo (auto if 0) - * @param int $caneditfield Add edit fields - * @param string $cssclass CSS name to use on img for photo - * @return string HTML code to output photo + * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') + * @param object $object Object containing data to retrieve file name + * @param int $width Width of photo + * @param int $height Height of photo (auto if 0) + * @param int $caneditfield Add edit fields + * @param string $cssclass CSS name to use on img for photo + * @param int $genericifundef Use a generic image if no image avaiable + * @return string HTML code to output photo */ - static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin') + static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $genericifundef=0) { global $conf,$langs; @@ -5199,7 +5203,7 @@ class Form else { $nophoto='/public/theme/common/nophoto.jpg'; - if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users + if (in_array($modulepart,array('userphoto','contact'))) // For module that are "physical" users { $nophoto='/public/theme/common/user_anonymous.png'; if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 9a67065fe64..aba18765777 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -689,10 +689,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') { $obj = $db->fetch_object($result); $var = !$var; - print ""; - - print ''; + $contactstatic->id = $obj->rowid; + $contactstatic->ref = $obj->ref; $contactstatic->statut = $obj->statut; $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; @@ -705,44 +704,23 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->phone_mobile = $obj->phone_mobile; $contactstatic->phone_perso = $obj->phone_perso; $contactstatic->email = $obj->email; + $contactstatic->web = $obj->web; + $contactstatic->skype = $obj->skype; + + $country_code = getCountry($obj->country_id, 'all'); + $contactstatic->country_code = $country_code; + + print ""; + + print ''; print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage)); print ''; if ($obj->poste) print $obj->poste; print ''; - $country_code = getCountry($obj->country_id, 'all'); - // Address and phone print ''; - $outdone=0; - $contactstatic->address = $obj->address; - $contactstatic->zip = $obj->zip; - $contactstatic->town = $obj->town; - $contactstatic->country_id = $obj->country_id; - $coords = $contactstatic->getFullAddress(1,', '); - if (! empty($conf->use_javascript_ajax)) - { - $namecoords = $contactstatic->getFullName($langs,1).'
    '.$coords; - // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile - print ''; - print img_picto($langs->trans("Address"), 'object_address.png'); - print ' '; - } - if ($coords) { print dol_print_address($coords,'address_contact_'.$obj->rowid, 'contact', $obj->rowid); $outdone++; } - - if ($obj->phone_pro || $obj->phone_mobile || $obj->phone_perso || $obj->fax) print ($outdone?'
    ':''); - if ($obj->phone_pro) { print dol_print_phone($obj->phone_pro,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } - if ($obj->phone_mobile) { print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } - if ($obj->phone_perso) { print dol_print_phone($obj->phone_perso,$country_code['code'],$obj->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++; } - if ($obj->fax) { print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX',' ','fax'); $outdone++; } - - print '
    '; - $outdone=0; - if ($obj->email) print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL',0,0,1); - if (! empty($conf->skype->enabled)) - { - if ($obj->skype) print ($outdone?'
    ':'').dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE'); - } + print $contactstatic->getBannerAddress('contact', $object); print ''; // Status diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 81f14683383..443749dd271 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1315,20 +1315,25 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0) * @param string $url Url to show * @param string $target Target for link * @param int $max Max number of characters to show + * @param int $withpicto With picto * @return string HTML Link */ -function dol_print_url($url,$target='_blank',$max=32) +function dol_print_url($url,$target='_blank',$max=32,$withpicto=0) { + global $langs; + if (empty($url)) return ''; $link=''; + $link.='"'; + if ($target) $link.=' target="'.$target.'"'; + $link.='>'; if (! preg_match('/^http/i',$url)) $link.='http://'; $link.=dol_trunc($url,$max); $link.=''; - return $link; + return '
    '.($withpicto?img_picto($langs->trans("Url"), 'object_globe.png').' ':'').$link.'
    '; } /** @@ -1591,26 +1596,30 @@ function dol_user_country() /** * Format address string * - * @param string $address Address - * @param int $htmlid Html ID (for example 'gmap') - * @param int $mode thirdparty|contact|member|other - * @param int $id Id of object - * @return void + * @param string $address Address + * @param int $htmlid Html ID (for example 'gmap') + * @param int $mode thirdparty|contact|member|other + * @param int $id Id of object + * @param int $noprint No output. Result is the function return + * @return string|void Nothing if noprint is 0, formatted address if noprint is 1 * @see dol_format_address */ -function dol_print_address($address, $htmlid, $mode, $id) +function dol_print_address($address, $htmlid, $mode, $id, $noprint=0) { global $conf, $user, $langs, $hookmanager; + $out = ''; + if ($address) { if ($hookmanager) { $parameters = array('element' => $mode, 'id' => $id); $reshook = $hookmanager->executeHooks('printAddress', $parameters, $address); - print $hookmanager->resPrint; + $out.=$hookmanager->resPrint; } - if (empty($reshook)) { - print nl2br($address); + if (empty($reshook)) + { + $out.=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; @@ -1623,15 +1632,17 @@ function dol_print_address($address, $htmlid, $mode, $id) if ($showgmap) { $url=dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id,1); - print ' '; + $out.=' '; } if ($showomap) { $url=dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id,1); - print ' '; + $out.=' '; } } } + if ($noprint) return $out; + else print $out; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 0411e974f2d..aad1a8aae48 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1727,7 +1727,7 @@ else // Capital print ''.fieldLabel('Capital','capital').''; - print ''.$langs->trans("Currency".$conf->currency).''; + print ' '.$langs->trans("Currency".$conf->currency).''; // Default language if (! empty($conf->global->MAIN_MULTILANGS)) @@ -1863,10 +1863,30 @@ else dol_htmloutput_errors($error,$errors); - $showlogo=$object->logo; + //$showlogo=$object->logo; + $showlogo=1; $showbarcode=empty($conf->barcode->enabled)?0:1; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; + print '
    '; + //$morehtmlleft='
    '.img_picto('', 'title_companies', '', '').'
    '; + if ($showlogo) $morehtmlleft.='
    '.$form->showphoto('societe',$object,0,0,0,'photoref').'
    '; + //if ($showlogo) $morehtmlleft.='
    '.$form->showphoto('societe',$object,0,0,0,'photoref').'
    '; + if ($showbarcode) $morehtmlleft.='
    '.$form->showbarcode($object).'
    '; + if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + $morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + } else { + $morehtmlright.=$object->getLibStatut(2); + } + $morehtml=''; + if (! empty($object->ame_nalias)) $morehtml.='
    '.$object->name_alias.'
    '; + $morehtml.='
    '; + $morehtml.=$object->getBannerAddress('refaddress',$object); + $morehtml.='
    '; + print $form->showrefnav($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', $morehtml, '', 0, $morehtmlleft, $morehtmlright); + print '
    '; + print '
    '; + print ''; // Ref @@ -1879,18 +1899,21 @@ else */ // Name + /* print ''; print ''; print ''; - + */ + // Alias names (commercial, trademark or alias names) - print '"; // Logo+barcode + /* $rowspan=6; if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++; if (! empty($object->client)) $rowspan++; @@ -1905,12 +1928,12 @@ else if ($showlogo && $showbarcode) $htmllogobar.='

    '; if ($showbarcode) $htmllogobar.=$form->showbarcode($object); $htmllogobar.=''; - } + }*/ // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; print $htmllogobar; $htmllogobar=''; print ''; } @@ -1919,7 +1942,7 @@ else if ($object->client) { print ''; @@ -1931,7 +1954,7 @@ else if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) { print ''; @@ -1943,13 +1966,16 @@ else if (! empty($conf->barcode->enabled)) { print ''; - print $htmllogobar; $htmllogobar=''; + if ($htmllogobar) $htmllogobar.=$form->showbarcode($object); + print $htmllogobar; + $htmllogobar=''; print ''; } // Status + /* print ''; print ''; print $htmllogobar; $htmllogobar=''; print ''; - + */ + // Address + /* print ''; @@ -2007,7 +2035,8 @@ else // Phone / Fax print ''; print ''; - + */ + // Prof ids $i=1; $j=0; while ($i <= 6) @@ -2015,8 +2044,9 @@ else $idprof=$langs->transcountry('ProfId'.$i,$object->country_code); if ($idprof!='-') { - if (($j % 2) == 0) print ''; - print ''; + print ''; + print ''; - if (($j % 2) == 1) print ''; + //if (($j % 2) == 1) print ''; + print ''; $j++; } $i++; } - if ($j % 2 == 1) print ''; + //if ($j % 2 == 1) print ''; // VAT payers print ''; - + print ''; + // VAT Code - print ''; + print ''; @@ -2177,13 +2210,14 @@ else // Type + Staff $arr = $formcompany->typent_array(1); $object->typent= $arr[$object->typent_code]; - print ''; + print ''; + print ''; // Legal - print ''; + print ''; // Capital - print ''; @@ -2192,7 +2226,7 @@ else if (! empty($conf->global->MAIN_MULTILANGS)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print ''; - print '"; } @@ -2215,7 +2249,7 @@ else // Supplier if ($object->fournisseur) { print ''; - print '"; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b6987ed42cc..d768f446a0d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -604,6 +604,38 @@ div.attacharea { padding-bottom: 10px; } +div.arearef { + /*border-bottom: 1px solid #bbb;*/ + padding-top: 2px; + padding-bottom: 5px; + /*padding-right: 3px; + padding-left: 2px;*/ + margin-bottom: 10px; +} +div.heightref { + min-height: 74px; +} +div.divphotoref { + padding-right: 10px; +} +div.statusref { + float: right; + padding-right: 12px; + margin-top: 9px; + margin-bottom: 10px; +} +img.photoref { + height: 68px; + width: 68px; + border: 1px solid #CCC; + -moz-box-shadow: 3px 3px 4px #DDD; + -webkit-box-shadow: 3px 3px 4px #DDD; + box-shadow: 3px 3px 4px #DDD; +} +.underrefbanner { + border-bottom: 2px solid #888; +} + /* ============================================================================== */ /* Menu top et 1ere ligne tableau */ /* ============================================================================== */ @@ -2051,13 +2083,19 @@ table.liste td { /* Pagination */ div.refidpadding { - padding-top: dol_use_jmobile)?'8':'12'; ?>px; + /* padding-top: dol_use_jmobile)?'8':'12'; ?>px; */ } div.refid { - padding-top: dol_use_jmobile)?'5':'12'; ?>px; + /* padding-top: dol_use_jmobile)?'5':'12'; ?>px; */ font-weight: bold; color: #766; - font-size: 120%; + font-size: 160%; +} +div.refidno { + padding-top: 2px; + font-weight: normal; + color: #444; + font-size: px; } div.pagination {
    '.$langs->trans('ThirdPartyName').''; print $form->showrefnav($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); print '
    '.$langs->trans('AliasNames').''; + print '
    '.$langs->trans('AliasNames').''; print $object->name_alias; print "
    '.$langs->trans('Prefix').''.$object->prefix_comm.'
    '.$langs->trans('Prefix').''.$object->prefix_comm.'
    '; - print $langs->trans('CustomerCode').''; + print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print '
    '; - print $langs->trans('SupplierCode').''; + print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
    '; - print $langs->trans('Gencod').''.$object->barcode; + print $langs->trans('Gencod').''.$object->barcode; print '
    '.$langs->trans("Status").''; if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { @@ -1960,8 +1986,10 @@ else print '
    '.$langs->trans('Address').''; dol_print_address($object->address,'gmap','thirdparty',$object->id); print '
    '.$langs->trans('Phone').''.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').''.$langs->trans('Fax').''.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'
    '.$idprof.''; + //if (($j % 2) == 0) print '
    '.$idprof.''; $key='idprof'.$i; print $object->$key; if ($object->$key) @@ -2025,12 +2055,13 @@ else else print ' ('.$langs->trans("ErrorWrongValue").')'; } print '
    '; @@ -2038,9 +2069,11 @@ else print ''; print yn($object->tva_assuj); print '
    '.$langs->trans('VATIntra').''; + print '
    '.$langs->trans('VATIntra').''; if ($object->tva_intra) { $s=''; @@ -2083,7 +2116,7 @@ else { print '
    '.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).''; print yn($object->localtax1_assuj); - print ''.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; + print '
    '.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).''; print yn($object->localtax2_assuj); print '
    '.$langs->trans("ThirdPartyType").''.$object->typent.''.$langs->trans("Staff").''.$object->effectif.'
    '.$langs->trans("ThirdPartyType").''.$object->typent.'
    '.$langs->trans("Staff").''.$object->effectif.'
    '.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
    '.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
    '.$langs->trans('Capital').''; + print '
    '.$langs->trans('Capital').''; if ($object->capital) print price($object->capital,'',$langs,0,-1,-1, $conf->currency); else print ' '; print '
    '.$langs->trans("DefaultLang").''; + print '
    '.$langs->trans("DefaultLang").''; //$s=picto_from_langcode($object->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); @@ -2207,7 +2241,7 @@ else // Customer if ($object->prospect || $object->client) { print '
    ' . $langs->trans("CustomersCategoriesShort") . ''; + print ''; print $form->showCategories($object->id, 'customer', 1); print "
    ' . $langs->trans("SuppliersCategoriesShort") . ''; + print ''; print $form->showCategories($object->id, 'supplier', 1); print "