Bug 12673: Remove CGI::scrolling_list from C4::Items.pm
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tue, 29 Jul 2014 18:00:56 +0000 (15:00 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 3 Aug 2014 20:21:08 +0000 (17:21 -0300)
This patch removes only instance in this file

To test:
1. Apply the patch
2. (Esay way) Put on staff URL
/cgi-bin/koha/services/itemrecorddisplay.pl?biblionumber=N&itemnumber=M
3. Code replaced corresponds to pulldowns, verify information
is correct (check with another item edit view)

PrepareItemrecordDisplay() in Items.pm is filled with chunks of
HTML code that must be put on TT file. For now scrolling_list
is the only removed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested different item edit displays and the URL given above,
no regressions found. Also passes all tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Items.pm
koha-tmpl/intranet-tmpl/prog/en/modules/services/itemrecorddisplay.tt

index fe05814..f8e2121 100644 (file)
@@ -2835,15 +2835,12 @@ sub PrepareItemrecordDisplay {
                             $authorised_lib{$value} = $lib;
                         }
                     }
-                    $subfield_data{marc_value} = CGI::scrolling_list(
-                        -name     => 'field_value',
-                        -values   => \@authorised_values,
-                        -default  => "$defaultvalue",
-                        -labels   => \%authorised_lib,
-                        -size     => 1,
-                        -tabindex => '',
-                        -multiple => 0,
-                    );
+                    $subfield_data{marc_value} = {
+                        type    => 'select',
+                        values  => \@authorised_values,
+                        default => "$defaultvalue",
+                        labels  => \%authorised_lib,
+                    };
                 } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) {
                         # opening plugin
                         my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'};
index 5637276..d55268a 100644 (file)
         [% ELSE %]
             <label>[% iteminfo.subfield %] - [% iteminfo.marc_lib %]</label>
         [% END %]
+        [% IF ( iteminfo.marc_value.type == 'select' ) %]
+        <select name="field_value" size="1">
+        [% FOREACH value IN iteminfo.marc_value.values %]
+          [% IF ( value == iteminfo.marc_value.default ) %]
+            <option value="[% value %]" selected="selected">[% iteminfo.marc_value.labels.$value %]</option>
+          [% ELSE %]
+            <option value="[% value %]">[% iteminfo.marc_value.labels.$value %]</option>
+          [% END %]
+        [% END %]
+        </select>
+        [% ELSE %]
         [% iteminfo.marc_value %]
+        [% END %]
         <input type="hidden" name="itemid" value="1" />
         <input type="hidden" name="kohafield" value="[% iteminfo.kohafield %]" />
         <input type="hidden" name="tag" value="[% iteminfo.tag %]" />