Bug 24113: guarantor info lost when a duplicate is found
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / members.js
index 7cdc1b9..da7d47e 100644 (file)
@@ -165,7 +165,7 @@ function update_category_code(category_code) {
     $(mytables).find(" li[data-category_code='']").show();
 }
 
-function select_user(borrowernumber, borrower) {
+function select_user(borrowernumber, borrower, relationship) {
     let is_guarantor = $(`.guarantor-details[data-borrowernumber=${borrower.borrowernumber}]`).length;
 
     if ( is_guarantor ) {
@@ -205,6 +205,10 @@ function select_user(borrowernumber, borrower) {
 
         $('#guarantor_relationships').append( fieldset );
         fieldset.show();
+
+        if ( relationship ) {
+            fieldset.find('.new_guarantor_relationship').val(relationship);
+        }
     }
 
     return 0;