Bug 11912: (refactoring followup) make GetMarcISBN implement its advertised API
authorTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 10 Mar 2014 14:52:19 +0000 (11:52 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Wed, 13 Aug 2014 18:25:20 +0000 (14:25 -0400)
The current implementation of GetMarcISBN contradicts the documented API.
It currently returns an array of hashes with only one key (marcisbn)
which doesn't add any value to it.

I chose to fix GetMarcISBN to honour the API instead of changing thex
 docs, because it seems a really silly change.

To test:
- Run:
  prove t/db_dependent/Biblio.t
=> SUCCESS
- catalogue/detail.pl should correctly show ISBNs.
- opac/opac-detail.pl should correctly show ISBNs in both prog and bootstrap.
- opac-opac-sendshelf.pl should correctly show ISBNs in the email.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 774483772b2a7ff8ebdb8a9aeac82881e7c858cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

C4/Biblio.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelf.tt
t/db_dependent/Biblio.t

index 4f1cf91..cd86152 100644 (file)
@@ -1639,13 +1639,12 @@ sub GetMarcISBN {
     } else {    # assume marc21 if not unimarc
         $scope = '020';
     }
+
     my @marcisbns;
-    my $marcisbn;
     foreach my $field ( $record->field($scope) ) {
         my $isbn = $field->as_string();
         if ( $isbn ne "" ) {
-            $marcisbn = { marcisbn => $isbn, };
-            push @marcisbns, $marcisbn;
+            push @marcisbns, $isbn;
         }
     }
 
index a83f4e3..7edbb6d 100644 (file)
@@ -294,7 +294,7 @@ function verify_images() {
         <div class="yui-u" style="margin-top: 1em;">
         <ul>
         [% IF ( MARCISBNS ) %]
-            <li><strong>ISBN:</strong><ul>[% FOREACH MARCISBN IN MARCISBNS %]<li>[% MARCISBN.marcisbn %]</li>[% END %]</ul></li>
+            <li><strong>ISBN:</strong><ul>[% FOREACH MARCISBN IN MARCISBNS %]<li>[% MARCISBN %]</li>[% END %]</ul></li>
         [% ELSE %]
             [% IF ( normalized_isbn ) %]
                 <li><strong>ISBN:</strong> [% normalized_isbn %]</li>
index 27f3913..2443db8 100644 (file)
@@ -615,7 +615,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
     [% IF ( pages ) %]<span class="results_summary physical"><span class="label">Physical details:</span> [% pages %] [% illus %] [% size %]</span>[% END %]
 
     [% IF ( MARCISBNS ) %]
-        <span class="results_summary isbn"><span class="label">ISBN:</span>[% FOREACH MARCISBN IN MARCISBNS %][% MARCISBN.marcisbn %][% IF ( loop.last ) %].[% ELSE %]; [% END %][% END %]</span>
+        <span class="results_summary isbn"><span class="label">ISBN:</span>[% FOREACH MARCISBN IN MARCISBNS %][% MARCISBN %][% IF ( loop.last ) %].[% ELSE %]; [% END %][% END %]</span>
     [% ELSE %]
         [% IF ( normalized_isbn ) %]
             <span class="results_summary isbn"><span class="label">ISBN: </span>[% normalized_isbn %]</span>
index c13a659..f3c7ed7 100644 (file)
@@ -59,7 +59,7 @@ Your list : [% shelfname %]
             [% IF ( BIBLIO_RESULT.ISBN && BIBLIO_RESULT.size > 0 ) %]
             <span>
                 ISBN: [% FOREACH isbn IN BIBLIO_RESULT.ISBN %]
-                          [% isbn.marcisbn %]
+                          [% isbn %]
                           [% UNLESS ( loop.last ) %]; [% END %]
                       [% END %]
             </span><br/>
index 2dd8034..b861023 100755 (executable)
@@ -19,7 +19,6 @@ use Modern::Perl;
 
 use Test::More tests => 3;
 use Test::MockModule;
-use Data::Dumper;
 
 use MARC::Record;
 
@@ -166,7 +165,7 @@ sub run_tests {
     $record_for_isbn->append_fields( $isbn_field );
     $isbns = GetMarcISBN( $record_for_isbn, $marcflavour );
     is( scalar @$isbns, 1, '(GetMarcISBN) The record contains one ISBN');
-    is( $isbns->[0]->{ marcisbn }, $isbn, '(GetMarcISBN) The record contains our ISBN');
+    is( $isbns->[0], $isbn, '(GetMarcISBN) The record contains our ISBN');
 
     # We add 3 more ISBNs
     $record_for_isbn = MARC::Record->new();
@@ -178,7 +177,7 @@ sub run_tests {
     $isbns = GetMarcISBN( $record_for_isbn, $marcflavour );
     is( scalar @$isbns, 4, '(GetMarcISBN) The record contains 4 ISBNs');
     for my $i (0 .. $#more_isbns) {
-        is( $isbns->[$i]->{ marcisbn }, $more_isbns[$i],
+        is( $isbns->[$i], $more_isbns[$i],
             "(GetMarcISBN) Corretly retrieves ISBN #". ($i + 1));
     }