require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/vcard.class.php'; $id = GETPOST('id', 'int'); // Security check $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $contact = new Contact($db); $result = $contact->fetch($id); $physicalperson = 1; $company = new Societe($db); if ($contact->socid) { $result = $company->fetch($contact->socid); //print "ee"; } // We create VCard $v = new vCard(); $v->setProdId('Dolibarr ' . DOL_VERSION); $v->setUid('DOLIBARR-CONTACTID-' . $contact->id); $v->setName($contact->lastname, $contact->firstname, "", "", ""); $v->setFormattedName($contact->getFullName($langs)); // By default, all informations are for work (except phone_perso and phone_mobile) $v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE"); $v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE"); $v->setPhoneNumber($contact->fax, "WORK;FAX"); $v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, $contact->country_code ? $contact->country_id : '', "WORK;POSTAL"); $v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, $contact->country_code ? $contact->country_id : '', "WORK"); $v->setEmail($contact->email, 'internet,pref'); $v->setNote($contact->note); $v->setTitle($contact->poste); // Data from linked company if ($company->id) { $v->setURL($company->url, "WORK");