Index: trunk/grails-app/services/TaskService.groovy
===================================================================
--- trunk/grails-app/services/TaskService.groovy	(revision 185)
+++ trunk/grails-app/services/TaskService.groovy	(revision 186)
@@ -36,7 +36,70 @@
     } // end create()
 
-    def start() {
-        //TaskModificationType.get(2)
-    }  // end start()
+    def createEntry(params) {
+        Task.withTransaction { status ->
+            def result = [:]
+            result.entryInstance = new Entry(params)
+            result.entryInstance.enteredBy = personService.currentUser()
+
+            if(result.entryInstance.validate()) {
+                def taskInstance = Task.lock(result.entryInstance.task.id)
+                result.taskId = result.entryInstance.task.id
+
+                if(!taskInstance) {
+                    status.setRollbackOnly()
+                    result.entryInstance.errors.rejectValue('task', "entry.task.notFound")
+                    result.error = true
+                    return result
+                }
+
+                if(taskInstance.taskStatus.id == 3) {
+                    status.setRollbackOnly()
+                    result.entryInstance.errors.rejectValue('task', "entry.task.taskIsComplete")
+                    result.error = true
+                    return result
+                }
+
+                // If task status is "Not Started" and entry type is "Work Done" then we create the started modification and set the status.
+                if(taskInstance.taskStatus.id == 1 && result.entryInstance.entryType.id == 2) {
+
+                    // Create the "Started" task modification, this provides the "Actual started date".
+                    def taskModification = new TaskModification(person: personService.currentUser(),
+                                                            taskModificationType: TaskModificationType.get(2),
+                                                            task: taskInstance)
+
+                    if(!taskModification.save()) {
+                        status.setRollbackOnly()
+                        taskInstance.errors.rejectValue("task", "entry.task.failedToSaveTaskModification")
+                        result.error = true
+                        return result
+                    }
+
+                    // Set task status to "In progress".
+                    taskInstance.taskStatus = TaskStatus.get(2)
+
+                    if(!taskInstance.save()) {
+                        status.setRollbackOnly()
+                        result.entryInstance.errors.rejectValue("task", "entry.task.failedToSave")
+                        result.error = true
+                        return result
+                    }
+                }
+
+                if(!result.entryInstance.save()) {
+                    status.setRollbackOnly()
+                    result.error = true
+                    return result
+                }
+
+                // All went well if we get to here.
+                return result
+            }
+            else {
+                result.error = true
+                return result
+            }
+
+        } //end withTransaction
+    } // end create()
 
     def update(params) {
