update with new table-structure for infolog

This commit is contained in:
Ralf Becker 2002-10-17 22:02:44 +00:00
parent 91138a3a10
commit 2004bf5c58
9 changed files with 310 additions and 188 deletions

View File

@ -22,13 +22,13 @@
'write' => True,
'delete' => True,
'check_access' => True,
'readProj' => True,
'readAddr' => True,
'anzSubs' => True,
'search' => True,
'get_rows' => True,
'accountInfo' => True, // in class boinfolog (this class)
'addr2name' => True,
/* 'readProj' => True,
'readAddr' => True,
'addr2name' => True,*/
'attach_file' => True,
'delete_attached'=> True,
'info_attached' => True,
@ -36,7 +36,8 @@
'read_attached' => True,
'attached_local' => True,
'link_title' => True,
'link_query' => True
'link_query' => True,
'link_id2title' => True
);
var $enums;
var $so;
@ -51,24 +52,26 @@
'priority' => array (
'urgent' => 'urgent','high' => 'high','normal' => 'normal',
'low' => 'low' ),
'status' => array(
/* 'status' => array(
'offer' => 'offer','ongoing' => 'ongoing','call' => 'call',
'will-call' => 'will-call','done' => 'done',
'billed' => 'billed' ),
'confirm' => array(
*/ 'confirm' => array(
'not' => 'not','accept' => 'accept','finish' => 'finish',
'both' => 'both' ),
'type' => array(
'task' => 'task','phone' => 'phone','note' => 'note'
/* ,'confirm' => 'confirm','reject' => 'reject','email' => 'email',
'fax' => 'fax' no implemented so far */ )
'fax' => 'fax' not implemented so far */ )
);
$this->status = array(
'defaults' => array(
'task' => 'ongoing', 'phone' => 'call', 'note' => 'done'),
'task' => array(
'offer' => 'offer','ongoing' => 'ongoing',
'done' => 'done', 'billed' => 'billed' ),
'offer' => 'offer','ongoing' => 'ongoing','done' => 'done',
'0%' => '0%', '10%' => '10%', '20%' => '20%', '30%' => '30%', '40%' => '40%',
'50%' => '50%', '60%' => '60%', '70%' => '70%', '80%' => '80%', '90%' => '90%',
'billed' => 'billed' ),
'phone' => array(
'call' => 'call','will-call' => 'will-call',
'done' => 'done', 'billed' => 'billed' ),
@ -78,6 +81,7 @@
$this->so = CreateObject('infolog.soinfolog');
$this->vfs = CreateObject('infolog.vfs');
$this->link = CreateObject('infolog.bolink');
$this->config = CreateObject('phpgwapi.config');
$this->config->read_repository();
@ -111,110 +115,7 @@
}
return $account_data['account_lid'];
}
function addr2name( $addr )
{
if (!is_array($addr) && !($addr = $this->readAddr($addr)))
{
return '';
}
$name = $addr['n_family'];
if ($addr['n_given'])
{
$name .= ', '.$addr['n_given'];
}
else
{
if ($addr['n_prefix'])
{
$name .= ', '.$addr['n_prefix'];
}
}
if ($addr['org_name'])
{
$name = $addr['org_name'].': '.$name;
}
return $GLOBALS['phpgw']->strip_html($name);
}
function proj2name( $proj )
{
if (!is_array($proj))
{
$proj = $this->readProj($proj);
}
return is_array($proj) ? $proj['title'] : '';
}
function readProj($proj_id)
{
if ($proj_id)
{
if (!is_object($this->projects) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->projects = createobject('projects.boprojects');
}
if (is_object($this->projects) && ($proj = $this->projects->read_single_project( $proj_id)))
{
return $proj;
}
}
return False;
}
function readAddr($addr_id)
{
if ($addr_id)
{
if (!is_object($this->contacts))
{
$this->contacts = createobject('phpgwapi.contacts');
}
if (list( $addr ) = $this->contacts->read_single_entry( $addr_id ))
{
return $addr;
}
}
return False;
}
function event2name( $event )
{
if (!is_object($this->bocal) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (is_object($this->bocal) && !is_array($event) && (int) $event > 0)
{
$event = $this->bocal->read_entry($event);
}
if (!is_array($event))
{
return '';
}
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name .= ': ' . $event['title'];
return $GLOBALS['phpgw']->strip_html($name);
}
function readEvent($cal_id)
{
if ($cal_id)
{
if (!is_object($this->bocal) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (is_object($this->bocal) && $event = $this->bocal->read_entry( $cal_id ))
{
return $event;
}
}
return False;
}
/*
* check's if user has the requiered rights on entry $info_id
*/
@ -226,28 +127,54 @@
function init()
{
$this->so->init();
}
}
function link_id2title(&$info,$not_app='',$not_id='')
{
if ($info['info_link_id'] > 0 &&
($link = $this->link->get_link($info['info_link_id'])) !== False)
{
$nr = $link['link_app1'] == 'infolog' && $link['link_id1'] == $info['info_id'] ? '2' : '1';
$title = $this->link->title($link['link_app'.$nr],$link['link_id'.$nr]);
if ($link['link_app'.$nr] == $not_app && $link['link_id'.$nr] == $not_id)
{
if ($title == $info['info_from'])
{
$info['info_from'] = '';
}
return False;
}
if ($info['info_from'] == '' || $info['info_from'] == $title)
{
$info['info_link_view'] = $this->link->view($link['link_app'.$nr],$link['link_id'.$nr]);
$info['info_from'] = $info['info_link_title'] = $title;
}
return $title;
}
return False;
}
function read($info_id)
{
$err = $this->so->read($info_id) === False;
if ($this->so->data['info_subject'] ==
(substr($this->so->data['info_des'],0,60).' ...'))
$data = &$this->so->data;
if ($data['info_subject'] == (substr($data['info_des'],0,60).' ...'))
{
$this->so->data['info_subject'] = '';
$data['info_subject'] = '';
}
if ($this->so->data['info_addr_id'] && $this->so->data['info_from'] ==
$this->addr2name( $this->readAddr( $this->so->data['info_addr_id'] )))
$data['info_link_title'] = $this->link_id2title($data,$data['info_link_view']);
if ($data['info_link_title'] == $data['info_from'])
{
$this->so->data['info_from'] = '';
$data['info_from'] = '';
}
return $err ? False : $this->so->data;
return $err ? False : $data;
}
function delete($info_id)
{
$this->delete_attached($info_id);
$this->link->unlink(0,'infolog',$info_id);
$this->so->delete($info_id);
}
@ -270,16 +197,17 @@
{
$values['info_owner'] = $this->so->user;
}
$values['info_datemodified'] = time();
if (!$values['info_subject'])
{
$values['info_subject'] = substr($values['info_des'],0,60).' ...';
}
if ($values['info_addr_id'] && !$values['info_from'])
if ($values['info_link_id'] && $values['info_from'] == '')
{
$values['info_from'] = $this->addr2name( $this->readAddr( $values['info_addr_id'] ));
$values['info_from'] = $this->link_id2title($values);
}
$values['info_datemodified'] = time();
$values['info_modifier'] = $this->so->user;
$this->so->write($values);
}
@ -454,6 +382,7 @@
}
return False;
}
/*!
@function link_title
@syntax link_title( $id )

View File

@ -60,10 +60,10 @@
'query' => 'infolog.boinfolog.link_query',
'title' => 'infolog.boinfolog.link_title',
'view' => array(
'menuaction' => 'infolog.uiinfolog.get_list',
'menuaction' => 'infolog.uiinfolog.index',
'action' => 'sp'
),
'view_id' => 'info_id',
'view_id' => 'action_id',
)
);
@ -88,7 +88,7 @@
@param $remark Remark to be saved with the link (defaults to '')
@param $owner Owner of the link (defaults to user)
@discussion Does NOT check if link already exists
@result db-errno or -1 (for param-error) or 0 for success
@result False (for db or param-error) or link_id on success
@result if $id1==0 or already an array: $id1 is array with links
*/
function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 )
@ -99,7 +99,7 @@
}
if (!$app1 || !$app2 || !$id1 && is_array($id2) || $app1 == $app2 && $id1 == $id2)
{
return -1;
return False;
}
if (is_array($id1) || !$id1) // create link only in $id1 array
{
@ -107,25 +107,26 @@
{
$id1 = array( );
}
$id1["$app2:$id2"] = array(
$link_id = "$app2:$id2";
$id1[$link_id] = array(
'app' => $app2,
'id' => $id2,
'remark' => $remark,
'owner' => $owner,
'link_id' => "$app2:$id2",
'link_id' => $link_id,
'lastmod' => time()
);
return 0;
return $link_id;
}
if (is_array($app2) && !$id2)
{
reset($app2);
$err = 0;
while (!$err && list(,$link) = each($app2))
$link_id = True;
while ($link_id && list(,$link) = each($app2))
{
$err = solink::link($app1,$id1,$link['app'],$link['id'],$link['remark'],$link['owner'],$link['lastmod']);
$link_id = solink::link($app1,$id1,$link['app'],$link['id'],$link['remark'],$link['owner'],$link['lastmod']);
}
return $err;
return $link_id;
}
return solink::link($app1,$id1,$app2,$id2,$remark,$owner);
}
@ -168,9 +169,32 @@
}
/*!
@function unlink
@syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' )
@author ralfbecker
@function get_link
@syntax get_link( $app_link_id,$id='',$app2='',$id2='' )
@author ralfbecker
@abstract returns data of a link
@param $app_link_id > 0 link_id of link or app-name of link
@param $id,$app2,$id2 other param of the link if not link_id given
@result array with link-data or False
@disscussion If $id is an array (links not yet created) only link_ids are allowed.
*/
function get_link($app_link_id,$id='',$app2='',$id2='')
{
if (is_array($id))
{
if (isset($id[$app_link_id]))
{
return $id[$app_link_id];
}
return False;
}
return solink::get_link($app_link_id,$id,$app2,$id2);
}
/*!
@function unlink
@syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' )
@author ralfbecker
@abstract Remove link with $link_id or all links matching given $app,$id
@param $link_id link-id to remove if > 0
@param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params

View File

@ -28,7 +28,8 @@
'link' => True,
'get_links' => True,
'unlink' => True,
'chown' => True
'chown' => True,
'get_link' => True
);
var $db;
var $user;
@ -55,7 +56,7 @@
@param $remark Remark to be saved with the link (defaults to '')
@param $owner Owner of the link (defaults to user)
@discussion Does NOT check if link already exists
@result db-errno or -1 (for param-error) or 0 for success
@result False (for db or param-error) or link_id for success
*/
function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
{
@ -66,7 +67,11 @@
if ($app1 == $app2 && $id1 == $id2 ||
$id1 == '' || $id2 == '' || $app1 == '' || $app2 == '')
{
return -1; // dont link to self or other nosense
return False; // dont link to self or other nosense
}
if ($this->get_link($app1,$id1,$app2,$id2))
{
return $link['link_id']; // link alread exist
}
if (!$owner)
{
@ -76,9 +81,7 @@
if (!$lastmod)
{
$lastmod = time();
}
$this->unlink(0,$app1,$id1,'',$app2,$id2); // remove link if one exists
}
$sql = "INSERT INTO $this->db_name (link_app1,link_id1,link_app2,link_id2,link_remark,link_lastmod,link_owner) ".
" VALUES ('$app1','$id1','$app2','$id2','$remark',$lastmod,$owner)";
@ -86,9 +89,9 @@
{
echo "<p>solink.link($app1,$id1,$app2,$id2,'$remark',$owner) sql='$sql'</p>\n";
}
$this->db->query($sql);
$this->db->query($sql,__LINE__,__FILE__);
return $this->db->errno;
return $this->db->errno ? False : $this->db->get_last_insert_id($this->db_name,'link_id');
}
/*!
@ -113,7 +116,7 @@
{
echo "<p>solink.get_links($app,$id,$only_app,$order) sql='$sql'</p>\n";
}
$this->db->query($sql);
$this->db->query($sql,__LINE__,__FILE__);
if ($not_only = $only_app[0] == '!')
{
@ -151,6 +154,40 @@
}
return $links;
}
/*!
@function get_link
@syntax get_link( $app_link_id,$id='',$app2='',$id2='' )
@author ralfbecker
@abstract returns data of a link
@param $app_link_id > 0 link_id of link or app-name of link
@param $id,$app2,$id2 other param of the link if not link_id given
@result array with link-data or False
*/
function get_link($app_link_id,$id='',$app2='',$id2='')
{
$sql = "SELECT * FROM $this->db_name WHERE ";
if (intval($app_link_id) > 0)
{
$sql .= "link_id=$app_link_id";
}
else
{
if ($app_link_id == '' || $id == '' || $app2 == '' || $id2 == '')
{
return False;
}
$sql .= "(link_app1='$app_link_id' AND link_id1='$id' AND link_app2='$app2' AND link_id2='$id2') OR".
"(link_app2='$app_link_id' AND link_id2='$id' AND link_app1='$app2' AND link_id1='$id2')";
}
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
return $this->db->Record;
}
return False;
}
/*!
@function unlink
@ -199,7 +236,7 @@
{
echo "<p>solink.unlink($link_id,$app,$id,$owner,$app2,$id2) sql='$sql'</p>\n";
}
$this->db->query($sql);
$this->db->query($sql,__LINE__,__FILE__);
return $this->db->affected_rows();
}
@ -219,7 +256,7 @@
{
return 0;
}
$this->db->query("UPDATE $this->db_name SET owner=$new_owner WHERE owner=$owner");
$this->db->query("UPDATE $this->db_name SET owner=$new_owner WHERE owner=$owner",__LINE__,__FILE__);
return $this->db->affected_rows();
}

View File

@ -17,7 +17,6 @@
{
var $public_functions = array
(
//'get_list' => True,
'index' => True,
'edit' => True,
'delete' => True,
@ -79,7 +78,7 @@
//$this->html = CreateObject('etemplate.html');
//$this->categories = CreateObject('phpgwapi.categories');
//$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->link = CreateObject('infolog.uilink');
$this->link = &$this->bo->link;
$this->tmpl = CreateObject('etemplate.etemplate');
$this->html = &$this->tmpl->html;
@ -92,10 +91,16 @@
$info = $this->bo->read($info);
}
$id = $info['info_id'];
$info += $this->formatInfo($info,$action,$action_id);
$done = $info['info_status'] == 'done' || $info['info_status'] == 'billed';
$info['sub_class'] = $info['info_pri'] . ($done ? '_done' : '');
if (!$done && $info['info_enddate'] < time()+(60*60)*$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])
{
$info['end_class'] = 'overdue';
}
$info['info_des'] = nl2br($info['info_des']);
$info['info_anz_subs'] = $this->bo->anzSubs($id);
$this->bo->link_id2title(&$info,$action,$action_id);
$readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT);
$readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE);
$readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD);
@ -130,7 +135,7 @@
}
//echo "<p>readonlys = "; _debug_array($readonlys);
reset($rows);
return $total;
}
@ -152,9 +157,11 @@
'cat_id' => $values['nm']['cat_id']
));
}
$action = $action ? $action : $values['action'];
$action_id = $action_id ? $action_id : $values['action_id'];
if ($action == '')
{
$action = $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
$action_id = $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
}
if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main']))
{
@ -167,7 +174,7 @@
{
list($do,$do_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
list($do_id) = @each($do_id);
echo "<p>infolog::index: do='$do/$do_id', referer="; _debug_array($referer);
//echo "<p>infolog::index: do='$do/$do_id', referer="; _debug_array($referer);
switch($do)
{
case 'edit':
@ -259,16 +266,39 @@
$action = $content['action'];
$action_id = $content['action_id'];
$referer = $content['referer'];
if (isset($content['link_to']['primary']))
{
$content['info_link_id'] = $content['link_to']['primary'];
}
if (!$this->link->get_link($content['info_link_id']))
{
$content['info_link_id'] = 0; // link has been deleted
}
if ($content['set_today'])
{
$content['info_startdate'] = time();
unset($content['set_today']);
}
if ($content['save'] || $content['delete'] || $content['cancel'])
{
if ($content['save'] && (!$info_id || $this->bo->check_access($info_id,PHPGW_ACL_EDIT)))
{
$this->bo->write($content);
if (!$info_id && is_array($content['link_to']['to_id']))
if (!$info_id && is_array($content['link_to']['to_id'])) // writing link for new entry
{
$this->link->link('infolog',$this->bo->so->data['info_id'],$content['link_to']['to_id']);
$info_id = $this->bo->so->data['info_id'];
$this->link->link('infolog',$info_id,$content['link_to']['to_id']);
if (strstr($content['info_link_id'],':') !== False)
{
list($app,$id) = explode(':',$content['info_link_id']);
$content['info_link_id'] = $this->link->get_link('info_log',$info_id,$app,$id);
$this->bo->write(array(
'info_id' => $info_id,
'info_link_id' => $content['info_link_id']
));
}
}
}
elseif ($content['delete'] && $info_id > 0)
@ -295,10 +325,6 @@
get_var('HTTP_REFERER',Array('GLOBAL')));
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
if (!isset($this->bo->enums['type'][$type]))
{
$type = 'note';
}
$this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id );
$content = $this->bo->so->data;
@ -334,7 +360,7 @@
}
$content['links'] = $content['link_to'] = array(
'to_id' => $info_id,
'to_app' => 'infolog'
'to_app' => 'infolog',
);
switch ($action)
{
@ -343,14 +369,19 @@
case 'addressbook':
case 'projects':
case 'calendar':
$this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
case 'new':
$content['info_type'] = $type;
$content['info_link_id'] = $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
case 'new':
if ($type != '')
{
$content['info_type'] = $type;
}
break;
default:
$action = '';
break;
}
$content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : True;
if (!isset($this->bo->enums['type'][$content['info_type']]))
{
$content['info_type'] = 'note';
@ -369,6 +400,7 @@
),$readonlys,array(
'info_id' => $info_id,
'info_id_parent' => $content['info_id_parent'],
'info_link_id' => $content['info_link_id'],
'action' => $action,
'action_id' => $action_id,
'referer' => $referer,
@ -1523,10 +1555,19 @@
/*!
@function writeLangFile
@abstract writes langfile with all templates and messages registered here
@discussion can be called via http://domain/phpgroupware/index.php?infolog.uiinfolog.writeLangFile
@discussion call as http://domain/phpgroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile
*/
function writeLangFile()
{
$this->tmpl->writeLangFile('infolog','en',$this->messages);
$extra = $this->messages + $this->filters;
$enums = $this->bo->enums + $this->bo->status;
unset($enums['defaults']);
reset($enums);
while (list($key,$msg_arr) = each($enums))
{
$extra += $msg_arr;
}
_debug_array($extra);
echo $this->tmpl->writeLangFile('infolog','en',$extra);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,18 @@
%1 records imported infolog en %1 records imported
%1 records read (not yet imported, you may go back and uncheck test import) infolog en %1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)
%s $row_cont[info_addr] infolog en %s $row_cont[info_addr]
%s today infolog en %s Today
- subprojects from infolog en - Subprojects from
0% infolog en 0%
10% infolog en 10%
20% infolog en 20%
30% infolog en 30%
40% infolog en 40%
50% infolog en 50%
60% infolog en 60%
70% infolog en 70%
80% infolog en 80%
90% infolog en 90%
<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients infolog en en
a short subject for the entry infolog en a short subject for the entry
abort without deleting infolog en Abort without deleting
@ -28,6 +41,7 @@ call infolog en call
cancel infolog en Cancel
categories infolog en Categories
category infolog en Category
check to set startday infolog en check to set startday
click here to create the link infolog en click here to create the Link
click here to start the search infolog en click here to start the search
close infolog en Close
@ -72,6 +86,7 @@ fax infolog en Fax
fieldseparator infolog en Fieldseparator
finish infolog en finish
from infolog en From
high infolog en high
id infolog en Id
import infolog en Import
info log common en InfoLog
@ -93,11 +108,13 @@ links infolog en Links
links of this entry infolog en Links of this entry
list no subs/childs infolog en List no Subs/Childs
longer textual description infolog en longer textual description
low infolog en low
new search infolog en New search
no - cancel infolog en No - Cancel
no entries found, try again ... infolog en no entries found, try again ...
no filter infolog en no Filter
none infolog en None
normal infolog en normal
not infolog en not
not assigned infolog en not assigned
note infolog en Note
@ -170,6 +187,7 @@ view other subs infolog en view other Subs
view parent infolog en View parent
view subs infolog en view Subs
view the parent of this entry and all his subs infolog en View the parent of this entry and all his subs
view this linked entry in its application infolog en view this linked entry in its application
when should the todo or phonecall be started, it shows up from that date in the filter open or own open (startpage) infolog en when should the ToDo or Phonecall be started, it shows up from that date in the filter open or own open (startpage)
will-call infolog en will call
yes - delete infolog en Yes - Delete

View File

@ -13,7 +13,7 @@
$setup_info['infolog']['name'] = 'infolog';
$setup_info['infolog']['title'] = 'Info Log';
$setup_info['infolog']['version'] = '0.9.15.003';
$setup_info['infolog']['version'] = '0.9.15.004';
$setup_info['infolog']['app_order'] = 20;
$setup_info['infolog']['tables'] = array('phpgw_infolog','phpgw_links');
$setup_info['infolog']['enable'] = 1;

View File

@ -15,24 +15,26 @@
'phpgw_infolog' => array(
'fd' => array(
'info_id' => array('type' => 'auto','nullable' => False),
'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False),
'info_type' => array('type' => 'varchar','precision' => '10','nullable' => False,'default' => 'task'),
'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_des' => array('type' => 'text','nullable' => True),
'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'),
'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'),
'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'),
'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not')
'info_startdate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_enddate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_pri' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'normal'),
'info_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_bill_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_status' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'done'),
'info_confirm' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'not'),
'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0')
),
'pk' => array('info_id'),
'fk' => array(),

View File

@ -158,4 +158,62 @@
$GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.003';
return $GLOBALS['setup_info']['infolog']['currentver'];
}
$test[] = '0.9.15.003';
function infolog_upgrade0_9_15_003()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array(
'type' => 'varchar',
'precision' => '10',
'nullable' => False,
'default' => 'task'
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_infolog','info_pri',array(
'type' => 'varchar',
'precision' => '10',
'nullable' => True,
'default' => 'normal'
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array(
'type' => 'varchar',
'precision' => '10',
'nullable' => True,
'default' => 'done'
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_infolog','info_confirm',array(
'type' => 'varchar',
'precision' => '10',
'nullable' => True,
'default' => 'not'
));
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_infolog','info_modifier',array(
'type' => 'int',
'precision' => '4',
'nullable' => False,
'default' => '0'
));
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_infolog','info_link_id',array(
'type' => 'int',
'precision' => '4',
'nullable' => False,
'default' => '0'
));
// ORDER BY link_app2 DESC gives addressbook the highes precedens, use ASC for projects
$GLOBALS['phpgw_setup']->oProc->query("SELECT link_id,link_id1 FROM phpgw_links WHERE link_app1='infolog' ORDER BY link_app2 DESC");
$links = array();
while ($GLOBALS['phpgw_setup']->oProc->next_record())
{
$links[$GLOBALS['phpgw_setup']->oProc->f(1)] = $GLOBALS['phpgw_setup']->oProc->f(0);
}
reset($links);
while (list($info_id,$link_id) = each($links))
{
$GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id");
}
$GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.004';
return $GLOBALS['setup_info']['infolog']['currentver'];
}
?>