Bug 10876

Summary: Fix opac-MARCdetail.pl partial hides
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: OPACAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: normal    
Priority: P5 - low CC: gmcharlt, jonathan.druart, katrin.fischer
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10872
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10584
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 10584    
Bug Blocks:    
Attachments: Bug 10876 - MARC view displays what should be hidden
Bug 10876 - Fix opac-MARCdetail.pl partial hides
Fix opac-MARCdetail.pl partial hides
Bug 10876 - Fix opac-MARCdetail.pl partial hides
Bug 10876 - Fix opac-MARCdetail.pl partial hides

Description Mark Tompsett 2013-09-11 12:57:34 UTC
The opac/opac-MARCdetail.pl file is what is viewed when "MARC view" is clicked while viewing a specific search result. Items hidden on opac/opac-detail.pl based on OpacHiddenItems are shown! This should not happen. I believe this bug goes back several versions, not just master.

While coding this, a lack of use or require in C4::Items was discovered. See bug 10872.

By adding calls to GetItemsInfo and GetHiddenItems, a filter on the items is placed. As this is processing MARC data, GetMarcFromKohaField was used to properly determine what the item number (952$9) is.

Test Plan
=========
1) Find a biblio with multiple items. (e.g. a book with multiple branches)
2) Look it up in OPAC
3) View the details.
4) In the staff client, set the OpacHiddenItems system preference to hide some of the data. (e.g. homebranch: [BRANCH2HIDE])
5) Refresh the OPAC
6) Some of the details should be hidden now. Save this URL for later (e.g. http://..../opac-detail.pl?biblionumber=#####)
7) Click the MARC view.
8) All the items are showing.
9) Apply patch from 10872
10) Apply this patch
11) Refresh the OPAC
12) The MARC view should now only show the same things the normal view shows.
13) In the staff client hide all the items for this record using OpacHiddenItems. (e.g. homebranch: [BRANCH1,BRANCH2,BRANCH3])
14) Refresh the OPAC
15) There should be a "404.pl" displayed.
16) Paste the URL saved in step 6.
17) There should be a "404.pl" displayed.
18) In the staff client blank the OpacHiddenItems system preference.
19) Paste the URL saved in step 6.
20) All the items should be displayed in normal view.
21) Click the MARC view and all the items should be displayed.
Comment 1 Mark Tompsett 2013-09-11 13:03:45 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2013-09-13 09:51:13 UTC
This patch should be rebased on bug 10872.
Comment 3 Jonathan Druart 2013-09-13 09:51:57 UTC
I tried to fix the conflict but the behavior is not what you described.
Comment 4 Mark Tompsett 2013-09-13 10:22:04 UTC
I hadn't gotten to fixing this one yet. Basically, this adds a next if check into a loop that builds the %this_row stuff, and would require bug 10872 and 10584 to be applied. I'll be fixing this up shortly.
Comment 5 Mark Tompsett 2013-09-13 11:25:58 UTC Comment hidden (obsolete)
Comment 6 Mark Tompsett 2013-09-13 12:01:10 UTC Comment hidden (obsolete)
Comment 7 Tomás Cohen Arazi 2013-09-16 15:47:49 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2013-09-17 07:55:49 UTC
Created attachment 21135 [details] [review]
Bug 10876 - Fix opac-MARCdetail.pl partial hides

When OpacHiddenItems is used to hide some, but not all of the
items for a biblio, then the opac-MARCdetail page displayed
all the items, rather than just the ones intended to be visible.

By determining the tag and subtag for items.itemnumber, the
loop which builds the big array can be filtered to exclude
records that should be hidden.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as expected, passes koha-qa also.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 9 Jonathan Druart 2013-09-17 07:57:04 UTC
The patch depends on bug 10584 and bug 10872.
Works as expected.
Marked as Passed QA.
Comment 10 Galen Charlton 2013-09-18 16:07:01 UTC
Pushed to master.  Thanks, Mark!
Comment 11 Galen Charlton 2013-09-21 21:43:08 UTC
*** Bug 10194 has been marked as a duplicate of this bug. ***