forked from extern/egroupware
WIP store responsible / attendees in an own table to track removed ones for CalDAV sync report
This commit is contained in:
parent
4dcb415f44
commit
70b22e3377
@ -58,6 +58,12 @@ class infolog_so
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $extra_table = 'egw_infolog_extra';
|
var $extra_table = 'egw_infolog_extra';
|
||||||
|
/**
|
||||||
|
* Infolog delegation / iCal attendees
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
var $users_table = 'egw_infolog_users';
|
||||||
/**
|
/**
|
||||||
* Offset between server- and user-time in h
|
* Offset between server- and user-time in h
|
||||||
*
|
*
|
||||||
@ -154,11 +160,10 @@ class infolog_so
|
|||||||
* Filter for a given responsible user: info_responsible either contains a the user or one of his memberships
|
* Filter for a given responsible user: info_responsible either contains a the user or one of his memberships
|
||||||
*
|
*
|
||||||
* @param int|array $users one or more account_ids
|
* @param int|array $users one or more account_ids
|
||||||
|
* @param boolean $deleted_too =false true: also use deleted entries
|
||||||
* @return string
|
* @return string
|
||||||
*
|
|
||||||
* @todo make the responsible a second table and that filter a join with the responsible table
|
|
||||||
*/
|
*/
|
||||||
function responsible_filter($users)
|
function responsible_filter($users, $deleted_too=false)
|
||||||
{
|
{
|
||||||
if (!$users) return '0';
|
if (!$users) return '0';
|
||||||
|
|
||||||
@ -174,12 +179,14 @@ class infolog_so
|
|||||||
{
|
{
|
||||||
$responsible = array_unique($responsible);
|
$responsible = array_unique($responsible);
|
||||||
}
|
}
|
||||||
foreach($responsible as $key => $uid)
|
$sql = "$this->users_table.account_id IN (".implode(',', $responsible).')';
|
||||||
|
|
||||||
|
if (!$deleted_too)
|
||||||
{
|
{
|
||||||
$responsible[$key] = $this->db->concat("','",'info_responsible',"','")." LIKE '%,$uid,%'";
|
// we use NULL or true, not false!
|
||||||
|
$sql .= " AND $this->users_table.info_res_deleted IS NULL";
|
||||||
}
|
}
|
||||||
//echo "<p align=right>responsible_filter($user) = ".'('.implode(' OR ',$responsible).')'."</p>\n";
|
return $sql;
|
||||||
return '('.implode(' OR ',$responsible).')';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,11 +218,11 @@ class infolog_so
|
|||||||
|
|
||||||
if ($filter == 'my' || $filter == 'responsible')
|
if ($filter == 'my' || $filter == 'responsible')
|
||||||
{
|
{
|
||||||
$filtermethod .= " AND info_responsible='0'";
|
$filtermethod .= " AND $this->users_table.account_id IS NULL";
|
||||||
}
|
}
|
||||||
if ($filter == 'delegated')
|
if ($filter == 'delegated')
|
||||||
{
|
{
|
||||||
$filtermethod .= " AND info_responsible<>'0')";
|
$filtermethod .= " AND $this->users_table.account_id IS NOT NULL)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,7 +274,7 @@ class infolog_so
|
|||||||
{
|
{
|
||||||
$filtermethod .= $this->db->expression($this->info_table,' AND (',array(
|
$filtermethod .= $this->db->expression($this->info_table,' AND (',array(
|
||||||
'info_owner' => $f_user,
|
'info_owner' => $f_user,
|
||||||
)," AND info_responsible='0' OR ",$this->responsible_filter($f_user),')');
|
)," AND $this->users_table.account_id IS NULL OR ",$this->responsible_filter($f_user),')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//echo "<p>aclFilter(filter='$_filter',user='$f_user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n";
|
//echo "<p>aclFilter(filter='$_filter',user='$f_user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n";
|
||||||
@ -387,8 +394,18 @@ class infolog_so
|
|||||||
{
|
{
|
||||||
$minimum_uid_length = 8;
|
$minimum_uid_length = 8;
|
||||||
}
|
}
|
||||||
|
if (isset($where['info_id']))
|
||||||
|
{
|
||||||
|
$where[] = $this->db->expression($this->info_table, $this->info_table.'.', array('info_id' => $where['info_id']));
|
||||||
|
unset($where['info_id']);
|
||||||
|
}
|
||||||
|
// hide deleted attendees
|
||||||
|
if ($where) $where[] = "$this->users_table.info_res_deleted IS NULL";
|
||||||
|
|
||||||
if (!$where || !($this->data = $this->db->select($this->info_table,'*',$where,__LINE__,__FILE__)->fetch()))
|
if (!$where ||
|
||||||
|
!($this->data = $this->db->select($this->info_table, '*,'.$this->db->group_concat('account_id').' AS info_responsible', $where,
|
||||||
|
__LINE__, __FILE__, false, "GROUP BY $this->info_table.info_id", 'infolog', 1,
|
||||||
|
"LEFT JOIN $this->users_table ON $this->info_table.info_id=$this->users_table.info_id")->fetch()))
|
||||||
{
|
{
|
||||||
$this->init( );
|
$this->init( );
|
||||||
//error_log(__METHOD__.'('.array2string($where).') returning FALSE');
|
//error_log(__METHOD__.'('.array2string($where).') returning FALSE');
|
||||||
@ -432,6 +449,7 @@ class infolog_so
|
|||||||
}
|
}
|
||||||
$this->db->delete($this->info_table,array('info_id'=>$info_id),__LINE__,__FILE__);
|
$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__);
|
$this->db->delete($this->extra_table,array('info_id'=>$info_id),__LINE__,__FILE__);
|
||||||
|
$this->db->delete($this->users_table,array('info_id'=>$info_id),__LINE__,__FILE__);
|
||||||
Link::unlink(0,'infolog',$info_id);
|
Link::unlink(0,'infolog',$info_id);
|
||||||
|
|
||||||
if ($this->data['info_id'] == $info_id)
|
if ($this->data['info_id'] == $info_id)
|
||||||
@ -478,6 +496,7 @@ class infolog_so
|
|||||||
* @param array $args hook arguments
|
* @param array $args hook arguments
|
||||||
* @param int $args['account_id'] account to delete
|
* @param int $args['account_id'] account to delete
|
||||||
* @param int $args['new_owner']=0 new owner
|
* @param int $args['new_owner']=0 new owner
|
||||||
|
* @todo test deleting an owner with replace and without
|
||||||
*/
|
*/
|
||||||
function change_delete_owner(array $args) // new_owner=0 means delete
|
function change_delete_owner(array $args) // new_owner=0 means delete
|
||||||
{
|
{
|
||||||
@ -492,17 +511,24 @@ class infolog_so
|
|||||||
{
|
{
|
||||||
$this->db->update($this->info_table,array('info_owner'=>$args['new_owner']),array('info_owner'=>$args['account_id']),__LINE__,__FILE__,'infolog');
|
$this->db->update($this->info_table,array('info_owner'=>$args['new_owner']),array('info_owner'=>$args['account_id']),__LINE__,__FILE__,'infolog');
|
||||||
}
|
}
|
||||||
foreach($this->db->select($this->info_table,'info_id,info_responsible',
|
|
||||||
$this->db->concat("','",'info_responsible',"','").' LIKE '.$this->db->quote('%,'.(int)$args['account_id'].',%'),
|
if ($args['new_owner'])
|
||||||
__LINE__,__FILE__,false,'','infolog') as $row)
|
|
||||||
{
|
{
|
||||||
$new_responsible = explode(',',$row['info_responsible']);
|
// we cant just set the new owner, as he might be already set and we have a unique index
|
||||||
unset($new_responsible[array_search($args['account_id'],$new_responsible)]);
|
Api\Db::$table_aliases[$this->users_table] = $this->users_table.
|
||||||
if ((int)$args['new_owner']) $new_responsible[] = (int)$args['new_owner'];
|
" LEFT JOIN $this->users_table new_owner ON new_owner.info_id=$this->users_table.info_id".
|
||||||
$this->db->update($this->info_table,array(
|
" AND new_owner.account_id=".$this->db->quote($args['new_owner'], 'int');
|
||||||
'info_responsible' => implode(',',$new_responsible),
|
|
||||||
),array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog');
|
$this->db->update($this->users_table, array(
|
||||||
|
'account_id' => $args['new_owner'],
|
||||||
|
), array(
|
||||||
|
'account_id' => $args['account_id'],
|
||||||
|
'new_owner.account_id IS NULL',
|
||||||
|
), __LINE__, __FILE__, 'infolog');
|
||||||
|
|
||||||
|
unset(Api\Db::$table_aliases[$this->users_table]);
|
||||||
}
|
}
|
||||||
|
$this->db->delete($this->users_table, array('account_id' => $args['account_id']), __LINE__, __FILE__, 'infolog');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -527,10 +553,6 @@ class infolog_so
|
|||||||
//echo "soinfolog::write(,$check_modified) values="; _debug_array($values);
|
//echo "soinfolog::write(,$check_modified) values="; _debug_array($values);
|
||||||
$info_id = (int) $values['info_id'];
|
$info_id = (int) $values['info_id'];
|
||||||
|
|
||||||
if (array_key_exists('info_responsible',$values)) // isset($values['info_responsible']) returns false for NULL!
|
|
||||||
{
|
|
||||||
$values['info_responsible'] = $values['info_responsible'] ? implode(',',$values['info_responsible']) : '0';
|
|
||||||
}
|
|
||||||
$table_def = $this->db->get_table_definitions('infolog',$this->info_table);
|
$table_def = $this->db->get_table_definitions('infolog',$this->info_table);
|
||||||
$to_write = array();
|
$to_write = array();
|
||||||
foreach($values as $key => $val)
|
foreach($values as $key => $val)
|
||||||
@ -626,6 +648,45 @@ class infolog_so
|
|||||||
// echo "<p>soinfolog.write this->data= "; _debug_array($this->data);
|
// 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']);
|
//error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning id=".$this->data['info_id']);
|
||||||
|
|
||||||
|
// update attendees/delegates
|
||||||
|
if (array_key_exists('info_responsible', $values))
|
||||||
|
{
|
||||||
|
// mark removed attendees as deleted
|
||||||
|
$this->db->update($this->users_table, array(
|
||||||
|
'info_res_deleted' => true,
|
||||||
|
'info_res_modifier' => $this->user,
|
||||||
|
), array(
|
||||||
|
'info_id' => $this->data['info_id'],
|
||||||
|
'info_res_deleted IS NULL',
|
||||||
|
)+(!$values['info_responsible'] ? array() :
|
||||||
|
array(1=>'account_id NOT IN ('.implode(',', array_map('intval', $values['info_responsible'])).')')),
|
||||||
|
__LINE__, __FILE__, 'infolog');
|
||||||
|
|
||||||
|
// add newly added attendees
|
||||||
|
if ($values['info_responsible'])
|
||||||
|
{
|
||||||
|
$old_responsible = array();
|
||||||
|
foreach($this->db->select($this->users_table,'account_id',array(
|
||||||
|
'info_id' => $this->data['info_id'],
|
||||||
|
'info_res_deleted IS NULL',
|
||||||
|
), __LINE__, __FILE__, false, '', 'infolog') as $row)
|
||||||
|
{
|
||||||
|
$old_responsible[] = $row['account_id'];
|
||||||
|
}
|
||||||
|
foreach(array_diff($values['info_responsible'], $old_responsible) as $account_id)
|
||||||
|
{
|
||||||
|
$this->db->insert($this->users_table, array(
|
||||||
|
'info_res_modifier' => $this->user,
|
||||||
|
'info_res_status' => 'NEEDS-ACTION',
|
||||||
|
'info_res_deleted' => null,
|
||||||
|
), array(
|
||||||
|
'info_id' => $this->data['info_id'],
|
||||||
|
'account_id' => $account_id,
|
||||||
|
), __LINE__, __FILE__, 'infolog');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->data['info_id'];
|
return $this->data['info_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,7 +813,7 @@ class infolog_so
|
|||||||
case 'info_responsible':
|
case 'info_responsible':
|
||||||
$data = (int) $data;
|
$data = (int) $data;
|
||||||
if (!$data) continue;
|
if (!$data) continue;
|
||||||
$filtermethod .= ' AND ('.$this->responsible_filter($data)." OR info_responsible='0' AND ".
|
$filtermethod .= ' AND ('.$this->responsible_filter($data)." OR $this->users_table.account_id IS NULL AND ".
|
||||||
$this->db->expression($this->info_table,array(
|
$this->db->expression($this->info_table,array(
|
||||||
'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data,true)
|
'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data,true)
|
||||||
)).')';
|
)).')';
|
||||||
@ -817,6 +878,9 @@ class infolog_so
|
|||||||
// mssql and others cant use DISTICT if text columns (info_des) are involved
|
// mssql and others cant use DISTICT if text columns (info_des) are involved
|
||||||
$distinct = $this->db->capabilities['distinct_on_text'] ? 'DISTINCT' : '';
|
$distinct = $this->db->capabilities['distinct_on_text'] ? 'DISTINCT' : '';
|
||||||
}
|
}
|
||||||
|
$join .= " LEFT JOIN $this->users_table ON main.info_id=$this->users_table.info_id";
|
||||||
|
$join .= " LEFT JOIN $this->users_table attendees ON main.info_id=attendees.info_id";
|
||||||
|
$group_by = ' GROUP BY attendees.info_id ';
|
||||||
$pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0)));
|
$pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0)));
|
||||||
|
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] != '1' && $action != 'sp' ||
|
if ($GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] != '1' && $action != 'sp' ||
|
||||||
@ -838,7 +902,7 @@ class infolog_so
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$query['total'] = $this->db->query($sql="SELECT $distinct main.info_id ".$sql_query,__LINE__,__FILE__)->NumRows();
|
$query['total'] = $this->db->query($sql="SELECT $distinct main.info_id ".$sql_query.$group_by,__LINE__,__FILE__)->NumRows();
|
||||||
}
|
}
|
||||||
$info_customfield = '';
|
$info_customfield = '';
|
||||||
if ($sortbycf != '')
|
if ($sortbycf != '')
|
||||||
@ -865,7 +929,10 @@ class infolog_so
|
|||||||
}
|
}
|
||||||
$cols = isset($query['cols']) ? $query['cols'] : 'main.*';
|
$cols = isset($query['cols']) ? $query['cols'] : 'main.*';
|
||||||
if (is_array($cols)) $cols = implode(',',$cols);
|
if (is_array($cols)) $cols = implode(',',$cols);
|
||||||
$rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.$query['append'].' '.$ordermethod,__LINE__,__FILE__,
|
$cols .= ','.$this->db->group_concat('attendees.account_id').' AS info_responsible';
|
||||||
|
$rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.
|
||||||
|
// hide deleted attendees
|
||||||
|
' AND attendees.info_res_deleted IS NULL '.$query['append'].$group_by.' '.$ordermethod,__LINE__,__FILE__,
|
||||||
(int) $query['start'],isset($query['start']) ? (int) $query['num_rows'] : -1,false,Api\Db::FETCH_ASSOC);
|
(int) $query['start'],isset($query['start']) ? (int) $query['num_rows'] : -1,false,Api\Db::FETCH_ASSOC);
|
||||||
//echo "<p>db::query('$sql',,,".(int)$query['start'].','.(isset($query['start']) ? (int) $query['num_rows'] : -1).")</p>\n";
|
//echo "<p>db::query('$sql',,,".(int)$query['start'].','.(isset($query['start']) ? (int) $query['num_rows'] : -1).")</p>\n";
|
||||||
|
|
||||||
@ -883,7 +950,7 @@ class infolog_so
|
|||||||
}
|
}
|
||||||
foreach($rs as $info)
|
foreach($rs as $info)
|
||||||
{
|
{
|
||||||
$info['info_responsible'] = $info['info_responsible'] ? explode(',',$info['info_responsible']) : array();
|
$info['info_responsible'] = $info['info_responsible'] ? array_unique(explode(',',$info['info_responsible'])) : array();
|
||||||
|
|
||||||
$ids[$info['info_id']] = $info;
|
$ids[$info['info_id']] = $info;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$setup_info['infolog']['name'] = 'infolog';
|
$setup_info['infolog']['name'] = 'infolog';
|
||||||
$setup_info['infolog']['version'] = '16.1.001';
|
$setup_info['infolog']['version'] = '16.1.003';
|
||||||
$setup_info['infolog']['app_order'] = 5;
|
$setup_info['infolog']['app_order'] = 5;
|
||||||
$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra');
|
$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra','egw_infolog_users');
|
||||||
$setup_info['infolog']['enable'] = 1;
|
$setup_info['infolog']['enable'] = 1;
|
||||||
$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true';
|
$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true';
|
||||||
|
|
||||||
@ -71,3 +71,4 @@ $setup_info['infolog']['depends'][] = array(
|
|||||||
'versions' => Array('16.1')
|
'versions' => Array('16.1')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ $phpgw_baseline = array(
|
|||||||
'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'),
|
'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'),
|
||||||
'info_des' => array('type' => 'longtext','comment' => 'desciption of the infolog-entry'),
|
'info_des' => array('type' => 'longtext','comment' => 'desciption of the infolog-entry'),
|
||||||
'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
|
'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
|
||||||
'info_responsible' => array('type' => 'ascii','meta' => 'account-commasep','precision' => '255','nullable' => False,'default' => '0','comment' => 'responsible users or groups (multiple)'),
|
|
||||||
'info_access' => array('type' => 'ascii','precision' => '10','default' => 'public','comment' => 'public or privat'),
|
'info_access' => array('type' => 'ascii','precision' => '10','default' => 'public','comment' => 'public or privat'),
|
||||||
'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
|
'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
|
||||||
'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
|
'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
|
||||||
@ -51,7 +50,7 @@ $phpgw_baseline = array(
|
|||||||
),
|
),
|
||||||
'pk' => array('info_id'),
|
'pk' => array('info_id'),
|
||||||
'fk' => array(),
|
'fk' => array(),
|
||||||
'ix' => array('caldav_name',array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')),
|
'ix' => array('caldav_name','info_owner','info_datemodified','info_id_parent'),
|
||||||
'uc' => array()
|
'uc' => array()
|
||||||
),
|
),
|
||||||
'egw_infolog_extra' => array(
|
'egw_infolog_extra' => array(
|
||||||
@ -64,5 +63,21 @@ $phpgw_baseline = array(
|
|||||||
'fk' => array(),
|
'fk' => array(),
|
||||||
'ix' => array(),
|
'ix' => array(),
|
||||||
'uc' => array()
|
'uc' => array()
|
||||||
|
),
|
||||||
|
'egw_infolog_users' => array(
|
||||||
|
'fd' => array(
|
||||||
|
'info_res_id' => array('type' => 'auto','nullable' => False,'comment' => 'auto id'),
|
||||||
|
'info_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||||
|
'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'attendee'),
|
||||||
|
'info_res_deleted' => array('type' => 'bool','comment' => 'NULL or true, not false!'),
|
||||||
|
'info_res_modified' => array('type' => 'timestamp','meta' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time'),
|
||||||
|
'info_res_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'modifying user'),
|
||||||
|
'info_res_status' => array('type' => 'varchar','precision' => '16','default' => 'NEEDS-ACTION','comment' => 'attendee status'),
|
||||||
|
'info_res_attendee' => array('type' => 'varchar','precision' => '255','comment' => 'attendee email or json object with attr. cn, url, ...')
|
||||||
|
),
|
||||||
|
'pk' => array('info_res_id'),
|
||||||
|
'fk' => array(),
|
||||||
|
'ix' => array('account_id'),
|
||||||
|
'uc' => array(array('info_id','account_id'))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use EGroupware\Api;
|
||||||
|
|
||||||
function infolog_upgrade0_9_11()
|
function infolog_upgrade0_9_11()
|
||||||
{
|
{
|
||||||
$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified');
|
$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified');
|
||||||
@ -819,3 +821,114 @@ function infolog_upgrade16_1()
|
|||||||
|
|
||||||
return $GLOBALS['setup_info']['infolog']['currentver'] = '16.1.001';
|
return $GLOBALS['setup_info']['infolog']['currentver'] = '16.1.001';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add extra attendee table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function infolog_upgrade16_1_001()
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_setup']->oProc->CreateTable('egw_infolog_users',array(
|
||||||
|
'fd' => array(
|
||||||
|
'info_res_id' => array('type' => 'auto','nullable' => False,'comment' => 'auto id'),
|
||||||
|
'info_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||||
|
'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'attendee'),
|
||||||
|
'info_res_deleted' => array('type' => 'bool'),
|
||||||
|
'info_res_modified' => array('type' => 'timestamp','meta' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time'),
|
||||||
|
'info_res_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'modifying user'),
|
||||||
|
'info_res_status' => array('type' => 'varchar','precision' => '16','default' => 'NEEDS-ACTION','comment' => 'attendee status'),
|
||||||
|
'info_res_attendee' => array('type' => 'varchar','precision' => '255','comment' => 'attendee email or json object with attr. cn, url, ...')
|
||||||
|
),
|
||||||
|
'pk' => array('info_res_id'),
|
||||||
|
'fk' => array(),
|
||||||
|
'ix' => array('account_id'),
|
||||||
|
'uc' => array(array('info_id','account_id'))
|
||||||
|
));
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
|
$chunk_size = 500;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
foreach($GLOBALS['egw_setup']->db->select('egw_infolog', 'info_id,info_responsible',
|
||||||
|
"info_responsible<>'0' AND info_responsible<>''", __LINE__, __FILE__,
|
||||||
|
$n*$chunk_size, 'ORDER BY info_id', 'infolog', $chunk_size) as $row)
|
||||||
|
{
|
||||||
|
foreach(explode(',', $row['info_responsible']) as $responsible)
|
||||||
|
{
|
||||||
|
if ($responsible)
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_setup']->db->insert('egw_infolog_users', array(
|
||||||
|
'info_id' => $row['info_id'],
|
||||||
|
'account_id' => $responsible,
|
||||||
|
), false, __LINE__, __FILE__, 'infolog');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++$i;
|
||||||
|
}
|
||||||
|
++$n;
|
||||||
|
}
|
||||||
|
while ($i == $chunk_size);
|
||||||
|
|
||||||
|
return $GLOBALS['setup_info']['infolog']['currentver'] = '16.1.002';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop egw_infolog.info_responsible and indexes containing it, creating indexes on info_owner, info_id_parent and info_datemodified
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function infolog_upgrade16_1_002()
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_setup']->oProc->DropIndex('egw_infolog', array('info_owner','info_responsible','info_status','info_startdate'));
|
||||||
|
$GLOBALS['egw_setup']->oProc->DropIndex('egw_infolog', array('info_id_parent','info_owner','info_responsible','info_status','info_startdate'));
|
||||||
|
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog', 'info_owner');
|
||||||
|
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog', 'info_id_parent');
|
||||||
|
$GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog', 'info_datemodified');
|
||||||
|
|
||||||
|
$GLOBALS['egw_setup']->oProc->DropColumn('egw_infolog',array(
|
||||||
|
'fd' => array(
|
||||||
|
'info_id' => array('type' => 'auto','nullable' => False,'comment' => 'id of the infolog-entry'),
|
||||||
|
'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task','comment' => 'infolog-type e.g. task, phone, email or note'),
|
||||||
|
'info_from' => array('type' => 'varchar','precision' => '255','comment' => 'text of the primary link'),
|
||||||
|
'info_addr' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for phone-number or email of the primary contact'),
|
||||||
|
'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'),
|
||||||
|
'info_des' => array('type' => 'longtext','comment' => 'desciption of the infolog-entry'),
|
||||||
|
'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
|
||||||
|
'info_access' => array('type' => 'ascii','precision' => '10','default' => 'public','comment' => 'public or privat'),
|
||||||
|
'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
|
||||||
|
'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
|
||||||
|
'info_startdate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the startdate'),
|
||||||
|
'info_enddate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the enddate'),
|
||||||
|
'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the parent infolog'),
|
||||||
|
'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: planned time'),
|
||||||
|
'info_replanned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: replanned time'),
|
||||||
|
'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: used time'),
|
||||||
|
'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done','comment' => 'status e.g. ongoing, done ...'),
|
||||||
|
'info_confirm' => array('type' => 'ascii','precision' => '10','default' => 'not'),
|
||||||
|
'info_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'account id of the last modifier'),
|
||||||
|
'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the primary link'),
|
||||||
|
'info_priority' => array('type' => 'int','precision' => '2','default' => '1','comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'),
|
||||||
|
'pl_id' => array('type' => 'int','precision' => '4','comment' => 'pm-field: id of the pricelist'),
|
||||||
|
'info_price' => array('type' => 'float','precision' => '8','comment' => 'pm-field: price-field'),
|
||||||
|
'info_percent' => array('type' => 'int','meta' => 'percent','precision' => '2','default' => '0','comment' => 'percentage of completion'),
|
||||||
|
'info_datecompleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of completion'),
|
||||||
|
'info_location' => array('type' => 'varchar','precision' => '255','comment' => 'textfield location'),
|
||||||
|
'info_custom_from' => array('type' => 'int','precision' => '1','comment' => 'tick-box to show infolog_from'),
|
||||||
|
'info_uid' => array('type' => 'ascii','precision' => '128','comment' => 'unique id of the infolog-entry'),
|
||||||
|
'info_cc' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for email-adress to be notified via email of changes'),
|
||||||
|
'caldav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CalDAV URL, if specified by client'),
|
||||||
|
'info_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag, not yet used'),
|
||||||
|
'info_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation date'),
|
||||||
|
'info_creator' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the creator')
|
||||||
|
),
|
||||||
|
'pk' => array('info_id'),
|
||||||
|
'fk' => array(),
|
||||||
|
'ix' => array('caldav_name','info_owner','info_datemodified','info_id_parent'),
|
||||||
|
'uc' => array()
|
||||||
|
),'info_responsible');
|
||||||
|
|
||||||
|
return $GLOBALS['setup_info']['infolog']['currentver'] = '16.1.003';
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user