Bug 38649: Fix autocheckout for circulation Fast Add only

In addition to checking the referrer for the URL domain and path
we should also check the query string of the referrer to make sure
it was from a circulation fast add.

It should include frameworkcode=FA&circborrowernumber

To test:
1. From anywhere on the additem.pl page where you are adding or editing an item
2. Click on Checkout in the menu bar and enter a patron's barcode
3. When circulation.pl loads it triggers a blank issue slip to be printed
4. Apply patch and repeat steps 1-3, no slip is triggered to print
5. Go to Circulation Checkout for a patron and enter a non existing barcode like 1337
6. Click '+ Add record using fast cataloging'
7. Fill in required fields and click 'Add item'
8. Confirm the item is auto checked out

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 431109830c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Brendan Lawlor 2024-12-06 17:32:44 +00:00 committed by Paul Derscheid
parent 16f7ffd1c4
commit c0f72df9ff
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 1 additions and 1 deletions

View File

@ -1149,7 +1149,7 @@
// Handle checkout for fast cataloging
// Check the referrer to prevent csrf, fill and submit form
if(document.referrer.split('?')[0] === window.location.origin +'/cgi-bin/koha/cataloguing/additem.pl') {
if(document.referrer.split(window.location.origin + '/cgi-bin/koha/cataloguing/additem.pl?')[1].match(/frameworkcode=FA&circborrowernumber=/) ) {
let urlParams = new URLSearchParams(window.location.search);
let barcode = urlParams.get('barcode');
$('#barcode').val(barcode);