X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fpayment_gateway.html;h=157449e89f24f219e26dbdfc177a02f22298c4cc;hp=b16bc3d27e1bdec08f78cb83f9596b7e6ef9049d;hb=HEAD;hpb=c648976f0b7975f2328ebd7ba8c711fad0ca4195 diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html index b16bc3d27..157449e89 100644 --- a/httemplate/edit/process/payment_gateway.html +++ b/httemplate/edit/process/payment_gateway.html @@ -1,35 +1,23 @@ -%if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ) %> -%} else { -<% $cgi->redirect(popurl(3). "browse/payment_gateway.html") %> -%} +<% include( 'elements/process.html', + 'table' => 'payment_gateway', + 'viewall_dir' => 'browse', + 'args_callback' => $args_callback, + ) +%> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $gatewaynum = $cgi->param('gatewaynum'); +my $args_callback = sub { + my ( $cgi, $new ) = @_; -my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; + my @options = split(/\r?\n/, $cgi->param('gateway_options') ); + pop @options + if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; + @options = ( {} ) if !@options; + (@options) +}; -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'); -}