phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] email addressbook.php,1.38.2.2,1.38.2.3


From: Jonathan Rivera <address@hidden>
Subject: [Phpgroupware-cvs] email addressbook.php,1.38.2.2,1.38.2.3
Date: Fri, 17 Oct 2003 05:21:15 +0000

Update of /cvsroot/phpgroupware/email
In directory subversions:/tmp/cvs-serv23688/email

Modified Files:
      Tag: Version-0_9_16-branch
        addressbook.php 
Log Message:
bugfix 5271


Index: addressbook.php
===================================================================
RCS file: /cvsroot/phpgroupware/email/addressbook.php,v
retrieving revision 1.38.2.2
retrieving revision 1.38.2.3
diff -C2 -d -r1.38.2.2 -r1.38.2.3
*** addressbook.php     1 Jun 2003 23:23:05 -0000       1.38.2.2
--- addressbook.php     17 Oct 2003 05:21:12 -0000      1.38.2.3
***************
*** 45,97 ****
        $GLOBALS['phpgw']->template->set_var('lang_select_cats',lang('Select 
category'));
  
!       if (! $start)
        {
!               $start = 0;
        }
  
!       if (!$filter)
        {
!               $filter = 'none';
        }
  
!       if (!$cat_id)
        {
!               if ($filter == 'none')
!               {
!                       $qfilter  = 'tid=n';
!               }
!               elseif ($filter == 'private')
!               {
!                       $qfilter  = 
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'];
!               }
!               else
!               {
!                       $qfilter = 'tid=n,owner='.$filter;
!               }
        }
        else
        {
!               if ($filter == 'none')
!               {
!                       $qfilter  = 'tid=n,cat_id='.$cat_id;
!               }
!               elseif ($filter == 'private')
!               {
!                       $qfilter  = 
'tid=n,owner='.$GLOBALS['phpgw_info']['user']['account_id'].',cat_id='.$cat_id; 
!               }
!               else
!               {
!                       $qfilter = 'tid=n,owner='.$filter.'cat_id='.$cat_id;
!               }
        }
! 
!       if 
(($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
!       ($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 
0))
        {
!               $offset = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
        }
        else
        {
!               $offset = 15;
        }
  
--- 45,95 ----
        $GLOBALS['phpgw']->template->set_var('lang_select_cats',lang('Select 
category'));
  
!       $cat_id = get_var('cat_id',array('get','post'));
!       $filter = get_var('filter',array('get','post'));
!       $start = get_var('start',array('get','post'));
!       $limit = get_var('limit',array('get','post'));
!       $query = get_var('query',array('get','post'));
!       $sort = get_var('sort',array('get','post'));
!       $order = get_var('order',array('get','post'));
!       
!       if(!$cat_id)
!       {               
!               $cat_id = $prefs['default_category'];
!       }
!                       
!       switch ($filter)
        {
!       case 'user_only':
!               $access = PHPGW_CONTACTS_MINE;
!               break;
!       case 'private':
!               $access = PHPGW_CONTACTS_PRIVATE;
!               break;
!       default:
!               $access = PHPGW_CONTACTS_ALL;
        }
  
!       if(!$start)
        {
!               $start = 0;
        }
  
!       if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
&&
!          $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] 
> 0)
        {
!               $limit = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
        }
        else
        {
!               $limit = 15;
        }
!                       
!       if($cat_id && $cat_id!=-1)
        {
!               $category_filter = $cat_id;
        }
        else
        {
!               $category_filter = PHPGW_CONTACTS_CATEGORIES_ALL;
        }
  
***************
*** 99,131 ****
  
        $cols = array (
!               'n_given'    => 'n_given',
!               'n_family'   => 'n_family',
                'org_name'   => 'org_name',
-               'email'      => 'email',
-               'email_home' => 'email_home'
        );
  
!       $entries = $d->read($start,$offset,$cols,$query,$qfilter,$sort,$order);
  
        //------------------------------------------- nextmatch 
--------------------------------------------
!       $left = 
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
!       $right = 
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$d->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query");
        $GLOBALS['phpgw']->template->set_var('left',$left);
        $GLOBALS['phpgw']->template->set_var('right',$right);
  
!       if ($d->total_records > 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])
!       {
!               
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing %1 - %2 of 
%3',($start + 1),($start + 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']),$d->total_records));
!       }
!       else
!       {
!               
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing 
%1',$d->total_records));
!       }
        // --------------------------------------- end nextmatch 
------------------------------------------
  
        // ------------------- list header variable template-declaration 
-----------------------
        
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!       
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_given',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
!       
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'n_family',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
        
$GLOBALS['phpgw']->template->set_var('sort_company',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'org_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Company')));
        $GLOBALS['phpgw']->template->set_var('lang_email',lang('Select work 
email address'));
--- 97,140 ----
  
        $cols = array (
!               'contact_id' => 'contact_id',
!               'per_first_name'    => 'per_first_name',
!               'per_last_name'   => 'per_last_name',
                'org_name'   => 'org_name',
        );
  
! 
!       //$entries = 
$d->read($start,$offset,$cols,$query,$qfilter,$sort,$order);
!       $criteria = $d->criteria_for_index($account_id, $access, 
$category_filter, $cols, $query);
!       $total_all_persons = $d->get_count_persons($criteria);
!       $entries = $d->get_persons($cols, $limit, $start, $order, $sort, '', 
$criteria);
! 
!       if(is_array($entries))
!       {
!               foreach ($entries as $id)
!               {
!                       $contacts[] = $id['contact_id'];
!               }
!               $entries_comm = $d->get_comm_contact_data($contacts, 
array('work email', 'home email'));
!       }
  
        //------------------------------------------- nextmatch 
--------------------------------------------
!       $left = 
$GLOBALS['phpgw']->nextmatchs->left('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$total_all_persons,"&order=$order&filter=$filter&sort=$sort&query=$query");
!       $right = 
$GLOBALS['phpgw']->nextmatchs->right('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',$start,$total_all_persons,"&order=$order&filter=$filter&sort=$sort&query=$query");
        $GLOBALS['phpgw']->template->set_var('left',$left);
        $GLOBALS['phpgw']->template->set_var('right',$right);
  
!       //$lang_showing = 
$GLOBALS['phpgw']->nextmatchs->show_hits($total_records,$this->start);
!       $lang_showing = lang('%1 - %2 of %3 ', 
!                            ($d->total_records!=0)?$start+1:$start, 
!                            $start+$d->total_records,$total_all_persons);
!       $GLOBALS['phpgw']->template->set_var('lang_showing', $lang_showing);
! 
! 
        // --------------------------------------- end nextmatch 
------------------------------------------
  
        // ------------------- list header variable template-declaration 
-----------------------
        
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
!       
$GLOBALS['phpgw']->template->set_var('sort_firstname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'per_first_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Firstname')));
!       
$GLOBALS['phpgw']->template->set_var('sort_lastname',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'per_last_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Lastname')));
        
$GLOBALS['phpgw']->template->set_var('sort_company',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'org_name',$order,'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/addressbook.php',lang('Company')));
        $GLOBALS['phpgw']->template->set_var('lang_email',lang('Select work 
email address'));
***************
*** 143,152 ****
                $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
!               $firstname = $entries[$i]['n_given'];
                if (!$firstname)
                {
                        $firstname = '&nbsp;';
                }
!               $lastname = $entries[$i]['n_family'];
                if (!$lastname)
                {
--- 152,161 ----
                $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
                $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
!               $firstname = $entries[$i]['per_first_name'];
                if (!$firstname)
                {
                        $firstname = '&nbsp;';
                }
!               $lastname = $entries[$i]['per_last_name'];
                if (!$lastname)
                {
***************
*** 177,207 ****
                $personal_part = $personal_firstname.$personal_lastname;
                
                if (($personal_part == '') ||
                        ($include_personal == False))
                {
!                       $id     = $entries[$i]['id'];
!                       $email  = $entries[$i]['email'];
!                       $hemail = $entries[$i]['email_home'];
                }
                else
                {
!                       $id = $entries[$i]['id'];
!                       if ((isset($entries[$i]['email'])) &&
!                               (trim($entries[$i]['email']) != ''))
                        {
!                               $email  = '&quot;'.$personal_part.'&quot; 
&lt;'.$entries[$i]['email'].'&gt;';
                        }
                        else
                        {
!                               $email  = $entries[$i]['email'];
                        }
!                       if ((isset($entries[$i]['email_home'])) &&
!                       (trim($entries[$i]['email_home']) != ''))
                        {
!                               $hemail = '&quot;'.$personal_part.'&quot; 
&lt;'.$entries[$i]['email_home'].'&gt;';
                        }
                        else
                        {
!                               $hemail = $entries[$i]['email_home'];
                        }
                }
--- 186,218 ----
                $personal_part = $personal_firstname.$personal_lastname;
                
+               $tmp_email  = get_comm_value($entries[$i]['contact_id'], 'work 
email', $entries_comm);
+               $tmp_hemail = get_comm_value($entries[$i]['contact_id'], 'home 
email', $entries_comm);
                if (($personal_part == '') ||
                        ($include_personal == False))
                {
!                       $id     = $entries[$i]['contact_id'];
!                       $email  = $tmp_email;
!                       $hemail = $tmp_hemail;
                }
                else
                {
!                       $id = $entries[$i]['contact_id'];
!                       if ((isset($tmp_email)) &&
!                               (trim($tmp_email) != ''))
                        {
!                               $email  = '&quot;'.$personal_part.'&quot; 
&lt;'.$tmp_email.'&gt;';
                        }
                        else
                        {
!                               $email  = $tmp_email;
                        }
!                       if ((isset($tmp_hemail)) &&
!                       (trim($tmp_hemail) != ''))
                        {
!                               $hemail = '&quot;'.$personal_part.'&quot; 
&lt;'.$tmp_hemail.'&gt;';
                        }
                        else
                        {
!                               $hemail = $tmp_hemail;
                        }
                }
***************
*** 227,229 ****
--- 238,256 ----
  
        $GLOBALS['phpgw']->common->phpgw_exit();
+ 
+       function get_comm_value($contact_id, $column, $entries_comm)
+       {
+               if(!is_array($entries_comm))
+               {
+                       $entries_comm=array();
+               }
+       
+               foreach($entries_comm as $comms)
+               {
+                       if($contact_id == $comms['comm_contact_id'] && $column 
== $comms['comm_description'])
+                       {       
+                               return $comms['comm_data'];
+                       }       
+               }
+       }
  ?>





reply via email to

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