27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/vcard.class.php';
32 $user2 =
new user($db);
39 if ($user->socid > 0) $socid = $user->socid;
44 $result = $user2->fetch($id);
56 $result = $company->fetch($user2->socid);
61 $v->setProdId(
'Dolibarr '.DOL_VERSION);
63 $v->setUid(
'DOLIBARR-USERID-'.$user2->id);
64 $v->setName($user2->lastname, $user2->firstname,
"", $user2->civility_code,
"");
65 $v->setFormattedName($user2->getFullName($langs, 1));
67 $v->setPhoneNumber($user2->phone_pro,
"TYPE=WORK;VOICE");
69 $v->setPhoneNumber($user2->phone_mobile,
"TYPE=CELL;VOICE");
70 $v->setPhoneNumber($user2->fax,
"TYPE=WORK;FAX");
72 $country = $user2->country_code ? $user2->country :
'';
74 $v->setAddress(
"",
"", $user2->address, $user2->town, $user2->state, $user2->zip, $country,
"TYPE=WORK;POSTAL");
75 $v->setLabel(
"",
"", $user2->address, $user2->town, $user2->state, $user2->zip, $country,
"TYPE=WORK");
77 $v->setEmail($user2->email);
78 $v->setNote($user2->note);
79 $v->setTitle($user2->poste);
84 $v->setURL($company->url,
"TYPE=WORK");
85 if (!$user2->phone_pro) $v->setPhoneNumber($company->phone,
"TYPE=WORK;VOICE");
86 if (!$user2->fax) $v->setPhoneNumber($company->fax,
"TYPE=WORK;FAX");
87 if (!$user2->zip) $v->setAddress(
"",
"", $company->address, $company->town, $company->state, $company->zip, $company->country,
"TYPE=WORK;POSTAL");
90 if (empty(trim($company->email)))
95 elseif (empty(trim($user2->email)))
97 $v->setEmail($company->email);
100 elseif (strtolower(end(explode(
"@", $user2->email))) == strtolower(end(explode(
"@", $company->email))))
102 $v->setEmail($user2->email);
105 $v->setEmail($company->email,
'INTERNET');
109 $v->setEmail($company->email);
112 $v->setEmail($user2->email,
'INTERNET');
116 if ($user2->typent_code !=
'TE_PRIVATE') $v->setOrg($company->name);
120 $v->setPhoneNumber($user2->phone_perso,
"TYPE=HOME;VOICE");
121 if ($user2->birth) $v->setBirthday($user2->birth);
127 $output = $v->getVCard();
129 $filename = trim(urldecode($v->getFileName()));
134 header(
"Content-Disposition: attachment; filename=\"".$filename.
"\"");
135 header(
"Content-Length: ".
dol_strlen($output));
136 header(
"Connection: close");
137 header(
"Content-Type: text/x-vcard; name=\"".$filename.
"\"");
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to buld vCard files.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...