Correcting C4::VirtualShelves::ShelfPossibleAction to handle the case where the staff...
[koha_fer] / C4 / Koha.pm
index af9b913..65822aa 100644 (file)
@@ -22,9 +22,6 @@ use strict;
 use C4::Context;
 use C4::Output;
 
-use MIME::Base64 qw(encode_base64 decode_base64);
-use Encode qw(encode decode);
-
 use vars qw($VERSION @ISA @EXPORT $DEBUG);
 
 BEGIN {
@@ -55,8 +52,6 @@ BEGIN {
                &GetKohaAuthorisedValues
                &GetAuthValCode
                &GetManagedTagSubfields
-        &str_to_base64
-        &base64_to_str
 
                $DEBUG
        );
@@ -460,8 +455,26 @@ sub getitemtypeimagesrcfromurl {
     return $imageurl;
 }
 
+=head2 getitemtypeimagedir
+
+=over
+
+=item 4
+
+  my $directory = getitemtypeimagedir( 'opac' );
+
+pass in 'opac' or 'intranet'. Defaults to 'opac'.
+
+returns the full path to the appropriate directory containing images.
+
+=back
+
+=cut
+
 sub getitemtypeimagedir {
        my $src = shift;
+        $src = 'opac' unless defined $src;
+
        if ($src eq 'intranet') {
                return C4::Context->config('intrahtdocs') . '/' .C4::Context->preference('template') . '/img/itemtypeimg';
        }
@@ -1060,42 +1073,28 @@ ORDER BY marc_subfield_structure.tagfield, tagsubfield|);
   return $data;
 }
 
-=head2 str_to_base64
+=head2 display_marc_indicators
 
 =over 4
 
-my $base64 = str_to_base64($string_containing_unicode);
+# field is a MARC::Field object
+my $display_form = C4::Koha::display_marc_indicators($field);
 
 =back
 
-Get a Base64 version of a string that is in UTF-8.  This
-function can be used to convert an arbitrary coded value
-(like a branch code) into a form that can be safely concatenated
-with similarly encoded values for a HTML form input name, as
-in admin/issuingrules.pl.
+Generate a display form of the indicators of a variable
+MARC field, replacing any blanks with '#'.
 
 =cut
 
-sub str_to_base64 {
-    my $in = shift;
-    return encode_base64(encode("UTF-8", $in), '');
-}
-
-=head2 base64_to_str
-
-=over 4
-
-my $base64 = base64_to_str($string_containing_unicode);
-
-=back
-
-Converse of C<str_to_base64()>.
-
-=cut
-
-sub base64_to_str {
-    my $in = shift;
-    return decode("UTF-8", decode_base64($in));
+sub display_marc_indicators {
+    my $field = shift;
+    my $indicators = '';
+    if ($field->tag() >= 10) {
+        $indicators = $field->indicator(1) . $field->indicator(2);
+        $indicators =~ s/ /#/g;
+    }
+    return $indicators;
 }
 
 1;