Summary: | Call to C4::Context->userenv happens before it's gets populated breaks code logic in circulation | ||
---|---|---|---|
Product: | Koha | Reporter: | Slava Shishkin <slavashishkin> |
Component: | Circulation | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | Pushed to oldstable --- | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | critical | ||
Priority: | P5 - low | CC: | aleisha, eric, fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, kyle, lucas, madamyk, michael.hafen, mspinney, nick, nugged, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
24.05.00,23.11.03,23.05.09
|
|
Circulation function: | |||
Bug Depends on: | 17798 | ||
Bug Blocks: | 36139 | ||
Attachments: |
Bug 35518: Check authentication and set userenv before fetching userenv variables
Bug 35518: Check authentication and set userenv before fetching userenv variables Bug 35518: Check authentication and set userenv before fetching userenv variables Bug 35518: Tidy the moved blocks Bug 35518: follow up - clear the barcode list in AutoSwitchPatron block Bug 35518: Follow-up for AutoSwitchPatron - clear $patron variable too |
Description
Slava Shishkin
2023-12-07 21:04:01 UTC
Created attachment 161539 [details] [review] Bug 35518: Check authentication and set userenv before fetching userenv variables Currently we get the userenv before we have set it correctly for the session To test: 1 - Sign in as a user with fast cataloging permission 2 - Bring up a patron, type gibberish into barcode field to get a fast cataloging link 3 - Check the link, it should have your current signed in barcode 4 - Sign in to a different browser with a different user and at a different branch 5 - Bring up a aptron in circulation and type gibberish into barcode field to get a fast cataloging link 6 - It may have your branch, but it may also have the other user's branch from the other window 7 - Keep entering gibberish to get a link until one user has the correct branch 8 - Then switch to the other browser, and keep entering gibberish, watch the branchcode change 9 - Apply patch, restart all 10 - Test switching between browsers. generating fast cataloging links 11 - Users should now consistently have the correct branch Created attachment 161707 [details] [review] Bug 35518: Check authentication and set userenv before fetching userenv variables Currently we get the userenv before we have set it correctly for the session To test: 1 - Sign in as a user with fast cataloging permission 2 - Bring up a patron, type gibberish into barcode field to get a fast cataloging link 3 - Check the link, it should have your current signed in barcode 4 - Sign in to a different browser with a different user and at a different branch 5 - Bring up a aptron in circulation and type gibberish into barcode field to get a fast cataloging link 6 - It may have your branch, but it may also have the other user's branch from the other window 7 - Keep entering gibberish to get a link until one user has the correct branch 8 - Then switch to the other browser, and keep entering gibberish, watch the branchcode change 9 - Apply patch, restart all 10 - Test switching between browsers. generating fast cataloging links 11 - Users should now consistently have the correct branch Signed-off-by: David Nind <david@davidnind.com> Created attachment 161929 [details] [review] Bug 35518: Check authentication and set userenv before fetching userenv variables Currently we get the userenv before we have set it correctly for the session To test: 1 - Sign in as a user with fast cataloging permission 2 - Bring up a patron, type gibberish into barcode field to get a fast cataloging link 3 - Check the link, it should have your current signed in barcode 4 - Sign in to a different browser with a different user and at a different branch 5 - Bring up a aptron in circulation and type gibberish into barcode field to get a fast cataloging link 6 - It may have your branch, but it may also have the other user's branch from the other window 7 - Keep entering gibberish to get a link until one user has the correct branch 8 - Then switch to the other browser, and keep entering gibberish, watch the branchcode change 9 - Apply patch, restart all 10 - Test switching between browsers. generating fast cataloging links 11 - Users should now consistently have the correct branch Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 161930 [details] [review] Bug 35518: Tidy the moved blocks This patch just tidies the moved blocks to get us past the QA script check. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> No regressions found, QA script happy. Passing QA this comment is not related to the code/solution, but to the problem as before the ticket: we recently found that before this solution Koha brings the wrong returning branches when the item is returned on circ/circulation.pl page (moreover, it looks like (unsure) that it reads branch data of another user from the Plack session because the current wasn't populated properly) so this bug should have "increased" priority, IMO. It's already PQA, we're in a security freeze right now. It'll be pushed as soon as that freeze is unlocked. Pushed to master for 24.05.00, thanks for the hard work everyone. Pushed to 23.11.x for 23.11.03 I found a bug with this patch. Because the AutoSwitch check has been moved to after the @$barcodes variable is filled, if I scan a patron barcode into the item barcode field (as my librarians do all the time), the @$barcodes variable gets filled, but not emptied, and the 'Barcode not found' error surfaces. I'll be submitting a (trivial) patch to correct that in a moment. Created attachment 162216 [details] [review] Bug 35518: follow up - clear the barcode list in AutoSwitchPatron block The AutoSwitchPatron block got moved, and now the @$barcodes variable gets filled and not cleared. Leading to a 'Barcode not found' error when the patron is auto switched. Created attachment 162218 [details] [review] Bug 35518: Follow-up for AutoSwitchPatron - clear $patron variable too Another follow up: The AutoSwitchPatron clears the $borrowernumber variable to switch patrons. With the AuthSwitchPatron block moved, the $patron variable still gets set, and the patron doesn't get switched. The clears the $patron variable too. Hi Michael Thanks for that. You should create a new bug report with those patches since the previous ones have already been pushed. And beware of commit messages for follow-ups : https://wiki.koha-community.org/wiki/Commit_messages#Follow-ups Would it be possible for this to be backported to 23.05? +1 to Eric's question. This is causing significant confusion in several different contexts in our consortium. Backported to 23.05.x for upcoming 23.05.09 (In reply to Fridolin Somers from comment #13) > Hi Michael > Thanks for that. > > You should create a new bug report with those patches since the previous > ones have already been pushed. > And beware of commit messages for follow-ups : > https://wiki.koha-community.org/wiki/Commit_messages#Follow-ups I was to late in marking those two patches obsolete, they were included in the push to 23.05.x. I made bug 36139 to track my patches. I foresee some confusion here. in 23.05.x those two extra patches should be reverted, or bug 36139 needs to Not be backported. (In reply to Michael Hafen from comment #17) > (In reply to Fridolin Somers from comment #13) > > Hi Michael > > Thanks for that. > > > > You should create a new bug report with those patches since the previous > > ones have already been pushed. > > And beware of commit messages for follow-ups : > > https://wiki.koha-community.org/wiki/Commit_messages#Follow-ups > > I was to late in marking those two patches obsolete, they were included in > the push to 23.05.x. > > I made bug 36139 to track my patches. > > I foresee some confusion here. in 23.05.x those two extra patches should be > reverted, or bug 36139 needs to Not be backported. Hey Lucas, do you understand what is required here for 23.05.x? > Hey Lucas, do you understand what is required here for 23.05.x? Do we need to revert Bug 36139 from 23.05.x? Don't need to revert Bug 36139 since it doesn't seem to have been back-ported at this point. Just need to make sure it doesn't get pulled into 23.05.x. (In reply to Michael Hafen from comment #20) > Don't need to revert Bug 36139 since it doesn't seem to have been > back-ported at this point. Just need to make sure it doesn't get pulled > into 23.05.x. We are seeing this bug in 23.05 so just want to check that the next release will have this fixed. You mentioned earlier "in 23.05.x those two extra patches should be reverted" - are you referring to the patches on this report, Bug 35518 need to be reverted from 23.05? There are two extra patches on this bug that are now obsolete. This bug was backported to 23.05.x before those two patches were marked obsolete. Those two patches are now on Bug 36139. My advise was that either Bug 36139 should be skipped (not backported to 23.05.x) OR the two extra patches should be reverted. I'll leave which option is the more appropriate to your discretion, in my opinion you should leave those two patches as is on this bug (don't revert them) and skip Bug 36139. Ah yes sorry that makes sense! |