diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index d81f3522f6..ad2dcc6412 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -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"),