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.2


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php, 1.17.2.2.2.20, 1.17.2.2.2.21 class.contact_person.inc.php, 1.1.2.7, 1.1.2.8 class.sql_builder.inc.php, 1.1.2.10, 1.1.2.11
Date: Tue, 14 Oct 2003 06:24:59 +0000

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.contacts_sql.inc.php class.contact_person.inc.php 
        class.sql_builder.inc.php 
Log Message:
various fixes from eald


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.20
retrieving revision 1.17.2.2.2.21
diff -C2 -d -r1.17.2.2.2.20 -r1.17.2.2.2.21
*** class.contacts_sql.inc.php  11 Oct 2003 08:22:54 -0000      1.17.2.2.2.20
--- class.contacts_sql.inc.php  14 Oct 2003 06:24:57 -0000      1.17.2.2.2.21
***************
*** 77,88 ****
                var $contact_fields = array('showable' =>
                                                array(
!                                               //      'name'                  
=> 'full name',
!                                                       'per_first_name'        
=> 'first name', 
                                                        'per_last_name'         
=> 'last name', 
                                                        'per_middle_name'       
=> 'middle name', 
!                                                       'per_initials'          
=> 'initials', 
!                                                       'per_prefix'            
=> 'prefix', 
!                                                       'per_suffix'            
=> 'suffix', 
!                                                       'per_birthday'          
=> 'birthday', 
                                                        'per_pubkey'            
=> 'public key', 
                                                        'per_title'             
=> 'title', 
--- 77,88 ----
                var $contact_fields = array('showable' =>
                                                array(
!                                                       'per_full_name'         
=> 'full name',
!                                                       'per_first_name'        
=> 'first name',
                                                        'per_last_name'         
=> 'last name', 
                                                        'per_middle_name'       
=> 'middle name', 
!                                                       'per_initials'          
=> 'initials',
!                                                       'per_prefix'            
=> 'prefix',
!                                                       'per_suffix'            
=> 'suffix',
!                                                       'per_birthday'          
=> 'birthday',
                                                        'per_pubkey'            
=> 'public key', 
                                                        'per_title'             
=> 'title', 
***************
*** 444,448 ****
  
                                 'key_cat_id'           => 
array('phpgwapi.contact_categories', '13'));
!               
                //'parent_id'           => array('categories_parent', '14'));
  
--- 444,485 ----
  
                                 'key_cat_id'           => 
array('phpgwapi.contact_categories', '13'));
!               var $import_export_fields = array('contact_id', 
!                                               'per_full_name',
!                                               'per_first_name',
!                                               'per_middle_name',
!                                               'per_middle_name',
!                                               'per_suffix',
!                                               'per_prefix',
!                                               'per_birthday',
!                                               'per_pubkey',
!                                               'per_title',
!                                               'per_departament',
!                                               'per_initials',
!                                               'per_sound',
!                                               'per_active',
!                                               'per_createon',
!                                               'per_createby',
!                                               'per_modby',
!                                               'per_modon',
!                                               'account_id',
!                                               'key_addr_id',
!                                               'addr_descritpion',
!                                               'addr_add1',
!                                               'addr_add2',
!                                               'addr_add3',
!                                               'addr_address',
!                                               'addr_city',
!                                               'addr_city',
!                                               'addr_country',
!                                               'addr_preferred',
!                                               'comm_descr',
!                                               'comm_type',
!                                               'comm_data',
!                                               'key_note_id',
!                                               'note_text',
!                                               'note_description',
!                                               'other_value',
!                                               'other_name');
! 
                //'parent_id'           => array('categories_parent', '14'));
  
***************
*** 607,610 ****
--- 644,648 ----
                {
                        $this->request($fields);
+                       $this->request(array('contact_id'));
                        $this->criteria(array('contact_id' => $id));
                        $sql_select = $this->get_query($action, __LINE__, 
__FILE__);
***************
*** 615,619 ****
                        $return_fields = &$this->db->Record;
  
!                       $return_extra_fields = 
read_extra_fields($return_fields['contact_id']);
  
                        return array_merge($return_fields,$return_extra_fields);
--- 653,657 ----
                        $return_fields = &$this->db->Record;
  
!                       $return_extra_fields = read_extra_fields(intval($id));
  
                        return array_merge($return_fields,$return_extra_fields);
***************
*** 697,730 ****
  
                /**
                * This function try to be a comprensive way to get data from 
contacts<br /> convert the contacts database output on a multidimensional 
array<br />
                */
!               function organzation_complete_data($field_list)
                {
!                       //Get comms that want to search
!                       $comms = $field_list['comm_media'];
!                       unset($field_list['comm_media']);
! 
!                       $locations = $field_list['locations'];
!                       unset($field_list['locations']);
! 
!                       if(array_key_exists($field_list))
                        {
!                               $categories = array('categories');
                        }
                        else
                        {
!                               $categories = array();
!                       }
!                       //Get common information from database
!                       foreach($comms as $media)
!                       {
!                                       $comms_search[] = 
$this->search_comm_descr($media);
                        }
!                       if (count($comms_search) > 0)
                        {
!                               $comms_data = array('comm_data', 'comm_descr');
!                               //foreach ($comms_search[])
                        }
!                       $this->request(array_merge($comm_data, $field_list, 
$categories));
                }
  
--- 735,812 ----
  
                /**
+               * 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'];
!                               $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'];
!                               $contact['notes'][$note_id]['text']             
= $record['note_text'];
!                               $contact['notes'][$note_id]['type']             
= $record['note_description'];
!                               // Communcation media fields
!                               $contact[$record['comm_descr']]                 
= $record['comm_data'];
!                               $contact['comm_type'][$record['comm_descr']]    
= $record['comm_type'];
!                               // Other fields
!                               $contact[$record['other_name']]                 
= $record['other_value'];
                        }
!                       return $contact;
                }
  
***************
*** 918,922 ****
                        $this->request($data);
                        $this->criteria(array('contact_id' => $contact_id));
- 
                        if($get_org==True)
                        {
--- 1000,1003 ----
***************
*** 1022,1028 ****
                                      'access',
                                      'cat_id',
!                                     'org_name',
!                                     'organizations');
!                       $this->request($data);
                        $this->criteria(array('contact_id' => $contact_id));
                        return $this->get_query($action, __LINE__, __FILE__);
--- 1103,1107 ----
                                      'access',
                                      'cat_id',
!                                     'org_name');
                        $this->criteria(array('contact_id' => $contact_id));
                        return $this->get_query($action, __LINE__, __FILE__);
***************
*** 2096,2100 ****
                                foreach ($contacts as $row)
                                {
!                                       $row['contact_id'];
                                }
                        }
--- 2175,2179 ----
                                foreach ($contacts as $row)
                                {
!                                       $this->delete($row['contact_id']);
                                }
                        }
***************
*** 2261,2270 ****
                        $this->request('addr_address');
                        $this->criteria(array('addr_contact_id' => 
$contact_id));
!                       $this->db->query($this->get_sql(), __LINE__, __FILE__);
!                       while ($this->db->next_record())
!                       {
!                               $addr = &$this->db->Record;
!                       }
!                       return $addr;                   
                }
                
--- 2340,2344 ----
                        $this->request('addr_address');
                        $this->criteria(array('addr_contact_id' => 
$contact_id));
!                       return $this->get_query(PHPGW_SQL_RUN_SQL, __LINE__, 
__FILE__);
                }
                
***************
*** 2358,2362 ****
                        $this->request('contact_id');
                        $this->criteria(array('owner' => $owner));
!                       return 
$this->get_query($action=PHPGW_SQL_RUN_SQL,__LINE__, __FILE__);
                }
  
--- 2432,2436 ----
                        $this->request('contact_id');
                        $this->criteria(array('owner' => $owner));
!                       return $this->get_query($action,__LINE__, __FILE__);
                }
  
***************
*** 2534,2547 ****
                function get_persons_by_org($org_id)
                {
!                       $this->request('op_person_id');
!                       $this->criteria(array('op_org_id' => $org_id));
!                       $sql = $this->get_sql();
!                       $this->db->query($sql, __LINE__, __FILE__);
!                       while ($this->db->next_record())
!                       {
!                               $persons = $this->db->f(0);
!                       }
!                       
!                       return $persons;
                }
  
--- 2608,2614 ----
                function get_persons_by_org($org_id)
                {
!                       $this->request(array('organizations', 'person_id', 
'per_full_name', 'per_first_name', 'per_middle_name', 'per_last_name'));
!                       $this->criteria(array('org_id' => $org_id));
!                       return $this->get_query(PHPGW_SQL_RETURN_SQL, __LINE__, 
__FILE__);
                }
  

Index: class.contact_person.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/phpgwapi/inc/Attic/class.contact_person.inc.php,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** class.contact_person.inc.php        9 Oct 2003 00:25:20 -0000       1.1.2.7
--- class.contact_person.inc.php        14 Oct 2003 06:24:57 -0000      1.1.2.8
***************
*** 155,159 ****
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
!                                'fn'                   => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
--- 155,159 ----
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
!                                'fn'                   => array('select'       
=> 'full_name',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',

Index: class.sql_builder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.sql_builder.inc.php,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** class.sql_builder.inc.php   9 Oct 2003 00:25:21 -0000       1.1.2.10
--- class.sql_builder.inc.php   14 Oct 2003 06:24:57 -0000      1.1.2.11
***************
*** 190,193 ****
--- 190,194 ----
                        $this->entity_to_center($entity_far_away,
                                                $entity_distance);
+                       $this->ldebug('sort_by_distances', 'entering to while, 
all the add_path must be reverse from here', 'msg');
                        while(!($this->last_distance()))
                        {
***************
*** 1191,1199 ****
                function ldebug($myfoo, $data, $type = 'string', $err = '')
                {
! //                    if (!((($myfoo != 'entity_to_center') xor
! //                           ($myfoo != 'sort_by_distances')) xor
! //                          ($myfoo == 'add_path')) xor
! //                        ($myfoo == ''))
! //                    if ($myfoo != 'SQL')
  //                    {
                        return;
--- 1192,1200 ----
                function ldebug($myfoo, $data, $type = 'string', $err = '')
                {
! //                    if (!((($myfoo != 'sort_by_distances') xor
! //                           ($myfoo != 'entity_to_center')) xor
! //                          ($myfoo == 'add_path')) xor
! //                        ($myfoo == ''))
! //                    if ($myfoo != 'get_join')
  //                    {
                        return;
***************
*** 1222,1226 ****
                                {
                                        $output .= "&nbsp;&nbsp;-$vari = ";
!                                       $output .= var_export($value)."\n<br>";
                                }
                                break;
--- 1223,1227 ----
                                {
                                        $output .= "&nbsp;&nbsp;-$vari = ";
!                                       $output .= var_dump($value)."\n<br>";
                                }
                                break;





reply via email to

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