Bugzilla – Attachment 90368 Details for
Bug 22421
accountlines.issue_id is missing a foreign key constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22421: (follow-up) Correct checkout relation
Bug-22421-follow-up-Correct-checkout-relation.patch (text/plain), 2.29 KB, created by
Kyle M Hall (khall)
on 2019-06-06 13:09:28 UTC
(
hide
)
Description:
Bug 22421: (follow-up) Correct checkout relation
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-06-06 13:09:28 UTC
Size:
2.29 KB
patch
obsolete
>From fe1b12ebd29d151921296a3a605ebe0dd18d97ab Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 6 Jun 2019 13:25:01 +0100 >Subject: [PATCH] Bug 22421: (follow-up) Correct checkout relation > >The Koha::Account::Line->checkout relationship accessor needed an update >to respect the new fields and foreign keys introduced here. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account/Line.pm | 12 +++++++----- > t/db_dependent/Koha/Account/Lines.t | 3 ++- > 2 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 0df5a7e3c2..8ee82145de 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -61,12 +61,14 @@ Return the checkout linked to this account line if exists > =cut > > sub checkout { >- my ( $self ) = @_; >- return unless $self->issue_id ; >+ my ($self) = @_; >+ return unless ( $self->issue_id || $self->old_issue_id ); >+ >+ my $issue_rs = $self->_result->issue; >+ return Koha::Checkout->_new_from_dbic($issue_rs) if $issue_rs; > >- $self->{_checkout} ||= Koha::Checkouts->find( $self->issue_id ); >- $self->{_checkout} ||= Koha::Old::Checkouts->find( $self->issue_id ); >- return $self->{_checkout}; >+ my $old_issue_rs = $self->_result->old_issue; >+ return Koha::Old::Checkout->_new_from_dbic($old_issue_rs) if $old_issue_rs; > } > > =head3 void >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index 1f64125fdb..1b6640f223 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -495,7 +495,8 @@ subtest 'checkout() tests' => sub { > is( ref($old_line_checkout), 'Koha::Old::Checkout', 'Result type is correct' ); > is( $old_line_checkout->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->checkout should return the correct old_checkout' ); > >- $line->issue_id(undef)->store; >+ $old_line_checkout->delete; >+ $line->discard_changes; #NOTE: discard_changes refreshes the whole resultset, get_from_storage only refreshes the unjoined row > is( $line->checkout, undef, 'Koha::Account::Line->checkout should return undef if no checkout linked' ); > > $schema->storage->txn_rollback; >-- >2.20.1 (Apple Git-117)
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 22421
:
85773
|
85774
|
85775
|
90352
|
90353
|
90354
|
90359
|
90360
|
90361
|
90362
|
90365
|
90366
|
90367
|
90368
|
161919
|
161920
|
161921
|
161922
|
161923
|
162244
|
162245
|
162246
|
162247
|
162248
|
166631
|
173287
|
173288
|
173289
|
173305
|
173790
|
173791
|
173792
|
173793
|
173794
|
173795
|
173796
|
173797
|
173798
|
173799
|
174281
|
174974