Bug 12048 - Doesn't display other libraries subscriptions when superlibrarian user
Summary: Doesn't display other libraries subscriptions when superlibrarian user
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Frédéric Demians
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 12080
  Show dependency treegraph
 
Reported: 2014-04-08 15:24 UTC by Frédéric Demians
Modified: 2015-06-04 23:30 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (1.60 KB, patch)
2014-04-08 15:28 UTC, Frédéric Demians
Details | Diff | Splinter Review
Proposed patch v2 (1.70 KB, patch)
2014-04-14 11:12 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 12048 - Doesn't display other libraries subscriptions when superlibrarian user (2.34 KB, patch)
2014-04-14 16:01 UTC, Mark Tompsett
Details | Diff | Splinter Review
[PASSED QA] Bug 12048 - Doesn't display other libraries subscriptions when superlibrarian user (2.87 KB, patch)
2014-04-14 20:54 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 12048 - 3.14.x version (891 bytes, patch)
2014-08-07 02:32 UTC, Mark Tompsett
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Demians 2014-04-08 15:24:54 UTC
This is a regression in master and 3.14. When a user has superlibrian
permissions, a search on serials subscriptions must display other libraries
subscriptions even when IndependantBranch syspref is enabled.

To reproduce/test the bug/patch:

1. Enable IndependanBranch
2. Login as a user not having superlibrarian permission
3. Search for a serial subscription on:
   /cgi-bin/koha/serials/serials-search.pl
4. Search a title which has at least 2 subscriptions: one in the user branch, and
   one in another branch
5. On the result page, just 1 subscription is displayed: the one attached to
   the userbranch
   => this is normal
6. Login as a user having superlibrarian permission
7. Repeat step 3-5.
8. You get the same result as 5. You should have seen all subscriptions.
Comment 1 Frédéric Demians 2014-04-08 15:28:47 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2014-04-14 04:22:41 UTC
Please use the function C4::Context->IsSuperLibrarian() instead.
Comment 3 Frédéric Demians 2014-04-14 11:12:30 UTC Comment hidden (obsolete)
Comment 4 Mark Tompsett 2014-04-14 16:01:08 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2014-04-14 20:54:27 UTC
Created attachment 27105 [details] [review]
[PASSED QA] Bug 12048 - Doesn't display other libraries subscriptions when superlibrarian user

This is a regression in master and 3.14. When a user has superlibrian
permissions, a search on serials subscriptions must display other libraries
subscriptions even when IndependentBranches syspref is enabled.

To reproduce/test the bug/patch:

1. Enable IndependentBranches (i.e. 'Prevent' staff...)
2. Login as a user not having superlibrarian permission
3. Search for a serial subscription on:
   /cgi-bin/koha/serials/serials-search.pl
4. Search a title which has at least 2 subscriptions: one in the user branch,
   and one in another branch
5. On the result page, just 1 subscription is displayed: the one attached to
   the userbranch
   => this is normal
6. Login as a user having superlibrarian permission
7. Repeat step 3-5.
8. You get the same result as 5. You should have seen all subscriptions.
   That's what you get after applying this patch.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: I tested a variation. My superlibrarian was a branch that
      was not the same as the non-superlibrarian. The serial was
      the same branch as the non-superlibrarian. Without the
      patch, the superlibrarian saw nothing, with the patch it
      saw the serial as expected.
      Also, remember the superserials permission can affect the
      results. I successfully changed the branch of the
      subscription, and then it ceased to show up with
      superserials not granted to the non-superlibrarian.
      I corrected the system preference name in the text here.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Superlibrarian permission now allows to see all subscriptions
independent from the branch.
Passes all tests and QA script.

But the superserials permission appears broken to me before
and after this patch. If I have superserials - the search
doesn't show all subscriptions. If I don't have superserials
I can still edit any subscription accessing the subscription
detail page through the serial collection page or accessing
the detail page directly by manipulating the URL.
Comment 6 Frédéric Demians 2014-04-15 05:37:00 UTC
> But the superserials permission appears broken to me before
> and after this patch. If I have superserials - the search
> doesn't show all subscriptions. If I don't have superserials
> I can still edit any subscription accessing the subscription
> detail page through the serial collection page or accessing
> the detail page directly by manipulating the URL.

Should another bug be opened? or a follow-up patch added to this one?
Comment 7 Katrin Fischer 2014-04-15 07:01:23 UTC
Ah, I forgot to put a note here: bug 12080
Comment 8 Galen Charlton 2014-04-18 20:50:31 UTC
Pushed to master, along with regression tests I wrote.  Thanks, Frédéric!
Comment 9 Fridolin Somers 2014-08-06 10:15:01 UTC
After applying patch to 3.14.x, the unit test t/db_dependent/Bookseller.t fails :

t/db_dependent/Bookseller.t .. 1/72 Use of uninitialized value $serialseq in string at /home/koha/src/C4/Serials.pm line 1537.
Can't use an undefined value as a HASH reference at /home/koha/src/C4/Serials.pm line 739.
# Looks like you planned 72 tests but ran 16.
# Looks like your test exited with 255 just after 16.
t/db_dependent/Bookseller.t .. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 56/72 subtests 

Test Summary Report
-------------------
t/db_dependent/Bookseller.t (Wstat: 65280 Tests: 16 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 72 tests but ran 16.
Files=1, Tests=16,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.77 cusr  0.06 csys =  0.87 CPU)
Result: FAIL
Comment 10 Mark Tompsett 2014-08-06 23:25:35 UTC
(In reply to Fridolin SOMERS from comment #9)
> After applying patch to 3.14.x, the unit test t/db_dependent/Bookseller.t
> fails :
> 

git checkout -b checkout_12048 origin/3.14.x
git grep -l IsSuperLibrarian

There is part of your problem: IsSuperLibrarian is not defined in C4::Context, because bug 10277 in not in stable.

Applying it first still doesn't help. :(
Comment 11 Mark Tompsett 2014-08-07 02:32:43 UTC
Created attachment 30563 [details] [review]
Bug 12048 - 3.14.x version

IsSuperLibrarian doesn't exist in 3.14.x
    C4::Context->userenv && C4::Context->userenv->{flags} != 1
is the 3.14.x equivalent of !C4::Context->IsSuperLibrarian().
Comment 12 Mark Tompsett 2014-08-07 04:04:17 UTC
P.S. You need to fix Koha/Patron/List.pm (see the git grep -l IsSuperLibrarian in comment 10) in 3.14.x
Comment 13 Fridolin Somers 2014-08-07 08:22:18 UTC
Pushed to 3.14.x, will be in 3.14.10

Thanks Mark for your help. I've resolved by intergrating Bug 10277 and some depending on it.