View | Details | Raw Unified | Return to bug 20310
Collapse All | Expand All

(-)a/Koha/Biblio.pm (-1 lines)
Lines 910-916 sub host_record { Link Here
910
    my ($self, $params) = @_;
910
    my ($self, $params) = @_;
911
    my $no_items = $params->{no_items};
911
    my $no_items = $params->{no_items};
912
    return if C4::Context->preference('marcflavour') eq 'UNIMARC'; # TODO
912
    return if C4::Context->preference('marcflavour') eq 'UNIMARC'; # TODO
913
    return if !C4::Context->preference('ArticleRequestsHostRedirection');
914
    return if $params->{no_items} && $self->items->count > 0;
913
    return if $params->{no_items} && $self->items->count > 0;
915
914
916
    my $record;
915
    my $record;
(-)a/opac/opac-request-article.pl (-8 / +13 lines)
Lines 79-92 if ( $action eq 'create' ) { Link Here
79
79
80
    print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
80
    print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
81
    exit;
81
    exit;
82
} elsif ( !$action ) {
82
# Should we redirect?
83
    # Should we redirect?
83
}
84
    # Conditions: no items, host item entry (MARC21 773)
84
elsif ( !$action && C4::Context->preference('ArticleRequestsHostRedirection') ) {
85
    my ( $host, $pageinfo ) = $biblio->host_record({ no_items => 1 });
85
  # Conditions: no items, host item entry (MARC21 773)
86
    if( $host ) {
86
  my ( $host, $pageinfo ) = $biblio->host_record( { no_items => 1 } );
87
        $template->param( pageinfo => $pageinfo, title => $biblio->title, author => $biblio->author );
87
  if ($host) {
88
        $biblio = $host;
88
      $template->param(
89
    }
89
          pageinfo => $pageinfo,
90
          title    => $biblio->title,
91
          author   => $biblio->author
92
      );
93
      $biblio = $host;
94
  }
90
}
95
}
91
96
92
my $patron = Koha::Patrons->find($borrowernumber);
97
my $patron = Koha::Patrons->find($borrowernumber);
(-)a/t/db_dependent/Koha/Biblio/host_record.t (-2 lines)
Lines 40-46 subtest 'host_record' => sub { Link Here
40
40
41
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
41
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
42
    t::lib::Mocks::mock_preference( 'MARCOrgCode', 'xyz' );
42
    t::lib::Mocks::mock_preference( 'MARCOrgCode', 'xyz' );
43
    t::lib::Mocks::mock_preference( 'ArticleRequestsHostRedirection', 1 );
44
43
45
    my $bib1 = $builder->build_object({ class => 'Koha::Biblios' });
44
    my $bib1 = $builder->build_object({ class => 'Koha::Biblios' });
46
    my $bib2 = $builder->build_object({ class => 'Koha::Biblios' });
45
    my $bib2 = $builder->build_object({ class => 'Koha::Biblios' });
47
- 

Return to bug 20310