29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/vcard.class.php';
35 $ref =
GETPOST(
'ref',
'alphanohtml');
37 $object =
new adherent($db);
40 if ($id > 0 || !empty($ref)) {
42 $result = $object->fetch($id, $ref);
45 $canadduser = ($user->admin || $user->hasRight(
'user',
'user',
'creer'));
47 if ($object->user_id) {
49 $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight(
'user',
'self',
'creer'))
50 || (($user->id != $object->user_id) && $user->hasRight(
'user',
'user',
'creer')));
51 $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight(
'user',
'self',
'password'))
52 || (($user->id != $object->user_id) && $user->hasRight(
'user',
'user',
'password')));
57 $canaddmember = $user->hasRight(
'adherent',
'creer');
60 $caneditfieldmember = $user->hasRight(
'adherent',
'creer');
64 $result =
restrictedArea($user,
'adherent', $object->id,
'',
'',
'socid',
'rowid', 0);
80 $result = $company->fetch($object->socid);
87 $v->setProdId(
'Dolibarr '.DOL_VERSION);
89 $v->setUid(
'DOLIBARR-ADHERENTID-'.$object->id);
90 $v->setName($object->lastname, $object->firstname,
"", $object->civility,
"");
91 $v->setFormattedName($object->getFullName($langs, 1));
93 $v->setPhoneNumber($object->phone_pro,
"TYPE=WORK;VOICE");
95 $v->setPhoneNumber($object->phone_mobile,
"TYPE=CELL;VOICE");
96 $v->setPhoneNumber($object->fax,
"TYPE=WORK;FAX");
98 $country = $object->country_code ? $object->country :
'';
100 $v->setAddress(
"",
"", $object->address, $object->town, $object->state, $object->zip, $country,
"TYPE=WORK;POSTAL");
101 $v->setLabel(
"",
"", $object->address, $object->town, $object->state, $object->zip, $country,
"TYPE=WORK");
103 $v->setEmail($object->email);
104 $v->setNote($object->note_public);
105 $v->setTitle($object->poste);
109 $v->setURL($company->url,
"TYPE=WORK");
110 if (!$object->phone_pro) {
111 $v->setPhoneNumber($company->phone,
"TYPE=WORK;VOICE");
114 $v->setPhoneNumber($company->fax,
"TYPE=WORK;FAX");
117 $v->setAddress(
"",
"", $company->address, $company->town, $company->state, $company->zip, $company->country,
"TYPE=WORK;POSTAL");
120 if (empty(trim($company->email))) {
122 } elseif (empty(trim($object->email))) {
124 $v->setEmail($company->email);
126 $tmpobject = explode(
"@", trim($object->email));
127 $tmpcompany = explode(
"@", trim($company->email));
129 if (strtolower(end($tmpobject)) == strtolower(end($tmpcompany))) {
131 $v->setEmail($object->email);
134 $v->setEmail($company->email,
'INTERNET');
137 $v->setEmail($company->email);
140 $v->setEmail($object->email,
'INTERNET');
145 if ($company->typent_code !=
'TE_PRIVATE') {
146 $v->setOrg($company->name);
151 $v->setPhoneNumber($object->phone_perso,
"TYPE=HOME;VOICE");
152 if ($object->birth) {
153 $v->setBirthday($object->birth);
161 $output = $v->getVCard();
163 $filename = trim(urldecode($v->getFileName()));
168 header(
"Content-Disposition: attachment; filename=\"".$filename.
"\"");
169 header(
"Content-Length: ".
dol_strlen($output));
170 header(
"Connection: close");
171 header(
"Content-Type: text/x-vcard; name=\"".$filename.
"\"");
Class to manage third parties objects (customers, suppliers, prospects...)
Class to buld vCard files.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.