summaryrefslogtreecommitdiff
path: root/FS/FS/option_Common.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/option_Common.pm')
-rw-r--r--FS/FS/option_Common.pm29
1 files changed, 11 insertions, 18 deletions
diff --git a/FS/FS/option_Common.pm b/FS/FS/option_Common.pm
index 26bb7ca..a786ae3 100644
--- a/FS/FS/option_Common.pm
+++ b/FS/FS/option_Common.pm
@@ -173,15 +173,10 @@ sub replace {
? shift
: $self->replace_old;
- my $options;
- my $options_supplied = 0;
- if ( ref($_[0]) eq 'HASH' ) {
- $options = shift;
- $options_supplied = 1;
- } else {
- $options = { @_ };
- $options_supplied = scalar(@_) ? 1 : 0;
- }
+ my $options =
+ ( ref($_[0]) eq 'HASH' )
+ ? shift
+ : { @_ };
warn "FS::option_Common::replace called on $self with options ".
join(', ', map "$_ => ". $options->{$_}, keys %$options)
@@ -257,15 +252,13 @@ sub replace {
}
#remove extraneous old options
- if ( $options_supplied ) {
- foreach my $opt (
- grep { !exists $options->{$_->$namecol()} } $old->option_objects
- ) {
- my $error = $opt->delete;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return $error;
- }
+ foreach my $opt (
+ grep { !exists $options->{$_->$namecol()} } $old->option_objects
+ ) {
+ my $error = $opt->delete;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
}
}