[Koha-bugs] [Bug 14385] Extend OpacHiddenItems to allow specifying exempt borrower categories

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Aug 24 05:04:47 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14385

--- Comment #112 from M. Tompsett <mtompset at hotmail.com> ---
back up database
git bz apply 19040
git bz apply 14385
sudo koha-shell -c bash kohadev
./installer/data/misc/updatedatabase.pl
-- this proves the atomic update

drop the database
create an empty one
run a web install
-- this proves the sysprefs changes

restore database
./installer/data/misc/updatedatabase.pl
-- This gives non-fresh install DB to actually test on.

log into the staff client
go to the OPAC system preferences (Home -> Koha administration -> Global System
Preferences -> OPAC)
scroll down to the policy section
-- there should be a new OpacHiddenItemsExpceptions system preference setting.
Set a value for the OpacHiddenItemsExceptions, and click save.
-- it should save.
Click 'Home' in the bread crumbs.
Navigate back to the OPAC system preferences
-- the value you set should be saved correctly.
-- This confirms the opac.pref file

sudo koha-shell -c bash kohadev
prove t/db_dependent/Authorities/Merge.t
-- This proves the C4/AuthoritiesMarc.pm change

prove t/db_dependent/HoldsQueue.t
-- This proves the C4/HoldsQueue.pm change

prove t/db_dependent/ILSDI_Services.t
-- This proves the C4/ILSDI/Services.pm change

prove t/db_dependent/Reserves.t t/db_dependent/Items.t
-- This prove the C4/Items.pm changes

prove t/db_dependent/Labels/t_Label.t
-- This proves the C4/Labels/Label.pm changes

prove t/db_dependent/Record/marcrecord2csv.t
-- This proves the C4/Record.pm changes

prove t/db_dependent/Serials.t
-- This proves the C4/Serials.pm change

prove t/db_dependent/ShelfBrowser.t
-- This proves the C4/ShelfBrowser.pm change

prove t/db_dependent/Koha/BiblioUtils.t
-- This proves the Koha/Biblio.pm change

prove t/db_dependent/Koha/BiblioUtils/Iterator.t
-- This proves the Koha/BiblioUtils/Iterator.pm change

prove t/db_dependent/Exporter/Record.t
-- This proves the Koha/Exporter/Record.pm changes

prove t/db_dependent/OAI/Server.t
-- This proves the Koha/OAI/Server/Repository.pm change

prove `git diff origin/master | grep ^diff | grep [.]t$ | cut -f4 -d' ' | sed
-e "s#^..##"`
-- This proves all the test file changes.

./misc/migration_tools/build_oai_sets.pl -i
-- This proves this file change.

prove t/db_dependent/Search.t
-- This triggers searchResults tweaks in this file.

- Catalog any new item in the staff client. I did a new from Z39.50.
-- This will trigger any remaining EmbedItemsInMarcBiblio
   calls in the staff client.

1) Make two borrowers, one in a category that should see everything (ie Staff
[S]), and another in a category that should only see certain things (ie Patron
[PT])
2) Add the borrower that can see everything (the Staff) to
OpacHiddenItemsExceptions
3) To the OpacHiddenItems syspref, add an item type (ensure that you have some
records that fall under this type in your library).
4) Log in as the borrower that should only see certain things (Patron)
5) Do a search, filtered to show records which are the item type that you
specified in the OpacHiddenItems syspref.
   -- No records should show for this borrower as this item type is hidden to
them.
6) Log out, and repeat the search
   -- No records should show
7) Log in as the borrower that should see everything (Staff)
8) Do the same search.
   -- There should be results from this search, as this borrower category has
been specified as an exception to the hidden items

prove -v t/db_dependent/Items.t
C4::Biblio changes (EmbedItemsInMarcBiblio) tested
C4::Items changes (GetHiddentItemnumbers) tested
the Items.t is tested itself too.

perldoc C4::Items
/PERLDOC
-- finds changes

installer/data/mysql/atomicupdate/bug_14385-add_OpacHiddenItemsExceptions_syspref.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
-- run an upgrade
-- log in to staff client
-- home -> koha administration -> global system preferences -> opac
-- should be an added OpacHiddenItemsExceptions under OpacHiddenItems
   in the Policy section.
-- should be able to save various values.

installer/data/mysql/sysprefs.sql
-- drop the db
-- create the db
-- fresh install
-- log in to staff client
-- home -> koha administration -> global system preferences -> opac
-- should be an added OpacHiddenItemsExceptions under OpacHiddenItems
   in the Policy section.
-- should be able to save various values.

opac/opac-search.pl
-- set the OpacHiddenItems to "itype: [BK]"
-- set the OpacHiddenItemsExceptions to "S"
-- make sure to catalogue at least two books, since you dropped everything.
-- Adding from Z39.50 is easiest.
-- do a full reindex
-- in the OPAC, search for "itype:BK"
-- there should be nothing found.
-- log in as the superlibrarian (which you probably set to S for staff)
-- in the OPAC, search for "itype:BK"
-- there should be two entries
-- change OpacHiddenItemsExceptions to "PT"
   (because your superlibrarian is probably S and not PT)
-- in the OPAC, search for "itype:BK"
-- there should be nothing found.

opac/opac-detail.pl
-- As you know there are two books, try a direct URL:
   {OPACBaseURL}/opac-detail.pl?biblionumber=1
-- it should return a 404 page
-- change OpacHiddenItemsExceptions back to "S"
-- try the direct URL again.
-- it should show up.

opac/opac-MARCdetail.pl
-- change the OpacHiddenItemsExceptions back to "PT"
-- try a direct URL:
   {OPACBaseURL}/opac-MARCdetail.pl?biblionumber=1
-- it should return a 404 page
-- change OpacHiddenItemsExceptions back to "S"
-- try the direct URL again.
-- it should show up.

opac/opac-ISBDdetail.pl
-- change the OpacHiddenItemsExceptions back to "PT"
-- try a direct URL:
   {OPACBaseURL}/opac-ISBDdetail.pl?biblionumber=1
-- it should return a 404 page
-- change OpacHiddenItemsExceptions back to "S"
-- try the direct URL again.
-- it should show up.

prove -v t/db_dependent/Search.t
the Search.t itself is proved.

catalogue/search.pl
-- Log in to the staff client
-- search for "itype:BK"
-- two results
-- change OpacHiddenItemsExceptions and OpacHiddenItems as desired
-- two results all the time, because this is the staff client!

cataloguing/addbooks.pl
-- Make sure you have records in the cataloguing reservoir
   This is done by staging at least one MARC record.
-- In the staff client, home -> Cataloguing -> Cataloguing search
-- Search for something that will find some records in the reservoir
-- Make sure results are expected regardless of hidden item
   system preferences.

To test all the EmbedItemsInMarcBiblio calls:
 prove t/db_dependent/Biblio.t
 prove t/db_dependent/Record/marcrecord2csv.t
 prove t/db_dependent/Koha/BiblioUtils/Iterator.t
 prove t/db_dependent/Exporter/Record.t
 ./misc/migration_tools/build_oai_sets.pl -i
 And catalog any new item in the staff client. I did a new from Z39.50.


This part of the testing is reading code and pondering if it makes sense.

git grep searchResults
-- The lines are as follows:
C4/Search.pm
- Export line
- Perldoc 2 lines
- subroutine
catalogue/search.pl
- call has interface => 'intranet' and no borrower category
cataloguing/addbooks.pl
- call has interface => 'intranet' and no borrower category
opac/opac-detail.pl
- call as variable $search_context which is
  { 'interface' => 'opac', 'category' => $borcat }
  $borcat is defined at the beginning of the program
opac/opac-search.pl
- comment
- function calls use $search_context which is defined
  before the servers loop
t/db_dependent/Search.t
- Doesn't test hiding in searchResults.

git grep GetHiddenItemnumbers
-- the lines are as follows:
C4/Biblio.pm
- a single line triggered by prove t/db_dependent/Items.t
C4/Items.pm
- Export line
- Perldoc 2 lines
- subroutine

... More explicit to come later. searchResults, GetHiddenItemnumbers,
EmbedItemsInMarcBiblio, GetMarcBiblio all had major prototype changes. Grep for
these and confirm the changes reflect the use of a hashref either completely
(GetMarcBiblio) or as a parameter (searchResults).

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list