Bug 36868: (QA follow-up) Fix deletion off by one error

When the biblionumber is not in the array -1 is returned.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Brendan Lawlor 2026-07-23 14:24:43 +00:00 committed by Pedro Amorim
parent 9b5f75a79e
commit ae903a008d
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 4 additions and 4 deletions

View File

@ -270,8 +270,8 @@ function delSingleRecord(biblionumber) {
var arrayRecords = valCookie.split("/");
var pos = jQuery.inArray(biblionumber, arrayRecords);
// the cart is empty, bail
if (pos <= 0) {
// if pos is -1, the cart is empty, bail
if (pos === -1) {
return;
}

View File

@ -236,8 +236,8 @@ function delSingleRecord(biblionumber) {
var pos = jQuery.inArray(biblionumber, arrayRecords);
arrayRecords.splice(pos, 1);
//if cart is empty, bail
if (pos <= -1) {
// if pos is -1, the cart is empty, bail
if (pos === -1) {
return;
}