diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm b/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm index c72f2ad80..de29b8dd0 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm @@ -35,6 +35,7 @@ require ZoneMinder::Storage; require ZoneMinder::Server; require ZoneMinder::Memory; require ZoneMinder::Monitor_Status; +require ZoneMinder::Zone; #our @ISA = qw(Exporter ZoneMinder::Base); use parent qw(ZoneMinder::Object); @@ -226,6 +227,13 @@ sub Storage { return new ZoneMinder::Storage( $_[0]{StorageId} ); } # end sub Storage +sub Zones { + if (! exists $_[0]{Zones}) { + $_[0]{Zones} = [ $_[0]{Id} ? ZoneMinder::Zone->find(MonitorId=>$_[0]{Id}) : () ]; + } + return wantarray ? @{$_[0]{Zones}} : $_[0]{Zones}; +} + sub control { my $monitor = shift; my $command = shift;