event may have changed (have endtime set) between load and saving Archived bit. Lock the event which now also reloads it.

This commit is contained in:
Isaac Connor 2021-08-06 19:15:22 -04:00
parent ae1e3d88b2
commit b306f92116
1 changed files with 3 additions and 0 deletions

View File

@ -47,9 +47,12 @@ if ( $action == 'create' ) {
$monitor = new ZM\Monitor($monitor_id); $monitor = new ZM\Monitor($monitor_id);
$monitor->TriggerOff(); $monitor->TriggerOff();
} }
$dbConn->beginTransaction();
foreach ( $snapshot->Events() as $event ) { foreach ( $snapshot->Events() as $event ) {
$event->lock();
$event->save(array('Archived'=>1)); $event->save(array('Archived'=>1));
} }
$dbConn->commit();
$redirect = '?view=snapshot&id='.$snapshot->Id(); $redirect = '?view=snapshot&id='.$snapshot->Id();
return; return;
} }