diff options
author | ivan <ivan> | 2007-01-31 02:08:40 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-01-31 02:08:40 +0000 |
commit | 966e32b588916cb7f6208e075efcded5ff3620b0 (patch) | |
tree | f0670a6c6e2970dedd0bb8a76ed24e7ea6238be6 /httemplate | |
parent | 811f2540b22045c137b4b8f2b5ff17bf6cbe957c (diff) |
this should be a popup too, but, until then, it shouldn't be missing the standard header
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/misc/change_pkg.cgi | 120 |
1 files changed, 62 insertions, 58 deletions
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 7276f3256..cfa460964 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -1,65 +1,69 @@ -<!-- mason kludge --> -% -% -%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; -% -%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. ")"; -%my $agent = $cust_main->agent; -% -%print header("Change Package"); -% -%print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), -% "</FONT><BR><BR>" -% if $cgi->param('error'); -% -%my $part_pkg = $cust_pkg->part_pkg; -% -%print small_custview( $cust_main, $conf->config('countrydefault') || '' , '', -% "${p}view/cust_main.cgi"). -% qq!<FORM ACTION="${p}edit/process/cust_pkg.cgi" METHOD=POST>!. -% qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!. -% qq!<INPUT TYPE="hidden" NAME="remove_pkg" VALUE="$pkgnum">!. -% '<BR>Current package: '. $part_pkg->pkg. ' - '. $part_pkg->comment. -% qq!<BR>New package: <SELECT NAME="new_pkgpart"><OPTION VALUE=0></OPTION>!; -% +<% include('/elements/header.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 %> + +<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; -% print qq!<OPTION VALUE="$pkgpart"!; -% print ' SELECTED' if $cgi->param('error') -% && $cgi->param('new_pkgpart') == $pkgpart; -% print qq!>$pkgpart: !. $part_pkg->pkg. ' - '. $part_pkg->comment. '</OPTION>'; + + <OPTION VALUE="$pkgpart" <% ( $cgi->param('error') && $cgi->param('new_pkgpart') == $pkgpart ) ? ' SELECTED' : '' %>> + <% $pkgpart %>: <% $part_pkg->pkg %> - <% $part_pkg->comment %> + </OPTION> + %} -% -%print <<END; -%</SELECT> -%<BR><BR><INPUT TYPE="submit" VALUE="Change package"> -% </FORM> -% </BODY> -%</HTML> -%END -% +</SELECT> +<BR><BR><INPUT TYPE="submit" VALUE="Change package"> + </FORM> + </BODY> +</HTML> +<%init> + +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; + +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. ")"; +my $agent = $cust_main->agent; + +my $part_pkg = $cust_pkg->part_pkg; + +</%init> |