Description
Alex Buckley
2017-08-03 06:10:15 UTC
+1 :-) +1 We usually have 'do you really want to...' questions for deleting data. As cloning overwrites the existing rules completely and currently without warning, I think the alert would fit in our patterns and be really helpful. Created attachment 66519 [details] [review] 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 In the patch I have attach I implemented a security question but have not moved the clone button, please let me know if you think I need to move the clone button as well, because I personally think the security question is a great improvement on the previous behaviour and the moving of the clone button is not needed. While testing I get: 'Cloning of circulation and fine rules failed!' Plack error log says: DBD::mysql::st execute failed: Duplicate entry '5' for key 'PRIMARY' [for Statement "INSERT INTO issuingrules SELECT * FROM tmpissuingrules WHERE branchcode=?" with ParamValues: 0="MPL"] at /home/marc/koha/admin/clone-rules.pl line 86. Seems to be a separate bug, but it makes impossible to test here. (In reply to Marc Véron from comment #6) > While testing I get: > 'Cloning of circulation and fine rules failed!' > Plack error log says: > DBD::mysql::st execute failed: Duplicate entry '5' for key 'PRIMARY' [for > Statement "INSERT INTO issuingrules SELECT * FROM tmpissuingrules WHERE > branchcode=?" with ParamValues: 0="MPL"] at > /home/marc/koha/admin/clone-rules.pl line 86. > > Seems to be a separate bug, but it makes impossible to test here. Could be related to Bug 18231 - Add the missing id-column to koha.issuingrules-table for DBIC fixtures Created attachment 67323 [details] [review] 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> The patch works as planned - the security question only shows when cloning from standard rules. However I feel like it would be better to apply the security question to all cloning operations. Saving users the trouble of an accidental cloning is better than having 1 less click to do. Alex, you should use .format() to ease translation. Created attachment 67529 [details] [review] Bug 19029 - Followup - Implemented .format() to ease translation Sponosred by: Catalyst IT There seems to be no security question for cloning conditions from one library to another. I think it would be good to be consistent and always ask, as cloning accidentally can create quite a chaos. Created attachment 67980 [details] [review] Bug 19029 - Followup: Make security question appear on clone operations from one library to another Sponsored-By: Catalyst IT Hi all I have just attached a patch which implements the security question on clone operations from one library to another which Katrin suggested in comment 12. Could the 2 follow-up patches be tested please Created attachment 67983 [details] [review] Bug 19029 - Followup: Make security question appear on clone operations from one library to another Message pops up for all instances of cloning now. Works as expected. Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> Created attachment 68688 [details] [review] 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> Created attachment 68689 [details] [review] Bug 19029 - Followup - Implemented .format() to ease translation Sponosred by: Catalyst IT Created attachment 68690 [details] [review] Bug 19029 - Followup: Make security question appear on clone operations from one library to another Message pops up for all instances of cloning now. Works as expected. Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> Pushed to master for 17.11, thanks to everybody involved! |