Gere plus d'info sur la vcard
This commit is contained in:
parent
7c1f8e2fb7
commit
130d20408c
@ -47,7 +47,9 @@ if ($contact->socid)
|
||||
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
|
||||
$v->setName($contact->name, $contact->firstname, "", "", "");
|
||||
$v->setFormattedName($contact->fullname);
|
||||
|
||||
@ -56,10 +58,12 @@ $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->ville, "", $contact->cp, $contact->pays, "WORK;POSTAL");
|
||||
$v->setEmail($contact->email);
|
||||
$v->setAddress("", "", $contact->address, $contact->ville, "", $contact->cp, ($contact->pays_code?$contact->pays:''), "WORK;POSTAL");
|
||||
$v->setEmail($contact->email,'internet,pref');
|
||||
$v->setNote($contact->note);
|
||||
|
||||
$v->setTitle($contact->poste);
|
||||
|
||||
// Data from linked company
|
||||
if ($company->id)
|
||||
{
|
||||
@ -67,6 +71,9 @@ if ($company->id)
|
||||
if (! $contact->phone_pro) $v->setPhoneNumber($company->tel, "WORK;VOICE");
|
||||
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
|
||||
if (! $contact->cp) $v->setAddress("", "", $company->adresse, $company->ville, "", $company->cp, $company->pays_code, "WORK;POSTAL");
|
||||
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
|
||||
// Si contact lié à un tiers non de type "particulier"
|
||||
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom);
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
|
||||
php vCard class v2.0
|
||||
php vCard class
|
||||
(c) Kai Blankenhorn
|
||||
www.bitfolge.de/en
|
||||
kaib@bitfolge.de
|
||||
@ -21,6 +21,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
***************************************************************************
|
||||
2007 v3.0 Laurent Destailleur eldy@users.sourceforge.net
|
||||
Added functions (as in http://www.ietf.org/rfc/rfc2426.txt):
|
||||
setTitle setOrg setProdId setUID
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
@ -198,8 +202,8 @@ class vCard {
|
||||
\param address
|
||||
*/
|
||||
|
||||
function setEmail($address) {
|
||||
$this->properties["EMAIL;INTERNET"] = $address;
|
||||
function setEmail($address,$type="internet,pref") {
|
||||
$this->properties["EMAIL;TYPE=".$type] = $address;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,12 +215,47 @@ class vCard {
|
||||
$this->properties["NOTE;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($note);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief mise en forme de l'url
|
||||
\param url
|
||||
\param type
|
||||
*/
|
||||
/**
|
||||
\brief mise en forme de la fonction
|
||||
\param title
|
||||
*/
|
||||
function setTitle($title) {
|
||||
$this->properties["TITLE;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief mise en forme de la societe
|
||||
\param org
|
||||
*/
|
||||
function setOrg($org) {
|
||||
$this->properties["ORG;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($org);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief mise en forme du logiciel generateur
|
||||
\param prodid
|
||||
*/
|
||||
function setProdId($prodid) {
|
||||
$this->properties["PRODID;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($prodid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief mise en forme du logiciel generateur
|
||||
\param uid
|
||||
*/
|
||||
function setUID($uid) {
|
||||
$this->properties["UID;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($uid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief mise en forme de l'url
|
||||
\param url
|
||||
\param type
|
||||
*/
|
||||
function setURL($url, $type="") {
|
||||
// $type may be WORK | HOME
|
||||
$key = "URL";
|
||||
@ -230,7 +269,7 @@ class vCard {
|
||||
|
||||
function getVCard() {
|
||||
$text = "BEGIN:VCARD\r\n";
|
||||
$text.= "VERSION:2.1\r\n";
|
||||
$text.= "VERSION:3.0\r\n";
|
||||
foreach($this->properties as $key => $value) {
|
||||
$text.= "$key:$value\r\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user