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.
Created attachment 26903 [details] [review] Proposed patch
Please use the function C4::Context->IsSuperLibrarian() instead.
Created attachment 27083 [details] [review] Proposed patch v2 Use IsSuperLibrarian function
Created attachment 27098 [details] [review] 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.
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.
> 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?
Ah, I forgot to put a note here: bug 12080
Pushed to master, along with regression tests I wrote. Thanks, Frédéric!
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
(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. :(
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().
P.S. You need to fix Koha/Patron/List.pm (see the git grep -l IsSuperLibrarian in comment 10) in 3.14.x
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.