https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40116

Emmi Takkinen <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #183240|0                           |1
        is obsolete|                            |

--- Comment #4 from Emmi Takkinen <[email protected]> ---
Comment on attachment 183240
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183240
Bug 40116: Do not display "Patron is already a guarantor..."  pop-up when error
occurs

>From db6d7ef8c3fc95a837b29ae15dcfed7e302eba00 Mon Sep 17 00:00:00 2001
>From: Emmi Takkinen <[email protected]>
>Date: Fri, 13 Jun 2025 13:15:57 +0300
>Subject: [PATCH] Bug 40116: Do not display "Patron is already a guarantor..."
> pop-up when error occurs
>
>If a yellow error message appears when saving the guaranteed patron,
>also an extra popup message "Patron is already a guarantor for this
>patron" will appear on the screen. It should only appear when you try
>to add the same patron as a guarantor that already is a guarantor for
>that patron. This happens because js function select_user is triggered
>every time when guarantor data is send back to front-end. This patch
>sends nok variable as parameter to this same function so that if error
>occurs checkin patron guarantors is skipped.
>
>To test:
>1. Find a patron with Patron guarantor or add first a Patron guarantor
>(not a Non-patron guarantor) to a juvenile patron and save.
>2. Edit again the same patron with guarantor and modify their age
>to be greater than the upperage or under the required age of the patron
>category.
>=> Notice that you will get a yellow message "The following fields are wrong.
>Please fix them..."
>=> Notice that you will also get a pop up notice that says "Patron is already
>a guarantor for this patron".
>3. Apply this patch.
>4. Repeat step 2.
>=> Confirm that yellow message box is displayed but "Patron is..." pop-up is 
>not
>5. Try to add same patron guarantor as guarantor for guarantee patron again.
>=> Confirm that pop-up is displayed right after attempting to add guarantor.
>
>Sponsored-by: Koha-Suomi Oy
>---
> .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt   | 2 +-
> koha-tmpl/intranet-tmpl/prog/js/members.js                    | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt 
>b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>index 361a178107..494bf3cc37 100644
>--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
>@@ -1779,7 +1779,7 @@
> 
>             [% IF new_guarantors %]
>                 [% FOREACH g IN new_guarantors %]
>-                    select_user( '[% g.patron.borrowernumber | html %]', [% 
>To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
>+                    select_user( '[% g.patron.borrowernumber | html %]', [% 
>To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]', [% nok 
>| $raw %] );
>                 [% END %]
>             [% END %]
> 
>diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js 
>b/koha-tmpl/intranet-tmpl/prog/js/members.js
>index a20561cfe0..7429e21859 100644
>--- a/koha-tmpl/intranet-tmpl/prog/js/members.js
>+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js
>@@ -90,12 +90,12 @@ function update_category_code(category_code) {
>     hint.html(hint_string);
> }
> 
>-function select_user(borrowernumber, borrower, relationship) {
>+function select_user(borrowernumber, borrower, relationship, nok) {
>     let is_guarantor = $(
>         `.guarantor-details[data-borrowernumber=${borrowernumber}]`
>     ).length;
> 
>-    if (is_guarantor) {
>+    if (is_guarantor && !nok) {
>         alert("Patron is already a guarantor for this patron");
>     } else {
>         $("#guarantor_id").val(borrowernumber);
>-- 
>2.34.1
>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to