fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15494] more on responsibility


From: sigurdne
Subject: [Fmsystem-commits] [15494] more on responsibility
Date: Fri, 19 Aug 2016 13:04:03 +0000 (UTC)

Revision: 15494
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15494
Author:   sigurdne
Date:     2016-08-19 13:04:03 +0000 (Fri, 19 Aug 2016)
Log Message:
-----------
more on responsibility

Modified Paths:
--------------
    trunk/property/inc/class.bolocation.inc.php
    trunk/property/inc/class.uilocation.inc.php

Modified: trunk/property/inc/class.bolocation.inc.php
===================================================================
--- trunk/property/inc/class.bolocation.inc.php 2016-08-19 11:45:55 UTC (rev 
15493)
+++ trunk/property/inc/class.bolocation.inc.php 2016-08-19 13:04:03 UTC (rev 
15494)
@@ -756,6 +756,8 @@
 
                function get_responsible( $data = array() )
                {
+                       static $names = array();
+
                        $soresponsible = CreateObject('property.soresponsible');
                        $contacts = createObject('phpgwapi.contacts');
 
@@ -772,8 +774,29 @@
                        {
                                $responsible_item = 
$soresponsible->get_active_responsible_at_location($location['location_code'], 
$data['role_id']);
                                $location['responsible_item'] = 
$responsible_item['id'];
-                               $location['responsible_contact'] = 
$contacts->get_name_of_person_id($responsible_item['contact_id']);
-                               $location['responsible_contact_id'] = 
$responsible_item['contact_id'];
+                               if(isset($responsible_item['contact_id']))
+                               {
+                                       
if(isset($names[$responsible_item['contact_id']]))
+                                       {
+                                               
$location['responsible_contact'] = $names[$responsible_item['contact_id']];
+                                       }
+                                       else
+                                       {
+                                               if(     $account_id = 
$GLOBALS['phpgw']->accounts->search_person($responsible_item['contact_id']))
+                                               {
+                                                       
$location['responsible_contact'] = 
$GLOBALS['phpgw']->accounts->get($account_id)->__toString();
+                                               }
+                                               else
+                                               {
+                                                       
$location['responsible_contact'] = 
$contacts->get_name_of_person_id($responsible_item['contact_id']);
+                                               }
+                                               
$names[$responsible_item['contact_id']] = $location['responsible_contact'];
+                                       }
+
+                                       $location['responsible_contact_id'] = 
$responsible_item['contact_id'];
+
+                               }
+
                        }
 
                        //_debug_array($locations);

Modified: trunk/property/inc/class.uilocation.inc.php
===================================================================
--- trunk/property/inc/class.uilocation.inc.php 2016-08-19 11:45:55 UTC (rev 
15493)
+++ trunk/property/inc/class.uilocation.inc.php 2016-08-19 13:04:03 UTC (rev 
15494)
@@ -584,11 +584,11 @@
                                        $_accounts = 
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 
'account_lastname', '', -1);
                                        break;
                                case 'groups':
-                                       $_accounts = 
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_lastname', 
'', -1);
+                                       $_accounts = 
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_firstname', 
'', -1);
                                        break;
                                default:
                                        $_accounts = array_merge(
-                                               
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_lastname', 
'', -1),
+                                               
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_firstname', 
'', -1),
                                                
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 
'account_lastname', '', -1)
                                        );
                                        break;




reply via email to

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