phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [19098] fix sorting of infolog entries and reenable l


From: Dave Hall
Subject: [Phpgroupware-cvs] [19098] fix sorting of infolog entries and reenable linking to companies - merging r19096 :19097 from branch
Date: Mon, 09 Mar 2009 11:57:41 +0000

Revision: 19098
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19098
Author:   skwashd
Date:     2009-03-09 11:57:41 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
fix sorting of infolog entries and reenable linking to companies - merging 
r19096:19097 from branch

Modified Paths:
--------------
    tags/Version-0_9_16-014-proposed/infolog/inc/class.bolink.inc.php
    tags/Version-0_9_16-014-proposed/infolog/inc/class.soinfolog.inc.php

Modified: tags/Version-0_9_16-014-proposed/infolog/inc/class.bolink.inc.php
===================================================================
--- tags/Version-0_9_16-014-proposed/infolog/inc/class.bolink.inc.php   
2009-03-09 11:42:30 UTC (rev 19097)
+++ tags/Version-0_9_16-014-proposed/infolog/inc/class.bolink.inc.php   
2009-03-09 11:57:41 UTC (rev 19098)
@@ -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;
                }
 

Modified: tags/Version-0_9_16-014-proposed/infolog/inc/class.soinfolog.inc.php
===================================================================
--- tags/Version-0_9_16-014-proposed/infolog/inc/class.soinfolog.inc.php        
2009-03-09 11:42:30 UTC (rev 19097)
+++ tags/Version-0_9_16-014-proposed/infolog/inc/class.soinfolog.inc.php        
2009-03-09 11:57:41 UTC (rev 19098)
@@ -477,7 +477,7 @@
                        }
                        else
                        {
-                         $ordermethod = 'ORDER BY info_datemodified DESC';   
// newest first
+                         $ordermethod = 'ORDER BY info_datemodified, info_id 
DESC';   // newest first
                        }
                        $filtermethod = $this->aclFilter($filter);
                        $filtermethod .= $this->statusFilter($filter);





reply via email to

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