Vote #66744
未完了Validate time entry hours based on a configurable regular expression
0%
説明
"time_entry_hours input" should support Regular expression. eg:set time_entry_hours value less than 8 or other conditions.
journals
Perhaps the feature should be a part of #4316
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
li wei wrote:
> "time_entry_hours input" should support Regular expression. eg:set time_entry_hours value less than 8 or other conditions.
"app/models/time_entry.rb" replace 'hours >= 1000' by 'hours >= 8'
<pre><code class="ruby">
def validate
errors.add :hours, :invalid if hours && (hours < 0 || hours > 8) # replace hours >= 1000 by hours >= 8
errors.add :project_id, :invalid if project.nil?
errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)
end
</code></pre>
--------------------------------------------------------------------------------