Bugzilla – Attachment 170538 Details for
Bug 31921
No confirmation alert when deleting a vendor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31921: Add confirmation modal when deleting a vendor
Bug-31921-Add-confirmation-modal-when-deleting-a-v.patch (text/plain), 7.85 KB, created by
Martin Renvoize (ashimema)
on 2024-08-21 08:53:33 UTC
(
hide
)
Description:
Bug 31921: Add confirmation modal when deleting a vendor
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-08-21 08:53:33 UTC
Size:
7.85 KB
patch
obsolete
>From 65b7148da8dd825c31172fe932d4b4c14912470c Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Tue, 9 Jul 2024 15:20:57 +0000 >Subject: [PATCH] Bug 31921: Add confirmation modal when deleting a vendor > >This patch adds a new modal for confirming vendor deletion. It fixes >the previous functionality, showing a confirmation modal for each >vendor and appropriately handling the response. > >To test: >1) Visit Acquisitions home. Under where it says 'Manage orders', click > the search bar to bring up the list of vendors. >2) Add a few vendors by clicking 'New' and 'Vendor'. After this, go back > to the vendor search so that all the vendors are showing. >3) For each vendor, click on 'Delete vendor' and ensure the modal shows > properly. >4) Attempt to delete one of the vendors. Go back to the vendor search > and ensure they are deleted correctly. >5) Click on a vendor's name to go their supplier page. Make sure modal > works properly and attempt to delete a vendor from here. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/includes/acquisitions-toolbar.inc | 7 +----- > .../prog/en/includes/modals/delete_vendor.inc | 23 +++++++++++++++++++ > .../prog/en/modules/acqui/booksellers.tt | 6 +++-- > .../prog/en/modules/acqui/supplier.tt | 2 ++ > koha-tmpl/intranet-tmpl/prog/js/acq.js | 6 +++-- > 5 files changed, 34 insertions(+), 10 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/delete_vendor.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc >index bf80bcabb4c..63171b96dd7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-toolbar.inc >@@ -23,12 +23,7 @@ > </div> > [% UNLESS ( basketcount OR subscriptioncount ) %] > <div class="btn-group"> >- <form action="/cgi-bin/koha/acqui/supplier.pl" method="post"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="op" value="cud-delete" /> >- <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> >- <button class="btn btn-default" id="deletesupplier" type="submit"><i class="fa fa-trash-can"></i> Delete vendor</button> >- </form> >+ <button type="button" data-toggle="modal" data-target="#deleteVendorModal" data-booksellerid="[% booksellerid | html %]" class="btn btn-default"><i class="fa fa-trash-can"></i> Delete vendor</button> > </div> > [% END %] > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/delete_vendor.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/delete_vendor.inc >new file mode 100644 >index 00000000000..be4801b88f6 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/delete_vendor.inc >@@ -0,0 +1,23 @@ >+<!-- Delete Vendor modal form --> >+<div id="deleteVendorModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="deleteVendorModalLabel"> >+ <form method="post" action="/cgi-bin/koha/acqui/supplier.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-delete" /> >+ <input type="hidden" name="booksellerid" id="booksellerid" value="" /> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="deleteVendorModalLabel">Delete vendor</h4> >+ </div> >+ <div class="modal-body"> >+ <p>Are you sure you want to delete this vendor?</p> >+ </div> >+ <div class="modal-footer"> >+ <button id="deleteVendorModaConfirmBtn" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</button> >+ <button id="deleteVendorModaCancelBtn"data-dismiss="modal" class="btn btn-secondary"><i class="fa fa-times" aria-hidden="true"></i> No</button> >+ </div> >+ </div> >+ </div> >+ </form> >+</div> >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >index a4718b04468..9bdae0fab24 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt >@@ -208,7 +208,7 @@ > <a class="btn btn-default btn-xs" id="addtoBasketLabel[% basket.basketno | html %]" href="#addtoBasket[% basket.basketno | html %]" role="button" data-toggle="modal"><i class="fa fa-plus"></i> Add to basket</a> > [% END %] > <!-- Modal --> >- <div id="addtoBasket[% basket.basketno | html %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno | html %]" aria-hidden="true" data-basketno="[% basket.basketname | html %]"> >+ <div id="addtoBasket[% basket.basketno | html %]" class="modal add_to_basket" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno | html %]" aria-hidden="true" data-basketno="[% basket.basketname | html %]"> > <div class="modal-dialog" role="document"> > <div class="modal-content"> > <div class="modal-header"> >@@ -257,6 +257,8 @@ > </div> > </div> <!-- /.row --> > >+[% INCLUDE 'modals/delete_vendor.inc' %] >+ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >@@ -277,7 +279,7 @@ > var id = $(this).find("option:selected").val(); > window.location.href = "#vendor" + id; > }); >- $(".modal").on("shown.bs.modal", function(){ >+ $(".add_to_basket").on("shown.bs.modal", function(){ > var basket = $(this).data("basketno"); > var legend = _("Add order to basket %s").format(basket); > $(this).find("h4").text( legend ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >index 8545c64a828..81d5fdb3e15 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt >@@ -524,6 +524,8 @@ > </aside> > </div> <!-- /.col-sm-2.col-sm-pull-10 --> > </div> <!-- /.row --> >+[% INCLUDE 'modals/delete_vendor.inc' %] >+ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acq.js b/koha-tmpl/intranet-tmpl/prog/js/acq.js >index d9d064f67aa..059cd4cea25 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acq.js >@@ -389,7 +389,9 @@ function hideAllColumns(){ > } > > $(document).ready(function(){ >- $("#deletesupplier").on("click", function(){ >- confirmDelete(__("Are you sure you want to delete this vendor?") ); >+ $("#deleteVendorModal").on("shown.bs.modal", function(e){ >+ var button = $(e.relatedTarget); >+ var item = button.data('booksellerid'); >+ $('#booksellerid').val(item); > }); > }); >-- >2.46.0
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 31921
:
168668
|
168674
|
168749
|
168832
|
170004
|
170005
| 170538 |
170539