phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [19097] make it so orgs can be linked to infolog entr


From: Dave Hall
Subject: [Phpgroupware-cvs] [19097] make it so orgs can be linked to infolog entries again
Date: Mon, 09 Mar 2009 11:42:30 +0000

Revision: 19097
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19097
Author:   skwashd
Date:     2009-03-09 11:42:30 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
make it so orgs can be linked to infolog entries again

Modified Paths:
--------------
    branches/Version-0_9_16-branch/infolog/inc/class.bolink.inc.php

Modified: branches/Version-0_9_16-branch/infolog/inc/class.bolink.inc.php
===================================================================
--- branches/Version-0_9_16-branch/infolog/inc/class.bolink.inc.php     
2009-03-09 11:41:34 UTC (rev 19096)
+++ branches/Version-0_9_16-branch/infolog/inc/class.bolink.inc.php     
2009-03-09 11:42:30 UTC (rev 19097)
@@ -895,23 +895,36 @@
 //                     {
 //                             //return False;
 //                     }
-                       $name = $addr['per_last_name'];
-                       if ($addr['per_first_name'])
+
+                       $name = '';
+                       if ( isset($addr['per_prefix']) )
                        {
-                               $name .= ', '.$addr['per_first_name'];
+                               $name .= $addr['per_prefix'] . ' ';
                        }
-                       else
+
+                       if ( isset($addr['per_first_name']) )
                        {
-                               if ($addr['per_prefix'])
+                               $name .= $addr['per_first_name'];
+                       }
+
+                       if ( isset($addr['per_last_name']) )
+                       {
+                         $name .= ' ' . $addr['per_last_name'];
+                       }
+
+                       if ( isset($addr['org_name']) )
+                       {
+                               if ( $name ) 
                                {
-                                       $name .= ', '.$addr['per_prefix'];
+                                       $name .= " ({$addr['org_name']})";
                                }
+                               else
+                               {
+                                       $name = $addr['org_name'];
+                               }
                        }
-                       if ($addr['org_name'])
-                       {
-                               $name = $addr['org_name'].($name !== '' ? ': 
'.$name : '');
-                       }
-                       return stripslashes($name);             // addressbook 
returns quotes with slashes
+
+                       return stripslashes($name);          // addressbook 
returns quotes with slashes
                }
 
                /*!
@@ -926,20 +939,35 @@
                        {
                                $this->contacts = 
createobject('phpgwapi.contacts');
                        }
-                       $columns_to_display = array('contact_id', 
'per_first_name', 'per_last_name', 'per_prefix', 'org_name');
+
                        $me = $GLOBALS['phpgw_info']['user']['account_id'];
 
-                       //$addrs = $this->contacts->get_people_by_owner($me, 
$columns_to_display);
+                       $content = array();
+
+                       // Orgs first
+                       $columns_to_display = array('contact_id', 'org_name');
                        $criteria = $this->contacts->criteria_for_index(
-                               $me, PHPGW_CONTACTS_ALL, 
-                               PHPGW_CONTACTS_CATEGORIES_ALL, 
+                               $me, PHPGW_CONTACTS_ALL,
+                               PHPGW_CONTACTS_CATEGORIES_ALL,
                                $columns_to_display, $pattern, 
$columns_to_display);
-                       $addrs = 
$this->contacts->get_persons($columns_to_display, '','','','','',$criteria);    
               
-                       $content = array( );
-                       while ($addrs && list( $key,$addr ) = each( $addrs ))
+                       $addrs = $this->contacts->get_orgs($columns_to_display, 
'', '', 'org_name', 'ASC', '', $criteria);
+                       foreach ( $addrs as $key => $addr )
                        {
-                               $content[$addrs[$key]['contact_id']] = 
$this->addressbook_title( $addr );
+                               $content[$addr['contact_id']] = 
$this->addressbook_title( $addr );
                        }
+
+                       // Now add the persons
+                       $columns_to_display = array('contact_id', 
'per_first_name', 'per_last_name', 'per_prefix', 'org_name');
+                       $criteria = $this->contacts->criteria_for_index(
+                               $me, PHPGW_CONTACTS_ALL,
+                               PHPGW_CONTACTS_CATEGORIES_ALL,
+                               $columns_to_display, $pattern, 
$columns_to_display);
+                       $addrs = 
$this->contacts->get_persons($columns_to_display, '', '', 'per_last_name', 
'ASC', '', $criteria);
+                       foreach ( $addrs as $addr )
+                       {
+                               $content[$addr['contact_id']] = 
$this->addressbook_title($addr);
+                       }
+
                        return $content;
                }
 





reply via email to

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