New feature : User, Guest and Gestionnaire can be upload a document with theirs comments

This commit is contained in:
Xavier J 2016-04-20 16:51:57 +02:00
parent fb2eeddf97
commit b15c2bbb2b
19 changed files with 214 additions and 59 deletions

View file

@ -21,4 +21,20 @@ class PiecesJustificativesService
end
errors
end
def self.upload_one! dossier, user, params
if ClamavService.safe_file? params[:piece_justificative][:content].path
piece_justificative = PieceJustificative.new(content: params[:piece_justificative][:content],
dossier: dossier,
type_de_piece_justificative: nil,
user: user)
piece_justificative.save
else
piece_justificative = PieceJustificative.new
piece_justificative.errors.add(:content, params[:piece_justificative][:content].original_filename+": <b>Virus détecté !!</b>")
end
piece_justificative
end
end