Changeset 421


Ignore:
Timestamp:
Mar 2, 2010, 9:12:24 AM (15 years ago)
Author:
gav
Message:

Add a logFileLink to the import error messages.
Small adjustment to asset import redirect.

Location:
trunk/grails-app
Files:
3 edited

Legend:

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

    r414 r421  
    6363        def result = assetCsvService.importAssetTree(request)
    6464
    65         if(!result.error)
     65        if(!result.error) {
    6666            flash.message = g.message(code: "asset.tree.import.success")
    67         else
    68             flash.errorMessage = g.message(code: result.error.code, args: result.error.args)
    69 
     67            redirect(action:search)
     68            return
     69        }
     70
     71        flash.errorMessage = g.message(code: result.error.code, args: result.error.args)
    7072        redirect(action: importAssetTree)
    7173    }
  • trunk/grails-app/i18n/messages.properties

    r418 r421  
    33
    44asset.tree.import.success=Asset tree imported.
    5 asset.tree.import.failure=Could not create asset tree from supplied file, failed on line {0}.
     5asset.tree.import.failure=Could not create asset tree from supplied file, failed on line {0}, see {1}.
    66
    77inventory.import.success=Inventory imported.
    8 inventory.import.failure=Could not create inventory from supplied file, failed on line {0}.
     8inventory.import.failure=Could not create inventory from supplied file, failed on line {0}, see {1}.
    99
    1010asset.copy.method.required=Please select a copy method for sub items.
  • trunk/grails-app/services/AssetCsvService.groovy

    r414 r421  
    1010
    1111    boolean transactional = false
     12
     13    def g = new org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib()
    1214
    1315    /**
     
    2224            def kByteMultiplier = 1000
    2325            def fileMaxSize = 500 * kByteMultiplier
     26            def logFileLink = g.link(controller: "appCore", action: "appLog") {"log"}
    2427
    2528            def multiPartFile = request.getFile('file')
     
    155158                    if(!siteInstance.save()) {
    156159                        log.error "Failed to create site on line: " + column.name + "(" + lineNumber + ")"
    157                         return fail(code: "asset.tree.import.failure", args: [lineNumber])
     160                        return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    158161                    }
    159162                }
     
    174177                    if(!departmentInstance.save()) {
    175178                        log.error "Failed to create department on line: " + column.name + "(" + lineNumber + ")"
    176                         return fail(code: "asset.tree.import.failure", args: [lineNumber])
     179                        return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    177180                    }
    178181                }
     
    194197                    if(!sectionInstance.save()) {
    195198                        log.error "Failed to create section on line: " + column.name + "(" + lineNumber + ")"
    196                         return fail(code: "asset.tree.import.failure", args: [lineNumber])
     199                        return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    197200                    }
    198201                }
     
    213216                    if(!assetInstance.save()) {
    214217                        log.error "Failed to create asset on line: " + column.name + "(" + lineNumber + ")"
    215                         return fail(code: "asset.tree.import.failure", args: [lineNumber])
     218                        return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    216219                    }
    217220                }
     
    231234                    if(!assetInstance.save()) {
    232235                        log.error "Failed to create assetSubItem on line: " + column.name + "(" + lineNumber + ")"
    233                         return fail(code: "asset.tree.import.failure", args: [lineNumber])
     236                        return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    234237                    }
    235238                }
     
    250253                        if(!assetSubItemInstance.save()) {
    251254                            log.error "Failed to create assetSubItem on line: " + column.name + "(" + lineNumber + ")"
    252                             return fail(code: "asset.tree.import.failure", args: [lineNumber])
     255                            return fail(code: "asset.tree.import.failure", args: [lineNumber, logFileLink])
    253256                        }
    254257                    }
Note: See TracChangeset for help on using the changeset viewer.