Bugzilla – Attachment 76043 Details for
Bug 20934
Biblio checkout history shows only current checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20934: Fix display of old checkouts in the checkout history page
Bug-20934-Fix-display-of-old-checkouts-in-the-chec.patch (text/plain), 4.68 KB, created by
Jonathan Druart
on 2018-06-13 16:34:59 UTC
(
hide
)
Description:
Bug 20934: Fix display of old checkouts in the checkout history page
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-13 16:34:59 UTC
Size:
4.68 KB
patch
obsolete
>From 5fffe36b3bde934a3f178cfe64577e2786dab539 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 13 Jun 2018 13:26:43 -0300 >Subject: [PATCH] Bug 20934: Fix display of old checkouts in the checkout > history page > >Again a regression caused by > commit fa54100dffe092e606f79b15692eedaf78f42e45 > Bug 18403: Use patron-title.inc when hidepatronname is used [SPECIFIC for issuehistory] > >GetBiblioIssues does a union all with issues and old_issues, so we >should old_issues as well. >To make the join on the items table we need to define the item and >patron methods. For consistency the relationships have been redefined >(item instead of itemnumber, borrower instead of borrowernumber) in the >DBIx::Class definition. > >This is not perfect but I think the best way to provide an easy to >backport patch. > >It highlights that we need improvements in this area. >--- > Koha/Old/Checkout.pm | 32 ++++++++++++++++++++++ > Koha/Schema/Result/OldIssue.pm | 19 +++++++++++++ > catalogue/issuehistory.pl | 13 +++++++-- > .../prog/en/modules/catalogue/issuehistory.tt | 4 +-- > 4 files changed, 64 insertions(+), 4 deletions(-) > >diff --git a/Koha/Old/Checkout.pm b/Koha/Old/Checkout.pm >index 3a7c1eb088..2507cc1326 100644 >--- a/Koha/Old/Checkout.pm >+++ b/Koha/Old/Checkout.pm >@@ -21,6 +21,38 @@ use Koha::Database; > > use base qw(Koha::Object); > >+=head3 item >+ >+my $item = $checkout->item; >+ >+Return the checked out item >+ >+=cut >+ >+sub item { >+ my ( $self ) = @_; >+ my $item_rs = $self->_result->item; >+ return Koha::Item->_new_from_dbic( $item_rs ); >+} >+ >+=head3 patron >+ >+my $patron = $checkout->patron >+ >+Return the patron for who the checkout has been done >+ >+=cut >+ >+sub patron { >+ my ( $self ) = @_; >+ my $patron_rs = $self->_result->borrower; >+ return Koha::Patron->_new_from_dbic( $patron_rs ); >+} >+ >+ >+ >+ >+ > sub _type { > return 'OldIssue'; > } >diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm >index b9c5b234b5..32a90ab6d3 100644 >--- a/Koha/Schema/Result/OldIssue.pm >+++ b/Koha/Schema/Result/OldIssue.pm >@@ -229,6 +229,25 @@ __PACKAGE__->belongs_to( > # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RKLeDDEz22G5BU/ZAl7QLA > >+__PACKAGE__->belongs_to( >+ "borrower", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "borrowernumber" }, >+ { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" }, >+); >+ >+__PACKAGE__->belongs_to( >+ "item", >+ "Koha::Schema::Result::Item", >+ { itemnumber => "itemnumber" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ > sub koha_objects_class { > 'Koha::Old::Checkouts'; > } >diff --git a/catalogue/issuehistory.pl b/catalogue/issuehistory.pl >index 6a7f623336..f7044022f0 100755 >--- a/catalogue/issuehistory.pl >+++ b/catalogue/issuehistory.pl >@@ -25,6 +25,7 @@ use C4::Output; > use C4::Biblio; # GetBiblio > use C4::Search; # enabled_staff_search_views > use Koha::Checkouts; >+use Koha::Old::Checkouts; > > use Koha::Biblios; > >@@ -41,17 +42,25 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > > my $biblionumber = $query->param('biblionumber'); > >-my $checkouts = Koha::Checkouts->search( >+my @checkouts = Koha::Checkouts->search( > { biblionumber => $biblionumber }, > { > join => 'item', > order_by => 'timestamp', > } > ); >+my @old_checkouts = Koha::Old::Checkouts->search( >+ { biblionumber => $biblionumber }, >+ { >+ join => 'item', >+ order_by => 'timestamp', >+ } >+); >+ > my $biblio = Koha::Biblios->find( $biblionumber ); > > $template->param( >- checkouts => $checkouts, >+ checkouts => [ @checkouts, @old_checkouts ], > biblio => $biblio, > issuehistoryview => 1, > C4::Search::enabled_staff_search_views, >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 0d3c01d498..e831fa6d27 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >@@ -26,8 +26,8 @@ > [% IF biblio.author %]<h3>by [% biblio.author %]</h3>[% END %] > > <div class="searchresults"> >- [% IF checkouts.count %] >- <h4>Checked out [% checkouts.count %] times</h4> >+ [% IF checkouts %] >+ <h4>Checked out [% checkouts %] times</h4> > <table id="table_issues"> > <thead><tr> > [% IF Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %] >-- >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 20934
:
76043
|
76104
|
76141
|
76142
|
76143