Bugzilla – Attachment 175565 Details for
Bug 38268
Callers of confirmModal need to remove the modal as the first step in their callback function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38268: Callers of confirmModal need to remove the modal as the first step in their callback function
Bug-38268-Callers-of-confirmModal-need-to-remove-t.patch (text/plain), 6.60 KB, created by
Martin Renvoize (ashimema)
on 2024-12-16 18:56:12 UTC
(
hide
)
Description:
Bug 38268: Callers of confirmModal need to remove the modal as the first step in their callback function
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-12-16 18:56:12 UTC
Size:
6.60 KB
patch
obsolete
>From a647c0ef161f0c63cc19f1cc7fb60fb5c0bfb850 Mon Sep 17 00:00:00 2001 >From: Phil Ringnalda <phil@chetcolibrary.org> >Date: Fri, 25 Oct 2024 11:15:08 -0700 >Subject: [PATCH] Bug 38268: Callers of confirmModal need to remove the modal > as the first step in their callback function > >Templates that use confirmModal to show a pretty confirm() need to >remove the modal in their callback function, or they are at risk of >having the first callback called for subsequent calls that think they >will get their own callback called. opac-user.tt is already fixed, >opac-shelves.tt is currently affected, and opace-suggestions.tt, >opac-tags.tt, and sco/sco-main.tt are at risk of being affected if >anyone adds another confirmModal caller. > >Test plan: > 1. Without the patch, open the OPAC, log in, search for something that > will return several results > 2. Select all - Add to list - New list > 3. Lists - {your list name} > 4. Click the checkboxes for the first two items > 5. Instead of clicking Remove from list, accidentally click Delete list > 6. In the confirmation popup, realize it was a mistake and click No, do > not delete > 7. Click Remove from list > 8. Poof, your whole list is gone > 9. Apply patch >10. Repeat steps 1-7, but instead of the whole list being deleted, see > that only the selected two items were removed >11. Now intentionally click Delete list and click Yes, delete, you'll > see that it is deleted rather than getting a message about nothing > being removed like you would have gotten without the patch if you > started by removing an item >12. On any bib detail page, click Add tag(s) and add one >13. Your account - Tags, check the checkbox for the tag, Remove selected > tags, Yes, delete tag and verify that it was deleted >14. Purchase suggestions - New purchase suggestion, fill in a title and > submit your suggestion, click the checkbox for your suggestion, > Delete selected, Yes, delete suggestion and verify it was deleted >15. In the staff interface, find and copy the barcode for any item that can > be checked out, then go to /cgi-bin/koha/sco/sco-main.pl with the > OPAC hostname and port, not the staff, and log in >16. Paste the barcode in the input, click Submit, then click Finish, and > in the confirmation popup click Print recept and end session, and > verify that it tries to print > >Sponsored-by: Chetco Community Public Library >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 3 +++ > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 1 + > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt | 1 + > koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 1 + > 4 files changed, 6 insertions(+) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 143491b555c..5f59a2d9b7d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -951,6 +951,7 @@ $(function() { > }); > } > confirmModal( message, title, yes_label, no_label, function( result ){ >+ $("#bootstrap-confirm-box-modal").remove(); > if( result ){ > if( biblionumber ){ > $("#shelf_delete_biblionumber").val( biblionumber ); >@@ -1003,6 +1004,7 @@ $(function() { > message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>"; > } > confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){ >+ $("#bootstrap-confirm-box-modal").remove(); > if( result ){ > $("#deleteshelf" + shelf_number ).submit(); > } >@@ -1015,6 +1017,7 @@ $(function() { > var shelf_name = $(this).data("shelfname"); > var shelf_number = $(this).data("shelfnumber"); > confirmModal( shelf_name, _("Are you sure you want to remove sharing? You will no longer have access to the list."), _("Yes, remove sharing"), _("No, do not remove sharing"), function( result ){ >+ $("#bootstrap-confirm-box-modal").remove(); > if( result ){ > $("#unshare" + shelf_number ).submit(); > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 312015c6ebe..0e33f7e39c3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -638,6 +638,7 @@ > }); > } > confirmModal( message, title, yes_label, no_label, function( result ){ >+ $("#bootstrap-confirm-box-modal").remove(); > if( result ){ > $("#delete_suggestions").submit(); > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >index 7e6dfa05e94..1f5cce9bb19 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >@@ -255,6 +255,7 @@ > }); > } > confirmModal( message, title, yes_label, no_label, function( result ){ >+ $("#bootstrap-confirm-box-modal").remove(); > if( result ){ > $("#deletetags").submit(); > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index 1e68d62898b..e705b2069f4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -612,6 +612,7 @@ > [% IF Koha.Preference('SelfCheckReceiptPrompt') %] > var confirmStart = Date.now(); > confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { >+ $("#bootstrap-confirm-box-modal").remove(); > if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) { > var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); > location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; >-- >2.47.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38268
:
173410
|
174995
|
175294
|
175310
|
175311
|
175325
|
175326
| 175565 |
175566