Bug 40841: Implement library limits on Z39.50 searches
This patchset implements Z39.50/SRU limits by branch in Koha. Key implementation notes: - Follows Koha's established pattern for library limits - A new table linking to library limits is added - The admin UI is adjusted so the form includes library limit selection - Z39.50/SRU search controllers use the `search_with_library_limits` methods to correctly constraint the offered servers. To test: 1. Apply this patches 2. Run: $ ktd --shell k$ updatedatabase => SUCCESS: Database upgrade goes well 3. Re-run: k$ updatedatabase => SUCCESS: No explosions, DB update idempotent 4. Restart everything: k$ restart_all 5. POint your browser to the admin page: http://kohadev-intra.localhost/cgi-bin/koha/admin/z3950servers.pl => SUCCESS: A new column is displayed for library limits brief 6. Edit `LIBRARY OF CONGRESS` => SUCCESS: The form includes the usual library limit selection UI 7. Choose some branches, excluding your current one (KTD's default is 'Centerville'). 8. Save => SUCCESS: It is saved correctly => SUCCESS: The table shows the edited library has the library limits set 9. Edit again => SUCCESS: The selected limits are preserved when editing 10. Pick some authorities Z39.50 target, and exclude your current branch for testing purposes. 11. Go to Cataloguing, and choose 'New from Z39.50/SRU' => SUCCESS: Limits are respected! 12. Go to Authorities, and choose 'New from Z39.50/SRU' => SUCCESS: Limits are respected! 13. Same as 11 but with the advanced editor => SUCCESS: Limits are respected! 14. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
parent
e389129d61
commit
d6aae094b4
|
|
@ -30,6 +30,7 @@ use Koha::Database;
|
|||
use Koha::MarcSubfieldStructures;
|
||||
use Koha::BiblioFrameworks;
|
||||
use Koha::KeyboardShortcuts;
|
||||
use Koha::Z3950Servers;
|
||||
|
||||
my $input = CGI->new;
|
||||
|
||||
|
|
@ -76,14 +77,14 @@ $template->{VARS}->{authtags} = $authtags;
|
|||
my $frameworks = Koha::BiblioFrameworks->search( {}, { order_by => ['frameworktext'] } );
|
||||
$template->{VARS}->{frameworks} = $frameworks;
|
||||
|
||||
# Z39.50 servers
|
||||
my $dbh = C4::Context->dbh;
|
||||
$template->{VARS}->{z3950_servers} = $dbh->selectall_arrayref(
|
||||
q{
|
||||
SELECT * FROM z3950servers
|
||||
WHERE recordtype != 'authority' AND servertype = 'zed'
|
||||
ORDER BY `rank`,servername
|
||||
}, { Slice => {} }
|
||||
$template->param(
|
||||
z3950_servers => Koha::Z3950Servers->search_with_library_limits(
|
||||
{
|
||||
recordtype => { '!=' => 'authority' },
|
||||
servertype => 'zed'
|
||||
},
|
||||
{ order_by => [ 'rank', 'servername' ] },
|
||||
)
|
||||
);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use C4::Breeding qw( Z3950Search Z3950SearchAuth );
|
|||
use MARC::Record;
|
||||
use Koha::Authorities;
|
||||
use Koha::Authority::Types;
|
||||
use Koha::Z3950Servers;
|
||||
use C4::AuthoritiesMarc qw( GetAuthority );
|
||||
|
||||
my $input = CGI->new;
|
||||
|
|
@ -97,13 +98,16 @@ $template->param(
|
|||
);
|
||||
|
||||
if ( $op ne "cud-do_search" ) {
|
||||
my $sth = $dbh->prepare(
|
||||
"SELECT id,host,servername,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY `rank`, servername"
|
||||
my $servers = Koha::Z3950Servers->search_with_library_limits(
|
||||
{
|
||||
recordtype => 'authority',
|
||||
},
|
||||
{
|
||||
order_by => [ 'rank', 'servername' ],
|
||||
},
|
||||
);
|
||||
$sth->execute();
|
||||
my $serverloop = $sth->fetchall_arrayref( {} );
|
||||
$template->param(
|
||||
serverloop => $serverloop,
|
||||
serverloop => $servers,
|
||||
opsearch => "cud-search",
|
||||
index => $index,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ use C4::Output qw( output_html_with_http_headers );
|
|||
use C4::Context;
|
||||
use C4::Breeding qw( Z3950Search );
|
||||
|
||||
use Koha::Z3950Servers;
|
||||
|
||||
my $input = CGI->new;
|
||||
my $error = $input->param('error');
|
||||
my $biblionumber = $input->param('biblionumber') || 0;
|
||||
|
|
@ -74,19 +76,17 @@ $template->param(
|
|||
);
|
||||
|
||||
if ( $op ne "cud-do_search" ) {
|
||||
my $schema = Koha::Database->new()->schema();
|
||||
my $rs = $schema->resultset('Z3950server')->search(
|
||||
my $servers = Koha::Z3950Servers->search_with_library_limits(
|
||||
{
|
||||
recordtype => 'biblio',
|
||||
servertype => [ 'zed', 'sru' ],
|
||||
},
|
||||
{
|
||||
result_class => 'DBIx::Class::ResultClass::HashRefInflator',
|
||||
order_by => [ 'rank', 'servername' ],
|
||||
order_by => [ 'rank', 'servername' ],
|
||||
},
|
||||
);
|
||||
$template->param(
|
||||
serverloop => [ $rs->all ],
|
||||
serverloop => $servers,
|
||||
opsearch => "cud-search",
|
||||
);
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
|
|
|||
Loading…
Reference in New Issue