X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=27819052601fe5e947808571f8c58e87bdac2989;hb=c43c1cf3cdd5c568cbeda69017b739053fe15874;hp=ca5c82ea8fc502f566d1b07a3d12b5e1ee4cc662;hpb=9049947bceb63fd795aab13ee5a17b17f180a4aa;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index ca5c82ea8..278190526 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -48,7 +48,7 @@ use FS::msg_template; use FS::contact; use FS::cust_location; -$DEBUG = 1; +$DEBUG = 0; $me = '[FS::ClientAPI::MyAccount]'; use vars qw( @cust_main_editable_fields @location_editable_fields ); @@ -2270,7 +2270,7 @@ sub order_pkg { my $status = $cust_main->status; - my %order_pkg_options = ()); + my %order_pkg_options = (); if ( $p->{locationnum} > 0 ) { $order_pkg_options{locationnum} = delete($p->{locationnum}); } elsif ( $p->{address1} ) { @@ -2398,26 +2398,26 @@ sub change_pkg { return { error=>"Can't change a suspended package", pkgnum=>$cust_pkg->pkgnum} if $cust_pkg->status eq 'suspended'; - my @newpkg; - my $error = FS::cust_pkg::order( $custnum, - [$p->{pkgpart}], - [$p->{pkgnum}], - \@newpkg, - ); + my $err_or_cust_pkg = $cust_pkg->change( 'pkgpart' => $p->{'pkgpart'}, + 'quantity' => $p->{'quantity'} || 1, + ); + + return { error=>$err_or_cust_pkg, pkgnum=>$cust_pkg->pkgnum } + unless ref($err_or_cust_pkg); if ( $conf->exists('signup_server-realtime') ) { my $bill_error = _do_bop_realtime( $cust_main, $status, 'no_credit'=>1 ); if ($bill_error) { - $newpkg[0]->suspend; + $err_or_cust_pkg->suspend; return $bill_error; } else { - $newpkg[0]->reexport; + $err_or_cust_pkg->reexport; } } else { - $newpkg[0]->reexport; + $err_or_cust_pkg->reexport; } return { error => '', pkgnum => $cust_pkg->pkgnum };