TPAC: Don't display serial headers without content user/dbwells/lp1001305_serial_header_display_fix
authorDan Wells <dbw2@calvin.edu>
Wed, 16 Jan 2013 20:05:17 +0000 (15:05 -0500)
committerDan Wells <dbw2@calvin.edu>
Wed, 16 Jan 2013 20:05:17 +0000 (15:05 -0500)
Currently, the TPAC serial display code will print a section
header, then see if there is any content to show.  This causes
headers to show up when they are unnecessary or unwanted.

Now, we only show the header if we have content needing heading.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/parts/record/issues-mfhd.tt2

index 15b9ab9..ced0ec6 100644 (file)
         };
 
         FOREACH serial IN ctx.mfhd_summaries;
-%]
-            <tr>
-                <td class="rdetail-mfhd-head" colspan="2">[% l('Holdings summary ([_1])', serial.location) %]</td>
-            </tr>
-[%
+            printed_mfhd_header = 0;
             FOREACH type IN mfhd.keys;
                 NEXT UNLESS serial.$type.size;
-%]
-            <tr>
-                <td class="rdetail-mfhd-type">[% mfhd.$type %]</td>
-                <td class="rdetail-mfhd-contents">[%
-                    FOR thing IN serial.$type;
-                        thing.join(", ");
-                    END %]</td>
-            </tr>
+                IF !printed_mfhd_header; %]
+                <tr>
+                    <td class="rdetail-mfhd-head" colspan="2">[% l('Holdings summary ([_1])', serial.location) %]</td>
+                </tr>
+                [% printed_mfhd_header = 1;
+                END; %]
+                <tr>
+                    <td class="rdetail-mfhd-type">[% mfhd.$type %]</td>
+                    <td class="rdetail-mfhd-contents">[%
+                        FOR thing IN serial.$type;
+                            thing.join(", ");
+                        END %]</td>
+                </tr>
+            [% END;
+            IF printed_mfhd_header; %]
+                <tr>
+                    <td class="rdetail-mfhd-foot" colspan="2"> </td>
+                </tr>
+            [% END; %]
         [% END %]
-            <tr>
-                <td class="rdetail-mfhd-foot" colspan="2"> </td>
-            </tr>
-    [% END %]
         </tbody></table>
     </div>
 [% END %]