X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fpayment_gateway.html;fp=httemplate%2Fedit%2Fprocess%2Fpayment_gateway.html;h=b16bc3d27e1bdec08f78cb83f9596b7e6ef9049d;hb=0930d22ffc440f80c1b222b2e750cadbabd9e8f6;hp=0b7e313956ab69739ff3e0eabcc2de009ae3af7f;hpb=f49f11d4c3c4ba9480cc5c9acfaa606a5ba73ad1;p=freeside.git diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html index 0b7e31395..b16bc3d27 100644 --- a/httemplate/edit/process/payment_gateway.html +++ b/httemplate/edit/process/payment_gateway.html @@ -1,34 +1,35 @@ -% -% -%my $gatewaynum = $cgi->param('gatewaynum'); -% -%my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; -% -%my $new = new FS::payment_gateway ( { -% map { -% $_, scalar($cgi->param($_)); -% } fields('payment_gateway') -%} ); -% -%my @options = split(/\r?\n/, $cgi->param('gateway_options') ); -%pop @options -% if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; -%my %options = @options; -% -%my $error; -%if ( $gatewaynum ) { -% $error=$new->replace($old, \%options); -%} else { -% $error=$new->insert(\%options); -% $gatewaynum=$new->getfield('gatewaynum'); -%} -% %if ( $error ) { % $cgi->param('error', $error); -% print $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ); +<% $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ) %> %} else { -% print $cgi->redirect(popurl(3). "browse/payment_gateway.html"); +<% $cgi->redirect(popurl(3). "browse/payment_gateway.html") %> %} -% -% +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $gatewaynum = $cgi->param('gatewaynum'); + +my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; + +my $new = new FS::payment_gateway ( { + map { + $_, scalar($cgi->param($_)); + } fields('payment_gateway') +} ); + +my @options = split(/\r?\n/, $cgi->param('gateway_options') ); +pop @options + if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; +my %options = @options; + +my $error; +if ( $gatewaynum ) { + $error=$new->replace($old, \%options); +} else { + $error=$new->insert(\%options); + $gatewaynum=$new->getfield('gatewaynum'); +} +