use strict;
use vars qw( @ISA $DEBUG );
+use Scalar::Util qw( blessed );
use FS::Record qw( qsearch qsearchs dbh );
@ISA = qw( FS::Record );
-$DEBUG = 3;
+$DEBUG = 0;
=head1 NAME
sub replace {
my $self = shift;
- my $old = ( ref($_[0]) eq ref($self) )
+ my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') )
? shift
: $self->replace_old;
( ref($_[0]) eq 'HASH' )
? shift
: { @_ };
+
warn "FS::option_Common::replace called on $self with options ".
join(', ', map "$_ => ". $options->{$_}, keys %$options)
if $DEBUG;
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;