Bugzilla – Attachment 113592 Details for
Bug 27012
Merging records with holds causes SQL error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27012: Fix incorrect SQL syntax in hold merging
Bug-27012-Fix-incorrect-SQL-syntax-in-hold-merging.patch (text/plain), 2.00 KB, created by
Joonas Kylmälä
on 2020-11-13 10:36:13 UTC
(
hide
)
Description:
Bug 27012: Fix incorrect SQL syntax in hold merging
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2020-11-13 10:36:13 UTC
Size:
2.00 KB
patch
obsolete
>From 4eade4935cc2152b06f1d678eb3f3c15bbbc1bad Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi> >Date: Fri, 13 Nov 2020 12:07:22 +0200 >Subject: [PATCH] Bug 27012: Fix incorrect SQL syntax in hold merging > >If you merge two records with holds in them following error happens >without this patch: > >[WARN] DBD::mysql::st execute failed: called with 4 bind variables when 3 are needed [for Statement "SELECT * FROM reserves WHERE biblionumber = ? AND (found <> ? AND found <> ? OR found is NULL) ORDER BY reservedate ASC" with ParamValues: 0=Null!, 1=Null!, 2=Null!] at /kohadevbox/koha/C4/Reserves.pm line 2002. > >To test: > 1) Create a hold in record A > 2) Use cataloging search to search for something that brings up > record A and another record B. > 3) Select A and B records in the search results and click Edit -> > Merge records > 4) Merge the records and notice that the above error is printed to > plack-intranet-error.log > 5) Apply patch and repeat steps 1-4 but notice the error is gone >--- > C4/Reserves.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index fbd42f0be4..c5a8d4ab53 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1993,13 +1993,13 @@ sub MergeHolds { > # don't reorder those already waiting > > $sth = $dbh->prepare( >-"SELECT * FROM reserves WHERE biblionumber = ? AND (found <> ? AND found <> ? OR found is NULL) ORDER BY reservedate ASC" >+"SELECT * FROM reserves WHERE biblionumber = ? AND (found NOT IN ('W', 'T', 'P') OR found is NULL) ORDER BY reservedate ASC" > ); > my $upd_sth = $dbh->prepare( > "UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ? > AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) " > ); >- $sth->execute( $to_biblio, 'W', 'T', 'P' ); >+ $sth->execute( $to_biblio ); > my $priority = 1; > while ( my $reserve = $sth->fetchrow_hashref() ) { > $upd_sth->execute( >-- >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 27012
:
113592
|
113593
|
113594
|
113632
|
113633
|
113651
|
113652