[Koha-patches] [PATCH] Bugfix: Enabling guide box configuration parameter

Chris Nighswonger cnighswonger at foundations.edu
Mon Feb 8 21:23:58 CET 2010


This patch enables turning the guide boxes on/off in the patron
cards layout editor.
---
 .../prog/en/modules/patroncards/edit-layout.tmpl   |   15 ++++++++++++---
 patroncards/create-pdf.pl                          |    2 +-
 patroncards/edit-layout.pl                         |    2 ++
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tmpl
index 188b88e..cc22661 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tmpl
@@ -179,12 +179,21 @@
                                     <label for="page_side">Page Side:</label>
                                     <!-- TMPL_IF NAME="page_side" -->
                                     <input type="radio" name="page_side" id="page_side" value="F" />Front
-                                    <input type="radio" name="page_side" id="page_side" value="B" checked />Back
+                                    <input type="radio" name="page_side" id="page_side" value="B" checked="checked" />Back
                                     <!-- TMPL_ELSE -->
-                                    <input type="radio" name="page_side" id="page_side" value="F" checked />Front
+                                    <input type="radio" name="page_side" id="page_side" value="F" checked="checked" />Front
                                     <input type="radio" name="page_side" id="page_side" value="B" />Back
                                     <!-- /TMPL_IF -->
-
+                                </li>
+                                <li>
+                                    <label for="guide_box">Guide Box:</label>
+                                    <!-- TMPL_IF NAME="guide_box" -->
+                                    <input type="radio" name="guide_box" id="guide_box" value="1" checked="checked" />On
+                                    <input type="radio" name="guide_box" id="guide_box" value="0" />Off
+                                    <!-- TMPL_ELSE -->
+                                    <input type="radio" name="guide_box" id="guide_box" value="1" />On
+                                    <input type="radio" name="guide_box" id="guide_box" value="0" checked="checked" />Off
+                                    <!-- /TMPL_IF -->
                                 </li>
                                 </fieldset>
                                 </li>
diff --git a/patroncards/create-pdf.pl b/patroncards/create-pdf.pl
index 656c31f..02ba793 100755
--- a/patroncards/create-pdf.pl
+++ b/patroncards/create-pdf.pl
@@ -120,7 +120,7 @@ foreach my $item (@{$items}) {
                 layout                  => $layout_xml,
                 text_wrap_cols          => 30, #FIXME: hardcoded
         );
-        $patron_card->draw_guide_box($pdf);
+        $patron_card->draw_guide_box($pdf) if $layout_xml->{'guide_box'};
         $patron_card->draw_barcode($pdf) if $layout_xml->{'barcode'};
 
 #       Do image foo and place binary image data into layout hash
diff --git a/patroncards/edit-layout.pl b/patroncards/edit-layout.pl
index 09edf42..38557b0 100755
--- a/patroncards/edit-layout.pl
+++ b/patroncards/edit-layout.pl
@@ -145,6 +145,7 @@ if ($op eq 'edit') {
             layout_id       => $layout->get_attr('layout_id') > -1 ? $layout->get_attr('layout_id') : '',
             layout_name     => $layout->get_attr('layout_name'),
             page_side       => ($layout_xml->{'page_side'} eq 'F' ? 0 : 1),
+            guide_box       => $layout_xml->{'guide_box'},
             units           => $units,
             @barcode,
             barcode_type    => get_barcode_types(),
@@ -206,6 +207,7 @@ elsif  ($op eq 'save') {
             $layout_id = $cgi->param($parameter) if $parameter eq 'layout_id';
             $layout->{'units'} = $cgi->param($parameter) if $parameter eq 'units';
             $layout->{'page_side'} = $cgi->param($parameter) if $parameter eq 'page_side';
+            $layout->{'guide_box'} = $cgi->param($parameter) if $parameter eq 'guide_box';
         }
     }
     $layout->{'text'} = $text_lines;
-- 
1.6.0.4




More information about the Koha-patches mailing list