Bug 8205: Add OPACShowUnusedAuthorities syspref
Rather than list authorities that are not actually used by a library, this commit introduces a new syspref: OPACShowUnusedAuthorities to enable libraries to hide unused authorities in the OPAC authority browser. To test: 1) Do a search in the OPAC authority browser that brings up multiple results, including some that are used in the bibliographic database and some that are not. 2) Observe that the results include both used and unused authorities. 3) Set OPACShowUnusedAuthorities to "Do not." 4) Repeat the same search as in step 1. 5) Observe that the results no longer include unused authorities. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Preference is implemented cleanly and works like advertised. As a note: The unused authority records will be hidden from display, but the result list paging does not adjust for the hidden records. So the result pages will show more or less records total, depending on how many records are hidden.
This commit is contained in:
parent
07e30a78d3
commit
44cd5e058b
5 changed files with 25 additions and 1 deletions
|
@ -371,3 +371,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
|
||||||
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo');
|
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo');
|
||||||
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see <a href="http://www.loc.gov/marc/languages/language_code.html">MARC Code List for Languages</a>)','','Free');
|
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see <a href="http://www.loc.gov/marc/languages/language_code.html">MARC Code List for Languages</a>)','','Free');
|
||||||
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowBarcode','0','Show items barcode in holding tab','','YesNo');
|
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowBarcode','0','Show items barcode in holding tab','','YesNo');
|
||||||
|
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo');
|
||||||
|
|
|
@ -5416,6 +5416,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
||||||
SetVersion($DBversion);
|
SetVersion($DBversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$DBversion = "3.09.00.XXX";
|
||||||
|
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
||||||
|
$dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo')");
|
||||||
|
print "Upgrade to $DBversion done (Add OPACShowUnusedAuthorities system preference)\n";
|
||||||
|
SetVersion ($DBversion);
|
||||||
|
}
|
||||||
|
|
||||||
=head1 FUNCTIONS
|
=head1 FUNCTIONS
|
||||||
|
|
||||||
=head2 TableExists($table)
|
=head2 TableExists($table)
|
||||||
|
|
|
@ -78,6 +78,12 @@ OPAC:
|
||||||
yes: Include
|
yes: Include
|
||||||
no: "Don't include"
|
no: "Don't include"
|
||||||
- "COinS / OpenURL / Z39.88 in OPAC search results. <br/>Warning: Enabling this feature will slow OPAC search response times."
|
- "COinS / OpenURL / Z39.88 in OPAC search results. <br/>Warning: Enabling this feature will slow OPAC search response times."
|
||||||
|
-
|
||||||
|
- pref: OPACShowUnusedAuthorities
|
||||||
|
choices:
|
||||||
|
yes: Show
|
||||||
|
no: "Do not show"
|
||||||
|
- unused authorities in the OPAC authority browser.
|
||||||
-
|
-
|
||||||
- pref: OPACShowHoldQueueDetails
|
- pref: OPACShowHoldQueueDetails
|
||||||
choices:
|
choices:
|
||||||
|
|
|
@ -30,7 +30,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="results">
|
<div id="results">
|
||||||
[% IF ( total ) %]
|
[% IF ( total ) %]
|
||||||
<b>Results [% from %] to [% to %] of [% total %]</b>
|
[% IF ( countfuzzy ) %]
|
||||||
|
<b>Showing [% resultcount %] of about [% total %] results</b>
|
||||||
|
[% ELSE %]
|
||||||
|
<b>Results [% from %] to [% to %] of [% total %]</b>
|
||||||
|
[% END %]
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
No results found.
|
No results found.
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
|
@ -127,6 +127,10 @@ if ( $op eq "do_search" ) {
|
||||||
else {
|
else {
|
||||||
$to = ( ( $startfrom + 1 ) * $resultsperpage );
|
$to = ( ( $startfrom + 1 ) * $resultsperpage );
|
||||||
}
|
}
|
||||||
|
unless (C4::Context->preference('OPACShowUnusedAuthorities')) {
|
||||||
|
my @usedauths = grep { $_->{used} > 0 } @$results;
|
||||||
|
$results = \@usedauths;
|
||||||
|
}
|
||||||
$template->param( result => $results ) if $results;
|
$template->param( result => $results ) if $results;
|
||||||
$template->param( FIELDS => \@fields );
|
$template->param( FIELDS => \@fields );
|
||||||
$template->param( orderby => $orderby );
|
$template->param( orderby => $orderby );
|
||||||
|
@ -138,9 +142,11 @@ if ( $op eq "do_search" ) {
|
||||||
startfromnext => $startfrom + 1,
|
startfromnext => $startfrom + 1,
|
||||||
startfromprev => $startfrom - 1,
|
startfromprev => $startfrom - 1,
|
||||||
searchdata => \@field_data,
|
searchdata => \@field_data,
|
||||||
|
countfuzzy => !(C4::Context->preference('OPACShowUnusedAuthorities')),
|
||||||
total => $total,
|
total => $total,
|
||||||
from => $from,
|
from => $from,
|
||||||
to => $to,
|
to => $to,
|
||||||
|
resultcount => scalar @$results,
|
||||||
numbers => \@numbers,
|
numbers => \@numbers,
|
||||||
authtypecode => $authtypecode,
|
authtypecode => $authtypecode,
|
||||||
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
|
authtypetext => $authtypes->{$authtypecode}{'authtypetext'},
|
||||||
|
|
Loading…
Reference in a new issue