X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Foption_Common.pm;h=2950b28d495761bd094a64d0ac14d1ca9253260f;hb=16a91fd700e3c3e5ec051d2c3692275f9389aab4;hp=5ef6d0f4cc49b0c76f258c21737d5dc333d24442;hpb=f913a319ef96ca1d39aaa11df3e31a573131f071;p=freeside.git diff --git a/FS/FS/option_Common.pm b/FS/FS/option_Common.pm index 5ef6d0f4c..2950b28d4 100644 --- a/FS/FS/option_Common.pm +++ b/FS/FS/option_Common.pm @@ -2,6 +2,7 @@ package FS::option_Common; use strict; use vars qw( @ISA $DEBUG ); +use Scalar::Util qw( blessed ); use FS::Record qw( qsearch qsearchs dbh ); @ISA = qw( FS::Record ); @@ -161,7 +162,7 @@ created or modified (see L). sub replace { my $self = shift; - my $old = ( ref($_[0]) eq ref($self) ) + my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') ) ? shift : $self->replace_old; @@ -169,6 +170,7 @@ sub replace { ( ref($_[0]) eq 'HASH' ) ? shift : { @_ }; + warn "FS::option_Common::replace called on $self with options ". join(', ', map "$_ => ". $options->{$_}, keys %$options) if $DEBUG; @@ -222,12 +224,10 @@ sub replace { my $opt_pkey = $newopt->primary_key; $newopt->$opt_pkey($oldopt->$opt_pkey) if $oldopt; - warn $oldopt; warn "FS::option_Common::replace: ". ( $oldopt ? "$newopt -> replace($oldopt)" : "$newopt -> insert" ) if $DEBUG > 2; my $error = $oldopt ? $newopt->replace($oldopt) : $newopt->insert; - warn $error; if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error;