From 56ffda0a703b5d42540c56eafb8d226c0ebf18ad Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 14 Jul 2014 07:36:07 -0400 Subject: [PATCH] Bug 12265: [QA Follow-up] - Improve usage of find When finding a row by its primary key, it is not necessary to pass a hashref, only the primary key value itself is required. Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- admin/z3950servers.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl index b4011e6763..edfcf5c441 100755 --- a/admin/z3950servers.pl +++ b/admin/z3950servers.pl @@ -55,29 +55,29 @@ my $schema = Koha::Database->new()->schema(); # First process a confirmed delete, or save a validated record if( $op eq 'delete_confirmed' && $id ) { - my $server=$schema->resultset('Z3950server')->find( { id => $id } ); - if( $server ) { + my $server = $schema->resultset('Z3950server')->find($id); + if ( $server ) { $server->delete; $template->param( msg_deleted => 1, msg_add => $server->name ); } else { $template->param( msg_notfound => 1, msg_add => $id ); } - $id=0; -} elsif( $op eq 'add_validated' ) { + $id = 0; +} elsif ( $op eq 'add_validated' ) { my @fields=qw/host port db userid password rank syntax encoding timeout recordtype checked/; my $formdata = _form_data_hashref( $input, \@fields ); #add name from servername (an input with name="name" gave problems) $formdata->{name} = $input->param('servername'); if( $id ) { - my $server= $schema->resultset('Z3950server')->find( { id => $id } ); - if( $server ) { + my $server = $schema->resultset('Z3950server')->find($id); + if ( $server ) { $server->update( $formdata ); $template->param( msg_updated => 1, msg_add => $formdata->{name} ); } else { $template->param( msg_notfound => 1, msg_add => $id ); } - $id=0; + $id = 0; } else { $schema->resultset('Z3950server')->create( $formdata ); $template->param( msg_added => 1, msg_add => $formdata->{name} ); -- 2.39.5