From: Ivan Kohler Date: Mon, 30 Mar 2015 01:18:37 +0000 (-0700) Subject: add quantity to self-service change_pkg, RT#34068 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=c43c1cf3cdd5c568cbeda69017b739053fe15874 add quantity to self-service change_pkg, RT#34068 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 8c6a5b8f7..278190526 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -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 }; diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index cbe3411c9..7f9c96013 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -108,6 +108,8 @@ FS::cust_pkg - Object methods for cust_pkg objects $seconds = $record->seconds_since($timestamp); + #bulk cancel+order... perhaps slightly deprecated, only used by the bulk + # cancel+order in the web UI and nowhere else (edit/process/cust_pkg.cgi) $error = FS::cust_pkg::order( $custnum, \@pkgparts ); $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] ); @@ -5362,6 +5364,9 @@ sub _X_show_zero { =item order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF [ REFNUM ] ] ] +Bulk cancel + order subroutine. Perhaps slightly deprecated, only used by the +bulk cancel+order in the web UI and nowhere else (edit/process/cust_pkg.cgi) + CUSTNUM is a customer (see L) PKGPARTS is a list of pkgparts specifying the the billing item definitions (see diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index 1e30dcd9d..039de6dbb 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -1026,6 +1026,10 @@ Existing customer package. New package to order (see L). +=item quantity + +Quantity for this package order (default 1). + =back Returns a hash reference with the following keys: