From bdfb8a556f02761a7e987659f36e237749e8f23e 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=utf8 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/] Sponsored-by: PTFS Europe [https://ptfs-europe.com/] Signed-off-by: Frédéric Demians Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- 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 ed2b43f3d5..cf638ab6a4 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -897,6 +897,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 a7556c7b07..01efe873f7 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -271,18 +271,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 @@ -294,9 +294,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'); @@ -337,13 +346,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 1a0afc2b6c..851b3706bd 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 8293979749..0790f66a7b 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.39.5