From f1e625e8a515a1f406c417e62709d1310ab6eff9 Mon Sep 17 00:00:00 2001 From: Tobias Reimann Date: Fri, 12 Aug 2016 08:17:21 -0700 Subject: [PATCH] Bug 17101 - Confirm a question before check in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch enable the checkin message type question. This type ask the user before the item is check in, yes or no. Only if he click yes then the item is checked in. Test plan: 1. Create an itemtype, with the checkinmsgtype question 2. Create an item with the itemtype from 1 3. Check out the item from 2 4. Check in the item from 3 5. Click no ==> item shouldn't be check in 6. Check in the item from 3 7. Click yes ==> item should be check in Optional: Before step 4 check others item in, to check if the prevouis check in's are still shown. Sponsored-by: Bücherei Maichingen Signed-off-by: Mirko Tietgen --- circ/returns.pl | 22 ++++++++++------- .../prog/en/modules/admin/itemtypes.tt | 5 ++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 28 +++++++++++++++++----- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 418f94e..e0f3964 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -190,6 +190,7 @@ my $issueinformation; my $itemnumber; my $barcode = $query->param('barcode'); my $exemptfine = $query->param('exemptfine'); +my $accept = $query->param('accept'); if ( $exemptfine && !C4::Auth::haspermission(C4::Context->userenv->{'id'}, {'updatecharges' => 'writeoff'}) @@ -268,11 +269,14 @@ if ($barcode) { # Check if we should display a checkin message, based on the the item # type of the checked in item my $itemtype = Koha::ItemTypes->find( $biblio->{'itemtype'} ); - if ( $itemtype && $itemtype->checkinmsg ) { - $template->param( - checkinmsg => $itemtype->checkinmsg, - checkinmsgtype => $itemtype->checkinmsgtype, - ); + if ($itemtype->checkinmsgtype eq 'question' && $accept != '1' && $accept !='2'){ + if ( $itemtype && $itemtype->checkinmsg ) { + $template->param( + checkinmsg => $itemtype->checkinmsg, + checkinmsgtype => $itemtype->checkinmsgtype, + barcode => $barcode, + ); + } } # make sure return branch respects home branch circulation rules, default to homebranch @@ -299,7 +303,6 @@ if ($barcode) { borrower => $borrower, additional_materials => $materials, ); - my %input = ( counter => 0, first => 1, @@ -307,9 +310,10 @@ if ($barcode) { ); # do the return - ( $returned, $messages, $issueinformation, $borrower ) = - AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate ); - + if($itemtype->checkinmsgtype ne 'question' || ($itemtype->checkinmsgtype eq 'question' && $accept == '1')) { + ( $returned, $messages, $issueinformation, $borrower ) = + AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate ); + } if ($returned) { my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minute'); my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 9a8f431..34f9b96 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -272,6 +272,11 @@ Item types administration [% ELSE %] [% END %] + [% IF itemtype.checkinmsgtype == 'question' %] + + [% ELSE %] + + [% END %]
  • 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 f0d584b..d163ea8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -528,12 +528,24 @@ $(document).ready(function () { [% IF ( checkinmsg ) %] - [% IF ( checkinmsgtype == 'alert' ) %] + [% IF ( checkinmsgtype == 'alert' || checkinmsgtype == 'question') %]
    [% ELSE %]
    [% END %]

    [% checkinmsg | html_line_break %]

    + [% IF ( checkinmsgtype == 'question') %] +
    + + + + + [% FOREACH inputloo IN inputloop %] + + + [% END %] + [% END %] +
    [% END%] @@ -553,12 +565,16 @@ $(document).ready(function () {
    Check in - [% IF ( exemptfine ) %] - - [% ELSIF ( dropboxmode ) %] - + [% IF checkinmsgtype == 'question' %] + [% ELSE %] - + [% IF ( exemptfine ) %] + + [% ELSIF ( dropboxmode ) %] + + [% ELSE %] + + [% END %] [% END %] -- 2.1.4