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, 'StorageId' => null,
'SecondaryStorageId' => null, 'SecondaryStorageId' => null,
'Cause' => '', 'Cause' => '',
'StartTime' => null, 'StartDateTime' => null,
'EndTime' => null, 'EndDateTime' => null,
'Width' => null, 'Width' => null,
'Height' => null, 'Height' => null,
'Length' => null, 'Length' => null,
@ -93,7 +93,7 @@ class Event extends ZM_Object {
public function Time() { public function Time() {
if ( ! isset($this->{'Time'}) ) { if ( ! isset($this->{'Time'}) ) {
$this->{'Time'} = strtotime($this->{'StartTime'}); $this->{'Time'} = strtotime($this->{'StartDateTime'});
} }
return $this->{'Time'}; return $this->{'Time'};
} }
@ -153,9 +153,9 @@ class Event extends ZM_Object {
if ( $this->{'Scheme'} == 'Deep' ) { if ( $this->{'Scheme'} == 'Deep' ) {
# Assumption: All events have a start time # Assumption: All events have a start time
$start_date = date_parse($this->{'StartTime'}); $start_date = date_parse($this->{'StartDateTime'});
if ( ! $start_date ) { 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; $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'}) ) { if ( (!property_exists($this, 'DiskSpace')) or (null === $this->{'DiskSpace'}) ) {
$this->{'DiskSpace'} = folder_size($this->Path()); $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. # 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'})); dbQuery('UPDATE Events SET DiskSpace=? WHERE Id=?', array($this->{'DiskSpace'}, $this->{'Id'}));
} }
@ -606,7 +606,7 @@ class Event extends ZM_Object {
if ( $this->Archived() ) { if ( $this->Archived() ) {
return false; return false;
} }
if ( !$this->EndTime() ) { if ( !$this->EndDateTime() ) {
return false; return false;
} }
if ( !canEdit('Events') ) { if ( !canEdit('Events') ) {
@ -619,7 +619,7 @@ class Event extends ZM_Object {
public function cant_delete_reason() { public function cant_delete_reason() {
if ( $this->Archived() ) { if ( $this->Archived() ) {
return 'You cannot delete an archived event. Unarchive it first.'; 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.'; return 'You cannot delete an event while it is being recorded. Wait for it to finish.';
} else if ( ! canEdit('Events') ) { } else if ( ! canEdit('Events') ) {
return 'You do not have rights to edit Events.'; return 'You do not have rights to edit Events.';

View File

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

View File

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