From 4e1e978b89adf49eaeb152688525d027ac1e4c57 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 13 May 2012 23:25:51 +0200 Subject: [PATCH] Contacts: Forgot one file for the import fix. --- apps/contacts/lib/app.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index 330d5b21b7..29428763d6 100755 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -12,8 +12,15 @@ OC_Contacts_App::$l10n = OC_L10N::get('contacts'); OC_Contacts_App::$categories = new OC_VCategories('contacts'); class OC_Contacts_App { + /* + * @brief language object for calendar app + */ + public static $l10n; - public static $categories; + /* + * @brief categories of the user + */ + public static $categories = null; public static function getAddressbook($id) { $addressbook = OC_Contacts_Addressbook::find( $id ); @@ -130,6 +137,21 @@ class OC_Contacts_App { } } + /* + * @brief returns the vcategories object of the user + * @return (object) $vcategories + */ + protected static function getVCategories() { + if (is_null(self::$categories)) { + self::$categories = new OC_VCategories('contacts'); + } + return self::$categories; + } + + /* + * @brief returns the categories for the user + * @return (Array) $categories + */ public static function getCategories() { $categories = self::$categories->categories(); if(count($categories) == 0) { @@ -169,7 +191,7 @@ class OC_Contacts_App { * @see OC_VCategories::loadFromVObject */ public static function loadCategoriesFromVCard(OC_VObject $contact) { - self::$categories->loadFromVObject($contact, true); + self::getVCategories()->loadFromVObject($contact, true); } public static function setLastModifiedHeader($contact) {