Skip to content

Commit

Permalink
Merge branch 'rambowm' into v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maeda-m committed Jul 22, 2020
2 parents 1a04b21 + d95f9a3 commit 782751c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/views/custom_fields/formats/_serial_number.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<em class="info">{yy}-{0000} #=> 15-0001</em>
<em class="info">{YYYY}-{0000} #=> 2014-0001</em>
<em class="info">{YY}-{0000} #=> 14-0001</em>
<em class="info">{ISO}-{0000} #=> 20150331-0001</em>
</p>

<%= f.hidden_field :is_required, :value => '0' %>
Expand Down
4 changes: 3 additions & 1 deletion lib/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ class Format < Redmine::FieldFormat::Base
MATCHERS = {
:TOW_DIGIT_NUMBER => /\d{2}/,
:FOUR_DIGIT_NUMBER => /\d{4}/,
:THREE_DIGIT_NUMBER => /\d{3}/,
:FORMAT_WRAPPER => /\{(.+?)\}/
}

DATE_FORMATS = {
:'yyyy' => { :strftime => '%Y', :financial_year => false, :regexp => MATCHERS[:FOUR_DIGIT_NUMBER] },
:'yy' => { :strftime => '%y', :financial_year => false, :regexp => MATCHERS[:TOW_DIGIT_NUMBER] },
:'YYYY' => { :strftime => '%Y', :financial_year => true, :regexp => MATCHERS[:FOUR_DIGIT_NUMBER] },
:'YY' => { :strftime => '%y', :financial_year => true, :regexp => MATCHERS[:TOW_DIGIT_NUMBER] }
:'YY' => { :strftime => '%y', :financial_year => true, :regexp => MATCHERS[:TOW_DIGIT_NUMBER] },
:'ISO' => { :strftime => '%Y%m%d', :financial_year => false, :regexp => MATCHERS[:THREE_DIGIT_NUMBER] }
}

def validate_custom_field(custom_field)
Expand Down

0 comments on commit 782751c

Please sign in to comment.