Ignore:
Timestamp:
May 15, 2009, 4:09:30 PM (15 years ago)
Author:
gav
Message:

Work on TaskRecurringSchedule?.

Location:
trunk/grails-app/controllers
Files:
2 edited

Legend:

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

    r97 r136  
    3939        /**
    4040         * Person delete action. Before removing an existing person,
    41          * he should be removed from those authorities which he is involved.
     41         * they should be removed from those authorities which they are involved.
    4242         */
    4343        def delete = {
  • trunk/grails-app/controllers/TaskRecurringScheduleDetailedController.groovy

    r135 r136  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
     2import org.codehaus.groovy.runtime.TimeCategory
    23
    34class TaskRecurringScheduleDetailedController extends BaseController {
     
    6667                }
    6768            }
    68             taskRecurringScheduleInstance.properties = params
     69//             taskRecurringScheduleInstance.properties = params
     70            setUpdateProperties()
     71                   
    6972            if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) {
    7073                flash.message = "TaskRecurringSchedule ${params.id} updated"
     
    104107                else {
    105108                       
    106                         taskRecurringScheduleInstance.nextDueDate = new Date()
    107                                
    108 //                      taskRecurringScheduleInstance.nextDueDate = calculateNextDueDate(new Date())
    109                        
    110109                        if(!taskRecurringScheduleInstance.hasErrors() && taskRecurringScheduleInstance.save()) {
    111110                               
     
    127126
    128127    }
    129        
    130 //      private Date calculateNextDueDate(nextDue) {
    131 // //           def now = new Date()
    132 // //           def calculatedDays = new Integer()
    133 // //           def nextDue = new Date()
    134 //                             
    135 // //           switch (period) {
    136 // //                   case "Day(s)":
    137 // //                           calculatedDays = period
    138 // //                           nextDue = now + calculatedDays
    139 // //                   case "Week(s)":
    140 // //                           calculatedDays = period * 7
    141 // //                           nextDue = now + calculatedDays
    142 // // //                        default:
    143 // //           }
    144 //              nextDue = nextDue + 1
    145 //              return nextDue
    146 //      }
    147        
     128               
     129    private setUpdateProperties() {
     130        def originalStartDate = taskRecurringScheduleInstance.startDate
     131       
     132        if(taskRecurringScheduleInstance.startDate == params.startDate) {
     133            taskRecurringScheduleInstance.properties = params
     134        }
     135        else {
     136            taskRecurringScheduleInstance.properties = params
     137            taskRecurringScheduleInstance.nextTargetStartDate = params.startDate
     138        }
     139       
     140    }
     141
     142/*   
     143    private Date calculateNextDueDate(recurEvery, period, startDate) {
     144        def nextDue = new Date()
     145       
     146        switch (period) {
     147            case "Day(s)":
     148                use(TimeCategory) {
     149                    nextDue = startDate + recurEvery.days
     150                }
     151                return nextDue
     152            case "Week(s)":
     153                use(TimeCategory) {
     154                    nextDue = startDate + recurEvery.weeks
     155                }
     156                return nextDue
     157            case "Month(s)":
     158                use(TimeCategory) {
     159                    nextDue = startDate + recurEvery.months
     160                }
     161                return nextDue
     162            case "Year(s)":
     163                use(TimeCategory) {
     164                    nextDue = startDate + recurEvery.years
     165                }
     166                return nextDue
     167            default:
     168                return nextDue
     169        }
     170       
     171    }*/
    148172}
Note: See TracChangeset for help on using the changeset viewer.