Bugzilla – Attachment 50275 Details for
Bug 16262
Remove the use of "onclick" from acquisitions basket template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16262 - Remove the use of "onclick" from acquisitions basket template
Bug-16262---Remove-the-use-of-onclick-from-acquisi.patch (text/plain), 15.20 KB, created by
Marc Véron
on 2016-04-15 14:01:23 UTC
(
hide
)
Description:
Bug 16262 - Remove the use of "onclick" from acquisitions basket template
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-04-15 14:01:23 UTC
Size:
15.20 KB
patch
obsolete
>From f0cdf80c7611044c861ef392d5395d79a64e0d69 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 14 Apr 2016 13:40:17 -0400 >Subject: [PATCH] Bug 16262 - Remove the use of "onclick" from acquisitions > basket template >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >In order to bring the acquisitions basket template into compliance with >coding guideline JS9, this patch changes with way some JavaScript events >are handled by moving JS handling out of the HTML markup. > >Also changed: Replaced the use of [% script_name %] (which is >undefined), with the actual script path. > >To test, apply the patch and locate an open basket in Acquisitions which >has more than one order in it. > >- Test the "Managed by: Add user" button and verify that it triggers a > popup where you can search for patrons. > - Select two or more patrons to be managers for the basket. > - Close the search windows and confirm that your choices appear on the > basket page. > - Click "Delete user" next to one of the patrons. The patron should be > removed. > - Click "Save changes" and verify that your choices are correctly > saved. > - Click "Delete user" next to one of the remaining patrons. The patron > should be removed. > - Click "Save changes" and verify that the patron stays deleted. >- In the list of orders, click the "Transfer" link and confirm that the > correct pop-up window is triggered. >- Test the "Delete this basket" button in the toolbar. A modal window > should be triggered. > - In a basket with orders: > - The "Delete basket and orders" button should do what it says, > leaving associated bibliographic records intact. > - The "Delete basket, orders, and records" button should do what it > says, deleting any bibliographic records associated with orders. > - In a basket with no orders: > - The "Delete basket" button should work correctly. >- Test the "Create edifact order" button. > - Click "Send EDI order" on the resulting page. > - In the resulting dialog, "Are you sure you want to generate an > edifact order," verify that both the "Yes" and "No" options work > correctly. > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 80 ++++++++++++++------ > 1 file changed, 58 insertions(+), 22 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index 5aec704..569006b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -33,6 +33,21 @@ > $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML); > }); > [% END %] >+ >+ $("body").on("click", ".del_user", function(e){ >+ e.preventDefault(); >+ del_user( $(this).data("borrowernumber") ); >+ }); >+ >+ $("#add_user").on("click",function(e){ >+ e.preventDefault(); >+ UserSearchPopup(); >+ }); >+ >+ $(".transfer_order").on("click",function(e){ >+ e.preventDefault(); >+ transfer_order_popup( $(this).data("ordernumber")); >+ }); > }); > //]]> > </script> >@@ -41,10 +56,6 @@ > <script type="text/javascript"> > //<![CDATA[ > >- function delete_basket(basketno,booksellerid,delbiblio) { >- window.location = "[% script_name %]?op=delete_confirm&delbiblio="+delbiblio+"&basketno="+basketno+"&booksellerid="+booksellerid; >- } >- > function transfer_order_popup(ordernumber) { > var url = "/cgi-bin/koha/acqui/transferorder.pl?" > + "ordernumber=" + ordernumber >@@ -54,7 +65,7 @@ > function confirm_ediorder() { > var is_confirmed = confirm(_("Are you sure you want to close this basket and generate an Edifact order?")); > if (is_confirmed) { >- window.location = "[% script_name %]?op=edi_confirm&basketno=[% basketno %]"; >+ window.location = "/cgi-bin/koha/acqui/basket.pl?op=edi_confirm&basketno=[% basketno %]"; > } > } > >@@ -79,7 +90,7 @@ > var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %]; > var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?")); > if (is_confirmed) { >- window.location = "[% script_name %]?op=reopen&basketno=[% basketno %]"; >+ window.location = "/cgi-bin/koha/acqui/basket.pl?op=reopen&basketno=[% basketno %]"; > } > } > //]]> >@@ -127,8 +138,8 @@ > ids.push(borrowernumber); > $("#users_ids").val(ids.join(':')); > var li = '<li id="user_'+borrowernumber+'">'+borrowername >- + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">' >- + _("Delete user") + '</a>]</li>'; >+ + ' <a href="#" data-borrowernumber="'+borrowernumber+'" class="del_user"><i class="fa fa-trash"></i> ' >+ + _("Delete user") + '</a></li>'; > $("#users_names").append(li); > return 0; > } >@@ -173,16 +184,16 @@ > [% END %] > <div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]&op=add_form" class="btn btn-small" id="basketheadbutton"><i class="fa fa-pencil"></i> Edit basket</a></div> > [%# FIXME This action should not be available for everyone %] >- <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-small" data-toggle="modal" id="delbasketbutton"><i class="fa fa-remove"></i> Delete this basket</a></div> >+ <div class="btn-group"><a href="#deleteBasketModal" role="button" class="btn btn-small" data-toggle="modal" id="delbasketbutton"><i class="fa fa-trash"></i> Delete this basket</a></div> > [% IF ( unclosable ) %] > [% ELSIF ( uncertainprices ) %] > <div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&owner=1" class="btn btn-small" id="uncertpricesbutton">Uncertain prices</a></div> > [% ELSE %] > <div class="btn-group"> >- <a href="[% script_name %]?op=close&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="closebutton"><i class="fa fa-times-circle"></i> Close this basket</a> >+ <a href="/cgi-bin/koha/acqui/basket.pl?op=close&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="closebutton"><i class="fa fa-times-circle"></i> Close this basket</a> > </div> > [% END %] >- <div class="btn-group"><a href="[% script_name %]?op=export&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="fa fa-download"></i> Export this basket as CSV</a></div> >+ <div class="btn-group"><a href="/cgi-bin/koha/acqui/basket.pl?op=export&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="fa fa-download"></i> Export this basket as CSV</a></div> > [% IF ediaccount %] > <div class="btn-group"><a href="/cgi-bin/koha/acqui/edi_ean.pl?op=ediorder&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="ediorderbutton"><i class="fa fa-download"></i> Create edifact order</a></div> > [% END %] >@@ -199,7 +210,13 @@ > </div> > <div class="modal-footer"> > <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button> >- <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket</button> >+ <form action="/cgi-bin/koha/acqui/basket.pl" method="get"> >+ <input type="hidden" name="op" value="delete_confirm" /> >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ <input type="hidden" name="delbiblio" value="0" /> >+ <button type="submit" class="btn btn-default">Delete basket</button> >+ </form> > </div> > [% ELSE %] > <div class="modal-body"> >@@ -211,8 +228,22 @@ > </div> > <div class="modal-footer"> > <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button> >- <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;">Delete basket and orders</button> >- <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and bibs</button> >+ <form action="/cgi-bin/koha/acqui/basket.pl" method="get"> >+ <input type="hidden" name="op" value="delete_confirm" /> >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ <input type="hidden" name="delbiblio" value="0" /> >+ <button type="submit" class="btn btn-default">Delete basket and orders</button> >+ </form> >+ >+ <form action="/cgi-bin/koha/acqui/basket.pl" method="get"> >+ <input type="hidden" name="op" value="delete_confirm" /> >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ <input type="hidden" name="delbiblio" value="1" /> >+ <button type="submit" class="btn btn-default">Delete basket, orders, and records</button> >+ </form> >+ > </div> > [% END %] > </div> >@@ -221,7 +252,7 @@ > [% UNLESS ( grouped ) %] > <div id="toolbar" class="btn-toolbar"> > <div class="btn-group"><a href="#" class="btn btn-small" id="reopenbutton"><i class="fa fa-refresh"></i> Reopen this basket</a></div> >- <div class="btn-group"><a href="[% script_name %]?op=export&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="fa fa-download"></i> Export this basket as CSV</a></div> >+ <div class="btn-group"><a href="/cgi-bin/koha/acqui/basket.pl?op=export&basketno=[% basketno %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="fa fa-download"></i> Export this basket as CSV</a></div> > </div> > [% END %] > [% END %] >@@ -231,7 +262,9 @@ > <h2>Vendor not found</h2> > [% ELSE %] > [% IF ( delete_confirmed ) %] >- <h3>Basket deleted</h3> >+ <div class="dialog message"> >+ <h3>Basket deleted</h3> >+ </div> > [% IF (cannotdelbiblios) %] > <div class="dialog alert"> > <p><strong>Warning:</strong></p> >@@ -276,14 +309,14 @@ > [% FOREACH user IN users %] > <li id="user_[% user.borrowernumber %]"> > [% user.firstname %] [% user.surname %] >- [<a onclick="del_user([% user.borrowernumber %]);" style="cursor:pointer">Delete user</a>] >+ <a href="#" data-borrowernumber="[% user.borrowernumber %]" class="del_user"><i class="fa fa-trash"></i> Delete user</a> > </li> > [% END %] > </ul> > <input type="hidden" id="basketno" name="basketno" value="[% basketno %]" /> > <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids %]" /> > <input type="hidden" id="op" name="op" value="mod_users" /> >- <input type="button" id="add_user" onclick="UserSearchPopup();" value="Add user" /> >+ <input type="button" id="add_user" value="Add user" /> > <input type="submit" value="Save changes" /> > </div> > </form> >@@ -529,7 +562,7 @@ > <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&booksellerid=[% booksellerid %]&basketno=[% basketno %]">Modify</a> > [% UNLESS (books_loo.order_received) %] > <br /> >- <a href="#" onclick="transfer_order_popup([% books_loo.ordernumber %]); return false;">Transfer</a> >+ <a href="#" class="transfer_order" data-ordernumber="[% books_loo.ordernumber %]">Transfer</a> > [% END %] > </td> > <td> >@@ -687,7 +720,7 @@ > [% IF edi_confirm %] > <div id="closebasket_needsconfirmation" class="dialog alert"> > >- <form action="/cgi-bin/koha/acqui/basket.pl" class="confirm"> >+ <form action="/cgi-bin/koha/acqui/basket.pl"> > <h1>Are you sure you want to generate an edifact order and close basket [% basketname|html %]?</h1> > [% IF CAN_user_acquisition_group_manage %] > <p> >@@ -701,8 +734,11 @@ > <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> > <input type="hidden" name="confirm" value="1" /> > <input type="hidden" name="basketgroupname" value="[% basketgroupname %]" /> >- <input type="submit" class="approve" value="Yes, close (Y)" accesskey="y" /> >- <input type="submit" class="deny" value="No, don't close (N)" accesskey="n" onclick="javascript:window.location='/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]';return false;" /> >+ <button type="submit" class="approve" accesskey="Y"><i class="fa fa-fw fa-check"></i> Yes, close (Y)</button> >+ </form> >+ <form action="/cgi-bin/koha/acqui/basket.pl" method="get"> >+ <input type="hidden" name="basketno" value="[% basketno %]" /> >+ <button type="submit" class="deny" accesskey="N"><i class="fa fa-fw fa-remove"></i> No, don't close (N)</button> > </form> > </div> > [% END %] >-- >1.7.10.4
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 16262
:
50244
|
50275
|
50282