Skip to content

Commit

Permalink
Add the document in offer only if it has no error (remove the title d…
Browse files Browse the repository at this point in the history
…ocument errorin the form)
  • Loading branch information
alexisP committed Feb 1, 2011
1 parent 3a4f331 commit 7b09a21
Showing 1 changed file with 7 additions and 9 deletions.
Expand Up @@ -154,14 +154,6 @@ class OfferController {

offerInstance.author = userInstance

if(request.getFile( 'data' ).getSize() > 0)
{
def document = new InternshipSubjectFile()
document.title = params.subject
document.fileData = fileService.createFile(request.getFile( 'data' ))
offerInstance.file = document
}

offerInstance.validate()

if (params.promotions == null || params.promotions == "") {
Expand All @@ -172,7 +164,13 @@ class OfferController {
}

if (!offerInstance.hasErrors()) {

if(request.getFile( 'data' ).getSize() > 0)
{
def document = new InternshipSubjectFile()
document.title = params.subject
document.fileData = fileService.createFile(request.getFile( 'data' ))
offerInstance.file = document
}
if ((offerInstance = offerInstance?.save(flush: true)))
{
params.promotions.each {
Expand Down

0 comments on commit 7b09a21

Please sign in to comment.