Bugzilla – Attachment 68688 Details for
Bug 19029
Implement a security question for cloning circulation conditions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19029 - Added JavaScript security question for cloning circ rules
Bug-19029---Added-JavaScript-security-question-for.patch (text/plain), 4.46 KB, created by
Kyle M Hall (khall)
on 2017-10-27 12:55:58 UTC
(
hide
)
Description:
Bug 19029 - Added JavaScript security question for cloning circ rules
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-10-27 12:55:58 UTC
Size:
4.46 KB
patch
obsolete
>From 4f70b6005a745274165aca02904fbd544f150632 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Thu, 24 Aug 2017 21:25:40 +0000 >Subject: [PATCH] Bug 19029 - Added JavaScript security question for cloning > circ rules > >This patch introduces a Javascript security question which is displayed >to the user when they try to clone a circulation rule to a specific >branch when the rule is a 'Standard rule for all libraries" > >The rationale for this patch is when the cloning takes place it >overwrites the existing rules of the destination branch and there is no >notification of this to the user. Therefore by implementing this patch >the user is asked if they want to clone the rule (if the rule is >standard accross all libraries) and are told that it >will overwrite the rules in the destination branch. > >Test plan: >1. Create a circulation rule for all libraries > >2. Make sure the 'select a library' option is set to 'Standard rules for all >libraries" > >3. Click the 'Clone' button and notice that the cloning takes place >without any warning that it will overwrite the rules of the destination >branch > >4. Apply patch > >5. Return to the circulation and fine rules page > >6. Repeat step 2 > >7. Click the clone button and notice a alert box appears asking if you >are sure you want to clone the standard rule to the destination branch. > >Note: The name of the destination branch is included in the alert. >Also note that the user is informed of the consequences of performing >the action, i.e. that it will overwrite the existing rules in the >destination branch > >8. Click 'Cancel' and notice that no cloning occurs > >9. Click the clone button again and this time click 'OK' and notice >that the cloning takes place > >10. Return to the Circulation and fine rules page and set the 'Select a >library' option to the name of an individual branch > >11. Click the clone button and notice that the clone action takes place > >Sponsored-By: Catalyst IT > >Signed-off-by: David Bourgault <david.bourgault@inlibro.com> >--- > .../intranet-tmpl/prog/en/modules/admin/smart-rules.tt | 13 ++++++++++++- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 4 ++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 5bc44ba..1804a74 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -28,11 +28,22 @@ function clear_edit(){ > > var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone."); > >+ > $(document).ready(function() { > $(".delete").on("click",function(){ > return confirmDelete(MSG_CONFIRM_DELETE); > }); > >+ $("#clone_rules").on("click",function(){ >+ var library_dropdown = document.getElementById("branch"); >+ var selected_library = library_dropdown.options[library_dropdown.selectedIndex].value; >+ if (selected_library === "*") { >+ var to_library = $("#tobranch option:selected").text(); >+ var MSG_CONFIRM_CLONE = _("Are you sure you want to clone this standard rule to " + to_library + " library? This will override the existing rules in " + to_library + " library."); >+ return confirmClone(MSG_CONFIRM_CLONE); >+ } >+ }); >+ > $('#cap_fine_to_replacement_price').on('change', function(){ > $('#overduefinescap').prop('disabled', $(this).is(':checked') ); > }); >@@ -156,7 +167,7 @@ $(document).ready(function() { > <select name="tobranch" id="tobranch"> > [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %] > </select> >- <input type="submit" value="Clone" /> >+ <input type="submit" id="clone_rules" value="Clone" /> > </form> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index c4d9e5d..cd586da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -135,6 +135,10 @@ function confirmDelete(message) { > return (confirm(message) ? true : false); > } > >+function confirmClone(message) { >+ return (confirm(message) ? true : false); >+} >+ > function playSound( sound ) { > if ( ! ( sound.indexOf('http://') === 0 || sound.indexOf('https://') === 0 ) ) { > sound = AUDIO_ALERT_PATH + sound; >-- >2.10.2
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 19029
:
66519
|
67323
|
67529
|
67980
|
67983
| 68688 |
68689
|
68690