diff options
author | ivan <ivan> | 2007-08-02 23:09:43 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-02 23:09:43 +0000 |
commit | 8e2487662e3555c1efbb7b8ed90e4bda0f8b6cd2 (patch) | |
tree | 1eeadb6ee448f22fd1dddb0d74221d897bde9034 /httemplate/misc/change_pkg.cgi | |
parent | 58cfac8638978d97857ee42883e8f8b56b22451b (diff) |
fix slowness on change package and also make it into a popup
Diffstat (limited to 'httemplate/misc/change_pkg.cgi')
-rwxr-xr-x | httemplate/misc/change_pkg.cgi | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 655799fc1..4bf15a1fa 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -1,55 +1,60 @@ -<% include('/elements/header.html', "Change Package") %> +<% include('/elements/header-popup.html', "Change Package") %> % if ( $cgi->param('error') ) { <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT> <BR><BR> % } -<% small_custview( $cust_main, $conf->config('countrydefault') || '' , '', - "${p}view/cust_main.cgi") -%> - <FORM ACTION="<% $p %>edit/process/cust_pkg.cgi" METHOD=POST> <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <INPUT TYPE="hidden" NAME="remove_pkg" VALUE="<% $pkgnum %>"> -<BR> -Current package: <% $part_pkg->pkg %> - <% $part_pkg->comment %> +<% ntable('#cccccc') %> + + <TR> + <TD>Current package: </TD> + <TD> + <B><% $part_pkg->pkgpart %>: <% $part_pkg->pkg %> - <% $part_pkg->comment %></B> + </TD> + </TR> + + <TR> + <TD>New package: </TD> + <TD><% include('/elements/select-cust-part_pkg.html', + 'cust_main' => $cust_main, + 'element_name' => 'new_pkgpart', + 'extra_sql' => ' AND pkgpart != '. $cust_pkg->pkgpart, + 'curr_value' => ( $cgi->param('error') + ? scalar($cgi->param('new_pkgpart')) + : '' + ), + ) + %> + </TD> + </TR> + +</TABLE> <BR> -New package: <SELECT NAME="new_pkgpart"><OPTION VALUE=0></OPTION> - -%foreach my $part_pkg ( -% grep { ! $_->disabled && $_->pkgpart != $cust_pkg->pkgpart } -% map { $_->part_pkg } $agent->agent_type->type_pkgs -%) { -% my $pkgpart = $part_pkg->pkgpart; - - <OPTION VALUE="<% $pkgpart %>" <% ( $cgi->param('error') && $cgi->param('new_pkgpart') == $pkgpart ) ? ' SELECTED' : '' %>> - <% $pkgpart %>: <% $part_pkg->pkg %> - <% $part_pkg->comment %> - </OPTION> +<INPUT TYPE="submit" VALUE="Change package"> -%} - -</SELECT> -<BR><BR><INPUT TYPE="submit" VALUE="Change package"> - </FORM> - </BODY> +</FORM> +</BODY> </HTML> + <%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Change customer package'); + 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 = (); + $pkgnum = $cgi->param('pkgnum'); } +$pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum"; +$pkgnum = $1; my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ) or die "unknown pkgnum $pkgnum"; @@ -57,8 +62,6 @@ my $custnum = $cust_pkg->custnum; my $conf = new FS::Conf; -my $p1 = popurl(1); - my $cust_main = $cust_pkg->cust_main or die "can't get cust_main record for custnum ". $cust_pkg->custnum. " ( pkgnum ". cust_pkg->pkgnum. ")"; |