From fe1537eb2623f6beb2c832d2e0ceaf3296d982b5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Feb 2014 12:54:24 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 11759: Batch checkout - Add the new template This patch is the main patch. It adds: - the new template circ/circulation_batch_checkouts.tt - the change into circ/circulation.pl === Why this feature is useful for some libraries? === Currently Koha does not allow to checkout several items at once to a user. This can cause a waste of time when a user want to checkout more than 10 items. This development has been asked to have statistics on in-house use. Every night, a librarian will enter a barcode list (from a file or a scanner : the librarian scans the barcode of the documents that users let on the tables). Barcodes will be added to a statistics patron in order to count the number of items consulted. The development has been expanded to cover another need: some special libraries (BDP for "Bibliotheque departementale de pret": "Loan Regional Library"). These libraries loan items to smaller libraries (municipal). The number of items could be very important and the current way offered by Koha is not adequate. === Test plan === 0/ Apply all patches and execute the DB change entry. 1/ Verify you are abble to do some checkouts (with confirmations, errors). = Statistics way = 2/ Create a statistical patron (e.g. category code STATS). 3/ Update the batch_checkouts pref with the category code (STATS). 4/ Go on the member page and verify the new "Batch check out" tab appears (and only for this user). 5/ Check some items out on the new page using the textarea or a file. 6/ Verify the table contains the item's information and the "Information" column contains "Local use recorded". = Real checkouts = 7/ Create a non statistical patron and update the pref. 8/ Check some items out on the new page using the textarea or a file. 9/ Verify the information in the table is consistent. 10/ Verify item without confirmation needed or impossible alert is checked out. 11/ If the logged in user has the "force_checkout" permission, all checkouts with a "confirmation needed" message can be done. If the logged in user does not have it, there is no way to force the checkout. Signed-off-by: Josef Moravec --- circ/circulation.pl | 41 ++- .../en/modules/circ/circulation_batch_checkouts.tt | 272 ++++++++++++++++++++ 2 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt diff --git a/circ/circulation.pl b/circ/circulation.pl index 4d830d9..1e127fc 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -88,13 +88,33 @@ if (!C4::Context->userenv && !$branch){ } my $barcodes = []; +my $batch = $query->param('batch'); if ( my $barcode = $query->param('barcode') ) { $barcodes = [ $barcode ]; +} else { + my $filefh = $query->upload('uploadfile'); + if ( $filefh ) { + while ( my $content = <$filefh> ) { + $content =~ s/[\r\n]*$//g; + push @$barcodes, $content if $content; + } + } elsif ( my $list = $query->param('barcodelist') ) { + push @$barcodes, split( /\s\n/, $list ); + $barcodes = [ map { $_ =~ /^\s*$/ ? () : $_ } @$barcodes ]; + } else { + @$barcodes = $query->param('barcodes'); + } } +$barcodes = [ uniq @$barcodes ]; + +my $template_name = $batch + ? q|circ/circulation_batch_checkouts.tt| + : q|circ/circulation.tt|; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( { - template_name => 'circ/circulation.tt', + template_name => $template_name, query => $query, type => "intranet", authnotrequired => 0, @@ -321,6 +341,7 @@ if (@$barcodes) { if ( $error->{'UNKNOWN_BARCODE'} && C4::Context->preference("itemBarcodeFallbackSearch") + && not $batch ) { $template_params->{FALLBACK} = 1; @@ -394,9 +415,16 @@ if (@$barcodes) { } push @$checkout_infos, $template_params; } - - $template->param( %{$checkout_infos->[0]} ); - $template->param( barcode => $barcodes->[0] ); + unless ( $batch ) { + $template->param( %{$checkout_infos->[0]} ); + $template->param( barcode => $barcodes->[0] ); + } else { + my $confirmation_needed = grep { $_->{NEEDSCONFIRMATION} } @$checkout_infos; + $template->param( + checkout_infos => $checkout_infos, + confirmation_needed => $confirmation_needed, + ); + } } # reload the borrower info for the sake of reseting the flags..... @@ -565,6 +593,9 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { extendedattributes => $attributes ); } +my $view = $batch + ?'batch_checkout_view' + : 'circview'; my @relatives = GetMemberRelatives( $borrower->{'borrowernumber'} ); my $relatives_issues_count = @@ -613,7 +644,7 @@ $template->param( totaldue => sprintf('%.2f', $total), inprocess => $inprocess, is_child => ($borrowernumber && $borrower->{'category_type'} eq 'C'), - circview => 1, + $view => 1, soundon => C4::Context->preference("SoundOn"), fast_cataloging => $fast_cataloging, CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt new file mode 100644 index 0000000..899eac2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -0,0 +1,272 @@ +[% USE Branches %] +[% USE KohaDates %] +[% IF ( export_remove_fields OR export_with_csv_profile ) %] + [% SET exports_enabled = 1 %] +[% END %] +[% USE AuthorisedValues %] +[% INCLUDE 'doc-head-open.inc' %] +[% SET destination = "circ" %] +Koha › Circulation +[% IF borrowernumber %] + › Checking out a batch to [% INCLUDE 'patron-title.inc' invert_name = 1 %] +[% END %] + +[% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %] +[% IF ( UseTablesortForCirc ) %] + +[% INCLUDE 'datatables-strings.inc' %] +[% END %] + + + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'circ-search.inc' %] + + +
+ +
+
+
+ +
+ +[% UNLESS checkout_infos %] +
+
+ +
+ Use a file +
    +
  1. +
+
+
+ Or list barcodes one by one +
    +
  1. + + +
  2. +
+
+ +
+ + + + +
+
+
+ +[% ELSE %] + [% IF confirmation_needed && CAN_user_circulate_force_checkout %] +
+ [% END %] + + + + [% IF confirmation_needed && CAN_user_circulate_force_checkout %] + + [% END %] + + + + + + + [% FOR checkout_info IN checkout_infos %] + + [% IF confirmation_needed && CAN_user_circulate_force_checkout %] + + [% END %] + + + + + [% END %] + +
BarcodeTitleInformation
+ [% IF checkout_info.NEEDSCONFIRMATION %] + + [% END %] + [% checkout_info.barcode %] + [% checkout_info.item.title |html %][% FOREACH subtitl IN checkout_info.item.subtitle %] [% subtitl.subfield %][% END %][% IF checkout_info.item.author %], by [% checkout_info.item.author %][% END %][% IF ( checkout_info.itme.itemnotes ) %]- [% checkout_info.item.itemnotes %][% END %] [% checkout_info.item.barcode %] + + [% IF checkout_info.NEEDSCONFIRMATION %] +

+ [% IF checkout_info.AGE_RESTRICTION %] + Age restriction [% checkout_info.AGE_RESTRICTION %] + [% END %] + [% IF checkout_info.DEBT %] + The patron has a debt of [% checkout_info.DEBT %] + [% END %] + [% IF checkout_info.RENEW_ISSUE %] + This Item is currently checked out to this patron. Renew? + [% END %] + [% IF checkout_info.RESERVE_WAITING %] + This Item has been waiting for another patron. + [% END %] + [% IF checkout_info.RESERVED %] + This Item has been on hold for another patron. + [% END %] + [% IF checkout_info.ISSUED_TO_ANOTHER %] + This Item is checked out to another patron. + [% IF CAN_user_circulate_force_checkout %] + Check in and check out? + [% END %] + [% END %] + [% IF checkout_info.TOO_MANY %] + Too many checked out. + [% END %] + [% IF checkout_info.BORRNOTSAMEBRANCH %] + This patrons is from a different library ([% checkout_info.BORRNOTSAMEBRANCH %]) + [% END %] + [% IF checkout_ino.PATRON_CANT %] + This patron can't check out this item per library circulation policy. + [% END %] + [% IF checkout_info.NOT_FOR_LOAN_FORCING %] + [% IF checkout_info.itemtype_notforloan %] + Item type is normally not for loan. + [% ELSIF checkout_info.item_notforloan %] + [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, checkout_info.item_notforloan, 0 ) %] + Item is normally not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib %])[% END %]. + [% END %] + [% END %] + [% IF checkout_info.USERBLOCKEDOVERDUE %] + Patron has [% checkout_info.USERBLOCKEDOVERDUE %] overdue item(s). + [% END %] + [% IF checkout_info.ITEM_LOST %] + This item has been lost with a status of "[% checkout_info.ITEM_LOST %]". + [% END %] + [% IF checkout_info.HIGHHOLDS %] + High demand item. Loan period shortened to [% checkout_info.HIGHHOLDS.duration %] days (due [% checkout_info.HIGHHOLDS.returndate %]). + [% END %] + [% IF checkout_info.HIGHHOLDS %] + + [% END %] + + [% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout or checkout_info.HIGHHOLDS ) %] + [% IF checkout_info.RESERVED || checkout_info.RESERVE_WAITING %] +

The hold will be canceled.

+ [% END %] + [% END %] +

+ [% END %] + + + [% IF checkout_info.alert.ITEM_LOST || checkout_info.alert.OTHER_CHARGES %] +

+ [% IF checkout_info.alert.ITEM_LOST %] + This item has been lost with a status of "[% checkout_info.alert.ITEM_LOST %]". + [% END %] + [% IF checkout_info.alert.OTHER_CHARGES %] + The patron has unpaid charges for reserves, rentals etc of [% checkout_info.alert.OTHER_CHARGES %]. + [% END %] +

+ [% END %] + + + [% IF checkout_info.IMPOSSIBLE %] +

+ [% IF checkout_info.STATS %] + Local use recorded + [% END %] + + [% IF checkout_info.NOT_FOR_LOAN %] + [% IF checkout_info.itemtype_notforloan %] + Item type not for loan. + [% ELSIF checkout_info.item_notforloan %] + [% item_notforloan_lib = AuthorisedValues.GetByCode( checkout_info.authvalcode_notforloan, checkout_info.item_notforloan, 0 ) %] + Item not for loan [% IF checkout_info.item_notforloan_lib %]([% checkout_info.item_notforloan_lib %])[% END %]. + [% END %] + [% END %] + [% IF checkout_info.WTHDRAWN %] + Item has been withdrawn + [% END %] + [% IF checkout_info.RESTRICTED %] + Item is restricted + [% END %] + [% IF checkout_info.GNA %] + Patron's address is in doubt + [% END %] + [% IF checkout_info.CARD_LOST %] + Patron's card is lost + [% END %] + [% IF checkout_info.DEBARRED %] + Patron is restricted + [% END %] + [% IF checkout_info.NO_MORE_RENEWALS %] + No more renewals possible + [% END %] + [% IF checkout_info.EXPIRED %] + Patron's card is expired + [% END %] + [% IF checkout_info.ITEMNOTSAMEBRANCH %] + This item belongs to [% Branches.GetName( checkout_info.itemhomebranch ) %] and cannot be checked out from this location. + [% END %] + [% IF checkout_info.USERBLOCKEDREMAINING %] + Patron has had overdue items and is blocked for [% checkout_info.USERBLOCKEDREMAINING %] day(s). + [% END %] + [% IF checkout_info.USERBLOCKEDOVERDUE %] + Checkouts are BLOCKED because patron has overdue items + [% END %] + [% IF checkout_info.TOO_MANY %] + Too many checked out. + [% END %] + [% IF checkout_info.UNKNOWN_BARCODE %] +

  • The barcode was not found [% checkout_info.barcode |html %] + [% END %] +

    + [% END %] +
  • + + [% IF confirmation_needed && CAN_user_circulate_force_checkout %] +

    Please confirm checkout

    + + + + + + +
    + [% END %] + +[% END %] + +
    +
    +
    +
    +[% INCLUDE 'circ-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] -- 1.7.10.4