28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/vcard.class.php';
33 $adherent =
new adherent($db);
39 $result =
restrictedArea($user,
'adherent', $id,
'',
'',
'socid',
'rowid', $objcanvas);
42 $result = $adherent->fetch($id);
51 if ($adherent->socid) {
52 $result = $company->fetch($adherent->socid);
57 $v->setProdId(
'Dolibarr '.DOL_VERSION);
59 $v->setUid(
'DOLIBARR-ADHERENTID-'.$adherent->id);
60 $v->setName($adherent->lastname, $adherent->firstname,
"", $adherent->civility,
"");
61 $v->setFormattedName($adherent->getFullName($langs, 1));
63 $v->setPhoneNumber($adherent->phone_pro,
"TYPE=WORK;VOICE");
65 $v->setPhoneNumber($adherent->phone_mobile,
"TYPE=CELL;VOICE");
66 $v->setPhoneNumber($adherent->fax,
"TYPE=WORK;FAX");
68 $country = $adherent->country_code ? $adherent->country :
'';
70 $v->setAddress(
"",
"", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country,
"TYPE=WORK;POSTAL");
71 $v->setLabel(
"",
"", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country,
"TYPE=WORK");
73 $v->setEmail($adherent->email);
74 $v->setNote($adherent->note_public);
75 $v->setTitle($adherent->poste);
79 $v->setURL($company->url,
"TYPE=WORK");
80 if (!$adherent->phone_pro) {
81 $v->setPhoneNumber($company->phone,
"TYPE=WORK;VOICE");
83 if (!$adherent->fax) {
84 $v->setPhoneNumber($company->fax,
"TYPE=WORK;FAX");
86 if (!$adherent->zip) {
87 $v->setAddress(
"",
"", $company->address, $company->town, $company->state, $company->zip, $company->country,
"TYPE=WORK;POSTAL");
90 if (empty(trim($company->email))) {
92 } elseif (empty(trim($adherent->email))) {
94 $v->setEmail($company->email);
95 } elseif (strtolower(end(explode(
"@", $adherent->email))) == strtolower(end(explode(
"@", $company->email)))) {
97 $v->setEmail($adherent->email);
100 $v->setEmail($company->email,
'INTERNET');
103 $v->setEmail($company->email);
106 $v->setEmail($adherent->email,
'INTERNET');
110 if ($company->typent_code !=
'TE_PRIVATE') {
111 $v->setOrg($company->name);
116 $v->setPhoneNumber($adherent->phone_perso,
"TYPE=HOME;VOICE");
117 if ($adherent->birth) {
118 $v->setBirthday($adherent->birth);
126 $output = $v->getVCard();
128 $filename = trim(urldecode($v->getFileName()));
133 header(
"Content-Disposition: attachment; filename=\"".$filename.
"\"");
134 header(
"Content-Length: ".
dol_strlen($output));
135 header(
"Connection: close");
136 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...