Changeset 1472


Ignore:
Timestamp:
Feb 2, 2011, 10:59:54 AM (13 years ago)
Author:
t.w.abma@…
Message:
  • after assigning properties, entities are read from Excel and invalid entities are added to wizardErrors variable to be used by the "imported data" step
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1471 r1472  
    163163                        }
    164164                        on("next") {
    165                                 if (propertiesPage(flow, params)) {
     165                                if (propertiesPage(flow, flash, params)) {
    166166                                        success()
    167167                                } else {
     
    359359         * @returns boolean true if correctly validated, otherwise false
    360360         */
    361         boolean propertiesPage(flow, params) {
     361        boolean propertiesPage(flow, flash, params) {
     362        flash.wizardErrors = [:]
     363       
    362364                // Find actual Template object from the chosen template name
    363365                def template = Template.get(flow.importer_template_id)
     
    392394
    393395                flow.importer_importeddata = table
    394                 flow.importer_failedcells = failedcells
    395        
     396
     397        // loop through all entities to validate them and add them to wizardErrors flash when invalid
     398        table.each { record ->
     399            record.each { entity ->
     400                if (!entity.validate()) {
     401                                this.appendErrors(entity, flash.wizardErrors, 'entity_' + entity.getIdentifier() + '_')
     402                }
     403            }
     404        }
     405
     406        flow.importer_failedcells = failedcells
     407
    396408                return true
    397409        }
Note: See TracChangeset for help on using the changeset viewer.