Bugzilla – Attachment 64450 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: Update accountlines.issue_id is the issue_id has been changed during the move
Bug-18651-Update-accountlinesissueid-is-the-issuei.patch (text/plain), 2.96 KB, created by
Marcel de Rooy
on 2017-06-20 13:15:30 UTC
(
hide
)
Description:
Bug 18651: Update accountlines.issue_id is the issue_id has been changed during the move
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-06-20 13:15:30 UTC
Size:
2.96 KB
patch
obsolete
>From 3cc2231eaf5c9a8db51e8c31ed1c5591b22c34e7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 22 May 2017 14:30:48 -0300 >Subject: [PATCH] Bug 18651: Update accountlines.issue_id is the issue_id has > been changed during the move >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Circulation.pm | 3 +++ > t/db_dependent/Circulation/Returns.t | 7 +++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 7e142ef..7b6a83e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2175,6 +2175,7 @@ sub MarkIssueReturned { > $schema->txn_do(sub { > $dbh->do( $query, undef, @bind ); > >+ my $original_issue_id = $issue_id; > my $id_already_exists = $dbh->selectrow_array( > q|SELECT COUNT(*) FROM old_issues WHERE issue_id = ?|, > undef, $issue_id >@@ -2191,6 +2192,8 @@ sub MarkIssueReturned { > > $dbh->do(q|INSERT INTO old_issues SELECT * FROM issues WHERE issue_id = ?|, undef, $issue_id); > >+ $dbh->do(q|UPDATE accountlines SET issue_id = ? WHERE issue_id = ?|, undef, $issue_id, $original_issue_id); >+ > # anonymise patron checkout immediately if $privacy set to 2 and AnonymousPatron is set to a valid borrowernumber > if ( $privacy == 2) { > $dbh->do(q|UPDATE old_issues SET borrowernumber=? WHERE issue_id = ?|, undef, $anonymouspatron, $issue_id); >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index 9d295e5..69cf309 100644 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -296,8 +296,11 @@ subtest 'Handle ids duplication' => sub { > > my ($doreturn, $messages, $new_checkout, $borrower) = AddReturn( $item->{barcode}, undef, undef, undef, dt_from_string ); > >- my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $new_checkout->{issue_id} }); >- is( $account_lines->count, 1, 'One account line should exist on new issue_id' ); >+ my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $original_checkout->issue_id }); >+ is( $account_lines->count, 0, 'No account lines should exist on old issue_id' ); >+ >+ $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $new_checkout->{issue_id} }); >+ is( $account_lines->count, 2, 'Two account lines should exist on new issue_id' ); > > isnt( $original_checkout->issue_id, $new_checkout->{issue_id}, 'AddReturn should return the issue with the new issue_id' ); > isnt( $old_checkout->itemnumber, $item->{itemnumber}, 'If an item is checked-in, it should be moved to old_issues even if the issue_id already existed in the table' ); >-- >2.1.4
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