LP#1284864 MR holds w/o formats disallowed
authorBill Erickson <berick@esilibrary.com>
Fri, 28 Feb 2014 15:07:11 +0000 (10:07 -0500)
committerMike Rylander <mrylander@gmail.com>
Mon, 10 Mar 2014 16:29:52 +0000 (12:29 -0400)
During MR hold placement, if the MR has zero holdable formats, disallow
the hold.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/parts/place_hold.tt2

index 2832f2f..85367aa 100644 (file)
@@ -1202,6 +1202,19 @@ a.dash-link:hover { text-decoration: underline !important; }
 .hold-items-list-title { font-size: [% css_fonts.size_bigger %]; }
 .hold-items-list-problem { color: [% css_colors.text_alert %]; }
 
+.mr_holds_no_formats { 
+  padding: 5px;
+  margin-left: 25px;
+  font-size: 110%;
+  font-weight: bold;
+  color: [% css_colors.text_invert %]; 
+  background: [% css_colors.primary %];
+}
+.holds_item_row_separator td {
+  border-top: 2px dashed [% css_colors.accent_medium %];
+}
+
 .big-strong {font-weight: bold; font-size: [% css_fonts.size_bigger %]; }
 
 .results_header_btns, .results_header_sel {
index 5383753..1a497f7 100644 (file)
@@ -5,6 +5,9 @@
 
 <div id='holds_box' class='canvas' style='margin-top: 6px;'>
     <h1>[% l('Place Hold') %]</h1>
+
+    [% some_holds_allowed = -1 %]
+      
     <form method="post">
         <input type="hidden" name="hold_type" value="[% CGI.param('hold_type') | html %]" />
         [%  
         <table id='hold-items-list'>
         [% FOR hdata IN ctx.hold_data;
             attrs = {marc_xml => hdata.marc_xml};
-            PROCESS get_marc_attrs args=attrs %]
+            PROCESS get_marc_attrs args=attrs;
+            this_hold_disallowed = 0;
+
+            IF CGI.param('hold_type') == 'M';
+              IF hdata.metarecord_filters.formats.size == 0;
+                this_hold_disallowed = 1;
+                # if this is the first hold and it's disallowed, 
+                # assume all holds are, until we proven otherwise
+                SET some_holds_allowed = 0 IF some_holds_allowed == -1;
+              ELSE; some_holds_allowed = 1; END;
+            END %]
+
             <tr>
                 <td>
+                    [% IF !this_hold_disallowed %]
                     <input type="hidden" name="hold_target" value="[% hdata.target.id | html %]" />
+                    [% END %]
                     <div class='hold-items-list-title'>[% attrs.title_extended | html %]</div>
-                    [% IF hdata.parts %]
+                    [% IF hdata.parts AND !this_hold_disallowed %]
                         [% IF hdata.parts.size > 0 %]
                         <div style='padding-left: 10px'>
                             <span><label for='select_hold_part'>[%
                     END %]
                 </td>
             </tr>
+
+            [% IF this_hold_disallowed %]
+              <tr><td>
+                <div class="mr_holds_no_formats">
+                [% l('This item does not have any formats available for holds placement') %]
+                </div>
+              </td></tr>
+            [% END %]
+
+            [%  IF !loop.last AND ctx.hold_data.size > 1 %]
+            <tr class="holds_item_row_separator"><td> </td></tr>
+            [% END %]
+
         [% END %]
         </table>
 
+        [% IF some_holds_allowed %]
+
         <p>
             [%- org_select_id = 'pickup_lib'; -%]
             <label for="[% org_select_id %]">[%l('Pickup location:') %]</label>
                 [% END %]
             </blockquote>
         </p>
-        <input id="place_hold_submit" type="submit" name="submit" value="[% l('Submit') %]" title="[% l('Submit') %]"
+        <input id="place_hold_submit" type="submit" name="submit" 
+            value="[% l('Submit') %]" title="[% l('Submit') %]"
             alt="[% l('Submit') %]" class="opac-button" />
+        [% END # some_holds_allowed %]
         <input type="reset" name="cancel" onclick="javascript:history.go(-1);"
             value="[% l('Cancel') %]" id="holds_cancel" class="opac-button" />
     </form>