From 640260083a70854868c2817963c4513739f2bf84 Mon Sep 17 00:00:00 2001
From: Fridolin Somers <fridolin.somers@biblibre.com>
Date: Tue, 1 Dec 2020 16:22:15 +0100
Subject: [PATCH] Bug 27128: Follow-up to bug 25728 - Don't prefill av's code

Bug 25728 patch "Don't prefill av's code" does not work.
Calling empty val() retruns the attribut.
Should be val('').

Test plan :
1) Without patch
2) Edit a record
3) Edit a subfield with AV
4) Enter a new value to create it
5) You see the modal popup, edit and save
6) Enter another new value to create it
7) You see the modal popup => value is prefilled
8) Re-do test plan with patch => value is empty
---
 koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
index 6cfccd2539..a66edff559 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js
@@ -127,7 +127,7 @@ var Select2Utils = {
                                 var category = $(this).data("category");
                                 $("#avCreate #new_av_category").html(category);
                                 $("#avCreate input[name='category']").val(category);
-                                $("#avCreate input[name='value']").val();
+                                $("#avCreate input[name='value']").val('');
                                 $("#avCreate input[name='description']").val(e.params.data.text);
 
                                 $(this).val($(this).find("option:first").val()).trigger('change');
-- 
2.29.2