phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [19106] Fix the prepare_read_holidays with the fact t


From: Caeies
Subject: [Phpgroupware-cvs] [19106] Fix the prepare_read_holidays with the fact that the is / contact_id and not account_id
Date: Wed, 11 Mar 2009 16:06:56 +0000

Revision: 19106
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19106
Author:   Caeies
Date:     2009-03-11 16:06:55 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
Fix the prepare_read_holidays with the fact that the  is /contact_id and not 
account_id

Modified Paths:
--------------
    core/trunk/calendar/inc/class.boholiday.inc.php

Modified: core/trunk/calendar/inc/class.boholiday.inc.php
===================================================================
--- core/trunk/calendar/inc/class.boholiday.inc.php     2009-03-11 16:05:22 UTC 
(rev 19105)
+++ core/trunk/calendar/inc/class.boholiday.inc.php     2009-03-11 16:06:55 UTC 
(rev 19106)
@@ -189,7 +189,8 @@
                public function prepare_read_holidays($year=0,$owner=0)
                {
                        $this->year = (isset($year) && $year > 
0?$year:$GLOBALS['phpgw']->common->show_date(time() - 
phpgwapi_datetime::user_timezone(), 'Y'));
-                       $this->owner = 
($owner?$owner:$GLOBALS['phpgw_info']['user']['account_id']);
+                       $oCurrentUserContact =  
$GLOBALS['phpgw']->contacts->is_contact($GLOBALS['phpgw_info']['user']['account_id']);
+                       $this->owner = ($owner?$owner:$oCurrentUserContact);
 
                        if($this->debug)
                        {
@@ -209,19 +210,23 @@
                                $this->locales[] = 'US';
                        }
                        
-                       if($this->owner != 
$GLOBALS['phpgw_info']['user']['account_id'])
+                       if($this->owner != $oCurrentUserContact)
                        {
-                               $owner_pref = 
CreateObject('phpgwapi.preferences',$owner);
-                               $owner_prefs = $owner_pref->read();
-                               if(@$owner_prefs['common']['country'])
+                               $id_user = 
$GLOBALS['phpgw']->contacts->is_user($this->owner);
+                               if($id_user)
                                {
-                                       $this->locales[] = 
$owner_prefs['common']['country'];
+                                       $owner_pref = 
CreateObject('phpgwapi.preferences',$id_user);
+                                       $owner_prefs = $owner_pref->read();
+                                       if(@$owner_prefs['common']['country'])
+                                       {
+                                               $this->locales[] = 
$owner_prefs['common']['country'];
+                                       }
+                                       
elseif(@$owner_prefs['calendar']['locale'])
+                                       {
+                                               $this->locales[] = 
$owner_prefs['calendar']['locale'];
+                                       }
+                                       unset($owner_pref);
                                }
-                               elseif(@$owner_prefs['calendar']['locale'])
-                               {
-                                       $this->locales[] = 
$owner_prefs['calendar']['locale'];
-                               }
-                               unset($owner_pref);
                        }
 
                        if ( 
isset($GLOBALS['phpgw_info']['server']['auto_load_holidays'])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]