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 class.h...


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc class.contacts_sql.inc.php class.h...
Date: Fri, 20 Oct 2006 13:43:45 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/10/20 13:43:45

Modified files:
        inc            : class.contacts_sql.inc.php class.hooks.inc.php 
                         class.sql.inc.php class.sql_entity.inc.php 
        inc/accounts   : class.accounts_sql.inc.php 

Log message:
        notices and other bugs found while fixing setup_demo

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.contacts_sql.inc.php?cvsroot=phpgwapi&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.hooks.inc.php?cvsroot=phpgwapi&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sql.inc.php?cvsroot=phpgwapi&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.sql_entity.inc.php?cvsroot=phpgwapi&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_sql.inc.php?cvsroot=phpgwapi&r1=1.18&r2=1.19

Patches:
Index: class.contacts_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- class.contacts_sql.inc.php  2 Oct 2006 00:33:44 -0000       1.34
+++ class.contacts_sql.inc.php  20 Oct 2006 13:43:45 -0000      1.35
@@ -6,7 +6,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage contacts
-       * @version $Id: class.contacts_sql.inc.php,v 1.34 2006/10/02 00:33:44 
skwashd Exp $
+       * @version $Id: class.contacts_sql.inc.php,v 1.35 2006/10/20 13:43:45 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        */
 
@@ -215,20 +215,15 @@
                                                        'key_other_id'          
=> 'custom id',
                                                        'other_contact_id'      
=> 'custom contact id',
                                                        'addr_type_id'          
=> 'address type id',
-//                                                     'account_id'            
=> 'account id',
-//                                                     'account_person_id'     
=> 'account person id',
+                                                       //'account_id'          
=> 'account id',
+                                                       //'account_person_id'   
=> 'account person id',
                                                        'person_only'           
=> 'only persons',
                                                        'per_active'            
=> 'active person',
                                                        'per_creaton'           
=> 'created on',
                                                        'per_creatby'           
=> 'created by',
                                                        'per_modon'             
=> 'modified on',
                                                        'per_modby'             
=> 'modified by',
-
                                                        'key_cat_id'            
=> 'category id'
-
-
-
-
                                                ),
                                        'catalogs' =>
                                        array(
@@ -618,8 +613,8 @@
                                $GLOBALS['phpgw']->session = 
createObject('phpgwapi.sessions');
                        }
 
-                       
$this->stock_contact_fields=&$this->contact_fields['showable'];
-                       $this->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->stock_contact_fields =& 
$this->contact_fields['showable'];
+                       $this->account_id = 
isset($GLOBALS['phpgw_info']['user']['account_id']) ? 
$GLOBALS['phpgw_info']['user']['account_id'] : 0;
                        if($session)
                        {
                                $this->read_sessiondata();
@@ -782,55 +777,58 @@
                function read_single_entry($id,$fields='')
                {
                        $person_data = $this->person_complete_data($id);
-                       $entry['fn']                    = 
$person_data['full_name'];
-                       $entry['sound']                 = $person_data['sound'];
-                       $entry['org_name']              = '';
-                       $entry['org_unit']              = 
$person_data['department'];
-                       $entry['title']                 = $person_data['title'];
-                       $entry['n_prefix']              = 
$person_data['prefix'];
-                       $entry['n_given']               = 
$person_data['first_name'];
-                       $entry['n_middle']              = 
$person_data['middle_name'];
-                       $entry['n_family']              = 
$person_data['last_name'];
-                       $entry['n_suffix']              = 
$person_data['suffix'];
-                       $entry['label']                 = '';
-                       $entry['adr_one_street']        = 
$person_data['locations'][1]['add1'];
-                       $entry['adr_one_locality']      = 
$person_data['locations'][1]['city'];
-                       $entry['adr_one_region']        = 
$person_data['locations'][1]['state'];
-                       $entry['adr_one_postalcode']    = 
$person_data['locations'][1]['postal_code'];
-                       $entry['adr_one_countryname']   = 
$person_data['locations'][1]['country'];
-                       $entry['adr_one_type']          = 
$person_data['locations'][1]['type'];
-                       $entry['adr_two_street']        = 
$person_data['locations'][2]['add1'];
-                       $entry['adr_two_locality']      = 
$person_data['locations'][2]['city'];
-                       $entry['adr_two_region']        = 
$person_data['locations'][2]['state'];
-                       $entry['adr_two_postalcode']    = 
$person_data['locations'][2]['postal_code'];
-                       $entry['adr_two_countryname']   = 
$person_data['locations'][2]['country'];
-                       $entry['adr_two_type']          = 
$person_data['locations'][2]['type'];
-                       $entry['tz']                    = 
$person_data['locations'][1]['tz'];;
-                       $entry['geo']                   = '';
-                       $entry['tel_work']              = $person_data['work 
phone'];
-                       $entry['tel_home']              = $person_data['home 
phone'];
-                       $entry['tel_voice']             = $person_data['voice 
phone'];
-                       $entry['tel_msg']               = $person_data['msg 
phone'];
-                       $entry['tel_fax']               = $person_data['work 
fax'];
-                       $entry['tel_pager']             = $person_data['pager'];
-                       $entry['tel_cell']              = $person_data['mobile 
(cell) phone'];
-                       $entry['tel_bbs']               = $person_data['bbs'];
-                       $entry['tel_modem']             = $person_data['modem'];
-                       $entry['tel_isdn']              = $person_data['isdn'];
-                       $entry['tel_car']               = $person_data['car 
phone'];
-                       $entry['tel_video']             = $person_data['video'];
-                       $entry['tel_prefer']            = '';
-                       $entry['email']                 = $person_data['work 
email'];
-                       $entry['email_type']            = 
$person_data['comm_type']['work email'];
-                       $entry['email_home']            = $person_data['home 
email'];
-                       $entry['email_home_type']       = 
$person_data['comm_type']['home email'];
-                       $entry['address2']              = 
$person_data['locations'][1]['add2'];
-                       $entry['address3']              = 
$person_data['locations'][1]['add3'];
-                       $entry['ophone']                = '';
-                       $entry['bday']                  = 
$person_data['birthday'];
-                       $entry['url']                   = 
$person_data['website'];
-                       $entry['pubkey']                = 
$person_data['per_pubkey'];
-                       $entry['note']                  = 
$person_data['notes'][1]['text'];
+                       $entry = array
+                       (
+                               'fn'                            => 
$person_data['full_name'],
+                               'sound'                         => 
$person_data['sound'],
+                               'org_name'                      => '',
+                               'org_unit'                      => 
$person_data['department'],
+                               'title'                         => 
$person_data['title'],
+                               'n_prefix'                      => 
$person_data['prefix'],
+                               'n_given'                       => 
$person_data['first_name'],
+                               'n_middle'                      => 
$person_data['middle_name'],
+                               'n_family'                      => 
$person_data['last_name'],
+                               'n_suffix'                      => 
$person_data['suffix'],
+                               'label'                         => '',
+                               'adr_one_street'        => 
$person_data['locations'][1]['add1'],
+                               'adr_one_locality'      => 
$person_data['locations'][1]['city'],
+                               'adr_one_region'        => 
$person_data['locations'][1]['state'],
+                               'adr_one_postalcode'=> 
$person_data['locations'][1]['postal_code'],
+                               'adr_one_countryname'=> 
$person_data['locations'][1]['country'],
+                               'adr_one_type'          => 
$person_data['locations'][1]['type'],
+                               'adr_two_street'        => 
$person_data['locations'][2]['add1'],
+                               'adr_two_locality'      => 
$person_data['locations'][2]['city'],
+                               'adr_two_region'        => 
$person_data['locations'][2]['state'],
+                               'adr_two_postalcode'=> 
$person_data['locations'][2]['postal_code'],
+                               'adr_two_countryname'=> 
$person_data['locations'][2]['country'],
+                               'adr_two_type'          => 
$person_data['locations'][2]['type'],
+                               'tz'                            => 
$person_data['locations'][1]['tz'],
+                               'geo'                           => '',
+                               'tel_work'                      => 
$person_data['work phone'],
+                               'tel_home'                      => 
$person_data['home phone'],
+                               'tel_voice'                     => 
$person_data['voice phone'],
+                               'tel_msg'                       => 
$person_data['msg phone'],
+                               'tel_fax'                       => 
$person_data['work fax'],
+                               'tel_pager'                     => 
$person_data['pager'],
+                               'tel_cell'                      => 
$person_data['mobile (cell) phone'],
+                               'tel_bbs'                       => 
$person_data['bbs'],
+                               'tel_modem'                     => 
$person_data['modem'],
+                               'tel_isdn'                      => 
$person_data['isdn'],
+                               'tel_car'                       => 
$person_data['car phone'],
+                               'tel_video'                     => 
$person_data['video'],
+                               'tel_prefer'            => '',
+                               'email'                         => 
$person_data['work email'],
+                               'email_type'            => 
$person_data['comm_type']['work email'],
+                               'email_home'            => $person_data['home 
email'],
+                               'email_home_type'       => 
$person_data['comm_type']['home email'],
+                               'address2'                      => 
$person_data['locations'][1]['add2'],
+                               'address3'                      => 
$person_data['locations'][1]['add3'],
+                               'ophone'                        => '',
+                               'bday'                          => 
$person_data['birthday'],
+                               'url'                           => 
$person_data['website'],
+                               'pubkey'                        => 
$person_data['per_pubkey'],
+                               'note'                          => 
$person_data['notes'][1]['text']
+                       );
                        if(is_array($fields))
                        {
                                foreach($fields as $field)
@@ -2337,10 +2335,14 @@
                        $owner = isset($principal['owner']) && 
$principal['owner'] ? $principal['owner'] : 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->lock_table($this->contact->table);
 
-                       $this->contact->insert(array('owner' => $owner,
+                       $this->contact->insert(array
+                       (
+                               'owner' => $owner,
                                                         'access' => 
$principal['access'],
                                                         'cat_id' => 
$this->get_categories($categories),
-                                                        'contact_type' => 
$type), PHPGW_SQL_RUN_SQL);
+                               'contact_type' => $type
+                       ), PHPGW_SQL_RUN_SQL);
+
                        $cid = $this->last_id('contact', 'contact_id');
                        $this->unlock_table();
                        $add_type = $this->search_contact_type_id($type);
@@ -4028,8 +4030,12 @@
                        $this->request(array('contact_type'));
                        $this->criteria(array('contact_id' => $contact_id));
                        $type =  $this->get_query($action, __LINE__, __FILE__);
+                       if ( is_array($type) && isset($type[0]['contact_type']) 
)
+                       {
                        return $type[0]['contact_type'];
                }
+                       return '';
+               }
 
                /**
                * Get the preferred address of organization.
@@ -4055,8 +4061,12 @@
 
                function get_user_id()
                {
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['account_id']) )
+                       {
                        return $GLOBALS['phpgw_info']['user']['account_id'];
                }
+                       return 0;
+               }
 
                function finalize_add($id)
                {

Index: class.hooks.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.hooks.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- class.hooks.inc.php 1 Oct 2006 14:06:13 -0000       1.22
+++ class.hooks.inc.php 20 Oct 2006 13:43:45 -0000      1.23
@@ -6,7 +6,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.hooks.inc.php,v 1.22 2006/10/01 14:06:13 skwashd 
Exp $
+       * @version $Id: class.hooks.inc.php,v 1.23 2006/10/20 13:43:45 skwashd 
Exp $
        */
 
        /**
@@ -68,11 +68,12 @@
                        }
 
                        /* Then add the rest */
+                       $apps = array();
                        if ($no_permission_check)
                        {
                                $apps = $GLOBALS['phpgw_info']['apps'];
                        }
-                       else
+                       else if ( isset($GLOBALS['phpgw_info']['user']['apps']) 
)
                        {
                                $apps = $GLOBALS['phpgw_info']['user']['apps'];
                        }

Index: class.sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sql.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- class.sql.inc.php   29 Aug 2006 04:23:28 -0000      1.7
+++ class.sql.inc.php   20 Oct 2006 13:43:45 -0000      1.8
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.sql.inc.php,v 1.7 2006/08/29 04:23:28 skwashd Exp 
$
+       * @version $Id: class.sql.inc.php,v 1.8 2006/10/20 13:43:45 skwashd Exp 
$
        * @internal Development of this application was funded by 
http://www.sogrp.com
        * @link http://www.sogrp.com/
        */
@@ -378,7 +378,7 @@
                */
                function integer($integer)
                {
-                       return intval($integer);
+                       return (int) $integer;
                }
 
                /**

Index: class.sql_entity.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.sql_entity.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- class.sql_entity.inc.php    14 Sep 2006 17:37:17 -0000      1.7
+++ class.sql_entity.inc.php    20 Oct 2006 13:43:45 -0000      1.8
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.sql_entity.inc.php,v 1.7 2006/09/14 17:37:17 
sigurdne Exp $
+       * @version $Id: class.sql_entity.inc.php,v 1.8 2006/10/20 13:43:45 
skwashd Exp $
        * @internal Development of this application was funded by 
http://www.sogrp.com
        * @link http://www.sogrp.com/
        */
@@ -559,7 +559,7 @@
                        
                        }
                        $type = $this->get_datatype($false_field);
-                       return ($data == sql::null())? sql::null() : 
sql::$type($data);
+                       return $data === sql::null() ? sql::null() : 
sql::$type($data);
                }
 
                /**

Index: accounts/class.accounts_sql.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/accounts/class.accounts_sql.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- accounts/class.accounts_sql.inc.php 2 Oct 2006 10:24:28 -0000       1.18
+++ accounts/class.accounts_sql.inc.php 20 Oct 2006 13:43:45 -0000      1.19
@@ -8,7 +8,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
-       * @version $Id: class.accounts_sql.inc.php,v 1.18 2006/10/02 10:24:28 
Caeies Exp $
+       * @version $Id: class.accounts_sql.inc.php,v 1.19 2006/10/20 13:43:45 
skwashd Exp $
        */
 
        /**
@@ -395,7 +395,7 @@
                function set_data($data)
                {
                        parent::set_data($data);
-                       $this->quota = (int)$data['quota'] ? 
(int)$data['quota'] : $this->quota;
+                       $this->quota = isset($data['quota']) ? 
(int)$data['quota'] : $this->quota;
                        if(!isset($this->person_id) || $this->person_id == '' )
                        {
                                // is there a reason to write 'NULL' into 
database?
@@ -467,6 +467,8 @@
 
                function get_account_with_contact()
                {
+                       $accounts = array();
+                       
                        $sql = 'SELECT account_id, person_id FROM 
phpgw_accounts '
                                . 'WHERE person_id IS NOT NULL OR person_id != 
0';
                        $this->db->query($sql,__LINE__,__FILE__);




reply via email to

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