Merge remote-tracking branch 'origin/new/bug_8209'
authorPaul Poulain <paul.poulain@biblibre.com>
Mon, 1 Oct 2012 14:39:52 +0000 (16:39 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 1 Oct 2012 14:39:52 +0000 (16:39 +0200)
1  2 
Koha/SuggestionEngine/Plugin/AuthorityFile.pm
t/SuggestionEngine_AuthorityFile.t

@@@ -35,24 -35,8 +35,24 @@@ use warnings
  use Carp;
  
  use base qw(Koha::SuggestionEngine::Base);
 -our $NAME    = 'AuthorityFile';
 -our $VERSION = '1.0';
 +
 +=head2 NAME
 +    my $name = $plugin->NAME;
 +
 +=cut
 +
 +sub NAME {
 +    return 'AuthorityFile';
 +}
 +
 +=head2 VERSION
 +    my $version = $plugin->VERSION;
 +
 +=cut
 +
 +sub VERSION {
 +    return '1.1';
 +}
  
  =head2 get_suggestions
  
@@@ -96,10 -80,8 +96,10 @@@ sub get_suggestions 
            {
              'search'  => "an=$auth->{'authid'}",
              relevance => $count--,
-             label     => $auth->{summary}->{authorized}->[0]
+             label     => $auth->{summary}->{authorized}->[0]->{heading}
            };
      }
      return \@results;
  }
 +
 +1;
@@@ -22,7 -22,7 +22,7 @@@ $module->mock('SearchAuthorities', sub 
                      'reported_tag' => undef,
                      'even' => 0,
                      'summary' => {
-                         'authorized' => [ 'Cooking' ],
+                         'authorized' => [ { 'heading' => 'Cooking' } ],
                          'otherscript' => [],
                          'seefrom' => [ 'Cookery' ],
                          'notes' => [ 'Your quintessential poor heading selection' ],
@@@ -33,7 -33,7 +33,7 @@@
                  } ], 1
  });
  
 -my $suggestor = Koha::SuggestionEngine->new( { plugins => ( 'AuthorityFile' ) } );
 +my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'AuthorityFile' ] } );
  is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
  
  my $result = $suggestor->get_suggestions({search => 'Cookery'});