phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.accounts_shared.inc.php, 1.48.2.2.


From: Alejandro Borges (lex) <address@hidden>
Subject: [Phpgroupware-cvs] phpgwapi/inc class.accounts_shared.inc.php, 1.48.2.2.2.18, 1.48.2.2.2.19 class.contacts_sql.inc.php, 1.17.2.2.2.25, 1.17.2.2.2.26
Date: Sun, 26 Oct 2003 03:24:45 +0000

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.accounts_shared.inc.php class.contacts_sql.inc.php 
Log Message:
Addressmaster fixup.... one more is pending, this one is known to crash apache 
in large pgsql updates from 14


Index: class.accounts_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.accounts_shared.inc.php,v
retrieving revision 1.48.2.2.2.18
retrieving revision 1.48.2.2.2.19
diff -C2 -d -r1.48.2.2.2.18 -r1.48.2.2.2.19
*** class.accounts_shared.inc.php       23 Oct 2003 15:25:33 -0000      
1.48.2.2.2.18
--- class.accounts_shared.inc.php       26 Oct 2003 03:24:43 -0000      
1.48.2.2.2.19
***************
*** 118,121 ****
--- 118,133 ----
                }
  
+               function set_addressmaster($master)
+               {
+                       $contacts = CreateObject('phpgwapi.contacts', False);
+                       
$contacts->change_owner($GLOBALS['phpgw_info']['server']['addressmaster'], 
$master);
+ 
+                       $config = CreateObject('phpgwapi.config');
+                       $config->appname = 'phpgwapi';
+                       $config->read_repository();
+                       $config->value('addressmaster',$master);
+                       $config->save_repository();
+               }
+ 
                function is_expired()
                {

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.25
retrieving revision 1.17.2.2.2.26
diff -C2 -d -r1.17.2.2.2.25 -r1.17.2.2.2.26
*** class.contacts_sql.inc.php  21 Oct 2003 01:57:53 -0000      1.17.2.2.2.25
--- class.contacts_sql.inc.php  26 Oct 2003 03:24:43 -0000      1.17.2.2.2.26
***************
*** 452,456 ****
                                                'per_first_name',
                                                'per_middle_name',
!                                               'per_middle_name',
                                                'per_suffix',
                                                'per_prefix',
--- 452,456 ----
                                                'per_first_name',
                                                'per_middle_name',
!                                               'per_last_name',
                                                'per_suffix',
                                                'per_prefix',
***************
*** 486,489 ****
--- 486,514 ----
                                                'other_name');
  
+               var $import_fields = array('contact_id' => 'contact id',
+                                          'first_name' => 'first name',
+                                          'last_name'  => 'last name',
+                                          'middle_name'=> 'middle name',
+                                          'sufix'      => 'sufix',
+                                          'prefix'     => 'prefix',
+                                          'birthday'   => 'birthday',
+                                          'pubkey'     => 'public key',
+                                          'title'      => 'title',
+                                          'department' => 'department',
+                                          'initials'   => 'initials',
+                                          'sound'      => 'sound',
+                                          'active'     => 'active',
+                                          'organizations' => 'organizations',
+                                          'categories' => 'Categories',
+                                          'locations'  => array('add1' => 
'Address 1',
+                                                                'add2' => 
'Address 2',
+                                                                'add3' => 
'Address 3',
+                                                                'city' => 
'City',
+                                                                'state'=> 
'State',
+                                                                'postal_code' 
=> 'Postal code',
+                                                                'country'      
=> 'Country',
+                                                                'preferred' => 
'Preferred'));
+               
+ 
                //'parent_id'           => array('categories_parent', '14'));
  
***************
*** 533,536 ****
--- 558,562 ----
                {
                        $this->db = &$GLOBALS['phpgw']->db;
+                       $this->session = CreateObject('phpgwapi.sessions');
                        
$this->stock_contact_fields=&$this->contact_fields['showable'];
                        $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
***************
*** 551,555 ****
                function read_sessiondata()
                {
!                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi');
  
                        if ($data['comm_descr'])
--- 577,581 ----
                function read_sessiondata()
                {
!                       $data = 
$this->session->appsession('session_data','phpgwapi');
  
                        if ($data['comm_descr'])
***************
*** 610,619 ****
                                'contact_type' => $this->contact_type
                        );
!                       
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi',$data);
                }
  
                function delete_sessiondata($var='')
                {
!                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi');
                        if($var!='')
                        {
--- 636,645 ----
                                'contact_type' => $this->contact_type
                        );
!                       
$this->session->appsession('session_data','phpgwapi',$data);
                }
  
                function delete_sessiondata($var='')
                {
!                       $data = 
$this->session->appsession('session_data','phpgwapi');
                        if($var!='')
                        {
***************
*** 624,628 ****
                                $data = '';
                        }
!                       
$GLOBALS['phpgw']->session->appsession('session_data','phpgwapi',$data);
                }
  
--- 650,654 ----
                                $data = '';
                        }
!                       
$this->session->appsession('session_data','phpgwapi',$data);
                }
  
***************
*** 1799,1802 ****
--- 1825,1829 ----
                                $this->unlock_table();
                        }
+                       
                        if(is_array($others))
                        {
***************
*** 1958,1962 ****
                                $this->lock_table($this->location->table);
                        }
! 
                        $location['addr_creatby'] = $this->get_user_id();
                        $location['addr_modby'] = $this->get_user_id();
--- 1985,1997 ----
                                $this->lock_table($this->location->table);
                        }
!                       $addr = $this->has_preferred_location($cid);
!                       if(count($addr[0]) == 0)
!                       {
!                               $location['addr_preferred'] = 'Y';
!                       }
!                       else
!                       {
!                               $location['addr_preferred'] = 'N';
!                       }
                        $location['addr_creatby'] = $this->get_user_id();
                        $location['addr_modby'] = $this->get_user_id();
***************
*** 2026,2031 ****
                function delete($cid, $type='')
                {
!                       $type = ($type)? $type : $this->get_type_contact($cid);
!                       $type = ($type == $this->_contact_person)? 'person' : 
'org';
  
                        if(empty($entity_keys))
--- 2061,2075 ----
                function delete($cid, $type='')
                {
!                       $type_id = ($type)? $type : 
$this->get_type_contact($cid);
!                       if ($this->search_contact_type_id($type_id) == 
$this->_contact_person)
!                       {
!                               $type = 'person';
!                       }
!                       else
!                       {
!                               $type = 'org';
!                       }
!                       
!                       //$type = ($this->search_contact_type_id($type) == 
$this->_contact_person)? 'person' : 'org';
  
                        if(empty($entity_keys))
***************
*** 2041,2045 ****
                                                'comm_contact_id');
                        }
-                       
                        $this->transaction_begin();
                        foreach ($entity_keys as $key)
--- 2085,2088 ----
***************
*** 2208,2217 ****
                function delete_all($owner=0)
                {
                        if ($owner)
                        {
                                $contacts = 
$this->get_contacts_by_owner($owner);
!                               foreach ($contacts as $row)
                                {
!                                       $this->delete($row['contact_id']);
                                }
                        }
--- 2251,2264 ----
                function delete_all($owner=0)
                {
+                       $owner = intval($owner);
                        if ($owner)
                        {
                                $contacts = 
$this->get_contacts_by_owner($owner);
!                               if(is_array($contacts))
                                {
!                                       foreach ($contacts as $row)
!                                       {
!                                               
$this->delete($row['contact_id']);
!                                       }
                                }
                        }
***************
*** 2557,2560 ****
--- 2604,2624 ----
                        return $persons;
                }
+ 
+               /**
+               * Decide if the contact has preferred location
+               *
+               * @param integer $contact_id Contact id which want to check.
+               * @return Array|Boolean False if has't preferred org or
+               * array with all id which has preferred org.
+               */
+               function has_preferred_location($contact_id)
+               {
+                       $this->request('addr_contact_id');
+                       $this->request('key_addr_id');
+                       $this->criteria(array('addr_contact_id' => $contact_id,
+                                             'addr_preferred' => 'Y'));
+                       $locations = $this->get_records(__LINE__, __FILE__);
+                       return $locations;
+               }
                
                /**
***************
*** 3290,3294 ****
                                $contact['per_pubkey']          = 
$fields['pubkey'];
                                $contact['per_title']           = 
$fields['title'];
!                               $contact['per_departament']     = 
$fields['departamet'];
                                $contact['per_initials']        = 
$fields['initials'];
                                $contact['per_sound']           = 
$fields['sound'];
--- 3354,3358 ----
                                $contact['per_pubkey']          = 
$fields['pubkey'];
                                $contact['per_title']           = 
$fields['title'];
!                               $contact['per_department']      = 
$fields['departmet'];
                                $contact['per_initials']        = 
$fields['initials'];
                                $contact['per_sound']           = 
$fields['sound'];
***************
*** 3336,3340 ****
                                {
                                        // Go for a _good_ address type
!                                       $addr_type = 
$this->search_location_type($Location_input['type']);
                                        if(!empty($addr_type))
                                        {
--- 3400,3404 ----
                                {
                                        // Go for a _good_ address type
!                                       $addr_type = 
$this->search_location_type($location_input['type']);
                                        if(!empty($addr_type))
                                        {
***************
*** 3419,3432 ****
  
                        // Other fields
                        if(count($fields) > 0)
                        {
                                foreach($fields as $field_name => $field_value)
                                {
!                                       $others['other_name']   = $field_name;
!                                       $others['other_value']  = $field_value;
                                }
                        }
                        // FIXME: Jarg needs to check this
!                       $this->add_contact($type, $contact, $comm_media, 
$locations, $contact['categories'], $others, $contact['relations']);
                        return $contact;
                }
--- 3483,3500 ----
  
                        // Other fields
+                       $others=array();
                        if(count($fields) > 0)
                        {
                                foreach($fields as $field_name => $field_value)
                                {
!                                       $other['other_name']    = $field_name;
!                                       $other['other_value']   = $field_value;
!                                       $other['other_owner']   = 
$GLOBALS['phpgw_info']['user']['account_id'];
!                                       $others[]               = $other;
                                }
                        }
+                       
                        // FIXME: Jarg needs to check this
!                       $this->add_contact($type, $contact, $comm_media, 
$locations, $contact['categories'], $others, $contact['relations']);
                        return $contact;
                }





reply via email to

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