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. How to reproduce: 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. 3. Notice that you will get a yellow message "The following fields are wrong. Please fix them. Patron's age is incorrect for their category. Ages allowed are xx-xx." 4. Notice that you will also get a pop up notice that says "Patron is already a guarantor for this patron". It should only appear when you try to add the same patron as a guarantor that already is a guarantor for that patron.
Bug 26558 made changes to restoring guarantor data when error occurs while creating/modifying patron. Now every time error occurs param new_guarantors is send to front-end side which triggers function select_user in member.js.
Created attachment 183240 [details] [review] 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
Created attachment 183249 [details] [review] 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 Signed-off-by: David Flater <flaterdavid@gmail.com>