From c9b7e1801dd21458fca4761d8e5d1317a1562ac1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 5 Nov 2013 12:32:30 +0100 Subject: [PATCH] [PASSED QA] Bug 11201: Add a in-house use list pages The circulation page has a new entry: a link to a list of the pending in-house use. Bug 10860 introduces a new way for managing in-house uses. This patch adds a new page (from the circulation home page) to list all pending in-house uses. Test plan: Go on the circulation home page and click on the in-house use link. Verify all your in-house uses are listed and information are consistent. Bug 11201: Display lib instead of AV code This patch assumes that items.location is linked the the LOC authorised values. Signed-off-by: Nicole Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 31 +++++++++ circ/on-site_checkouts.pl | 43 ++++++++++++ .../prog/en/modules/circ/circulation-home.tt | 1 + .../prog/en/modules/circ/on-site_checkouts.tt | 81 ++++++++++++++++++++++ t/db_dependent/Circulation/GetIssues.t | 12 +++- 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100755 circ/on-site_checkouts.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt diff --git a/C4/Circulation.pm b/C4/Circulation.pm index af2eabb..2726f79 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -73,6 +73,7 @@ BEGIN { &barcodedecode &LostItem &ReturnLostItem + &GetPendingOnSiteCheckouts ); # subs to deal with issuing a book @@ -3894,6 +3895,36 @@ sub GetAgeRestriction { 1; +=head2 GetPendingOnSiteCheckouts + +=cut + +sub GetPendingOnSiteCheckouts { + my $dbh = C4::Context->dbh; + return $dbh->selectall_arrayref(q| + SELECT + items.barcode, + items.biblionumber, + items.itemnumber, + items.itemnotes, + items.itemcallnumber, + items.location, + issues.date_due, + issues.branchcode, + biblio.author, + biblio.title, + borrowers.firstname, + borrowers.surname, + borrowers.cardnumber, + borrowers.borrowernumber + FROM items + LEFT JOIN issues ON items.itemnumber = issues.itemnumber + LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber + LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber + WHERE issues.onsite_checkout = 1 + |, { Slice => {} } ); +} + __END__ =head1 AUTHOR diff --git a/circ/on-site_checkouts.pl b/circ/on-site_checkouts.pl new file mode 100755 index 0000000..2ae52f7 --- /dev/null +++ b/circ/on-site_checkouts.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl +# This file is part of Koha. +# +# Copyright (C) 2013 BibLibre +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use C4::Auth; +use C4::Circulation qw( GetPendingOnSiteCheckouts ); +use C4::Output; + +my $cgi = new CGI; + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "circ/on-site_checkouts.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => {circulate => "circulate_remaining_permissions"}, + } +); + +my $pending_onsite_checkouts = C4::Circulation::GetPendingOnSiteCheckouts(); + +$template->param( + pending_onsite_checkouts => $pending_onsite_checkouts, +); + +output_html_with_http_headers $cgi, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index e5eaddc..af67379 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -46,6 +46,7 @@ systems with large numbers of overdue items.[% END %]
  • Overdues with fines - Limited to your library. See report help for other details.
  • +
  • On-site checkout list
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt new file mode 100644 index 0000000..cb67007 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt @@ -0,0 +1,81 @@ +[% USE Branches %] +[% USE KohaDates %] +[% USE AuthorisedValues %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › On-site checkouts +[% INCLUDE 'doc-head-close.inc' %] + +[% INCLUDE 'datatables.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'circ-search.inc' %] + + + +
    +
    +
    +
    +

    Pending on-site checkout list

    + [% IF pending_onsite_checkouts %] + + + + + + + + [% FOREACH item IN pending_onsite_checkouts %] + + + + + + + + + + [% END %] + +
    DatePatronTitleCallnumberBarcodeLibraryLocation
    [% item.date_due | $KohaDates %] + [%item.firstname %] [% item.surname %] + + [% item.title |html %][% IF ( item.author ) %], by [% item.author %][% END %][% IF ( item.itemnotes ) %]- [% item.itemnotes %][% END %] + [% item.itemcallnumber %] + [% item.barcode %] + [% Branches.GetName(item.branchcode) %][% AuthorisedValues.GetByCode( 'LOC', item.location )%]
    + [% ELSE %] +

    No pending on-site checkout.

    + [% END %] +
    +
    +
    + [% INCLUDE 'circ-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/t/db_dependent/Circulation/GetIssues.t b/t/db_dependent/Circulation/GetIssues.t index e308dbe..ddd5186 100644 --- a/t/db_dependent/Circulation/GetIssues.t +++ b/t/db_dependent/Circulation/GetIssues.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More; +use Test::More tests => 10; use Test::MockModule; use C4::Biblio; use C4::Items; @@ -16,6 +16,8 @@ my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; +$dbh->do(q|DELETE FROM issues|); + my $branchcode; my $branch_created; my @branches = keys %{ GetBranches() }; @@ -82,4 +84,10 @@ is(scalar @$issues, 1, "The other is an item from biblio $biblionumber2"); $issues = C4::Circulation::GetIssues({itemnumber => $itemnumber2}); is(scalar @$issues, 0, "No one has issued the second item of biblio $biblionumber2"); -done_testing; +my $onsite_checkouts = GetPendingOnSiteCheckouts; +is( scalar @$onsite_checkouts, 0, "No pending on-site checkouts" ); + +my $itemnumber4 = AddItem({ barcode => '0104', %item_branch_infos }, $biblionumber1); +AddIssue( $borrower, '0104', undef, undef, undef, undef, { onsite_checkout => 1 } ); +$onsite_checkouts = GetPendingOnSiteCheckouts; +is( scalar @$onsite_checkouts, 1, "There is 1 pending on-site checkout" ); -- 1.9.1