← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14774: Approval level, user feedback when level cannot be deleted

 

------------------------------------------------------------
revno: 14774
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-10 19:36:33 +0200
message:
  Approval level, user feedback when level cannot be deleted
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java	2014-04-10 01:28:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java	2014-04-10 17:36:33 +0000
@@ -28,15 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.apache.commons.io.IOUtils;
-import org.hisp.dhis.api.utils.ContextUtils;
 import org.hisp.dhis.common.DeleteNotAllowedException;
 import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelService;
+import org.hisp.dhis.i18n.I18n;
 
 import com.opensymphony.xwork2.Action;
-import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.external.location.LocationManagerException;
 
 /**
  * @author Jim Grace
@@ -56,6 +53,13 @@
         this.dataApprovalLevelService = dataApprovalLevelService;
     }
 
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -92,9 +96,12 @@
         }
         catch ( DeleteNotAllowedException ex )
         {
-            message = ex.getMessage();
-
-            return ERROR;
+            if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+            {
+                message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+                
+                return ERROR;
+            }
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2014-04-10 01:28:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2014-04-10 17:36:33 +0000
@@ -90,4 +90,5 @@
 months=Months
 openid_provider_label=OpenID Provider Label
 openid_provider=OpenID Provider
-allow_users_to_grant_own_user_roles=Allow users to grant own user roles
\ No newline at end of file
+allow_users_to_grant_own_user_roles=Allow users to grant own user roles
+object_not_deleted_associated_by_objects=Object not deleted because it is associated by objects of type
\ No newline at end of file