X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fquick-cust_pkg.cgi;h=a6449b8802cd2b39eeeff157e7c6ddd016a56bf9;hb=e0a26680d75fc2000bde195eba7946805a3aaa28;hp=9c24743307c3c969cf735ced62e9b2ac3eb1361c;hpb=a661ced3f9f678a645780eaa0b183d2de5f100fa;p=freeside.git diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 9c2474330..a6449b880 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -3,12 +3,24 @@ <% $cgi->redirect(popurl(3). 'misc/order_pkg.html?'. $cgi->query_string ) %> %} else { % my $frag = "cust_pkg". $cust_pkg->pkgnum; +% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% ? '' +% : ';show=packages'; +% my $redir_url = popurl(3) +% ."view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag"; +% +% # for going right to a provision service after ordering a package +% if ( $svcpart ) { +% $redir_url = popurl(3)."edit/".$part_svc->svcdb.".cgi?". +% "pkgnum=".$cust_pkg->pkgnum. ";svcpart=$svcpart"; +% $redir_url .= ";qualnum=$qualnum" if $qualnum; +% } <% header('Package ordered') %> @@ -16,8 +28,10 @@ %} <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Order customer package'); + unless $curuser->access_right('Order customer package'); #untaint custnum (probably not necessary, searching for it is escape enough) $cgi->param('custnum') =~ /^(\d+)$/ @@ -40,12 +54,48 @@ my $refnum = $1; $cgi->param('locationnum') =~ /^(\-?\d*)$/ or die 'illegal locationnum '. $cgi->param('locationnum'); my $locationnum = $1; +$cgi->param('discountnum') =~ /^(\-?\d*)$/ + or die 'illegal discountnum '. $cgi->param('discountnum'); +my $discountnum = $1; + +# for going right to a provision service after ordering a package +my( $svcpart, $part_svc ) = ( '', '' ); +if ( $cgi->param('svcpart') ) { + $cgi->param('svcpart') =~ /^(\-?\d*)$/ + or die 'illegal svcpart '. $cgi->param('svcpart'); + $svcpart = $1; + $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ) + or die "unknown svcpart $svcpart"; +} + +my $qualnum = ''; +if ( $cgi->param('qualnum') ) { + $cgi->param('qualnum') =~ /^(\d+)$/ or die 'illegal qualnum'; + $qualnum = $1; +} + my $cust_pkg = new FS::cust_pkg { - 'custnum' => $custnum, - 'pkgpart' => $pkgpart, - 'refnum' => $refnum, - 'locationnum' => $locationnum, + 'custnum' => $custnum, + 'pkgpart' => $pkgpart, + 'start_date' => ( scalar($cgi->param('start_date')) + ? parse_datetime($cgi->param('start_date')) + : '' + ), + 'no_auto' => scalar($cgi->param('no_auto')), + 'refnum' => $refnum, + 'locationnum' => $locationnum, + 'discountnum' => $discountnum, + #for the create a new discount case + 'discountnum__type' => scalar($cgi->param('discountnum__type')), + 'discountnum_amount' => scalar($cgi->param('discountnum_amount')), + 'discountnum_percent' => scalar($cgi->param('discountnum_percent')), + 'discountnum_months' => scalar($cgi->param('discountnum_months')), + 'contract_end' => ( scalar($cgi->param('contract_end')) + ? parse_datetime($cgi->param('contract_end')) + : '' + ), + #'discountnum_disabled' => scalar($cgi->param('discountnum_disabled')), }; my %opt = ( 'cust_pkg' => $cust_pkg ); @@ -53,11 +103,11 @@ my %opt = ( 'cust_pkg' => $cust_pkg ); if ( $locationnum == -1 ) { my $cust_location = new FS::cust_location { map { $_ => scalar($cgi->param($_)) } - qw( custnum address1 address2 city county state zip country ) + qw( custnum address1 address2 city county state zip country geocode ) }; $opt{'cust_location'} = $cust_location; } -my $error = $cust_main->order_pkg( %opt ); +my $error = $cust_main->order_pkg( \%opt );