use unique tokens to prevent double-submission of payments in the web UI
[freeside.git] / httemplate / edit / process / svc_acct_sm.cgi
1 <%
2
3 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
4 my $svcnum =$1;
5
6 my $old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum;
7
8 #unmunge domsvc and domuid
9 #$cgi->param('domsvc',(split(/:/, $cgi->param('domsvc') ))[0] );
10 #$cgi->param('domuid',(split(/:/, $cgi->param('domuid') ))[0] );
11
12 my $new = new FS::svc_acct_sm ( {
13   map {
14     ($_, scalar($cgi->param($_)));
15   #} qw(svcnum pkgnum svcpart domuser domuid domsvc)
16   } ( fields('svc_acct_sm'), qw( pkgnum svcpart ) )
17 } );
18
19 my $error = '';
20 if ( $svcnum ) {
21   $error = $new->replace($old);
22 } else {
23   $error = $new->insert;
24   $svcnum = $new->getfield('svcnum');
25
26
27 if ($error) {
28   $cgi->param('error', $error);
29   print $cgi->redirect(popurl(2). "svc_acct_sm.cgi?". $cgi->query_string );
30 } else {
31   print $cgi->redirect(popurl(3). "view/svc_acct_sm.cgi?$svcnum");
32 }
33
34 %>