[Koha-patches] [PATCH] Allow renewal limits to be overridden

Galen Charlton galen.charlton at liblime.com
Thu Oct 23 01:11:26 CEST 2008


From: Michael Hafen <mdhafen at tech.washk12.org>

Originally by Jesse Weaver <jesse.weaver at liblime.com>

This patch creates a new system preference, AllowRenewalLimitOverride,
that, if YES, allows the renewal limit to be manually overridden. It
updates C4::Circulation and reserve/renewscript.pl to obey this.

Signed-off-by: Galen Charlton <galen.charlton at liblime.com>
---
 C4/Circulation.pm                                  |    4 +-
 admin/systempreferences.pl                         |    1 +
 circ/circulation.pl                                |   18 ++-
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    4 +-
 installer/data/mysql/updatedatabase.pl             |    7 +
 .../intranet-tmpl/prog/en/css/staff-global.css     |    2 -
 .../prog/en/modules/circ/circulation.tmpl          |  149 ++++++++++++-------
 .../prog/en/modules/members/moremember.tmpl        |   28 ++++
 kohaversion.pl                                     |    2 +-
 members/moremember.pl                              |    5 +-
 reserve/renewscript.pl                             |    3 +-
 12 files changed, 153 insertions(+), 71 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index b9b3771..3e4b0e5 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1877,7 +1877,7 @@ already renewed the loan. $error will contain the reason the renewal can not pro
 sub CanBookBeRenewed {
 
     # check renewal status
-    my ( $borrowernumber, $itemnumber ) = @_;
+    my ( $borrowernumber, $itemnumber, $override_limit ) = @_;
     my $dbh       = C4::Context->dbh;
     my $renews    = 1;
     my $renewokay = 0;
@@ -1912,7 +1912,7 @@ sub CanBookBeRenewed {
         if ( my $data2 = $sth2->fetchrow_hashref ) {
             $renews = $data2->{'renewalsallowed'};
         }
-        if ( $renews && $renews > $data1->{'renewals'} ) {
+        if ( ( $renews && $renews > $data1->{'renewals'} ) || $override_limit ) {
             $renewokay = 1;
         }
         else {
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index c81146e..ef53715 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -135,6 +135,7 @@ my %tabsysprefs;
     $tabsysprefs{useDaysMode}="Circulation";
     $tabsysprefs{ReservesNeedReturns}="Circulation";
     $tabsysprefs{CircAutocompl}="Circulation";
+    $tabsysprefs{AllowRenewalLimitOverride}="Circulation";
     $tabsysprefs{canreservefromotherbranches}="Circulation";
     $tabsysprefs{finesMode}="Circulation";
     $tabsysprefs{emailLibrarianWhenHoldIsPlaced}="Circulation";
diff --git a/circ/circulation.pl b/circ/circulation.pl
index 70e7fd2..6fc2462 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -438,13 +438,14 @@ if ($borrower) {
             $it->{'itemnumber'}, $borrower->{'borrowernumber'}
         );
         $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
-        my $can_renew_error;
-        ($it->{'can_renew'}, $can_renew_error) = CanBookBeRenewed( 
+        my ($can_renew, $can_renew_error) = CanBookBeRenewed( 
             $borrower->{'borrowernumber'},$it->{'itemnumber'}
         );
         $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
         my ( $restype, $reserves ) = CheckReserves( $it->{'itemnumber'} );
-        ( $restype ) and $it->{'can_renew'} = 0;
+		$it->{'can_renew'} = $can_renew;
+		$it->{'can_confirm'} = !$can_renew && !$restype;
+		$it->{'renew_error'} = $restype;
 
         $it->{'dd'} = format_date($it->{'date_due'});
         $it->{'od'} = ( $it->{'date_due'} lt $todaysdate ) ? 1 : 0 ;
@@ -711,10 +712,11 @@ $template->param( picture => 1 ) if $picture;
 
 
 $template->param(
-    debt_confirmed           => $debt_confirmed,
-    SpecifyDueDate           => C4::Context->preference("SpecifyDueDate"),
-    CircAutocompl            => C4::Context->preference("CircAutocompl"),
-    dateformat               => C4::Context->preference("dateformat"),
-    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+    debt_confirmed            => $debt_confirmed,
+    SpecifyDueDate            => C4::Context->preference("SpecifyDueDate"),
+    CircAutocompl             => C4::Context->preference("CircAutocompl"),
+	AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
+    dateformat                => C4::Context->preference("dateformat"),
+    DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar(),
 );
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index baa05ab..1f13910 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -210,4 +210,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
 -- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ?
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo');
 
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 7fe36a0..686c092 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -209,5 +209,7 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
-INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', "S'il est activé, autorise le dépassement des limites du renouvellement sur la page de circulation",NULL,'YesNo');
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index a8468c9..03e13c3 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2033,6 +2033,13 @@ if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.01.00.003";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo')");
+    print "Upgrade to $DBversion done (add new syspref)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index fe946eb..1fa02b2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -761,13 +761,11 @@ fieldset.rows .inputnote {
 	background-color : #FFFF99;
 }
 .content_hidden {
-    visibility:hidden; /* you propably don't need to change this one */
     display:none;
 }
 
 /* the property for the displayed tab */
 .content_visible {
-    visibility:visible; /* you propably don't need to change this one */
     display:block;
 }
 #newbiblio a, #addchild a, #newentry a, #newshelf a, #newmenuc .first-child, #newsupplier .first-child, #newlabel a, #newtemplate a, #newlabelbatch a, #newpatroncardbatch a, #newprofile a, #newsubscription a, #newdictionary a, #neworder a {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index d87dda3..815f66e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -9,26 +9,36 @@
 <script type="text/JavaScript" language="JavaScript">
 //<![CDATA[
 $.tablesorter.addParser({
-    id: 'articles', 
-    is: function(s) {return false;  }, 
-    format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, 
-    type: 'text' 
+    id: 'articles',
+    is: function(s) {return false;  },
+    format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
+    type: 'text'
 });
 	 $(document).ready(function() {
  		$('#patronlists > ul').tabs();
-		$.tablesorter.defaults.widgets = ['zebra']; 
+		$.tablesorter.defaults.widgets = ['zebra'];
 		$("#issuest").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
 		dateFormat: 'uk',<!-- /TMPL_IF -->
 		headers: { 1: { sorter: 'articles' },4:{sorter:false},5: { sorter: false },6:{sorter:false}}
 		});
 		$("#issuest").bind("sortEnd",function() {
         	$("#previous").parents("tr").remove();  // 'previous checkouts' header chokes table sorter
-	    }); 
+	    });
 		$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
 		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[0,0]],
 			headers: { 1: { sorter: 'articles' }}
-		}); 
+		});
+
+        <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
+        $( '#override_limit' ).click( function () {
+            if ( this.checked ) {
+                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
+            } else {
+                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
+            }
+        } ).attr( 'checked', false );
+        <!-- /TMPL_IF -->
 	 });
 //]]>
 </script>
@@ -43,13 +53,13 @@ $.tablesorter.addParser({
 
 <!-- TMPL_IF NAME="CGIselectborrower" -->
 <div id="doc" class="yui-t7">
-   
+
    <div id="bd">
 	<div id="yui-main">
 	<div class="yui-g">
 <!-- TMPL_ELSE -->
 <div id="doc3" class="yui-t2">
-   
+
    <div id="bd">
 	<div id="yui-main">
 	<div class="yui-b">
@@ -94,7 +104,7 @@ $.tablesorter.addParser({
 </ul>
 
 <form method="post" action="/cgi-bin/koha/circ/circulation.pl">
-    
+
 <!-- TMPL_IF NAME="RESERVED" -->
     <p>
     <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" />
@@ -138,7 +148,7 @@ $.tablesorter.addParser({
 
         <!-- TMPL_IF NAME="INVALID_DATE" -->
             <li>The due date is invalid</li>
-        <!-- /TMPL_IF -->  
+        <!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="UNKNOWN_BARCODE" -->
             <li>The barcode was not found</li>
         <!-- /TMPL_IF -->
@@ -177,7 +187,7 @@ $.tablesorter.addParser({
 
         <!-- TMPL_IF NAME="NOTSAMEBRANCH" -->
             <li>This item belongs to <!-- TMPL_VAR NAME="itemhomebranch" --> and cannot be issued from this location.</li>
-        <!-- /TMPL_IF --> 
+        <!-- /TMPL_IF -->
         </ul>
 
     <!-- TMPL_IF NAME="memberofinstution" -->
@@ -231,14 +241,14 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 <fieldset id="circ_circulation_issue">
     <label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->) </label>
 	<div class="hint">Enter item barcode:</div>
-	
+
 	<input type="text" name="barcode" id="barcode" class="barcode focus" size="14" /> <input type="submit" value="Check Out" />
-        
+
     <div class="date-select">
-        <div class="hint">Specify Due Date:</div><input type="text" size="10" id="duedatespec" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />                                                        
+        <div class="hint">Specify Due Date:</div><input type="text" size="10" id="duedatespec" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
 		<img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" alt="Show Calendar"  border="0" id="CalendarDueDate" style="cursor: pointer;" />
              <script language="JavaScript" type="text/javascript">
-			 //<![CDATA[ 
+			 //<![CDATA[
                    function validate1(date) {
                          var today = new Date();
                          if ( date < today ) {
@@ -282,11 +292,11 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                         <input type="hidden" name="oldamount" value="<!-- TMPL_VAR NAME="amountold" -->" />
                 <!-- /TMPL_IF -->
 </div>
-</fieldset> 
+</fieldset>
 </form></div><!-- /TMPL_UNLESS --><!-- /unless noissues -->
 
 <!-- TMPL_IF NAME="noissues" --><div><!-- TMPL_ELSE --><div class="yui-u"><!-- /TMPL_IF -->
-	
+
     <!-- TMPL_IF NAME="flagged" -->
 		<!-- TMPL_IF NAME="noissues" -->
 		 <h4>Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</h4>
@@ -294,17 +304,17 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 		<!-- TMPL_ELSE -->
         <div id="circmessages" class="circmessage attention">
 		<!-- /TMPL_IF -->
-		
+
 		<h3><!-- TMPL_IF NAME="noissues" -->Cannot Check Out!<!-- TMPL_ELSE -->Attention:<!-- /TMPL_IF --></h3>
 		<ul>
-		
+
 			<!-- TMPL_IF NAME = "warndeparture" -->
 			<li><span class="circ-hlt">Expiration:</span> Patron's card will expire soon.
 			Patron's card expires on <!-- TMPL_VAR NAME="expiry" --> <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->">Edit Details</a>
-			
+
 			</li>
 			<!-- /TMPL_IF -->
-			
+
 			<!-- TMPL_IF NAME="returnbeforeexpiry" -->
 			 <li><span class="circ-hlt">Set due date to expiry:</span> You have the ReturnBeforeExpiry system preference enabled this means if the
 			 expiry date is before the date due, the date due will be set to the expiry date
@@ -314,25 +324,25 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 			<!-- TMPL_IF NAME = "expired" -->
 			<li><span class="circ-hlt">Expiration:</span> Patron's card has expired.
 			Patron's card expired on <!-- TMPL_VAR NAME="expiry" --> <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;categorycode=<!-- TMPL_VAR NAME="categorycode" -->">Edit Details</a>
-			
+
 			</li>
 			<!-- /TMPL_IF -->
 
             <!-- TMPL_IF NAME="gna" -->
 			<li class="blocker"><span class="circ-hlt">Address:</span> Patron's address in doubt</li>
 			<!-- /TMPL_IF -->
-			
+
             <!-- TMPL_IF NAME="lost" -->
 			<li class="blocker"><span class="circ-hlt">Lost: </span>Patron's card is lost</li>
 			<!-- /TMPL_IF -->
-			
+
             <!-- TMPL_IF NAME="dbarred" --><li class="blocker">
                <span class="circ-hlt"> Restricted:</span> Patron's account is restricted <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&amp;destination=circ&amp;status=0">Lift restriction</a>
 </li><!-- /TMPL_IF -->
 
         	<!-- TMPL_IF name="odues" --><li><!-- TMPL_IF name="nonreturns" --><span class="circ-hlt">Overdues:</span> Patron has <span class="circ-hlt">ITEMS OVERDUE</span>. See highlighted items <a href="#checkouts">below</a><!-- /TMPL_IF --></li>
             <!-- /TMPL_IF -->
-			
+
         	<!-- TMPL_IF NAME="charges" -->
                 <!-- TMPL_IF NAME="charges_is_blocker" -->
 			        <li class="blocker">
@@ -350,19 +360,19 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 			<li><span class="circ-hlt">Credits:</span> Patron has a credit</li>
 			<!-- /TMPL_IF -->
 
-			
+
 
 			</ul>
         </div>
 
-			<!-- TMPL_IF NAME="WaitingReserveLoop" -->	
+			<!-- TMPL_IF NAME="WaitingReserveLoop" -->
 			<div id="holdswaiting" class="circmessage">
 		    <h4>Holds waiting:</h4>
 			        <!-- TMPL_LOOP NAME="WaitingReserveLoop" -->
 			            <ul> 
 			                <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --></a> (<!-- TMPL_VAR NAME="itemtype"-->), <!-- TMPL_IF NAME="author" -->by <!-- TMPL_VAR NAME="author"--><!-- /TMPL_IF --> Hold placed on <!-- TMPL_VAR NAME="reservedate"-->.
 			            <!-- TMPL_IF NAME="waitingat" -->
-			                <br /><!-- TMPL_IF NAME="waitinghere" --><strong class="waitinghere"><!-- TMPL_ELSE --><strong><!-- /TMPL_IF -->Waiting at <!-- TMPL_VAR NAME="waitingat" --></strong>	
+			                <br /><!-- TMPL_IF NAME="waitinghere" --><strong class="waitinghere"><!-- TMPL_ELSE --><strong><!-- /TMPL_IF -->Waiting at <!-- TMPL_VAR NAME="waitingat" --></strong>
 			            <!-- /TMPL_IF -->
 			                </li>
 			            </ul>
@@ -374,7 +384,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 			<h4>Notes:</h4>
             <p><span class="circ-hlt"><!-- TMPL_VAR name="notesmsg" --></span></p>
 			</div>
-    <!-- /If notes --><!-- /TMPL_IF --> 
+    <!-- /If notes --><!-- /TMPL_IF -->
      <!-- /If flagged --><!-- /TMPL_IF -->
 
 
@@ -383,7 +393,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 
 <div class="yui-g"><div id="patronlists" class="toptabs">
 
-<ul>   
+<ul>
 <li>    <!--TMPL_IF NAME="issuecount"-->
             <a href="/cgi-bin/koha/circ/circulation.pl#checkouts"><!-- TMPL_VAR NAME="issuecount"--> Checkout(s)</a>
     <!-- TMPL_ELSE -->
@@ -394,7 +404,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
     <!-- TMPL_ELSE -->
             <a href="/cgi-bin/koha/circ/circulation.pl#reserves">0 Holds</a>
     <!-- /TMPL_IF --></li>
- 
+
 </ul>
 
 <!-- SUMMARY : TODAY & PREVIOUS ISSUES -->
@@ -404,7 +414,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
     <input type="hidden" value="circ" name="destination" />
     <input type="hidden" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
-    <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />	
+    <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
         <table id="issuest">
     <thead><tr>
         <th>Due date</th>
@@ -435,21 +445,34 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
         <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
         <td>
-		<!-- TMPL_IF NAME="can_renew" -->
+        <!-- TMPL_IF NAME="can_renew" -->
         <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
         <!-- TMPL_IF NAME="od" -->
             <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
         <!-- TMPL_ELSE -->
             <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
         <!-- /TMPL_IF -->
-		<!-- TMPL_ELSE -->
-		    <!-- TMPL_IF NAME="renew_error_on_reserve" -->
-			    On Hold
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF NAME="renew_error_too_many" -->
-			    Too Many Renewals
-			<!-- /TMPL_IF -->
+        <!-- TMPL_ELSE -->
+            <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed content_hidden">
+                <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
+                <!-- TMPL_IF NAME="od" -->
+                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+                <!-- TMPL_ELSE -->
+                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+                <!-- /TMPL_IF -->
+                </span>
+                <span class="renewals-disabled">
+            <!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="renew_error_on_reserve" -->
+			On Hold
 		<!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="renew_error_too_many" -->
+			Too Many Renewals
+                <!-- /TMPL_IF -->
+            <!-- TMPL_IF NAME="can_confirm" -->
+                </span>
+            <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
         </td>
 		<td><a href="/cgi-bin/koha/circ/returns.pl?barcode=<!-- TMPL_VAR NAME="barcode" -->">Check In</a></td>
 		<!-- TMPL_IF NAME="renew_failed" -->
@@ -482,22 +505,34 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
         <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
         <td>
-		<!-- TMPL_IF NAME="can_renew" -->
-            <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
+        <!-- TMPL_IF NAME="can_renew" -->
+        <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
         <!-- TMPL_IF NAME="od" -->
             <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
         <!-- TMPL_ELSE -->
             <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
         <!-- /TMPL_IF -->
-		<!-- TMPL_ELSE -->
-		    <!-- TMPL_IF NAME="renew_error_on_reserve" -->
-			    On Hold
-			<!-- /TMPL_IF -->
-			<!-- TMPL_IF NAME="renew_error_too_many" -->
-			    Too Many Renewals
-			<!-- /TMPL_IF -->
-			
+        <!-- TMPL_ELSE -->
+            <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed content_hidden">
+                <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
+                <!-- TMPL_IF NAME="od" -->
+                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+                <!-- TMPL_ELSE -->
+                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+                <!-- /TMPL_IF -->
+                </span>
+                <span class="renewals-disabled">
+            <!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="renew_error_on_reserve" -->
+			On Hold
 		<!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="renew_error_too_many" -->
+			Too Many Renewals
+                <!-- /TMPL_IF -->
+            <!-- TMPL_IF NAME="can_confirm" -->
+                </span>
+            <!-- /TMPL_IF -->
+        <!-- /TMPL_IF -->
         </td>
 		<td><a href="/cgi-bin/koha/circ/returns.pl?barcode=<!-- TMPL_VAR NAME="barcode" -->">Check In</a></td>
 		<!-- TMPL_IF NAME="renew_failed" -->
@@ -505,12 +540,16 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 		<!-- /TMPL_IF -->
 
     </tr>
-    <!-- /loop previssues --><!-- /TMPL_LOOP --> 
-<!--/if previssues --><!-- /TMPL_IF --> 
+    <!-- /loop previssues --><!-- /TMPL_LOOP -->
+<!--/if previssues --><!-- /TMPL_IF -->
 	</tbody>
     </table>
-	<!--TMPL_IF NAME="issuecount"-->
+    <!--TMPL_IF NAME="issuecount"-->
     <fieldset class="action">
+    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
+        <label for="override_limit">Override Renewal Limit:</label>
+        <input type="checkbox" name="override_limit" id="override_limit" value="1" />
+    <!-- /TMPL_IF -->
     <input type="submit" name="renew_checked" value="Renew Checked Items" />
     <input type="submit" name="renew_all" value="Renew All" />
     </fieldset>
@@ -548,7 +587,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                         <!-- /TMPL_IF -->
                         <!-- TMPL_IF name="nottransfered" --> hasn't been transfered yet from <!-- TMPL_VAR NAME="nottransferedby" --></i>
                         <!-- /TMPL_IF --></em></td>
-                    <td>                    
+                    <td>
                         <!-- TMPL_IF NAME="waitingposition" -->
                         Hold priority
                         <b> <!-- TMPL_VAR NAME="waitingposition" --> </b><!-- /TMPL_IF -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
index f42fcaf..4a9913c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
@@ -41,6 +41,16 @@ $(document).ready(function() {
     $("#CheckNoitems").click(function(){ $(".checkboxed").unCheckCheckboxes(":not(input[@name*=barcodes])"); return false; });
 	$("#CheckAllreturns").click(function(){ $(".checkboxed").checkCheckboxes(":not(input[@name*=items])"); $(".checkboxed").unCheckCheckboxes(":not(input[@name*=barcodes])"); return false; });
     $("#CheckNoreturns").click(function(){ $(".checkboxed").unCheckCheckboxes(":not(input[@name*=items])"); return false; });
+
+    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
+    $( '#override_limit' ).click( function () {
+        if ( this.checked ) {
+           $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
+        } else {
+           $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
+        }
+    } ).attr( 'checked', false );
+    <!-- /TMPL_IF -->
  });
 function uncheck_sibling(me){
 nodename=me.getAttribute("name");
@@ -65,6 +75,7 @@ if (nodename =="barcodes[]"){
    }   
 }
 }
+
 //]]>
 </script>
 
@@ -381,12 +392,25 @@ if (nodename =="barcodes[]"){
       <!-- TMPL_ELSE -->
             <td>
             <!-- TMPL_IF name="norenew" -->
+                <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed content_hidden">
+                    <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
+                    <!-- TMPL_IF NAME="od" -->
+                        <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+                    <!-- TMPL_ELSE -->
+                        <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+                    <!-- /TMPL_IF -->
+                    </span>
+                    <span class="renewals-disabled">
+                <!-- /TMPL_IF -->
 			      <!-- TMPL_IF NAME="norenew_reason_on_reserve" -->
               <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">On Hold</a>
 				    <!-- /TMPL_IF -->
 				    <!-- TMPL_IF NAME="norenew_reason_too_many" -->
 				        Too Many Renewals
 				    <!-- /TMPL_IF -->
+                <!-- TMPL_IF NAME="can_confirm" -->
+                    </span>
+                <!-- /TMPL_IF -->
             <!-- TMPL_ELSE -->
             <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
             <!-- TMPL_IF NAME="red" -->
@@ -430,6 +454,10 @@ if (nodename =="barcodes[]"){
         </tr>
         </table>
         <fieldset class="action">
+        <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
+        <label for="override_limit">Override Renewal Limit:</label>
+        <input type="checkbox" name="override_limit" id="override_limit" value="1" />
+        <!-- /TMPL_IF -->
         <input type="submit" name="renew_checked" value="Renew or Return checked items" />
         <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
         <input type="submit" id="return_all" name="return_all" value="Return all" />
diff --git a/kohaversion.pl b/kohaversion.pl
index 6449588..e849ae1 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.002';
+    our $VERSION = '3.01.00.003';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/members/moremember.pl b/members/moremember.pl
index b0299f2..03d3323 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -62,6 +62,7 @@ my $dbh = C4::Context->dbh;
 my $input = new CGI;
 $debug or $debug = $input->param('debug') || 0;
 my $print = $input->param('print');
+my $override_limit = $input->param("override_limit") || 0;
 my @failedrenews = $input->param('failedrenew');
 my @failedreturns = $input->param('failedreturn');
 my $error = $input->param('error');
@@ -245,8 +246,9 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
 
     $row{'charge'} = sprintf( "%.2f", $charge );
 
-	my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'});
+	my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit );
 	$row{'norenew'} = !$renewokay;
+	$row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
 	$row{"norenew_reason_$renewerror"} = 1 if $renewerror;
 	$row{'renew_failed'} = $renew_failed{ $issue->[$i]{'itemnumber'} };
 	$row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}};   
@@ -349,6 +351,7 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
 
 $template->param(
 	detailview => 1,
+    AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
   DHTMLcalendar_dateformat=>C4::Dates->DHTMLcalendar(), 
     roaddetails      => $roaddetails,
     borrowernumber   => $borrowernumber,
diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl
index 48e6076..f4b2a65 100755
--- a/reserve/renewscript.pl
+++ b/reserve/renewscript.pl
@@ -75,10 +75,11 @@ if ($input->param('newduedate')){
 my $cardnumber = $input->param("cardnumber");
 my $borrowernumber = $input->param("borrowernumber");
 my $exemptfine = $input->param("exemptfine") || 0;
+my $override_limit = $input->param("override_limit") || 0;
 my $failedrenews;
 foreach my $itemno (@data) {
     # check status before renewing issue
-	my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno);
+	my ($renewokay,$error) = CanBookBeRenewed($borrowernumber,$itemno,$override_limit);
     if ($renewokay){
         AddRenewal($borrowernumber,$itemno,$branch,$datedue);
     }
-- 
1.5.5.GIT



More information about the Koha-patches mailing list