From: Olivier Le Floch Date: Sat, 31 Jan 2009 12:46:15 +0000 (+0100) Subject: Fix vcard for users that don't have a pro address. X-Git-Tag: xorg/0.10.1~146 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=a86b97674a4f4a79cedf91c813676b38ce9c47e1;p=platal.git Fix vcard for users that don't have a pro address. Signed-off-by: Olivier Le Floch --- diff --git a/include/vcard.inc.php b/include/vcard.inc.php index a755fcd..dfdadaa 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']); + } } }