Rename StartTime, EndTime in Events to StartDateTime and EndDateTime

pull/3072/head
Isaac Connor 2020-11-04 13:52:32 -05:00
parent 0d404ac66f
commit 2d33dd5386
3 changed files with 28 additions and 28 deletions

View File

@ -14,8 +14,8 @@ class Event extends ZM_Object {
'StorageId' => null,
'SecondaryStorageId' => null,
'Cause' => '',
'StartTime' => null,
'EndTime' => null,
'StartDateTime' => null,
'EndDateTime' => null,
'Width' => null,
'Height' => null,
'Length' => null,
@ -93,7 +93,7 @@ class Event extends ZM_Object {
public function Time() {
if ( ! isset($this->{'Time'}) ) {
$this->{'Time'} = strtotime($this->{'StartTime'});
$this->{'Time'} = strtotime($this->{'StartDateTime'});
}
return $this->{'Time'};
}
@ -153,9 +153,9 @@ class Event extends ZM_Object {
if ( $this->{'Scheme'} == 'Deep' ) {
# Assumption: All events have a start time
$start_date = date_parse($this->{'StartTime'});
$start_date = date_parse($this->{'StartDateTime'});
if ( ! $start_date ) {
throw new Exception('Unable to parse start time for event ' . $this->{'Id'} . ' not deleting files.');
throw new Exception('Unable to parse start date time for event ' . $this->{'Id'} . ' not deleting files.');
}
$start_date['year'] = $start_date['year'] % 100;
@ -279,7 +279,7 @@ class Event extends ZM_Object {
}
if ( (!property_exists($this, 'DiskSpace')) or (null === $this->{'DiskSpace'}) ) {
$this->{'DiskSpace'} = folder_size($this->Path());
if ( $this->{'EndTime'} ) {
if ( $this->{'EndDateTime'} ) {
# Finished events shouldn't grow in size much so we can commit it to the db.
dbQuery('UPDATE Events SET DiskSpace=? WHERE Id=?', array($this->{'DiskSpace'}, $this->{'Id'}));
}
@ -606,7 +606,7 @@ class Event extends ZM_Object {
if ( $this->Archived() ) {
return false;
}
if ( !$this->EndTime() ) {
if ( !$this->EndDateTime() ) {
return false;
}
if ( !canEdit('Events') ) {
@ -619,7 +619,7 @@ class Event extends ZM_Object {
public function cant_delete_reason() {
if ( $this->Archived() ) {
return 'You cannot delete an archived event. Unarchive it first.';
} else if ( ! $this->EndTime() ) {
} else if ( ! $this->EndDateTime() ) {
return 'You cannot delete an event while it is being recorded. Wait for it to finish.';
} else if ( ! canEdit('Events') ) {
return 'You do not have rights to edit Events.';

View File

@ -392,35 +392,35 @@ class Filter extends ZM_Object {
break;
case 'DateTime':
case 'StartDateTime':
$sqlValue = 'E.StartTime';
$sqlValue = 'E.StartDateTime';
$dtAttr = true;
break;
case 'Date':
case 'StartDate':
$sqlValue = 'to_days(E.StartTime)';
$sqlValue = 'to_days(E.StartDateTime)';
$dtAttr = true;
break;
case 'Time':
case 'StartTime':
$sqlValue = 'extract(hour_second from E.StartTime)';
$sqlValue = 'extract(hour_second from E.StartDateTime)';
break;
case 'Weekday':
case 'StartWeekday':
$sqlValue = 'weekday(E.StartTime)';
$sqlValue = 'weekday(E.StartDateTime)';
break;
case 'EndDateTime':
$sqlValue = 'E.EndTime';
$sqlValue = 'E.EndDateTime';
$dtAttr = true;
break;
case 'EndDate':
$sqlValue = 'to_days(E.EndTime)';
$sqlValue = 'to_days(E.EndDateTime)';
$dtAttr = true;
break;
case 'EndTime':
$sqlValue = 'extract(hour_second from E.EndTime)';
$sqlValue = 'extract(hour_second from E.EndDateTime)';
break;
case 'EndWeekday':
$sqlValue = 'weekday(E.EndTime)';
$sqlValue = 'weekday(E.EndDateTime)';
break;
case 'Id':
case 'Name':

View File

@ -222,45 +222,45 @@ class FilterTerm {
break;
# Unspecified start or end, so assume start, this is to support legacy filters
case 'DateTime':
$sql .= 'E.StartTime';
$sql .= 'E.StartDateTime';
break;
case 'Date':
$sql .= 'to_days(E.StartTime)';
$sql .= 'to_days(E.StartDateTime)';
break;
case 'Time':
$sql .= 'extract(hour_second FROM E.StartTime)';
$sql .= 'extract(hour_second FROM E.StartDateTime)';
break;
case 'Weekday':
$sql .= 'weekday(E.StartTime)';
$sql .= 'weekday(E.StartDateTime)';
break;
# Starting Time
case 'StartDateTime':
$sql .= 'E.StartTime';
$sql .= 'E.StartDateTime';
break;
case 'FramesEventId':
$sql .= 'F.EventId';
break;
case 'StartDate':
$sql .= 'to_days(E.StartTime)';
$sql .= 'to_days(E.StartDateTime)';
break;
case 'StartTime':
$sql .= 'extract(hour_second FROM E.StartTime)';
$sql .= 'extract(hour_second FROM E.StartDateTime)';
break;
case 'StartWeekday':
$sql .= 'weekday(E.StartTime)';
$sql .= 'weekday(E.StartDateTime)';
break;
# Ending Time
case 'EndDateTime':
$sql .= 'E.EndTime';
$sql .= 'E.EndDateTime';
break;
case 'EndDate':
$sql .= 'to_days(E.EndTime)';
$sql .= 'to_days(E.EndDateTime)';
break;
case 'EndTime':
$sql .= 'extract(hour_second FROM E.EndTime)';
$sql .= 'extract(hour_second FROM E.EndDateTime)';
break;
case 'EndWeekday':
$sql .= 'weekday(E.EndTime)';
$sql .= 'weekday(E.EndDateTime)';
break;
case 'Emailed':
case 'Id':