From d86507c723908372de86d1162cc53822e3792490 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 5 Aug 2015 13:52:09 +0100 Subject: [PATCH] Bug 25261: Require confirmation of multiple parts items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan 1/ Catalogue an item to contain multiple parts by populating 'Materials specified (bound volume or other part)' 2/ Enable the new system preference 'CircConfirmParts' 3/ Attempt to checkout the item created in step 1 to a user and note that confirmation is now required. 4/ Checkout the item 5/ Attempt to checkin the item you have just checked out and note that confirmation is required. 6/ Signoff Signed-off-by: Frédéric Demians --- C4/Circulation.pm | 6 +++ circ/returns.pl | 39 ++++++++++++------- .../prog/en/modules/circ/circulation.tt | 9 ++++- .../prog/en/modules/circ/returns.tt | 35 +++++++++++++++-- 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 8db887db2e..23aae5d001 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -843,6 +843,12 @@ sub CanBookBeIssued { } } + # Additional Materials Check + my $no_of_parts = $item_object->materials; + if ( $no_of_parts > 0 ) { + $needsconfirmation{additional_materials} = $no_of_parts; + } + # # CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER # diff --git a/circ/returns.pl b/circ/returns.pl index 8044262551..512fde60d7 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -274,18 +274,18 @@ if ($barcode) { my $checkout = $item->checkout; my $biblio = $item->biblio; $template->param( - title => $biblio->title, - homebranch => $item->homebranch, - holdingbranch => $item->holdingbranch, - returnbranch => $returnbranch, - author => $biblio->author, - itembarcode => $item->barcode, - itemtype => $item->effective_itemtype, - ccode => $item->ccode, - itembiblionumber => $biblio->biblionumber, - biblionumber => $biblio->biblionumber, + title => $biblio->title, + homebranch => $item->homebranch, + holdingbranch => $item->holdingbranch, + returnbranch => $returnbranch, + author => $biblio->author, + itembarcode => $item->barcode, + itemtype => $item->effective_itemtype, + ccode => $item->ccode, + itembiblionumber => $biblio->biblionumber, + biblionumber => $biblio->biblionumber, additional_materials => $materials, - issue => $checkout, + issue => $checkout, ); } # FIXME else we should not call AddReturn but set BadBarcode directly instead @@ -297,9 +297,18 @@ if ($barcode) { my $return_date = $dropboxmode ? $dropboxdate : $return_date_override_dt; + # Block return if multi-part and confirm has not been received + my $needs_confirm = 0; + if ( C4::Context->preference("CircConfirmParts") ) { + if ( $item->materials > 0 && !$query->param('multiple_confirm') ) { + $needs_confirm = 1; + } + } + # do the return ( $returned, $messages, $issue, $borrower ) = - AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date ); + AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date ) + unless $needs_confirm; if ($returned) { my $time_now = dt_from_string()->truncate( to => 'minute'); @@ -340,13 +349,17 @@ if ($barcode) { ); } } - } elsif ( C4::Context->preference('ShowAllCheckins') and !$messages->{'BadBarcode'} ) { + } elsif ( C4::Context->preference('ShowAllCheckins') and !$messages->{'BadBarcode'} and !$needs_confirm ) { $input{duedate} = 0; $returneditems{0} = $barcode; $riduedate{0} = 0; push( @inputloop, \%input ); } $template->param( privacy => $borrower->{privacy} ); + + if ( $needs_confirm ) { + $template->param( needs_confirm => $needs_confirm ); + } } $template->param( inputloop => \@inputloop ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 7423164850..34253e85a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -82,7 +82,7 @@ [% IF ( NEEDSCONFIRMATION ) %]
- [% IF CAN_user_circulate_force_checkout %] + [% IF CAN_user_circulate_force_checkout or additional_materials %]

Please confirm checkout

[% ELSE %]

Cannot check out

@@ -98,6 +98,7 @@ [% END %] + [% IF ( DEBT ) %]
  • The patron has a debt of [% DEBT | $Price %].
  • [% END %] @@ -196,6 +197,12 @@ [% END %] [% END %] + + [% IF additional_materials %] +
  • + Please confirm that the accompanying materials are present: [% additional_materials | html %] +
  • + [% END %] [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index bcde1e90cb..6aa5594d8e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -121,11 +121,38 @@
    [% END %] - [% IF additional_materials %] -
    - Note about the accompanying materials:
    - [% additional_materials | html %] + [% IF needs_confirm %] +
    +

    Please confirm checkin

    +
      + [% IF additional_materials %] +
    • + Please confirm that the accompanying materials are present: [% additional_materials | html %] +
    • + [% END %] +
    + +
    + + + [% IF additional_materials %] + + [% END %] + + + +
    +
    + [% ELSE %] + [% IF additional_materials %] +
    +
      +
    • + Note about the accompanying materials: [% additional_materials | html %] +
    • +
    + [% END %] [% END %] [% IF ( collectionItemNeedsTransferred ) %] -- 2.20.1