From 7b09a21c6c32c2907623af7a62a612e2374c6e3b Mon Sep 17 00:00:00 2001 From: Alexis Plantin Date: Tue, 1 Feb 2011 21:14:22 +0100 Subject: [PATCH] Add the document in offer only if it has no error (remove the title document errorin the form) --- .../hcl/seekin/Internship/OfferController.groovy | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/grails-app/controllers/me/hcl/seekin/Internship/OfferController.groovy b/grails-app/controllers/me/hcl/seekin/Internship/OfferController.groovy index bd997ff..c3497cd 100644 --- a/grails-app/controllers/me/hcl/seekin/Internship/OfferController.groovy +++ b/grails-app/controllers/me/hcl/seekin/Internship/OfferController.groovy @@ -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 == "") { @@ -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 {