Ignore:
Timestamp:
Feb 24, 2011, 6:04:43 PM (8 years ago)
Author:
gav
Message:

AJAX PM Entry, first draft.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/EntryDetailedController.groovy

    r822 r826  
    9292    }
    9393
    94     def createMaintenanceAction = {
     94    def ajaxCreate = {
     95        if(!params.taskId || !params.entryTypeId) {
     96            flash.message = g.message(code:"entry.create.no.params")
     97            redirect(controller:"taskDetailed", action:"search")
     98            return
     99        }
    95100
    96 //         if(!params.taskInstance?.id || !params.entryType?.id) {
    97 //             flash.message = g.message(code:"entry.create.no.params")
    98 //             redirect(controller:"taskDetailed", action:"search")
    99 //             return
    100 //         }
     101        def taskInstance = Task.read(params.taskId)
    101102
    102         def taskInstance = Task.read(params.taskInstance.id)
    103         println taskInstance
    104         render "Done"
     103        if(!taskInstance) {
     104            flash.message = g.message(code:"task.notFound")
     105            redirect(controller:"taskDetailed", action:"search")
     106            return
     107        }
     108
     109        // Check for Complete task.
     110        if(taskInstance.taskStatus.id == 3) {
     111            flash.errorMessage = g.message(code:"task.operationNotPermittedOnCompleteTask")
     112            redirect(controller:"taskDetailed", action:"show", id: taskInstance.id)
     113            return
     114        }
     115
     116        def entryInstance = new Entry()
     117        entryInstance.task = taskInstance
     118        entryInstance.entryType = EntryType.read(params.entryTypeId)
     119        render(template: "create", model: ['entryInstance': entryInstance])
    105120    }
    106121
Note: See TracChangeset for help on using the changeset viewer.