Project

General

Profile

Make file description mandatory

Added by Dorice Nyamy almost 7 years ago

Hi all,
I am a new redmine developper, and I would like to make the description mandatory when uploading a file.
Please can any body indicate a way to do it ?
Thanks in advance
Dorice


Replies (2)

RE: Make file description mandatory - Added by Bernhard Rohloff over 6 years ago

Look at the attachments model. There are already some validations made so I think you can modify it to check the existence of a description,too.

RE: Make file description mandatory - Added by Dorice Nyamy over 6 years ago

Hello,

Thanks a lot for replying.
I have created a function to validate the file description in attachments model, indeed.

  def validate_file_description
    unless !description.blank?
      logger.info("Invalid file description : ") if logger
      errors.add(:base, l(:error_invalid_file_description, :description => description))
    end
  end

Which I call before file creation
  before_create :validate_file_description, :files_to_final_location

I can see in the logs that file description is invalid
But I don't understand why there is no pop up error generated

Please, any more idea ?
Thanks

    (1-2/2)