From f120a2e65ae03bf05d24f7436850d23718ab05fc 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 Sponsored-by: Royal College of Music [https://www.rcm.ac.uk/] Signed-off-by: Frédéric Demians Signed-off-by: Kyle M Hall --- 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 34fe73583f..b8332bf74a 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 e1bce3c3f1..d3374daf28 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -272,18 +272,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 @@ -295,9 +295,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'); @@ -338,13 +347,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 682573dc0a..e1a5483f3b 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 84efebe53d..3d1e54f2b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -118,11 +118,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.24.1 (Apple Git-126)