freeside/httemplate/edit/process prepay_credit.cgi,NONE,1.1 reg_code.cgi,1.1,1.2

ivan ivan at pouncequick.420.am
Sat Mar 12 06:32:27 PST 2005


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory pouncequick:/tmp/cvs-serv9831/httemplate/edit/process

Modified Files:
	reg_code.cgi 
Added Files:
	prepay_credit.cgi 
Log Message:
- bring prepaid support into this century (close: Bug#1124)
- finally get rid of fs_signup (everything is in fs_selfservice now) (Bug#413)
- organize main menu sysadmin section so it is slightly less confusing

Index: reg_code.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/reg_code.cgi,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- reg_code.cgi	29 Jan 2005 12:34:12 -0000	1.1
+++ reg_code.cgi	12 Mar 2005 14:31:49 -0000	1.2
@@ -22,11 +22,14 @@
 
 $error ||= $agent->generate_reg_codes($num, \@pkgparts);
 
-unless ( ref($error) ) { %><%=
+unless ( ref($error) ) {
+  $cgi->param('error'. $error );
+%><%=
   $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string )
 %><% } else { %>
 
 <%= header("$num registration codes generated for ". $agent->agent, menubar(
+  'Main menu'       => popurl(3),
   'View all agents' => popurl(3). 'browse/agent.cgi',
 ) ) %>
 

--- NEW FILE: prepay_credit.cgi ---
<%
my $hashref = {};

my $agent = '';
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
  $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } );
}

my $error = '';

my $num = 0;
if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
  $num = $1;
} else {
  $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
}

$hashref->{amount} = $cgi->param('amount');
$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');

$error ||= FS::prepay_credit::generate( $num,
                                        scalar($cgi->param('type')), 
                                        $hashref
                                      );

unless ( ref($error) ) {
  $cgi->param('error', $error );
%><%=
  $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
%><% } else { %>

<%= header( "$num prepaid cards generated".
              ( $agent ? ' for '.$agent->agent : '' ),
            menubar( 'Main menu' => popurl(3) )
          )
%>

<FONT SIZE="+1">
<% foreach my $card ( @$error ) { %>
  <code><%= $card %></code>
  -
  <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
  <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
  <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
  <br>
<% } %>

</FONT>

</BODY></HTML>
<% } %>




More information about the freeside-commits mailing list