27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/vcard.class.php';
38 $result =
restrictedArea($user,
'contact', $id,
'socpeople&societe');
41 $result = $contact->fetch($id);
53 $result = $company->fetch($contact->socid);
58 $v->setProdId(
'Dolibarr '.DOL_VERSION);
60 $v->setUid(
'DOLIBARR-CONTACTID-'.$contact->id);
61 $v->setName($contact->lastname, $contact->firstname,
"", $contact->civility,
"");
62 $v->setFormattedName($contact->getFullName($langs, 1));
64 $v->setPhoneNumber($contact->phone_pro,
"TYPE=WORK;VOICE");
66 $v->setPhoneNumber($contact->phone_mobile,
"TYPE=CELL;VOICE");
67 $v->setPhoneNumber($contact->fax,
"TYPE=WORK;FAX");
69 $country = $contact->country_code ? $contact->country :
'';
71 $v->setAddress(
"",
"", $contact->address, $contact->town, $contact->state, $contact->zip, $country,
"TYPE=WORK;POSTAL");
72 $v->setLabel(
"",
"", $contact->address, $contact->town, $contact->state, $contact->zip, $country,
"TYPE=WORK");
74 $v->setEmail($contact->email);
75 $v->setNote($contact->note);
76 $v->setTitle($contact->poste);
81 $v->setURL($company->url,
"TYPE=WORK");
82 if (!$contact->phone_pro) $v->setPhoneNumber($company->phone,
"TYPE=WORK;VOICE");
83 if (!$contact->fax) $v->setPhoneNumber($company->fax,
"TYPE=WORK;FAX");
84 if (!$contact->zip) $v->setAddress(
"",
"", $company->address, $company->town, $company->state, $company->zip, $company->country,
"TYPE=WORK;POSTAL");
87 if (empty(trim($company->email)))
92 elseif (empty(trim($contact->email)))
94 $v->setEmail($company->email);
97 elseif (strtolower(end(explode(
"@", $contact->email))) == strtolower(end(explode(
"@", $company->email))))
99 $v->setEmail($contact->email);
102 $v->setEmail($company->email,
'INTERNET');
106 $v->setEmail($company->email);
109 $v->setEmail($contact->email,
'INTERNET');
113 if ($contact->typent_code !=
'TE_PRIVATE') $v->setOrg($company->name);
117 $v->setPhoneNumber($contact->phone_perso,
"TYPE=HOME;VOICE");
118 if ($contact->birthday) $v->setBirthday($contact->birthday);
125 $output = $v->getVCard();
127 $filename = trim(urldecode($v->getFileName()));
132 header(
"Content-Disposition: attachment; filename=\"".$filename.
"\"");
133 header(
"Content-Length: ".
dol_strlen($output));
134 header(
"Connection: close");
135 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...