From 1328492c641ef7bf8761e5a9fa6d2164ed1a6f37 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 23 Dec 2015 14:16:09 -0500 Subject: [PATCH] fixes --- scripts/ZoneMinder/lib/ZoneMinder/Filter.pm | 6 +++--- scripts/ZoneMinder/lib/ZoneMinder/Object.pm | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm index 8b983bfc9..8fd494b96 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm @@ -31,7 +31,7 @@ use warnings; require ZoneMinder::Base; require Date::Manip; -use parent qw(ZoneMinder::Object);; +use parent qw(ZoneMinder::Object); #our @ISA = qw(ZoneMinder::Object); use vars qw/ $table $primary_key /; @@ -114,8 +114,8 @@ sub Execute { $sql =~ s/zmSystemLoad/$load/g; } - my $sth = $$self{dbh}->prepare_cached( $sql ) - or Fatal( "Can't prepare '$sql': ".$$self{dbh}->errstr() ); + my $sth = $ZoneMinder::Database::dbh->prepare_cached( $sql ) + or Fatal( "Can't prepare '$sql': ".$ZoneMinder::Database::dbh->errstr() ); my $res = $sth->execute(); if ( !$res ) { diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm index 147d5928c..379aab045 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Object.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Object.pm @@ -49,6 +49,12 @@ sub new { my $self = {}; bless $self, $parent; + no strict 'refs'; + my $primary_key = ${$parent.'::primary_key'}; + if ( ! $primary_key ) { + Error( 'NO primary_key for type ' . $parent ); + return; + } # end if if ( ( $$self{$primary_key} = $id ) or $data ) { #$log->debug("loading $parent $id") if $debug or DEBUG_ALL; $self->load( $data );