From b986d5071fea52a9bd81de87c776bfa28502052f Mon Sep 17 00:00:00 2001 From: Grace Smyth Date: Thu, 18 Jan 2018 20:30:00 +0000 Subject: [PATCH] Bug 19987: If no z39.50/SRU servers the button should not show Test plan: [1.] Load the patch and make sure you have some Z39.50/SRU servers (Administration => Z39.50/SRU servers administration) [2.] Then go to authorities and notice that the 'New from Z39.50/SRU' button is there [3.] Next go to cataloging and notice that the 'New from Z39.50/SRU' button is there too [4.] Now make sure you have no Z39.50/SRU servers (remove the servers) (Administration => Z39.50/SRU servers administration) [5.] Go to authorities and notice that the 'New from Z39.50/SRU' button is not there [6.] Lastly go to cataloging and notice that the 'New from Z39.50/SRU' button is not there too :) Signed-off-by: Owen Leonard I added a missing [% END %] during signoff. Hope no one minds! Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens (cherry picked from commit 0b3e70c961be7dcc5aa18f5dc7e0996852563e66) Signed-off-by: Fridolin Somers --- authorities/authorities-home.pl | 12 ++++++++++++ cataloguing/addbooks.pl | 12 ++++++++++++ .../prog/en/includes/authorities-toolbar.inc | 8 +++++--- .../prog/en/modules/cataloguing/addbooks.tt | 2 ++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index d9c5ac83bb..f6d3f85a72 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -214,7 +214,19 @@ if ( $op eq '' ) { } +my $schema = Koha::Database->new()->schema(); +my $servers = $schema->resultset('Z3950server')->search( + { + recordtype => 'biblio', + servertype => ['zed', 'sru'], + }, + { result_class => 'DBIx::Class::ResultClass::HashRefInflator', + order_by => ['rank', 'servername'], + }, +); + $template->param( + servers => $servers, authority_types => $authority_types, op => $op, ); diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index 1d52bb8007..653bced3f7 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -133,8 +133,20 @@ for my $resultsbr (@resultsbr) { }; } +my $schema = Koha::Database->new()->schema(); +my $servers = $schema->resultset('Z3950server')->search( + { + recordtype => 'biblio', + servertype => ['zed', 'sru'], + }, + { result_class => 'DBIx::Class::ResultClass::HashRefInflator', + order_by => ['rank', 'servername'], + }, +); + my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] }); $template->param( + servers => $servers, frameworks => $frameworks, breeding_count => $countbr, breeding_loop => $breeding_loop, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc index 582a4eddf1..4b9d779fc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc @@ -59,9 +59,11 @@ [% END %] - + [% IF servers.count > 0 %] + + [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index d6d39d8e86..c126978852 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -105,6 +105,7 @@ [% END %] + [% IF servers.count > 0 %]
+ [% END %] [% IF ( total ) %]
[% END %] -- 2.39.5