phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.3


From: Alejandro Borges (lex) <address@hidden>
Subject: [Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.32, 1.17.2.2.2.33
Date: Wed, 29 Oct 2003 05:09:50 +0000

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv28145

Modified Files:
      Tag: Version-0_9_16-branch
        class.contacts_sql.inc.php 
Log Message:
Fixup for deprecated function


Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.32
retrieving revision 1.17.2.2.2.33
diff -C2 -d -r1.17.2.2.2.32 -r1.17.2.2.2.33
*** class.contacts_sql.inc.php  28 Oct 2003 08:29:24 -0000      1.17.2.2.2.32
--- class.contacts_sql.inc.php  29 Oct 2003 05:09:48 -0000      1.17.2.2.2.33
***************
*** 683,729 ****
                /* @deprecated */
                /* send this the id and whatever fields you want to see */
!               function read_single_entry($id,$fields='', 
$action=PHPGW_SQL_RUN_SQL)
!               {
!                       $this->request($fields);
!                       $this->request(array('contact_id'));
!                       $this->criteria(array('contact_id' => $id));
!                       $sql_select = $this->get_query($action, __LINE__, 
__FILE__);
! 
!                       $this->db->query($sql_select,__LINE__,__FILE__);
!                       $this->db->next_record();
! 
!                       $return_fields = &$this->db->Record;
! 
!                       $return_extra_fields = 
$this->read_extra_fields(intval($id));
! 
!                       return array_merge($return_fields,$return_extra_fields);
!               }
! 
!               /* This function get all the Communication media from one 
contact.
!               *
!               * Or the first if there is no one marked as preferred.
!               * @param integer $contact_id id to locate the contact
!               * return array Form: (description => value, description => 
value, ...)
!               */
!               function get_all_comms($contact_id)
                {
!                       if (intval($contact_id) != 0)
                        {
!                               // get all comm_descriptions from api function
!                               $this->request(array('comm_data', 
'comm_descr'));
!                               $this->criteria(array('comm_contact_id' => 
$contact_id));
!                               // get all comms from db
!                               $records = $this->get_query(PHPGW_SQL_RUN_SQL, 
__LINE__, __FILE__);
!                               if(count($records) == 0)
!                               {
!                                       return;
!                               }
!                               foreach ($records as $comm)
                                {
!                                       $descr = 
$this->search_comm_descr_id($comm['comm_descr']);
!                                       $comms[$descr] = $comm['comm_data'];    
                                }
                        }
!                       return $comms;
                }
  
--- 683,750 ----
                /* @deprecated */
                /* send this the id and whatever fields you want to see */
!               function read_single_entry($id,$fields='')
                {
!                       $person_data = $this->person_complete_data($id);
!                       $entry['fn']                    = 
$person_data['per_full_name'];
!                       $entry['sound']                 = 
$person_data['per_sound'];
!                       $entry['org_name']              = '';
!                       $entry['org_unit']              = 
$person_data['per_departament'];
!                       $entry['title']                 = 
$person_data['per_title'];
!                       $entry['n_prefix']              = 
$person_data['per_prefix'];
!                         $entry['n_given']                     = 
$person_data['per_first_name'];
!                       $entry['n_middle']              = 
$person_data['per_middle_name'];
!                       $entry['n_family']              = 
$person_data['per_last_name'];
!                       $entry['n_suffix']              = 
$person_data['per_suffix'];
!                       $entry['label']                 = '';
!                       $entry['adr_one_street']        = 
$person_data['locations'][1]['add1'];
!                       $entry['adr_one_locality']      = 
$person_data['locations'][1]['city'];
!                       $entry['adr_one_region']        = 
$person_data['locations'][1]['state'];
!                       $entry['adr_one_postalcode']    = 
$person_data['locations'][1]['postal_code'];
!                       $entry['adr_one_countryname']   = 
$person_data['locations'][1]['country'];
!                       $entry['adr_one_type']          = 
$person_data['locations'][1]['type'];
!                       $entry['adr_two_street']        = 
$person_data['locations'][2]['add1'];
!                       $entry['adr_two_locality']      = 
$person_data['locations'][2]['city'];
!                       $entry['adr_two_region']        = 
$person_data['locations'][2]['state'];
!                       $entry['adr_two_postalcode']    = 
$person_data['locations'][2]['postal_code'];
!                       $entry['adr_two_countryname']   = 
$person_data['locations'][2]['country'];
!                       $entry['adr_two_type']          = 
$person_data['locations'][2]['type'];
!                       $entry['tz']                    = 
$person_data['locations'][1]['tz'];;
!                       $entry['geo']                   = '';
!                       $entry['tel_work']              = $person_data['work 
phone'];
!                       $entry['tel_home']              = $person_data['home 
phone'];
!                       $entry['tel_voice']             = $person_data['voice 
phone'];
!                       $entry['tel_msg']               = $person_data['msg 
phone'];
!                       $entry['tel_fax']               = $person_data['work 
fax'];
!                       $entry['tel_pager']             = $person_data['pager'];
!                       $entry['tel_cell']              = $person_data['mobile 
(cell) phone'];
!                       $entry['tel_bbs']               = $person_data['bbs'];
!                       $entry['tel_modem']             = $person_data['modem'];
!                       $entry['tel_isdn']              = $person_data['isdn'];
!                       $entry['tel_car']               = $person_data['car 
phone'];
!                       $entry['tel_video']             = $person_data['video'];
!                       $entry['tel_prefer']            = '';
!                       $entry['email']                 = $person_data['work 
email'];
!                       $entry['email_type']            = 
$person_data['comm_type']['work email'];
!                       $entry['email_home']            = $person_data['home 
email'];
!                       $entry['email_home_type']       = 
$person_data['comm_type']['home email'];
!                       $entry['address2']              = 
$person_data['locations'][1]['add2'];
!                       $entry['address3']              = 
$person_data['locations'][1]['add3'];
!                       $entry['ophone']                = '';
!                       $entry['bday']                  = 
$person_data['per_birthday'];
!                       $entry['url']                   = 
$person_data['website'];
!                       $entry['pubkey']                = 
$person_data['per_pubkey'];
!                       $entry['note']                  = 
$person_data['notes'][1]['text'];
!                       if(is_array($fields))
                        {
!                               foreach($fields as $field)
                                {
!                                       $entry_data[0][$field] = $entry[$field];
                                }
                        }
!                       else
!                       {
!                               $entry_data[0] = $entry;
!                       }
!                       return $entry_data;
                }
  
***************
*** 731,738 ****
                function read_last_entry($fields='')
                {
!                       $this->request('max_contact_id');
!                       $id = $this->records();
!                       $return_fieds = read_single_entry($id, $fields);
!                       return $return_fields;
                }
  
--- 752,758 ----
                function read_last_entry($fields='')
                {
!                       $last_contact = $this->get_max_contact();
!                       $person_data = $this->read_single_entry($last_contact, 
$fields);
!                       return $person_data;
                }
  
***************
*** 778,951 ****
                }
  
-               
-               function comms_fixed($comm_type, $comm_description)
-               {
-                       // In this array add all the label that you have on an 
import method, an make the
-                       // association with the corresponding description on 
database
-                       if(!$this->hash_comms_import)
-                       {
-                               $this->hash_comms_import = 
-                                       array('email'  => array('home'          
=> 'home email',
-                                                               'work'          
=> 'work email',
-                                                               'other'         
=> 'other email'),
-                                             'phone'  => array('home'          
=> 'home phone',
-                                                               'work'          
=> 'work phone',
-                                                               'other'         
=> 'other phone',
-                                                               'msg'           
=> 'msg phone',
-                                                               'home_two'      
=> 'second home phone',
-                                                               'work_two'      
=> 'second work phone',
-                                                               'isdn'          
=> 'isdn',
-                                                               'other_two'     
=> 'second other phone',
-                                                               'pager'         
=> 'pager'),
-                                             'fax'    => array('work'          
=> 'work fax',
-                                                               'home'          
=> 'home fax',
-                                                               'other'         
=> 'other fax'),
-                                             'mobile' => array('car'           
=> 'car phone',
-                                                               'cell'          
=> 'mobile (cell) phone'));
-                       }
- 
-                       return 
$this->search_comm_descr($hash_comms_import[$comm_type][$comm_description]);
-               }
- 
-               /**
-               * explode a field name by `_' so parts of the field name have a 
meaning, not only the whole name
-               * 
-               * @param string $field meta-field name, with form: 
{kind}_{key_{real_field_name}
-               * @param value $value to assing to field
-               * @param mixed &$field_list reference to the list that contain 
$field
-               */
-               function explode_field_name($field, $value, &$fields_list)
-               {
-                       // ugly hack
-                       $addr_keys = array('work', 'home', 'other', 'other', 
'other', 'other');
- 
-                       list($kind, $key, $name) = explode('_', $field, 3);
-                       switch ($kind)
-                       {
-                       case 'addr':
-                               // Code for locations
-                               $fields_list['location'][$key][$name] = $value;
-                               unset($fields_list[$field]);
-                               $fields_list['location'][$key]['type'] = 
$addr_keys[$key];
-                               break;
-                       case 'comm':
-                               // Code for comms
-                               
$fields_list['comm_media'][$this->comms_fixed($key, $name)] = $value;
-                               unset($fields_list[$field]);
-                               break;
-                       case 'org':
-                               list($org_key, $name) = explode('_', $name, 2);
-                               switch($key)
-                               {
-                               case 'addr':
-                                       // Code for locations
-                                       
$fields_list['org_data']['location'][$org_key][$name] = $value;
-                                       unset($fields_list[$field]);
-                                       
$fields_list['org_data']['location'][$org_key]['type'] = $addr_keys[$org_key];
-                                       break;
-                               case 'comm':
-                                       // Code for comms
-                                       
$fields_list['org_data']['comm_media'][$this->comms_fixed($org_key, $name)] = 
$value;
-                                       unset($fields_list[$field]);
-                                       break;
-                               default:
-                                       // code for default (principal/others)
-                                       $fields_list['org_data'][$field] = 
$value;
-                                       unset($fields_list[$field]);
-                               }
-                       }
-               }
- 
-               /**
-               * Get all the data for any contact or contacts that are part of 
$optional_criteria.
-               *
-               * This function try to be a comprensive way to get data from 
contacts<br /> convert the contacts database output on a multidimensional 
array<br />
-               * @param int|array $contact_id
-               * @param mixed $optional_criteria criteria built with 
sql_criteria
-               * @param integer $line where this function is called, usefull 
for debug
-               * @param integer $file where this function is called, usefull 
for debug
-               * @return mixed array with all the data of contact (contacts).
-               */
-               function person_complete_data($contact_id, $optional_criteria = 
'', $line=__LINE__, $file=__FILE__)
-               {
-                       $this->request($this->import_export_fields);
-                       if (empty($optional_criteria))
-                       {
-                               if (intval($contact_id) == 0)
-                               {
-                                       // this is an error
-                                       return ;
-                               }
-                               
$this->criteria_token(sql_criteria::_equal('contact_id', $contact_id));
-                       }
-                       else
-                       {
-                               $this->criteria_token($optional_criteria);
-                       }
- 
-                       $sql = $this->get_sql();
- 
-                       $this->execute_query($sql, $line, $file);
- 
-                       while ($this->db->next_record())
-                       {
-                               $record = $this->db->Record;
-                               $contact['contact_id']          = 
$record['contact_id'];
-                               $contact['per_full_name']       = 
$record['per_full_name'];
-                               $contact['per_first_name']      = 
$record['per_first_name'];
-                               $contact['per_last_name']       = 
$record['per_full_name'];
-                               $contact['per_middle_name']     = 
$record['per_middle_name'];
-                               $contact['per_suffix']          = 
$record['per_suffix'];
-                               $contact['per_prefix']          = 
$record['per_prefix'];
-                               $contact['per_birthday']        = 
$record['per_birthday'];
-                               $contact['per_pubkey']          = 
$record['per_pubkey'];
-                               $contact['per_title']           = 
$record['per_title'];
-                               $contact['per_departament']     = 
$record['per_departamet'];
-                               $contact['per_initials']        = 
$record['per_initials'];
-                               $contact['per_sound']           = 
$record['per_sound'];
-                               $contact['per_active']          = 
$record['per_active'];
-                               $contact['per_createon']        = 
$record['per_createon'];
-                               $contact['per_createby']        = 
$record['per_createby'];
-                               $contact['per_modby']           = 
$record['per_modby'];
-                               $contact['per_modon']           = 
$record['per_modon'];
-                               $contact['account_id']          = 
$record['account_id'];
-                               // Locations info
-                               $loc_id                                         
= $record['key_addr_id'];
-                               if($loc_id)
-                               {
-                                       $contact['locations'][$loc_id]['type']  
        = $record['addr_description'];
-                                       $contact['locations'][$loc_id]['add1']  
        = $record['addr_add1'];
-                                       $contact['locations'][$loc_id]['add2']  
        = $record['addr_add2'];
-                                       $contact['locations'][$loc_id]['add3']  
        = $record['addr_add3'];
-                                       
$contact['locations'][$loc_id]['address']       = $record['addr_address'];
-                                       $contact['locations'][$loc_id]['city']  
        = $record['addr_city'];
-                                       $contact['locations'][$loc_id]['state'] 
        = $record['addr_state'];
-                                       
$contact['locations'][$loc_id]['postal_code']   = $record['addr_postal_code'];
-                                       
$contact['locations'][$loc_id]['country']       = $record['addr_country'];
-                                       
$contact['locations'][$loc_id]['preferred']     = $record['addr_preferred'];
-                               }
-                               // Notes
-                               $note_id                                        
= $record['key_note_id'];
-                               if($note_id)
-                               {
-                                       $contact['notes'][$note_id]['text']     
        = $record['note_text'];
-                                       $contact['notes'][$note_id]['type']     
        = $record['note_description'];
-                               }
-                               // Communcation media fields
-                               if($record['comm_data'])
-                               {
-                                       $comm_descr                             
= $record['comm_description'];
-                                       $contact[$comm_descr]                   
= $record['comm_data'];
-                                       $contact['comm_type'][$comm_descr]      
= $record['comm_type_description'];
-                               }
-                               // Other fields
-                               if($record['other_value'])
-                               {
-                                       $contact[$record['other_name']]         
= $record['other_value'];
-                               }
-                       }
-                       return $contact;
-               }
- 
                // Deprecated, this method is for old import only, I ask help 
to code a new one
                /* @deprecated */
--- 798,801 ----
***************
*** 1005,1012 ****
                        $this->other_fields = 
CreateObject('phpgwapi.contact_others');
                        $this->other_fields->insert(array('other_contact_id' => 
$id, 'other_name' => $field_name, 'other_value' => $field_value));
- //                    $this->insert('other_contact_id', $id);
- //                    $this->insert($field_name, $field_value);
- //                    $sql_insert = $this->map['other_contact_id']->insert();
- //                    $this->db->query($sql_insert,__LINE__,__FILE__);
                }
  
--- 855,858 ----
***************
*** 1014,1022 ****
                function delete_single_extra_field($id,$field_name)
                {
!                       $this->delete('other_id');
!                       $this->criteria(array('other_contact_id' => $id));
!                       $this->criteria(array('other_name' => $field_name));
!                       $sql_delete = $this->map['other_id']->delete();
!                       $this->db->query($sql_delete,__LINE__,__FILE__);
                }
  
--- 860,865 ----
                function delete_single_extra_field($id,$field_name)
                {
!                       $this->delete_others($cid);
!                       return array();
                }
  
***************
*** 1056,1071 ****
                function read_extra_fields($id)
                {
!                       $this->request(array(contact_name,contact_value));
!                       $this->criteria(array('other_contact_id' => $id));
!                       $sql_select = $this->map['other_contact_id']->select();
!                       
!                       $this->db->query($sql_select,__LINE__,__FILE__);
!                       while ($this->db->next_record())
!                       {
!                               $return_extra_fields['other_name'] = 
$this->db->f('other_value');
!                       }
!                       return $return_extra_fields;
                }
  
                /*************************************************************\
                * Retrieve functions section                                  *
--- 899,913 ----
                function read_extra_fields($id)
                {
!                       echo "don't use this";
                }
  
+               function update_single_extra_field($id, $name, $value)
+               {
+                       $other = CreateObject('phpgwapi.contact_others');
+                       $criteria = 
sql_criteria::token_and(sql_criteria::_equal('other_name', $name), 
sql_criteria::_equal('contact_id', $id));
+                       $other->update($id, array('other_value' => $value), 
$criteria);
+               }
+ 
+ 
                /*************************************************************\
                * Retrieve functions section                                  *
***************
*** 1678,1681 ****
--- 1520,1719 ----
                }
  
+               /* This function get all the Communication media from one 
contact.
+               *
+               * Or the first if there is no one marked as preferred.
+               * @param integer $contact_id id to locate the contact
+               * return array Form: (description => value, description => 
value, ...)
+               */
+               function get_all_comms($contact_id)
+               {
+                       if (intval($contact_id) != 0)
+                       {
+                               // get all comm_descriptions from api function
+                               $this->request(array('comm_data', 
'comm_descr'));
+                               $this->criteria(array('comm_contact_id' => 
$contact_id));
+                               // get all comms from db
+                               $records = $this->get_query(PHPGW_SQL_RUN_SQL, 
__LINE__, __FILE__);
+                               if(count($records) == 0)
+                               {
+                                       return;
+                               }
+                               foreach ($records as $comm)
+                               {
+                                       $descr = 
$this->search_comm_descr_id($comm['comm_descr']);
+                                       $comms[$descr] = $comm['comm_data'];    
+                               }
+                       }
+                       return $comms;
+               }
+               
+               function comms_fixed($comm_type, $comm_description)
+               {
+                       // In this array add all the label that you have on an 
import method, an make the
+                       // association with the corresponding description on 
database
+                       if(!$this->hash_comms_import)
+                       {
+                               $this->hash_comms_import = 
+                                       array('email'  => array('home'          
=> 'home email',
+                                                               'work'          
=> 'work email',
+                                                               'other'         
=> 'other email'),
+                                             'phone'  => array('home'          
=> 'home phone',
+                                                               'work'          
=> 'work phone',
+                                                               'other'         
=> 'other phone',
+                                                               'msg'           
=> 'msg phone',
+                                                               'home_two'      
=> 'second home phone',
+                                                               'work_two'      
=> 'second work phone',
+                                                               'isdn'          
=> 'isdn',
+                                                               'other_two'     
=> 'second other phone',
+                                                               'pager'         
=> 'pager'),
+                                             'fax'    => array('work'          
=> 'work fax',
+                                                               'home'          
=> 'home fax',
+                                                               'other'         
=> 'other fax'),
+                                             'mobile' => array('car'           
=> 'car phone',
+                                                               'cell'          
=> 'mobile (cell) phone'));
+                       }
+ 
+                       return 
$this->search_comm_descr($hash_comms_import[$comm_type][$comm_description]);
+               }
+ 
+               /**
+               * explode a field name by `_' so parts of the field name have a 
meaning, not only the whole name
+               * 
+               * @param string $field meta-field name, with form: 
{kind}_{key_{real_field_name}
+               * @param value $value to assing to field
+               * @param mixed &$field_list reference to the list that contain 
$field
+               */
+               function explode_field_name($field, $value, &$fields_list)
+               {
+                       // ugly hack
+                       $addr_keys = array('work', 'home', 'other', 'other', 
'other', 'other');
+ 
+                       list($kind, $key, $name) = explode('_', $field, 3);
+                       switch ($kind)
+                       {
+                       case 'addr':
+                               // Code for locations
+                               $fields_list['location'][$key][$name] = $value;
+                               unset($fields_list[$field]);
+                               $fields_list['location'][$key]['type'] = 
$addr_keys[$key];
+                               break;
+                       case 'comm':
+                               // Code for comms
+                               
$fields_list['comm_media'][$this->comms_fixed($key, $name)] = $value;
+                               unset($fields_list[$field]);
+                               break;
+                       case 'org':
+                               list($org_key, $name) = explode('_', $name, 2);
+                               switch($key)
+                               {
+                               case 'addr':
+                                       // Code for locations
+                                       
$fields_list['org_data']['location'][$org_key][$name] = $value;
+                                       unset($fields_list[$field]);
+                                       
$fields_list['org_data']['location'][$org_key]['type'] = $addr_keys[$org_key];
+                                       break;
+                               case 'comm':
+                                       // Code for comms
+                                       
$fields_list['org_data']['comm_media'][$this->comms_fixed($org_key, $name)] = 
$value;
+                                       unset($fields_list[$field]);
+                                       break;
+                               default:
+                                       // code for default (principal/others)
+                                       $fields_list['org_data'][$field] = 
$value;
+                                       unset($fields_list[$field]);
+                               }
+                       }
+               }
+ 
+               /**
+               * Get all the data for any contact or contacts that are part of 
$optional_criteria.
+               *
+               * This function try to be a comprensive way to get data from 
contacts<br /> convert the contacts database output on a multidimensional 
array<br />
+               * @param int|array $contact_id
+               * @param mixed $optional_criteria criteria built with 
sql_criteria
+               * @param integer $line where this function is called, usefull 
for debug
+               * @param integer $file where this function is called, usefull 
for debug
+               * @return mixed array with all the data of contact (contacts).
+               */
+               function person_complete_data($contact_id, $optional_criteria = 
'', $line=__LINE__, $file=__FILE__)
+               {
+                       $this->request($this->import_export_fields);
+                       if (empty($optional_criteria))
+                       {
+                               if (intval($contact_id) == 0)
+                               {
+                                       // this is an error
+                                       return ;
+                               }
+                               
$this->criteria_token(sql_criteria::_equal('contact_id', $contact_id));
+                       }
+                       else
+                       {
+                               $this->criteria_token($optional_criteria);
+                       }
+ 
+                       $sql = $this->get_sql();
+ 
+                       $this->execute_query($sql, $line, $file);
+ 
+                       while ($this->db->next_record())
+                       {
+                               $record = $this->db->Record;
+                               $contact['contact_id']          = 
$record['contact_id'];
+                               $contact['per_full_name']       = 
$record['per_full_name'];
+                               $contact['per_first_name']      = 
$record['per_first_name'];
+                               $contact['per_last_name']       = 
$record['per_last_name'];
+                               $contact['per_middle_name']     = 
$record['per_middle_name'];
+                               $contact['per_suffix']          = 
$record['per_suffix'];
+                               $contact['per_prefix']          = 
$record['per_prefix'];
+                               $contact['per_birthday']        = 
$record['per_birthday'];
+                               $contact['per_pubkey']          = 
$record['per_pubkey'];
+                               $contact['per_title']           = 
$record['per_title'];
+                               $contact['per_departament']     = 
$record['per_departamet'];
+                               $contact['per_initials']        = 
$record['per_initials'];
+                               $contact['per_sound']           = 
$record['per_sound'];
+                               $contact['per_active']          = 
$record['per_active'];
+                               $contact['per_createon']        = 
$record['per_createon'];
+                               $contact['per_createby']        = 
$record['per_createby'];
+                               $contact['per_modby']           = 
$record['per_modby'];
+                               $contact['per_modon']           = 
$record['per_modon'];
+                               $contact['account_id']          = 
$record['account_id'];
+                               // Locations info
+                               $loc_id                                         
= $record['key_addr_id'];
+                               if($loc_id)
+                               {
+                                       $contact['locations'][$loc_id]['type']  
        = $record['addr_description'];
+                                       $contact['locations'][$loc_id]['add1']  
        = $record['addr_add1'];
+                                       $contact['locations'][$loc_id]['add2']  
        = $record['addr_add2'];
+                                       $contact['locations'][$loc_id]['add3']  
        = $record['addr_add3'];
+                                       
$contact['locations'][$loc_id]['address']       = $record['addr_address'];
+                                       $contact['locations'][$loc_id]['city']  
        = $record['addr_city'];
+                                       $contact['locations'][$loc_id]['state'] 
        = $record['addr_state'];
+                                       
$contact['locations'][$loc_id]['postal_code']   = $record['addr_postal_code'];
+                                       
$contact['locations'][$loc_id]['country']       = $record['addr_country'];
+                                       
$contact['locations'][$loc_id]['preferred']     = $record['addr_preferred'];
+                               }
+                               // Notes
+                               $note_id                                        
= $record['key_note_id'];
+                               if($note_id)
+                               {
+                                       $contact['notes'][$note_id]['text']     
        = $record['note_text'];
+                                       $contact['notes'][$note_id]['type']     
        = $record['note_description'];
+                               }
+                               // Communcation media fields
+                               if($record['comm_data'])
+                               {
+                                       $comm_descr                             
= $record['comm_description'];
+                                       $contact[$comm_descr]                   
= $record['comm_data'];
+                                       $contact['comm_type'][$comm_descr]      
= $record['comm_type_description'];
+                               }
+                               // Other fields
+                               if($record['other_value'])
+                               {
+                                       $contact[$record['other_name']]         
= $record['other_value'];
+                               }
+                       }
+                       return $contact;
+               }
                
                /*************************************************************\
***************
*** 1704,1709 ****
--- 1742,1769 ----
                        return $this->search_catalog('addr_description', 
$description, 'addr_type_id', 'addr_type');
                }
+ 
+               /**
+               * Search location id in location catalog
+               *
+               * @param integer $id The location id to find
+               * @return string The description of id
+               */
+               function search_note_type_id($id)
+               {
+                       return $this->search_catalog('note_type_id', $id, 
'note_description', 'note_type');
+               }
                
                /**
+               * Search location type in location catalog
+               *
+               * @param string $description The location description to find
+               * @return integer The id of description
+               */
+               function search_note_type($description)
+               {
+                       return $this->search_catalog('note_description', 
$description, 'note_type_id', 'note_type');
+               }
+ 
+               /**
                * Search communication type id in communications catalog
                *
***************
*** 2246,2250 ****
                * @param string $type Contact type
                */
!               function delete($cid, $type='')
                {
                        $type_id = ($type)? $type : 
$this->get_type_contact($cid);
--- 2306,2310 ----
                * @param string $type Contact type
                */
!               function delete($cid, $type='', $action=PHPGW_SQL_RUN_SQL)
                {
                        $type_id = ($type)? $type : 
$this->get_type_contact($cid);
***************
*** 2275,2279 ****
                        foreach ($entity_keys as $key)
                        {
!                               $this->_delete(sql_criteria::_equal($key, 
$cid), PHPGW_SQL_RUN_SQL);
                        }
                        $this->transaction_end();
--- 2335,2339 ----
                        foreach ($entity_keys as $key)
                        {
!                               $this->_delete(sql_criteria::_equal($key, 
$cid), $action);
                        }
                        $this->transaction_end();
***************
*** 3275,3285 ****
                }
  
-               function update_single_extra_field($id, $name, $value)
-               {
-                       $other = CreateObject('phpgwapi.contact_others');
-                       $criteria = 
sql_criteria::token_and(sql_criteria::_equal('other_name', $name), 
sql_criteria::_equal('contact_id', $id));
-                       $other->update($id, array('other_value' => $value), 
$criteria);
-               }
- 
                function is_contact($account_id)
                {
--- 3335,3338 ----
***************
*** 3370,3384 ****
                        
                        $person = $this->get_persons(array('person_id',
!                                                                               
                'per_first_name',
!                                                                               
                'per_last_name',
!                                                                               
                //'fn', //'CONCAT( IFNULL( CONCAT(first_name," "), 
""),last_name)'
!                                                                               
                'per_initials',
!                                                                               
                'per_title',
!                                                                               
                'per_department',
!                                                                               
                'per_pubkey'
!                                                                               
                ),
!                                                                               
                '','','','','',
!                                                                               
                array('contact_id', $id, 'equal')
!                                                                               
);
                        
                        $attributes = array();
--- 3423,3437 ----
                        
                        $person = $this->get_persons(array('person_id',
!                                                          'per_first_name',
!                                                          'per_last_name',
!                                                          //'fn', //'CONCAT( 
IFNULL( CONCAT(first_name," "), ""),last_name)'
!                                                          'per_initials',
!                                                          'per_title',
!                                                          'per_department',
!                                                          'per_pubkey'
!                                                            ),
!                                                    '','','','','',
!                                                    array('contact_id', $id, 
'equal')
!                               );
                        
                        $attributes = array();





reply via email to

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