From: ivan Date: Tue, 13 May 2008 21:20:08 +0000 (+0000) Subject: eliminate warnings on upgrade: "(Odd number of elements in anonymous hash | Use of... X-Git-Tag: root_of_webpay_support~656 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=fa234efef75db594f78e8c4a093e2c2d863dfdde eliminate warnings on upgrade: "(Odd number of elements in anonymous hash | Use of unintialized value in anonymous hash ) at /usr/local/share/perl/5.8.8/FS/option_Common.pm line 176. --- diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index fd43e61c6..c3e76d5bd 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -254,14 +254,17 @@ sub delete { Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. -Currently available options are: I and I +Currently available options are: I, I and I If I is set to a hashref with svcparts as keys and quantities as -values, the appropriate FS::pkg_svc records will be replace. +values, the appropriate FS::pkg_svc records will be replaced. If I is set to the svcpart of the primary service, the appropriate FS::pkg_svc record will be updated. +If I is set to a hashref, the appropriate FS::part_pkg_option records +will be replaced. + =cut sub replace { @@ -276,6 +279,8 @@ sub replace { ? shift : { @_ }; + $options->{options} = {} unless defined($options->{options}); + warn "FS::part_pkg::replace called on $new to replace $old with options". join(', ', map "$_ => ". $options->{$_}, keys %$options) if $DEBUG;