forked from extern/egroupware
Deleted recurrences (exceptions) now show when using deleted filter
This commit is contained in:
parent
7bb16b4823
commit
a6de0724bb
@ -487,7 +487,11 @@ class calendar_so
|
||||
$where['cal_public'] = 1;
|
||||
$where[] = "$this->user_table.cal_status NOT IN ('R','X')"; break;
|
||||
case 'deleted':
|
||||
$where[] = 'cal_deleted IS NOT NULL'; break;
|
||||
// Change source of recur date to get deleted recurrence exceptions
|
||||
$cols = str_replace("{$this->user_table}.cal_recur_date","{$this->dates_table}.cal_start AS cal_recur_date",$cols);
|
||||
$remove_rejected_by_user = false;
|
||||
$where[] = "$this->user_table.cal_recur_date=0";
|
||||
$where[] = "($this->cal_table.cal_deleted IS NOT NULL OR (recur_exception=1 AND $this->user_table.cal_recur_date = 0))"; break;
|
||||
case 'unknown':
|
||||
$where[] = "$this->user_table.cal_status='U'"; break;
|
||||
case 'not-unknown':
|
||||
@ -571,6 +575,11 @@ class calendar_so
|
||||
if ($params['enum_recuring']) // dates table join only needed to enum recuring events
|
||||
{
|
||||
$select['join'] = "JOIN $this->dates_table ON $this->cal_table.cal_id=$this->dates_table.cal_id ".$select['join'];
|
||||
// Add in deleted exceptions to recurring
|
||||
if($filter == 'deleted')
|
||||
{
|
||||
$select['join'] .= "LEFT JOIN (SELECT egw_cal.cal_reference AS ref, egw_cal.cal_recurrence AS rec FROM $this->cal_table) AS cal_exception ON $this->cal_table.cal_id = cal_exception.ref AND $this->dates_table.cal_start = cal_exception.rec ";
|
||||
}
|
||||
}
|
||||
$selects = array();
|
||||
// we check if there are parts to use for the construction of our UNION query,
|
||||
@ -583,7 +592,10 @@ class calendar_so
|
||||
$selects[count($selects)-1]['where'][] = $user_sql;
|
||||
if ($params['enum_recuring'])
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
if($filter != 'deleted')
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
}
|
||||
$selects[] = $select;
|
||||
$selects[count($selects)-1]['where'][] = $user_sql;
|
||||
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
|
||||
@ -596,7 +608,10 @@ class calendar_so
|
||||
$selects[count($selects)-1]['where'][] = $owner_or;
|
||||
if ($params['enum_recuring'])
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
if($filter != 'deleted')
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
}
|
||||
$selects[] = $select;
|
||||
$selects[count($selects)-1]['where'][] = $owner_or;
|
||||
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
|
||||
@ -609,7 +624,10 @@ class calendar_so
|
||||
$selects[] = $select;
|
||||
if ($params['enum_recuring'])
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
if($filter != 'deleted')
|
||||
{
|
||||
$selects[count($selects)-1]['where'][] = "recur_type IS NULL AND $this->user_table.cal_recur_date=0";
|
||||
}
|
||||
$selects[] = $select;
|
||||
$selects[count($selects)-1]['where'][] = "$this->user_table.cal_recur_date=cal_start";
|
||||
}
|
||||
@ -625,6 +643,10 @@ class calendar_so
|
||||
{
|
||||
$selects[$key]['cols'] = str_replace('cal_start','MIN(cal_start) AS cal_start',$selects[$key]['cols']);
|
||||
}
|
||||
if($filter == 'deleted')
|
||||
{
|
||||
$selects[$key]['cols'] = str_replace("{$this->user_table}.cal_recur_date","{$this->dates_table}.cal_start AS cal_recur_date",$selects[$key]['cols']);
|
||||
}
|
||||
}
|
||||
if (!isset($param['cols'])) self::get_union_selects($selects,$start,$end,$users,$cat_id,$filter,$params['query'],$params['users']);
|
||||
|
||||
|
@ -364,6 +364,13 @@ class calendar_uilist extends calendar_ui
|
||||
{
|
||||
$event['class'] .= 'rowDeleted ';
|
||||
}
|
||||
// Disable everything for 'deleted' exceptions - there's nothing
|
||||
// logical to do except undelete it
|
||||
if($search_params['filter'] == 'deleted' && $event['recur_type'])
|
||||
{
|
||||
$event['class'] .= ' rowNoView rowNoDelete rowDeleted';
|
||||
}
|
||||
|
||||
// Filemanager disabled for other applications
|
||||
$readonlys['filemanager['.$event['id'].']'] = !is_numeric($event['id']);
|
||||
|
||||
@ -591,14 +598,28 @@ class calendar_uilist extends calendar_ui
|
||||
break;
|
||||
case 'undelete':
|
||||
$action_msg = lang('recovered');
|
||||
if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(EGW_ACL_EDIT,$id) &&
|
||||
is_array($event) && $event['deleted'])
|
||||
if ($id && ($event = $this->bo->read($id, $recur_date)) && $this->bo->check_perms(EGW_ACL_EDIT,$id))
|
||||
{
|
||||
$event['deleted'] = null;
|
||||
if($this->bo->save($event))
|
||||
if(is_array($event) && $event['deleted'])
|
||||
{
|
||||
$success++;
|
||||
break;
|
||||
$event['deleted'] = null;
|
||||
if($this->bo->save($event))
|
||||
{
|
||||
$success++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Undelete an exception by removing it
|
||||
else if (is_array($event) && $event['recur_type'])
|
||||
{
|
||||
$original = $this->bo->read($id);
|
||||
$key = array_search($recur_date, $original['recur_exception']);
|
||||
if($key !== false) unset($original['recur_exception'][$key]);
|
||||
if($key !== false && $this->bo->save($original))
|
||||
{
|
||||
$success++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$failed++;
|
||||
@ -843,6 +864,7 @@ class calendar_uilist extends calendar_ui
|
||||
$actions['undelete'] = array(
|
||||
'caption' => 'Un-delete',
|
||||
'hint' => 'Recover this event',
|
||||
'icon' => 'revert',
|
||||
'group' => $group,
|
||||
'enabled' => 'javaScript:nm_enableClass',
|
||||
'enableClass' => 'rowDeleted',
|
||||
|
Loading…
Reference in New Issue
Block a user