phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] addressbook/inc class.uicatalog_contact_note_type.inc


From: Jonathan Rivera <address@hidden>
Subject: [Phpgroupware-cvs] addressbook/inc class.uicatalog_contact_note_type.inc.php, 1.1.2.1, 1.1.2.2 class.uicatalog_contact_comm_type.inc.php, 1.1.2.1, 1.1.2.2 class.uicatalog_contact_comm_descr.inc.php, 1.1.2.1, 1.1.2.2 class.uicatalog_contact_addr_type.inc.php, 1.1.2.1, 1.1.2.2 class.uiaddressbook.inc.php, 1.36.2.15.2.20, 1.36.2.15.2.21 class.soaddressbook.inc.php, 1.14.2.3.2.10, 1.14.2.3.2.11
Date: Thu, 02 Oct 2003 23:08:49 +0000

Update of /cvsroot/phpgroupware/addressbook/inc
In directory subversions:/tmp/cvs-serv3103/addressbook/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.uicatalog_contact_note_type.inc.php 
        class.uicatalog_contact_comm_type.inc.php 
        class.uicatalog_contact_comm_descr.inc.php 
        class.uicatalog_contact_addr_type.inc.php 
        class.uiaddressbook.inc.php class.soaddressbook.inc.php 
Log Message:
Bugfix #5655, 5656, 5658, 5659


Index: class.uicatalog_contact_note_type.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/addressbook/inc/Attic/class.uicatalog_contact_note_type.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** class.uicatalog_contact_note_type.inc.php   30 Sep 2003 15:08:38 -0000      
1.1.2.1
--- class.uicatalog_contact_note_type.inc.php   2 Oct 2003 23:08:46 -0000       
1.1.2.2
***************
*** 5,8 ****
--- 5,9 ----
        {
                var $public_functions = array('view' => True);
+               var $modify = False;
  
                function uicatalog_contact_note_type()
***************
*** 46,49 ****
--- 47,55 ----
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
+                       if($this->modify)
+                       {
+                               $contacts = CreateObject('phpgwapi.contacts');
+                               $contacts->delete_sessiondata('note_type');
+                       }
                }
  
***************
*** 56,59 ****
--- 62,66 ----
                {
                        $this->bo->insert($fields);
+                       $this->modify = True;
                }
                
***************
*** 61,64 ****
--- 68,72 ----
                {
                        $this->bo->delete($key);
+                       $this->modify = True;
                }
                
***************
*** 66,69 ****
--- 74,78 ----
                {
                        $this->bo->update($key, $fields);
+                       $this->modify = True;
                }
  

Index: class.uicatalog_contact_comm_descr.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/addressbook/inc/Attic/class.uicatalog_contact_comm_descr.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** class.uicatalog_contact_comm_descr.inc.php  30 Sep 2003 15:08:38 -0000      
1.1.2.1
--- class.uicatalog_contact_comm_descr.inc.php  2 Oct 2003 23:08:46 -0000       
1.1.2.2
***************
*** 5,8 ****
--- 5,9 ----
        {
                var $public_functions = array('view' => True);
+               var $modify = False;
  
                function uicatalog_contact_comm_descr()
***************
*** 52,55 ****
--- 53,61 ----
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
+                       if($this->modify)
+                       {
+                               $contacts = CreateObject('phpgwapi.contacts');
+                               $contacts->delete_sessiondata('comm_descr');
+                       }
                }
  
***************
*** 62,65 ****
--- 68,72 ----
                {
                        $this->bo->insert($fields);
+                       $this->modify = True;
                }
                
***************
*** 67,70 ****
--- 74,78 ----
                {
                        $this->bo->delete($key);
+                       $this->modify = True;
                }
                
***************
*** 72,75 ****
--- 80,84 ----
                {
                        $this->bo->update($key, $fields);
+                       $this->modify = True;
                }
  

Index: class.uicatalog_contact_comm_type.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/addressbook/inc/Attic/class.uicatalog_contact_comm_type.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** class.uicatalog_contact_comm_type.inc.php   30 Sep 2003 15:08:38 -0000      
1.1.2.1
--- class.uicatalog_contact_comm_type.inc.php   2 Oct 2003 23:08:46 -0000       
1.1.2.2
***************
*** 5,8 ****
--- 5,9 ----
        {
                var $public_functions = array('view' => True);
+               var $modify = False;
  
                function uicatalog_contact_comm_type()
***************
*** 46,49 ****
--- 47,55 ----
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
+                       if($this->modify)
+                       {
+                               $contacts = CreateObject('phpgwapi.contacts');
+                               $contacts->delete_sessiondata('comm_type');
+                       }
                }
  
***************
*** 56,59 ****
--- 62,66 ----
                {
                        $this->bo->insert($fields);
+                       $this->modify = True;
                }
                
***************
*** 61,64 ****
--- 68,72 ----
                {
                        $this->bo->delete($key);
+                       $this->modify = True;
                }
                
***************
*** 66,69 ****
--- 74,78 ----
                {
                        $this->bo->update($key, $fields);
+                       $this->modify = True;
                }
  

Index: class.uicatalog_contact_addr_type.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/addressbook/inc/Attic/class.uicatalog_contact_addr_type.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** class.uicatalog_contact_addr_type.inc.php   30 Sep 2003 15:08:38 -0000      
1.1.2.1
--- class.uicatalog_contact_addr_type.inc.php   2 Oct 2003 23:08:46 -0000       
1.1.2.2
***************
*** 5,15 ****
        {
                var $public_functions = array('view' => True);
  
                function uicatalog_contact_addr_type()
                {
                        $this->_constructor();
- 
                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_addr_type');
!                       
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_addr_type.view';
                        $this->catalog_name = 'addr_types';
--- 5,15 ----
        {
                var $public_functions = array('view' => True);
+               var $modify = False;
  
                function uicatalog_contact_addr_type()
                {
                        $this->_constructor();
                        $this->bo = 
CreateObject('addressbook.bocatalog_contact_addr_type');
! 
                        $this->form_action = 
'menuaction=addressbook.uicatalog_contact_addr_type.view';
                        $this->catalog_name = 'addr_types';
***************
*** 46,49 ****
--- 46,54 ----
                        $this->validate_action($this->action);
                        $this->create_window($this->catalog_name, $this->entry, 
$this->title);
+                       if($this->modify)
+                       {
+                               $contacts = CreateObject('phpgwapi.contacts');
+                               $contacts->delete_sessiondata('addr_type');
+                       }
                }
  
***************
*** 56,59 ****
--- 61,65 ----
                {
                        $this->bo->insert($fields);
+                       $this->modify = True;
                }
                
***************
*** 61,64 ****
--- 67,71 ----
                {
                        $this->bo->delete($key);
+                       $this->modify = True;
                }
                
***************
*** 66,69 ****
--- 73,77 ----
                {
                        $this->bo->update($key, $fields);
+                       $this->modify = True;
                }
  

Index: class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.36.2.15.2.20
retrieving revision 1.36.2.15.2.21
diff -C2 -d -r1.36.2.15.2.20 -r1.36.2.15.2.21
*** class.uiaddressbook.inc.php 26 Sep 2003 19:34:21 -0000      1.36.2.15.2.20
--- class.uiaddressbook.inc.php 2 Oct 2003 23:08:46 -0000       1.36.2.15.2.21
***************
*** 269,273 ****
                                
$this->template->set_var('add_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.add_org'));
                        }
! 
                        $comms_array = 
$columns_to_display['comm_types']?$columns_to_display['comm_types']:array();
                        unset($columns_to_display['comm_types']);
--- 269,273 ----
                                
$this->template->set_var('add_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.add_org'));
                        }
!                       
                        $comms_array = 
$columns_to_display['comm_types']?$columns_to_display['comm_types']:array();
                        unset($columns_to_display['comm_types']);
***************
*** 287,301 ****
                        $entries = $this->bo->$get_data_function($fields, 
$this->limit, $this->start, $this->order, $this->sort, '', $criteria);
  
!                       if (is_array($entries))
                        {
!                               foreach ($entries as $id)
                                {
!                                       $contacts[] = $id['contact_id'];
                                }
-                               $this->entries_comm = 
$this->bo->get_comm_contact_data($contacts, $fields_comms);
-                       }
-                       else
-                       {
-                               $entries=array();
                        }
  
--- 287,304 ----
                        $entries = $this->bo->$get_data_function($fields, 
$this->limit, $this->start, $this->order, $this->sort, '', $criteria);
  
!                       if(count($fields_comms)>0)
                        {
!                               if (is_array($entries))
                                {
!                                       foreach ($entries as $id)
!                                       {
!                                               $contacts[] = $id['contact_id'];
!                                       }
!                                       $this->entries_comm = 
$this->bo->get_comm_contact_data($contacts, $fields_comms);
!                               }
!                               else
!                               {
!                                       $entries=array();
                                }
                        }
  
***************
*** 413,428 ****
                                        {
                                                $data = 
$this->get_comm_value($myid, $column[key]);
                                        }
                                        else
                                        {
!                                               switch ($column[key])
!                                               {
!                                               case 'url':
!                                                       break;
!                                               case 'email':
!                                                       break;
!                                               default:
!                                                       $ref = ''; $data = 
$coldata;
!                                               }
                                        }
                                        
$this->template->set_var('col_data',$ref.$data);
--- 416,444 ----
                                        {
                                                $data = 
$this->get_comm_value($myid, $column[key]);
+                                               if(strpos($column[key], 
'email'))
+                                               {
+                                                       if 
($GLOBALS['phpgw_info']['user']['apps']['email'])
+                                                       {
+                                                               $ref='<a 
href="'.$GLOBALS['phpgw']->link(
+                                                                       
"/email/compose.php","to=" 
+                                                                       . 
urlencode($data))
+                                                                       .'" 
target="_new">';
+                                                       }
+                                                       else
+                                                       {
+                                                               $ref='<a 
href="mailto:'.$data.'">';
+                                                       }
+                                                       $data=$data . '</a>';
+                                               }
+                                               if($column[key]=='website')
+                                               {
+                                                       if ( !empty($data) && 
(substr($data,0,7) != 'http://') ) { $data = 'http://' . $data; }
+                                                       $ref='<a 
href="'.$data.'" target="_new">';
+                                                       $data=$data.'</a>';
+                                               }
                                        }
                                        else
                                        {
!                                               $ref = ''; $data = $coldata;
                                        }
                                        
$this->template->set_var('col_data',$ref.$data);
***************
*** 520,526 ****
                                $this->tab = $this->tab_person_data;
                        }
- 
-                       //read the current tab information
-                       $this->entry = $this->read_tab_session($this->tab);
                        
                        //evaluate the submit action
--- 536,539 ----
***************
*** 528,532 ****
                        {
                        case 'save':
-                               
$this->save_tab_session($this->entry['old_tab'], $this->entry);
                                $fields = $this->get_all_entry();
  
--- 541,544 ----
***************
*** 552,555 ****
--- 564,570 ----
                        }
                        
+                       //read the current tab information
+                       $this->entry = $this->read_tab_session($this->tab);
+ 
                        //start to draw the add window
                        $GLOBALS['phpgw']->common->phpgw_header();
***************
*** 597,603 ****
                                $this->tab = $this->tab_person_data;
                        }
-                       
-                       //read the current tab information
-                       $this->entry = $this->read_tab_session($this->tab);
  
                        //evaluate the submit action
--- 612,615 ----
***************
*** 605,609 ****
                        {
                        case 'save':
-                               
$this->save_tab_session($this->entry['old_tab'], $this->entry);
                                $fields = $this->get_all_entry();
  
--- 617,620 ----
***************
*** 635,638 ****
--- 646,652 ----
                        }
  
+                       //read the current tab information
+                       $this->entry = $this->read_tab_session($this->tab);
+ 
                        /* First, make sure they have permission to this entry 
*/
                        $this->owner = 
$this->entry['owner']?$this->entry['owner']:$this->owner;
***************
*** 735,741 ****
                                $this->tab = $this->tab_org_data;
                        }
-                       
-                       //read the current tab information
-                       $this->entry = $this->read_tab_session($this->tab);
  
                        //evaluate the submit action
--- 749,752 ----
***************
*** 743,747 ****
                        {
                        case 'save':
-                               
$this->save_tab_session($this->entry['old_tab'], $this->entry);
                                $fields = $this->get_all_entry();
                                
--- 754,757 ----
***************
*** 765,768 ****
--- 775,781 ----
                        }
  
+                       //read the current tab information
+                       $this->entry = $this->read_tab_session($this->tab);
+ 
                        //start to draw the add window
                        $GLOBALS['phpgw']->common->phpgw_header();
***************
*** 810,816 ****
                                $this->tab = $this->tab_org_data;
                        }
-                       
-                       //read the current tab information
-                       $this->entry = $this->read_tab_session($this->tab);
  
                        //evaluate the submit action
--- 823,826 ----
***************
*** 848,851 ****
--- 858,864 ----
                        }
                        
+                       //read the current tab information
+                       $this->entry = $this->read_tab_session($this->tab);
+ 
                        /* First, make sure they have permission to this entry 
*/
                        $this->owner = 
$this->entry['owner']?$this->entry['owner']:$this->owner;
***************
*** 1082,1086 ****
                                //$defaul_person_name='entry[current_person]';
  
!                               $fields_to_search=array('person_id', 
'per_first_name');
                                $this->get_persons($fields_to_search, 
$fields['my_person']);
  
--- 1095,1099 ----
                                //$defaul_person_name='entry[current_person]';
  
!                               $fields_to_search=array('person_id', 
'per_first_name', 'per_last_name');
                                $this->get_persons($fields_to_search, 
$fields['my_person']);
  
***************
*** 1923,1926 ****
--- 1936,1941 ----
                                $comms['comm_data']['work email'] = 
$entry['email'];
                                $comms['comm_data']['work phone'] = 
$entry['wphone'];
+                               $comms['preferred'] = 
$comms['preferred']?$comms['preferred']:'work email';
+                               
                                $this->save_tab_session($this->tab_comms, 
$comms);
                                unset($entry['email']);
***************
*** 1944,1956 ****
                                        . $entry['bday_year'];
                                
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_orgs:
                                $entry_name = 'tab_orgs';
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_cats:
                                $entry_name = 'tab_cats';
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_comms:
--- 1959,1974 ----
                                        . $entry['bday_year'];
                                
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_orgs:
                                $entry_name = 'tab_orgs';
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_cats:
                                $entry_name = 'tab_cats';
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_comms:
***************
*** 1969,1981 ****
                                }
  
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_others:
                                $entry_name = 'tab_others';
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_extra:
                                $entry_name = 'tab_extra';
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_org_data:
--- 1987,2002 ----
                                }
  
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_others:
                                $entry_name = 'tab_others';
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_extra:
                                $entry_name = 'tab_extra';
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_org_data:
***************
*** 1985,1988 ****
--- 2006,2010 ----
                                $comms = 
$this->read_tab_session($this->tab_comms);
                                $comms['comm_data']['work phone'] = 
$entry['wphone'];
+                               $comms['preferred'] = 
$comms['preferred']?$comms['preferred']:'work email';
                                $this->save_tab_session($this->tab_comms, 
$comms);
                                unset($entry['wphone']);
***************
*** 1999,2007 ****
                                        $entry['access'] = 'public';
                                }
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case $this->tab_persons:
                                $entry_name = 'tab_persons';
!                               $entry_data = $this->save_simple_array($entry);
                                break;
                        case 'others_data':
--- 2021,2031 ----
                                        $entry['access'] = 'public';
                                }
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case $this->tab_persons:
                                $entry_name = 'tab_persons';
!                               //$entry_data = 
$this->save_simple_array($entry);
!                               $entry_data = $entry;
                                break;
                        case 'others_data':
***************
*** 2012,2015 ****
--- 2036,2040 ----
                                $entry_name = 'addr_data';
                                $entry_data = $entry;
+                               break;
                        }
                        
$GLOBALS['phpgw']->session->appsession($entry_name,'addressbook', $entry_data);
***************
*** 2572,2576 ****
                        foreach($contacts as $field => $data)
                        {
!                               if(!is_numeric($field))
                                {
                                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
--- 2597,2601 ----
                        foreach($contacts as $field => $data)
                        {
!                               if(!is_numeric($field) && $data!='')
                                {
                                        $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
***************
*** 2642,2651 ****
                function get_comm_value($contact_id, $column)
                {
!                       if(!is_array($this->entries_comm['comm']))
                        {
!                               $this->entries_comm['comm']=array();
                        }
                        
!                       foreach($this->entries_comm['comm'] as $comms)
                        {
                                if($contact_id == $comms['comm_contact_id'] && 
$column == $comms['comm_description'])
--- 2667,2676 ----
                function get_comm_value($contact_id, $column)
                {
!                       if(!is_array($this->entries_comm))
                        {
!                               $this->entries_comm=array();
                        }
                        
!                       foreach($this->entries_comm as $comms)
                        {
                                if($contact_id == $comms['comm_contact_id'] && 
$column == $comms['comm_description'])
***************
*** 2780,2784 ****
                                        {
                                                $this->my_person_data .= 
'<option value="' . $v['person_id'] . '">'
!                                                       
.$v['per_first_name'].'</option>';
                                                
$this->my_person_array[$v['person_id']] = $v['per_first_name'];
                                        }
--- 2805,2809 ----
                                        {
                                                $this->my_person_data .= 
'<option value="' . $v['person_id'] . '">'
!                                                       .$v['per_first_name']. 
' ' .$v['per_last_name'].'</option>';
                                                
$this->my_person_array[$v['person_id']] = $v['per_first_name'];
                                        }
***************
*** 2786,2790 ****
                                        {
                                                $this->all_person_data .= 
'<option value="' . $v['person_id'] . '">'
!                                                       
.$v['per_first_name'].'</option>';
                                        }
                                }
--- 2811,2815 ----
                                        {
                                                $this->all_person_data .= 
'<option value="' . $v['person_id'] . '">'
!                                                       .$v['per_first_name']. 
' ' .$v['per_last_name'].'</option>';
                                        }
                                }

Index: class.soaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.soaddressbook.inc.php,v
retrieving revision 1.14.2.3.2.10
retrieving revision 1.14.2.3.2.11
diff -C2 -d -r1.14.2.3.2.10 -r1.14.2.3.2.11
*** class.soaddressbook.inc.php 30 Sep 2003 19:27:30 -0000      1.14.2.3.2.10
--- class.soaddressbook.inc.php 2 Oct 2003 23:08:47 -0000       1.14.2.3.2.11
***************
*** 220,223 ****
--- 220,228 ----
                        $principal = array_merge($fields['tab_person_data'], 
$fields['tab_extra']);
                        
+                       if(!is_array($fields['tab_comms']['comm_data']))
+                       {
+                               $fields['tab_comms']['comm_data']=array();
+                       }
+                       
                        foreach($fields['tab_comms']['comm_data'] as 
$type_descr => $data)
                        {
***************
*** 240,245 ****
                        $orgs = $fields['tab_orgs']['my_orgs'];
                        $principal['preferred_org'] = 
$fields['tab_orgs']['preferred_org'];
!                       $principal['preferred_address'] = '1';
!                       
                        $cats = $fields['tab_cats']['my_cats'];
  
--- 245,253 ----
                        $orgs = $fields['tab_orgs']['my_orgs'];
                        $principal['preferred_org'] = 
$fields['tab_orgs']['preferred_org'];
!                       if($fields['tab_orgs']['preferred_org'])
!                       {
!                               $principal['preferred_address'] = 
$this->contacts->get_location_pref_org($principal['preferred_org']);
!                       }
! 
                        $cats = $fields['tab_cats']['my_cats'];
  
***************
*** 317,321 ****
                        unset($fields['addr_data']);
                        unset($fields['transactions']);
!                       unset($fields['tab_comms']);
                        unset($fields['old_comm']);
  
--- 325,329 ----
                        unset($fields['addr_data']);
                        unset($fields['transactions']);
!                       //unset($fields['tab_comms']);
                        unset($fields['old_comm']);
  
***************
*** 326,330 ****
                                
$this->contacts->delete_org_person_relation($org_id, $person_id, 
PHPGW_SQL_RUN_SQL);
                        }
!                       $fields['preferred_address']=1;
                        $this->contacts->add_orgs_for_person($orgs['insert'], 
                                                             
$orgs['preferred_org'], 
--- 334,343 ----
                                
$this->contacts->delete_org_person_relation($org_id, $person_id, 
PHPGW_SQL_RUN_SQL);
                        }
! 
!                       if($orgs['preferred_org'])
!                       {
!                               $fields['preferred_address'] = 
$this->contacts->get_location_pref_org($orgs['preferred_org']);
!                       }
! 
                        $this->contacts->add_orgs_for_person($orgs['insert'], 
                                                             
$orgs['preferred_org'], 
***************
*** 332,340 ****
                                                             $person_id, 
PHPGW_SQL_RUN_SQL);
  
                        $this->upgrade_comms($fields['edit_comms']['insert'], 
                                             $fields['edit_comms']['delete'], 
                                             $fields['edit_comms']['edit'],
!                                            $fields['comm_data'], $person_id);
!                       
                        $this->upgrade_others($fields['edit_others']['insert'],
                                              $fields['edit_others']['delete'],
--- 345,355 ----
                                                             $person_id, 
PHPGW_SQL_RUN_SQL);
  
+                       $comm_preferred = $fields['tab_comms']['preferred'];
+                       
                        $this->upgrade_comms($fields['edit_comms']['insert'], 
                                             $fields['edit_comms']['delete'], 
                                             $fields['edit_comms']['edit'],
!                                            $fields['comm_data'], 
$comm_preferred, $person_id);
! 
                        $this->upgrade_others($fields['edit_others']['insert'],
                                              $fields['edit_others']['delete'],
***************
*** 382,386 ****
                                             $fields['edit_comms']['delete'], 
                                             $fields['edit_comms']['edit'],
!                                            $fields['comm_data'], $org_id);
                        
                        $this->upgrade_others($fields['edit_others']['insert'],
--- 397,401 ----
                                             $fields['edit_comms']['delete'], 
                                             $fields['edit_comms']['edit'],
!                                            $fields['comm_data'], '', $org_id);
                        
                        $this->upgrade_others($fields['edit_others']['insert'],
***************
*** 392,396 ****
                }
  
!               function upgrade_comms($add_comms=array(), $del_comms=array(), 
$edit_comms=array(), $data=array(), $contact_id)
                {
                        if(!is_array($add_comms))
--- 407,411 ----
                }
  
!               function upgrade_comms($add_comms=array(), $del_comms=array(), 
$edit_comms=array(), $data=array(), $comm_preferred='', $contact_id='')
                {
                        if(!is_array($add_comms))
***************
*** 412,415 ****
--- 427,431 ----
                        }
                        
+                       $this->edit_comms_by_contact($contact_id, 
array('comm_preferred'=>'N'), PHPGW_SQL_RUN_SQL);
                        foreach($data as $key => $value)
                        {
***************
*** 426,430 ****
                                if(array_key_exists($value['comm_description'], 
$edit_comms))
                                {
!                                       
$this->edit_comms($value['key_comm_id'], $value, PHPGW_SQL_RUN_SQL);
                                }
                        }
--- 442,457 ----
                                if(array_key_exists($value['comm_description'], 
$edit_comms))
                                {
!                                       if($comm_preferred == 
$value['comm_description'])
!                                       {
!                                               $value['comm_preferred'] = 'Y';
!                                       }
!                                       else
!                                       {
!                                               $value['comm_preferred'] = 'N';
!                                       }
!                                       
!                                       
$this->edit_comms($value['key_comm_id'], 
!                                                         array('comm_data' => 
$edit_comms[$value['comm_description']]), 
!                                                         PHPGW_SQL_RUN_SQL);
                                }
                        }
***************
*** 432,437 ****
                        foreach($add_comms as $key => $value)
                        {
                                $fields = array('comm_descr' => 
$this->search_comm_descr($key),
!                                               'comm_data' => $value);
                                
                                $this->add_communication_media($fields, 
$contact_id, PHPGW_SQL_RUN_SQL);
--- 459,474 ----
                        foreach($add_comms as $key => $value)
                        {
+                               if($comm_preferred == $key)
+                               {
+                                       $pref = 'Y';
+                               }
+                               else
+                               {
+                                       $pref = 'N';
+                               }
+                               
                                $fields = array('comm_descr' => 
$this->search_comm_descr($key),
!                                               'comm_data' => $value,
!                                               'comm_preferred' => $pref);
                                
                                $this->add_communication_media($fields, 
$contact_id, PHPGW_SQL_RUN_SQL);
***************
*** 604,607 ****
--- 641,649 ----
                }
  
+               function edit_comms_by_contact($id, $data, 
$action=PHPGW_SQL_RETURN_SQL)
+               {
+                       return $this->contacts->edit_comms_by_contact($id, 
$data, $action);
+               }
+               
                function add_location($fields, $contact_id)
                {





reply via email to

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