"fixed (undeletable) n type, which appears in new installations

to get rid of it on existing installs, you can now simply delete it (it does not get recreated, which makes it seem undeletable before)"
This commit is contained in:
Ralf Becker 2008-07-18 07:16:44 +00:00
parent 95d15246b5
commit c76f649797

View File

@ -5,13 +5,11 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog
* @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2003-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
include_once(EGW_API_INC.'/class.solink.inc.php');
/**
* storage object / db-layer for InfoLog
*
@ -68,25 +66,6 @@ class soinfolog // DB-Layer
*/
var $tz_offset;
/**
* custom fields backend
*
* @var so_sql
*/
var $soextra;
/**
* customfields name => array(...) pairs
*
* @var array
*/
var $customfields = array();
/**
* content-types as name => array(...) pairs
*
* @var array
*/
var $content_types = array();
/**
* Constructor
*
@ -101,22 +80,6 @@ class soinfolog // DB-Layer
$this->user = $GLOBALS['egw_info']['user']['account_id'];
$this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
$this->soextra =& CreateObject('etemplate.so_sql');
$this->soextra->so_sql('infolog',$this->extra_table);
$custom =& CreateObject('admin.customfields','infolog');
$this->customfields = $custom->get_customfields();
$this->content_types = $custom->get_content_types();
if (!$this->content_types)
{
$this->content_types = $custom->content_types = array('n' => array(
'name' => 'infolog',
'options' => array(
'template' => 'infolog.edit',
'icon' => 'navbar.png'
)));
$custom->save_repository();
}
}
/**
@ -452,6 +415,7 @@ class soinfolog // DB-Layer
$this->db->delete($this->info_table,array('info_id'=>$info_id),__LINE__,__FILE__);
$this->db->delete($this->extra_table,array('info_id'=>$info_id),__LINE__,__FILE__);
egw_link::unlink(0,'infolog',$info_id);
egw_index::delete('infolog',$info_id);
if ($this->data['info_id'] == $info_id)
{
@ -611,6 +575,10 @@ class soinfolog // DB-Layer
// echo "<p>soinfolog.write this->data= "; _debug_array($this->data);
//error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning id=".$this->data['info_id']);
// update the index
egw_index::save('infolog',$this->data['info_id'],$this->data['info_owner'],$this->data,$this->data['info_cat'],
array('info_uid','info_type','info_status','info_confirm','info_access'));
return $this->data['info_id'];
}
@ -752,6 +720,23 @@ class soinfolog // DB-Layer
if ($query['query']) $query['search'] = $query['query']; // allow both names
if ($query['search']) // we search in _from, _subject, _des and _extra_value for $query
{
/* new code join the index
if (ctype_digit($query['search'])) // search by ticket-number (numbers get never indexed!)
{
$sql_query = 'AND info_id='.(int)$query['search'];
}
else
{
$join = egw_index::sql_join_ids_by_keyword($query['search'],'infolog','info_id');
}
*/
/* new code with info_id IN (subquery) --> way to slow
$sql_query .= 'AND info_id IN ('.
egw_index::sql_ids_by_keyword(explode(' ',$query['search']),egw_index::MATCH_CONTAINS,'infolog').
// add search string itself, if it is numeric, to allow to search for a info_id/ticket number
ctype_digit($query['search'] ? ' UNION (SELECT '.$this->db->quote($query['search']).')' : '').')';
*/
/* old code searching the table direct */
$pattern = $this->db->quote('%'.$query['search'].'%');
$columns = array('info_from','info_addr','info_location','info_subject','info_extra_value');
@ -760,9 +745,7 @@ class soinfolog // DB-Layer
$sql_query = 'AND ('.(is_numeric($query['search']) ? 'main.info_id='.(int)$query['search'].' OR ' : '').
implode(" LIKE $pattern OR ",$columns)." LIKE $pattern) ";
}
if ($query['search'])
{
$join = ($cfcolfilter>0 ? '':'LEFT')." JOIN $this->extra_table ON main.info_id=$this->extra_table.info_id ";
// mssql and others cant use DISTICT if text columns (info_des) are involved
$distinct = $this->db->capabilities['distinct_on_text'] ? 'DISTINCT' : '';