From 96d5db7deabb190a355d35e7bbd78aa62e23ee30 Mon Sep 17 00:00:00 2001 From: Olivier Le Floch Date: Sat, 31 Jan 2009 13:46:15 +0100 Subject: [PATCH] Fix vcard for users that don't have a pro address. Signed-off-by: Olivier Le Floch --- include/vcard.inc.php | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/include/vcard.inc.php b/include/vcard.inc.php index b62d09f..22bfcac 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -111,24 +111,26 @@ class VCard extends PlVCard } // Pro - foreach ($user['adr_pro'] as $pro) { - $street = array($adr['adr1']); - if (!empty($pro['adr2'])) { - $street[] = $pro['adr2']; - } - if (!empty($pro['adr3'])) { - $street[] = $pro['adr3']; - } - $group = $entry->addWork($pro['entreprise'], null, $pro['poste'], $pro['fonction'], - $street, null, null, $pro['postcode'], $pro['city'], $pro['region'], @$pro['country']); - if (!empty($pro['tel'])) { - $entry->addTel($group, $pro['tel']); - } - if (!empty($pro['fax'])) { - $entry->addTel($group, $pro['fax'], true); - } - if (!empty($pro['email'])) { - $entry->addMail($group, $pro['email']); + if (!empty($user['adr_pro'])) { + foreach ($user['adr_pro'] as $pro) { + $street = array($adr['adr1']); + if (!empty($pro['adr2'])) { + $street[] = $pro['adr2']; + } + if (!empty($pro['adr3'])) { + $street[] = $pro['adr3']; + } + $group = $entry->addWork($pro['entreprise'], null, $pro['poste'], $pro['fonction'], + $street, null, null, $pro['postcode'], $pro['city'], $pro['region'], @$pro['country']); + if (!empty($pro['tel'])) { + $entry->addTel($group, $pro['tel']); + } + if (!empty($pro['fax'])) { + $entry->addTel($group, $pro['fax'], true); + } + if (!empty($pro['email'])) { + $entry->addMail($group, $pro['email']); + } } } -- 2.1.4