X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fchange_pkg.cgi;h=ec10b85cfe247974dd5f2165ac4ebbcf1a0eb728;hb=0f7643c1af2d909e0c3172e5bec0c01855fca1b9;hp=aef3746eac50eea06902d0f402732b52c4926e2e;hpb=a099ad369951bea5e77d359cfbfe8dee4ae2d80e;p=freeside.git diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index aef3746ea..ec10b85cf 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -1,68 +1,75 @@ -<% include('/elements/header.html', "Change Package") %> - -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } - -<% small_custview( $cust_main, $conf->config('countrydefault') || '' , '', - "${p}view/cust_main.cgi") +<% include('/elements/header-popup.html', "Change Package") %> + +<% include('/elements/error.html') %> + +
+ + +<% ntable('#cccccc') %> + + + Current package + + <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg |h %> - <% $part_pkg->comment |h %> + + + + <% include('/elements/tr-select-cust-part_pkg.html', + 'pre_label' => 'New', + 'curr_value' => scalar($cgi->param('pkgpart')), + 'classnum' => $part_pkg->classnum, + 'cust_main' => $cust_main, + #'extra_sql' => ' AND pkgpart != '. $cust_pkg->pkgpart, + ) + %> + + <% include('/elements/tr-select-cust_location.html', + 'cgi' => $cgi, + 'cust_main' => $cust_main, + ) + %> + + + +<% include( '/elements/standardize_locations.html', + 'form' => "OrderPkgForm", + 'onlyship' => 1, + 'no_company' => 1, + 'callback' => 'document.OrderPkgForm.submit();', + ) %> - - - -
-Current package: <% $part_pkg->pkg %> - <% $part_pkg->comment %> + -
-New package: -

-
- - -<%init> +my $curuser = $FS::CurrentUser::CurrentUser; -my $pkgnum; -if ( $cgi->param('error') ) { - #$custnum = $cgi->param('custnum'); - #%remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); - $pkgnum = ($cgi->param('remove_pkg'))[0]; -} else { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - #$custnum = $1; - $pkgnum = $1; - #%remove_pkg = (); -} - -my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ) - or die "unknown pkgnum $pkgnum"; -my $custnum = $cust_pkg->custnum; +die "access denied" + unless $curuser->access_right('Change customer package'); -my $conf = new FS::Conf; +my $pkgnum = scalar($cgi->param('pkgnum')); +$pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum"; +$pkgnum = $1; -my $p1 = popurl(1); +my $cust_pkg = + qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'pkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, + }) or die "unknown pkgnum $pkgnum"; my $cust_main = $cust_pkg->cust_main or die "can't get cust_main record for custnum ". $cust_pkg->custnum. " ( pkgnum ". cust_pkg->pkgnum. ")"; -my $agent = $cust_main->agent; my $part_pkg = $cust_pkg->part_pkg;