[freeside-commits] freeside/httemplate/misc change_pkg.cgi, 1.6, 1.6.2.1
Ivan,,,
ivan at wavetail.420.am
Thu Aug 2 16:09:48 PDT 2007
Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail:/tmp/cvs-serv27342/httemplate/misc
Modified Files:
Tag: FREESIDE_1_7_BRANCH
change_pkg.cgi
Log Message:
fix slowness on change package and also make it into a popup
Index: change_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/change_pkg.cgi,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- change_pkg.cgi 10 Feb 2007 00:42:44 -0000 1.6
+++ change_pkg.cgi 2 Aug 2007 23:09:46 -0000 1.6.2.1
@@ -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 %>
-
-<BR>
-New package: <SELECT NAME="new_pkgpart"><OPTION VALUE=0></OPTION>
+<% ntable('#cccccc') %>
-%foreach my $part_pkg (
-% grep { ! $_->disabled && $_->pkgpart != $cust_pkg->pkgpart }
-% map { $_->part_pkg } $agent->agent_type->type_pkgs
-%) {
-% my $pkgpart = $part_pkg->pkgpart;
+ <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>
- <OPTION VALUE="<% $pkgpart %>" <% ( $cgi->param('error') && $cgi->param('new_pkgpart') == $pkgpart ) ? ' SELECTED' : '' %>>
- <% $pkgpart %>: <% $part_pkg->pkg %> - <% $part_pkg->comment %>
- </OPTION>
+</TABLE>
-%}
+<BR>
+<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 $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. ")";
More information about the freeside-commits
mailing list