Browse Source

Doc

Prototyping
Rachael Booth 9 months ago
parent
commit
9f6cf12a80
  1. 15
      app/models/validations/.yardoc/checksums
  2. 0
      app/models/validations/.yardoc/complete
  3. BIN
      app/models/validations/.yardoc/object_types
  4. BIN
      app/models/validations/.yardoc/objects/root.dat
  5. BIN
      app/models/validations/.yardoc/proxy_types
  6. 360
      app/models/validations/doc/Validations/DateValidations.html
  7. 915
      app/models/validations/doc/Validations/FinancialValidations.html
  8. 1243
      app/models/validations/doc/Validations/HouseholdValidations.html
  9. 182
      app/models/validations/doc/Validations/LocalAuthorityValidations.html
  10. 435
      app/models/validations/doc/Validations/PropertyValidations.html
  11. 843
      app/models/validations/doc/Validations/Sales/FinancialValidations.html
  12. 702
      app/models/validations/doc/Validations/Sales/HouseholdValidations.html
  13. 312
      app/models/validations/doc/Validations/Sales/PropertyValidations.html
  14. 1445
      app/models/validations/doc/Validations/Sales/SaleInformationValidations.html
  15. 417
      app/models/validations/doc/Validations/Sales/SetupValidations.html
  16. 1996
      app/models/validations/doc/Validations/Sales/SoftValidations.html
  17. 679
      app/models/validations/doc/Validations/SetupValidations.html
  18. 853
      app/models/validations/doc/Validations/SharedValidations.html
  19. 1516
      app/models/validations/doc/Validations/SoftValidations.html
  20. 584
      app/models/validations/doc/Validations/TenancyValidations.html
  21. 246
      app/models/validations/doc/_index.html
  22. 51
      app/models/validations/doc/class_list.html
  23. 1
      app/models/validations/doc/css/common.css
  24. 58
      app/models/validations/doc/css/full_list.css
  25. 497
      app/models/validations/doc/css/style.css
  26. 51
      app/models/validations/doc/file_list.html
  27. 22
      app/models/validations/doc/frames.html
  28. 246
      app/models/validations/doc/index.html
  29. 314
      app/models/validations/doc/js/app.js
  30. 216
      app/models/validations/doc/js/full_list.js
  31. 4
      app/models/validations/doc/js/jquery.js
  32. 1179
      app/models/validations/doc/method_list.html
  33. 100
      app/models/validations/doc/top-level-namespace.html

15
app/models/validations/.yardoc/checksums

@ -0,0 +1,15 @@
sales/financial_validations.rb 6add021f45e5e9c88d0afec093421b0063212292
sales/household_validations.rb 3a1cb5ed2c2d1ce2a1ce0cf15cee1f9f3b6b5f9d
sales/property_validations.rb 20246b8f4746379f02de744d5e946f2859174b93
sales/sale_information_validations.rb 23d52b47f67fc5ef728e0d82b80e8d6f748d5205
sales/setup_validations.rb ef71ce4e95490183dca7893b908f46afb003e91b
sales/soft_validations.rb 80f3e430dda865cf4256db8bb966f9fcd47773c9
date_validations.rb 8a8d0c5640e5426441a46db20c82f8bbff864250
financial_validations.rb a3996355854dfb5df4a39357ee074783c7f8e17e
household_validations.rb 3b54050ed5cfb80be6f4d920bb48780eff4e646f
local_authority_validations.rb a83a049b3b8ea90de2b629c071b5832705b6f0c1
property_validations.rb f5f2ffe3e2d7c9a5deb31ba2618ad2641598d148
setup_validations.rb 75dba754f71e631fd35c216cf5610a8cb13d8b6e
shared_validations.rb 5d408ca2ede983dd0e38a6dbfc1136b18c099ea9
soft_validations.rb af5a959f496c7f509d784528896171abd7d726ee
tenancy_validations.rb 954d3c4bad2304cf656295a5e7a79d87f37a225e

0
app/models/validations/.yardoc/complete

BIN
app/models/validations/.yardoc/object_types

Binary file not shown.

BIN
app/models/validations/.yardoc/objects/root.dat

Binary file not shown.

BIN
app/models/validations/.yardoc/proxy_types

Binary file not shown.

360
app/models/validations/doc/Validations/DateValidations.html

@ -0,0 +1,360 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::DateValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::DateValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (D)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">DateValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::DateValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>date_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_property_major_repairs-instance_method" title="#validate_property_major_repairs (instance method)">#<strong>validate_property_major_repairs</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_property_void_date-instance_method" title="#validate_property_void_date (instance method)">#<strong>validate_property_void_date</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_startdate-instance_method" title="#validate_startdate (instance method)">#<strong>validate_startdate</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_property_major_repairs-instance_method">
#<strong>validate_property_major_repairs</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
4
5
6
7
8
9
10
11
12
13
14
15
16
17</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'date_validations.rb', line 4</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_property_major_repairs'>validate_property_major_repairs</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mrcdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.mrcdate.before_tenancy_start</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_is_rsnvac_first_let?'>is_rsnvac_first_let?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mrcdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.mrcdate.not_first_let</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='int'>3650</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mrcdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.mrcdate.ten_years_before_tenancy_start</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_property_void_date-instance_method">
#<strong>validate_property_void_date</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21
22
23
24
25
26
27
28
29
30
31
32</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'date_validations.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_property_void_date'>validate_property_void_date</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='int'>3650</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:voiddate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.void_date.ten_years_before_tenancy_start</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:voiddate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.void_date.before_tenancy_start</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:voiddate</span><span class='comma'>,</span> <span class='symbol'>:after_mrcdate</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.void_date.after_mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mrcdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.mrcdate.before_void_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_startdate-instance_method">
#<strong>validate_startdate</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'date_validations.rb', line 34</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_startdate'>validate_startdate</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.after_void_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.after_major_repair_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>voiddate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='int'>3650</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.ten_years_after_void_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mrcdate</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='int'>3650</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.ten_years_after_mrc_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

915
app/models/validations/doc/Validations/FinancialValidations.html

@ -0,0 +1,915 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::FinancialValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::FinancialValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (F)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">FinancialValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::FinancialValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>ChargesHelper, MoneyFormattingHelper, SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>financial_validations.rb</dd>
</dl>
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="EMPLOYED_STATUSES-constant" class="">EMPLOYED_STATUSES =
</dt>
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
</dl>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#no_known_benefits%3F-instance_method" title="#no_known_benefits? (instance method)">#<strong>no_known_benefits?</strong>(record) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_care_home_charges-instance_method" title="#validate_care_home_charges (instance method)">#<strong>validate_care_home_charges</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_negative_currency-instance_method" title="#validate_negative_currency (instance method)">#<strong>validate_negative_currency</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_net_income-instance_method" title="#validate_net_income (instance method)">#<strong>validate_net_income</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_net_income_uc_proportion-instance_method" title="#validate_net_income_uc_proportion (instance method)">#<strong>validate_net_income_uc_proportion</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_outstanding_rent_amount-instance_method" title="#validate_outstanding_rent_amount (instance method)">#<strong>validate_outstanding_rent_amount</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Validations methods need to be called ‘validate_&lt;page_name&gt;’ to run on model save or ‘validate_’ to run on submit as well.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_rent_amount-instance_method" title="#validate_rent_amount (instance method)">#<strong>validate_rent_amount</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_rent_period-instance_method" title="#validate_rent_period (instance method)">#<strong>validate_rent_period</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_tshortfall-instance_method" title="#validate_tshortfall (instance method)">#<strong>validate_tshortfall</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="no_known_benefits?-instance_method">
#<strong>no_known_benefits?</strong>(record) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
108
109
110
111
112
113
114
115
116
117
118
119
120</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 108</span>
<span class='kw'>def</span> <span class='id identifier rubyid_no_known_benefits?'>no_known_benefits?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span> <span class='op'>&lt;=</span> <span class='int'>2021</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_benefits_unknown?'>benefits_unknown?</span> <span class='op'>||</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_receives_no_benefits?'>receives_no_benefits?</span> <span class='op'>||</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_receives_universal_credit_but_no_housing_benefit?'>receives_universal_credit_but_no_housing_benefit?</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_benefits_unknown?'>benefits_unknown?</span> <span class='op'>||</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_receives_no_benefits?'>receives_no_benefits?</span> <span class='op'>||</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenant_refuses_to_say_benefits?'>tenant_refuses_to_say_benefits?</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_care_home_charges-instance_method">
#<strong>validate_care_home_charges</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 158</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_care_home_charges'>validate_care_home_charges</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_carehome?'>is_carehome?</span>
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_get_question'>get_question</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>period</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_label_from_value'>label_from_value</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_period'>period</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
<span class='comment'># NOTE: This is a temporary change to allow `ccharge` values despite `is_carehome` being true. This value
</span> <span class='comment'># is going to be moved to a soft validation in CLDC-2074, so we can safely do this.
</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_chcharge'>chcharge</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='comment'># record.errors.add :is_carehome, I18n.t(&quot;validations.financial.carehome.not_provided&quot;, period:)
</span> <span class='comment'># record.errors.add :chcharge, I18n.t(&quot;validations.financial.carehome.not_provided&quot;, period:)
</span> <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_weekly_value_in_range'>weekly_value_in_range</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>chcharge</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='int'>10</span><span class='comma'>,</span> <span class='int'>5000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_max_chcharge'>max_chcharge</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_weekly_to_value_per_period'>weekly_to_value_per_period</span><span class='lparen'>(</span><span class='int'>5000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_min_chcharge'>min_chcharge</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_weekly_to_value_per_period'>weekly_to_value_per_period</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.carehome.out_of_range</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>period:</span><span class='comma'>,</span> <span class='label'>min_chcharge:</span><span class='comma'>,</span> <span class='label'>max_chcharge:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:period</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:chcharge</span><span class='comma'>,</span> <span class='symbol'>:out_of_range</span><span class='comma'>,</span> <span class='label'>message:</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_negative_currency-instance_method">
#<strong>validate_negative_currency</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
93
94
95
96
97
98
99
100</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 93</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_negative_currency'>validate_negative_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='qwords_beg'>%w[</span><span class='tstring_content'>earnings</span><span class='words_sep'> </span><span class='tstring_content'>brent</span><span class='words_sep'> </span><span class='tstring_content'>scharge</span><span class='words_sep'> </span><span class='tstring_content'>pscharge</span><span class='words_sep'> </span><span class='tstring_content'>supcharg</span><span class='tstring_end'>]</span></span>
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_x'>x</span><span class='op'>|</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_x'>x</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_negative?'>negative?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_x'>x</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.negative_currency</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_net_income-instance_method">
#<strong>validate_net_income</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_net_income'>validate_net_income</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ecstat1'>ecstat1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_weekly_net_income'>weekly_net_income</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_date'>start_date</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='op'>&gt;=</span> <span class='int'>2023</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_weekly_net_income'>weekly_net_income</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_applicable_income_range'>applicable_income_range</span><span class='period'>.</span><span class='id identifier rubyid_hard_max'>hard_max</span>
<span class='id identifier rubyid_frequency'>frequency</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_get_question'>get_question</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>incfreq</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_label_from_value'>label_from_value</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_incfreq'>incfreq</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
<span class='id identifier rubyid_hard_max'>hard_max</span> <span class='op'>=</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_applicable_income_range'>applicable_income_range</span><span class='period'>.</span><span class='id identifier rubyid_hard_max'>hard_max</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='symbol'>:earnings</span><span class='comma'>,</span>
<span class='symbol'>:over_hard_max</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.over_hard_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>hard_max:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='symbol'>:hhmemb</span><span class='comma'>,</span>
<span class='symbol'>:over_hard_max</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.hhmemb.earnings.over_hard_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>earnings:</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>frequency:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:over_hard_max</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.ecstat.over_hard_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>earnings:</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>frequency:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='int'>9</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:over_hard_max</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.age.earnings_over_hard_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>earnings:</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>frequency:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_weekly_net_income'>weekly_net_income</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_applicable_income_range'>applicable_income_range</span><span class='period'>.</span><span class='id identifier rubyid_hard_min'>hard_min</span>
<span class='id identifier rubyid_hard_min'>hard_min</span> <span class='op'>=</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_applicable_income_range'>applicable_income_range</span><span class='period'>.</span><span class='id identifier rubyid_hard_min'>hard_min</span><span class='rparen'>)</span>
<span class='id identifier rubyid_frequency'>frequency</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_get_question'>get_question</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>incfreq</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_label_from_value'>label_from_value</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_incfreq'>incfreq</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='symbol'>:earnings</span><span class='comma'>,</span>
<span class='symbol'>:under_hard_min</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.under_hard_min</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>hard_min:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='symbol'>:hhmemb</span><span class='comma'>,</span>
<span class='symbol'>:under_hard_min</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.hhmemb.earnings.under_hard_min</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>earnings:</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>frequency:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='symbol'>:under_hard_min</span><span class='comma'>,</span>
<span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.ecstat.under_hard_min</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>earnings:</span> <span class='id identifier rubyid_format_as_currency'>format_as_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>frequency:</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='comment'># N.B. It is not possible for a change to an age field to increase the hard min
</span> <span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_incfreq'>incfreq</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:incfreq</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.freq_missing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:earnings</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.freq_missing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_incfreq'>incfreq</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_earnings'>earnings</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:earnings</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.earnings_missing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:incfreq</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.earnings.earnings_missing</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_net_income_uc_proportion-instance_method">
#<strong>validate_net_income_uc_proportion</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
15
16
17
18
19
20
21
22
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 15</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_net_income_uc_proportion'>validate_net_income_uc_proportion</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='int'>8</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
<span class='id identifier rubyid_economic_status'>economic_status</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_is_employed'>is_employed</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#EMPLOYED_STATUSES-constant" title="Validations::FinancialValidations::EMPLOYED_STATUSES (constant)">EMPLOYED_STATUSES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_economic_status'>economic_status</span><span class='rparen'>)</span>
<span class='id identifier rubyid_relationship'>relationship</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_is_partner_or_main'>is_partner_or_main</span> <span class='op'>=</span> <span class='id identifier rubyid_relationship'>relationship</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>P</span><span class='tstring_end'>&quot;</span></span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_relationship'>relationship</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_economic_status'>economic_status</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_is_employed'>is_employed</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_is_partner_or_main'>is_partner_or_main</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_benefits'>benefits</span><span class='op'>&amp;.</span><span class='id identifier rubyid_zero?'>zero?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:benefits</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.benefits.part_or_full_time</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_outstanding_rent_amount-instance_method">
#<strong>validate_outstanding_rent_amount</strong>(record) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Validations methods need to be called ‘validate_&lt;page_name&gt;’ to run on model save or ‘validate_’ to run on submit as well</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
7
8
9
10
11
12</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 7</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_outstanding_rent_amount'>validate_outstanding_rent_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_housing_benefit_rent_shortfall?'>has_housing_benefit_rent_shortfall?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tshortfall'>tshortfall</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tshortfall</span><span class='comma'>,</span> <span class='symbol'>:no_outstanding_charges</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.tshortfall.outstanding_amount_not_expected</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:hbrentshortfall</span><span class='comma'>,</span> <span class='symbol'>:no_outstanding_charges</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.hbrentshortfall.outstanding_amount_not_expected</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_rent_amount-instance_method">
#<strong>validate_rent_amount</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 122</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_rent_amount'>validate_rent_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_wtshortfall'>wtshortfall</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_wrent'>wrent</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_wtshortfall'>wtshortfall</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_wrent'>wrent</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tshortfall</span><span class='comma'>,</span> <span class='symbol'>:more_than_rent</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.tshortfall.more_than_rent</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:brent</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.rent.less_than_shortfall</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_wtshortfall'>wtshortfall</span> <span class='op'>&lt;</span> <span class='float'>0.01</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tshortfall</span><span class='comma'>,</span> <span class='symbol'>:must_be_positive</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.tshortfall.must_be_positive</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tcharge'>tcharge</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_weekly_value_in_range'>weekly_value_in_range</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>tcharge</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='float'>9.99</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tcharge</span><span class='comma'>,</span> <span class='symbol'>:under_10</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.tcharge.under_10</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_answered_questions'>answered_questions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tcharge'>tcharge</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_chcharge'>chcharge</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_concat'>concat</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_household_charge'>household_charge</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_household_charge'>household_charge</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_household_charge'>household_charge</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_answered_questions'>answered_questions</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:present?</span><span class='rparen'>)</span> <span class='op'>&gt;</span> <span class='int'>1</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tcharge</span><span class='comma'>,</span> <span class='symbol'>:complete_1_of_3</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.charges.complete_1_of_3</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tcharge'>tcharge</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:chcharge</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.charges.complete_1_of_3</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_chcharge'>chcharge</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:household_charge</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.charges.complete_1_of_3</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_household_charge'>household_charge</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_validate_charges'>validate_charges</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_validate_rent_range'>validate_rent_range</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_rent_period-instance_method">
#<strong>validate_rent_period</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
147
148
149
150
151
152
153
154
155
156</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 147</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_rent_period'>validate_rent_period</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_rent_periods'>rent_periods</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_period'>period</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_rent_periods'>rent_periods</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_period'>period</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:period</span><span class='comma'>,</span> <span class='symbol'>:wrong_rent_period</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.rent_period.invalid_for_org</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>org_name:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>rent_period:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_get_question'>get_question</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>period</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_label_from_value'>label_from_value</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_period'>period</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='comma'>,</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_tshortfall-instance_method">
#<strong>validate_tshortfall</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
102
103
104
105
106</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'financial_validations.rb', line 102</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_tshortfall'>validate_tshortfall</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_housing_benefit_rent_shortfall?'>has_housing_benefit_rent_shortfall?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_no_known_benefits?'>no_known_benefits?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tshortfall</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.hbrentshortfall.outstanding_no_benefits</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

1243
app/models/validations/doc/Validations/HouseholdValidations.html

File diff suppressed because it is too large Load Diff

182
app/models/validations/doc/Validations/LocalAuthorityValidations.html

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::LocalAuthorityValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::LocalAuthorityValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (L)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">LocalAuthorityValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::LocalAuthorityValidations
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>local_authority_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_previous_accommodation_postcode-instance_method" title="#validate_previous_accommodation_postcode (instance method)">#<strong>validate_previous_accommodation_postcode</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_previous_accommodation_postcode-instance_method">
#<strong>validate_previous_accommodation_postcode</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
2
3
4
5
6
7
8</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'local_authority_validations.rb', line 2</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_previous_accommodation_postcode'>validate_previous_accommodation_postcode</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_postcode'>postcode</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ppostcode_full'>ppostcode_full</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_previous_postcode_known?'>previous_postcode_known?</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='id identifier rubyid_postcode'>postcode</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_postcode'>postcode</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='const'>POSTCODE_REGEXP</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_error_message'>error_message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.postcode</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:ppostcode_full</span><span class='comma'>,</span> <span class='symbol'>:wrong_format</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_error_message'>error_message</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

435
app/models/validations/doc/Validations/PropertyValidations.html

@ -0,0 +1,435 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::PropertyValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::PropertyValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (P)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">PropertyValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::PropertyValidations
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>property_validations.rb</dd>
</dl>
</div>
<h2>
Constant Summary
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
</h2>
<dl class="constants">
<dt id="REFERRAL_INVALID_TMP-constant" class="">REFERRAL_INVALID_TMP =
<div class="docstring">
<div class="discussion">
<p>Validations methods need to be called ‘validate_&lt;page_name&gt;’ to run on model save or ‘validate_’ to run on submit as well</p>
</div>
</div>
<div class="tags">
</div>
</dt>
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>8</span><span class='comma'>,</span> <span class='int'>10</span><span class='comma'>,</span> <span class='int'>12</span><span class='comma'>,</span> <span class='int'>13</span><span class='comma'>,</span> <span class='int'>14</span><span class='comma'>,</span> <span class='int'>15</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
</dl>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_rsnvac-instance_method" title="#validate_rsnvac (instance method)">#<strong>validate_rsnvac</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_shared_housing_rooms-instance_method" title="#validate_shared_housing_rooms (instance method)">#<strong>validate_shared_housing_rooms</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_unitletas-instance_method" title="#validate_unitletas (instance method)">#<strong>validate_unitletas</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_uprn-instance_method" title="#validate_uprn (instance method)">#<strong>validate_uprn</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_rsnvac-instance_method">
#<strong>validate_rsnvac</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'property_validations.rb', line 6</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_rsnvac'>validate_rsnvac</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_first_let_vacancy_reason?'>has_first_let_vacancy_reason?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.first_let_not_social</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_rsnvac'>rsnvac</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_has_first_let_vacancy_reason?'>has_first_let_vacancy_reason?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.first_let_social</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_relet_to_temp_tenant?'>is_relet_to_temp_tenant?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_previous_tenancy_was_temporary?'>previous_tenancy_was_temporary?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.non_temp_accommodation</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_relet_to_temp_tenant?'>is_relet_to_temp_tenant?</span> <span class='op'>&amp;&amp;</span> <span class='const'><span class='object_link'><a href="#REFERRAL_INVALID_TMP-constant" title="Validations::PropertyValidations::REFERRAL_INVALID_TMP (constant)">REFERRAL_INVALID_TMP</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_referral'>referral</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.referral_invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:referral</span><span class='comma'>,</span> <span class='symbol'>:referral_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.referral.rsnvac_non_temp</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_renewal'>renewal</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_renewal'>renewal</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_rsnvac'>rsnvac</span> <span class='op'>==</span> <span class='int'>14</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rsnvac</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.not_a_renewal</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_shared_housing_rooms-instance_method">
#<strong>validate_shared_housing_rooms</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'property_validations.rb', line 35</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_shared_housing_rooms'>validate_shared_housing_rooms</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_unittype_gn'>unittype_gn</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_bedsit?'>is_bedsit?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span> <span class='op'>!=</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_bedroom_bedsit</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_bedroom_bedsit</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_shared_housing?'>is_shared_housing?</span> <span class='op'>&amp;&amp;</span>
<span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>3</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_three_bedroom_single_tenant_shared</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='symbol'>:one_three_bedroom_single_tenant_shared</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_three_bedroom_single_tenant_shared</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_shared_housing?'>is_shared_housing?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>7</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unittype_gn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_seven_bedroom_shared</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.unittype_gn.one_seven_bedroom_shared</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_unitletas-instance_method">
#<strong>validate_unitletas</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
29
30
31
32
33</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'property_validations.rb', line 29</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_unitletas'>validate_unitletas</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_first_time_property_let_as_social_housing?'>first_time_property_let_as_social_housing?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_unitletas'>unitletas</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:unitletas</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.rsnvac.previous_let_social</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_uprn-instance_method">
#<strong>validate_uprn</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
53
54
55
56
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'property_validations.rb', line 53</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_uprn'>validate_uprn</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]{1,12}$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:uprn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.uprn.invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

843
app/models/validations/doc/Validations/Sales/FinancialValidations.html

@ -0,0 +1,843 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::Sales::FinancialValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::Sales::FinancialValidations";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (F)</a> &raquo;
<span class='title'>Validations</span> &raquo; <span class='title'>Sales</span>
&raquo;
<span class="title">FinancialValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::Sales::FinancialValidations
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>sales/financial_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_child_income-instance_method" title="#validate_child_income (instance method)">#<strong>validate_child_income</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_combined_income-instance_method" title="#validate_combined_income (instance method)">#<strong>validate_combined_income</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_equity_in_range_for_year_and_type-instance_method" title="#validate_equity_in_range_for_year_and_type (instance method)">#<strong>validate_equity_in_range_for_year_and_type</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_equity_less_than_staircase_difference-instance_method" title="#validate_equity_less_than_staircase_difference (instance method)">#<strong>validate_equity_less_than_staircase_difference</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_income1-instance_method" title="#validate_income1 (instance method)">#<strong>validate_income1</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Validations methods need to be called ‘validate_&lt;page_name&gt;’ to run on model save or ‘validate_’ to run on submit as well.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_income2-instance_method" title="#validate_income2 (instance method)">#<strong>validate_income2</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_monthly_leasehold_charges-instance_method" title="#validate_monthly_leasehold_charges (instance method)">#<strong>validate_monthly_leasehold_charges</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_mortgage-instance_method" title="#validate_mortgage (instance method)">#<strong>validate_mortgage</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_percentage_bought_at_least_threshold-instance_method" title="#validate_percentage_bought_at_least_threshold (instance method)">#<strong>validate_percentage_bought_at_least_threshold</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_percentage_bought_not_equal_percentage_owned-instance_method" title="#validate_percentage_bought_not_equal_percentage_owned (instance method)">#<strong>validate_percentage_bought_not_equal_percentage_owned</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_percentage_bought_not_greater_than_percentage_owned-instance_method" title="#validate_percentage_bought_not_greater_than_percentage_owned (instance method)">#<strong>validate_percentage_bought_not_greater_than_percentage_owned</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_child_income-instance_method">
#<strong>validate_child_income</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
80
81
82
83
84
85
86
87</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 80</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_child_income'>validate_child_income</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ecstat2'>ecstat2</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span><span class='period'>.</span><span class='id identifier rubyid_positive?'>positive?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_is_economic_status_child?'>is_economic_status_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ecstat2'>ecstat2</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_date'>start_date</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='op'>&gt;=</span> <span class='int'>2023</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:ecstat2</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.child_has_income</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:income2</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.child_has_income</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_combined_income-instance_method">
#<strong>validate_combined_income</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29
30
31
32
33
34
35
36
37</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_combined_income'>validate_combined_income</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income1'>income1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_la'>la</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_shared_ownership_scheme?'>shared_ownership_scheme?</span>
<span class='id identifier rubyid_combined_income'>combined_income</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income1'>income1</span> <span class='op'>+</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>income1</span><span class='words_sep'> </span><span class='tstring_content'>income2</span><span class='words_sep'> </span><span class='tstring_content'>ownershipsch</span><span class='words_sep'> </span><span class='tstring_content'>uprn</span><span class='words_sep'> </span><span class='tstring_content'>la</span><span class='words_sep'> </span><span class='tstring_content'>postcode_full</span><span class='tstring_end'>]</span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_london_property?'>london_property?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_combined_income'>combined_income</span> <span class='op'>&gt;</span> <span class='int'>90_000</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:over_combined_hard_max_for_london</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.combined_over_hard_max_for_london</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_property_not_in_london?'>property_not_in_london?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_combined_income'>combined_income</span> <span class='op'>&gt;</span> <span class='int'>80_000</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:over_combined_hard_max_for_outside_london</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.combined_over_hard_max_for_outside_london</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_equity_in_range_for_year_and_type-instance_method">
#<strong>validate_equity_in_range_for_year_and_type</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 89</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_equity_in_range_for_year_and_type'>validate_equity_in_range_for_year_and_type</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span>
<span class='id identifier rubyid_ranges'>ranges</span> <span class='op'>=</span> <span class='const'>EQUITY_RANGES_BY_YEAR</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span><span class='comma'>,</span> <span class='const'>DEFAULT_EQUITY_RANGES</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_range'>range</span> <span class='op'>=</span> <span class='id identifier rubyid_ranges'>ranges</span><span class='lbracket'>[</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:type</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.under_min</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_equity:</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:equity</span><span class='comma'>,</span> <span class='symbol'>:under_min</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.under_min</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_equity:</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:type</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.over_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>max_equity:</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:equity</span><span class='comma'>,</span> <span class='symbol'>:over_max</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.over_max</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>max_equity:</span> <span class='id identifier rubyid_range'>range</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_equity_less_than_staircase_difference-instance_method">
#<strong>validate_equity_less_than_staircase_difference</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
105
106
107
108
109
110
111
112
113
114
115</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 105</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_equity_less_than_staircase_difference'>validate_equity_less_than_staircase_difference</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span>
<span class='id identifier rubyid_formatted_equity'>formatted_equity</span> <span class='op'>=</span> <span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%g</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:equity</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.over_stairowned_minus_stairbought</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>equity:</span> <span class='id identifier rubyid_formatted_equity'>formatted_equity</span><span class='comma'>,</span> <span class='label'>staircase_difference:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span><span class='comma'>,</span> <span class='label'>buyer_owns:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyers own</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyer owns</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairowned</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.over_stairowned_minus_stairbought</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>equity:</span> <span class='id identifier rubyid_formatted_equity'>formatted_equity</span><span class='comma'>,</span> <span class='label'>staircase_difference:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span><span class='comma'>,</span> <span class='label'>buyer_owns:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyers own</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyer owns</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairbought</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.equity.over_stairowned_minus_stairbought</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>equity:</span> <span class='id identifier rubyid_formatted_equity'>formatted_equity</span><span class='comma'>,</span> <span class='label'>staircase_difference:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span><span class='comma'>,</span> <span class='label'>buyer_owns:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyers own</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyer owns</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_income1-instance_method">
#<strong>validate_income1</strong>(record) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Validations methods need to be called ‘validate_&lt;page_name&gt;’ to run on model save or ‘validate_’ to run on submit as well</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
5
6
7
8
9
10
11
12
13
14</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 5</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_income1'>validate_income1</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income1'>income1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_la'>la</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_shared_ownership_scheme?'>shared_ownership_scheme?</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>income1</span><span class='words_sep'> </span><span class='tstring_content'>ownershipsch</span><span class='words_sep'> </span><span class='tstring_content'>uprn</span><span class='words_sep'> </span><span class='tstring_content'>la</span><span class='words_sep'> </span><span class='tstring_content'>postcode_full</span><span class='tstring_end'>]</span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_london_property?'>london_property?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income1'>income1</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>90_000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:outside_london_income_range</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.outside_london_income_range</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_property_not_in_london?'>property_not_in_london?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income1'>income1</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>80_000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:outside_non_london_income_range</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.outside_non_london_income_range</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_income2-instance_method">
#<strong>validate_income2</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
16
17
18
19
20
21
22
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 16</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_income2'>validate_income2</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_la'>la</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_shared_ownership_scheme?'>shared_ownership_scheme?</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>income2</span><span class='words_sep'> </span><span class='tstring_content'>ownershipsch</span><span class='words_sep'> </span><span class='tstring_content'>uprn</span><span class='words_sep'> </span><span class='tstring_content'>la</span><span class='words_sep'> </span><span class='tstring_content'>postcode_full</span><span class='tstring_end'>]</span></span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_london_property?'>london_property?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>90_000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:outside_london_income_range</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.outside_london_income_range</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_property_not_in_london?'>property_not_in_london?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_income2'>income2</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>80_000</span><span class='rparen'>)</span>
<span class='id identifier rubyid_relevant_fields'>relevant_fields</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_field'>field</span><span class='comma'>,</span> <span class='symbol'>:outside_non_london_income_range</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.income.outside_non_london_income_range</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_monthly_leasehold_charges-instance_method">
#<strong>validate_monthly_leasehold_charges</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
43
44
45</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 43</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_monthly_leasehold_charges'>validate_monthly_leasehold_charges</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mscharge</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.monthly_leasehold_charges.not_zero</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mscharge'>mscharge</span><span class='op'>&amp;.</span><span class='id identifier rubyid_zero?'>zero?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_mortgage-instance_method">
#<strong>validate_mortgage</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
39
40
41</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 39</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_mortgage'>validate_mortgage</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:mortgage</span><span class='comma'>,</span> <span class='symbol'>:cannot_be_0</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.mortgage</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_used?'>mortgage_used?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage'>mortgage</span><span class='op'>&amp;.</span><span class='id identifier rubyid_zero?'>zero?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_percentage_bought_at_least_threshold-instance_method">
#<strong>validate_percentage_bought_at_least_threshold</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
65
66
67
68
69
70
71
72
73
74
75
76
77
78</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 65</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_percentage_bought_at_least_threshold'>validate_percentage_bought_at_least_threshold</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span>
<span class='id identifier rubyid_threshold'>threshold</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='lbracket'>[</span><span class='int'>2</span><span class='comma'>,</span> <span class='int'>16</span><span class='comma'>,</span> <span class='int'>18</span><span class='comma'>,</span> <span class='int'>24</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span>
<span class='int'>10</span>
<span class='kw'>else</span>
<span class='int'>1</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_threshold'>threshold</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_threshold'>threshold</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairbought</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.staircasing.percentage_bought_must_be_at_least_threshold</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>threshold:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:type</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.type.percentage_bought_must_be_at_least_threshold</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>threshold:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_percentage_bought_not_equal_percentage_owned-instance_method">
#<strong>validate_percentage_bought_not_equal_percentage_owned</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
55
56
57
58
59
60
61
62
63</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 55</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_percentage_bought_not_equal_percentage_owned'>validate_percentage_bought_not_equal_percentage_owned</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>==</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairbought</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.staircasing.percentage_bought_equal_percentage_owned</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>stairbought:</span> <span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%g</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairowned:</span> <span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%g</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairowned</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.staircasing.percentage_bought_equal_percentage_owned</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>stairbought:</span> <span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%g</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairowned:</span> <span class='id identifier rubyid_sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%g</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_percentage_bought_not_greater_than_percentage_owned-instance_method">
#<strong>validate_percentage_bought_not_greater_than_percentage_owned</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
47
48
49
50
51
52
53</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/financial_validations.rb', line 47</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_percentage_bought_not_greater_than_percentage_owned'>validate_percentage_bought_not_greater_than_percentage_owned</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought'>stairbought</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairowned'>stairowned</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:stairowned</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.financial.staircasing.percentage_bought_must_be_greater_than_percentage_owned</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_now_owns:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyers now own</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>buyer now owns</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

702
app/models/validations/doc/Validations/Sales/HouseholdValidations.html

@ -0,0 +1,702 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::Sales::HouseholdValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::Sales::HouseholdValidations";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (H)</a> &raquo;
<span class='title'>Validations</span> &raquo; <span class='title'>Sales</span>
&raquo;
<span class="title">HouseholdValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::Sales::HouseholdValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>Validations::SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>sales/household_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_buyer1_previous_tenure-instance_method" title="#validate_buyer1_previous_tenure (instance method)">#<strong>validate_buyer1_previous_tenure</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_buyer_not_child-instance_method" title="#validate_buyer_not_child (instance method)">#<strong>validate_buyer_not_child</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_buyers_living_in_property-instance_method" title="#validate_buyers_living_in_property (instance method)">#<strong>validate_buyers_living_in_property</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_child_12_years_younger-instance_method" title="#validate_child_12_years_younger (instance method)">#<strong>validate_child_12_years_younger</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_partner_count-instance_method" title="#validate_partner_count (instance method)">#<strong>validate_partner_count</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_person_age_and_relationship_matches_economic_status-instance_method" title="#validate_person_age_and_relationship_matches_economic_status (instance method)">#<strong>validate_person_age_and_relationship_matches_economic_status</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_person_age_matches_economic_status-instance_method" title="#validate_person_age_matches_economic_status (instance method)">#<strong>validate_person_age_matches_economic_status</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_person_age_matches_relationship-instance_method" title="#validate_person_age_matches_relationship (instance method)">#<strong>validate_person_age_matches_relationship</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_buyer1_previous_tenure-instance_method">
#<strong>validate_buyer1_previous_tenure</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
18
19
20
21
22
23
24
25
26</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_buyer1_previous_tenure'>validate_buyer1_previous_tenure</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_discounted_ownership_sale?'>discounted_ownership_sale?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_prevten'>prevten</span>
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='int'>3</span><span class='comma'>,</span> <span class='int'>4</span><span class='comma'>,</span> <span class='int'>5</span><span class='comma'>,</span> <span class='int'>6</span><span class='comma'>,</span> <span class='int'>7</span><span class='comma'>,</span> <span class='int'>9</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_prevten'>prevten</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:prevten</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.prevten.invalid_for_discounted_sale</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:ownershipsch</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.prevten.invalid_for_discounted_sale</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_buyer_not_child-instance_method">
#<strong>validate_buyer_not_child</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
108
109
110
111
112
113</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 108</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_buyer_not_child'>validate_buyer_not_child</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat1</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.buyer_cannot_be_child</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_index:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_person_is_economic_child?'>person_is_economic_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ecstat1'>ecstat1</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat2</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.buyer_cannot_be_child</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_index:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>2</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_person_is_economic_child?'>person_is_economic_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ecstat2'>ecstat2</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_buyers_living_in_property-instance_method">
#<strong>validate_buyers_living_in_property</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
8
9
10
11
12
13
14
15
16</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 8</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_buyers_living_in_property'>validate_buyers_living_in_property</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_date'>start_date</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='op'>&gt;=</span> <span class='int'>2023</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_buyers_will_live_in?'>buyers_will_live_in?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_buyer_one_will_not_live_in_property?'>buyer_one_will_not_live_in_property?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_buyer_two_will_not_live_in_property?'>buyer_two_will_not_live_in_property?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:buylivein</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent_setup</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:buy1livein</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:buy2livein</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_child_12_years_younger-instance_method">
#<strong>validate_child_12_years_younger</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 91</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_child_12_years_younger'>validate_child_12_years_younger</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='lparen'>(</span><span class='int'>2</span><span class='op'>..</span><span class='int'>6</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_person_num'>person_num</span><span class='op'>|</span>
<span class='id identifier rubyid_buyer_1_age'>buyer_1_age</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age1</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_person_age'>person_age</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_relationship'>relationship</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_buyer_1_age'>buyer_1_age</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_person_age'>person_age</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_relationship'>relationship</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_person_age'>person_age</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_buyer_1_age'>buyer_1_age</span> <span class='op'>-</span> <span class='int'>12</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_person_is_child?'>person_is_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_relationship'>relationship</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age1</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_partner_count-instance_method">
#<strong>validate_partner_count</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
4
5
6</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 4</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_partner_count'>validate_partner_count</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_shared_validate_partner_count'>shared_validate_partner_count</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='int'>6</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_person_age_and_relationship_matches_economic_status-instance_method">
#<strong>validate_person_age_and_relationship_matches_economic_status</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_person_age_and_relationship_matches_economic_status'>validate_person_age_and_relationship_matches_economic_status</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='lparen'>(</span><span class='int'>2</span><span class='op'>..</span><span class='int'>6</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_person_num'>person_num</span><span class='op'>|</span>
<span class='id identifier rubyid_age'>age</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_economic_status'>economic_status</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_relationship'>relationship</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_economic_status'>economic_status</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_relationship'>relationship</span>
<span class='id identifier rubyid_age_between_16_19'>age_between_16_19</span> <span class='op'>=</span> <span class='id identifier rubyid_age'>age</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>16</span><span class='comma'>,</span> <span class='int'>19</span><span class='rparen'>)</span>
<span class='id identifier rubyid_student'>student</span> <span class='op'>=</span> <span class='id identifier rubyid_person_is_fulltime_student?'>person_is_fulltime_student?</span><span class='lparen'>(</span><span class='id identifier rubyid_economic_status'>economic_status</span><span class='rparen'>)</span>
<span class='id identifier rubyid_economic_status_refused'>economic_status_refused</span> <span class='op'>=</span> <span class='id identifier rubyid_person_economic_status_refused?'>person_economic_status_refused?</span><span class='lparen'>(</span><span class='id identifier rubyid_economic_status'>economic_status</span><span class='rparen'>)</span>
<span class='id identifier rubyid_child'>child</span> <span class='op'>=</span> <span class='id identifier rubyid_person_is_child?'>person_is_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_relationship'>relationship</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_age_between_16_19'>age_between_16_19</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_student'>student</span> <span class='op'>||</span> <span class='id identifier rubyid_economic_status_refused'>economic_status_refused</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_child'>child</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.student_16_19.must_be_student</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.student_16_19.cannot_be_16_19.child_not_student</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.relat.student_16_19.cannot_be_child.16_19_not_student</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_age_between_16_19'>age_between_16_19</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_student'>student</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_child'>child</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.student_16_19.must_be_16_19</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.student_16_19.cannot_be_student.child_not_16_19</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.relat.student_16_19.cannot_be_child.student_not_16_19</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_person_age_matches_economic_status-instance_method">
#<strong>validate_person_age_matches_economic_status</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 74</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_person_age_matches_economic_status'>validate_person_age_matches_economic_status</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='lparen'>(</span><span class='int'>2</span><span class='op'>..</span><span class='int'>6</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_person_num'>person_num</span><span class='op'>|</span>
<span class='id identifier rubyid_age'>age</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_economic_status'>economic_status</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_economic_status'>economic_status</span>
<span class='kw'>if</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&lt;</span> <span class='int'>16</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_economic_status_is_child_other_or_refused?'>economic_status_is_child_other_or_refused?</span><span class='lparen'>(</span><span class='id identifier rubyid_economic_status'>economic_status</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.child_under_16</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_under_16_ecstat</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_person_is_economic_child?'>person_is_economic_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_economic_status'>economic_status</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&gt;</span> <span class='int'>16</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ecstat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.ecstat.child_over_16</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_over_16</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_person_age_matches_relationship-instance_method">
#<strong>validate_person_age_matches_relationship</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/household_validations.rb', line 28</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_person_age_matches_relationship'>validate_person_age_matches_relationship</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='lparen'>(</span><span class='int'>2</span><span class='op'>..</span><span class='int'>6</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_person_num'>person_num</span><span class='op'>|</span>
<span class='id identifier rubyid_age'>age</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_relationship'>relationship</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_relationship'>relationship</span>
<span class='kw'>if</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&lt;</span> <span class='int'>16</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_relationship_is_child_other_or_refused?'>relationship_is_child_other_or_refused?</span><span class='lparen'>(</span><span class='id identifier rubyid_relationship'>relationship</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_under_16_relat_sales</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.relat.child_under_16_sales</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>person_num:</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>&gt;=</span> <span class='int'>20</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_person_is_child?'>person_is_child?</span><span class='lparen'>(</span><span class='id identifier rubyid_relationship'>relationship</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>age</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.age.child_over_20</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_person_num'>person_num</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.relat.child_over_20</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

312
app/models/validations/doc/Validations/Sales/PropertyValidations.html

@ -0,0 +1,312 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::Sales::PropertyValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::Sales::PropertyValidations";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (P)</a> &raquo;
<span class='title'>Validations</span> &raquo; <span class='title'>Sales</span>
&raquo;
<span class="title">PropertyValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::Sales::PropertyValidations
</h1>
<div class="box_info">
<dl>
<dt>Defined in:</dt>
<dd>sales/property_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_bedsit_number_of_beds-instance_method" title="#validate_bedsit_number_of_beds (instance method)">#<strong>validate_bedsit_number_of_beds</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_postcodes_match_if_discounted_ownership-instance_method" title="#validate_postcodes_match_if_discounted_ownership (instance method)">#<strong>validate_postcodes_match_if_discounted_ownership</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_uprn-instance_method" title="#validate_uprn (instance method)">#<strong>validate_uprn</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_bedsit_number_of_beds-instance_method">
#<strong>validate_bedsit_number_of_beds</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
14
15
16
17
18
19
20
21</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/property_validations.rb', line 14</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_bedsit_number_of_beds'>validate_bedsit_number_of_beds</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_proptype'>proptype</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_bedsit?'>is_bedsit?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_beds'>beds</span> <span class='op'>&gt;</span> <span class='int'>1</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:proptype</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.proptype.bedsits_have_max_one_bedroom</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:beds</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.beds.bedsits_have_max_one_bedroom</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_postcodes_match_if_discounted_ownership-instance_method">
#<strong>validate_postcodes_match_if_discounted_ownership</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
2
3
4
5
6
7
8
9
10
11
12</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/property_validations.rb', line 2</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_postcodes_match_if_discounted_ownership'>validate_postcodes_match_if_discounted_ownership</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ppostcode_full'>ppostcode_full</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_postcode_full'>postcode_full</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_discounted_ownership_sale?'>discounted_ownership_sale?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ppostcode_full'>ppostcode_full</span> <span class='op'>!=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_postcode_full'>postcode_full</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:postcode_full</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.postcode.must_match_previous</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_possessive:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyers’</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyer’s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:ppostcode_full</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.postcode.must_match_previous</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_possessive:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyers’</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyer’s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:ownershipsch</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.postcode.must_match_previous</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_possessive:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyers’</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyer’s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:uprn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.postcode.must_match_previous</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>buyer_possessive:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint_purchase?'>joint_purchase?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyers’</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Buyer’s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_uprn-instance_method">
#<strong>validate_uprn</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25
26
27
28
29</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/property_validations.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_uprn'>validate_uprn</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_uprn'>uprn</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[0-9]{1,12}$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:uprn</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.property.uprn.invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

1445
app/models/validations/doc/Validations/Sales/SaleInformationValidations.html

File diff suppressed because it is too large Load Diff

417
app/models/validations/doc/Validations/Sales/SetupValidations.html

@ -0,0 +1,417 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::Sales::SetupValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::Sales::SetupValidations";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (S)</a> &raquo;
<span class='title'>Validations</span> &raquo; <span class='title'>Sales</span>
&raquo;
<span class="title">SetupValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::Sales::SetupValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>CollectionTimeHelper, Validations::SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>sales/setup_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_merged_organisations_saledate-instance_method" title="#validate_merged_organisations_saledate (instance method)">#<strong>validate_merged_organisations_saledate</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_organisation-instance_method" title="#validate_organisation (instance method)">#<strong>validate_organisation</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_saledate_collection_year-instance_method" title="#validate_saledate_collection_year (instance method)">#<strong>validate_saledate_collection_year</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_saledate_two_weeks-instance_method" title="#validate_saledate_two_weeks (instance method)">#<strong>validate_saledate_two_weeks</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_merged_organisations_saledate-instance_method">
#<strong>validate_merged_organisations_saledate</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/setup_validations.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_merged_organisations_saledate'>validate_merged_organisations_saledate</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>saledate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_merged_owning_organisation_inactive?'>merged_owning_organisation_inactive?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:saledate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.saledate.invalid_merged_organisations_saledate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_merge_date:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>owning_absorbing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_absorbing_organisation'>absorbing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_absorbing_owning_organisation_inactive?'>absorbing_owning_organisation_inactive?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:saledate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.saledate.invalid_absorbing_organisations_saledate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_available_from:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_organisation-instance_method">
#<strong>validate_organisation</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/setup_validations.rb', line 44</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_organisation'>validate_organisation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.inactive_merged_organisation_sales</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_merge_date:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>owning_absorbing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_absorbing_organisation'>absorbing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_absorbed_organisations'>absorbed_organisations</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.inactive_absorbing_organisation_sales</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_available_from:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_saledate_collection_year-instance_method">
#<strong>validate_saledate_collection_year</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
5
6
7
8
9
10
11
12
13
14
15
16
17</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/setup_validations.rb', line 5</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_saledate_collection_year'>validate_saledate_collection_year</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>saledate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='const'>FeatureToggle</span><span class='period'>.</span><span class='id identifier rubyid_allow_future_form_use?'>allow_future_form_use?</span>
<span class='id identifier rubyid_first_collection_start_date'>first_collection_start_date</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate_was'>saledate_was</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_editable_collection_start_date'>editable_collection_start_date</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_active_collection_start_date'>active_collection_start_date</span>
<span class='kw'>end</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_first_collection_start_date'>first_collection_start_date</span><span class='comma'>,</span> <span class='id identifier rubyid_current_collection_end_date'>current_collection_end_date</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:saledate</span><span class='comma'>,</span> <span class='id identifier rubyid_saledate_validation_error_message'>saledate_validation_error_message</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_saledate_two_weeks-instance_method">
#<strong>validate_saledate_two_weeks</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21
22
23
24
25</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'sales/setup_validations.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_saledate_two_weeks'>validate_saledate_two_weeks</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>saledate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='const'>FeatureToggle</span><span class='period'>.</span><span class='id identifier rubyid_allow_future_form_use?'>allow_future_form_use?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_zone'>zone</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span> <span class='op'>+</span> <span class='int'>14</span><span class='period'>.</span><span class='id identifier rubyid_days'>days</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:saledate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.saledate.later_than_14_days_after</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

1996
app/models/validations/doc/Validations/Sales/SoftValidations.html

File diff suppressed because it is too large Load Diff

679
app/models/validations/doc/Validations/SetupValidations.html

@ -0,0 +1,679 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::SetupValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::SetupValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (S)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">SetupValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::SetupValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>CollectionTimeHelper, SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>setup_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_irproduct_other-instance_method" title="#validate_irproduct_other (instance method)">#<strong>validate_irproduct_other</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_location-instance_method" title="#validate_location (instance method)">#<strong>validate_location</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_managing_organisation_data_sharing_agremeent_signed-instance_method" title="#validate_managing_organisation_data_sharing_agremeent_signed (instance method)">#<strong>validate_managing_organisation_data_sharing_agremeent_signed</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_merged_organisations_start_date-instance_method" title="#validate_merged_organisations_start_date (instance method)">#<strong>validate_merged_organisations_start_date</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_organisation-instance_method" title="#validate_organisation (instance method)">#<strong>validate_organisation</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_scheme-instance_method" title="#validate_scheme (instance method)">#<strong>validate_scheme</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_scheme_has_confirmed_locations_validation-instance_method" title="#validate_scheme_has_confirmed_locations_validation (instance method)">#<strong>validate_scheme_has_confirmed_locations_validation</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_startdate_setup-instance_method" title="#validate_startdate_setup (instance method)">#<strong>validate_startdate_setup</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_irproduct_other-instance_method">
#<strong>validate_irproduct_other</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
69
70
71
72
73</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 69</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_irproduct_other'>validate_irproduct_other</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_intermediate_product_rent_type?'>intermediate_product_rent_type?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_irproduct_other'>irproduct_other</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:irproduct_other</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.intermediate_rent_product_name.blank</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_location-instance_method">
#<strong>validate_location</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
75
76
77
78
79
80
81
82</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 75</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_location'>validate_location</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_location_during_startdate_validation'>location_during_startdate_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span><span class='op'>&amp;.</span><span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='symbol'>:incomplete</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:location_id</span><span class='comma'>,</span> <span class='symbol'>:incomplete</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.location.incomplete</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:scheme_id</span><span class='comma'>,</span> <span class='symbol'>:incomplete</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.location.incomplete</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_managing_organisation_data_sharing_agremeent_signed-instance_method">
#<strong>validate_managing_organisation_data_sharing_agremeent_signed</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
96
97
98
99
100
101
102</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 96</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_managing_organisation_data_sharing_agremeent_signed'>validate_managing_organisation_data_sharing_agremeent_signed</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_skip_dpo_validation'>skip_dpo_validation</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation_id_changed?'>managing_organisation_id_changed?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_data_protection_confirmed?'>data_protection_confirmed?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:managing_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.managing_organisation.data_sharing_agreement_not_signed</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_merged_organisations_start_date-instance_method">
#<strong>validate_merged_organisations_start_date</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61
62
63
64
65
66
67</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_merged_organisations_start_date'>validate_merged_organisations_start_date</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='id identifier rubyid_add_same_merge_organisation_error'>add_same_merge_organisation_error</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span> <span class='op'>==</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span>
<span class='kw'>return</span> <span class='id identifier rubyid_add_same_merge_error'>add_same_merge_error</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_organisations_belong_to_same_merge?'>organisations_belong_to_same_merge?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='rparen'>)</span>
<span class='id identifier rubyid_add_merged_organisations_errors'>add_merged_organisations_errors</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_add_absorbing_organisations_errors'>add_absorbing_organisations_errors</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_organisation-instance_method">
#<strong>validate_organisation</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 23</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_organisation'>validate_organisation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_created_by'>created_by</span><span class='comma'>,</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='comma'>,</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>created_by</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>managing_organisation</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>owning_organisation</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='lbracket'>[</span><span class='id identifier rubyid_created_by'>created_by</span><span class='comma'>,</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='comma'>,</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:blank?</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_created_by'>created_by</span><span class='period'>.</span><span class='id identifier rubyid_organisation'>organisation</span><span class='period'>.</span><span class='id identifier rubyid_absorbed_organisations'>absorbed_organisations</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='id identifier rubyid_created_by'>created_by</span><span class='period'>.</span><span class='id identifier rubyid_organisation'>organisation</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&amp;</span> <span class='lbracket'>[</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='comma'>,</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:created_by</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.created_by.invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:managing_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.managing_organisation.invalid</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span>
<span class='kw'>if</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.inactive_merged_organisation</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_merge_date:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>owning_absorbing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_absorbing_organisation'>absorbing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_absorbed_organisations'>absorbed_organisations</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.inactive_absorbing_organisation</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>owning_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>owning_organisation_available_from:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='kw'>if</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span> <span class='op'>&lt;=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:managing_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.managing_organisation.inactive_merged_organisation</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>managing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>managing_organisation_merge_date:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_merge_date'>merge_date</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>managing_absorbing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_absorbing_organisation'>absorbing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_absorbed_organisations'>absorbed_organisations</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span><span class='period'>.</span><span class='id identifier rubyid_to_date'>to_date</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:managing_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.managing_organisation.inactive_absorbing_organisation</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
<span class='label'>managing_organisation:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>managing_organisation_available_from:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_managing_organisation'>managing_organisation</span><span class='period'>.</span><span class='id identifier rubyid_available_from'>available_from</span><span class='period'>.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_scheme-instance_method">
#<strong>validate_scheme</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
92
93
94</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 92</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_scheme'>validate_scheme</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_scheme_during_startdate_validation'>scheme_during_startdate_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_scheme_has_confirmed_locations_validation-instance_method">
#<strong>validate_scheme_has_confirmed_locations_validation</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
84
85
86
87
88
89
90</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 84</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_scheme_has_confirmed_locations_validation'>validate_scheme_has_confirmed_locations_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span><span class='period'>.</span><span class='id identifier rubyid_locations'>locations</span><span class='period'>.</span><span class='id identifier rubyid_confirmed'>confirmed</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:scheme_id</span><span class='comma'>,</span> <span class='symbol'>:no_completed_locations</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.scheme.no_completed_locations</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_startdate_setup-instance_method">
#<strong>validate_startdate_setup</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'setup_validations.rb', line 5</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_startdate_setup'>validate_startdate_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>startdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='const'>FeatureToggle</span><span class='period'>.</span><span class='id identifier rubyid_allow_future_form_use?'>allow_future_form_use?</span>
<span class='id identifier rubyid_first_collection_start_date'>first_collection_start_date</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate_was'>startdate_was</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_editable_collection_start_date'>editable_collection_start_date</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_active_collection_start_date'>active_collection_start_date</span>
<span class='kw'>end</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_first_collection_start_date'>first_collection_start_date</span><span class='comma'>,</span> <span class='id identifier rubyid_current_collection_end_date'>current_collection_end_date</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='id identifier rubyid_startdate_validation_error_message'>startdate_validation_error_message</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span> <span class='op'>&gt;</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_zone'>zone</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span> <span class='op'>+</span> <span class='int'>14</span><span class='period'>.</span><span class='id identifier rubyid_days'>days</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.later_than_14_days_after</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:48 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

853
app/models/validations/doc/Validations/SharedValidations.html

@ -0,0 +1,853 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::SharedValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::SharedValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (S)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">SharedValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::SharedValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>ActionView::Helpers::NumberHelper</dd>
</dl>
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="DateValidations.html" title="Validations::DateValidations (module)">DateValidations</a></span>, <span class='object_link'><a href="FinancialValidations.html" title="Validations::FinancialValidations (module)">FinancialValidations</a></span>, <span class='object_link'><a href="HouseholdValidations.html" title="Validations::HouseholdValidations (module)">HouseholdValidations</a></span>, <span class='object_link'><a href="Sales/HouseholdValidations.html" title="Validations::Sales::HouseholdValidations (module)">Validations::Sales::HouseholdValidations</a></span>, <span class='object_link'><a href="Sales/SaleInformationValidations.html" title="Validations::Sales::SaleInformationValidations (module)">Validations::Sales::SaleInformationValidations</a></span>, <span class='object_link'><a href="Sales/SetupValidations.html" title="Validations::Sales::SetupValidations (module)">Validations::Sales::SetupValidations</a></span>, <span class='object_link'><a href="SetupValidations.html" title="Validations::SetupValidations (module)">SetupValidations</a></span>, <span class='object_link'><a href="TenancyValidations.html" title="Validations::TenancyValidations (module)">TenancyValidations</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>shared_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#date_valid%3F-instance_method" title="#date_valid? (instance method)">#<strong>date_valid?</strong>(question, record) &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#inactive_status-instance_method" title="#inactive_status (instance method)">#<strong>inactive_status</strong>(date, resource) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#location_during_startdate_validation-instance_method" title="#location_during_startdate_validation (instance method)">#<strong>location_during_startdate_validation</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scheme_during_startdate_validation-instance_method" title="#scheme_during_startdate_validation (instance method)">#<strong>scheme_during_startdate_validation</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#shared_validate_partner_count-instance_method" title="#shared_validate_partner_count (instance method)">#<strong>shared_validate_partner_count</strong>(record, max_people) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_numeric_min_max-instance_method" title="#validate_numeric_min_max (instance method)">#<strong>validate_numeric_min_max</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_numeric_step-instance_method" title="#validate_numeric_step (instance method)">#<strong>validate_numeric_step</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_other_field-instance_method" title="#validate_other_field (instance method)">#<strong>validate_other_field</strong>(record, value_other = nil, main_field = nil, other_field = nil, main_label = nil, other_label = nil) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_owning_organisation_data_sharing_agremeent_signed-instance_method" title="#validate_owning_organisation_data_sharing_agremeent_signed (instance method)">#<strong>validate_owning_organisation_data_sharing_agremeent_signed</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_property_postcode-instance_method" title="#validate_property_postcode (instance method)">#<strong>validate_property_postcode</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="date_valid?-instance_method">
#<strong>date_valid?</strong>(question, record) &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
116
117
118
119
120
121
122
123</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 116</span>
<span class='kw'>def</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_question'>question</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_question'>question</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeWithZone</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_question'>question</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_question'>question</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.date.invalid_date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>false</span>
<span class='kw'>else</span>
<span class='kw'>true</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="inactive_status-instance_method">
#<strong>inactive_status</strong>(date, resource) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 87</span>
<span class='kw'>def</span> <span class='id identifier rubyid_inactive_status'>inactive_status</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_resource'>resource</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_status_at'>status_at</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>reactivating_soon</span><span class='words_sep'> </span><span class='tstring_content'>activating_soon</span><span class='words_sep'> </span><span class='tstring_content'>deactivated</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_status'>status</span><span class='rparen'>)</span>
<span class='id identifier rubyid_closest_reactivation'>closest_reactivation</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_last_deactivation_before'>last_deactivation_before</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='rparen'>)</span>
<span class='id identifier rubyid_open_deactivation'>open_deactivation</span> <span class='op'>=</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_open_deactivation'>open_deactivation</span>
<span class='id identifier rubyid_date'>date</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_status'>status</span>
<span class='kw'>when</span> <span class='symbol'>:reactivating_soon</span> <span class='kw'>then</span> <span class='id identifier rubyid_closest_reactivation'>closest_reactivation</span><span class='period'>.</span><span class='id identifier rubyid_reactivation_date'>reactivation_date</span>
<span class='kw'>when</span> <span class='symbol'>:activating_soon</span> <span class='kw'>then</span> <span class='id identifier rubyid_resource'>resource</span><span class='op'>&amp;.</span><span class='id identifier rubyid_available_from'>available_from</span>
<span class='kw'>when</span> <span class='symbol'>:deactivated</span> <span class='kw'>then</span> <span class='id identifier rubyid_open_deactivation'>open_deactivation</span><span class='period'>.</span><span class='id identifier rubyid_deactivation_date'>deactivation_date</span>
<span class='kw'>end</span>
<span class='lbrace'>{</span> <span class='label'>scope:</span> <span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='label'>date:</span> <span class='id identifier rubyid_date'>date</span><span class='op'>&amp;.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span> <span class='id identifier rubyid_closest_reactivation'>closest_reactivation</span><span class='op'>&amp;.</span><span class='id identifier rubyid_deactivation_date'>deactivation_date</span><span class='op'>&amp;.</span><span class='id identifier rubyid_to_formatted_s'>to_formatted_s</span><span class='lparen'>(</span><span class='symbol'>:govuk_date</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="location_during_startdate_validation-instance_method">
#<strong>location_during_startdate_validation</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69
70
71
72
73
74
75
76</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 67</span>
<span class='kw'>def</span> <span class='id identifier rubyid_location_during_startdate_validation'>location_during_startdate_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_location_inactive_status'>location_inactive_status</span> <span class='op'>=</span> <span class='id identifier rubyid_inactive_status'>inactive_status</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_location_inactive_status'>location_inactive_status</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_deactivation_date'>deactivation_date</span> <span class='op'>=</span> <span class='id identifier rubyid_location_inactive_status'>location_inactive_status</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='symbol'>:date</span><span class='comma'>,</span> <span class='symbol'>:scope</span><span class='comma'>,</span> <span class='symbol'>:deactivation_date</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='symbol'>:not_active</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.location.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scope'>scope</span><span class='embexpr_end'>}</span><span class='tstring_content'>.startdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>postcode:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_postcode'>postcode</span><span class='comma'>,</span> <span class='label'>date:</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:location_id</span><span class='comma'>,</span> <span class='symbol'>:not_active</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.location.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scope'>scope</span><span class='embexpr_end'>}</span><span class='tstring_content'>.location_id</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>postcode:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_postcode'>postcode</span><span class='comma'>,</span> <span class='label'>date:</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:scheme_id</span><span class='comma'>,</span> <span class='symbol'>:not_active</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.location.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scope'>scope</span><span class='embexpr_end'>}</span><span class='tstring_content'>.location_id</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>postcode:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_postcode'>postcode</span><span class='comma'>,</span> <span class='label'>date:</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scheme_during_startdate_validation-instance_method">
#<strong>scheme_during_startdate_validation</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
78
79
80
81
82
83
84
85</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 78</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scheme_during_startdate_validation'>scheme_during_startdate_validation</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_scheme_inactive_status'>scheme_inactive_status</span> <span class='op'>=</span> <span class='id identifier rubyid_inactive_status'>inactive_status</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_startdate'>startdate</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_scheme_inactive_status'>scheme_inactive_status</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_date'>date</span><span class='comma'>,</span> <span class='id identifier rubyid_scope'>scope</span><span class='comma'>,</span> <span class='id identifier rubyid_deactivation_date'>deactivation_date</span> <span class='op'>=</span> <span class='id identifier rubyid_scheme_inactive_status'>scheme_inactive_status</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='symbol'>:date</span><span class='comma'>,</span> <span class='symbol'>:scope</span><span class='comma'>,</span> <span class='symbol'>:deactivation_date</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:startdate</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.scheme.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scope'>scope</span><span class='embexpr_end'>}</span><span class='tstring_content'>.startdate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>name:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span><span class='period'>.</span><span class='id identifier rubyid_service_name'>service_name</span><span class='comma'>,</span> <span class='label'>date:</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:scheme_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.startdate.scheme.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_scope'>scope</span><span class='embexpr_end'>}</span><span class='tstring_content'>.scheme_id</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>name:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span><span class='period'>.</span><span class='id identifier rubyid_service_name'>service_name</span><span class='comma'>,</span> <span class='label'>date:</span><span class='comma'>,</span> <span class='label'>deactivation_date:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="shared_validate_partner_count-instance_method">
#<strong>shared_validate_partner_count</strong>(record, max_people) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
105
106
107
108
109
110
111
112
113
114</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 105</span>
<span class='kw'>def</span> <span class='id identifier rubyid_shared_validate_partner_count'>shared_validate_partner_count</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_max_people'>max_people</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_start_year_after_2024?'>start_year_after_2024?</span>
<span class='id identifier rubyid_partner_numbers'>partner_numbers</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='int'>2</span><span class='op'>..</span><span class='id identifier rubyid_max_people'>max_people</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span> <span class='id identifier rubyid_person_is_partner?'>person_is_partner?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>if</span> <span class='id identifier rubyid_partner_numbers'>partner_numbers</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&gt;</span> <span class='int'>1</span>
<span class='id identifier rubyid_partner_numbers'>partner_numbers</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_n'>n</span><span class='op'>|</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>relat</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_n'>n</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.household.relat.one_partner</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_numeric_min_max-instance_method">
#<strong>validate_numeric_min_max</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_numeric_min_max'>validate_numeric_min_max</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_numeric_questions'>numeric_questions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_question'>question</span><span class='op'>|</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='op'>||</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_routed_to?'>routed_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_answer'>answer</span> <span class='op'>=</span> <span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>_before_type_cast</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
<span class='id identifier rubyid_add_range_error'>add_range_error</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_question'>question</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_answer'>answer</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_answer'>answer</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_answer'>answer</span><span class='rparen'>)</span>
<span class='id identifier rubyid_add_range_error'>add_range_error</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_question'>question</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_numeric_step-instance_method">
#<strong>validate_numeric_step</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 38</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_numeric_step'>validate_numeric_step</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_numeric_questions'>numeric_questions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_question'>question</span><span class='op'>|</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_step'>step</span>
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_routed_to?'>routed_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_public_send'>public_send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>_before_type_cast</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_field'>field</span> <span class='op'>=</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_check_answer_label'>check_answer_label</span> <span class='op'>||</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
<span class='id identifier rubyid_incorrect_accuracy'>incorrect_accuracy</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_d'>to_d</span> <span class='op'>*</span> <span class='int'>100</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='lparen'>(</span><span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_step'>step</span> <span class='op'>*</span> <span class='int'>100</span><span class='rparen'>)</span> <span class='op'>!=</span> <span class='int'>0</span>
<span class='kw'>if</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_step'>step</span> <span class='op'>&lt;</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_incorrect_accuracy'>incorrect_accuracy</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.numeric.nearest_hundredth</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>field:</span><span class='rparen'>)</span>
<span class='kw'>elsif</span> <span class='id identifier rubyid_incorrect_accuracy'>incorrect_accuracy</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_d'>to_d</span> <span class='op'>!=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='comment'># if the user enters a value in exponent notation (eg &#39;4e1&#39;) the to_i method does not convert this to the correct value
</span> <span class='id identifier rubyid_field'>field</span> <span class='op'>=</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_check_answer_label'>check_answer_label</span> <span class='op'>||</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
<span class='kw'>case</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_step'>step</span>
<span class='kw'>when</span> <span class='int'>1</span> <span class='kw'>then</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='symbol'>:not_integer</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.numeric.whole_number</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>field:</span><span class='rparen'>)</span>
<span class='kw'>when</span> <span class='int'>10</span> <span class='kw'>then</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_question'>question</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.numeric.nearest_ten</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>field:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_other_field-instance_method">
#<strong>validate_other_field</strong>(record, value_other = nil, main_field = nil, other_field = nil, main_label = nil, other_label = nil) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
4
5
6
7
8
9
10
11
12
13
14
15
16
17</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 4</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_other_field'>validate_other_field</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_value_other'>value_other</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_main_field'>main_field</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_other_field'>other_field</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_main_label'>main_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_other_label'>other_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_main_field'>main_field</span> <span class='op'>||</span> <span class='id identifier rubyid_other_field'>other_field</span>
<span class='id identifier rubyid_main_field_label'>main_field_label</span> <span class='op'>=</span> <span class='id identifier rubyid_main_label'>main_label</span> <span class='op'>||</span> <span class='id identifier rubyid_main_field'>main_field</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_humanize'>humanize</span><span class='lparen'>(</span><span class='label'>capitalize:</span> <span class='kw'>false</span><span class='rparen'>)</span>
<span class='id identifier rubyid_other_field_label'>other_field_label</span> <span class='op'>=</span> <span class='id identifier rubyid_other_label'>other_label</span> <span class='op'>||</span> <span class='id identifier rubyid_other_field'>other_field</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_humanize'>humanize</span><span class='lparen'>(</span><span class='label'>capitalize:</span> <span class='kw'>false</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_main_field'>main_field</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_value_other'>value_other</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_other_field'>other_field</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_main_field'>main_field</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.other_field_missing</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>main_field_label:</span><span class='comma'>,</span> <span class='label'>other_field_label:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_other_field'>other_field</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.other_field_missing</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>main_field_label:</span><span class='comma'>,</span> <span class='label'>other_field_label:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_main_field'>main_field</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='id identifier rubyid_value_other'>value_other</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='lbracket'>[</span><span class='id identifier rubyid_other_field'>other_field</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_other_field'>other_field</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.other_field_not_required</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>main_field_label:</span><span class='comma'>,</span> <span class='label'>other_field_label:</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_owning_organisation_data_sharing_agremeent_signed-instance_method">
#<strong>validate_owning_organisation_data_sharing_agremeent_signed</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
125
126
127
128
129
130
131</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 125</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_owning_organisation_data_sharing_agremeent_signed'>validate_owning_organisation_data_sharing_agremeent_signed</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_skip_dpo_validation'>skip_dpo_validation</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation_id_changed?'>owning_organisation_id_changed?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_owning_organisation'>owning_organisation</span><span class='period'>.</span><span class='id identifier rubyid_data_protection_confirmed?'>data_protection_confirmed?</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:owning_organisation_id</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.setup.owning_organisation.data_sharing_agreement_not_signed</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_property_postcode-instance_method">
#<strong>validate_property_postcode</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
59
60
61
62
63
64
65</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'shared_validations.rb', line 59</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_property_postcode'>validate_property_postcode</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_postcode'>postcode</span> <span class='op'>=</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_postcode_full'>postcode_full</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_postcode_known?'>postcode_known?</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><span class='id identifier rubyid_postcode'>postcode</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_postcode'>postcode</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='const'>POSTCODE_REGEXP</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_error_message'>error_message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.postcode</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:postcode_full</span><span class='comma'>,</span> <span class='symbol'>:wrong_format</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_error_message'>error_message</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:48 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

1516
app/models/validations/doc/Validations/SoftValidations.html

File diff suppressed because it is too large Load Diff

584
app/models/validations/doc/Validations/TenancyValidations.html

@ -0,0 +1,584 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Validations::TenancyValidations
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Validations::TenancyValidations";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (T)</a> &raquo;
<span class='title'>Validations</span>
&raquo;
<span class="title">TenancyValidations</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Validations::TenancyValidations
</h1>
<div class="box_info">
<dl>
<dt>Includes:</dt>
<dd>SharedValidations</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>tenancy_validations.rb</dd>
</dl>
</div>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#validate_general_needs_fixed_tenancy_length_affordable_social_rent-instance_method" title="#validate_general_needs_fixed_tenancy_length_affordable_social_rent (instance method)">#<strong>validate_general_needs_fixed_tenancy_length_affordable_social_rent</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_general_needs_fixed_tenancy_length_intermediate_rent-instance_method" title="#validate_general_needs_fixed_tenancy_length_intermediate_rent (instance method)">#<strong>validate_general_needs_fixed_tenancy_length_intermediate_rent</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_joint_tenancy-instance_method" title="#validate_joint_tenancy (instance method)">#<strong>validate_joint_tenancy</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_other_tenancy_type-instance_method" title="#validate_other_tenancy_type (instance method)">#<strong>validate_other_tenancy_type</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_periodic_tenancy_length-instance_method" title="#validate_periodic_tenancy_length (instance method)">#<strong>validate_periodic_tenancy_length</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_supported_housing_fixed_tenancy_length-instance_method" title="#validate_supported_housing_fixed_tenancy_length (instance method)">#<strong>validate_supported_housing_fixed_tenancy_length</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#validate_tenancy_length_blank_when_not_required-instance_method" title="#validate_tenancy_length_blank_when_not_required (instance method)">#<strong>validate_tenancy_length_blank_when_not_required</strong>(record) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="validate_general_needs_fixed_tenancy_length_affordable_social_rent-instance_method">
#<strong>validate_general_needs_fixed_tenancy_length_affordable_social_rent</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
19
20
21
22
23
24
25
26
27
28
29
30
31</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 19</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_general_needs_fixed_tenancy_length_affordable_social_rent'>validate_general_needs_fixed_tenancy_length_affordable_social_rent</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_affordable_or_social_rent?'>affordable_or_social_rent?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_general_needs?'>is_general_needs?</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>2</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.length.invalid_fixed</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rent_type</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_general_needs_fixed_tenancy_length_intermediate_rent-instance_method">
#<strong>validate_general_needs_fixed_tenancy_length_intermediate_rent</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
33
34
35
36
37
38
39
40
41
42
43
44
45</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 33</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_general_needs_fixed_tenancy_length_intermediate_rent'>validate_general_needs_fixed_tenancy_length_intermediate_rent</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_affordable_or_social_rent?'>affordable_or_social_rent?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_general_needs?'>is_general_needs?</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.length.invalid_fixed</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:rent_type</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_joint_tenancy-instance_method">
#<strong>validate_joint_tenancy</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
71
72
73
74
75
76
77
78</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 71</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_joint_tenancy'>validate_joint_tenancy</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint'>joint</span>
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hhmemb'>hhmemb</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_joint'>joint</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_collection_start_year'>collection_start_year</span> <span class='op'>&gt;=</span> <span class='int'>2022</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:joint</span><span class='comma'>,</span> <span class='symbol'>:not_joint_tenancy</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.not_joint</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:hhmemb</span><span class='comma'>,</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.joint_more_than_one_member</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_other_tenancy_type-instance_method">
#<strong>validate_other_tenancy_type</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
67
68
69</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 67</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_other_tenancy_type'>validate_other_tenancy_type</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='id identifier rubyid_validate_other_field'>validate_other_field</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='int'>3</span><span class='comma'>,</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='symbol'>:tenancyother</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>tenancy type</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>other tenancy type</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_periodic_tenancy_length-instance_method">
#<strong>validate_periodic_tenancy_length</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
47
48
49
50
51
52
53
54
55
56</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 47</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_periodic_tenancy_length'>validate_periodic_tenancy_length</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_periodic_tenancy?'>is_periodic_tenancy?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.length.invalid_periodic</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_supported_housing_fixed_tenancy_length-instance_method">
#<strong>validate_supported_housing_fixed_tenancy_length</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
6
7
8
9
10
11
12
13
14
15
16
17</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 6</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_supported_housing_fixed_tenancy_length'>validate_supported_housing_fixed_tenancy_length</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_supported_housing?'>is_supported_housing?</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span> <span class='op'>=</span> <span class='int'>1</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='id identifier rubyid_min_tenancy_length'>min_tenancy_length</span><span class='comma'>,</span> <span class='int'>99</span><span class='rparen'>)</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.length.invalid_fixed</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>min_tenancy_length:</span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:needstype</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="validate_tenancy_length_blank_when_not_required-instance_method">
#<strong>validate_tenancy_length_blank_when_not_required</strong>(record) &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
58
59
60
61
62
63
64
65</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'tenancy_validations.rb', line 58</span>
<span class='kw'>def</span> <span class='id identifier rubyid_validate_tenancy_length_blank_when_not_required'>validate_tenancy_length_blank_when_not_required</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancylength'>tenancylength</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_tenancy_type_fixed_term?'>tenancy_type_fixed_term?</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_periodic_tenancy?'>is_periodic_tenancy?</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>validations.tenancy.length.fixed_term_not_required</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancylength</span><span class='comma'>,</span> <span class='symbol'>:tenancylength_invalid</span><span class='comma'>,</span> <span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span>
<span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:tenancy</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:48 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

246
app/models/validations/doc/_index.html

@ -0,0 +1,246 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = null;
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.36</h1>
<div id="listing">
<h1 class="alphaindex">Alphabetic Index</h1>
<div class="clear"></div>
<h2>Namespace Listing A-Z</h2>
<table>
<tr>
<td valign='top' width="33%">
<ul id="alpha_D" class="alpha">
<li class="letter">D</li>
<ul>
<li>
<span class='object_link'><a href="Validations/DateValidations.html" title="Validations::DateValidations (module)">DateValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_F" class="alpha">
<li class="letter">F</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/FinancialValidations.html" title="Validations::Sales::FinancialValidations (module)">FinancialValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/FinancialValidations.html" title="Validations::FinancialValidations (module)">FinancialValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_H" class="alpha">
<li class="letter">H</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/HouseholdValidations.html" title="Validations::Sales::HouseholdValidations (module)">HouseholdValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/HouseholdValidations.html" title="Validations::HouseholdValidations (module)">HouseholdValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_L" class="alpha">
<li class="letter">L</li>
<ul>
<li>
<span class='object_link'><a href="Validations/LocalAuthorityValidations.html" title="Validations::LocalAuthorityValidations (module)">LocalAuthorityValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_P" class="alpha">
<li class="letter">P</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/PropertyValidations.html" title="Validations::Sales::PropertyValidations (module)">PropertyValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/PropertyValidations.html" title="Validations::PropertyValidations (module)">PropertyValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_S" class="alpha">
<li class="letter">S</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/SaleInformationValidations.html" title="Validations::Sales::SaleInformationValidations (module)">SaleInformationValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/Sales/SetupValidations.html" title="Validations::Sales::SetupValidations (module)">SetupValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SetupValidations.html" title="Validations::SetupValidations (module)">SetupValidations</a></span>
<small>(Validations)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SharedValidations.html" title="Validations::SharedValidations (module)">SharedValidations</a></span>
<small>(Validations)</small>
</li>
<li>
<span class='object_link'><a href="Validations/Sales/SoftValidations.html" title="Validations::Sales::SoftValidations (module)">SoftValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SoftValidations.html" title="Validations::SoftValidations (module)">SoftValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_T" class="alpha">
<li class="letter">T</li>
<ul>
<li>
<span class='object_link'><a href="Validations/TenancyValidations.html" title="Validations::TenancyValidations (module)">TenancyValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
</td>
</tr>
</table>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

51
app/models/validations/doc/class_list.html

File diff suppressed because one or more lines are too long

1
app/models/validations/doc/css/common.css

@ -0,0 +1 @@
/* Override this file with custom rules */

58
app/models/validations/doc/css/full_list.css

@ -0,0 +1,58 @@
body {
margin: 0;
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
font-size: 13px;
height: 101%;
overflow-x: hidden;
background: #fafafa;
}
h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; }
.clear { clear: both; }
.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; }
#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; }
#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; }
#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; }
#full_list ul { padding: 0; }
#full_list li { padding: 0; margin: 0; list-style: none; }
#full_list li .item { padding: 5px 5px 5px 12px; }
#noresults { padding: 7px 12px; background: #fff; }
#content.insearch #noresults { margin-left: 7px; }
li.collapsed ul { display: none; }
li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; }
li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; }
li { color: #888; cursor: pointer; }
li.deprecated { text-decoration: line-through; font-style: italic; }
li.odd { background: #f0f0f0; }
li.even { background: #fafafa; }
.item:hover { background: #ddd; }
li small:before { content: "("; }
li small:after { content: ")"; }
li small.search_info { display: none; }
a, a:visited { text-decoration: none; color: #05a; }
li.clicked > .item { background: #05a; color: #ccc; }
li.clicked > .item a, li.clicked > .item a:visited { color: #eee; }
li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; }
li.collapsed.clicked a.toggle { background-position: top right; }
#search input { border: 1px solid #bbb; border-radius: 3px; }
#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; }
#full_list_nav a, #nav a:visited { color: #358; }
#full_list_nav a:hover { background: transparent; color: #5af; }
#full_list_nav span:after { content: ' | '; }
#full_list_nav span:last-child:after { content: ''; }
#content h1 { margin-top: 0; }
li { white-space: nowrap; cursor: normal; }
li small { display: block; font-size: 0.8em; }
li small:before { content: ""; }
li small:after { content: ""; }
li small.search_info { display: none; }
#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; }
#content.insearch #search { background-position: center right; }
#search input { width: 110px; }
#full_list.insearch ul { display: block; }
#full_list.insearch .item { display: none; }
#full_list.insearch .found { display: block; padding-left: 11px !important; }
#full_list.insearch li a.toggle { display: none; }
#full_list.insearch li small.search_info { display: block; }

497
app/models/validations/doc/css/style.css

@ -0,0 +1,497 @@
html {
width: 100%;
height: 100%;
}
body {
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
font-size: 13px;
width: 100%;
margin: 0;
padding: 0;
display: flex;
display: -webkit-flex;
display: -ms-flexbox;
}
#nav {
position: relative;
width: 100%;
height: 100%;
border: 0;
border-right: 1px dotted #eee;
overflow: auto;
}
.nav_wrap {
margin: 0;
padding: 0;
width: 20%;
height: 100%;
position: relative;
display: flex;
display: -webkit-flex;
display: -ms-flexbox;
flex-shrink: 0;
-webkit-flex-shrink: 0;
-ms-flex: 1 0;
}
#resizer {
position: absolute;
right: -5px;
top: 0;
width: 10px;
height: 100%;
cursor: col-resize;
z-index: 9999;
}
#main {
flex: 5 1;
-webkit-flex: 5 1;
-ms-flex: 5 1;
outline: none;
position: relative;
background: #fff;
padding: 1.2em;
padding-top: 0.2em;
box-sizing: border-box;
}
@media (max-width: 920px) {
.nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; }
#resizer { display: none; }
#nav {
z-index: 9999;
background: #fff;
display: none;
position: absolute;
top: 40px;
right: 12px;
width: 500px;
max-width: 80%;
height: 80%;
overflow-y: scroll;
border: 1px solid #999;
border-collapse: collapse;
box-shadow: -7px 5px 25px #aaa;
border-radius: 2px;
}
}
@media (min-width: 920px) {
body { height: 100%; overflow: hidden; }
#main { height: 100%; overflow: auto; }
#search { display: none; }
}
#main img { max-width: 100%; }
h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; }
h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; }
h1.title { margin-bottom: 10px; }
h1.alphaindex { margin-top: 0; font-size: 22px; }
h2 {
padding: 0;
padding-bottom: 3px;
border-bottom: 1px #aaa solid;
font-size: 1.4em;
margin: 1.8em 0 0.5em;
position: relative;
}
h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; }
h2 small a {
display: block;
height: 20px;
border: 1px solid #aaa;
border-bottom: 0;
border-top-left-radius: 5px;
background: #f8f8f8;
position: relative;
padding: 2px 7px;
}
.clear { clear: both; }
.inline { display: inline; }
.inline p:first-child { display: inline; }
.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; }
.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt {
color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em;
border-radius: 4px;
}
.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; }
.docstring h1 { font-size: 1.2em; }
.docstring h2 { font-size: 1.1em; }
.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; }
.summary_desc .object_link a, .docstring .object_link a {
font-family: monospace; font-size: 1.05em;
color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em;
border-radius: 4px;
}
.rdoc-term { padding-right: 25px; font-weight: bold; }
.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; }
.summary_desc pre.code .object_link a, .docstring pre.code .object_link a {
padding: 0px; background: inherit; color: inherit; border-radius: inherit;
}
/* style for <table> */
#filecontents table, .docstring table { border-collapse: collapse; }
#filecontents table th, #filecontents table td,
.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; }
#filecontents table tr:nth-child(odd),
.docstring table tr:nth-child(odd) { background: #eee; }
#filecontents table tr:nth-child(even),
.docstring table tr:nth-child(even) { background: #fff; }
#filecontents table th, .docstring table th { background: #fff; }
/* style for <ul> */
#filecontents li > p, .docstring li > p { margin: 0px; }
#filecontents ul, .docstring ul { padding-left: 20px; }
/* style for <dl> */
#filecontents dl, .docstring dl { border: 1px solid #ccc; }
#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; }
#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; }
#filecontents dd > p, .docstring dd > p { margin: 0px; }
.note {
color: #222;
margin: 20px 0;
padding: 10px;
border: 1px solid #eee;
border-radius: 3px;
display: block;
}
.docstring .note {
border-left-color: #ccc;
border-left-width: 5px;
}
.note.todo { background: #ffffc5; border-color: #ececaa; }
.note.returns_void { background: #efefef; }
.note.deprecated { background: #ffe5e5; border-color: #e9dada; }
.note.title.deprecated { background: #ffe5e5; border-color: #e9dada; }
.note.private { background: #ffffc5; border-color: #ececaa; }
.note.title { padding: 3px 6px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; }
.summary_signature + .note.title { margin-left: 7px; }
h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; }
.note.title { background: #efefef; }
.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
.note.title.private { background: #d5d5d5; border-color: #c5c5c5; }
.note.title.not_defined_here { background: transparent; border: none; font-style: italic; }
.discussion .note { margin-top: 6px; }
.discussion .note:first-child { margin-top: 0; }
h3.inherited {
font-style: italic;
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
font-weight: normal;
padding: 0;
margin: 0;
margin-top: 12px;
margin-bottom: 3px;
font-size: 13px;
}
p.inherited {
padding: 0;
margin: 0;
margin-left: 25px;
}
.box_info dl {
margin: 0;
border: 0;
width: 100%;
font-size: 1em;
display: flex;
display: -webkit-flex;
display: -ms-flexbox;
}
.box_info dl dt {
flex-shrink: 0;
-webkit-flex-shrink: 1;
-ms-flex-shrink: 1;
width: 100px;
text-align: right;
font-weight: bold;
border: 1px solid #aaa;
border-width: 1px 0px 0px 1px;
padding: 6px 0;
padding-right: 10px;
}
.box_info dl dd {
flex-grow: 1;
-webkit-flex-grow: 1;
-ms-flex: 1;
max-width: 420px;
padding: 6px 0;
padding-right: 20px;
border: 1px solid #aaa;
border-width: 1px 1px 0 0;
overflow: hidden;
position: relative;
}
.box_info dl:last-child > * {
border-bottom: 1px solid #aaa;
}
.box_info dl:nth-child(odd) > * { background: #eee; }
.box_info dl:nth-child(even) > * { background: #fff; }
.box_info dl > * { margin: 0; }
ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; }
.index_inline_list { padding-left: 0; font-size: 1.1em; }
.index_inline_list li {
list-style: none;
display: inline-block;
padding: 0 12px;
line-height: 30px;
margin-bottom: 5px;
}
dl.constants { margin-left: 10px; }
dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; }
dl.constants.compact dt { display: inline-block; font-weight: normal }
dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; }
dl.constants .docstring .note:first-child { margin-top: 5px; }
.summary_desc {
margin-left: 32px;
display: block;
font-family: sans-serif;
font-size: 1.1em;
margin-top: 8px;
line-height: 1.5145em;
margin-bottom: 0.8em;
}
.summary_desc tt { font-size: 0.9em; }
dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; }
dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; }
dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; }
dl.constants .discussion *:first-child { margin-top: 0; }
dl.constants .discussion *:last-child { margin-bottom: 0; }
.method_details { border-top: 1px dotted #ccc; margin-top: 25px; padding-top: 0; }
.method_details.first { border: 0; margin-top: 5px; }
.method_details.first h3.signature { margin-top: 1em; }
p.signature, h3.signature {
font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
padding: 6px 10px; margin-top: 1em;
background: #E8F4FF; border: 1px solid #d8d8e5; border-radius: 5px;
}
p.signature tt,
h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; }
p.signature .overload,
h3.signature .overload { display: block; }
p.signature .extras,
h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; }
p.signature .not_defined_here,
h3.signature .not_defined_here,
p.signature .aliases,
h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; }
p.signature .aliases .names,
h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; }
.tags .tag_title { font-size: 1.05em; margin-bottom: 0; font-weight: bold; }
.tags .tag_title tt { color: initial; padding: initial; background: initial; }
.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; }
.tags ul li { margin-bottom: 3px; }
.tags ul .name { font-family: monospace; font-weight: bold; }
.tags ul .note { padding: 3px 6px; }
.tags { margin-bottom: 12px; }
.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; }
.tags .examples .inline p { padding: 0; margin: 0; font-weight: bold; font-size: 1em; }
.tags .examples .inline p:before { content: "▸"; font-size: 1em; margin-right: 5px; }
.tags .overload .overload_item { list-style: none; margin-bottom: 25px; }
.tags .overload .overload_item .signature {
padding: 2px 8px;
background: #F1F8FF; border: 1px solid #d8d8e5; border-radius: 3px;
}
.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; }
.tags .overload .docstring { margin-top: 15px; }
.defines { display: none; }
#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; }
.showSource { font-size: 0.9em; }
.showSource a, .showSource a:visited { text-decoration: none; color: #666; }
#content a, #content a:visited { text-decoration: none; color: #05a; }
#content a:hover { background: #ffffa5; }
ul.summary {
list-style: none;
font-family: monospace;
font-size: 1em;
line-height: 1.5em;
padding-left: 0px;
}
ul.summary a, ul.summary a:visited {
text-decoration: none; font-size: 1.1em;
}
ul.summary li { margin-bottom: 5px; }
.summary_signature { padding: 4px 8px; background: #f8f8f8; border: 1px solid #f0f0f0; border-radius: 5px; }
.summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; }
.summary_signature.deprecated { background: #ffe5e5; border-color: #e9dada; }
ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;}
ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; }
#content .summary_signature:hover a,
#content .summary_signature:hover a:visited {
background: transparent;
color: #049;
}
p.inherited a { font-family: monospace; font-size: 0.9em; }
p.inherited { word-spacing: 5px; font-size: 1.2em; }
p.children { font-size: 1.2em; }
p.children a { font-size: 0.9em; }
p.children strong { font-size: 0.8em; }
p.children strong.modules { padding-left: 5px; }
ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; }
ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; }
ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAHtJREFUeNqMzrEJAkEURdGzuhgZbSoYWcAWoBVsB4JgZAGmphsZCZYzTQgWNCYrDN9RvMmHx+X916SUBFbo8CzD1idXrLErw1mQttgXtyrOcQ/Ny5p4Qh+2XqLYYazsPWNTiuMkRxa4vcV+evuNAUOLIx5+c2hyzv7hNQC67Q+/HHmlEwAAAABJRU5ErkJggg==) no-repeat top center; }
ul.fullTree li:first-child { padding-top: 0; background: transparent; }
ul.fullTree li:last-child { padding-bottom: 0; }
.showAll ul.fullTree { display: block; }
.showAll .inheritName { display: none; }
#search { position: absolute; right: 12px; top: 0px; z-index: 9000; }
#search a {
display: block; float: left;
padding: 4px 8px; text-decoration: none; color: #05a; fill: #05a;
border: 1px solid #d8d8e5;
border-bottom-left-radius: 3px; border-bottom-right-radius: 3px;
background: #F1F8FF;
box-shadow: -1px 1px 3px #ddd;
}
#search a:hover { background: #f5faff; color: #06b; fill: #06b; }
#search a.active {
background: #568; padding-bottom: 20px; color: #fff; fill: #fff;
border: 1px solid #457;
border-top-left-radius: 5px; border-top-right-radius: 5px;
}
#search a.inactive { color: #999; fill: #999; }
.inheritanceTree, .toggleDefines {
float: right;
border-left: 1px solid #aaa;
position: absolute; top: 0; right: 0;
height: 100%;
background: #f6f6f6;
padding: 5px;
min-width: 55px;
text-align: center;
}
#menu { font-size: 1.3em; color: #bbb; }
#menu .title, #menu a { font-size: 0.7em; }
#menu .title a { font-size: 1em; }
#menu .title { color: #555; }
#menu a, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; }
#menu a:hover { color: #05a; }
#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; }
#footer a, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; }
#footer a:hover { color: #05a; }
#listing ul.alpha { font-size: 1.1em; }
#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; }
#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; }
#listing ul.alpha ul { margin: 0; padding-left: 15px; }
#listing ul small { color: #666; font-size: 0.7em; }
li.r1 { background: #f0f0f0; }
li.r2 { background: #fafafa; }
#content ul.summary li.deprecated .summary_signature a,
#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; }
#toc {
position: relative;
float: right;
overflow-x: auto;
right: -3px;
margin-left: 20px;
margin-bottom: 20px;
padding: 20px; padding-right: 30px;
max-width: 300px;
z-index: 5000;
background: #fefefe;
border: 1px solid #ddd;
box-shadow: -2px 2px 6px #bbb;
}
#toc .title { margin: 0; }
#toc ol { padding-left: 1.8em; }
#toc li { font-size: 1.1em; line-height: 1.7em; }
#toc > ol > li { font-size: 1.1em; font-weight: bold; }
#toc ol > li > ol { font-size: 0.9em; }
#toc ol ol > li > ol { padding-left: 2.3em; }
#toc ol + li { margin-top: 0.3em; }
#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; }
#toc.hidden:hover { background: #fafafa; }
#filecontents h1 + #toc.nofloat { margin-top: 0; }
@media (max-width: 560px) {
#toc {
margin-left: 0;
margin-top: 16px;
float: none;
max-width: none;
}
}
/* syntax highlighting */
.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; }
#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
#filecontents pre.code, .docstring pre.code { display: block; }
.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
#filecontents pre.code, .docstring pre.code,
.tags pre.example {
padding: 9px 14px;
margin-top: 4px;
border: 1px solid #e1e1e8;
background: #f7f7f9;
border-radius: 4px;
font-size: 1em;
overflow-x: auto;
line-height: 1.2em;
}
pre.code { color: #000; tab-size: 2; }
pre.code .info.file { color: #555; }
pre.code .val { color: #036A07; }
pre.code .tstring_content,
pre.code .heredoc_beg, pre.code .heredoc_end,
pre.code .qwords_beg, pre.code .qwords_end, pre.code .qwords_sep,
pre.code .words_beg, pre.code .words_end, pre.code .words_sep,
pre.code .qsymbols_beg, pre.code .qsymbols_end, pre.code .qsymbols_sep,
pre.code .symbols_beg, pre.code .symbols_end, pre.code .symbols_sep,
pre.code .tstring, pre.code .dstring { color: #036A07; }
pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s,
pre.code .rubyid_to_sym, pre.code .rubyid_to_f,
pre.code .dot + pre.code .id,
pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; }
pre.code .comment { color: #0066FF; }
pre.code .const, pre.code .constant { color: #585CF6; }
pre.code .label,
pre.code .symbol { color: #C5060B; }
pre.code .kw,
pre.code .rubyid_require,
pre.code .rubyid_extend,
pre.code .rubyid_include { color: #0000FF; }
pre.code .ivar { color: #318495; }
pre.code .gvar,
pre.code .rubyid_backref,
pre.code .rubyid_nth_ref { color: #6D79DE; }
pre.code .regexp, .dregexp { color: #036A07; }
pre.code a { border-bottom: 1px dotted #bbf; }
/* inline code */
*:not(pre) > code {
padding: 1px 3px 1px 3px;
border: 1px solid #E1E1E8;
background: #F7F7F9;
border-radius: 4px;
}
/* Color fix for links */
#content .summary_desc pre.code .id > .object_link a, /* identifier */
#content .docstring pre.code .id > .object_link a { color: #0085FF; }
#content .summary_desc pre.code .const > .object_link a, /* constant */
#content .docstring pre.code .const > .object_link a { color: #585CF6; }

51
app/models/validations/doc/file_list.html

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
<title>File List</title>
<base id="base_target" target="_parent" />
</head>
<body>
<div id="content">
<div class="fixed_header">
<h1 id="full_list_header">File List</h1>
<div id="full_list_nav">
<span><a target="_self" href="class_list.html">
Classes
</a></span>
<span><a target="_self" href="method_list.html">
Methods
</a></span>
<span><a target="_self" href="file_list.html">
Files
</a></span>
</div>
<div id="search">Search: <input type="text" /></div>
</div>
<ul id="full_list" class="file">
</ul>
</div>
</body>
</html>

22
app/models/validations/doc/frames.html

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Documentation by YARD 0.9.36</title>
</head>
<script type="text/javascript">
var mainUrl = 'index.html';
try {
var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);
var name = match ? match[1] : mainUrl;
var url = new URL(name, location.href);
window.top.location.replace(url.origin === location.origin ? name : mainUrl);
} catch (e) {
window.top.location.replace(mainUrl);
}
</script>
<noscript>
<h1>Oops!</h1>
<h2>YARD requires JavaScript!</h2>
</noscript>
</html>

246
app/models/validations/doc/index.html

@ -0,0 +1,246 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = null;
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.36</h1>
<div id="listing">
<h1 class="alphaindex">Alphabetic Index</h1>
<div class="clear"></div>
<h2>Namespace Listing A-Z</h2>
<table>
<tr>
<td valign='top' width="33%">
<ul id="alpha_D" class="alpha">
<li class="letter">D</li>
<ul>
<li>
<span class='object_link'><a href="Validations/DateValidations.html" title="Validations::DateValidations (module)">DateValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_F" class="alpha">
<li class="letter">F</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/FinancialValidations.html" title="Validations::Sales::FinancialValidations (module)">FinancialValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/FinancialValidations.html" title="Validations::FinancialValidations (module)">FinancialValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_H" class="alpha">
<li class="letter">H</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/HouseholdValidations.html" title="Validations::Sales::HouseholdValidations (module)">HouseholdValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/HouseholdValidations.html" title="Validations::HouseholdValidations (module)">HouseholdValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_L" class="alpha">
<li class="letter">L</li>
<ul>
<li>
<span class='object_link'><a href="Validations/LocalAuthorityValidations.html" title="Validations::LocalAuthorityValidations (module)">LocalAuthorityValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_P" class="alpha">
<li class="letter">P</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/PropertyValidations.html" title="Validations::Sales::PropertyValidations (module)">PropertyValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/PropertyValidations.html" title="Validations::PropertyValidations (module)">PropertyValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_S" class="alpha">
<li class="letter">S</li>
<ul>
<li>
<span class='object_link'><a href="Validations/Sales/SaleInformationValidations.html" title="Validations::Sales::SaleInformationValidations (module)">SaleInformationValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/Sales/SetupValidations.html" title="Validations::Sales::SetupValidations (module)">SetupValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SetupValidations.html" title="Validations::SetupValidations (module)">SetupValidations</a></span>
<small>(Validations)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SharedValidations.html" title="Validations::SharedValidations (module)">SharedValidations</a></span>
<small>(Validations)</small>
</li>
<li>
<span class='object_link'><a href="Validations/Sales/SoftValidations.html" title="Validations::Sales::SoftValidations (module)">SoftValidations</a></span>
<small>(Validations::Sales)</small>
</li>
<li>
<span class='object_link'><a href="Validations/SoftValidations.html" title="Validations::SoftValidations (module)">SoftValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
<ul id="alpha_T" class="alpha">
<li class="letter">T</li>
<ul>
<li>
<span class='object_link'><a href="Validations/TenancyValidations.html" title="Validations::TenancyValidations (module)">TenancyValidations</a></span>
<small>(Validations)</small>
</li>
</ul>
</ul>
</td>
</tr>
</table>
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>

314
app/models/validations/doc/js/app.js

@ -0,0 +1,314 @@
(function() {
var localStorage = {}, sessionStorage = {};
try { localStorage = window.localStorage; } catch (e) { }
try { sessionStorage = window.sessionStorage; } catch (e) { }
function createSourceLinks() {
$('.method_details_list .source_code').
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
$('.toggleSource').toggle(function() {
$(this).parent().nextAll('.source_code').slideDown(100);
$(this).text("Hide source");
},
function() {
$(this).parent().nextAll('.source_code').slideUp(100);
$(this).text("View source");
});
}
function createDefineLinks() {
var tHeight = 0;
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
$('.toggleDefines').toggle(function() {
tHeight = $(this).parent().prev().height();
$(this).prev().css('display', 'inline');
$(this).parent().prev().height($(this).parent().height());
$(this).text("(less)");
},
function() {
$(this).prev().hide();
$(this).parent().prev().height(tHeight);
$(this).text("more...");
});
}
function createFullTreeLinks() {
var tHeight = 0;
$('.inheritanceTree').toggle(function() {
tHeight = $(this).parent().prev().height();
$(this).parent().toggleClass('showAll');
$(this).text("(hide)");
$(this).parent().prev().height($(this).parent().height());
},
function() {
$(this).parent().toggleClass('showAll');
$(this).parent().prev().height(tHeight);
$(this).text("show all");
});
}
function searchFrameButtons() {
$('.full_list_link').click(function() {
toggleSearchFrame(this, $(this).attr('href'));
return false;
});
window.addEventListener('message', function(e) {
if (e.data === 'navEscape') {
$('#nav').slideUp(100);
$('#search a').removeClass('active inactive');
$(window).focus();
}
});
$(window).resize(function() {
if ($('#search:visible').length === 0) {
$('#nav').removeAttr('style');
$('#search a').removeClass('active inactive');
$(window).focus();
}
});
}
function toggleSearchFrame(id, link) {
var frame = $('#nav');
$('#search a').removeClass('active').addClass('inactive');
if (frame.attr('src') === link && frame.css('display') !== "none") {
frame.slideUp(100);
$('#search a').removeClass('active inactive');
}
else {
$(id).addClass('active').removeClass('inactive');
if (frame.attr('src') !== link) frame.attr('src', link);
frame.slideDown(100);
}
}
function linkSummaries() {
$('.summary_signature').click(function() {
document.location = $(this).find('a').attr('href');
});
}
function summaryToggle() {
$('.summary_toggle').click(function(e) {
e.preventDefault();
localStorage.summaryCollapsed = $(this).text();
$('.summary_toggle').each(function() {
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
var next = $(this).parent().parent().nextAll('ul.summary').first();
if (next.hasClass('compact')) {
next.toggle();
next.nextAll('ul.summary').first().toggle();
}
else if (next.hasClass('summary')) {
var list = $('<ul class="summary compact" />');
list.html(next.html());
list.find('.summary_desc, .note').remove();
list.find('a').each(function() {
$(this).html($(this).find('strong').html());
$(this).parent().html($(this)[0].outerHTML);
});
next.before(list);
next.toggle();
}
});
return false;
});
if (localStorage.summaryCollapsed == "collapse") {
$('.summary_toggle').first().click();
} else { localStorage.summaryCollapsed = "expand"; }
}
function constantSummaryToggle() {
$('.constants_summary_toggle').click(function(e) {
e.preventDefault();
localStorage.summaryCollapsed = $(this).text();
$('.constants_summary_toggle').each(function() {
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
var next = $(this).parent().parent().nextAll('dl.constants').first();
if (next.hasClass('compact')) {
next.toggle();
next.nextAll('dl.constants').first().toggle();
}
else if (next.hasClass('constants')) {
var list = $('<dl class="constants compact" />');
list.html(next.html());
list.find('dt').each(function() {
$(this).addClass('summary_signature');
$(this).text( $(this).text().split('=')[0]);
if ($(this).has(".deprecated").length) {
$(this).addClass('deprecated');
};
});
// Add the value of the constant as "Tooltip" to the summary object
list.find('pre.code').each(function() {
console.log($(this).parent());
var dt_element = $(this).parent().prev();
var tooltip = $(this).text();
if (dt_element.hasClass("deprecated")) {
tooltip = 'Deprecated. ' + tooltip;
};
dt_element.attr('title', tooltip);
});
list.find('.docstring, .tags, dd').remove();
next.before(list);
next.toggle();
}
});
return false;
});
if (localStorage.summaryCollapsed == "collapse") {
$('.constants_summary_toggle').first().click();
} else { localStorage.summaryCollapsed = "expand"; }
}
function generateTOC() {
if ($('#filecontents').length === 0) return;
var _toc = $('<ol class="top"></ol>');
var show = false;
var toc = _toc;
var counter = 0;
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
var i;
var curli;
if ($('#filecontents h1').length > 1) tags.unshift('h1');
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
var lastTag = parseInt(tags[0][1], 10);
$(tags.join(', ')).each(function() {
if ($(this).parents('.method_details .docstring').length != 0) return;
if (this.id == "filecontents") return;
show = true;
var thisTag = parseInt(this.tagName[1], 10);
if (this.id.length === 0) {
var proposedId = $(this).attr('toc-id');
if (typeof(proposedId) != "undefined") this.id = proposedId;
else {
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
this.id = proposedId;
}
}
if (thisTag > lastTag) {
for (i = 0; i < thisTag - lastTag; i++) {
if ( typeof(curli) == "undefined" ) {
curli = $('<li/>');
toc.append(curli);
}
toc = $('<ol/>');
curli.append(toc);
curli = undefined;
}
}
if (thisTag < lastTag) {
for (i = 0; i < lastTag - thisTag; i++) {
toc = toc.parent();
toc = toc.parent();
}
}
var title = $(this).attr('toc-title');
if (typeof(title) == "undefined") title = $(this).text();
curli =$('<li><a href="#' + this.id + '">' + title + '</a></li>');
toc.append(curli);
lastTag = thisTag;
});
if (!show) return;
html = '<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>';
$('#content').prepend(html);
$('#toc').append(_toc);
$('#toc .hide_toc').toggle(function() {
$('#toc .top').slideUp('fast');
$('#toc').toggleClass('hidden');
$('#toc .title small').toggle();
}, function() {
$('#toc .top').slideDown('fast');
$('#toc').toggleClass('hidden');
$('#toc .title small').toggle();
});
}
function navResizeFn(e) {
if (e.which !== 1) {
navResizeFnStop();
return;
}
sessionStorage.navWidth = e.pageX.toString();
$('.nav_wrap').css('width', e.pageX);
$('.nav_wrap').css('-ms-flex', 'inherit');
}
function navResizeFnStop() {
$(window).unbind('mousemove', navResizeFn);
window.removeEventListener('message', navMessageFn, false);
}
function navMessageFn(e) {
if (e.data.action === 'mousemove') navResizeFn(e.data.event);
if (e.data.action === 'mouseup') navResizeFnStop();
}
function navResizer() {
$('#resizer').mousedown(function(e) {
e.preventDefault();
$(window).mousemove(navResizeFn);
window.addEventListener('message', navMessageFn, false);
});
$(window).mouseup(navResizeFnStop);
if (sessionStorage.navWidth) {
navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)});
}
}
function navExpander() {
var done = false, timer = setTimeout(postMessage, 500);
function postMessage() {
if (done) return;
clearTimeout(timer);
var opts = { action: 'expand', path: pathId };
document.getElementById('nav').contentWindow.postMessage(opts, '*');
done = true;
}
window.addEventListener('message', function(event) {
if (event.data === 'navReady') postMessage();
return false;
}, false);
}
function mainFocus() {
var hash = window.location.hash;
if (hash !== '' && $(hash)[0]) {
$(hash)[0].scrollIntoView();
}
setTimeout(function() { $('#main').focus(); }, 10);
}
function navigationChange() {
// This works around the broken anchor navigation with the YARD template.
window.onpopstate = function() {
var hash = window.location.hash;
if (hash !== '' && $(hash)[0]) {
$(hash)[0].scrollIntoView();
}
};
}
$(document).ready(function() {
navResizer();
navExpander();
createSourceLinks();
createDefineLinks();
createFullTreeLinks();
searchFrameButtons();
linkSummaries();
summaryToggle();
constantSummaryToggle();
generateTOC();
mainFocus();
navigationChange();
});
})();

216
app/models/validations/doc/js/full_list.js

@ -0,0 +1,216 @@
(function() {
var $clicked = $(null);
var searchTimeout = null;
var searchCache = [];
var caseSensitiveMatch = false;
var ignoreKeyCodeMin = 8;
var ignoreKeyCodeMax = 46;
var commandKey = 91;
RegExp.escape = function(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
function escapeShortcut() {
$(document).keydown(function(evt) {
if (evt.which == 27) {
window.parent.postMessage('navEscape', '*');
}
});
}
function navResizer() {
$(window).mousemove(function(e) {
window.parent.postMessage({
action: 'mousemove', event: {pageX: e.pageX, which: e.which}
}, '*');
}).mouseup(function(e) {
window.parent.postMessage({action: 'mouseup'}, '*');
});
window.parent.postMessage("navReady", "*");
}
function clearSearchTimeout() {
clearTimeout(searchTimeout);
searchTimeout = null;
}
function enableLinks() {
// load the target page in the parent window
$('#full_list li').on('click', function(evt) {
$('#full_list li').removeClass('clicked');
$clicked = $(this);
$clicked.addClass('clicked');
evt.stopPropagation();
if (evt.target.tagName === 'A') return true;
var elem = $clicked.find('> .item .object_link a')[0];
var e = evt.originalEvent;
var newEvent = new MouseEvent(evt.originalEvent.type);
newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
elem.dispatchEvent(newEvent);
evt.preventDefault();
return false;
});
}
function enableToggles() {
// show/hide nested classes on toggle click
$('#full_list a.toggle').on('click', function(evt) {
evt.stopPropagation();
evt.preventDefault();
$(this).parent().parent().toggleClass('collapsed');
highlight();
});
}
function populateSearchCache() {
$('#full_list li .item').each(function() {
var $node = $(this);
var $link = $node.find('.object_link a');
if ($link.length > 0) {
searchCache.push({
node: $node,
link: $link,
name: $link.text(),
fullName: $link.attr('title').split(' ')[0]
});
}
});
}
function enableSearch() {
$('#search input').keyup(function(event) {
if (ignoredKeyPress(event)) return;
if (this.value === "") {
clearSearch();
} else {
performSearch(this.value);
}
});
$('#full_list').after("<div id='noresults' style='display:none'></div>");
}
function ignoredKeyPress(event) {
if (
(event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
(event.keyCode == commandKey)
) {
return true;
} else {
return false;
}
}
function clearSearch() {
clearSearchTimeout();
$('#full_list .found').removeClass('found').each(function() {
var $link = $(this).find('.object_link a');
$link.text($link.text());
});
$('#full_list, #content').removeClass('insearch');
$clicked.parents().removeClass('collapsed');
highlight();
}
function performSearch(searchString) {
clearSearchTimeout();
$('#full_list, #content').addClass('insearch');
$('#noresults').text('').hide();
partialSearch(searchString, 0);
}
function partialSearch(searchString, offset) {
var lastRowClass = '';
var i = null;
for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
var item = searchCache[i];
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
var matchString = buildMatchString(searchString);
var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
if (searchName.match(matchRegexp) == null) {
item.node.removeClass('found');
item.link.text(item.link.text());
}
else {
item.node.addClass('found');
item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
}
}
if(i == searchCache.length) {
searchDone();
} else {
searchTimeout = setTimeout(function() {
partialSearch(searchString, i);
}, 0);
}
}
function searchDone() {
searchTimeout = null;
highlight();
if ($('#full_list li:visible').size() === 0) {
$('#noresults').text('No results were found.').hide().fadeIn();
} else {
$('#noresults').text('').hide();
}
$('#content').removeClass('insearch');
}
function buildMatchString(searchString, event) {
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
var regexSearchString = RegExp.escape(searchString);
if (caseSensitiveMatch) {
regexSearchString += "|" +
$.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
join('.+?');
}
return regexSearchString;
}
function highlight() {
$('#full_list li:visible').each(function(n) {
$(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
});
}
/**
* Expands the tree to the target element and its immediate
* children.
*/
function expandTo(path) {
var $target = $(document.getElementById('object_' + path));
$target.addClass('clicked');
$target.removeClass('collapsed');
$target.parentsUntil('#full_list', 'li').removeClass('collapsed');
if($target[0]) {
window.scrollTo(window.scrollX, $target.offset().top - 250);
highlight();
}
}
function windowEvents(event) {
var msg = event.data;
if (msg.action === "expand") {
expandTo(msg.path);
}
return false;
}
window.addEventListener("message", windowEvents, false);
$(document).ready(function() {
escapeShortcut();
navResizer();
enableLinks();
enableToggles();
populateSearchCache();
enableSearch();
});
})();

4
app/models/validations/doc/js/jquery.js vendored

File diff suppressed because one or more lines are too long

1179
app/models/validations/doc/method_list.html

File diff suppressed because it is too large Load Diff

100
app/models/validations/doc/top-level-namespace.html

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Top Level Namespace
&mdash; Documentation by YARD 0.9.36
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> &raquo;
<span class="title">Top Level Namespace</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Top Level Namespace
</h1>
<div class="box_info">
</div>
</div>
<div id="footer">
Generated on Thu Apr 18 11:36:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.36 (ruby-3.1.4).
</div>
</div>
</body>
</html>
Loading…
Cancel
Save