[Koha-patches] [PATCH] Fix for Bug 4950 - checkbox should be removed when can't place a hold

Owen Leonard oleonard at myacpl.org
Fri Jul 9 17:53:01 CEST 2010


- Hiding form controls for titles which can't be placed on hold
- Highlighting hold blocked message for better visibility
- Showing table of blocked holds even if none can be placed on
  hold: hiding the table hides the messages explaining why
  titles can't be placed on hold
- Removing an unused line from the script which was leaving errors
  in the error log
- Consolidating error messages into one box which were displaying
  in two.
- Correcting link to unused opac-userdetails.pl
---
 koha-tmpl/opac-tmpl/prog/en/css/opac.css           |    4 +-
 .../opac-tmpl/prog/en/modules/opac-reserve.tmpl    |  364 ++++++++++----------
 opac/opac-reserve.pl                               |   10 +-
 3 files changed, 187 insertions(+), 191 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index 5142dd2..fb9f1fc 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -1406,6 +1406,7 @@ div#changelanguage{
 	color : #666;
 	font-size : 85%;
 	padding : 1em;
+	margin-top : 2em;
  }
  
 div#changelanguage a {
@@ -1957,4 +1958,5 @@ div.ft {
 	font-size:90%;
 	list-style:disc outside url("../../images/item-bullet.gif");
 	padding:0.2em 0;
-}
\ No newline at end of file
+}
+div.bibmessage { background-color : #ffffb0; border-radius : 5px; padding : 3px; margin : 2px; }
\ No newline at end of file
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
index 812c91b..0fa3a2b 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
@@ -160,27 +160,23 @@
     <div id="bd">
 	  <div id="yui-g">
         <div id="holds" class="container">
-
-          <!-- TMPL_IF NAME="message" -->
+        <!-- TMPL_IF NAME="message" -->
             <!-- TMPL_IF NAME="GNA" -->
-              <div class="dialog alert">
-                <strong>Sorry</strong>, you cannot place holds because the library doesn't have up-to-date <a href="/cgi-bin/koha/opac-userdetails.pl">contact information</a> on file.
-              </div>
-              <div class="dialog alert">Please contact your librarian, or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)
+              <div id="gna" class="dialog alert">
+                <p><strong>Sorry</strong>, you cannot place holds because the library doesn't have up-to-date <a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a> on file.</p>
+              <p>Please contact your librarian, or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)</p>
               </div>
             <!-- /TMPL_IF -->
             <!-- TMPL_IF NAME="lost" -->
-              <div class="dialog alert">
-                <strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.
-              </div>
-              <div class="dialog alert">If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.
+              <div id="lost" class="dialog alert">
+                <p><strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.</p>
+                <p>If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.</p>
               </div>
             <!-- /TMPL_IF -->
             <!-- TMPL_IF NAME="debarred" -->
-              <div class="dialog alert">
-                <strong>Sorry</strong>, you cannot place holds because your account has been frozen.
-              </div>
-              <div class="dialog alert">Usually the reason for freezing an account is old overdues or damage fees.   If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please consult a librarian.
+              <div id="debarred" class="dialog alert">
+                <p><strong>Sorry</strong>, you cannot place holds because your account has been frozen.</p>
+                <p>Usually the reason for freezing an account is old overdues or damage fees.   If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please consult a librarian.</p>
               </div>
             <!-- /TMPL_IF -->
             <!-- TMPL_IF NAME="too_much_oweing" -->
@@ -211,18 +207,18 @@
             <!-- TMPL_IF NAME="bad_data" -->
               <div class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
             <!-- /TMPL_IF -->
+          <!-- TMPL_ELSE -->
             <!-- TMPL_IF NAME="none_available" -->
-              <div class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
-              </div>
-            <!-- /TMPL_IF -->
+                <div class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
+                </div>
+              <!-- /TMPL_IF -->
           <!-- /TMPL_IF --><!-- NAME="message" -->
 
-          <!-- TMPL_UNLESS NAME="message" -->
-              <h3>Confirm holds for:
-                <!-- TMPL_LOOP NAME="USER_INFO" -->
-                  <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)
-                <!-- /TMPL_LOOP -->
-              </h3>
+      <!-- TMPL_UNLESS NAME="message" --><!-- TMPL_UNLESS NAME="none_available" --><h3>Confirm holds for:
+                      <!-- TMPL_LOOP NAME="USER_INFO" -->
+                        <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)
+                      <!-- /TMPL_LOOP -->
+                    </h3><!-- /TMPL_UNLESS -->
 
             <form action="/cgi-bin/koha/opac-reserve.pl" method="post">
             <input type="hidden" name="place_reserve" value="1"/>
@@ -232,8 +228,8 @@
             <input type="hidden" name="selecteditems" id="selections"/>
             <div id="bigloop">
               <table id="bibitemloop">
-                <tr>
-                  <th colspan="2">Hold</th>
+                <!-- TMPL_UNLESS NAME="none_available" --><tr>
+                  <th>Hold</th>
                   <th>Title</th>
                   <!-- TMPL_UNLESS NAME="item-level_itypes" -->
                     <th>Item Type</th>
@@ -251,12 +247,12 @@
                   <!-- TMPL_UNLESS NAME="singleBranchMode" -->
                     <th>Pickup Location</th>
                   <!-- /TMPL_UNLESS -->
-                </tr>
+                </tr><!-- TMPL_ELSE --><tr><th colspan="5">Title</th></tr><!-- /TMPL_UNLESS -->
 
                 <!-- TMPL_LOOP name="bibitemloop" -->
                   <tr>
                       <!-- TMPL_IF NAME="holdable" -->
-					  <td colspan="2">
+					  <td>
                       <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
                       <input class="single_bib" name="single_bib" type="hidden" value="<!-- TMPL_VAR NAME="biblionumber" -->"/>
                         <span class="confirmjs_hold" title="<!-- TMPL_VAR NAME="biblionumber" -->"></span>
@@ -269,173 +265,170 @@
                         </span>
 					</td>
                       <!-- TMPL_ELSE -->
-					  <td>
-                      <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
-                      <input class="single_bib" name="single_bib" type="hidden" value="<!-- TMPL_VAR NAME="biblionumber" -->"/>
-                        <span class="confirmjs_nohold" title="<!-- TMPL_VAR NAME="biblionumber" -->"></span>
-                        <span class="confirm_nonjs">
-                          <input type="radio" class="confirmbox checkitem <!-- TMPL_VAR NAME="checkitem_bib" -->"
-                                 name="<!-- TMPL_VAR NAME="checkitem_bib" -->" disabled="disabled"
-                                 id="<!-- TMPL_VAR NAME="checkitem_bib" -->"
-                                 value="any" />
-                        </span>
-					</td><td>
+					  <!-- TMPL_UNLESS NAME="none_available" --><td>&nbsp;</td><!-- /TMPL_UNLESS -->
+                      <!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="holdable" --><td><!-- TMPL_ELSE --><td colspan="5"><!-- /TMPL_IF -->
+                      <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --><!-- TMPL_IF NAME="subtitle" --> <!-- TMPL_LOOP NAME="subtitle" --><!--TMPL VAR Name="subfield"--><!--/TMPL_LOOP--><!-- /TMPL_IF --></a>
+                      <!-- TMPL_IF NAME="author" -->,  by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --> 
+
+                      <!-- TMPL_UNLESS NAME="holdable" -->
+
                         <!-- TMPL_IF NAME="already_reserved" -->
                           <div class="bibmessage">You have already requested this title.</div>
-                        <!-- /TMPL_IF -->
-                        <!-- TMPL_UNLESS NAME="bib_available" -->
-                          <div class="bibmessage">No available items.</div>
                         <!-- TMPL_ELSE -->
-                          <div class="bibmessage">This title cannot be requested.</div>
+                          <!-- TMPL_UNLESS NAME="bib_available" -->
+                            <div class="bibmessage">No available items.</div>
+                          <!-- TMPL_ELSE -->
+                            <div class="bibmessage">This title cannot be requested.</div>
+                          <!-- /TMPL_UNLESS -->
+                        <!-- /TMPL_IF -->
+
+
                         <!-- /TMPL_UNLESS -->
+
                     </td>
-                      <!-- /TMPL_IF -->
-                    <td>
-                      <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" escape="html" --><!-- TMPL_IF NAME="subtitle" --> <!-- TMPL_LOOP NAME="subtitle" --><!--TMPL VAR Name="subfield"--><!--/TMPL_LOOP--><!-- /TMPL_IF --></a>
-                      <!-- TMPL_IF NAME="author" -->,  by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF -->
-                    </td>
-                    <!-- TMPL_UNLESS NAME="item-level_itypes" -->
-                      <td>
-                        <!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="" /><!-- /TMPL_IF -->
-						<!-- TMPL_VAR NAME="description" -->
-                      </td>
-                    <!-- /TMPL_UNLESS -->
-                    <!-- TMPL_IF NAME="showpriority" --><td><!-- TMPL_VAR name="rank" --> out of <!-- TMPL_VAR NAME="reservecount" --></td><!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="holdable" --><!-- TMPL_UNLESS NAME="item-level_itypes" -->
+                                          <td>
+                                            <!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="" /><!-- /TMPL_IF -->
+                                <!-- TMPL_VAR NAME="description" -->
+                                          </td>
+                                        <!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="holdable" --><!-- TMPL_IF NAME="showpriority" --><td><!-- TMPL_VAR name="rank" --> out of <!-- TMPL_VAR NAME="reservecount" --></td><!-- /TMPL_IF --><!-- /TMPL_IF -->
 		    <!-- TMPL_IF NAME="reserve_in_future" -->
-		    <td>
-			<input name="reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->" id="reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->" size="10">
-		  <script language="JavaScript" type="text/javascript">
-			//<![CDATA[
-			$("#reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->").attr( 'readonly', 'readonly' );
-
-			var cal_img = document.createElement('img');
-			cal_img.src = "<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif";
-			cal_img.alt = "Show Calendar";
-			cal_img.border = "0";
-			cal_img.id = "CalendarReserveDate<!-- TMPL_VAR NAME="biblionumber" -->";
-			cal_img.style.cursor = "pointer";
-			document.getElementById("reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->").parentNode.appendChild( cal_img );
-
-			function validate<!-- TMPL_VAR NAME="biblionumber" -->(date) {
-			    var today = new Date();
-                if ( (date > today) ||
-                        ( date.getDate() == today.getDate() &&
-                          date.getMonth() == today.getMonth() &&
-                          date.getFullYear() == today.getFullYear() ) ) {
-                    return false;
-                } else {
-                    return true;
-                }
-			};
-			Calendar.setup(
-			{
-				inputField : "reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->",
-				ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
-				button : "CalendarReserveDate<!-- TMPL_VAR NAME="biblionumber" -->",
-				disableFunc : validate<!-- TMPL_VAR NAME="biblionumber" -->,
-				dateStatusFunc : validate<!-- TMPL_VAR NAME="biblionumber" -->,
-			}
-			);
-			//]]>
-			</script>
-		    </td>
+		    <!-- TMPL_IF NAME="holdable" --><td>
+              <input name="reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->" id="reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->" size="10">
+              <script language="JavaScript" type="text/javascript">
+              //<![CDATA[
+              $("#reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->").attr( 'readonly', 'readonly' );
+
+              var cal_img = document.createElement('img');
+              cal_img.src = "<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif";
+              cal_img.alt = "Show Calendar";
+              cal_img.border = "0";
+              cal_img.id = "CalendarReserveDate<!-- TMPL_VAR NAME="biblionumber" -->";
+              cal_img.style.cursor = "pointer";
+              document.getElementById("reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->").parentNode.appendChild( cal_img );
+
+              function validate<!-- TMPL_VAR NAME="biblionumber" -->(date) {
+                  var today = new Date();
+                        if ( (date > today) ||
+                                ( date.getDate() == today.getDate() &&
+                                  date.getMonth() == today.getMonth() &&
+                                  date.getFullYear() == today.getFullYear() ) ) {
+                            return false;
+                        } else {
+                            return true;
+                        }
+              };
+              Calendar.setup(
+              {
+                inputField : "reserve_date_<!-- TMPL_VAR NAME="biblionumber" -->",
+                ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+                button : "CalendarReserveDate<!-- TMPL_VAR NAME="biblionumber" -->",
+                disableFunc : validate<!-- TMPL_VAR NAME="biblionumber" -->,
+                dateStatusFunc : validate<!-- TMPL_VAR NAME="biblionumber" -->,
+              }
+              );
+              //]]>
+              </script>
+                </td><!-- /TMPL_IF -->
 
 		    <!-- /TMPL_IF -->
-	<td>
-	    <input name="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" id="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" size="10" readonly="readonly" />
-	    <img src="<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate_<!-- TMPL_VAR NAME="biblionumber" -->" style="cursor: pointer;" />
-	    <script language="JavaScript" type="text/javascript">
-		//<![CDATA[
-		function validate1(date) {
-			var today = new Date();
-			if ( (date > today) ||
-                    ( date.getDate() == today.getDate() &&
-                      date.getMonth() == today.getMonth() &&
-                      date.getFullYear() == today.getFullYear() ) ) {
-				return false;
-			} else {
-				return true;
-			}
-		};
-		Calendar.setup(
-			{
-				inputField : "expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->",
-				ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
-				button : "CalendarExpirationDate_<!-- TMPL_VAR NAME="biblionumber" -->",
-				disableFunc : validate1,
-				dateStatusFunc : validate1,
-			}
-		);
-		//]]>
-	    </script>
-		<p style="margin:.3em 2em;">
-		<a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->').value='';return false;">Clear Date</a></p>
-	</td>
-
-                    <!-- TMPL_IF NAME="OPACItemHolds" -->
-                      <td class="place_on_type" style="display:none">
-                        <table>
-                          <tr>
-                            <td>
-                              <!-- TMPL_UNLESS NAME="holdable" -->
-                                <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       class="selectany"
-                                       value="Any"
-                                       disabled="disabled"
-                                />
-                              <!-- TMPL_ELSE -->
-                                <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       class="selectany"
-                                       value="Any"
-                                       checked="checked"
-                                />
-                              <!-- /TMPL_UNLESS -->
-                              <label for="reqany_<!-- TMPL_VAR NAME="biblionumber" -->">Next available copy</label>
-                            </td>
-                          </tr>
-                          <tr>
-                            <td>
-                              <!-- TMPL_UNLESS NAME="holdable" -->
-                                <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       id="reqspecific_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       class="selectspecific"
-                                       disabled="disabled"
-                                       value="Specific"
-                                />
-                              <!-- TMPL_ELSE -->
-                                <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       id="reqspecific_<!-- TMPL_VAR NAME="biblionumber" -->"
-                                       class="selectspecific"
-                                       value="Specific"
-                                />
-                              <!-- /TMPL_UNLESS -->
-                              <label for="reqspecific_<!-- TMPL_VAR NAME="biblionumber"-->">A specific copy</label>
-                            </td>
-                          </tr>
-                        </table>
-                      </td>
-                    <!-- /TMPL_IF -->
+	<!-- TMPL_IF NAME="holdable" --><td>
+        <input name="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" id="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" size="10" readonly="readonly" />
+        <img src="<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate_<!-- TMPL_VAR NAME="biblionumber" -->" style="cursor: pointer;" />
+        <script language="JavaScript" type="text/javascript">
+      //<![CDATA[
+      function validate1(date) {
+        var today = new Date();
+        if ( (date > today) ||
+                      ( date.getDate() == today.getDate() &&
+                        date.getMonth() == today.getMonth() &&
+                        date.getFullYear() == today.getFullYear() ) ) {
+          return false;
+        } else {
+          return true;
+        }
+      };
+      Calendar.setup(
+        {
+          inputField : "expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->",
+          ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+          button : "CalendarExpirationDate_<!-- TMPL_VAR NAME="biblionumber" -->",
+          disableFunc : validate1,
+          dateStatusFunc : validate1,
+        }
+      );
+      //]]>
+        </script>
+      <p style="margin:.3em 2em;">
+      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->').value='';return false;">Clear Date</a></p>
+    </td><!-- /TMPL_IF -->
+
+                    <!-- TMPL_IF NAME="holdable" --><!-- TMPL_IF NAME="OPACItemHolds" -->
+                                          <td class="place_on_type" style="display:none">
+                                            <table>
+                                              <tr>
+                                                <td>
+                                                  <!-- TMPL_UNLESS NAME="holdable" -->
+                                                    <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           class="selectany"
+                                                           value="Any"
+                                                           disabled="disabled"
+                                                    />
+                                                  <!-- TMPL_ELSE -->
+                                                    <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           class="selectany"
+                                                           value="Any"
+                                                           checked="checked"
+                                                    />
+                                                  <!-- /TMPL_UNLESS -->
+                                                  <label for="reqany_<!-- TMPL_VAR NAME="biblionumber" -->">Next available copy</label>
+                                                </td>
+                                              </tr>
+                                              <tr>
+                                                <td>
+                                                  <!-- TMPL_UNLESS NAME="holdable" -->
+                                                    <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           id="reqspecific_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           class="selectspecific"
+                                                           disabled="disabled"
+                                                           value="Specific"
+                                                    />
+                                                  <!-- TMPL_ELSE -->
+                                                    <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           id="reqspecific_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                           class="selectspecific"
+                                                           value="Specific"
+                                                    />
+                                                  <!-- /TMPL_UNLESS -->
+                                                  <label for="reqspecific_<!-- TMPL_VAR NAME="biblionumber"-->">A specific copy</label>
+                                                </td>
+                                              </tr>
+                                            </table>
+                                          </td>
+                                        <!-- /TMPL_IF --><!-- /TMPL_IF -->
 
                     <!-- TMPL_UNLESS NAME="singleBranchMode" -->
-                      <td>
-                        <select name="branch" id="branch_<!-- TMPL_VAR NAME="biblionumber" -->"
-                          <!-- TMPL_UNLESS NAME="holdable" -->disabled="disabled"<!-- /TMPL_UNLESS --> >
-                          <!-- TMPL_LOOP NAME="branchChoicesLoop" -->
-                            <!-- TMPL_IF name="selected" -->
-                              <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
-                            <!-- TMPL_ELSE -->
-                              <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
-                            <!-- /TMPL_IF -->
-                          <!-- /TMPL_LOOP -->
-                        </select>
-                      </td>
+                      <!-- TMPL_IF NAME="holdable" --><td>
+                                              <select name="branch" id="branch_<!-- TMPL_VAR NAME="biblionumber" -->"
+                                                <!-- TMPL_UNLESS NAME="holdable" -->disabled="disabled"<!-- /TMPL_UNLESS --> >
+                                                <!-- TMPL_LOOP NAME="branchChoicesLoop" -->
+                                                  <!-- TMPL_IF name="selected" -->
+                                                    <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
+                                                  <!-- TMPL_ELSE -->
+                                                    <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
+                                                  <!-- /TMPL_IF -->
+                                                <!-- /TMPL_LOOP -->
+                                              </select>
+                                            </td><!-- /TMPL_IF -->
                     <!-- /TMPL_UNLESS -->
                   </tr>
 
                   <!-- TMPL_IF NAME="OPACItemHolds" -->
-                  <!-- TMPL_IF NAME="bib_available" -->
+                  <!-- TMPL_IF NAME="holdable" -->
                     <tr class="copiesrow" id="copiesrow_<!-- TMPL_VAR NAME="biblionumber"-->">
                       <td colspan="1">
                       </td>
@@ -517,18 +510,17 @@
                   <!-- /TMPL_IF --><!-- OPACItemHolds -->
                 <!-- /TMPL_LOOP -->
               </table><!-- bibitemloop -->
+              <!-- /TMPL_UNLESS --> <!-- if message -->
             </div><!-- bigloop -->
 
-            <!-- TMPL_IF NAME="none_available" -->
-            <input type="submit" disabled="disabled" value="Place Hold" />
-            <!-- TMPL_ELSE -->
+            <!-- TMPL_UNLESS NAME="message" -->
+            <!-- TMPL_UNLESS NAME="none_available" -->
             <input type="submit" value="Place Hold" class="placehold" />
-            <!-- /TMPL_IF -->
+            <!-- /TMPL_UNLESS -->
+            <!-- /TMPL_UNLESS -->
 
             </form>
 
-          <!-- /TMPL_UNLESS --><!-- message -->
-
         </div><!-- holds -->
       </div><!-- yui-g -->
     </div><!-- bd    -->
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index d5d39db..5e040c0 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -288,6 +288,7 @@ my $notforloan_label_of = get_notforloan_label_of();
 my $biblioLoop = [];
 my $numBibsAvailable = 0;
 my $itemdata_enumchron = 0;
+my $anyholdable;
 my $itemLevelTypes = C4::Context->preference('item-level_itypes');
 $template->param('item-level_itypes' => $itemLevelTypes);
 
@@ -335,8 +336,6 @@ foreach my $biblioNum (@biblionumbers) {
         }
     }
 
-    $biblioLoopIter{itemTypeDescription} = $itemTypes->{$biblioData->{itemtype}}{description};
-
     $biblioLoopIter{itemLoop} = [];
     my $numCopiesAvailable = 0;
     foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
@@ -454,19 +453,22 @@ foreach my $biblioNum (@biblionumbers) {
         $numBibsAvailable++;
         $biblioLoopIter{bib_available} = 1;
         $biblioLoopIter{holdable} = 1;
+        $anyholdable = 1;
     }
     if ($biblioLoopIter{already_reserved}) {
         $biblioLoopIter{holdable} = undef;
+        $anyholdable = undef;
     }
     if(not CanBookBeReserved($borrowernumber,$biblioNum)){
         $biblioLoopIter{holdable} = undef;
+        $anyholdable = undef;
     }
 
     push @$biblioLoop, \%biblioLoopIter;
 }
 
-if ( $numBibsAvailable == 0 ) {
-    $template->param( none_available => 1, message => 1 );
+if ( $numBibsAvailable == 0 || !$anyholdable) {
+    $template->param( none_available => 1 );
 }
 
 my $itemTableColspan = 5;
-- 
1.7.0.4



More information about the Koha-patches mailing list