Project

General

Profile

Actions

Feature #4989

open

Validate time entry hours based on a configurable regular expression

Added by li wei almost 15 years ago. Updated almost 15 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
2010-03-05
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

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

Actions #1

Updated by li wei almost 15 years ago

Perhaps the feature should be a part of #4316

Actions #2

Updated by Jean-Philippe Lang almost 15 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)
Actions #3

Updated by li wei almost 15 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'

  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

Actions

Also available in: Atom PDF