From 311382db7b926d411f9fdc5b2e488e114c4a0435 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Mon, 20 Mar 2023 16:44:49 +0100
Subject: [PATCH] refs #23387 [finc] remove erroneous href javascript: for
 button without javascript action

* also fix error in lightbox_form_cache.js after deleting item
---
 themes/finc/js/lightbox_form_cache.js | 4 +++-
 themes/finc/templates/cart/cart.phtml | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/themes/finc/js/lightbox_form_cache.js b/themes/finc/js/lightbox_form_cache.js
index bbda19c1ec5..2e8aedcbbbf 100644
--- a/themes/finc/js/lightbox_form_cache.js
+++ b/themes/finc/js/lightbox_form_cache.js
@@ -29,7 +29,9 @@ document.addEventListener('DOMContentLoaded', function () {
     const inputs = Array.from(form.querySelectorAll('input:not([type=password])'))
         .concat(Array.from(form.querySelectorAll('textarea')));
     JSON.parse(cache.getItem(cacheKey) || '[]').forEach(function (value, index) {
-      inputs[index].value = value;
+      if (inputs[index]) {
+        inputs[index].value = value;
+      }
     });
 
     modal.querySelectorAll('a:not([data-reset-forms]):not(#cart-confirm-empty):not(#cart-confirm-delete)').forEach(function (link) {
diff --git a/themes/finc/templates/cart/cart.phtml b/themes/finc/templates/cart/cart.phtml
index ca99a0462f5..6bff5ff8b40 100644
--- a/themes/finc/templates/cart/cart.phtml
+++ b/themes/finc/templates/cart/cart.phtml
@@ -46,7 +46,7 @@
             <a href="javascript:" id="cart-confirm-delete" title="<?=$this->transEscAttr('confirm_delete')?>" role="menuitem"><?=$this->transEscAttr('confirm_dialog_yes')?></a>
           </li>
           <li role="none">
-            <a href="javascript:" role="menuitem"><?=$this->transEsc('confirm_dialog_no')?></a>
+            <a role="menuitem"><?=$this->transEsc('confirm_dialog_no')?></a>
           </li>
         </ul>
       </div>
@@ -59,7 +59,7 @@
             <a href="javascript:" id="cart-confirm-empty" title="<?=$this->transEscAttr('bookbag_confirm_empty')?>" role="menuitem"><?=$this->transEsc('confirm_dialog_yes')?></a>
           </li>
           <li role="none">
-            <a href="javascript:" id="cart-refuse-empty" role="menuitem"><?=$this->transEsc('confirm_dialog_no')?></a>
+            <a id="cart-refuse-empty" role="menuitem"><?=$this->transEsc('confirm_dialog_no')?></a>
           </li>
         </ul>
       </div>
-- 
GitLab