Bug 20310: (follow-up) Move syspref check into controller
I believe the syspref check is better placed in the controller. This way the host_record method is not so closely tied to the articel requests feature and may subsequently prove useful to future use cases. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
cc316db0b1
commit
472538b17d
|
|
@ -910,7 +910,6 @@ sub host_record {
|
|||
my ($self, $params) = @_;
|
||||
my $no_items = $params->{no_items};
|
||||
return if C4::Context->preference('marcflavour') eq 'UNIMARC'; # TODO
|
||||
return if !C4::Context->preference('ArticleRequestsHostRedirection');
|
||||
return if $params->{no_items} && $self->items->count > 0;
|
||||
|
||||
my $record;
|
||||
|
|
|
|||
|
|
@ -77,14 +77,19 @@ if ( $action eq 'create' ) {
|
|||
|
||||
print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests");
|
||||
exit;
|
||||
} elsif ( !$action ) {
|
||||
# Should we redirect?
|
||||
# Conditions: no items, host item entry (MARC21 773)
|
||||
my ( $host, $pageinfo ) = $biblio->host_record({ no_items => 1 });
|
||||
if( $host ) {
|
||||
$template->param( pageinfo => $pageinfo, title => $biblio->title, author => $biblio->author );
|
||||
$biblio = $host;
|
||||
}
|
||||
# Should we redirect?
|
||||
}
|
||||
elsif ( !$action && C4::Context->preference('ArticleRequestsHostRedirection') ) {
|
||||
# Conditions: no items, host item entry (MARC21 773)
|
||||
my ( $host, $pageinfo ) = $biblio->host_record( { no_items => 1 } );
|
||||
if ($host) {
|
||||
$template->param(
|
||||
pageinfo => $pageinfo,
|
||||
title => $biblio->title,
|
||||
author => $biblio->author
|
||||
);
|
||||
$biblio = $host;
|
||||
}
|
||||
}
|
||||
|
||||
my $patron = Koha::Patrons->find($borrowernumber);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ subtest 'host_record' => sub {
|
|||
|
||||
t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
|
||||
t::lib::Mocks::mock_preference( 'MARCOrgCode', 'xyz' );
|
||||
t::lib::Mocks::mock_preference( 'ArticleRequestsHostRedirection', 1 );
|
||||
|
||||
my $bib1 = $builder->build_object({ class => 'Koha::Biblios' });
|
||||
my $bib2 = $builder->build_object({ class => 'Koha::Biblios' });
|
||||
|
|
|
|||
Loading…
Reference in New Issue