Bugzilla – Attachment 64490 Details for
Bug 18651
Move of checkouts is still not correctly handled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18651: [QA Follow-up] Fix the MAX(issue_id) calculation
Bug-18651-QA-Follow-up-Fix-the-MAXissueid-calculat.patch (text/plain), 1.57 KB, created by
Devinim
on 2017-06-21 14:42:43 UTC
(
hide
)
Description:
Bug 18651: [QA Follow-up] Fix the MAX(issue_id) calculation
Filename:
MIME Type:
Creator:
Devinim
Created:
2017-06-21 14:42:43 UTC
Size:
1.57 KB
patch
obsolete
>From ee7969d3461e6ce08b4fbfd982c90f263f19f693 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 20 Jun 2017 15:03:35 +0200 >Subject: [PATCH] Bug 18651: [QA Follow-up] Fix the MAX(issue_id) calculation > >Found this by inserting the same issue_id in old_issues before checkin: >The call to ->search( )->get_column is in scalar context and will >return the number of results, i.e. always 1. >If you have an issue_id 2 in old_issues, it will crash: > DBIx::Class::Storage::DBI::_dbh_execute(): Duplicate entry '2' for key 'PRIMARY' > >The fix is fairly simple: Put get_column in list context and pick the first >array entry. >NOTE: Using DBIx's get_column()->max here might look simpler here. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Circulation.pm | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 07f1887..e25167d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2186,10 +2186,11 @@ sub MarkIssueReturned { > my $old_checkout_data = $issue->unblessed; > > if ( Koha::Old::Checkouts->find( $issue_id ) ) { >- my $new_issue_id = Koha::Old::Checkouts->search( >+ my $new_issue_id = ( Koha::Old::Checkouts->search( > {}, > { columns => [ { max_issue_id => { max => 'issue_id' } } ] } >- )->get_column('max_issue_id') + 1; >+ )->get_column('max_issue_id') )[0]; >+ $new_issue_id++; > $issue_id = $new_issue_id; > } > $old_checkout_data->{issue_id} = $issue_id; >-- >1.9.1
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 18651
:
63629
|
63630
|
63631
|
63632
|
63633
|
63634
|
63635
|
63636
|
63637
|
63654
|
63659
|
63706
|
64352
|
64353
|
64354
|
64355
|
64356
|
64357
|
64394
|
64395
|
64396
|
64397
|
64398
|
64399
|
64448
|
64449
|
64450
|
64451
|
64452
|
64453
|
64454
|
64455
|
64489
|
64490
|
64495
|
65134