From 78d7dd880e5736d16cdb14bdeca8197edc85bd1f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Mar 2016 09:27:23 +0100 Subject: [PATCH] Bug 16167: Remove Authorised value images 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. 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. --- C4/Auth.pm | 1 - C4/Biblio.pm | 62 -------------- C4/Items.pm | 98 ---------------------- C4/Search.pm | 1 - C4/UsageStats.pm | 2 - admin/authorised_values.pl | 7 -- installer/data/mysql/sysprefs.sql | 1 - .../prog/en/modules/admin/authorised_values.tt | 36 -------- .../prog/en/modules/admin/preferences/opac.pref | 6 -- .../en/modules/admin/preferences/staff_client.pref | 6 -- .../prog/en/modules/catalogue/results.tt | 8 -- .../en/modules/help/admin/authorised_values.tt | 3 - .../bootstrap/en/includes/item-status.inc | 6 +- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 8 -- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 13 +-- opac/opac-detail.pl | 14 ---- t/db_dependent/UsageStats.t | 2 - 17 files changed, 2 insertions(+), 272 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index fef418d..b365504 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -507,7 +507,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, diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 188870c..7756d32 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -3470,68 +3470,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); diff --git a/C4/Items.pm b/C4/Items.pm index 7b41d2b..ac6470c 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1760,104 +1760,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, diff --git a/C4/Search.pm b/C4/Search.pm index 9b7bde3..0e51304 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1896,7 +1896,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); diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index ba97fef..092e8bd 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -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 diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index 0f00126..415a72d 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -83,12 +83,10 @@ if ($op eq 'add_form') { lib => $av->lib, lib_opac => $av->lib_opac, id => $av->id, - imagesets => C4::Koha::getImageSets( checked => $av->imageurl ), ); } else { $template->param( category => $category, - imagesets => C4::Koha::getImageSets(), ); } $template->param( @@ -98,8 +96,6 @@ if ($op eq 'add_form') { } elsif ($op eq 'add') { my $new_authorised_value = $input->param('authorised_value'); my $new_category = $input->param('category'); - my $imageurl = $input->param( 'imageurl' ) || ''; - $imageurl = '' if $imageurl =~ /removeImage/; my $duplicate_entry = 0; my @branches = grep { $_ ne q{} } $input->param('branches'); @@ -120,7 +116,6 @@ if ($op eq 'add_form') { $av->lib_opac( $input->param('lib_opac') || undef ); $av->category( $new_category ); $av->authorised_value( $new_authorised_value ); - $av->imageurl( $imageurl ); eval{ $av->store; $av->replace_branch_limitations( \@branches ); @@ -137,7 +132,6 @@ if ($op eq 'add_form') { authorised_value => $new_authorised_value, lib => $input->param('lib') || undef, lib_opac => $input->param('lib_opac') || undef, - imageurl => $imageurl, } ); eval { @@ -202,7 +196,6 @@ if ( $op eq 'list' ) { $row_data{authorised_value} = $av->authorised_value; $row_data{lib} = $av->lib; $row_data{lib_opac} = $av->lib_opac; - $row_data{imageurl} = getitemtypeimagelocation( 'intranet', $av->imageurl ); $row_data{branches} = $av->branch_limitations; $row_data{id} = $av->id; push(@loop_data, \%row_data); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f0c46d3..7ea8f81 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -439,7 +439,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','','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 .','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'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 293a379..eb24bcb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -118,40 +118,6 @@ $(document).ready(function() { -
-
Choose an icon:
- -
    -
  • -
-
- [% FOREACH imageset IN imagesets %] -
    - [% FOREACH image IN imageset.images %] -
  • - -
  • - [% END %]
-
-
- [% END %] -
Cancel
@@ -250,7 +216,6 @@ $(document).ready(function() { Authorized value Description Description (OPAC) - Icon Branches limitations Edit Delete @@ -265,7 +230,6 @@ $(document).ready(function() { [% loo.authorised_value %] [% loo.lib %] [% loo.lib_opac %] - [% IF ( loo.imageurl ) %][% ELSE %] [% END %] [% IF loo.branches.size > 0 %] [% branches_str = "" %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index b041ddf..722ac3e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -176,12 +176,6 @@ OPAC: class: multi - (separate columns with |) - - - pref: AuthorisedValueImages - choices: - yes: Show - no: "Don't show" - - images for authorized values (such as lost statuses and locations) in search results and item detail pages on the OPAC. - - - Use the image at - pref: OpacFavicon class: url diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index 75dfe0e..37333ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -72,12 +72,6 @@ Staff Client: 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 authorized values (such as lost statuses and locations) in search results. - - - 'Display the URI in the 856u field as an image on: ' - pref: Display856uAsImage choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 0e77646..c722cef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -551,14 +551,6 @@ var holdForPatron = function () {

[% IF ( SEARCH_RESULT.searchhighlightblob ) %]

[% SEARCH_RESULT.searchhighlightblob %]

[% END %] - [% IF ( SEARCH_RESULT.authorised_value_images ) %] -

- [% FOREACH authorised_value_image IN SEARCH_RESULT.authorised_value_images %] - [% authorised_value_image.description %] - [% END %] -

- [% END %] - [% END %] [% END %]

[% IF ( SEARCH_RESULT.norequests ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/authorised_values.tt index 8eb11fd..2d75968 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/authorised_values.tt @@ -63,7 +63,6 @@

  • 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)'
  • 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.
  • -
  • If you have StaffAuthorisedValueImages and/or AuthorisedValueImages set to show images for authorized values you can choose the image under 'Choose an icon'
  • Click 'Save'
  • @@ -85,8 +84,6 @@
  • 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)'
  • 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.
  • -
  • If you have StaffAuthorisedValueImages and/or AuthorisedValueImages set -to show images for authorized values you can choose the image under 'Choose an icon'
  • Click 'Save'
  • The new value will appear in the list along with existing values
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 23b3a19..5bb76ec 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -14,11 +14,7 @@ not use an API to fetch items that populates item.datedue. [% IF ( av_lib_include ) %] [% av_lib_include %] [% ELSE %] - [% IF ( item.lostimageurl ) %] - [% item.lostimagelabel %] - [% ELSE %] - Item lost - [% END %] + Item lost [% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index ecc1751..3ad8d95 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -363,14 +363,6 @@ [% END # / IF MARCURLS %] [% END # / IF OPACXSLTDetailsDisplay %] - [% IF ( AuthorisedValueImages && authorised_value_images ) %] -
    - [% FOREACH authorised_value_image IN authorised_value_images %] - [% authorised_value_image.label %] - [% END %] -
    - [% END # / AuthorisedValueImages && authorised_value_images %] - [% IF ( LibraryThingForLibrariesID ) %] [% UNLESS ( LibraryThingForLibrariesTabbedView ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 061ceed..7021638 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -220,18 +220,7 @@ [% END %] - [% IF ( AuthorisedValueImages ) %] - [% # Cell 4: Show Authorized value image %] - - [% FOREACH authorised_value_image IN SEARCH_RESULT.authorised_value_images %] - [% IF ( authorised_value_image.imageurl ) %] - [% authorised_value_image.label %] - [% END %] - [% END %] - - [% END %] - - [% # Cell 5: Search result details and controls %] + [% # Cell 4: Search result details and controls %]
    diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index da94801..aefd9da 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -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"), ); diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index 713524a..c99fea2 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -468,7 +468,6 @@ sub mocking_systempreferences_to_a_set_value { LetterLog ReturnLog SubscriptionLog - AuthorisedValueImages BiblioDefaultView COinSinOPACResults DisplayOPACiconsXSLT @@ -564,7 +563,6 @@ sub mocking_systempreferences_to_a_set_value { SubscriptionHistory Display856uAsImage DisplayIconsXSLT - StaffAuthorisedValueImages template yuipath HidePatronName -- 2.7.0