can('client','read') && $client->id!=0 && !$myUser->can('client_sheet','read',$client->id)) throw new Exception("Permission non accordée sur cette fiche"); if(isset($_['id']) && !$client) throw new Exception("Aucun client existant avec cet identifiant"); $addresses = $client->addresses('global'); $mainAddress = !empty($addresses) ? $addresses[0]: new Address(); $contacts = $client->contacts(); $phone = isset($contacts['phone']) ? $contacts['phone'] : new Contact(); $phoneValue = $phone->value; if(!empty($phone->value)) $phoneValue = implode(' ',str_split($phone->value,2)); $mail = isset($contacts['mail']) ? $contacts['mail'] : new Contact(); $clientMenu = array(); if($client->creator == '') $client->creator = $myUser->login; if($client->updater == '') $client->updater = $myUser->login; $creator = User::byLogin($client->creator); $updater = User::byLogin($client->updater); $subsites = $client->subsites(); $holding = isset($_['parent']) ? Client::getById($_['parent']) : $client->holding(); $holdingPhone = ''; $holdingAddress = new Address(); if($holding->id!=0){ $holdingPhone = $holding->contacts('phone')->value; $holdingAddress = $holding->addresses('global'); $holdingAddress = !empty($holdingAddress) ? $holdingAddress[0] : new Address(); } Plugin::callHook('client_menu',array(&$clientMenu,$client)); usort($clientMenu,function($a,$b){ if($a->sort < $b->sort) return -1; if($a->sort > $b->sort) return 1; if($a->sort == $b->sort) return 0; }); $editable = $myUser->can('client','edit') && ($client->id==0 || $client->firm==$myFirm->id || $myUser->can('client_sheet','edit',$client->id)); ?>
{{street}} {{complement}},
{{#zip}}{{zip}}{{/zip}}{{^zip}}-{{/zip}} {{#city}}{{city}}{{/city}}{{^city}}-{{/city}}
{{#country}}{{country}}{{/country}}