phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: addressbook/inc class.uiaddressbook.inc.php, 1.


From: Jonathan Rivera <address@hidden>
Subject: [Phpgroupware-cvs] CVS: addressbook/inc class.uiaddressbook.inc.php, 1.36.2.15.2.15, 1.36.2.15.2.16 class.soaddressbook.inc.php, 1.14.2.3.2.4, 1.14.2.3.2.5 class.boaddressbook.inc.php, 1.21.2.2.2.6, 1.21.2.2.2.7
Date: Tue, 16 Sep 2003 14:44:18 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.uiaddressbook.inc.php class.soaddressbook.inc.php 
        class.boaddressbook.inc.php 
Log Message:
BugFix #5143, now i can add orgs to persons and persons to orgs


Index: class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.36.2.15.2.15
retrieving revision 1.36.2.15.2.16
diff -C2 -r1.36.2.15.2.15 -r1.36.2.15.2.16
*** class.uiaddressbook.inc.php 12 Sep 2003 23:03:33 -0000      1.36.2.15.2.15
--- class.uiaddressbook.inc.php 16 Sep 2003 18:44:14 -0000      1.36.2.15.2.16
***************
*** 551,554 ****
--- 551,555 ----
                                $fields['owner'] = 
$GLOBALS['phpgw_info']['user']['account_id'];
  
+                               $fields['old_my_person'] = 
$GLOBALS['phpgw']->session->appsession('old_my_person','addressbook');
                                $this->bo->edit_org($fields['contact_id'], 
$fields);
  
***************
*** 583,586 ****
--- 584,589 ----
                                        {
                                                $entry = 
$this->bo->get_person_orgs_data($this->contact_id);
+                                               $old_my_person = $entry;
+                                               
$GLOBALS['phpgw']->session->appsession('old_my_person','addressbook',$old_my_person);
 
                                        }
                                        break;
***************
*** 713,716 ****
--- 716,720 ----
                                $fields['owner'] = 
$GLOBALS['phpgw_info']['user']['account_id'];
  
+                               $fields['old_my_orgs'] = 
$GLOBALS['phpgw']->session->appsession('old_my_orgs','addressbook');
                                $this->bo->edit_person($fields['contact_id'], 
$fields);
  
***************
*** 745,748 ****
--- 749,754 ----
                                        {
                                                $entry = 
$this->bo->get_orgs_person_data($this->contact_id);
+                                               $old_my_orgs = $entry;
+                                               
$GLOBALS['phpgw']->session->appsession('old_my_orgs','addressbook',$old_my_orgs);
                                        }
                                        break;

Index: class.soaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.soaddressbook.inc.php,v
retrieving revision 1.14.2.3.2.4
retrieving revision 1.14.2.3.2.5
diff -C2 -r1.14.2.3.2.4 -r1.14.2.3.2.5
*** class.soaddressbook.inc.php 12 Sep 2003 23:03:33 -0000      1.14.2.3.2.4
--- class.soaddressbook.inc.php 16 Sep 2003 18:44:15 -0000      1.14.2.3.2.5
***************
*** 296,299 ****
--- 296,300 ----
                        $principal['cat_id'] = $fields['my_cats'];
                        $this->contacts->edit_contact($person_id, $principal, 
PHPGW_SQL_RUN_SQL);
+ 
                        unset($fields['contact_id']);
                        unset($fields['owner']);
***************
*** 309,313 ****
--- 310,326 ----
                        unset($fields['bday_month']);
                        unset($fields['bday_year']);
+ 
                        $this->contacts->edit_person($person_id, $fields, 
PHPGW_SQL_RUN_SQL);
+ 
+                       foreach($fields['edit_orgs']['delete'] as $org_id)
+                       {
+                               
$this->contacts->delete_org_person_relation($org_id, $person_id, 
PHPGW_SQL_RUN_SQL);
+                       }
+                       
+                       $fields['preferred_address']=1;
+                       
$this->contacts->add_orgs_for_person($fields['edit_orgs']['insert'], 
+                                                            
$fields['preferred_org'], 
+                                                            
$fields['preferred_address'], 
+                                                            $person_id, 
PHPGW_SQL_RUN_SQL);
                }
  
***************
*** 318,321 ****
--- 331,335 ----
                        $principal['cat_id'] = $fields['my_cats'];
                        $this->contacts->edit_contact($org_id, $principal, 
PHPGW_SQL_RUN_SQL);
+ 
                        unset($fields['contact_id']);
                        unset($fields['owner']);
***************
*** 331,335 ****
--- 345,357 ----
                        unset($fields['bday_month']);
                        unset($fields['bday_year']);
+ 
                        $this->contacts->edit_org($org_id, $fields, 
PHPGW_SQL_RUN_SQL);
+ 
+                       foreach($fields['edit_person']['delete'] as $person_id)
+                       {
+                               
$this->contacts->delete_org_person_relation($org_id, $person_id, 
PHPGW_SQL_RUN_SQL);
+                       }
+                       
+                       
$this->contacts->add_people_for_organzation($fields['edit_person']['insert'], 
$org_id, PHPGW_SQL_RUN_SQL);
                }
  
***************
*** 458,461 ****
--- 480,524 ----
                        return $this->contacts->edit_location($contact_id, 
$fields);
                }
+ 
+               /**
+               * Delete the specified communication media.
+               * 
+               * @param integer|array $id Key of the comm media what you want
+               */
+               function delete_specified_comm($id)
+               {
+                       return $this->contacts->delete_specified_comm($id);
+               }
+ 
+               /**
+               * Delete the specified address.
+               * 
+               * @param integer|array $id Key of the address what you want
+               */
+               function delete_specified_location($id)
+               {
+                       return $this->contacts->delete_specified_location($id);
+               }
+               /**
+               * Delete the specified others field.
+               * 
+               * @param integer|array $id Key of the other field what you want
+               */
+               function delete_specified_other($id)
+               {
+                       return $this->contacts->delete_specified_other($id);
+               }
+ 
+               /**
+               * Delete the specified note.
+               * 
+               * @param integer|array $id Key of the note what you want
+               */
+               function delete_specified_note($id)
+               {
+                       return $this->contacts->delete_specified_note($id);
+               }
+ 
+ 
        }
  ?>

Index: class.boaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.boaddressbook.inc.php,v
retrieving revision 1.21.2.2.2.6
retrieving revision 1.21.2.2.2.7
diff -C2 -r1.21.2.2.2.6 -r1.21.2.2.2.7
*** class.boaddressbook.inc.php 12 Sep 2003 23:03:33 -0000      1.21.2.2.2.6
--- class.boaddressbook.inc.php 16 Sep 2003 18:44:15 -0000      1.21.2.2.2.7
***************
*** 657,660 ****
--- 657,666 ----
                function edit_org($org_id, $fields)
                {
+                       $old_person= $fields['old_my_person']['my_person'];
+                       $new_person = $fields['my_person'];
+                       unset($old_person['load']);
+                       unset($new_person['load']);
+                       
+                       $fields['edit_person'] = 
$this->diff_arrays($old_person, $new_person);
                        return $this->so->edit_org($org_id, $fields);
                }
***************
*** 662,667 ****
--- 668,697 ----
                function edit_person($person_id, $fields)
                {
+                       $old_orgs= $fields['old_my_orgs']['my_orgs'];
+                       $new_orgs = $fields['my_orgs'];
+                       unset($old_orgs['load']);
+                       unset($new_orgs['load']);
+                       
+                       $fields['edit_orgs'] = $this->diff_arrays($old_orgs, 
$new_orgs);
+                       
                        return $this->so->edit_person($person_id, $fields);
                }
+ 
+               function diff_arrays($old_array=array(), $new_array=array())
+               {
+                       if(!is_array($old_array))
+                       {
+                               $old_array =  array();
+                       }
+                       
+                       if(!is_array($new_array))
+                       {
+                               $new_array =  array();
+                       }
+ 
+                       $result['delete'] = array_diff($old_array, $new_array);
+                       $result['insert'] = array_diff($new_array, $old_array);
+                       return $result;
+               }
                
                function search_contact_type_id($id)
***************
*** 693,696 ****
--- 723,765 ----
                {
                        return $this->so->get_count_orgs($criteria);
+               }
+ 
+               /**
+               * Delete the specified communication media.
+               * 
+               * @param integer|array $id Key of the comm media what you want
+               */
+               function delete_specified_comm($id)
+               {
+                       return $this->so->delete_specified_comm($id);
+               }
+ 
+               /**
+               * Delete the specified address.
+               * 
+               * @param integer|array $id Key of the address what you want
+               */
+               function delete_specified_location($id)
+               {
+                       return $this->so->delete_specified_location($id);
+               }
+               /**
+               * Delete the specified others field.
+               * 
+               * @param integer|array $id Key of the other field what you want
+               */
+               function delete_specified_other($id)
+               {
+                       return $this->so->delete_specified_other($id);
+               }
+ 
+               /**
+               * Delete the specified note.
+               * 
+               * @param integer|array $id Key of the note what you want
+               */
+               function delete_specified_note($id)
+               {
+                       return $this->so->delete_specified_note($id);
                }
        }





reply via email to

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