Changeset 816 for trunk/grails-app


Ignore:
Timestamp:
Feb 21, 2011, 8:50:33 PM (14 years ago)
Author:
gav
Message:

Add check to prevent changing a tasks primaryAsset if maintenanceActions have been created.

Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/i18n/messages.properties

    r809 r816  
    163163task.assignedPersons.failedToSave=Could not complete operation, as assignedPerson record failed to save.
    164164tast.taskRecurringSchedule.alreadyExists=This task already has a recurring schedule.
     165tast.operationNotPermittedToChangeAssetWithMaintenanceActions=Changing the primaryAsset \
     166    on a task with maintenanceActions is not permitted, remove the maintenanceActions first.
    165167task.targetCompletionDate.before.targetStartDate=The target completion date must be equal to or greater than \
    166168    the target start date.
  • trunk/grails-app/services/TaskService.groovy

    r809 r816  
    415415            result.taskInstance.properties = params
    416416
     417            if(result.taskInstance.taskProcedureRevision?.maintenanceActions && result.taskInstance.isDirty('primaryAsset'))
     418                return fail(field:'primaryAsset', code:"tast.operationNotPermittedToChangeAssetWithMaintenanceActions")
     419
    417420            if(result.taskInstance.hasErrors() || !result.taskInstance.save())
    418421                return fail(code:"default.update.failure")
Note: See TracChangeset for help on using the changeset viewer.