Feature #4989

Validate time entry hours based on a configurable regular expression

Added by li wei about 2 years ago. Updated about 2 years ago.

Status:New Start date:2010-03-05
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Time tracking
Target version:-
Resolution:

Description

"time_entry_hours input" should support Regular expression. eg:set time_entry_hours value less than 8 or other conditions.

History

#1 Updated by li wei about 2 years ago

Perhaps the feature should be a part of #4316

#2 Updated by Jean-Philippe Lang about 2 years ago

  • Subject changed from "time_entry_hours inputbox" should support Regular expression to Validate time entry hours based on a configurable regular expression
  • Assignee deleted (Eric Davis)

#3 Updated by li wei about 2 years ago

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'

1  def validate
2    errors.add :hours, :invalid if hours && (hours < 0 || hours > 8) # replace hours >= 1000 by hours >= 8
3    errors.add :project_id, :invalid if project.nil?
4    errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)
5  end

Also available in: Atom PDF