phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] addressbook/inc class.boaddressbook.inc.php cla...


From: Dave Hall
Subject: [Phpgroupware-cvs] addressbook/inc class.boaddressbook.inc.php cla...
Date: Sat, 09 Sep 2006 11:50:11 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    addressbook
Changes by:     Dave Hall <skwashd>     06/09/09 11:50:11

Modified files:
        inc            : class.boaddressbook.inc.php 
                         class.soaddressbook.inc.php 
                         class.uiaddressbook.inc.php 

Log message:
        notices and fix phpgw::link()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.boaddressbook.inc.php?cvsroot=phpgroupware&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.soaddressbook.inc.php?cvsroot=phpgroupware&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uiaddressbook.inc.php?cvsroot=phpgroupware&r1=1.68&r2=1.69

Patches:
Index: class.boaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.boaddressbook.inc.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- class.boaddressbook.inc.php 1 Sep 2006 14:44:43 -0000       1.31
+++ class.boaddressbook.inc.php 9 Sep 2006 11:50:11 -0000       1.32
@@ -17,7 +17,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-/* $Id: class.boaddressbook.inc.php,v 1.31 2006/09/01 14:44:43 skwashd Exp $ */
+/* $Id: class.boaddressbook.inc.php,v 1.32 2006/09/09 11:50:11 skwashd Exp $ */
 
        class boaddressbook
        {
@@ -290,8 +290,8 @@
                */
                function edit_person($person_id, $fields)
                {
-                       $old_orgs= $fields['old_my_orgs']['my_orgs'];
-                       $new_orgs = $fields['tab_orgs']['my_orgs'];
+                       $old_orgs = isset($fields['old_my_orgs']['my_orgs']) ? 
$fields['old_my_orgs']['my_orgs'] : array() ;
+                       $new_orgs = isset($fields['tab_orgs']['my_orgs']) ? 
$fields['tab_orgs']['my_orgs'] : array();
                        $fields['edit_orgs'] = $this->diff_arrays($old_orgs, 
$new_orgs);
 
                        $old_comm = $fields['old_comm'];
@@ -872,6 +872,7 @@
                //used
                function diff_arrays($old_array=array(), $new_array=array(), 
$type='values')
                {
+                       $result = array();
                        if(!is_array($old_array))
                        {
                                $old_array =  array();

Index: class.soaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.soaddressbook.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- class.soaddressbook.inc.php 29 Aug 2006 16:02:43 -0000      1.21
+++ class.soaddressbook.inc.php 9 Sep 2006 11:50:11 -0000       1.22
@@ -17,7 +17,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-/* $Id: class.soaddressbook.inc.php,v 1.21 2006/08/29 16:02:43 skwashd Exp $ */
+/* $Id: class.soaddressbook.inc.php,v 1.22 2006/09/09 11:50:11 skwashd Exp $ */
 
        class soaddressbook
        {
@@ -403,8 +403,9 @@
                {
                        $principal['owner'] = $fields['owner'];
                        $principal['access'] = 
$fields['tab_person_data']['ispublic'];
-                       $preferred_force_addr = 
$fields['tab_address']['addr_preferred'];
+                       $preferred_force_addr = 
isset($fields['tab_address']['addr_preferred']) ? 
$fields['tab_address']['addr_preferred'] : 0;
 
+                       $cats = array();
                        if(is_array($fields['tab_cats']['my_cats']))
                        {
                                foreach($fields['tab_cats']['my_cats'] as $cat)
@@ -415,15 +416,11 @@
                                        }
                                }
                        }
-                       else
-                       {
-                               $cats = '';
-                       }
                        
                        $principal['cat_id'] = $cats;
                        $person = array_merge($fields['tab_person_data'], 
$fields['tab_extra']);
                        $orgs = $fields['edit_orgs'];
-                       $orgs['preferred_org'] = 
$fields['tab_orgs']['preferred_org'];
+                       $orgs['preferred_org'] = 
isset($fields['tab_orgs']['preferred_org']) ? 
$fields['tab_orgs']['preferred_org'] : 0;
                        $queries = $fields['transactions'];
 
                        //unset($fields['tab_person_data']);
@@ -459,6 +456,11 @@
                        }
                        else
                        {
+                               if ( !isset($fields['preferred_address']) )
+                               {
+                                       $fields['preferred_address'] = 0;
+                               }
+
                                $data =  array('my_preferred' => 'N');
                                $this->contacts->edit_org_person_relation('', 
$person_id, $data, PHPGW_SQL_RUN_SQL);
                                $data = array('my_preferred' => 'Y',
@@ -468,12 +470,14 @@
                        
                        $comm_preferred = $fields['tab_comms']['preferred'];
                        
-                       $this->upgrade_comms($fields['edit_comms']['insert'], 
+                       //FIXME this is a hack cos i am sick of fixing broken 
written by lazy developers! skwashd 20060908
+                       @$this->upgrade_comms($fields['edit_comms']['insert'], 
                                             $fields['edit_comms']['delete'], 
                                             $fields['edit_comms']['edit'],
                                             $fields['comm_data'], 
$comm_preferred, $person_id);
 
-                       $this->upgrade_others($fields['edit_others']['insert'],
+                       //FIXME this is a hack cos i am sick of fixing broken 
written by lazy developers! skwashd 20060908
+                       @$this->upgrade_others($fields['edit_others']['insert'],
                                              $fields['edit_others']['delete'],
                                              $fields['edit_others']['edit'],
                                              
$fields['tab_others']['other_value'], $person_id);
@@ -649,6 +653,7 @@
                                $fields['tab_comms']['comm_data']=array();
                        }
                        
+                       $comms = array();
                        foreach($fields['tab_comms']['comm_data'] as 
$type_descr => $data)
                        {
                                if($data)
@@ -659,13 +664,16 @@
                                }
                        }
                        
-                       if(is_array($fields['addr_data']))
+                       $addr = array();
+                       if( isset($fields['addr_data']) && 
isset($fields['tab_address']['addr_preferred'])
+                               && is_array($fields['addr_data']))
                        {
                                
$fields['addr_data'][$fields['tab_address']['addr_preferred']]['addr_preferred']='Y';
                                $addr = $fields['addr_data'];
                        }
 
-                       if(is_array($fields['others_data']))
+                       if( isset($fields['others_data'])
+                               && is_array($fields['others_data']) )
                        {
                                foreach($fields['others_data'] as $key => $data)
                                {
@@ -674,14 +682,20 @@
                        }
                        $others = $fields['others_data'];
                        
-                       $orgs = $fields['tab_orgs']['my_orgs'];
-                       $principal['preferred_org'] = 
$fields['tab_orgs']['preferred_org'];
-                       if($fields['tab_orgs']['preferred_org'])
+                       $orgs = isset($fields['tab_orgs']['my_orgs']) ? 
$fields['tab_orgs']['my_orgs'] : array();
+                       $principal['preferred_org'] = 
isset($fields['tab_orgs']['preferred_org']) ? 
$fields['tab_orgs']['preferred_org'] : 0;
+
+                       if( isset($fields['tab_orgs']['preferred_org'])
+                               && $fields['tab_orgs']['preferred_org'] )
                        {
                                $principal['preferred_address'] = 
$this->contacts->get_location_pref_org($principal['preferred_org']);
                        }
+                       else
+                       {
+                               $principal['preferred_address'] = 0;
+                       }
 
-                       $cats = $fields['tab_cats']['my_cats'];
+                       $cats = isset($fields['tab_cats']['my_cats']) ? 
$fields['tab_cats']['my_cats'] : array();
 
                        $type = 
$this->contacts->search_contact_type($this->contacts->get_person_name());
                        $c_id = $this->contacts->add_contact($type, $principal, 
$comms, $addr, $cats, $others, $orgs);

Index: class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- class.uiaddressbook.inc.php 1 Sep 2006 14:44:43 -0000       1.68
+++ class.uiaddressbook.inc.php 9 Sep 2006 11:50:11 -0000       1.69
@@ -12,7 +12,7 @@
  *  option) any later version.                                              *
  \**************************************************************************/
 
-/* $Id: class.uiaddressbook.inc.php,v 1.68 2006/09/01 14:44:43 skwashd Exp $ */
+/* $Id: class.uiaddressbook.inc.php,v 1.69 2006/09/09 11:50:11 skwashd Exp $ */
 
 
 class uiaddressbook
@@ -281,7 +281,7 @@
                        $count_function = 'get_count_persons';
                        $get_data_function = 'get_persons';
 
-                       
$this->template->set_var('add_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.add_person'));
+                       $this->template->set_var('add_url', 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'addressbook.uiaddressbook.add_person')));
 
                        $search_obj=array('query' => $this->query,
                                        'search_obj' => array(
@@ -403,7 +403,7 @@
                //FIXME make show_tpl stop using theme values
                $search_filter = $this->nextmatchs->show_tpl(
                                '/index.php', $this->start, $total_all_persons,
-                               
'menuaction=addressbook.uiaddressbook.index&section='.$this->section,
+                               array('menuaction' => 
'addressbook.uiaddressbook.index', 'section' => $this->section),
                                '90%', '',
                                
$search_obj,1,True,array('filter'=>$this->filter,'yours'=>1),$this->cat_id);
                $query = $filter = '';
@@ -432,24 +432,22 @@
                $this->template->set_var('lang_showing',$lang_showing);
                $this->template->set_var('search_filter',$search_filter);
                $this->template->set_var('cats',lang('Category'));
-               
$this->template->set_var('cats_url',$GLOBALS['phpgw']->link('/index.php',
-                                       
'menuaction=addressbook.uiaddressbook.index&section='.$this->section));
+               
$this->template->set_var('cats_url',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'addressbook.uiaddressbook.index', 'section' => 
$this->section)));
                /* 
$this->template->set_var('cats_link',$this->cat_option($this->cat_id)); */
                $this->template->set_var('lang_cats',lang('Select'));
                //                      
$this->template->set_var('lang_addressbook',lang('Address book'));
                $this->template->set_var('lang_add',lang('Add'));
                $this->template->set_var('lang_cat_cont',lang('Categorize'));
-               $this->template->set_var('cat_cont_url', 
$GLOBALS['phpgw']->link('/index.php',
-                                       
'menuaction=addressbook.uicategorize_contacts.index'));
+               $this->template->set_var('cat_cont_url', 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'addressbook.uicategorize_contacts.index')));
 
                $this->template->set_var('lang_addvcard',lang('AddVCard'));
-               
$this->template->set_var('vcard_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.in'));
+               
$this->template->set_var('vcard_url',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'addressbook.uivcard.in')));
                $this->template->set_var('lang_import',lang('Import Contacts'));
-               
$this->template->set_var('import_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiXport.import'));
+               
$this->template->set_var('import_url',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'addressbook.uiXport.import')));
                $this->template->set_var('lang_import_alt',lang('Alt. CSV 
Import'));
                
$this->template->set_var('import_alt_url',$GLOBALS['phpgw']->link('/addressbook/csv_import.php'));
                $this->template->set_var('lang_export',lang('Export Contacts'));
-               
$this->template->set_var('export_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiXport.export'));
+               
$this->template->set_var('export_url',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'addressbook.uiXport.export')));
 
                $export_vars = array
                (
@@ -554,17 +552,14 @@
                                $this->template->set_var('col_data',$ref.$data);
                                $this->template->parse('columns','column',True);
                        }
-                       
$this->template->set_var('row_view_link',$GLOBALS['phpgw']->link('/index.php',
-                                               
'menuaction=addressbook.uiaddressbook.' . $this->view_mode 
-                                               
.'&ab_id='.$entry['contact_id']));
-                       
$this->template->set_var('row_vcard_link',$GLOBALS['phpgw']->link('/index.php',
-                                               
'menuaction=addressbook.uivcard.out&ab_id='.$entry['contact_id']));
+                       
$this->template->set_var('row_view_link',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => "addressbook.uiaddressbook.{$this->view_mode}", 'ab_id' 
=> $entry['contact_id'] ) ) );
+                       
$this->template->set_var('row_vcard_link',$GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'addressbook.uivcard.out', 'ab_id' => 
$entry['contact_id'] ) ) );
 
                        if($this->bo->check_edit($entry['contact_id'], 
$myowner))
                        {
-                               $this->template->set_var('row_edit','<a href="' 
. $GLOBALS['phpgw']->link('/index.php',
-                                       'menuaction=addressbook.uiaddressbook.' 
. $this->edit_mode
-                                               . 
'&ab_id='.$entry['contact_id']) . '">' . lang('Edit') . '</a>');
+                               $this->template->set_var('row_edit','<a href="' 
+                                       . $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => "addressbook.uiaddressbook.{$this->edit_mode}", 'ab_id' 
=> $entry['contact_id']) )
+                                       . '">' . lang('Edit') . '</a>');
                        }                               
                        else
                        {
@@ -2567,7 +2562,7 @@
 
                if($tab_section=='others')
                {
-                       if(!$add_data['other_owner'])
+                       if ( !isset($add_data['other_owner']) || 
!$add_data['other_owner'] )
                        {
                                $add_data['other_owner'] = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        }




reply via email to

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