[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: cdb/inc class.cdb_phone.inc.php,1.5,1.6 class.cd
From: |
Brian Morel <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: cdb/inc class.cdb_phone.inc.php,1.5,1.6 class.cdb_organization_location.inc.php,1.3,1.4 class.cdb_organization_client.inc.php,1.1,1.2 class.cdb_organization.inc.php,1.1,1.2 class.cdb_generic.inc.php,1.4,1.5 class.cdb_entity_meta.inc.php,1.2,1.3 class.cdb_entity.inc.php,1.5,1.6 class.cdb_contact_phone.inc.php,1.3,1.4 class.cdb_contact_personal.inc.php,1.5,1.6 class.cdb_contact_internet.inc.php,1.1,1.2 class.cdb_contact_client.inc.php,1.1,1.2 class.cdb_contact_address.inc.php,1.2,1.3 class.cdb_contact.inc.php,1.6,1.7 class.cdb_address.inc.php,1.2,1.3 |
Date: |
Wed, 20 Feb 2002 17:13:01 -0500 |
Update of /cvsroot/phpgroupware/cdb/inc
In directory subversions:/tmp/cvs-serv5045
Modified Files:
class.cdb_phone.inc.php
class.cdb_organization_location.inc.php
class.cdb_organization_client.inc.php
class.cdb_organization.inc.php class.cdb_generic.inc.php
class.cdb_entity_meta.inc.php class.cdb_entity.inc.php
class.cdb_contact_phone.inc.php
class.cdb_contact_personal.inc.php
class.cdb_contact_internet.inc.php
class.cdb_contact_client.inc.php
class.cdb_contact_address.inc.php class.cdb_contact.inc.php
class.cdb_address.inc.php
Log Message:
fixed database calles to match database tables
Index: class.cdb_phone.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_phone.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.cdb_phone.inc.php 15 Feb 2002 21:08:25 -0000 1.5
--- class.cdb_phone.inc.php 20 Feb 2002 22:12:57 -0000 1.6
***************
*** 32,36 ****
{
// Build update query
! $sqlp = "UPDATE cdb_contact_phone SET ";
if ($this->_dirty_vars())
{
--- 32,36 ----
{
// Build update query
! $sqlp = "UPDATE phpgw_cdb_contact_phone SET ";
if ($this->_dirty_vars())
{
***************
*** 57,61 ****
function load($phone_id)
{
! $sql = 'SELECT * FROM cdb_contact_phone WHERE
contact_phone_id="' .
$phone_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 57,61 ----
function load($phone_id)
{
! $sql = 'SELECT * FROM phpgw_cdb_contact_phone WHERE
contact_phone_id="' .
$phone_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 79,83 ****
$this->_loaded = TRUE;
$this->_dirty = array();
! $sql = 'INSERT INTO cdb_contact_phone ("entity_id",' .
'"phone_category_id", "number") VALUES
' .
'("'.$entity_id.'","'.$type_id.'","'.$number.'")';
--- 79,83 ----
$this->_loaded = TRUE;
$this->_dirty = array();
! $sql = 'INSERT INTO phpgw_cdb_contact_phone ("entity_id",' .
'"phone_category_id", "number") VALUES
' .
'("'.$entity_id.'","'.$type_id.'","'.$number.'")';
***************
*** 85,89 ****
$this->_id = $entity_id;
$this->_let('contact_phone_id',
! $this->_db->get_last_insert_id('cdb_contact_phone',
'contact_phone_id'));
--- 85,89 ----
$this->_id = $entity_id;
$this->_let('contact_phone_id',
! $this->_db->get_last_insert_id('phpgw_cdb_contact_phone',
'contact_phone_id'));
***************
*** 98,102 ****
function get_type_name()
{
! $sql = 'SELECT phone_category_name FROM
cdb_contact_phone_category'.
' WHERE
phone_category_id="'.$this->_get('phone_category_id').
'"';
--- 98,102 ----
function get_type_name()
{
! $sql = 'SELECT phone_category_name FROM
phpgw_cdb_contact_phone_cat'.
' WHERE
phone_category_id="'.$this->_get('phone_category_id').
'"';
Index: class.cdb_organization_location.inc.php
===================================================================
RCS file:
/cvsroot/phpgroupware/cdb/inc/class.cdb_organization_location.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.cdb_organization_location.inc.php 18 Feb 2002 05:16:15 -0000
1.3
--- class.cdb_organization_location.inc.php 20 Feb 2002 22:12:57 -0000
1.4
***************
*** 111,115 ****
if($this->id() &&
$this->location_exists($this->get_organization_id()) && $this->can_write())
{
! $sqlp = "UPDATE cdb_organization_location SET ";
if ($this->_dirty_vars())
{
--- 111,115 ----
if($this->id() &&
$this->location_exists($this->get_organization_id()) && $this->can_write())
{
! $sqlp = "UPDATE phpgw_cdb_org_location SET ";
if ($this->_dirty_vars())
{
***************
*** 150,154 ****
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM cdb_organization_location WHERE
location_id="' .
$location_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 150,154 ----
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM phpgw_cdb_org_location WHERE
location_id="' .
$location_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 168,172 ****
function create()
{
! $sql='INSERT INTO cdb_organization_location( ' .
'"organization_id", ' .
'"location", ' .
--- 168,172 ----
function create()
{
! $sql='INSERT INTO phpgw_cdb_org_location( ' .
'"organization_id", ' .
'"location", ' .
***************
*** 178,182 ****
'VALUES ("0", "", "", "", "", "", "", "")';
$this->_db->query($sql,__LINE__,__FILE__);
! return
$this->_db->get_last_insert_id('cdb_organization_location',
'location_id'));
--- 178,182 ----
'VALUES ("0", "", "", "", "", "", "", "")';
$this->_db->query($sql,__LINE__,__FILE__);
! return
$this->_db->get_last_insert_id('phpgw_cdb_org_location',
'location_id'));
***************
*** 189,193 ****
$location_id = $this->_get('location_id');
}
! $sql='SELECT * FROM cdb_organization_location WHERE
location_id="' .
$location_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 189,193 ----
$location_id = $this->_get('location_id');
}
! $sql='SELECT * FROM phpgw_cdb_org_location WHERE
location_id="' .
$location_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_organization_client.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_organization_client.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.cdb_organization_client.inc.php 18 Feb 2002 05:16:36 -0000
1.1
--- class.cdb_organization_client.inc.php 20 Feb 2002 22:12:58 -0000
1.2
***************
*** 78,82 ****
if($this->id() &&
$this->client_exists($this->get_organization_id()) && $this->can_write())
{
! $sqlp = "UPDATE cdb_organization_client SET ";
if ($this->_dirty_vars())
{
--- 78,82 ----
if($this->id() &&
$this->client_exists($this->get_organization_id()) && $this->can_write())
{
! $sqlp = "UPDATE phpgw_cdb_org_client SET ";
if ($this->_dirty_vars())
{
***************
*** 117,121 ****
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM cdb_organization_client WHERE
organization_id="' .
$organization . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 117,121 ----
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM phpgw_cdb_org_client WHERE
organization_id="' .
$organization . '"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 135,139 ****
function create()
{
! $sql='INSERT INTO cdb_organization_client( ' .
'"account", ' .
'"billing_info", ' .
--- 135,139 ----
function create()
{
! $sql='INSERT INTO phpgw_cdb_org_client( ' .
'"account", ' .
'"billing_info", ' .
***************
*** 142,146 ****
'VALUES ("", "", "", "")';
$this->_db->query($sql,__LINE__,__FILE__);
! return
$this->_db->get_last_insert_id('cdb_organization_client',
'organization_id'));
--- 142,146 ----
'VALUES ("", "", "", "")';
$this->_db->query($sql,__LINE__,__FILE__);
! return
$this->_db->get_last_insert_id('phpgw_cdb_org_client',
'organization_id'));
***************
*** 153,157 ****
$organization_id =
$this->_get('organization_id');
}
! $sql='SELECT * FROM cdb_organization_client WHERE
organization_id="' .
$organization_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 153,157 ----
$organization_id =
$this->_get('organization_id');
}
! $sql='SELECT * FROM phpgw_cdb_org_client WHERE
organization_id="' .
$organization_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_organization.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_organization.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.cdb_organization.inc.php 17 Feb 2002 19:39:28 -0000 1.1
--- class.cdb_organization.inc.php 20 Feb 2002 22:12:58 -0000 1.2
***************
*** 45,51 ****
}
! /************************\
! * Public Functions *
! \************************/
/*!
@function organization_id
--- 45,51 ----
}
! /************************\
! * Public Functions *
! \************************/
/*!
@function organization_id
***************
*** 78,98 ****
// Create entry in organization
! $sql = 'INSERT INTO cdb_organization
("organization_name") ' .
'VALUES ("'.$name.'")';
$this->_db->query($sql,__LINE__,__FILE__);
$this->_let('organization_id',
!
$this->_db->get_last_insert_id('cdb_organization',
'organization_id'));
// Create entity_id entry
! $sql = 'INSERT INTO cdb_entity_id ("organization_id")
VALUES ("' .
$organization_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('cdb_entity_id',
'entity_id');
// Create entry in entity_meta
$status = "active";
! $sql = 'INSERT INTO cdb_entity_meta ("entity_id", ' .
'"status", ' .
'"created", ' .
--- 78,98 ----
// Create entry in organization
! $sql = 'INSERT INTO phpgw_cdb_org ("organization_name")
' .
'VALUES ("'.$name.'")';
$this->_db->query($sql,__LINE__,__FILE__);
$this->_let('organization_id',
!
$this->_db->get_last_insert_id('phpgw_cdb_org',
'organization_id'));
// Create entity_id entry
! $sql = 'INSERT INTO phpgw_cdb_entity_id
("organization_id") VALUES ("' .
$organization_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('phpgw_cdb_entity_id',
'entity_id');
// Create entry in entity_meta
$status = "active";
! $sql = 'INSERT INTO phpgw_cdb_entity_meta ("entity_id",
' .
'"status", ' .
'"created", ' .
***************
*** 112,116 ****
// Create enry in entity_note
! $sql = 'INSERT INTO cdb_entity_notes
("entity_id","note") VALUES ' .
'("' . $this->id() . '","")';
$this->_db->query($sql,__LINE__,__FILE__);
--- 112,116 ----
// Create enry in entity_note
! $sql = 'INSERT INTO phpgw_cdb_entity_notes
("entity_id","note") VALUES ' .
'("' . $this->id() . '","")';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 122,165 ****
}
! /*!
! @function exists
! @abstract Checks the existence of organization_id
! @discussion Checks for the existence of organization_id
! */
! function organization_exists($organization_id)
! {
! if (!is_int($organization_id))
! {
! $organization_id = $this->_get('organization_id');
! }
! $sql='SELECT * FROM cdb_entity_id WHERE organization_id="' .
! $organization_id . '"';
! $this->_db->query($sql,__LINE__,__FILE__);
! if ($this->_db->num_rows() > 0)
! {
! return $this->_db->f('entity_id');
! }
! else
! {
! return FALSE;
! }
! }
!
! /*!
! @function save
! @abstract Save recent changes
! @syntax int save()
! @discussion This will use the _dirty array to determine what needs
! to be written to the database and then write it. Returns true
when
! changes have been made and false if none have been made.
! @example1 if ($x->save())
! {
! print lang('Changes saved.');
! }
! else
! {
! print lang('No changes saved.');
! }
! */
function save()
{
--- 122,165 ----
}
! /*!
! @function organization_exists
! @abstract Checks the existence of organization_id
! @discussion Checks for the existence of organization_id
! */
! function organization_exists($organization_id)
! {
! if (!is_int($organization_id))
! {
! $organization_id =
$this->_get('organization_id');
! }
! $sql='SELECT * FROM phpgw_cdb_entity_id WHERE
organization_id="' .
! $organization_id . '"';
! $this->_db->query($sql,__LINE__,__FILE__);
! if ($this->_db->num_rows() > 0)
! {
! return $this->_db->f('entity_id');
! }
! else
! {
! return FALSE;
! }
! }
!
! /*!
! @function save
! @abstract Save recent changes
! @syntax int save()
! @discussion This will use the _dirty array to determine what
needs
! to be written to the database and then write it.
Returns true when
! changes have been made and false if none have been made.
! @example1 if ($x->save())
! {
! print lang('Changes saved.');
! }
! else
! {
! print lang('No changes saved.');
! }
! */
function save()
{
***************
*** 185,189 ****
// Build update query
! $sqlp = "UPDATE cdb_organization SET ";
if ($this->_dirty_vars())
{
--- 185,189 ----
// Build update query
! $sqlp = "UPDATE phpgw_cdb_org SET ";
if ($this->_dirty_vars())
{
***************
*** 198,202 ****
// the note is
in a diff table
// sine it's by
itself, just do db now
! $sql2.='UPDATE
cdb_entity_notes SET note="'.
$this->get_note().'" WHERE entity_id="'.
$this->id().'"';
--- 198,202 ----
// the note is
in a diff table
// sine it's by
itself, just do db now
! $sql2.='UPDATE
phpgw_cdb_entity_notes SET note="'.
$this->get_note().'" WHERE entity_id="'.
$this->id().'"';
***************
*** 257,261 ****
// Now lookup the main contact info
! $sql = 'SELECT * FROM cdb_organization WHERE
organization_id="' .
$organization_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 257,261 ----
// Now lookup the main contact info
! $sql = 'SELECT * FROM phpgw_cdb_org WHERE
organization_id="' .
$organization_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 279,283 ****
// Now take care of the note
! $sql = 'SELECT note FROM cdb_entity_notes WHERE
entity_id="' .
$this->id() . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 279,283 ----
// Now take care of the note
! $sql = 'SELECT note FROM phpgw_cdb_entity_notes WHERE
entity_id="' .
$this->id() . '"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 404,408 ****
$sql = 'SELECT location_id, location FROM ' .
! 'cdb_organization_locations WHERE
organization_id="' .
get_organization_id() . '"';
--- 404,408 ----
$sql = 'SELECT location_id, location FROM ' .
! 'cdb_org_locations WHERE organization_id="' .
get_organization_id() . '"';
Index: class.cdb_generic.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_generic.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.cdb_generic.inc.php 14 Feb 2002 05:06:39 -0000 1.4
--- class.cdb_generic.inc.php 20 Feb 2002 22:12:58 -0000 1.5
***************
*** 17,35 ****
! /* This class is extended by all cdb classes */
! class cdb_generic {
! /**************************\
! * Public Variables *
! \**************************/
!
! /**************************\
! * Local Variables *
! \**************************/
!
! /******************************************\
! * PHP does not support local vars. Use *
! * 'var $_varname;' to signify local vars. *
! \******************************************/
var $_ = array();
--- 17,35 ----
! /* This class is extended by all cdb classes */
! class cdb_generic {
! /**************************\
! * Public Variables *
! \**************************/
!
! /**************************\
! * Local Variables *
! \**************************/
!
! /******************************************\
! * PHP does not support local vars. Use *
! * 'var $_varname;' to signify local vars. *
! \******************************************/
var $_ = array();
***************
*** 37,45 ****
var $_id = 0;
var $_db;
! var $_loaded;
! /**************************\
! * Private Functions *
! \**************************/
function _var_valid($var)
{
--- 37,45 ----
var $_id = 0;
var $_db;
! var $_loaded;
! /**************************\
! * Private Functions *
! \**************************/
function _var_valid($var)
{
***************
*** 90,94 ****
}
! function _dirty_vars()
{
if (is_array($this->_dirty) && count($this->_dirty)>0)
--- 90,94 ----
}
! function _dirty_vars()
{
if (is_array($this->_dirty) && count($this->_dirty)>0)
***************
*** 115,121 ****
}
! /**************************\
! * Public Functions *
! \**************************/
function id()
{
--- 115,121 ----
}
! /**************************\
! * Public Functions *
! \**************************/
function id()
{
***************
*** 126,130 ****
{
$tmpdb = $GLOBALS['phpgw']->db;
! $sql = 'SELECT * FROM cdb_entity_id WHERE contact_id="' .
$contact_id . '"';
$tmpdb->query($sql,__LINE__,__FILE__);
--- 126,130 ----
{
$tmpdb = $GLOBALS['phpgw']->db;
! $sql = 'SELECT * FROM phpgw_cdb_entity_id WHERE contact_id="' .
$contact_id . '"';
$tmpdb->query($sql,__LINE__,__FILE__);
***************
*** 134,138 ****
function get_entity_id_from_org($org_id)
{
! // TODO
}
--- 134,142 ----
function get_entity_id_from_org($org_id)
{
! $tmpdb = $GLOBALS['phpgw']->db;
! $sql = 'SELECT * FROM phpgw_cdb_entity_id WHERE
organization_id="' .
! $org_id . '"';
! $tmpdb->query($sql,__LINE__,__FILE__);
! return $tmpdb->f('entity_id');
}
***************
*** 152,156 ****
if(is_int($entity_id))
{
! // do stuff
}
else
--- 156,160 ----
if(is_int($entity_id))
{
! // do stuff
}
else
***************
*** 167,171 ****
if(is_int($entity_id))
{
! // do stuff
}
else
--- 171,175 ----
if(is_int($entity_id))
{
! // do stuff
}
else
Index: class.cdb_entity_meta.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_entity_meta.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_entity_meta.inc.php 13 Feb 2002 22:35:02 -0000 1.2
--- class.cdb_entity_meta.inc.php 20 Feb 2002 22:12:58 -0000 1.3
***************
*** 1,307 ****
! <?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Patrick Walsh <address@hidden> *
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /*!
! @class cdb_entity_meta
! @abstract Meta data for entities
! @syntax CreateObject('cdb.cdb_entity_meta');
! @example $x = CreateObject('cdb.cdb_entity_meta');
! @author mr_e
! @copyright GPL
! @package cdb
! @access public
! */
!
! class cdb_entity_meta extends cdb_generic
! {
! var _modified;
!
! function cdb_entity_meta()
! {
! $this->_db = $GLOBALS['phpgw']->db;
! $this->_ = array(
! 'entity_type' => 'contact', //'contact' or
'organization'
! 'status' => 'pending',
//'pending','active',or'deleted'
! 'created' => 0,
! 'modified' => 0,
! 'file_as' => '',
! 'followup_status' => 0,
! 'created_by' => 0,
! 'keywords' => '',
! 'group_access' => 0,
! 'version' => $GLOBALS['cdb_ver'],
! 'ldap_sync' => 0,
! 'ldap_dn' => ''
! );
! }
!
! /*!
! @function get_type
! @abstract Returns the entity type
! @discussion Returns either 'contact' or 'organization'
! */
! function get_type()
! {
! return $this->_get('entity_type');
! }
!
! /*!
! @function let_type
! @abstract Sets the entity type
! @discussion Returns either 'contact' or 'organization'
! */
! function let_type($new_type)
! {
! if (strtolower($new_type) == 'contact')
! {
! $this->_let('entity_type', 'contact');
! }
! elseif(strtolower(substr($new_type,0,3)) == 'org')
! {
! $this->_let('entity_type', 'organization');
! }
! }
!
! /*!
! @function save
! @abstract Saves any changed meta data
! @discussion Returns true if any data has changed and false if
nothing
! has changed.
! */
! function save()
! {
! if($this->id() && $this->exists($this->id()) &&
$this->can_write()
! && $this->loaded())
! {
! // Build query
! $sqlp = "UPDATE cdb_entity_meta SET ";
! reset($this->_dirty);
! do
! $key = key($this->_dirty);
! switch($key)
! {
! default:
! $sql.=$key.'="';
! }
! $sql .= $this->_get($key) . '", ';
! while (next($this->_dirty));
! if ($sql || $this->_modified)
! {
! //There was dirty data, so update the
modified date
! $sql .= 'modified="' . time() . '"' .
! ' WHERE entity_id="' .
$this->id() . '"';
!
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
! $this->_modified = FALSE;
! $this->_dirty = array();
! return TRUE;
! }
! else
! {
! return FALSE;
! }
! }
! else
! {
! //TODO: raise a major error! Can't save an
unloaded class
! return FALSE;
! }
! }
!
! function load($entity_id)
! {
! $this->_loaded = FALSE;
! $this->_modified = FALSE;
! $this->_id = 0;
!
! // Retrieve the type of entity. If the entity doesn't
exist,
! // FALSE will be returned and we should return false as
well.
! $entity = CreateObject('cdb.cdb_entity');
! if (! $type = $entity->get_type($entity_id))
! {
! return FALSE;
! }
!
! $this->_id = $entity_id;
!
! $sql = 'SELECT * FROM cdb_entity_meta WHERE
entity_id="'.
! $entity_id . '"';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! reset($this->_);
! do
! $key = key($this->_);
! switch($key)
! {
! case 'entity_type':
! $this->_let($key,$type);
! break;
! default:
! $this->_let($key,$this->_db->f($key));
! }
! while(next($this->_));
! $this->_loaded = TRUE;
! }
!
! function create($entity_id)
! {
! $status = "active";
! $sql = 'INSERT INTO cdb_entity_meta ("entity_id","status",' .
! '"created","modified","file_as","created_by","version") '
.
! 'VALUES ("'.$this->id().'","'.$status.'","'.time().'","' .
! time().'","'.$file_as.'","' .
! $GLOBALS['phpgw_info']['user']['account_id'].'","' .
! $cdb_ver.'")';
! $this->_db->query($sql,__LINE__,__FILE__);
! }
!
! function date_created()
! {
! return $this->_get('created');
! }
!
! function set_modified()
! {
! $this->_modified=TRUE;
! }
!
! function date_modified()
! {
! return $this->_get('modified');
! }
!
! function created_by()
! {
! return $this->_get('created_by');
! }
!
! function version()
! {
! return $this->_get('version');
! }
!
! function get_status()
! {
! /* Can be either 'active', 'pending', 'deleted' */
! return $this->_get('status');
! }
!
! function let_status($status)
! {
! switch ($status)
! {
! case 'active':
! case 'pending':
! case 'deleted':
! return $this->_let('status', $status);
! break;
! default:
! return FALSE;
! }
! }
!
! function get_file_as()
! {
! return $this->_get('file_as');
! }
!
! function let_file_as($file_as)
! {
! return $this->_let('file_as', $file_as);
! }
!
! function get_followup_status()
! {
! return $this->_get('followup_status');
! }
!
! function let_followup_status($followup)
! {
! if(is_int($intStatus))
! {
! //TODO: Check for valid followup status
! return $this->_let('followup_status',
$intStatus);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_keywords()
! {
! return $this->_get('keywords');
! }
!
! function let_keywords($keywords)
! {
! /* keywords should either be an array or a comma
separated list */
! if(is_array($keywords))
! {
! return $this->_let('keywords',
implode(',',$keywords);
! }
! else if (is_string($keywords))
! {
! return $this->_let('keywords',$keywords);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_group_access()
! {
! return $this->_get('group_access');
! }
!
! function let_group_access($groupaccess)
! {
! if(is_int($groupaccess))
! {
! return $this->_let('group_access',
$groupaccess);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_ldap_sync()
! {
! return $this->_get('ldap_sync');
! }
!
! function let_ldap_sync($ldap_sync)
! {
! return $this->_let(intval($ldap_sync));
! }
!
! function get_ldap_dn()
! {
! /* if ldap_sync is true, and this record has already
been
! propogated, then this will return the dn which can
directly
! reference the ldap entry.
! */
! $this->_get('ldap_dn');
! }
!
! function let_ldap_dn($ldap_dn)
! {
! return $this->_let('ldap_dn');
! }
! }
! ?>
--- 1,309 ----
! <?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Patrick Walsh <address@hidden> *
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /*!
! @class cdb_entity_meta
! @abstract Meta data for entities
! @syntax CreateObject('cdb.cdb_entity_meta');
! @example $x = CreateObject('cdb.cdb_entity_meta');
! @author mr_e
! @copyright GPL
! @package cdb
! @access public
! */
!
! class cdb_entity_meta extends cdb_generic
! {
! var _modified;
!
! function cdb_entity_meta()
! {
! $this->_db = $GLOBALS['phpgw']->db;
! $this->_ = array(
! //'contact' or 'organization'
! 'entity_type' => 'contact',
! //'pending','active',or'deleted'
! 'status' => 'pending',
! 'created' => 0,
! 'modified' => 0,
! 'file_as' => '',
! 'followup_status' => 0,
! 'created_by' => 0,
! 'keywords' => '',
! 'group_access' => 0,
! 'version' => $GLOBALS['cdb_ver'],
! 'ldap_sync' => 0,
! 'ldap_dn' => ''
! );
! }
!
! /*!
! @function get_type
! @abstract Returns the entity type
! @discussion Returns either 'contact' or 'organization'
! */
! function get_type()
! {
! return $this->_get('entity_type');
! }
!
! /*!
! @function let_type
! @abstract Sets the entity type
! @discussion Returns either 'contact' or 'organization'
! */
! function let_type($new_type)
! {
! if (strtolower($new_type) == 'contact')
! {
! $this->_let('entity_type', 'contact');
! }
! elseif(strtolower(substr($new_type,0,3)) == 'org')
! {
! $this->_let('entity_type', 'organization');
! }
! }
!
! /*!
! @function save
! @abstract Saves any changed meta data
! @discussion Returns true if any data has changed and false if
nothing
! has changed.
! */
! function save()
! {
! if($this->id() && $this->exists($this->id()) &&
$this->can_write()
! && $this->loaded())
! {
! // Build query
! $sqlp = "UPDATE phpgw_cdb_entity_meta SET ";
! reset($this->_dirty);
! do
! $key = key($this->_dirty);
! switch($key)
! {
! default:
! $sql.=$key.'="';
! }
! $sql .= $this->_get($key) . '", ';
! while (next($this->_dirty));
! if ($sql || $this->_modified)
! {
! //There was dirty data, so update the
modified date
! $sql .= 'modified="' . time() . '"' .
! ' WHERE entity_id="' .
$this->id() . '"';
!
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
! $this->_modified = FALSE;
! $this->_dirty = array();
! return TRUE;
! }
! else
! {
! return FALSE;
! }
! }
! else
! {
! //TODO: raise a major error! Can't save an
unloaded class
! return FALSE;
! }
! }
!
! function load($entity_id)
! {
! $this->_loaded = FALSE;
! $this->_modified = FALSE;
! $this->_id = 0;
!
! // Retrieve the type of entity. If the entity doesn't
exist,
! // FALSE will be returned and we should return false as
well.
! $entity = CreateObject('cdb.cdb_entity');
! if (! $type = $entity->get_type($entity_id))
! {
! return FALSE;
! }
!
! $this->_id = $entity_id;
!
! $sql = 'SELECT * FROM phpgw_cdb_entity_meta WHERE
entity_id="'.
! $entity_id . '"';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! reset($this->_);
! do
! $key = key($this->_);
! switch($key)
! {
! case 'entity_type':
! $this->_let($key,$type);
! break;
! default:
!
$this->_let($key,$this->_db->f($key));
! }
! while(next($this->_));
! $this->_loaded = TRUE;
! }
!
! function create($entity_id)
! {
! $status = "active";
! $sql = 'INSERT INTO phpgw_cdb_entity_meta
("entity_id","status",' .
!
'"created","modified","file_as","created_by","version") ' .
! 'VALUES
("'.$this->id().'","'.$status.'","'.time().'","' .
! time().'","'.$file_as.'","' .
!
$GLOBALS['phpgw_info']['user']['account_id'].'","' .
! $cdb_ver.'")';
! $this->_db->query($sql,__LINE__,__FILE__);
! }
!
! function date_created()
! {
! return $this->_get('created');
! }
!
! function set_modified()
! {
! $this->_modified=TRUE;
! }
!
! function date_modified()
! {
! return $this->_get('modified');
! }
!
! function created_by()
! {
! return $this->_get('created_by');
! }
!
! function version()
! {
! return $this->_get('version');
! }
!
! function get_status()
! {
! /* Can be either 'active', 'pending', 'deleted' */
! return $this->_get('status');
! }
!
! function let_status($status)
! {
! switch ($status)
! {
! case 'active':
! case 'pending':
! case 'deleted':
! return $this->_let('status', $status);
! break;
! default:
! return FALSE;
! }
! }
!
! function get_file_as()
! {
! return $this->_get('file_as');
! }
!
! function let_file_as($file_as)
! {
! return $this->_let('file_as', $file_as);
! }
!
! function get_followup_status()
! {
! return $this->_get('followup_status');
! }
!
! function let_followup_status($followup)
! {
! if(is_int($intStatus))
! {
! //TODO: Check for valid followup status
! return $this->_let('followup_status',
$intStatus);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_keywords()
! {
! return $this->_get('keywords');
! }
!
! function let_keywords($keywords)
! {
! /* keywords should either be an array or a comma
separated list */
! if(is_array($keywords))
! {
! return $this->_let('keywords',
implode(',',$keywords);
! }
! else if (is_string($keywords))
! {
! return $this->_let('keywords',$keywords);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_group_access()
! {
! return $this->_get('group_access');
! }
!
! function let_group_access($groupaccess)
! {
! if(is_int($groupaccess))
! {
! return $this->_let('group_access',
$groupaccess);
! }
! else
! {
! return FALSE;
! }
! }
!
! function get_ldap_sync()
! {
! return $this->_get('ldap_sync');
! }
!
! function let_ldap_sync($ldap_sync)
! {
! return $this->_let(intval($ldap_sync));
! }
!
! function get_ldap_dn()
! {
! /* if ldap_sync is true, and this record has already
been
! propogated, then this will return the dn which can
directly
! reference the ldap entry.
! */
! $this->_get('ldap_dn');
! }
!
! function let_ldap_dn($ldap_dn)
! {
! return $this->_let('ldap_dn');
! }
! }
! ?>
Index: class.cdb_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_entity.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.cdb_entity.inc.php 14 Feb 2002 05:06:39 -0000 1.5
--- class.cdb_entity.inc.php 20 Feb 2002 22:12:58 -0000 1.6
***************
*** 72,76 ****
$this->_id = 0;
! $sql = 'SELECT * FROM cdb_entity_id WHERE ' .
'entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 72,76 ----
$this->_id = 0;
! $sql = 'SELECT * FROM phpgw_cdb_entity_id WHERE ' .
'entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 156,162 ****
if ($org_id = $this->_org->create(''))
{
! $sql = 'INSERT INO cdb_entity_id
("organization_id") VALUES ("' . $org_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('cdb_entity_id','entity_id');
$this->_loaded = TRUE;
return $this->id();
--- 156,162 ----
if ($org_id = $this->_org->create(''))
{
! $sql = 'INSERT INTO phpgw_cdb_entity_id
("organization_id") VALUES ("' . $org_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('phpgw_cdb_entity_id','entity_id');
$this->_loaded = TRUE;
return $this->id();
***************
*** 192,196 ****
$entity_id = $this->id();
}
! $sql='SELECT * FROM cdb_entity_id WHERE
entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
if ($this->_db->num_rows() > 0)
--- 192,196 ----
$entity_id = $this->id();
}
! $sql='SELECT * FROM phpgw_cdb_entity_id WHERE
entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
if ($this->_db->num_rows() > 0)
***************
*** 217,221 ****
if (is_int($entity_id))
{
! $sql = 'SELECT * FROM cdb_entity_id WHERE ' .
'entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 217,221 ----
if (is_int($entity_id))
{
! $sql = 'SELECT * FROM phpgw_cdb_entity_id WHERE
' .
'entity_id="'.$entity_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_contact_phone.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_phone.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.cdb_contact_phone.inc.php 14 Feb 2002 04:25:42 -0000 1.3
--- class.cdb_contact_phone.inc.php 20 Feb 2002 22:12:58 -0000 1.4
***************
*** 48,52 ****
$this->_id = $entity_id;
$this->_loaded = TRUE;
! $sql = 'SELECT contact_phone_id FROM cdb_contact_phone
WHERE ' .
'entity_id="' . $entity_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 48,52 ----
$this->_id = $entity_id;
$this->_loaded = TRUE;
! $sql = 'SELECT contact_phone_id FROM
phpgw_cdb_contact_phone WHERE ' .
'entity_id="' . $entity_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_contact_personal.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_personal.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.cdb_contact_personal.inc.php 15 Feb 2002 19:25:31 -0000 1.5
--- class.cdb_contact_personal.inc.php 20 Feb 2002 22:12:58 -0000 1.6
***************
*** 133,137 ****
if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
{
! $sqlp = "UPDATE cdb_contact_personal SET ";
if ($this->_dirty_vars())
{
--- 133,137 ----
if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
{
! $sqlp = "UPDATE phpgw_cdb_contact_personal SET
";
if ($this->_dirty_vars())
{
***************
*** 169,173 ****
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM cdb_contact_personal WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 169,173 ----
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM phpgw_cdb_contact_personal WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 196,200 ****
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM cdb_contact_personal WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 196,200 ----
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM phpgw_cdb_contact_personal WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 221,225 ****
}
! $sql='INSERT INTO cdb_contact_personal ("contact_id", '
.
'"birthday", "children", "gender",
"gov_id_num", ' .
'"hobbies", "language", "spouse", "anniversary"
) ' .
--- 221,225 ----
}
! $sql='INSERT INTO phpgw_cdb_contact_personal
("contact_id", ' .
'"birthday", "children", "gender",
"gov_id_num", ' .
'"hobbies", "language", "spouse", "anniversary"
) ' .
Index: class.cdb_contact_internet.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_internet.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.cdb_contact_internet.inc.php 14 Feb 2002 22:51:39 -0000 1.1
--- class.cdb_contact_internet.inc.php 20 Feb 2002 22:12:58 -0000 1.2
***************
*** 1,296 ****
<?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Brian Morel <brianmorel AT yahoo DOT com>
*
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /* This file is to be should work, but needs to be tested*/
!
! class cdb_contact_internet extends cdb_generic_class
! {
! function cdb_contact_internet()
! {
! /* add vars that have get/let interface to this array.
*/
! $this->_db = $GLOBALS['phpgw']->db;
! $this->_ = array(
! 'contact_id' => 0,
! 'email_home' => '',
! 'email_home_display' => '',
! 'email_business' => '',
! 'email_business_display' => '',
! 'email_other' => '',
! 'email_other_display' => '',
! 'ftp' => '',
! 'free_busy_address' => '',
! 'personal_home_page' => '',
! 'business_home_page' => '',
! 'other_home_page' => '',
! 'send_as_plain_text' => 1,
! 'icq' => ''
! );
! }
!
! function get_email_home()
! {
! return $this->_get('email_home');
! }
!
! function let_email_home($new_email_home)
! {
! return $this->_let('email_home', $new_email_home);
! }
!
! function get_email_home_display()
! {
! return $this->_get('email_home_display');
! }
!
! function let_email_home_display($new_email_home_display)
! {
! return $this->_let('email_home_display',
$new_email_home_display);
! }
!
! function get_email_business()
! {
! return $this->_get('email_business');
! }
!
! function let_email_business($new_email_business)
! {
! return $this->_let('email_business',
$new_email_business);
! }
!
! function get_email_business_display()
! {
! return $this->_get('email_business_display');
! }
!
! function let_email_business_display($new_email_business_display)
! {
! return $this->_let('email_business_display',
$new_email_business_display);
! }
!
! function get_email_other()
! {
! return $this->_get('email_other');
! }
!
! function let_email_other($new_email_other)
! {
! return $this->_let('email_other', $new_email_other);
! }
!
! function get_email_other_display()
! {
! return $this->_get('email_other_display');
! }
!
! function let_email_other_display($new_email_other_display)
! {
! return $this->_let('email_other_display',
$new_email_other_display);
! }
!
! function get_ftp()
! {
! return $this->_get('ftp');
! }
!
! function let_ftp($new_ftp)
! {
! return $this->_let('ftp', $new_ftp);
! }
!
! function get_free_busy_address()
! {
! return $this->_get('free_busy_address');
! }
!
! function let_free_busy_address($new_free_busy_address)
! {
! return $this->_let('free_busy_address',
$new_free_busy_address);
! }
!
! function get_personal_home_page()
! {
! return $this->_get('personal_home_page');
! }
!
! function let_personal_home_page($new_personal_home_page)
! {
! return $this->_let('personal_home_page',
$new_personal_home_page);
! }
!
! function get_business_home_page()
! {
! return $this->_get('business_home_page');
! }
!
! function let_business_home_page($new_business_home_page)
! {
! return $this->_let('business_home_page',
$new_business_home_page);
! }
!
! function get_other_home_page()
! {
! return $this->_get('other_home_page');
! }
!
! function let_other_home_page($new_other_home_page)
! {
! return $this->_let('other_home_page',
$new_other_home_page);
! }
!
! function get_send_as_plain_text()
! {
! return $this->_get('send_as_plain_text');
! }
!
! function let_send_as_plain_text($new_send_as_plain_text)
! {
! return $this->_let('send_as_plain_text',
$new_send_as_plain_text);
! }
!
! function get_icq()
! {
! return $this->_get('icq');
! }
!
! function let_icq($new_icq)
! {
! return $this->_let('icq', $new_icq);
! }
!
! function save()
! {
! if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
! {
! $sqlp = "UPDATE cdb_contact_internet SET ";
! if ($this->_dirty_vars())
! {
! reset($this->_dirty);
! do
! {
! $key = key($this->_dirty);
! $sql.=$key.'="';
! $sql .= $this->_get($key) . '", ';
! } while (next($this->_dirty));
! if ($sql)
! {
! $sql .= 'contact_id="' .
$this->get_contact_id().'"'.
! ' WHERE
contact_id="'.$this->get_contact_id().'"';
!
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
! }
! }
!
! $this->_dirty = array();
!
! return TRUE;
! }
! else
! {
! //TODO: raise a major error!
! return FALSE;
! }
! }
!
! function load($contact_id)
! {
! if (!$this->contact_exists($contact_id))
! {
! $this->_create($contact_id);
! }
!
! $this->_loaded = FALSE;
! $this->_dirty = array();
!
!
! $sql = 'SELECT * FROM cdb_contact_internet WHERE
contact_id="' .
! $contact_id.'"';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! reset($this->_);
! do
! {
! $key = key($this->_);
! $this->_let($key,$this->_db->f($key));
! } while(next($this->_));
!
!
!
! $this->_loaded = TRUE;
! return TRUE;
!
! }
!
! /*!
! @function contact_exists
! @abstract Checks the existence of contact_id
! @discussion Checks for the existence of contact_id
! */
! function contact_exists($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
! $sql='SELECT * FROM cdb_contact_internet WHERE contact_id="' .
! $contact_id.'"';
! $this->_db->query($sql,__LINE__,__FILE__);
! if ($this->_db->num_rows() > 0)
! {
! return TRUE;
! }
! else
! {
! return FALSE;
! }
! }
!
! /*!
! @function _create
! @abstract Creates a new record in the cdb_contact_internet DB
! @discussion New with default values
! */
! function _create($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
!
! $sql='INSERT INTO cdb_contact_internet ("contact_id", ' .
! '"email_home", ' .
! '"email_home_display", ' .
! '"email_business", ' .
! '"email_business_display", ' .
! '"email_other", ' .
! '"email_other_display", ' .
! '"ftp", ' .
! '"free_busy_address", ' .
! '"personal_home_page", ' .
! '"business_home_page", ' .
! '"other_home_page", ' .
! '"send_as_plain_text", ' .
! '"icq" ' .
! ') ' .
! 'VALUES ("' .
! $contact_id .
! '", ' .
! '"", "", "", "", "", "", "", "", "", "", "", "1", "")';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! }
!
! }
! ?>
--- 1,293 ----
<?php
! /**************************************************************************\
! * phpGroupWare *
! * http://www.phpgroupware.org/ *
! * This file written by Brian Morel <brianmorel AT yahoo DOT com> *
! * ------------------------------------------------------------------------ *
! * Please see the documentation for these classes in the README file in *
! * this directory. *
! * ------------------------------------------------------------------------ *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! /* This file is to be should work, but needs to be tested*/
!
! class cdb_contact_internet extends cdb_generic_class
! {
! function cdb_contact_internet()
! {
! /* add vars that have get/let interface to this array.
*/
! $this->_db = $GLOBALS['phpgw']->db;
! $this->_ = array(
! 'contact_id' => 0,
! 'email_home' => '',
! 'email_home_display' => '',
! 'email_business' => '',
! 'email_business_display' => '',
! 'email_other' => '',
! 'email_other_display' => '',
! 'ftp' => '',
! 'free_busy_address' => '',
! 'personal_home_page' => '',
! 'business_home_page' => '',
! 'other_home_page' => '',
! 'send_as_plain_text' => 1,
! 'icq' => ''
! );
! }
!
! function get_email_home()
! {
! return $this->_get('email_home');
! }
!
! function let_email_home($new_email_home)
! {
! return $this->_let('email_home', $new_email_home);
! }
!
! function get_email_home_display()
! {
! return $this->_get('email_home_display');
! }
!
! function let_email_home_display($new_email_home_display)
! {
! return $this->_let('email_home_display',
$new_email_home_display);
! }
!
! function get_email_business()
! {
! return $this->_get('email_business');
! }
!
! function let_email_business($new_email_business)
! {
! return $this->_let('email_business',
$new_email_business);
! }
!
! function get_email_business_display()
! {
! return $this->_get('email_business_display');
! }
!
! function let_email_business_display($new_email_business_display)
! {
! return $this->_let('email_business_display',
$new_email_business_display);
! }
!
! function get_email_other()
! {
! return $this->_get('email_other');
! }
!
! function let_email_other($new_email_other)
! {
! return $this->_let('email_other', $new_email_other);
! }
!
! function get_email_other_display()
! {
! return $this->_get('email_other_display');
! }
!
! function let_email_other_display($new_email_other_display)
! {
! return $this->_let('email_other_display',
$new_email_other_display);
! }
!
! function get_ftp()
! {
! return $this->_get('ftp');
! }
!
! function let_ftp($new_ftp)
! {
! return $this->_let('ftp', $new_ftp);
! }
!
! function get_free_busy_address()
! {
! return $this->_get('free_busy_address');
! }
!
! function let_free_busy_address($new_free_busy_address)
! {
! return $this->_let('free_busy_address',
$new_free_busy_address);
! }
!
! function get_personal_home_page()
! {
! return $this->_get('personal_home_page');
! }
!
! function let_personal_home_page($new_personal_home_page)
! {
! return $this->_let('personal_home_page',
$new_personal_home_page);
! }
!
! function get_business_home_page()
! {
! return $this->_get('business_home_page');
! }
!
! function let_business_home_page($new_business_home_page)
! {
! return $this->_let('business_home_page',
$new_business_home_page);
! }
!
! function get_other_home_page()
! {
! return $this->_get('other_home_page');
! }
!
! function let_other_home_page($new_other_home_page)
! {
! return $this->_let('other_home_page',
$new_other_home_page);
! }
!
! function get_send_as_plain_text()
! {
! return $this->_get('send_as_plain_text');
! }
!
! function let_send_as_plain_text($new_send_as_plain_text)
! {
! return $this->_let('send_as_plain_text',
$new_send_as_plain_text);
! }
!
! function get_icq()
! {
! return $this->_get('icq');
! }
!
! function let_icq($new_icq)
! {
! return $this->_let('icq', $new_icq);
! }
!
! function save()
! {
! if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
! {
! $sqlp = "UPDATE phpgw_cdb_contact_internet SET
";
! if ($this->_dirty_vars())
! {
! reset($this->_dirty);
! do
! $key = key($this->_dirty);
! $sql.=$key.'="';
! $sql .= $this->_get($key) . '",
';
! while (next($this->_dirty));
! if ($sql)
! {
! $sql .= 'contact_id="' .
$this->get_contact_id().'"'.
! ' WHERE
contact_id="'.$this->get_contact_id().'"';
!
$this->_db->query($sqlp.$sql,__LINE__,__FILE__);
! }
! }
!
! $this->_dirty = array();
!
! return TRUE;
! }
! else
! {
! //TODO: raise a major error!
! return FALSE;
! }
! }
!
! function load($contact_id)
! {
! if (!$this->contact_exists($contact_id))
! {
! $this->_create($contact_id);
! }
!
! $this->_loaded = FALSE;
! $this->_dirty = array();
!
! $sql = 'SELECT * FROM phpgw_cdb_contact_internet WHERE
contact_id="' .
! $contact_id.'"';
! $this->_db->query($sql,__LINE__,__FILE__);
!
! reset($this->_);
! do
! $key = key($this->_);
! $this->_let($key,$this->_db->f($key));
! while(next($this->_));
!
! $this->_loaded = TRUE;
! return TRUE;
!
! }
!
! /*!
! @function contact_exists
! @abstract Checks the existence of contact_id
! @discussion Checks for the existence of contact_id
! */
! function contact_exists($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
!
! $sql='SELECT * FROM phpgw_cdb_contact_internet WHERE
contact_id="' .
! $contact_id.'"';
! $this->_db->query($sql,__LINE__,__FILE__);
! if ($this->_db->num_rows() > 0)
! {
! return TRUE;
! }
! else
! {
! return FALSE;
! }
! }
!
! /*!
! @function _create
! @abstract Creates a new record in the cdb_contact_internet DB
! @discussion New with default values
! */
! function _create($contact_id)
! {
! if (!is_int($contact_id))
! {
! $contact_id = $this->_get('contact_id');
! }
!
! $sql='INSERT INTO phpgw_cdb_contact_internet
("contact_id", ' .
! '"email_home", ' .
! '"email_home_display", ' .
! '"email_business", ' .
! '"email_business_display", ' .
! '"email_other", ' .
! '"email_other_display", ' .
! '"ftp", ' .
! '"free_busy_address", ' .
! '"personal_home_page", ' .
! '"business_home_page", ' .
! '"other_home_page", ' .
! '"send_as_plain_text", ' .
! '"icq" ' .
! ') ' .
! 'VALUES ("' .
! $contact_id .
! '", ' .
! '"", "", "", "", "", "", "", "", "", "", "",
"1", "")';
!
! $this->_db->query($sql,__LINE__,__FILE__);
!
! }
!
! }
! ?>
Index: class.cdb_contact_client.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_client.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.cdb_contact_client.inc.php 15 Feb 2002 21:35:58 -0000 1.1
--- class.cdb_contact_client.inc.php 20 Feb 2002 22:12:58 -0000 1.2
***************
*** 87,91 ****
if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
{
! $sqlp = "UPDATE cdb_contact_client SET ";
if ($this->_dirty_vars())
{
--- 87,91 ----
if($this->id() && $this->contact_exists($this->id()) &&
$this->can_write())
{
! $sqlp = "UPDATE phpgw_cdb_contact_client SET ";
if ($this->_dirty_vars())
{
***************
*** 134,138 ****
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM cdb_contact_client WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 134,138 ----
$this->_loaded = FALSE;
! $sql = 'SELECT * FROM phpgw_cdb_contact_client WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 162,166 ****
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM cdb_contact_client WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 162,166 ----
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM phpgw_cdb_contact_client WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 187,191 ****
}
! $sql='INSERT INTO cdb_contact_client ("contact_id", ' .
'"account", "billing_info", "customer_id",
"referred_by" ) ' .
'VALUES ("' . $contact_id . '", "", "", "", "")
';
--- 187,191 ----
}
! $sql='INSERT INTO phpgw_cdb_contact_client
("contact_id", ' .
'"account", "billing_info", "customer_id",
"referred_by" ) ' .
'VALUES ("' . $contact_id . '", "", "", "", "")
';
Index: class.cdb_contact_address.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact_address.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_contact_address.inc.php 15 Feb 2002 19:26:19 -0000 1.2
--- class.cdb_contact_address.inc.php 20 Feb 2002 22:12:58 -0000 1.3
***************
*** 48,52 ****
$this->_id = $entity_id;
$this->_loaded = TRUE;
! $sql = 'SELECT contact_address_id FROM
cdb_contact_address WHERE ' .
'entity_id="' . $entity_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 48,52 ----
$this->_id = $entity_id;
$this->_loaded = TRUE;
! $sql = 'SELECT contact_address_id FROM
phpgw_cdb_contact_addr WHERE ' .
'entity_id="' . $entity_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_contact.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_contact.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.cdb_contact.inc.php 14 Feb 2002 05:06:39 -0000 1.6
--- class.cdb_contact.inc.php 20 Feb 2002 22:12:58 -0000 1.7
***************
*** 104,108 ****
// Create entry in contact_main
! $sql = 'INSERT INTO cdb_contact_main
("first_name","last_name") ' .
'VALUES ("'.$fname.'","'.$lname.'")';
$this->_db->query($sql,__LINE__,__FILE__);
--- 104,108 ----
// Create entry in contact_main
! $sql = 'INSERT INTO phpgw_cdb_contact_main
("first_name","last_name") ' .
'VALUES ("'.$fname.'","'.$lname.'")';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 112,124 ****
// Create entity_id entry
! $sql = 'INSERT INTO cdb_entity_id ("contact_id") VALUES
("' .
$contact_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('cdb_entity_id',
'entity_id');
// Create entry in entity_meta
$status = "active";
! $sql = 'INSERT INTO cdb_entity_meta
("entity_id","status",' .
'"created","modified","file_as","created_by","version") ' .
'VALUES
("'.$this->id().'","'.$status.'","'.time().'","' .
--- 112,124 ----
// Create entity_id entry
! $sql = 'INSERT INTO phpgw_cdb_entity_id ("contact_id")
VALUES ("' .
$contact_id . '")';
$this->_db->query($sql,__LINE__,__FILE__);
! $this->_id =
$this->_db->get_last_insert_id('phpgw_cdb_entity_id',
'entity_id');
// Create entry in entity_meta
$status = "active";
! $sql = 'INSERT INTO phpgw_cdb_entity_meta
("entity_id","status",' .
'"created","modified","file_as","created_by","version") ' .
'VALUES
("'.$this->id().'","'.$status.'","'.time().'","' .
***************
*** 129,133 ****
// Create enry in entity_note
! $sql = 'INSERT INTO cdb_entity_notes
("entity_id","note") VALUES ' .
'("'.$this->id().'","")';
$this->_db->query($sql,__LINE__,__FILE__);
--- 129,133 ----
// Create enry in entity_note
! $sql = 'INSERT INTO phpgw_cdb_entity_notes
("entity_id","note") VALUES ' .
'("'.$this->id().'","")';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 150,154 ****
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM cdb_entity_id WHERE contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 150,154 ----
$contact_id = $this->_get('contact_id');
}
! $sql='SELECT * FROM phpgw_cdb_entity_id WHERE contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 222,226 ****
// Build update query
! $sqlp = "UPDATE cdb_contact_main SET ";
if ($this->_dirty_vars())
{
--- 222,226 ----
// Build update query
! $sqlp = "UPDATE phpgw_cdb_contact_main SET ";
if ($this->_dirty_vars())
{
***************
*** 235,239 ****
// the note is
in a diff table
// sine it's by
itself, just do db now
! $sql2.='UPDATE
cdb_entity_notes SET note="'.
$this->get_note().'" WHERE entity_id="'.
$this->id().'"';
--- 235,239 ----
// the note is
in a diff table
// sine it's by
itself, just do db now
! $sql2.='UPDATE
phpgw_cdb_entity_notes SET note="'.
$this->get_note().'" WHERE entity_id="'.
$this->id().'"';
***************
*** 291,295 ****
// Now lookup the main contact info
! $sql = 'SELECT * FROM cdb_contact_main WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 291,295 ----
// Now lookup the main contact info
! $sql = 'SELECT * FROM phpgw_cdb_contact_main WHERE
contact_id="' .
$contact_id.'"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 313,317 ****
// Now take care of the note
! $sql = 'SELECT note FROM cdb_entity_notes WHERE
entity_id="' .
$this->id() . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 313,317 ----
// Now take care of the note
! $sql = 'SELECT note FROM phpgw_cdb_entity_notes WHERE
entity_id="' .
$this->id() . '"';
$this->_db->query($sql,__LINE__,__FILE__);
Index: class.cdb_address.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/cdb/inc/class.cdb_address.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.cdb_address.inc.php 15 Feb 2002 19:26:35 -0000 1.2
--- class.cdb_address.inc.php 20 Feb 2002 22:12:58 -0000 1.3
***************
*** 40,44 ****
function get_type_name()
{
! $sql = 'SELECT address_category_name FROM
cdb_contact_address_category'.
'WHERE
address_category_id="'.$this->_get('address_category_id').
'"';
--- 40,44 ----
function get_type_name()
{
! $sql = 'SELECT address_category_name FROM
phpgw_cdb_contact_addr_cat'.
'WHERE
address_category_id="'.$this->_get('address_category_id').
'"';
***************
*** 100,104 ****
{
// Build update query
! $sqlp = "UPDATE cdb_contact_phone SET ";
if ($this->_dirty_vars())
{
--- 100,104 ----
{
// Build update query
! $sqlp = "UPDATE phpgw_cdb_contact_addr SET ";
if ($this->_dirty_vars())
{
***************
*** 133,137 ****
function load($address_id)
{
! $sql = 'SELECT * FROM cdb_contact_address WHERE
contact_address_id="' .
$address_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
--- 133,137 ----
function load($address_id)
{
! $sql = 'SELECT * FROM phpgw_cdb_contact_addr WHERE
contact_address_id="' .
$address_id . '"';
$this->_db->query($sql,__LINE__,__FILE__);
***************
*** 156,160 ****
$this->_loaded = TRUE;
$this->_dirty = array();
! $sql = 'INSERT INTO cdb_contact_address ( ' .
'"entity_id",' .
'"address_category_id", ' .
--- 156,160 ----
$this->_loaded = TRUE;
$this->_dirty = array();
! $sql = 'INSERT INTO phpgw_cdb_contact_addr ( ' .
'"entity_id",' .
'"address_category_id", ' .
***************
*** 173,177 ****
$this->_id = $entity_id;
$this->_let('contact_address_id',
! $this->_db->get_last_insert_id('cdb_contact_address',
'contact_address_id'));
--- 173,177 ----
$this->_id = $entity_id;
$this->_let('contact_address_id',
!
$this->_db->get_last_insert_id('phpgw_cdb_contact_address',
'contact_address_id'));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: cdb/inc class.cdb_phone.inc.php,1.5,1.6 class.cdb_organization_location.inc.php,1.3,1.4 class.cdb_organization_client.inc.php,1.1,1.2 class.cdb_organization.inc.php,1.1,1.2 class.cdb_generic.inc.php,1.4,1.5 class.cdb_entity_meta.inc.php,1.2,1.3 class.cdb_entity.inc.php,1.5,1.6 class.cdb_contact_phone.inc.php,1.3,1.4 class.cdb_contact_personal.inc.php,1.5,1.6 class.cdb_contact_internet.inc.php,1.1,1.2 class.cdb_contact_client.inc.php,1.1,1.2 class.cdb_contact_address.inc.php,1.2,1.3 class.cdb_contact.inc.php,1.6,1.7 class.cdb_address.inc.php,1.2,1.3,
Brian Morel <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: cdb/doc cdb.sql,1.10,1.11
- Next by Date:
[Phpgroupware-cvs] CVS: cdb/setup tables_baseline.inc.php,NONE,1.1 tables_current.inc.php,1.1,1.2 setup.inc.php,1.3,1.4
- Previous by thread:
[Phpgroupware-cvs] CVS: cdb/doc cdb.sql,1.10,1.11
- Next by thread:
[Phpgroupware-cvs] CVS: cdb/setup tables_baseline.inc.php,NONE,1.1 tables_current.inc.php,1.1,1.2 setup.inc.php,1.3,1.4
- Index(es):