phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.contact_org.inc.php, 1.1.2.4, 1.1.


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] phpgwapi/inc class.contact_org.inc.php, 1.1.2.4, 1.1.2.5 class.contact_org_person.inc.php, 1.1.2.5, 1.1.2.6 class.contact_person.inc.php, 1.1.2.6, 1.1.2.7 class.contacts_sql.inc.php, 1.17.2.2.2.18, 1.17.2.2.2.19 class.sql_builder.inc.php, 1.1.2.9, 1.1.2.10 class.sql_entity.inc.php, 1.1.2.8, 1.1.2.9
Date: Thu, 09 Oct 2003 00:25:33 +0000

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.contact_org.inc.php class.contact_org_person.inc.php 
        class.contact_person.inc.php class.contacts_sql.inc.php 
        class.sql_builder.inc.php class.sql_entity.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.18
retrieving revision 1.17.2.2.2.19
diff -C2 -d -r1.17.2.2.2.18 -r1.17.2.2.2.19
*** class.contacts_sql.inc.php  6 Oct 2003 02:41:34 -0000       1.17.2.2.2.18
--- class.contacts_sql.inc.php  9 Oct 2003 00:25:20 -0000       1.17.2.2.2.19
***************
*** 267,328 ****
                                 'sel_cat_id'           => 
array('phpgwapi.contact_central', '0'),
                                 
!                                'org_id'               => 
array('phpgwapi.contact_org', '2'),
!                                'org_name'             => 
array('phpgwapi.contact_org', '2'),
!                                'org_active'           => 
array('phpgwapi.contact_org', '2'),
!                                'org_parent'           => 
array('phpgwapi.contact_org', '2'),
!                                'org_creaton'          => 
array('phpgwapi.contact_org', '2'),
!                                'org_creatby'          => 
array('phpgwapi.contact_org', '2'),
!                                'org_modon'            => 
array('phpgwapi.contact_org', '2'),
!                                'org_modby'            => 
array('phpgwapi.contact_org', '2'),
!                                'name'                 => 
array('phpgwapi.contact_org', '2'),
!                                'count_orgs'           => 
array('phpgwapi.contact_org', '2'),
!                                'people'               => 
array('phpgwapi.contact_org', '2'),
  
-                                'person_id'            => 
array('phpgwapi.contact_person', '2'),
-                                'per_full_name'        => 
array('phpgwapi.contact_person', '2'),
-                                'per_first_name'       => 
array('phpgwapi.contact_person', '2'),
-                                'per_last_name'        => 
array('phpgwapi.contact_person', '2'),
-                                'per_middle_name'      => 
array('phpgwapi.contact_person', '2'),
-                                'per_prefix'           => 
array('phpgwapi.contact_person', '2'),
-                                'per_suffix'           => 
array('phpgwapi.contact_person', '2'),
-                                'per_birthday'         => 
array('phpgwapi.contact_person', '2'),
-                                'per_pubkey'           => 
array('phpgwapi.contact_person', '2'),
-                                'per_title'            => 
array('phpgwapi.contact_person', '2'),
-                                'per_department'       => 
array('phpgwapi.contact_person', '2'),
-                                'per_initials'         => 
array('phpgwapi.contact_person', '2'),
-                                'per_sound'            => 
array('phpgwapi.contact_person', '2'),
-                                'per_active'           => 
array('phpgwapi.contact_person', '2'),
-                                'per_creaton'          => 
array('phpgwapi.contact_person', '2'),
-                                'per_creatby'          => 
array('phpgwapi.contact_person', '2'),
-                                'per_modon'            => 
array('phpgwapi.contact_person', '2'),
-                                'per_modby'            => 
array('phpgwapi.contact_person', '2'),
-                                'per_name'             => 
array('phpgwapi.contact_person', '2'),
-                                'account_id'           => 
array('phpgwapi.contact_person', '2'),
-                                'count_persons'        => 
array('phpgwapi.contact_person', '2'),
-                                'organizations'        => 
array('phpgwapi.contact_person', '2'),
                                 //deprecated start
!                                'fn'                   => 
array('phpgwapi.contact_person', '2'),
!                                'n_given'              => 
array('phpgwapi.contact_person', '2'),
!                                'n_family'             => 
array('phpgwapi.contact_person', '2'),
!                                'n_middle'             => 
array('phpgwapi.contact_person', '2'),
!                                'n_prefix'             => 
array('phpgwapi.contact_person', '2'),
!                                'n_suffix'             => 
array('phpgwapi.contact_person', '2'),
!                                'sound'                => 
array('phpgwapi.contact_person', '2'),
!                                'bday'                 => 
array('phpgwapi.contact_person', '2'),
!                                'note'                 => 
array('phpgwapi.contact_person', '2'),
!                                'tz'                   => 
array('phpgwapi.contact_person', '2'),
!                                'geo'                  => 
array('phpgwapi.contact_person', '2'),
!                                'url'                  => 
array('phpgwapi.contact_person', '2'),
!                                'pubkey'               => 
array('phpgwapi.contact_person', '2'),
!                                'org_unit'             => 
array('phpgwapi.contact_person', '2'),
!                                'title'                => 
array('phpgwapi.contact_person', '2'),
                                 //deprecated end
  
!                                'my_org_id'            => 
array('phpgwapi.contact_org_person', '1'),
!                                'my_person_id'         => 
array('phpgwapi.contact_org_person', '1'),
!                                'my_addr_id'           => 
array('phpgwapi.contact_org_person', '1'),
!                                'my_preferred'         => 
array('phpgwapi.contact_org_person', '1'),
!                                'my_creaton'           => 
array('phpgwapi.contact_org_person', '1'),
!                                'my_creatby'           => 
array('phpgwapi.contact_org_person', '1'),
  
                                 'key_addr_id'          => 
array('phpgwapi.contact_addr', '3'),
--- 267,333 ----
                                 'sel_cat_id'           => 
array('phpgwapi.contact_central', '0'),
                                 
!                                'org_id'               => 
array('phpgwapi.contact_org', '1'),
!                                'org_name'             => 
array('phpgwapi.contact_org', '1'),
!                                'org_active'           => 
array('phpgwapi.contact_org', '1'),
!                                'org_parent'           => 
array('phpgwapi.contact_org', '1'),
!                                'org_creaton'          => 
array('phpgwapi.contact_org', '1'),
!                                'org_creatby'          => 
array('phpgwapi.contact_org', '1'),
!                                'org_modon'            => 
array('phpgwapi.contact_org', '1'),
!                                'org_modby'            => 
array('phpgwapi.contact_org', '1'),
!                                'name'                 => 
array('phpgwapi.contact_org', '1'),
!                                'count_orgs'           => 
array('phpgwapi.contact_org', '1'),
!                                'organizations'        => 
array('phpgwapi.contact_org', '1', array('organizations_person', 
'organizations_org_person')),
!                                'people_org'           => 
array('phpgwapi.contact_org', '1', '', 3),
! 
!                                'person_id'            => 
array('phpgwapi.contact_person', '1'),
!                                'per_full_name'        => 
array('phpgwapi.contact_person', '1'),
!                                'per_first_name'       => 
array('phpgwapi.contact_person', '1'),
!                                'per_last_name'        => 
array('phpgwapi.contact_person', '1'),
!                                'per_middle_name'      => 
array('phpgwapi.contact_person', '1'),
!                                'per_prefix'           => 
array('phpgwapi.contact_person', '1'),
!                                'per_suffix'           => 
array('phpgwapi.contact_person', '1'),
!                                'per_birthday'         => 
array('phpgwapi.contact_person', '1'),
!                                'per_pubkey'           => 
array('phpgwapi.contact_person', '1'),
!                                'per_title'            => 
array('phpgwapi.contact_person', '1'),
!                                'per_department'       => 
array('phpgwapi.contact_person', '1'),
!                                'per_initials'         => 
array('phpgwapi.contact_person', '1'),
!                                'per_sound'            => 
array('phpgwapi.contact_person', '1'),
!                                'per_active'           => 
array('phpgwapi.contact_person', '1'),
!                                'per_creaton'          => 
array('phpgwapi.contact_person', '1'),
!                                'per_creatby'          => 
array('phpgwapi.contact_person', '1'),
!                                'per_modon'            => 
array('phpgwapi.contact_person', '1'),
!                                'per_modby'            => 
array('phpgwapi.contact_person', '1'),
!                                'per_name'             => 
array('phpgwapi.contact_person', '1'),
!                                'account_id'           => 
array('phpgwapi.contact_person', '1'),
!                                'count_persons'        => 
array('phpgwapi.contact_person', '1'),
!                                'people'               => 
array('phpgwapi.contact_person', '1', array('people_org', 'people_org_person')),
!                                'organizations_person' => 
array('phpgwapi.contact_person', '1', '', 3),
  
                                 //deprecated start
!                                'fn'                   => 
array('phpgwapi.contact_person', '1'),
!                                'n_given'              => 
array('phpgwapi.contact_person', '1'),
!                                'n_family'             => 
array('phpgwapi.contact_person', '1'),
!                                'n_middle'             => 
array('phpgwapi.contact_person', '1'),
!                                'n_prefix'             => 
array('phpgwapi.contact_person', '1'),
!                                'n_suffix'             => 
array('phpgwapi.contact_person', '1'),
!                                'sound'                => 
array('phpgwapi.contact_person', '1'),
!                                'bday'                 => 
array('phpgwapi.contact_person', '1'),
!                                'note'                 => 
array('phpgwapi.contact_person', '1'),
!                                'tz'                   => 
array('phpgwapi.contact_person', '1'),
!                                'geo'                  => 
array('phpgwapi.contact_person', '1'),
!                                'url'                  => 
array('phpgwapi.contact_person', '1'),
!                                'pubkey'               => 
array('phpgwapi.contact_person', '1'),
!                                'org_unit'             => 
array('phpgwapi.contact_person', '1'),
!                                'title'                => 
array('phpgwapi.contact_person', '1'),
                                 //deprecated end
  
!                                'my_org_id'            => 
array('phpgwapi.contact_org_person', '2'),
!                                'my_person_id'         => 
array('phpgwapi.contact_org_person', '2'),
!                                'my_addr_id'           => 
array('phpgwapi.contact_org_person', '2'),
!                                'my_preferred'         => 
array('phpgwapi.contact_org_person', '2'),
!                                'my_creaton'           => 
array('phpgwapi.contact_org_person', '2'),
!                                'my_creatby'           => 
array('phpgwapi.contact_org_person', '2'),
!                                'people_org_person'    => 
array('phpgwapi.contact_org_person', '2'),
!                       'organizations_org_person'      => 
array('phpgwapi.contact_org_person', '2'),
  
                                 'key_addr_id'          => 
array('phpgwapi.contact_addr', '3'),
***************
*** 630,633 ****
--- 635,642 ----
                                // get all comms from db
                                $records = $this->get_query(PHPGW_SQL_RUN_SQL, 
__LINE__, __FILE__);
+                               if(count($records) == 0)
+                               {
+                                       return;
+                               }
                                foreach ($records as $comm)
                                {
***************
*** 732,736 ****
                function field_exists($id,$field_name)
                {
!                       $this->recuest('other_count_row');
                        $this->criteria(array('other_contact_id' => $id));
                        $this->criteria(array('other_name' => $field_name));
--- 741,745 ----
                function field_exists($id,$field_name)
                {
!                       $this->request('other_count_row');
                        $this->criteria(array('other_contact_id' => $id));
                        $this->criteria(array('other_name' => $field_name));
***************
*** 837,840 ****
--- 846,854 ----
                {
                        $this->request($fields);
+                       if(in_array('org_name', $fields))
+                       {
+                               $this->request(array('people'));
+                       }
+ 
                        if ($criteria != '')
                        {
***************
*** 901,911 ****
                                      'per_department',
                                      'per_initials',
!                                     'per_sound');
!                       
! //                                  'org_name',
! //                                  'people');
                        $this->request($data);
! //                    $this->criteria(array('contact_id' => $contact_id, 
'my_preferred' => 'Y'));
!                       $this->criteria(array('contact_id' => $contact_id));
                        return $this->get_query($action, __LINE__, __FILE__);
                }
--- 915,923 ----
                                      'per_department',
                                      'per_initials',
!                                     'per_sound',
!                                     'org_name',
!                                     'people');
                        $this->request($data);
!                       $this->criteria(array('contact_id' => $contact_id, 
'my_preferred' => 'Y'));
                        return $this->get_query($action, __LINE__, __FILE__);
                }
***************
*** 945,948 ****
--- 957,966 ----
                {
                        $this->request($fields);
+                       $person_fields = array('per_full_name', 
'per_first_name', 'per_last_name');
+                       if(array_intersect($person_fields, $fields) > 0)
+                       {
+                               $this->request(array('organizations'));
+                       }
+ 
                        if ($criteria != '')
                        {
***************
*** 1000,1004 ****
                                      'access',
                                      'cat_id',
!                                     'org_name');
                        $this->request($data);
                        $this->criteria(array('contact_id' => $contact_id));
--- 1018,1023 ----
                                      'access',
                                      'cat_id',
!                                     'org_name',
!                                     'organizations');
                        $this->request($data);
                        $this->criteria(array('contact_id' => $contact_id));

Index: class.contact_org_person.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/phpgwapi/inc/Attic/class.contact_org_person.inc.php,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** class.contact_org_person.inc.php    5 Oct 2003 07:35:18 -0000       1.1.2.5
--- class.contact_org_person.inc.php    9 Oct 2003 00:25:20 -0000       1.1.2.6
***************
*** 52,56 ****
                                                         'sort'         => '',
                                                         'field'        => 
'created_by',
!                                                        'type'         => 
'integer'));
  
                function contact_org_person ($ali = '', $field = '', $criteria 
= '')
--- 52,58 ----
                                                         'sort'         => '',
                                                         'field'        => 
'created_by',
!                                                        'type'         => 
'integer'),
!                       'people_org_person'     => array('select'       => 
'relink_person'),
!               'organizations_org_person'      => array('select'       => 
'relink_org'));
  
                function contact_org_person ($ali = '', $field = '', $criteria 
= '')
***************
*** 65,72 ****
                                $this->add_criteria($criteria);
                        }
-                       $this->set_ilinks('my_org_id', 
'phpgwapi.contact_org','org_id');
-                       $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id');
                }
!               
                function criteria_my_org_id($element)
                {
--- 67,86 ----
                                $this->add_criteria($criteria);
                        }
                }
! 
!               // When we want people
!               function relink_person()
!               {
!                       $this->set_elinks('my_org_id', 
'phpgwapi.contact_org','org_id');
!                       $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id', PHPGW_SQL_LAZY_KEY);
!               }
! 
!               // When we want organizations
!               function relink_org()
!               {
!                       $this->set_elinks('my_person_id', 
'phpgwapi.contact_person','person_id');
!                       $this->set_ilinks('my_org_id', 
'phpgwapi.contact_org','org_id', PHPGW_SQL_LAZY_KEY);
!               }
! 
                function criteria_my_org_id($element)
                {
***************
*** 81,85 ****
                        $new_criteria = sql_criteria::equal($field, 
$element['value']);
                        $this->_add_criteria($new_criteria);
-                       $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id');
                }
  
--- 95,98 ----
***************
*** 87,91 ****
                {
                        $this->_add_field(array('field' => 'my_org_id', 
'real_field' => 'org_id'));
-                       $this->set_ilinks('my_org_id', 
'phpgwapi.contact_org','org_id');
                }
                
--- 100,103 ----
***************
*** 93,97 ****
                {
                        $this->_add_field(array('field' => 'my_person_id', 
'real_field' => 'person_id'));
-                       $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id');
                }
  
--- 105,108 ----

Index: class.contact_person.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/phpgwapi/inc/Attic/class.contact_person.inc.php,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** class.contact_person.inc.php        5 Oct 2003 11:31:43 -0000       1.1.2.6
--- class.contact_person.inc.php        9 Oct 2003 00:25:20 -0000       1.1.2.7
***************
*** 256,260 ****
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'person_id'),
!                                'organizations'        => array('select'       
=>'unlink_person'));
  
                function contact_person ($ali = '', $field = '', $criteria =    
'')
--- 256,261 ----
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'person_id'),
!                                'organizations_person' => array('select'       
=> 'unlink_person'),
!                                'people'               => array('select'       
=> 'relink_org_person'));
  
                function contact_person ($ali = '', $field = '', $criteria =    
'')
***************
*** 269,288 ****
                                $this->add_criteria($criteria);
                        }
-                       $this->set_elinks('person_id', 
'phpgwapi.contact_accounts', 'account_person_id');
-                       $this->set_elinks('person_id', 
'phpgwapi.contact_org_person', 'my_person_id');
                        $this->set_ilinks('person_id', 
'phpgwapi.contact_central','contact_id', PHPGW_SQL_REQUIRED_KEY);
                }
  
                function criteria_person_id($element)
                {
!                       $field = $this->put_alias($element['real_field']);
!                       if(is_array($element['value']))
!                       {
!                               $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
!                       }
!                       else
!                       {
!                               
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
!                       }
                }
  
--- 270,281 ----
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('person_id', 
'phpgwapi.contact_central','contact_id', PHPGW_SQL_REQUIRED_KEY);
+                       $this->set_elinks('person_id', 
'phpgwapi.contact_accounts', 'account_person_id');
+                       $this->set_ilinks('person_id', 
'phpgwapi.contact_org_person','my_person_id', PHPGW_SQL_LAZY_KEY);
                }
  
                function criteria_person_id($element)
                {
!                       $this->_add_criteria($this->index_criteria($element));
                }
  
***************
*** 300,306 ****
--- 293,307 ----
                }
  
+               // When we want organizations
                function unlink_person()
                {
                        unset($this->ilink['phpgwapi.contact_central']);
+               }
+ 
+               // When we want people
+               function relink_org_person()
+               {
+                       unset($this->ilink['phpgwapi.contact_org_person']);
+                       $this->set_elinks('person_id', 
'phpgwapi.contact_org_person','my_person_id');
                }
        }

Index: class.sql_builder.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.sql_builder.inc.php,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** class.sql_builder.inc.php   4 Oct 2003 23:42:36 -0000       1.1.2.9
--- class.sql_builder.inc.php   9 Oct 2003 00:25:21 -0000       1.1.2.10
***************
*** 23,26 ****
--- 23,28 ----
        define(PHPGW_SQL_ENTITY_NAME, 0);
        define(PHPGW_SQL_DISTANCE, 1);
+       define(PHPGW_SQL_CHILD_FIELDS, 2);
+       define(PHPGW_SQL_CHANGE_DISTANCE, 3);
        define(PHPGW_SQL_LAZY_KEY, 1);
        define(PHPGW_SQL_REQUIRED_KEY, 2);
***************
*** 89,92 ****
--- 91,103 ----
                function get_distance($field)
                {
+                       $entity = $this->map[$field][PHPGW_SQL_ENTITY_NAME];
+                       if(is_array($this->distance))
+                       {
+                               $distance = array_keys($this->distance);
+                               if(in_array($entity, $distance))
+                               {
+                                       return $this->distance[$entity];
+                               }
+                       }
                        return $this->map[$field][PHPGW_SQL_DISTANCE];
                }
***************
*** 169,172 ****
--- 180,184 ----
                        $entity_distance = current($this->distance);
                        $entity_far_away = key($this->distance);
+                       $this->ldebug('sort_by_distances', 'entering to 
sort_by_distance', 'msg');
                        $this->add_path($entity_far_away);
                        $this->ldebug('sort_by_distances',
***************
*** 241,252 ****
                                        //We found a good one
                                        $this->ldebug('entity_to_center',
!                                                     "dist $dist < 
min_distance $min_distance",
                                                      'msg');
                                        $min_distance = $dist;
                                        $near_entity = $this->ent_name($field);
-                                       $this->ldebug('entity_to_center',
-                                                                 array('entity 
founded' => $near_entity));
                                }
                        }
                        $this->instance_entity($near_entity);
                        $this->add_path($near_entity, $reverse);
--- 253,263 ----
                                        //We found a good one
                                        $this->ldebug('entity_to_center',
!                                                     "Actual Distance $dist < 
Min Distance $min_distance",
                                                      'msg');
                                        $min_distance = $dist;
                                        $near_entity = $this->ent_name($field);
                                }
                        }
+ 
                        $this->instance_entity($near_entity);
                        $this->add_path($near_entity, $reverse);
***************
*** 505,510 ****
                function find_link($entity, $prev_entity, $alias)
                {
!                       $this->ldebug('find_link', array('prev_entity' => 
$prev_entity,
!                                                                               
         'entity' => $entity));
                        if($return_link = $this->get_link($entity, 
$prev_entity))
                        {
--- 516,520 ----
                function find_link($entity, $prev_entity, $alias)
                {
!                       $this->ldebug('find_link', array('prev_entity' => 
$prev_entity, 'entity' => $entity));
                        if($return_link = $this->get_link($entity, 
$prev_entity))
                        {
***************
*** 518,532 ****
                                $return_link['prev_entity'] = 
$this->central_entity;
                                $return_link['alias'] = 
$this->path[$this->central_entity]['alias'];
!                               $this->ldebug('find_link', array('return_link' 
=> $return_link),
!                                                         'dump');
                        }
                        else
!                       {
                                // Maybe here is one amazing research about the 
nodes
                                // entities, but not for this moment.
                                return;
                        }
!                       $this->ldebug('find_link', array('return_link' => 
$return_link),
!                                                 'dump');
                        return $return_link;
                }
--- 528,540 ----
                                $return_link['prev_entity'] = 
$this->central_entity;
                                $return_link['alias'] = 
$this->path[$this->central_entity]['alias'];
!                               $this->ldebug('find_link', array('return_link' 
=> $return_link), 'dump');
                        }
                        else
!                       {
                                // Maybe here is one amazing research about the 
nodes
                                // entities, but not for this moment.
                                return;
                        }
!                       $this->ldebug('find_link', array('return_link' => 
$return_link), 'dump');
                        return $return_link;
                }
***************
*** 534,539 ****
                function get_link($entity, $test_entity)
                {                       
!                       $this->ldebug('get_link', array('entity' => $entity,
!                                                                               
        'test_entity' => $test_entity));
                        if ($entity_link = 
$this->entities[$entity]->get_ilink($test_entity))
                        {
--- 542,546 ----
                function get_link($entity, $test_entity)
                {                       
!                       $this->ldebug('get_link', array('entity' => $entity, 
'test_entity' => $test_entity));
                        if ($entity_link = 
$this->entities[$entity]->get_ilink($test_entity))
                        {
***************
*** 1082,1085 ****
--- 1089,1107 ----
                function _request($data)
                {
+                       /**
+                       * This the NEW parent/child fields
+                       * implementation, I hope this solve my
+                       * problems, but this don't remove that exist
+                       * a design problem with the n-n relations and
+                       * 1-1.
+                       */
+                       if (is_array($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) 
&& count($this->map[$data][PHPGW_SQL_CHILD_FIELDS]) > 0)
+                       {
+                               
foreach($this->map[$data][PHPGW_SQL_CHILD_FIELDS] as $child)
+                               {
+                                       $this->_request($child);
+                               }
+                       }
+ 
                        $ent = $this->get_entity($data);
                        $this->ldebug('_request', array('Data' => $data,
***************
*** 1093,1096 ****
--- 1115,1122 ----
                                $this->raise_error($data);
                        }
+                       if(intval($this->map[$data][PHPGW_SQL_CHANGE_DISTANCE]) 
!= 0)
+                       {
+                               $this->distance[$ent] = 
$this->map[$data][PHPGW_SQL_CHANGE_DISTANCE];
+                       }
                }
  
***************
*** 1165,1173 ****
                function ldebug($myfoo, $data, $type = 'string', $err = '')
                {
! //                    if (!((($myfoo != 'entity_to_center') xor
! //                           ($myfoo != 'sort_by_distances')) xor
! //                          ($myfoo == '')) xor
! //                        ($myfoo == ''))
! //                    if ($myfoo != 'sort_by_distances')
  //                    {
                        return;
--- 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;
***************
*** 1196,1200 ****
                                {
                                        $output .= "&nbsp;&nbsp;-$vari = ";
!                                       $output .= var_dump($value, 
True)."\n<br>";
                                }
                                break;
--- 1222,1226 ----
                                {
                                        $output .= "&nbsp;&nbsp;-$vari = ";
!                                       $output .= var_export($value)."\n<br>";
                                }
                                break;

Index: class.sql_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.sql_entity.inc.php,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** class.sql_entity.inc.php    2 Oct 2003 22:23:54 -0000       1.1.2.8
--- class.sql_entity.inc.php    9 Oct 2003 00:25:21 -0000       1.1.2.9
***************
*** 365,369 ****
                        {
                                $value = $this->cast($element['value'], 
$element['field']);
!                               return sql_criteria::equal($field, 
$element['value']);
                        }
                }
--- 365,369 ----
                        {
                                $value = $this->cast($element['value'], 
$element['field']);
!                               return sql_criteria::equal($field, $value);
                        }
                }

Index: class.contact_org.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.contact_org.inc.php,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** class.contact_org.inc.php   4 Oct 2003 23:42:36 -0000       1.1.2.4
--- class.contact_org.inc.php   9 Oct 2003 00:25:20 -0000       1.1.2.5
***************
*** 83,87 ****
                                                         'sort'         => '',
                                                         'field'        => ''),
!                                'people'       => array('select'       => 
'unlink_org'));
                
                function contact_org ($ali = '', $field = '', $criteria =       
'')
--- 83,88 ----
                                                         'sort'         => '',
                                                         'field'        => ''),
!                                'people_org'   => array('select'       => 
'unlink_org'),
!                                'organizations'=> array('select'       => 
'relink_org_person'));
                
                function contact_org ($ali = '', $field = '', $criteria =       
'')
***************
*** 96,101 ****
                                $this->add_criteria($criteria);
                        }
-                       $this->set_elinks('org_id', 
'phpgwapi.contact_org_person', 'my_org_id');
                        $this->set_ilinks('org_id', 
'phpgwapi.contact_central','contact_id', PHPGW_SQL_REQUIRED_KEY);
                }
  
--- 97,102 ----
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('org_id', 
'phpgwapi.contact_central','contact_id', PHPGW_SQL_REQUIRED_KEY);
+                       $this->set_ilinks('org_id', 
'phpgwapi.contact_org_person','my_org_id', PHPGW_SQL_LAZY_KEY);
                }
  
***************
*** 118,124 ****
--- 119,133 ----
                }
  
+               // From people_org, when we want people
                function unlink_org()
                {
                        unset($this->ilink['phpgwapi.contact_central']);
+               }
+ 
+               // Run when ask organizations
+               function relink_org_person()
+               {
+                       unset($this->ilink['phpgwapi.contact_org_person']);
+                       $this->set_elinks('org_id', 
'phpgwapi.contact_org_person', 'my_org_id');
                }
        }





reply via email to

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