Bugzilla – Attachment 92256 Details for
Bug 23242
Error when adding new Z39.50/SRU server in DB strict mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23242: Fix insert of Z3950 servers with strict SQL modes
Bug-23242-Fix-insert-of-Z3950-servers-with-strict-.patch (text/plain), 3.29 KB, created by
Marcel de Rooy
on 2019-08-16 06:20:01 UTC
(
hide
)
Description:
Bug 23242: Fix insert of Z3950 servers with strict SQL modes
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-08-16 06:20:01 UTC
Size:
3.29 KB
patch
obsolete
>From 461c114336acaae6e3750ce85006503c0769ffd4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 4 Aug 2019 12:48:07 -0500 >Subject: [PATCH] Bug 23242: Fix insert of Z3950 servers with strict SQL modes >Content-Type: text/plain; charset=utf-8 > >If strict SQL modes are set, the insertion of a new Z3950 server can >fail. > >DBIx::Class::Storage::DBI::_dbh_execute(): Incorrect integer value: '' >for column 'checked' at row 1 at >/home/vagrant/kohaclone/admin/z3950servers.pl line 82 > >Using Koha::Z3950Servers fixes the issue (handled from >Koha::Object->store) > >Test plan: >- Turn the strict SQL modes on (config strict_sql_modes) >- Create a new Z3950 server filling only the mandatory fields. >=> Without this patch you will get the failure, with this patch applied >the server will be inserted sucessfully >- Delete it >=> No regression should be found >- Search for servers >=> No regression should be found (the search is a start-with, LIKE "$pattern%") > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > admin/z3950servers.pl | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > >diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl >index bb15e39121..cb226663d8 100755 >--- a/admin/z3950servers.pl >+++ b/admin/z3950servers.pl >@@ -30,6 +30,7 @@ use C4::Context; > use C4::Auth; > use C4::Output; > use Koha::Database; >+use Koha::Z3950Servers; > > # Initialize CGI, template, database > >@@ -56,7 +57,7 @@ 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); >+ my $server = Koha::Z3950Servers->find($id); > if ( $server ) { > $server->delete; > $template->param( msg_deleted => 1, msg_add => $server->servername ); >@@ -70,16 +71,16 @@ if( $op eq 'delete_confirmed' && $id ) { > add_xslt/; > my $formdata = _form_data_hashref( $input, \@fields ); > if( $id ) { >- my $server = $schema->resultset('Z3950server')->find($id); >+ my $server = Koha::Z3950Servers->find($id); > if ( $server ) { >- $server->update( $formdata ); >+ $server->set( $formdata )->store; > $template->param( msg_updated => 1, msg_add => $formdata->{servername} ); > } else { > $template->param( msg_notfound => 1, msg_add => $id ); > } > $id = 0; > } else { >- $schema->resultset('Z3950server')->create( $formdata ); >+ Koha::Z3950Server->new( $formdata )->store; > $template->param( msg_added => 1, msg_add => $formdata->{servername} ); > } > } else { >@@ -106,11 +107,10 @@ output_html_with_http_headers $input, $cookie, $template->output; > > sub ServerSearch { #find server(s) by id or name > my ( $schema, $id, $searchstring )= @_; >- my $rs = $schema->resultset('Z3950server')->search( >- $id ? { id => $id }: { servername => { like => $searchstring.'%' } }, >- { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } >- ); >- return [ $rs->all ]; >+ >+ return Koha::Z3950Servers->search( >+ $id ? { id => $id } : { servername => { like => $searchstring . '%' } }, >+ )->unblessed; > } > > sub _form_data_hashref { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23242
:
91952
|
92170
| 92256