From 240cb95d354b4e5369d39e9d8d5eed4ce99f9104 Mon Sep 17 00:00:00 2001 From: Grace Smyth Date: Thu, 18 Jan 2018 01:05:12 +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 --- authorities/authorities-home.pl | 25 ++++++++++------------ cataloguing/addbooks.pl | 12 +++++------ .../prog/en/includes/authorities-toolbar.inc | 2 +- .../prog/en/modules/cataloguing/addbooks.tt | 4 ++-- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index 54f2a80..c4fd6fa 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -214,22 +214,19 @@ if ( $op eq '' ) { } -4 if ( $op ne "do_search" ) { - my $schema = Koha::Database->new()->schema(); - my $rs = $schema->resultset('Z3950server')->search( - { - recordtype => 'biblio', - servertype => ['zed', 'sru'], - }, - { result_class => 'DBIx::Class::ResultClass::HashRefInflator', - order_by => ['rank', 'servername'], - }, - ); - $template->param( - serverloop => [ $rs->all ], - ) +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 a1581d7..47dcbf6 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -133,20 +133,20 @@ for my $resultsbr (@resultsbr) { }; } -my $rs = $schema->resultset('Z3950server')->search( +my $schema = Koha::Database->new()->schema(); +my $servers = $schema->resultset('Z3950server')->search( { - recordtype => 'biblio', - servertype => ['zed', 'sru'], + recordtype => 'biblio', + servertype => ['zed', 'sru'], }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator', order_by => ['rank', 'servername'], }, - ); - $template->param( - serverloop => [ $rs->all ], +); 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 9bdbe9b..8800219 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc @@ -59,7 +59,7 @@ [% END %] - [% IF server %] + [% IF servers.count > 0 %]
New from Z39.50
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 887e96d..bcaac61 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -30,13 +30,12 @@ [% END %] - [% IF server %] + [% IF servers.count > 0 %]
- [% END %]
+ [% END %] [% IF ( total ) %]
[% END %] -- 2.1.4