LP#842991 Reports needs to error when deleting fails
authorRemington Steed <rjs7@calvin.edu>
Wed, 27 Nov 2013 14:55:35 +0000 (09:55 -0500)
committerDan Wells <dbw2@calvin.edu>
Tue, 21 Jan 2014 22:20:35 +0000 (17:20 -0500)
When attempting to delete a report template, the reports interface
incorrectly shows "Action Succeeded" even when it partly fails. If the
user performing the delete does not own all the dependent reports and
outputs, then the perl function returns 1 to indicate that some were
deleted, but not all. However, the javascript that calls that function
does not check for a return value of 1. This commit adds that check, and
also improves the formatting of the related error messages.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/web/opac/locale/en-US/reports.dtd
Open-ILS/web/reports/oils_rpt_folder_window.js

index 09a721b..f572515 100644 (file)
 <!ENTITY reports.oils_rpt_folder_window.select_folder "Select Folder">
 <!ENTITY reports.oils_rpt_folder_window.cancel "Cancel">
 <!ENTITY reports.oils_rpt_folder_window.confirm_delete "Are you sure you wish to delete the selected item(s)?">
-<!ENTITY reports.oils_rpt_folder_window.dependant_reports_no_delete "One or more of the selected templates could not be deleted because there are reports that depend on them.">
-<!ENTITY reports.oils_rpt_folder_window.dependant_outputs_no_delete "One or more of The selected reports could not be deleted because there are outputs that depend on them.">
+<!ENTITY reports.oils_rpt_folder_window.dependant_reports_no_delete "
+        One or more of the selected templates could not be deleted because
+        there are reports or outputs that depend on them.">
+<!ENTITY reports.oils_rpt_folder_window.dependant_outputs_no_delete "
+        One or more of the selected reports could not be deleted because
+        there are outputs that depend on them.">
 <!ENTITY reports.oils_rpt_folder_window.cannot_delete_another_users_data "You may not delete another user's items">
 <!ENTITY reports.oils_rpt_folder_window.cannot_move_another_users_data "You may not move another user's items">
 <!ENTITY reports.oils_rpt_folder_window.delete_all_attached_reports "
index b9d31b3..dc6a7d0 100644 (file)
@@ -444,6 +444,7 @@ oilsRptFolderWindow.prototype.deleteTemplates = function(list, idx, callback, er
                                        req.callback(function(r) {
                                                var res = r.getResultObject();
                                                if( res == 0 ) return oilsRptAlertFailure();
+                                               if( res == 1 ) errid = 'oils_rpt_folder_contents_template_no_delete';
                                                obj.deleteTemplates(list, ++idx, callback, errid)
                                        });
                                        req.send();