Bug 39307: Check to make sure there is a document.referrer
To test: 1. Navigate to circ/circulation.pl?borrowernumber=X 2. See the console error `document.referrer.split(...)[1] is undefined` 3. Go to circ home circ/circulation-home.pl and search for a patron 4. See the console error when you select a patron or are taken directly to them 5. APPLY PATCH 5. JS error should be gone in both instances squash Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
8ea3785f0f
commit
db44d917ef
|
|
@ -1210,13 +1210,15 @@
|
|||
|
||||
// Handle checkout for fast cataloging
|
||||
// Check the referrer to prevent csrf, fill and submit form
|
||||
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);
|
||||
$('#mainform').submit();
|
||||
if (document.referrer.length) {
|
||||
const referrerSplit = document.referrer.split(window.location.origin + '/cgi-bin/koha/cataloguing/additem.pl?')
|
||||
if(referrerSplit[1] && referrerSplit[1].match(/frameworkcode=FA&circborrowernumber=/) ) {
|
||||
let urlParams = new URLSearchParams(window.location.search);
|
||||
let barcode = urlParams.get('barcode');
|
||||
$('#barcode').val(barcode);
|
||||
$('#mainform').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$("#cancellation-reason").comboBox({
|
||||
displayProperty: 'name',
|
||||
placeholder: _("Select or type a reason"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue