You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
702 lines
51 KiB
702 lines
51 KiB
9 months ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>
|
||
|
Module: Validations::Sales::HouseholdValidations
|
||
|
|
||
|
— 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> »
|
||
|
<span class='title'>Validations</span> » <span class='title'>Sales</span>
|
||
|
»
|
||
|
<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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ 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) ⇒ <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'>&&</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'>&&</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'>"</span><span class='tstring_content'>validations.household.prevten.invalid_for_discounted_sale</span><span class='tstring_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'>: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'>"</span><span class='tstring_content'>validations.household.prevten.invalid_for_discounted_sale</span><span class='tstring_end'>"</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) ⇒ <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'>&&</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'>"</span><span class='tstring_content'>ecstat1</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.buyer_cannot_be_child</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>buyer_index:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>ecstat2</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.buyer_cannot_be_child</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>buyer_index:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>2</span><span class='tstring_end'>"</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'>&&</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) ⇒ <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'>>=</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'>&&</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'>&&</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'>"</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent_setup</span><span class='tstring_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'>: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'>"</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent</span><span class='tstring_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'>: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'>"</span><span class='tstring_content'>validations.household.buylivein.buyers_will_live_in_property_values_inconsistent</span><span class='tstring_end'>"</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) ⇒ <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'>&&</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'>"</span><span class='tstring_content'>age1</span><span class='tstring_end'>"</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'>"</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'>"</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'>"</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'>"</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'>&&</span> <span class='id identifier rubyid_person_age'>person_age</span> <span class='op'>&&</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'>></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'>&&</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'>"</span><span class='tstring_content'>age1</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_12_years_younger</span><span class='tstring_end'>"</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) ⇒ <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) ⇒ <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'>&&</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'>"</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'>"</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'>"</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'>"</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'>"</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'>"</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'>&&</span> <span class='id identifier rubyid_economic_status'>economic_status</span> <span class='op'>&&</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'>&&</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'>&&</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.student_16_19.must_be_student</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.student_16_19.cannot_be_16_19.child_not_student</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.relat.student_16_19.cannot_be_child.16_19_not_student</span><span class='tstring_end'>"</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'>&&</span> <span class='id identifier rubyid_student'>student</span> <span class='op'>&&</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.student_16_19.must_be_16_19</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.student_16_19.cannot_be_student.child_not_16_19</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.relat.student_16_19.cannot_be_child.student_not_16_19</span><span class='tstring_end'>"</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) ⇒ <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'>"</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'>"</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'>"</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'>"</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'>&&</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'><</span> <span class='int'>16</span> <span class='op'>&&</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'>&&</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.child_under_16</span><span class='tstring_end'>"</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_under_16_ecstat</span><span class='tstring_end'>"</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'>&&</span> <span class='id identifier rubyid_age'>age</span> <span class='op'>></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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.ecstat.child_over_16</span><span class='tstring_end'>"</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_over_16</span><span class='tstring_end'>"</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) ⇒ <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'>&&</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'>"</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'>"</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'>"</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'>"</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'>&&</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'><</span> <span class='int'>16</span> <span class='op'>&&</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_under_16_relat_sales</span><span class='tstring_end'>"</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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.relat.child_under_16_sales</span><span class='tstring_end'>"</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'>>=</span> <span class='int'>20</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='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'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.age.child_over_20</span><span class='tstring_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='tstring'><span class='tstring_beg'>"</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'>"</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'>"</span><span class='tstring_content'>validations.household.relat.child_over_20</span><span class='tstring_end'>"</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>
|