Bug 16167: Remove Authorised value images prefs

There are 2 prefs to drive this feature: StaffAuthorisedValueImages and
AuthorisedValueImages. AuthorisedValueImages is not added by
sysprefs.sql and does not appear in updatedatabase.pl, we could easily
imagine that nobody uses it.

With XSLT enabled, the feature is only visible on a record detail page
at the OPAC, if AuthorisedValueImages is set. Otherwise you need to turn
the XSLT off. In this case you will see the images on the result list
(OPAC+Staff interfaces) and OPAC detail page, but not the Staff detail
page.

This patch suggests to remove completely this feature as it does not
work correctly.

The ability to assign an image to an authorised value is now always
displayed, but the image will only be displayed on the advanced search
if defined.

Test plan:
Confirm that the authorised value images are no longer visible at the
opac and the staff interfaces.
The prefs should have been removed too.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-03-30 09:27:23 +01:00 committed by Kyle M Hall
parent d60c96c891
commit 85e7d186ec
15 changed files with 2 additions and 229 deletions

View File

@ -509,7 +509,6 @@ sub get_template_and_user {
$template->param(
OpacAdditionalStylesheet => C4::Context->preference("OpacAdditionalStylesheet"),
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
BranchesLoop => GetBranchesLoop($opac_name),
BranchCategoriesLoop => $library_categories,
opac_name => $opac_name,

View File

@ -3504,68 +3504,6 @@ sub ModBiblioMarc {
return $biblionumber;
}
=head2 get_biblio_authorised_values
find the types and values for all authorised values assigned to this biblio.
parameters:
biblionumber
MARC::Record of the bib
returns: a hashref mapping the authorised value to the value set for this biblionumber
$authorised_values = {
'Scent' => 'flowery',
'Audience' => 'Young Adult',
'itemtypes' => 'SER',
};
Notes: forlibrarian should probably be passed in, and called something different.
=cut
sub get_biblio_authorised_values {
my $biblionumber = shift;
my $record = shift;
my $forlibrarian = 1; # are we in staff or opac?
my $frameworkcode = GetFrameworkCode($biblionumber);
my $authorised_values;
my $tagslib = GetMarcStructure( $forlibrarian, $frameworkcode )
or return $authorised_values;
# assume that these entries in the authorised_value table are bibliolevel.
# ones that start with 'item%' are item level.
my $query = q(SELECT distinct authorised_value, kohafield
FROM marc_subfield_structure
WHERE authorised_value !=''
AND (kohafield like 'biblio%'
OR kohafield like '') );
my $bibliolevel_authorised_values = C4::Context->dbh->selectall_hashref( $query, 'authorised_value' );
foreach my $tag ( keys(%$tagslib) ) {
foreach my $subfield ( keys( %{ $tagslib->{$tag} } ) ) {
# warn "checking $subfield. type is: " . ref $tagslib->{ $tag }{ $subfield };
if ( 'HASH' eq ref $tagslib->{$tag}{$subfield} ) {
if ( defined $tagslib->{$tag}{$subfield}{'authorised_value'} && exists $bibliolevel_authorised_values->{ $tagslib->{$tag}{$subfield}{'authorised_value'} } ) {
if ( defined $record->field($tag) ) {
my $this_subfield_value = $record->field($tag)->subfield($subfield);
if ( defined $this_subfield_value ) {
$authorised_values->{ $tagslib->{$tag}{$subfield}{'authorised_value'} } = $this_subfield_value;
}
}
}
}
}
}
# warn ( Data::Dumper->Dump( [ $authorised_values ], [ 'authorised_values' ] ) );
return $authorised_values;
}
=head2 CountBiblioInOrders
$count = &CountBiblioInOrders( $biblionumber);

View File

@ -1762,104 +1762,6 @@ sub GetHiddenItemnumbers {
return @resultitems;
}
=head3 get_item_authorised_values
find the types and values for all authorised values assigned to this item.
parameters: itemnumber
returns: a hashref malling the authorised value to the value set for this itemnumber
$authorised_values = {
'CCODE' => undef,
'DAMAGED' => '0',
'LOC' => '3',
'LOST' => '0'
'NOT_LOAN' => '0',
'RESTRICTED' => undef,
'STACK' => undef,
'WITHDRAWN' => '0',
'branches' => 'CPL',
'cn_source' => undef,
'itemtypes' => 'SER',
};
Notes: see C4::Biblio::get_biblio_authorised_values for a similar method at the biblio level.
=cut
sub get_item_authorised_values {
my $itemnumber = shift;
# assume that these entries in the authorised_value table are item level.
my $query = q(SELECT distinct authorised_value, kohafield
FROM marc_subfield_structure
WHERE kohafield like 'item%'
AND authorised_value != '' );
my $itemlevel_authorised_values = C4::Context->dbh->selectall_hashref( $query, 'authorised_value' );
my $iteminfo = GetItem( $itemnumber );
# warn( Data::Dumper->Dump( [ $itemlevel_authorised_values ], [ 'itemlevel_authorised_values' ] ) );
my $return;
foreach my $this_authorised_value ( keys %$itemlevel_authorised_values ) {
my $field = $itemlevel_authorised_values->{ $this_authorised_value }->{'kohafield'};
$field =~ s/^items\.//;
if ( exists $iteminfo->{ $field } ) {
$return->{ $this_authorised_value } = $iteminfo->{ $field };
}
}
# warn( Data::Dumper->Dump( [ $return ], [ 'return' ] ) );
return $return;
}
=head3 get_authorised_value_images
find a list of icons that are appropriate for display based on the
authorised values for a biblio.
parameters: listref of authorised values, such as comes from
get_item_authorised_values or
from C4::Biblio::get_biblio_authorised_values
returns: listref of hashrefs for each image. Each hashref looks like this:
{ imageurl => '/intranet-tmpl/prog/img/itemtypeimg/npl/WEB.gif',
label => '',
category => '',
value => '', }
Notes: Currently, I put on the full path to the images on the staff
side. This should either be configurable or not done at all. Since I
have to deal with 'intranet' or 'opac' in
get_biblio_authorised_values, perhaps I should be passing it in.
=cut
sub get_authorised_value_images {
my $authorised_values = shift;
my @imagelist;
my $authorised_value_list = GetAuthorisedValues();
# warn ( Data::Dumper->Dump( [ $authorised_value_list ], [ 'authorised_value_list' ] ) );
foreach my $this_authorised_value ( @$authorised_value_list ) {
if ( exists $authorised_values->{ $this_authorised_value->{'category'} }
&& $authorised_values->{ $this_authorised_value->{'category'} } eq $this_authorised_value->{'authorised_value'} ) {
# warn ( Data::Dumper->Dump( [ $this_authorised_value ], [ 'this_authorised_value' ] ) );
if ( defined $this_authorised_value->{'imageurl'} ) {
push @imagelist, { imageurl => C4::Koha::getitemtypeimagelocation( 'intranet', $this_authorised_value->{'imageurl'} ),
label => $this_authorised_value->{'lib'},
category => $this_authorised_value->{'category'},
value => $this_authorised_value->{'authorised_value'}, };
}
}
}
# warn ( Data::Dumper->Dump( [ \@imagelist ], [ 'imagelist' ] ) );
return \@imagelist;
}
=head1 LIMITED USE FUNCTIONS
The following functions, while part of the public API,

View File

@ -1916,7 +1916,6 @@ sub searchResults {
# add imageurl to itemtype if there is one
$oldbiblio->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
$oldbiblio->{'authorised_value_images'} = ($search_context eq 'opac' && C4::Context->preference('AuthorisedValueImages')) || ($search_context eq 'intranet' && C4::Context->preference('StaffAuthorisedValueImages')) ? C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ) : [];
$oldbiblio->{normalized_upc} = GetNormalizedUPC( $marcrecord,$marcflavour);
$oldbiblio->{normalized_ean} = GetNormalizedEAN( $marcrecord,$marcflavour);
$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);

View File

@ -217,7 +217,6 @@ sub BuildReport {
LetterLog
ReturnLog
SubscriptionLog
AuthorisedValueImages
BiblioDefaultView
COinSinOPACResults
DisplayOPACiconsXSLT
@ -312,7 +311,6 @@ sub BuildReport {
SubscriptionHistory
Display856uAsImage
DisplayIconsXSLT
StaffAuthorisedValueImages
template
yuipath
HidePatronName

View File

@ -450,7 +450,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('SpineLabelAutoPrint','0','','If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.','YesNo'),
('SpineLabelFormat','<itemcallnumber><copynumber>','30|10','This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.','Textarea'),
('SpineLabelShowPrintOnBibDetails','0','','If turned on, a \"Print Label\" link will appear for each item on the bib details page in the staff interface.','YesNo'),
('StaffAuthorisedValueImages','0',NULL,'','YesNo'),
('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'),
('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'),
('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'),

View File

@ -175,12 +175,6 @@ OPAC:
- pref: NotHighlightedWords
class: multi
- (separate columns with |)
-
- pref: AuthorisedValueImages
choices:
yes: Show
no: "Don't show"
- images for <a href="/cgi-bin/koha/admin/authorised_values.pl">authorized values</a> (such as lost statuses and locations) in search results and item detail pages on the OPAC.
-
- Use the image at
- pref: OpacFavicon

View File

@ -71,12 +71,6 @@ Staff Client:
yes: Show
no: "Don't show"
- the format, audience, and material type icons in XSLT MARC21 results and detail pages in the staff client.
-
- pref: StaffAuthorisedValueImages
choices:
yes: Show
no: "Don't show"
- images for <a href="/cgi-bin/koha/admin/authorised_values.pl">authorized values</a> (such as lost statuses and locations) in search results.
-
- 'Display the URI in the 856u field as an image on: '
- pref: Display856uAsImage

View File

@ -551,14 +551,6 @@ var holdForPatron = function () {
</p>
[% IF ( SEARCH_RESULT.searchhighlightblob ) %]<p class="searchhighlightblob">[% SEARCH_RESULT.searchhighlightblob %]</p>[% END %]
[% IF ( SEARCH_RESULT.authorised_value_images ) %]
<p>
[% FOREACH authorised_value_image IN SEARCH_RESULT.authorised_value_images %]
<img src="[% authorised_value_image.imageurl %]" alt="[% authorised_value_image.description %]" />
[% END %]
</p>
[% END %]
[% END %]
[% END %]
<p class="hold">[% IF ( SEARCH_RESULT.norequests ) %]

View File

@ -63,7 +63,6 @@
</li>
<li>Use the Description field for the actual value that will be displayed. If you want something different to show in the OPAC, enter a 'Description (OPAC)'</li>
<li>If you would like to limit this authorized value category to only specific libraries you can choose them from the 'Branches limitation' menu. To have it show for all libraries just choose 'All branches' at the top of the list.</li>
<li>If you have StaffAuthorisedValueImages and/or AuthorisedValueImages set to show images for authorized values you can choose the image under 'Choose an icon'</li>
</ul>
</li>
<li>Click 'Save'</li>
@ -85,8 +84,6 @@
</li>
<li>Use the Description field for the actual value that will be displayed. If you want something different to show in the OPAC, enter a 'Description (OPAC)'</li>
<li>If you would like to limit this authorized value category to only specific libraries you can choose them from the 'Branches limitation' menu. To have it show for all libraries just choose 'All branches' at the top of the list.</li>
<li>If you have StaffAuthorisedValueImages and/or AuthorisedValueImages set
to show images for authorized values you can choose the image under 'Choose an icon'</li>
<li>Click 'Save'</li>
<li>The new value will appear in the list along with existing values</li>
</ul>

View File

@ -14,11 +14,7 @@ not use an API to fetch items that populates item.datedue.
[% IF ( av_lib_include ) %]
<span class="item-status lost">[% av_lib_include %]</span>
[% ELSE %]
[% IF ( item.lostimageurl ) %]
<img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]" />
[% ELSE %]
<span class="item-status lost">Item lost</span>
[% END %]
<span class="item-status lost">Item lost</span>
[% END %]
[% END %]

View File

@ -363,14 +363,6 @@
[% END # / IF MARCURLS %]
[% END # / IF OPACXSLTDetailsDisplay %]
[% IF ( AuthorisedValueImages && authorised_value_images ) %]
<div class="authorised_value_images">
[% FOREACH authorised_value_image IN authorised_value_images %]
<img src="[% authorised_value_image.imageurl %]" alt="[% authorised_value_image.label %]" title="[% authorised_value_image.label %]" />
[% END %]
</div>
[% END # / AuthorisedValueImages && authorised_value_images %]
<!-- This puts the LTFL reviews in, and if TabbedView is not set, puts the remaining content above the Tabs instead of in them -->
[% IF ( LibraryThingForLibrariesID ) %]
[% UNLESS ( LibraryThingForLibrariesTabbedView ) %]

View File

@ -220,18 +220,7 @@
</td>
[% END %]
[% IF ( AuthorisedValueImages ) %]
[% # Cell 4: Show Authorized value image %]
<td class="authvalcol">
[% FOREACH authorised_value_image IN SEARCH_RESULT.authorised_value_images %]
[% IF ( authorised_value_image.imageurl ) %]
<img src="[% authorised_value_image.imageurl %]" alt="[% authorised_value_image.label %]" title="[% authorised_value_image.label %]">
[% END %]
[% END %]
</td>
[% END %]
[% # Cell 5: Search result details and controls %]
[% # Cell 4: Search result details and controls %]
<td class="bibliocol">
<div class="coverimages">
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">

View File

@ -560,10 +560,6 @@ foreach my $subscription (@subscriptions) {
$dat->{'count'} = scalar(@items);
my $biblio_authorised_value_images = C4::Context->preference('AuthorisedValueImages')
? C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) )
: [];
my (%item_reserves, %priority);
my ($show_holds_count, $show_priority);
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
@ -656,15 +652,6 @@ if ( not $viewallitems and @items > $max_items_to_display ) {
$itemfields{$_} = 1 if ($itm->{$_});
}
# walk through the item-level authorised values and populate some images
my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
# warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) );
if ( $itm->{'itemlost'} ) {
my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
$itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' };
$itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
}
my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
@ -736,7 +723,6 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib
itemdata_uri => $itemfields{uri},
itemdata_copynumber => $itemfields{copynumber},
itemdata_itemnotes => $itemfields{itemnotes},
authorised_value_images => $biblio_authorised_value_images,
subtitle => $subtitle,
OpacStarRatings => C4::Context->preference("OpacStarRatings"),
);

View File

@ -469,7 +469,6 @@ sub mocking_systempreferences_to_a_set_value {
LetterLog
ReturnLog
SubscriptionLog
AuthorisedValueImages
BiblioDefaultView
COinSinOPACResults
DisplayOPACiconsXSLT
@ -565,7 +564,6 @@ sub mocking_systempreferences_to_a_set_value {
SubscriptionHistory
Display856uAsImage
DisplayIconsXSLT
StaffAuthorisedValueImages
template
yuipath
HidePatronName