phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.bojsaddressbook.inc.php, NONE


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.bojsaddressbook.inc.php, NONE, 1.1.2.1 class.contact_accounts.inc.php, NONE, 1.1.2.1 class.contact_addr.inc.php, NONE, 1.1.2.1 class.contact_addr_type.inc.php, NONE, 1.1.2.1 class.contact_categories.inc.php, NONE, 1.1.2.1 class.contact_central.inc.php, NONE, 1.1.2.1 class.contact_comm.inc.php, NONE, 1.1.2.1 class.contact_comm_descr.inc.php, NONE, 1.1.2.1 class.contact_comm_type.inc.php, NONE, 1.1.2.1 class.contact_note.inc.php, NONE, 1.1.2.1 class.contact_note_type.inc.php, NONE, 1.1.2.1 class.contact_org.inc.php, NONE, 1.1.2.1 class.contact_org_person.inc.php, NONE, 1.1.2.1 class.contact_others.inc.php, NONE, 1.1.2.1 class.contact_person.inc.php, NONE, 1.1.2.1 class.contact_types.inc.php, NONE, 1.1.2.1 class.sql.inc.php, NONE, 1.1.2.1 class.sql_builder.inc.php, NONE, 1.1.2.1 class.sql_criteria.inc.php, NONE, 1.1.2.1 class.sql_entity.inc.php, NONE, 1.1.2.1 class.sql_mysql.inc.php, NONE, 1.1.2.1 class.sql_pgsql.inc.php, NONE, 1.1.2.1 class.uijsaddressbook.inc.php, NONE, 1.1.2.1 class.contacts_ldap.inc.php, 1.11.2.5.2.2, 1.11.2.5.2.3 class.contacts_shared.inc.php, 1.9.2.1.2.2, 1.9.2.1.2.3 class.contacts_sql.inc.php, 1.17.2.2.2.1, 1.17.2.2.2.2 class.nextmatchs.inc.php, 1.43.2.6.2.3, 1.43.2.6.2.4
Date: Mon, 08 Sep 2003 09:26:41 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.contacts_ldap.inc.php class.contacts_shared.inc.php 
        class.contacts_sql.inc.php class.nextmatchs.inc.php 
Added Files:
      Tag: Version-0_9_16-branch
        class.bojsaddressbook.inc.php class.contact_accounts.inc.php 
        class.contact_addr.inc.php class.contact_addr_type.inc.php 
        class.contact_categories.inc.php class.contact_central.inc.php 
        class.contact_comm.inc.php class.contact_comm_descr.inc.php 
        class.contact_comm_type.inc.php class.contact_note.inc.php 
        class.contact_note_type.inc.php class.contact_org.inc.php 
        class.contact_org_person.inc.php class.contact_others.inc.php 
        class.contact_person.inc.php class.contact_types.inc.php 
        class.sql.inc.php class.sql_builder.inc.php 
        class.sql_criteria.inc.php class.sql_entity.inc.php 
        class.sql_mysql.inc.php class.sql_pgsql.inc.php 
        class.uijsaddressbook.inc.php 
Log Message:
Adding new contacts backend ... and associated code


--- NEW FILE ---
<?php
/**************************************************************************\
 * phpGroupWare - Todo list                                                 *
 * http://www.phpgroupware.org                                              *
 * Written by Alex Borges <address@hidden>                          *
 * Low Level Design also by    Dave Hall address@hidden                         
 *
 * UI Design and market research by Gerardo Ramirez address@hidden
 *-----------------------------------------------                          *
 *  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.                                              *
 \**************************************************************************/

/*!
  @class bojsaddressbiij
  @abstract logic for the javascript addressbook is here
  @author Lex 
  @ discussion  Understand that
  this is my first attempt to a bo,ui pair of objects
  that will do the job. I turned to do this because
  this thingie has to be available for use by all the
  phpgw 0.9.14 apps.
  My approach is to use abstraction as much as possible.
  This class will handle all data. DATA you hear? 
  This means that the state of the abstraction we call
  the cool addressbook chooser is here.... THE STATE!
  Nothing webish about this file. This file will no receive
  ever variables from HTTP_POST or GET. That is for the UI class
  to handle. This class has methods that receive parameters so you 
  can use it from anyware.
 */
         class bojsaddressbook
        {
                //@param $contacts phpgwapi contacts object
                var $contacts;
                //@param destboxes array that has the state of the three 
possible destination boxes
                //this thing will have the title of the destination boxes and 
their content
                //this class is session cache enabled. When you solicit the 
content of 
                //this boxes this class may get it from cache if it thinks its 
necesary
                //the boxes are named toselectbox,ccselectbox  and 
bccselectbox. 
                var $destboxes;
                //@param contactquery this is an array that holds the parameters
                //to make a query for  the contacts class. The contact class 
takes
                //as parameters: integers: start,offset. The cols array that 
has the fields that should be returned.
                //The query string that returns whatever matches the given 
string for the fields provided
                //the filter string to match against non contact fields. The 
sort boolean and the extra sort_by parameter
                //to sort by a given field.
                var $contactquery;
                //@param queryresult its the array with actual user data that 
we have gotten from contacts
                var $queryresults;
                //@param cachestate Its an internal var to tell us if we should 
expire the cache
                var $cachestate="dirty";
                var $debug = False;
                //@param result Which has an array of results from querying the 
contacts backend.
                var $result;
                //@param mass_query_cols Is an array that tells the backends 
which fields to get from the
                //contacts backend for FULL QUERIES. Full queries are made upon 
construction of this
                //object. They are different from single queries in that full 
queries are supposed to get
                //A list of contacts, each having their own fields given by 
this array.
                var $mass_query_cols = array (
                                'title'     => 'title',
                                'n_given'    => 'n_given',
                                'n_family'   => 'n_family',
                                'email'      => 'email',
                                'org_name' => 'org_name',
                                'email_home'  => 'email_home'
                                );
                //@param single_query_cols This array is similar to the one 
above except this is for
                //SINGLE QUERIES. This queries happen when you call the 
get_userdata method to get
                //the record of a single entry in the contacts backend
                //To add a field to fetch back from userdata
                //u need to add the field u want here
                //Also, in class.uijsaddressbook there is a translation array 
that has
                //the names of each field in english. Use it to decide what 
values to add here
                var $single_query_cols =  array (
                                'title'     => 'title',
                                'n_given'    => 'n_given',
                                'n_family'   => 'n_family',
                                'org_name' => 'org_name',
                                'tel_work' => 'tel_work',
                                'cat_id'  => 'cat_id'
                                );
                //@param use_session Not used at the moment
                var $use_session=true;

                //@function bojsaddressbook 
                //@abstract This class's contructor
                //@param contactquery Its a query array in the form explained 
as:
                //      order: Must be equal to the order in which you want the 
query...ASC or DESC
                //      categories: Must have the categories string as 
constrained by the categories class
                //                  ,1,2 or 1,2 are valid strings to say, 
category number 1 and 2
                //      filter: This is a whole parameter in itself, will 
explain bellow in the parse_contactquery discussion
                //      query: Freestyle query to match against any fields in a 
mass query
                //      sort:  The field to sort by.... n_give will sort by 
name, for example
                //      directory_uid: This field may be empty but, if it has a 
number in it
                //      we will search in the contacts owned by the user whose 
uid matches this value
                //@param queryresults UNUSED, might use it for caching state 
purposes later on
                //@discussion 
                //This function checks its cache. All parameters are optional. 
If called with no parameters
                //the class will assume all that it needs is in the cache and 
will get it from there
                //If a contactquery value is supplied, the class will desregard 
its cache and go fetch the whole
                //query again. 
                //To be truth, its actually quite stupid and we should be using 
more intelligence to decide
                //if the cache is stale.... for example, caching the result 
form parse_contactquery and
                //compare it with what results from parsing the incoming 
contactquery. If its the same,
                //we shouldnt refetch.
                function bojsaddressbook($contactquery="",$queryresults="")
                {
                        $this->contactsobject=CreateObject('phpgwapi.contacts');
                        //the idea is that here, right here, nowhere else, do 
we decide what to keep
                        //from the cache and what to go and query again
                                $data=$this->read_sessiondata();
                                if(is_array($contactquery))
                                {
                                        
$this->parse_contactquery($contactquery);
                                        
$data['result']=$this->contactsobject->read($this->contactquery['start'],$this->contactquery['offset'],
                                                        
$this->mass_query_cols,$this->contactquery['query'],
                                                        
$this->contactquery['filter'],
                                                        
$this->contactquery['sort'],
                                                        $this->sortby);
                                        $this->save_sessiondata($data);
                                }

                                $this->result=$data['result'];

                }
                //@function parse_contactquery 
                //@param contactquery As described in the constructor's param
                //@abstract Parses an incoming contactquery into what the 
contacts backend
                //likes to see in a query
                //@discussion This ignores the start and offset parameters as 
they are somehow
                //obsolete in this version. Its strange, i know, but maybe we 
will want to optimize
                //later what we want to fetch from the contacts backend by this 
parameters so all other
                //functions respect and think that thisone builds the start and 
offset
                function parse_contactquery($contactquery)
                {
                        $notfirsttime=False;
//                      while(list($k,$v)=each($contactquery))
                        foreach ($contactquery as $k => $v)
                        {
                                switch($k)
                                {
                                        case 'filter':
                                                {
                                                        switch($v)
                                                        {

                                                                case 'none':
                                                                        {
                                                                                
$this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
        ($notfirsttime ? "," :"")."tid=n";
                                                                                
$notfirsttime=True;
                                                                                
break;
                                                                        }
                                                                case 
'user_only':
                                                                        {
                                                                                
$this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
        ($notfirsttime ? "," :"").
                                                                                
        'owner='.$GLOBALS['phpgw_info']['user']['account_id'];
                                                                                
$notfirsttime=True;
                                                                                
break;
                                                                        }
                                                                case 
'directory':
                                                                        {
                                                                                
if(!$contactquery['directory_uid'])
                                                                                
{

                                                                                
        $this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
                ($notfirsttime ? "," :"")."tid=p";
                                                                                
}
                                                                                
else
                                                                                
{
                                                                                
         $this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
                      ($notfirsttime ? "," :"")."owner=".
                                                                                
                      $contactquery['directory_uid'];
                                                                                
}
                                                                                
$notfirsttime=True;
                                                                                
break;
                                                                        }
                                                                case 'private':
                                                                        {
                                                                                
$this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
        ($notfirsttime ? "," :"").'owner='.
                                                                                
        $GLOBALS['phpgw_info']['user']['account_id'].
                                                                                
        ',access=private';
                                                                                
$notfirsttime=True;
                                                                                
break;
                                                                        }
                                                        }
                                                        $notfirsttime=false;
                                                        break;
                                                }
                                        case 'categories':
                                                {
                                                        if($v)
                                                        {
                                                                
$this->contactquery['filter']=$this->contactquery['filter'].
                                                                                
 ($notfirsttime ? "," :"")."cat_id=".$v;
                                                        $notfirsttime=true;
                                                        }
                                                        break;
                                                }
                                        case 'query':
                                                {
                                                        if($v)
                                                        {
                                                                
$this->contactquery['query']=$v;
                                                        }
                                                }
                                                        
                                }//end switch
                        }//end while
                //      print "<BR> built query";
                //      print_r($this->contactquery);
                }//end function
                
                //@function forget_query
                //@discussion
                //Causes the class to forget its query cache. This does not 
forget the destination boxes, only
                //the mass query
                function forget_query()
                {
                                $this->save_sessiondata("");
                }
                //@function recordinfo
                //@param addy_id The record's id in the contacts backend
                //@abstract Gets the record info descirbed by the 
single_query_cols array
                //@discussion This returns an array of field=>value that 
actually has
                //the whole record for the given id. As u can see, the values 
it gets back are
                //given by the single_query_cols attribute which u can change 
to get more data
                function recordinfo($addy_id)
                {
                        $entry = 
$this->contactsobject->read("","",$this->single_query_cols,"","id=$addy_id");
                        if(!$entry[0])
                        {
                                return false;
                        }
                        return $entry[0];       
                }
                //@function save_destboxes
                //@param destboxes The array of destbox arrays that we want 
saveed in the cache
                //@discussion This function saves the destboxes into the cache
                function save_destboxes($destboxes)
                {
                        
                        $this->save_sessiondata($destboxes,"destboxes");
                }
                //@function get_destboxes
                //@abstract Function to get the destination boxes... .this 
parameter should exlusively be gotten this way
                //@discussion This function sees if we have any destboxes 
present in the destboxes attribute
                //if we do, it returns that, if we dont, it gets them from 
cache.
                
                function get_destboxes()
                {
                        if(!is_array($this->destboxes) || 
(count($this->destboxes)<1) )
                        {
                                
$this->destboxes=$this->read_sessiondata("destboxes");
                        }
                        if(is_array($this->destboxes))
                        {
                                return $this->destboxes;
                        }
                        
                        return false;
                }
                //@function forget_destbox
                //@param destboxname The name of the destbox which serves as 
key to the destboxes array
                //@abstract Will unset the live destbox corresponding to 
destboxname
                //@discussion 
                //Note that this function will not forget the destbox from the 
cache... i thought it
                //a bit unneded for the particular application since i wanted 
this function to 
                //iterate through the destboxes array and unset them one by 
one. This means that
                //thisone only operates on real, already in memory (not in 
cache) destboxes.
                //For the cache to reflect this change, you need to 
$obj->save_destboxes($this->destboxes)
                //after calling this.
                function  forget_destbox($destboxname)
                {
                        $this->get_destboxes();
                        if(is_array($this->destboxes[$destboxname]))  
                        {
                                unset($this->destboxes[$destboxname]); 
                                return $this->destboxes;
                        }  
                        return false;
                        
                }
                //@function forget_destboxes
                //@abstract Will forget all the destboxes, then save the 
changes to the cache
                
                function forget_destboxes()
                {
                        if($this->get_destboxes())
                        {
                                $destboxesnames=array_keys($this->destboxes);
                                foreach($destboxesnames as $name)
                                {
                                        $this->forget_destbox($name);
                                }
                                $this->set_destboxes($this->destboxes);
                        }
                }
                //@function set_destboxes
                //@param aryboxes The new destboxes array
                //@param deleted An array of booleans with keys similar to the 
destboxes array
                //If a given destination box has a true entry here, it will be 
removed in the cache
                //@abstract This functions saves in cache the destination boxes 
values
                //@discussion Note that this function can be mistaken by the 
save_destboxes function.
                //Different thigs completely. This one takes an array of 
destboxes. The keys to this array
                // are the destboxes names. Inside each array, there are uid => 
name pairs. Note the absence
                //of an email field. The incoming aryboxes have NO email field 
whatsoever.
                //What we do here, is try and find the corresponding email 
fields either in cache or directly
                //in our mass query cache and set that field correctly to save 
it in cache
                //This function is redundant, inneficient and dead slow. Not to 
say complex and unreadable
                //Please change this please please please.
                //Previous disclaimer said, it works now, and will release this 
way.
                function set_destboxes($aryboxes,$deleted='')
                {
                        //print_r($aryboxes);
//                      print "<br> SAVed DESTBOXES <br>";
                        //We get our own destboxes from the cache
                        $saveddestboxes=$this->get_destboxes();
                        $GLOBALS['debug_timer_start']=perfgetmicrotime();
//                      print_r($saveddestboxes);
                        
                        $found=false;
                        //We iterate into each box
                        //while(list($ak,$li)=each($aryboxes))
                        
                        foreach($aryboxes as $ak => $li)
                        {
//                              print $ak." ".$li."<BR>";
//                              print_r($li);
//                              print "<br>";
                                //We make shure this box has an array in it
                                if($aryboxes[$ak])
                                {
                                        //We iterate into the incoming box to 
search
                                        //for its values in the cache
                                //      
while(list($numary,$ary)=each($aryboxes[$ak]))
                                        foreach($aryboxes[$ak] as $numary => 
$ary)
                                        {
//                                              print "<br> Iterating aryboxes 
$numary";        
//                                              print_r($ary);
                                                list($id,$name)=each($ary);
                                                //Look for this record in the 
cached destboxes
                                                
if(is_array($saveddestboxes[$ak]))
                                                {
                                                        //Well, we found that 
we have this destboxed cached so
                                                        //now we will iterate 
through that
                                                        
//while(list($numarysave,$arysave)=each($saveddestboxes[$ak]))
                                                        
foreach($saveddestboxes[$ak] as $numarysave => $arysave)
                                                        {
                                                                //We will try 
and get each addressbook key
                                                                //out of the 
cached destbox
                                                                
list($sid,$sname)=each($arysave);
                                                                
//                                                              print "<br> 
Iterating destboxes $id -> $name / $sid $sname";    
                                                                //So we can 
compare it and set the email field in it
                                                                if($id==$sid)
                                                                {
//                                                                      print 
"<br> found $id in $ak";
//                                                                      print 
"<br> seting mail to $arysave[email]";
                                                                        
$ary['email']=$arysave['email'];
                                                                        
$aryboxes[$ak][$numary]=$ary;
                                                                        
                                                                        
$found=true;
                                                                }

                                                        }
                                                        
reset($saveddestboxes[$ak]);
                                                }
                                                //couldnt find it in saved 
destboxes, lookfor ir in result
                                                //This redundant POSH makes me 
angry....
                                                //Now we look into our names 
cache...im not shure why, if i 
                                                //try and evade this search 
when i find it in the cache, 
                                                //it all goes borken
                                                //We iterate into the query 
cache
                                        //      
while(list($num,$record)=each($this->result))
                                                foreach($this->result as $num 
=> $record)
                                                {
//                                                      print "<br> Iterating 
results $id   ---> $name <br>$record[id]---> $record[email]";
                                                        //Found what we are 
looking for
                                                        if($id == $record["id"])
                                                        {
                                                                //Set the mail 
record to what it should be
//                                                              print "<br> 
seting mail to $record[email] <br>";
                                                                
$ary['email']=($record["email"] ? $record["email"] : $record["home_email"]);
                                                                
$aryboxes[$ak][$numary]=$ary;
                                                                
$retboxes[$ak][$id]['email']= $ary['email'];
                                                                
$retboxes[$ak][$id]['name']= $name;
                                                                
                                                        }
                                                }
                                                reset($this->result);
                                                $found=false;
                                        }

                                }
                                elseif(!$deleted[$ak])
                                {
//                                      print "<br>Saving $ak from destination 
data $deleted[$ak]<br>";
//                                      print_r($deleted);
                                        //Delete the destboxes that need 
deletion
                                        $aryboxes[$ak]=$saveddestboxes[$ak];
                                }
                        }
//                      print "<br>modified<br>";
//                              print_r($aryboxes);
                                reset($aryboxes);
                        //Save the resulting destboxes
                        $GLOBALS['debug_timer_stop']=perfgetmicrotime();
//                      print("<BR><B>Set destboxes in ". 
($GLOBALS['debug_timer_stop'] - $GLOBALS['debug_timer_start']) . " seconds.");
                        $this->save_destboxes($aryboxes);
                        //We return what we couldnt find in cache so the caller 
can evaluate
                        //if he needs to refresh his info...
                        return $retboxes; 
                        
                }
                //@function save_sessiondata
                //@param data The data to be saved
                //@param location An extra string to save data in diferent 
locations
                //@abstract Saves the data into the app session cache
                //@discussion
                //If you pass it no location, it will save into jsbook_data
                //If you do, it will save into jsbook_data_location
                //This is important cause we sometimes only need the destboxes 
and not
                //the whole queries so we only get what we need
                function save_sessiondata($data,$location="")
                {
                        if ($this->use_session)
                        {
                                
$GLOBALS['phpgw']->session->appsession('session_data',"jsbook_data".($location 
? '_'.$location :""),$data);
                        }
                        if($this->debug)
                        {
                                echo '<br>Saving: ';
                                _debug_array($data);
                        }
                }
                //@function read_sessiondata
                //@param location
                //@abstract gets data out of the appsesion cache
                //@discussion
                //The location field behaves like the one described in 
save_sessiondata

                function read_sessiondata($location="")
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','jsbook_data'.($location 
? '_'.$location :""));
                        if($this->debug)
                        {
                                echo '<br>Read: ';
                                _debug_array($data);
                        }
                        return $data;
                }
                
        }
?>

--- NEW FILE ---
<?php
        class contact_accounts extends sql_entity
        {
                var $map = array('account_id'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'account_person_id'    => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'person_id'),
                                 'person_only'          => array('criteria'     
=> ''),
                                 'is_user'              => array('select'       
=> ''));
                
                function contact_accounts ($ali = '', $field = '', $criteria =  
'')
                {
                        $this->_constructor('phpgw_accounts', 
'contact_accounts');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('account_id', 
'phpgwapi.contact_central','owner');
                        $this->set_ilinks('account_person_id', 
'phpgwapi.contact_person','person_id', LAZY_KEY);
                }

                function criteria_account_id($element)
                {
                        $this->_add_criteria($this->index_criteria($element));
                }

                function criteria_person_only($element)
                {
                        
$this->_add_criteria($this->put_alias(sql_criteria::not_null($this->real_field('account_person_id'))));
                }

                function select_is_user($element)
                {
                        $this->add_field('is_user', 
'count('.$this->real_field('account_id').')');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_addr extends sql_entity
        {
                var $map = array('key_addr_id'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_addr_id'),
                                 'addr_contact_id'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_id'),
                                 'addr_type'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'addr_type_id'),
                                 'addr_add1'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'add1'),
                                 'addr_add2'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'add2'),
                                 'addr_city'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'city'),
                                 'addr_state'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'state'),
                                 'addr_postal_code'     => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'postal_code'),
                                 'addr_country'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'country'),
                                 'addr_preferred'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'preferred'),
                                 'addr_creaton'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_on'),
                                 'addr_creatby'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_by'),
                                 'addr_modon'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_on'),
                                 'addr_modby'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_by'),
                                 'addr_precedence'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'precedence'),
                                 'addr_address'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'adr_one_street'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'add1'),
                                 'adr_one_locality'     => array('select'       
=> 'select_primary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'city'),
                                 'adr_one_region'       => array('select'       
=> 'select_primary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'state'),
                                 'adr_one_postalcode'   => array('select'       
=> 'select_primary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'postal_code'),
                                 'adr_one_countryname'  => array('select'       
=> 'select_primary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'country'),
                                 'adr_two_street'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'adr_two_locality'     => array('select'       
=> 'select_secondary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'city'),
                                 'adr_two_region'       => array('select'       
=> 'select_secondary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'state'),
                                 'adr_two_postalcode'   => array('select'       
=> 'select_secondary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'postal_code'),
                                 'adr_two_countryname'  => array('select'       
=> 'select_secondary',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'country'),
                                 'addr_pref_val'        => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'preferred'));
                var $primary_set;
                var $secondary_set;
                

                function contact_addr ($ali = '', $field = '', $criteria = '')
                {
                        $this->_constructor('phpgw_contact_addr', 
'contact_addr');
                        if($field)
                        {
                                $this->add_select($field);
                                
                        }       
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('addr_contact_id', 
'phpgwapi.contact_central','contact_id');
                        $this->set_ilinks('addr_type', 
'phpgwapi.contact_addr_type','addr_type_id');
                }
                /*
                @function select_addr_address
                @discussion addr_address false field is a concatenation of add1 
and add2
                therefore, we use the || standard concatenation operator for 
select
                */
                function select_addr_address($element)
                {
                        
$this->field_list['addr_address']=$this->put_alias('.add1').' || 
'.$this->put_alias('add2');
                }
                /*
                @function select_addr_address
                @discussion addr_address false field is a concatenation of add1 
and add2
                therefore, we use the || standard concatenation operator for 
select
                */
                function select_adr_one_street($element)
                {
                        $this->set_primary_address($element);
                        
$this->field_list['adr_one_street']=$this->put_alias('.add1').' || 
'.$this->put_alias('add2');
                        
                }
                /*
                @function select_primary
                @discussion Generic select builder for adr_one fields that need 
to be limited to
                criteria precedence=1 but map 1 to 1 to real fields 
(city,country,postalcode) */
                function select_primary($element)
                {
                        $this->set_primary_address($element);
                        $this->field_list[$element['field']] = 
$this->put_alias($element['real_field']);
                }
                /*
                @function select_adr_two_street
                @discussion Street address as asked for by the adr_*_street 
false fields are actually 
                concatenations of add1 and add2, therefore that needs its own 
handler
                */
                function select_adr_two_street($element)
                {
                        $this->set_secondary_address($element);
                        
$this->field_list['adr_one_street']=$this->put_alias('.add1').' || 
'.$this->put_alias('add2');
                        
                }
                /*
                @function select_secondary
                @discussion Generic select builder for adr_two fields that need 
to be limited to
                criteria precedence=2 but map 1 to 1 to real fields 
(city,country,postalcode)
                */
                function select_secondary($element)
                {
                                $this->set_secondary_address($element);
                                $this->field_list[$element['field']] = 
$this->put_alias(sql::string($element['real_field']));
                }
                
                //Backwards compatibility for adr_one adr_two when asked to 
SEARCH CRITERIA (where clause)
                /*
                @function criteria_adr_one_street
                @discussion in this case, searching in the adr_one_street false 
field should
                look for the value in add1 and add2 since adr_one_street is 
defined to be the
                concatenation of this two fields
                */
                function criteria_adr_one_street($element)
                {
                        $this->set_primary_address($element);
                        
$criteria=sql_criteria::or_(sql_criteria::has($this->put_alias('add1'),$element['value']),
                                                    
sql_criteria::has($this->put_alias('add2'),$element['value']));
                        $this->_add_criteria($criteria);
                }
                /*
                @function criteria_primary
                @discussion 
                Generic criteria builder for adr_one type fields. They need an 
extra precedence and
                then are a LIKE clause which is given by sql_criteria::has(). 
So, if the user asks for
                adr_one_country, the resulting query will be tablename.country 
= %%value%%
                */
                function criteria_primary($element)
                {
                        $this->set_primary_address($element);
                        
$criteria=sql_criteria::has($this->put_alias($element['real_field']),sql::string($element['value']));
                        $this->add_criteria($criteria);
                }
                /*
                @function criteria_adr_two_street
                @discussion Same as criteria_adr_one_street but with precedence 
2
                */
                function criteria_adr_two_street($element)
                {
                        $this->set_secondary_address($element);
                        
$criteria=sql_criteria::or_(sql_criteria::has($this->put_alias('add1'),sql::string($element['value'])),
                                                    
sql_criteria::has($this->put_alias('add2'),sql::string($element['value'])));
                        
                        $this->_add_criteria($criteria);
                        
                }
                function criteria_secondary($element)
                {
                        $this->set_secondary_address($element);
                        
$criteria=sql_criteria::has($this->put_alias($element['real_field']),sql::string($element['value']));
                        $this->_add_criteria($criteria);
                }

                function set_primary_address($element)
                {
                        if($this->primary_set != 'primary')
                        {
                                
$criteria=sql_criteria::equal($this->put_alias('precedence'),'1');
                                $this->_add_criteria($criteria);
                                $this->primary_set='primary';
                        }
                        
                }
                
                function set_secondary_address($element)
                {
                        if($this->secondary_set != 'secondary')
                        {
                                
$criteria=sql_criteria::equal($this->put_alias('precedence'),'2');
                                $this->_add_criteria($criteria);
                                $this->secondary_set='secondary';
                        }
                        
                }

                function criteria_addr_pref_val($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        $criteria = 
sql_criteria::or_(sql_criteria::equal($field, sql::string($element['value'])),
                                                      
sql_criteria::is_null($field));
                        $this->_add_criteria($criteria);
                }

                function criteria_addr_contact_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_addr_type extends sql_entity
        {
                var $map = array('addr_type_id'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'addr_description'     => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'description'));
                
                function contact_addr_type ($ali = '', $field = '', $criteria = 
        '')
                {
                        $this->_constructor('phpgw_contact_addr_type', 
'contact_addr_type');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('addr_type_id', 
'phpgwapi.contact_addr','addr_type');
                }

                function criteria_addr_type_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_categories extends sql_entity
        {
                var $map = array('key_cat_id'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'cat_id'),
                                 'parent_id'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'cat_id'));
                
                
                function contact_categories ($ali = '', $field = '', $criteria 
=        '')
                {
                        $this->_constructor('phpgw_categories', 
'contact_categories');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        //$this->set_elinks('key_cat_id', 
'contact_central','cat_id');
                }               

                function select_parent_id($element)
                {
                        $this->set_alias('categorie_parent');
                        $this->_add_field(array('field' => 'parent_id', 
'real_field' => 'cat_id'));
                        $this->set_elinks('key_cat_id', 
'phpgwapi.contact_categories','parent_id');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_central extends sql_entity
        {
                var $map = array('contact_id'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'owner'        => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'access'       => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'cat_id'       => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'contact_type' => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'contact_type_id'),
                                 'sel_cat_id'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'cat_id'),
                                 'count_contacts'=> array('select'      => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''));
                


                function contact_central ($ali = '', $field = '', $criteria =   
'')
                {
                        $this->_constructor('phpgw_contact', 'contact_central');

                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('contact_id', 
'phpgwapi.contact_person', 'person_id');
                        $this->set_elinks('contact_id', 'phpgwapi.contact_org', 
'org_id');
                        $this->set_elinks('contact_id', 
'phpgwapi.contact_note', 'note_contact_id');
                        $this->set_elinks('contact_id', 
'phpgwapi.contact_addr', 'addr_contact_id');
                        $this->set_elinks('contact_id', 
'phpgwapi.contact_comm', 'comm_contact_id');
                        $this->set_elinks('contact_id', 
'phpgwapi.contact_others', 'other_contact_id');

                        $this->set_ilinks('contact_type', 
'phpgwapi.contact_types','contact_type_id');
                        $this->set_ilinks('owner', 
'phpgwapi.contact_accounts','account_id');
                        //$this->set_ilinks('cat_id', 
'contact_categories','key_cat_id');
                }

                function criteria_contact_id($element)
                {
                        $this->_add_criteria($this->index_criteria($element));  
                
                }

                function criteria_access($element)
                {
                        $this->_add_criteria($this->index_criteria($element)); 
                }

                function criteria_contact_type($element)
                {
                        $this->_add_criteria($this->index_criteria($element)); 
                }

                function criteria_owner($element)
                {
                        $this->_add_criteria($this->index_criteria($element)); 
                }

                function select_count_contacts()
                {
                        $this->add_field('count_contacts', 'count(contact_id)');
                }

                function criteria_sel_cat_id($element)
                {
                        $field = $this->put_alias($element['real_field']);

                        if(is_array($element['value']))
                        {
                                foreach($element['value'] as $value)
                                {
                                        $data[] = 
sql_criteria::or_(sql_criteria::equal($field, sql::string($value)),
                                                                    
sql_criteria::has($field, ',' . $value . ','));
                                }
                                
                                $criteria = sql_criteria::append_or($data);
                                $this->_add_criteria($criteria);
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, 
sql::string($element['value'])));
                        }
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_comm extends sql_entity
        {
                var $map = array('key_comm_id'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_id'),
                                 'comm_contact_id'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_id'),
                                 'comm_descr'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_descr_id'),
                                 'comm_preferred'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'preferred'),
                                 'comm_data'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'comm_creaton'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_on'),
                                 'comm_creatby'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_by'),
                                 'comm_modon'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_on'),
                                 'comm_modby'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_by'),
                                 'phone'                => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'phone_home'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'phone_prefer'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'email'                => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'email_home'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_work'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_home'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_voice'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_fax'              => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_msg'              => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_cell'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_pager'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_bbs'              => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_modem'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_car'              => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_isdn'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_video'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'tel_prefer'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'),
                                 'url'                  => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_data'));
                
                function contact_comm ($ali = '', $field = '', $criteria =      
'')
                {
                        $this->_constructor('phpgw_contact_comm', 
'contact_comm');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('comm_contact_id', 
'phpgwapi.contact_central','contact_id');
                        $this->set_ilinks('comm_descr', 
'phpgwapi.contact_comm_descr','comm_descr_id');
                }

                function criteria_key_comm_id($element)
                {
                        $this->_add_criteria($this->index_criteria($element));
                }
                        
                
                function criteria_comm_contact_id($element)
                {
                        $this->_add_criteria($this->index_criteria($element));
                }
                
                function criteria_comm_descr($element)
                {
                        $this->_add_criteria($this->index_criteria($element));
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_comm_descr extends sql_entity
        {
                var $map = array('comm_descr_id'        => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'comm_type'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'comm_type_id'),
                                 'comm_description'     => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'descr'),
                                 'comm_find_descr'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'descr'));

                function contact_comm_descr ($ali = '', $field = '', $criteria 
=        '')
                {
                        $this->_constructor('phpgw_contact_comm_descr', 
'contact_comm_descr');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('comm_descr_id', 
'phpgwapi.contact_comm','comm_descr');
                        $this->set_ilinks('comm_type', 
'phpgwapi.contact_comm_type','comm_type_id');
                }

                function criteria_comm_descr_id($element)
                {
                        $this->_add_criteria($this->index_criteria($element));
                }

                function criteria_comm_find_descr($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        
                        foreach($element['value'] as $value)
                        {
                                $data[] = sql_criteria::equal($field, 
sql::string($value));
                        }

                        $criteria = sql_criteria::append_or($data);

                        $this->_add_criteria($criteria);
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_comm_type extends sql_entity
        {
                var $map = array('comm_type_id'=> array('select'        => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'comm_type_description'=> array('select'       
=> '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'type'),
                                 'comm_active'  => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'active'),
                                 'comm_class'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'class'));


                function contact_comm_type ($ali = '', $field = '', $criteria = 
        '')
                {
                        $this->_constructor('phpgw_contact_comm_type', 
'contact_comm_type');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }

                        $this->set_elinks('comm_type_id', 
'phpgwapi.contact_comm_descr','comm_type');
                }               

        }
?>

--- NEW FILE ---
<?php
        class contact_note extends sql_entity
        {
                var $map = array('key_note_id'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_note_id'),
                                 'note_contact_id'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_id'),
                                 'note_type'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'note_type_id'),
                                 'note_text'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'note_creaton'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_on'),
                                 'note_creatby'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_by'),
                                 'note_modon'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_on'),
                                 'note_modby'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_by'),
                                 'note'                 => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''));
                

                function contact_note ($ali = '', $field = '', $criteria =      
'')
                {
                        $this->_constructor('phpgw_contact_note', 
'contact_note');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('note_contact_id', 
'phpgwapi.contact_central','contact_id');
                        $this->set_ilinks('note_type', 
'phpgwapi.contact_note_type','note_type_id');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_note_type extends sql_entity
        {
                var $map = array('note_type_id'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'note_description'     => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'description'));
                
                function contact_note_type ($ali = '', $field = '', $criteria = 
        '')
                {
                        $this->_constructor('phpgw_contact_note_type', 
'contact_note_type');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('note_type_id', 
'phpgwapi.contact_note','note_type');
                }               

        }
?>

--- NEW FILE ---
<?php
        class contact_org extends sql_entity
        {
                var $map = array('org_id'       => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'org_id') ,
                                 'org_name'     => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'name'),
                                 'org_active'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'active'),
                                 'org_parent'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'parent'),
                                 'org_creaton'  => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'created_on'),
                                 'org_creatby'  => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'created_by'),
                                 'org_modon'    => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'modified_on'),
                                 'org_modby'    => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'modified_by'),
                                 'name'         => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''),
                                 'count_orgs'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => ''));
                
                function contact_org ($ali = '', $field = '', $criteria =       
'')
                {
                        $this->_constructor('phpgw_contact_org', 'contact_org');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('org_id', 
'phpgwapi.contact_org_person', 'my_org_id');
                        $this->set_ilinks('org_id', 
'phpgwapi.contact_central','contact_id', REQUIRED_KEY);
                }

                function criteria_org_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }

                function select_count_orgs()
                {
                        $this->add_field('count_orgs', 'count(org_id)');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_org_person extends sql_entity
        {
                var $map = array('my_org_id'    => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'org_id'),
                                 'my_person_id' => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'person_id'),
                                 'my_addr_id'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'addr_id'),
                                 'my_preferred'=> array('select'        => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'preferred'),
                                 'my_creaton'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'created_on'),
                                 'my_creatby'   => array('select'       => '',
                                                         'criteria'     => '',
                                                         'insert'       => '',
                                                         'update'       => '',
                                                         'delete'       => '',
                                                         'sort'         => '',
                                                         'field'        => 
'created_by'));

                function contact_org_person ($ali = '', $field = '', $criteria 
= '')
                {
                        $this->_constructor('phpgw_contact_org_person', 
'contact_org_person');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                }
                
                function criteria_my_org_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        $new_criteria = sql_criteria::equal($field, 
$element['value']);
                        $this->_add_criteria($new_criteria);
                        $this->set_ilinks('my_org_id', 
'phpgwapi.contact_org','org_id');
                }

                function criteria_my_person_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        $new_criteria = sql_criteria::equal($field, 
$element['value']);
                        $this->_add_criteria($new_criteria);
                        $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id') ;
                }

                function select_my_org_id($element)
                {
                        $this->_add_field(array('field' => 'my_org_id', 
'real_field' => 'org_id'));
                        $this->set_ilinks('my_org_id', 
'phpgwapi.contact_org','org_id');
                }
                
                function select_my_person_id($element)
                {
                        $this->_add_field(array('field' => 'my_person_id', 
'real_field' => 'person_id'));
                        $this->set_ilinks('my_person_id', 
'phpgwapi.contact_person','person_id');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_others extends sql_entity
        {
                var $map = array('key_other_id'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'other_id'),
                                 'other_contact_id'     => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_id'),
                                 'other_name'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'other_value'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'other_owner'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'contact_owner'),
                                 'other_count_row'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'label'               => array('select'        
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'email_type'          => array('select'        
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'email_home_type'     => array('select'        
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'adr_one_type'        => array('select'        
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'adr_two_type'        => array('select'        
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''));
                

                function contact_others ($ali = '', $field = '', $criteria =    
'')
                {
                        $this->_constructor('phpgw_contact_others', 
'contact_others');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_ilinks('other_contact_id', 
'phpgwapi.contact_central','contact_id');
                }

                function criteria_other_contact_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_person extends sql_entity
        {
                var $map = array('person_id'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'per_first_name'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'first_name'),
                                 'per_last_name'        => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'last_name'),
                                 'per_middle_name'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'middle_name'),
                                 'per_prefix'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'prefix'),
                                 'per_suffix'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'suffix'),
                                 'per_birthday'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'birthday'),
                                 'per_pubkey'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'pubkey'),
                                 'per_title'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'title'),
                                 'per_department'       => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'department'),
                                 'per_initials'         => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'initials'),
                                 'per_sound'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'sound'),
                                 'per_active'           => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'active'),
                                 'per_creaton'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_on'),
                                 'per_creatby'          => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'created_by'),
                                 'per_modon'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_on'),
                                 'per_modby'            => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'modified_by'),
                                 'per_name'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'fn'                   => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'n_given'              => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'first_name'),
                                 'n_family'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'last_name'),
                                 'n_middle'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'middle_name'),
                                 'n_prefix'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_prefix'),
                                 'n_suffix'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_suffix'),
                                 'sound'                => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_sound'),
                                 'bday'                 => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_birthday'),
                                 'tz'                   => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_timezone'),
                                 'geo'                  => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_geo'),
                                 'pubkey'               => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_pubkey'),
                                 'org_unit'             => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_deparment'),
                                 'title'                => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'per_title'),
                                 'count_persons'        => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> 'person_id'));

                function contact_person ($ali = '', $field = '', $criteria =    
'')
                {
                        $this->_constructor('phpgw_contact_person', 
'contact_person');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('person_id', 
'phpgwapi.contact_accounts', 'account_person_id');
                        $this->set_elinks('person_id', 
'phpgwapi.contact_org_person', 'my_person_id');
                        $this->set_ilinks('person_id', 
'phpgwapi.contact_central','contact_id', REQUIRED_KEY);
                }

                function criteria_person_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }

                function select_count_persons()
                {
                        $this->add_field('count_persons', 'count(person_id)');
                }
        }
?>

--- NEW FILE ---
<?php
        class contact_types extends sql_entity
        {
                var $map = array('contact_type_id'      => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'contact_type_descr'   => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''),
                                 'contact_type_table'   => array('select'       
=> '',
                                                                 'criteria'     
=> '',
                                                                 'insert'       
=> '',
                                                                 'update'       
=> '',
                                                                 'delete'       
=> '',
                                                                 'sort'         
=> '',
                                                                 'field'        
=> ''));
                
                function contact_types ($ali = '', $field = '', $criteria =     
'')
                {
                        $this->_constructor('phpgw_contact_types', 
'contact_types');
                        if($field)
                        {
                                $this->add_select($field);
                        }
                        if($criteria)
                        {
                                $this->add_criteria($criteria);
                        }
                        $this->set_elinks('contact_type_id', 
'phpgwapi.contact_central','contact_type');
                }

                function criteria_contact_type_id($element)
                {
                        $field = $this->put_alias($element['real_field']);
                        if(is_array($element['value']))
                        {
                                $this->_add_criteria(sql_criteria::in($field, 
$element['value']));
                        }
                        else
                        {
                                
$this->_add_criteria(sql_criteria::equal($field, $element['value']));
                        }
                }
        }
?>

***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql_builder.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql_criteria.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql_entity.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql_mysql.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.sql_pgsql.inc.php'
***** Error reading new file: [Errno 2] No such file or directory: 
'class.uijsaddressbook.inc.php'
Index: class.contacts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_ldap.inc.php,v
retrieving revision 1.11.2.5.2.2
retrieving revision 1.11.2.5.2.3
diff -C2 -r1.11.2.5.2.2 -r1.11.2.5.2.3

Index: class.contacts_shared.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_shared.inc.php,v
retrieving revision 1.9.2.1.2.2
retrieving revision 1.9.2.1.2.3
diff -C2 -r1.9.2.1.2.2 -r1.9.2.1.2.3
*** class.contacts_shared.inc.php       1 Jul 2003 23:54:01 -0000       
1.9.2.1.2.2
--- class.contacts_shared.inc.php       8 Sep 2003 13:26:38 -0000       
1.9.2.1.2.3
***************
*** 66,83 ****
  
                /* This will take an array or integer */
!               function delete($id)
!               {
!                       if (gettype($id) == 'array')
!                       {
!                               while (list($null,$t_id) = each($id))
!                               {
!                                       $this->delete_($t_id);
!                               }
!                       }
!                       else
!                       {
!                               $this->delete_($id);
!                       }
!               }
  
                function asc_sort($a,$b)
--- 66,83 ----
  
                /* This will take an array or integer */
! //            function delete($id)
! //            {
! //                    if (gettype($id) == 'array')
! //                    {
! //                            while (list($null,$t_id) = each($id))
! //                            {
! //                                    $this->delete_($t_id);
! //                            }
! //                    }
! //                    else
! //                    {
! //                            $this->delete_($id);
! //                    }
! //            }
  
                function asc_sort($a,$b)

Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.1
retrieving revision 1.17.2.2.2.2
diff -C2 -r1.17.2.2.2.1 -r1.17.2.2.2.2
*** class.contacts_sql.inc.php  30 Apr 2003 23:30:47 -0000      1.17.2.2.2.1
--- class.contacts_sql.inc.php  8 Sep 2003 13:26:38 -0000       1.17.2.2.2.2
***************
*** 1,699 ****
  <?php
    /**************************************************************************\
!   * phpGroupWare API - Contacts manager for SQL                              *
!   * This file written by Joseph Engo <address@hidden>                *
!   *   and Miles Lott <address@hidden>                              *
!   * View and manipulate contact records using SQL                            *
!   * Copyright (C) 2001 Joseph Engo                                           *
!   * -------------------------------------------------------------------------*
!   * This library is part of the phpGroupWare API                             *
!   * http://www.phpgroupware.org/api                                          
* 
[...2970 lines suppressed...]
!                               return False;
!                       }
!                       return $person_id;
!               }
! 
!               /**
!               * Get the contact_type for contact_id.
!               *
!               * @param integer $contact_id  Contact id which want to check.
!               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL depending what we want
!               * @return integer The contact_type_id.
!               */
!               function get_type_contact($contact_id, 
$action=PHPGW_SQL_RUN_SQL)
!               {
!                       $this->request(array('contact_type'));
!                       $this->criteria(array('contact_id' => $contact_id));
!                       $type =  $this->get_query($action, __LINE__, __FILE__);
!                       return $type[0]['contact_type'];
                }
        }

Index: class.nextmatchs.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.nextmatchs.inc.php,v
retrieving revision 1.43.2.6.2.3
retrieving revision 1.43.2.6.2.4
diff -C2 -r1.43.2.6.2.3 -r1.43.2.6.2.4
*** class.nextmatchs.inc.php    22 May 2003 23:21:02 -0000      1.43.2.6.2.3
--- class.nextmatchs.inc.php    8 Sep 2003 13:26:38 -0000       1.43.2.6.2.4
***************
*** 137,141 ****
                                        }
                                }
!                               $extras = implode($t_extras,'&');
                        }
  
--- 137,143 ----
                                        }
                                }
!                               //jarg-SOG s
!                               $extras = '&'.implode($t_extras,'&');
!                               //jarg-SOG e
                        }
  
***************
*** 172,176 ****
                        $var = Array(
                                'align'     => $align,
!                               'action'    => 
($this->action?$this->page():$GLOBALS['phpgw']->link($link)),
                                'form_name' => $img,
                                'hidden'    => 
substr($hidden,0,strlen($hidden)-1),
--- 174,180 ----
                        $var = Array(
                                'align'     => $align,
!                               //jarg-SOG s
!                               'action'    => 
($this->action?$this->page($extravars):$GLOBALS['phpgw']->link($link)),
!                               //jarg-SOG e
                                'form_name' => $img,
                                'hidden'    => 
substr($hidden,0,strlen($hidden)-1),
***************
*** 207,211 ****
                        $extravars = Array();
                        $extravars = $this->split_extras($extravars,$extra);
! 
                        $var = array(
                                'form_action'   => 
($this->action?$this->page($extra):$GLOBALS['phpgw']->link($sn, $extra)),
--- 211,215 ----
                        $extravars = Array();
                        $extravars = $this->split_extras($extravars,$extra);
!                       
                        $var = array(
                                'form_action'   => 
($this->action?$this->page($extra):$GLOBALS['phpgw']->link($sn, $extra)),





reply via email to

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