X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fmisc%2Fchange_pkg.cgi;h=c588c9e6c171f9df52dbf365c68ad7ec4a11fd09;hb=88371c24e0b727646f0b01288f01439a06967fe7;hp=03e336cba070460d339b7d34626ddab0c5ebe1a0;hpb=f88dda7fe57054bd030491a5b9363a1aff601bf2;p=freeside.git diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 03e336cba..c588c9e6c 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -1,46 +1,132 @@ -<& /elements/header-popup.html, mt("Change Package") &> +<& /elements/header-popup.html, mt($title) &> - <& /elements/error.html &>
@@ -74,4 +160,30 @@ my $cust_main = $cust_pkg->cust_main my $part_pkg = $cust_pkg->part_pkg; +my $title = "Change Package"; + +my $use_contract_end = $cust_pkg->get('contract_end') ? 1 : 0; + +# if there's already a package change ordered, preload it +if ( $cust_pkg->change_to_pkgnum ) { + my $change_to = FS::cust_pkg->by_key($cust_pkg->change_to_pkgnum); + $cgi->param('delay', 1); + foreach(qw( start_date pkgpart locationnum quantity )) { + $cgi->param($_, $change_to->get($_)); + } + if ($use_contract_end) { + $cgi->param('contract_end', $change_to->get('contract_end')); + } + $title = "Edit Scheduled Package Change"; +} + +# Get current values of discounts for selectboxes +my %discount = (setup => undef, recur => undef); +$discount{$_->setuprecur} = $_->discountnum + for qsearch('cust_pkg_discount', { + pkgnum => $cust_pkg->pkgnum, + disabled => '', + }); +$discount{setup} = '-2' if $cust_pkg->waive_setup; + %init>