Merge branch 'newpointone' of isaac.internal.point-one.com:ZoneMinder.p1 into newpointone

This commit is contained in:
Isaac Connor 2015-12-23 14:18:36 -05:00
commit 9b6157a685
2 changed files with 9 additions and 3 deletions

View File

@ -31,7 +31,7 @@ use warnings;
require ZoneMinder::Base; require ZoneMinder::Base;
require Date::Manip; require Date::Manip;
use parent qw(ZoneMinder::Object);; use parent qw(ZoneMinder::Object);
#our @ISA = qw(ZoneMinder::Object); #our @ISA = qw(ZoneMinder::Object);
use vars qw/ $table $primary_key /; use vars qw/ $table $primary_key /;
@ -114,8 +114,8 @@ sub Execute {
$sql =~ s/zmSystemLoad/$load/g; $sql =~ s/zmSystemLoad/$load/g;
} }
my $sth = $$self{dbh}->prepare_cached( $sql ) my $sth = $ZoneMinder::Database::dbh->prepare_cached( $sql )
or Fatal( "Can't prepare '$sql': ".$$self{dbh}->errstr() ); or Fatal( "Can't prepare '$sql': ".$ZoneMinder::Database::dbh->errstr() );
my $res = $sth->execute(); my $res = $sth->execute();
if ( !$res ) if ( !$res )
{ {

View File

@ -49,6 +49,12 @@ sub new {
my $self = {}; my $self = {};
bless $self, $parent; 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 ) { if ( ( $$self{$primary_key} = $id ) or $data ) {
#$log->debug("loading $parent $id") if $debug or DEBUG_ALL; #$log->debug("loading $parent $id") if $debug or DEBUG_ALL;
$self->load( $data ); $self->load( $data );