Bug 643: Allow override of 'debarred' status
authorPasi Kallinen <pasi.kallinen@pttk.fi>
Thu, 22 May 2014 11:38:33 +0000 (14:38 +0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 31 Oct 2014 18:15:31 +0000 (15:15 -0300)
Add a button to temporarily override patron debarment.

To test:
1) Go to patron check out page
2) If patron has been debarred (eg. due to having fees),
   there is no way to check out to that patron.
3) Apply patch
4) A debarred patron check out page now has a button for
   "Override debarment temporarily" - clicking on it
   should allow checking out to that patron.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Rebased because patch did not apply

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with/without force_checkout and superlibrarian permission.
Also checked crafting a URL is no longer working.
No regressions found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt

index 8f79f71..131c8b0 100755 (executable)
@@ -97,6 +97,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
 
 my $branches = GetBranches();
 
+my $force_allow_issue = $query->param('forceallow') || 0;
+
+my @failedrenews = $query->param('failedrenew');    # expected to be itemnumbers
+our %renew_failed = ();
+for (@failedrenews) { $renew_failed{$_} = 1; }
+
+my @failedreturns = $query->param('failedreturn');
+our %return_failed = ();
+for (@failedreturns) { $return_failed{$_} = 1; }
+
 my $findborrower = $query->param('findborrower') || q{};
 $findborrower =~ s|,| |g;
 my $borrowernumber = $query->param('borrowernumber');
@@ -235,7 +245,8 @@ if ($borrowernumber) {
         #borrowercard expired, no issues
         $template->param(
             flagged  => "1",
-            noissues => "1",
+            noissues => ($force_allow_issue) ? 0 : "1",
+            forceallow => $force_allow_issue,
             expired => "1",
             renewaldate => format_date("$renew_year-$renew_month-$renew_day")
         );
@@ -328,7 +339,7 @@ if ($barcode) {
         );
         $blocker = 1;
     }
-    if( !$blocker ){
+    if( !$blocker || $force_allow_issue ){
         my $confirm_required = 0;
         unless($issueconfirmed){
             #  Get the item title for more information
@@ -400,7 +411,8 @@ foreach my $flag ( sort keys %$flags ) {
     $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
     if ( $flags->{$flag}->{'noissues'} ) {
         $template->param(
-            noissues => 'true',
+            noissues => ($force_allow_issue) ? 0 : 'true',
+            forceallow => $force_allow_issue,
         );
         if ( $flag eq 'GNA' ) {
             $template->param( gna => 'true' );
index 3708e0e..8419ccb 100644 (file)
@@ -252,6 +252,8 @@ $(document).ready(function() {
 [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
 
+[% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
+
 [% IF ( RESERVED ) %]
     <p>
     <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
@@ -291,6 +293,7 @@ $(document).ready(function() {
 [% END %]
 
 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
+    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
@@ -340,6 +343,7 @@ $(document).ready(function() {
                 [% FOREACH book IN options %]
                     <br />
                     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
+                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
                         <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
                         <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
                         <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
@@ -420,11 +424,20 @@ $(document).ready(function() {
         [% END %]
         </ul>
 
+        [% IF (forceallow) %]
+            <li>Debarment overridden temporarily</li>
+        [% END %]
+
 </div></div>
 [% ELSE %]
 [% IF ( soundon ) %]
 <audio src="[% interface %]/[% theme %]/sound/beep.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
 [% END %]
+
+  [% IF (forceallow) %]
+      <div id="overridden_debarment" class="dialog alert">Debarment overridden temporarily</div>
+  [% END %]
+
     [% END %] <!-- /impossible -->
 
 [% IF ( issued ) %]
@@ -446,6 +459,7 @@ No patron matched <span class="ex">[% message %]</span>
 <fieldset id="circ_circulation_selectborrower" class="brief">
     <legend>Patron selection</legend>
 
+[% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
     <input type="hidden" name="branch" value="[% branch %]" />
     <input type="hidden" name="printer" value="[% printer %]" />
     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
@@ -484,6 +498,8 @@ No patron matched <span class="ex">[% message %]</span>
         <span id="clearscreen"><a href="/cgi-bin/koha/circ/circulation.pl" title="Clear screen">x</a></span>
     [% END %]
 
+    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
+
     <label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
 
        <div class="hint">Enter item barcode:</div>
@@ -541,6 +557,8 @@ No patron matched <span class="ex">[% message %]</span>
                <h3>[% IF ( noissues ) %]
                        Cannot check out!
                [% ELSE %]Attention:[% END %]</h3>
+
+
                <ul>
 
                        [% IF ( warndeparture ) %]
@@ -609,6 +627,13 @@ No patron matched <span class="ex">[% message %]</span>
 
 
                        </ul>
+
+[% IF (noissues && borrowernumber) %]
+<div class="override_debarment">
+<a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&amp;borrowernumber=[% borrowernumber %]" class="btn btn-small">Override debarment temporarily</a>
+</div>
+[% END %]
+
         </div>
 
                        [% IF ( WaitingReserveLoop ) %]