Bugzilla – Attachment 79828 Details for
Bug 21432
Internal Server Error in Checkout History
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21432: (bug 20899 follow-up) Fix patron's name display for deleted patrons
Bug-21432-bug-20899-follow-up-Fix-patrons-name-dis.patch (text/plain), 4.48 KB, created by
Josef Moravec
on 2018-10-02 16:02:41 UTC
(
hide
)
Description:
Bug 21432: (bug 20899 follow-up) Fix patron's name display for deleted patrons
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-10-02 16:02:41 UTC
Size:
4.48 KB
patch
obsolete
>From 1159e4e389f084291dc8121ee59bf54d7317105b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 1 Oct 2018 18:05:44 -0300 >Subject: [PATCH] Bug 21432: (bug 20899 follow-up) Fix patron's name display > for deleted patrons >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Template process failed: undef error - DBIC result _type isn't of the >_type Borrower at >/home/vagrant/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >line 54. > >Koha::Old::Checkout->patron should return undef if the patron record has >been removed. > >Test plan: >- Check 2 items out on the same bibliographic record >- Check them in >- Delete the patron's record of one of the issuer (Is this word really >exist?) >- View the checkout history for this bib record (Home ⺠Catalog ⺠>Checkout history) >=> Without this patch you get the error >=> With this patch applied one of the "Patron" cells will be empty > >Signed-off-by: Claudio <costalc@gmail.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Old/Checkout.pm | 1 + > .../prog/en/modules/catalogue/issuehistory.tt | 6 ++++- > t/db_dependent/Koha/Checkouts.t | 30 +++++++++++++++++++--- > 3 files changed, 32 insertions(+), 5 deletions(-) > >diff --git a/Koha/Old/Checkout.pm b/Koha/Old/Checkout.pm >index 876e0cd..d602a63 100644 >--- a/Koha/Old/Checkout.pm >+++ b/Koha/Old/Checkout.pm >@@ -54,6 +54,7 @@ Return the patron for who the checkout has been done > sub patron { > my ( $self ) = @_; > my $patron_rs = $self->_result->borrower; >+ return unless $patron_rs; > return Koha::Patron->_new_from_dbic( $patron_rs ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >index caede4d..215b40d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >@@ -48,7 +48,11 @@ > [% FOREACH checkout IN checkouts %] > <tr> > [% IF show_patron_column %] >- <td>[% INCLUDE 'patron-title.inc' patron => checkout.patron hide_patron_infos_if_needed=1 %]</td> >+ <td> >+ [% IF checkout.patron %][%# Not set for deleted patron records %] >+ [% INCLUDE 'patron-title.inc' patron => checkout.patron hide_patron_infos_if_needed=1 %] >+ [% END %] >+ </td> > [% END %] > <td> > [% IF checkout.item.barcode %] [%# FIXME This test is not mandatory I think %] >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index c8ec4c5..dfb90e4 100644 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -21,6 +21,7 @@ use Modern::Perl; > > use Test::More tests => 7; > >+use C4::Circulation; > use Koha::Checkouts; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); >@@ -94,10 +95,31 @@ subtest 'item' => sub { > }; > > subtest 'patron' => sub { >- plan tests => 2; >- my $p = $new_checkout_1->patron; >- is( ref($p), 'Koha::Patron', 'Koha::Checkout->patron should return a Koha::Patron' ); >- is( $p->borrowernumber, $patron->{borrowernumber}, 'Koha::Checkout->patron should return the correct patron' ); >+ plan tests => 3; >+ my $patron = $builder->build_object({class=>'Koha::Patrons', value => {branchcode => $library->{branchcode}}}); >+ >+ my $item = $builder->build_object( { class=> 'Koha::Items' } ); >+ my $checkout = Koha::Checkout->new( >+ { borrowernumber => $patron->borrowernumber, >+ itemnumber => $item->itemnumber, >+ branchcode => $library->{branchcode}, >+ } >+ )->store; >+ >+ my $p = $checkout->patron; >+ is( ref($p), 'Koha::Patron', >+ 'Koha::Checkout->patron should return a Koha::Patron' ); >+ is( $p->borrowernumber, $patron->borrowernumber, >+ 'Koha::Checkout->patron should return the correct patron' ); >+ >+ # Testing Koha::Old::Checkout->patron now >+ my $issue_id = $checkout->issue_id; >+ C4::Circulation::MarkIssueReturned( $p->borrowernumber, $checkout->itemnumber ); >+ $p->delete; >+ my $old_issue = Koha::Old::Checkouts->find($issue_id); >+ is( $old_issue->patron, undef, >+ 'Koha::Checkout->patron should return undef if the patron record has been deleted' >+ ); > }; > > $retrieved_checkout_1->delete; >-- >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 21432
:
79511
|
79785
| 79828