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

ivan ivan at pouncequick.420.am
Sat Jan 29 04:34:18 PST 2005


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

Added Files:
	reg_code.cgi 
Log Message:
registration codes

--- NEW FILE: reg_code.cgi ---
<%

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

my $error = '';

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

my @pkgparts = 
  map  { /^pkgpart(.*)$/; $1 }
  grep { $cgi->param($_) }
  grep { /^pkgpart/ }
  $cgi->param;

$error ||= $agent->generate_reg_codes($num, \@pkgparts);

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

<%= header("$num registration codes generated for ". $agent->agent, menubar(
  'View all agents' => popurl(3). 'browse/agent.cgi',
) ) %>

<PRE><FONT SIZE="+1">
<% foreach my $code ( @$error ) { %>
  <%= $code %>
<% } %>

</FONT></PRE>

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




More information about the freeside-commits mailing list