Ignore:
Timestamp:
Nov 16, 2010, 7:56:10 AM (14 years ago)
Author:
gav
Message:

Return error message on equipment register (OH&S) report submit when endDate < startDate.

File:
1 edited

Legend:

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

    r709 r710  
    199199        params.endDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.endDate)
    200200
    201         def dataModel = assetReportService.getEquipmentRegister(params, RCU.getLocale(request))
    202 
    203         // Jasper plugin controller expects data to be a Collection.
    204         chain(controller:'jasper', action:'index', model:[data: [dataModel]], params:params)
     201        def result = assetReportService.getEquipmentRegister(params, RCU.getLocale(request))
     202
     203        if(!result.error) {
     204            // Jasper plugin controller expects data to be a Collection.
     205            chain(controller:'jasper', action:'index', model:[data: [result]], params:params)
     206            return
     207        }
     208
     209        flash.errorMessage = g.message(code: result.error.code, args: result.error.args)
     210        redirect(action: 'equipmentRegisterOhsGsp')
    205211
    206212//         render {
Note: See TracChangeset for help on using the changeset viewer.