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.
1445 lines
114 KiB
1445 lines
114 KiB
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="utf-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title> |
|
Module: Validations::Sales::SaleInformationValidations |
|
|
|
— 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::SaleInformationValidations"; |
|
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> » |
|
<span class='title'>Validations</span> » <span class='title'>Sales</span> |
|
» |
|
<span class="title">SaleInformationValidations</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::SaleInformationValidations |
|
|
|
|
|
|
|
</h1> |
|
<div class="box_info"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
<dl> |
|
<dt>Includes:</dt> |
|
<dd>CollectionTimeHelper, MoneyFormattingHelper, Validations::SharedValidations</dd> |
|
</dl> |
|
|
|
|
|
|
|
|
|
<dl> |
|
<dt>Included in:</dt> |
|
<dd><span class='object_link'><a href="SoftValidations.html" title="Validations::Sales::SoftValidations (module)">SoftValidations</a></span></dd> |
|
</dl> |
|
|
|
|
|
|
|
<dl> |
|
<dt>Defined in:</dt> |
|
<dd>sales/sale_information_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="#check_non_staircasing_non_socialhomebuy_mortgage-instance_method" title="#check_non_staircasing_non_socialhomebuy_mortgage (instance method)">#<strong>check_non_staircasing_non_socialhomebuy_mortgage</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#check_non_staircasing_socialhomebuy_mortgage-instance_method" title="#check_non_staircasing_socialhomebuy_mortgage (instance method)">#<strong>check_non_staircasing_socialhomebuy_mortgage</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#check_staircasing_non_socialhomebuy_mortgage-instance_method" title="#check_staircasing_non_socialhomebuy_mortgage (instance method)">#<strong>check_staircasing_non_socialhomebuy_mortgage</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#check_staircasing_socialhomebuy_mortgage-instance_method" title="#check_staircasing_socialhomebuy_mortgage (instance method)">#<strong>check_staircasing_socialhomebuy_mortgage</strong>(record) ⇒ Object </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#over_tolerance%3F-instance_method" title="#over_tolerance? (instance method)">#<strong>over_tolerance?</strong>(expected, actual, tolerance) ⇒ Boolean </a> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span> |
|
|
|
</li> |
|
|
|
|
|
<li class="public "> |
|
<span class="summary_signature"> |
|
|
|
<a href="#validate_basic_monthly_rent-instance_method" title="#validate_basic_monthly_rent (instance method)">#<strong>validate_basic_monthly_rent</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_discount_and_value-instance_method" title="#validate_discount_and_value (instance method)">#<strong>validate_discount_and_value</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_discounted_ownership_value-instance_method" title="#validate_discounted_ownership_value (instance method)">#<strong>validate_discounted_ownership_value</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_exchange_date-instance_method" title="#validate_exchange_date (instance method)">#<strong>validate_exchange_date</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_grant_amount-instance_method" title="#validate_grant_amount (instance method)">#<strong>validate_grant_amount</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_mortgage_used_and_stairbought-instance_method" title="#validate_mortgage_used_and_stairbought (instance method)">#<strong>validate_mortgage_used_and_stairbought</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_mortgage_used_dont_know-instance_method" title="#validate_mortgage_used_dont_know (instance method)">#<strong>validate_mortgage_used_dont_know</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_non_staircasing_mortgage-instance_method" title="#validate_non_staircasing_mortgage (instance method)">#<strong>validate_non_staircasing_mortgage</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_outright_sale_value_matches_mortgage_plus_deposit-instance_method" title="#validate_outright_sale_value_matches_mortgage_plus_deposit (instance method)">#<strong>validate_outright_sale_value_matches_mortgage_plus_deposit</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_practical_completion_date-instance_method" title="#validate_practical_completion_date (instance method)">#<strong>validate_practical_completion_date</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_previous_property_unit_type-instance_method" title="#validate_previous_property_unit_type (instance method)">#<strong>validate_previous_property_unit_type</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_stairbought-instance_method" title="#validate_stairbought (instance method)">#<strong>validate_stairbought</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_staircasing_mortgage-instance_method" title="#validate_staircasing_mortgage (instance method)">#<strong>validate_staircasing_mortgage</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="check_non_staircasing_non_socialhomebuy_mortgage-instance_method"> |
|
|
|
#<strong>check_non_staircasing_non_socialhomebuy_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 178</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_check_non_staircasing_non_socialhomebuy_mortgage'>check_non_staircasing_non_socialhomebuy_mortgage</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_mortgage_used?'>mortgage_used?</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_mortgage'>mortgage</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_and_deposit_total'>mortgage_and_deposit_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_expected_shared_ownership_deposit_value'>expected_shared_ownership_deposit_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>equity</span><span class='tstring_end'>]</span></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_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='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.sale_information.non_staircasing_mortgage.mortgage_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.non_staircasing_mortgage.mortgage_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_not_used?'>mortgage_not_used?</span> |
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit'>deposit</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_expected_shared_ownership_deposit_value'>expected_shared_ownership_deposit_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>equity</span><span class='tstring_end'>]</span></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_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='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.sale_information.non_staircasing_mortgage.mortgage_not_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.non_staircasing_mortgage.mortgage_not_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></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="check_non_staircasing_socialhomebuy_mortgage-instance_method"> |
|
|
|
#<strong>check_non_staircasing_socialhomebuy_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 156</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_check_non_staircasing_socialhomebuy_mortgage'>check_non_staircasing_socialhomebuy_mortgage</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_cashdis'>cashdis</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='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_mortgage'>mortgage</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_deposit_and_discount_total'>mortgage_deposit_and_discount_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_expected_shared_ownership_deposit_value'>expected_shared_ownership_deposit_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>cashdis</span><span class='words_sep'> </span><span class='tstring_content'>equity</span><span class='tstring_end'>]</span></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_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='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.sale_information.non_staircasing_mortgage.mortgage_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.non_staircasing_mortgage.mortgage_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_not_used?'>mortgage_not_used?</span> |
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit_and_discount_total'>deposit_and_discount_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_expected_shared_ownership_deposit_value'>expected_shared_ownership_deposit_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>cashdis</span><span class='words_sep'> </span><span class='tstring_content'>equity</span><span class='tstring_end'>]</span></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_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='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.sale_information.non_staircasing_mortgage.mortgage_not_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.non_staircasing_mortgage.mortgage_not_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>expected_shared_ownership_deposit_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>expected_shared_ownership_deposit_value</span><span class='tstring_end'>"</span></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="check_staircasing_non_socialhomebuy_mortgage-instance_method"> |
|
|
|
#<strong>check_staircasing_non_socialhomebuy_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 218</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_check_staircasing_non_socialhomebuy_mortgage'>check_staircasing_non_socialhomebuy_mortgage</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_mortgage_used?'>mortgage_used?</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_mortgage'>mortgage</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_and_deposit_total'>mortgage_and_deposit_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought_part_of_value'>stairbought_part_of_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>stairbought</span><span class='words_sep'> </span><span class='tstring_content'>type</span><span class='tstring_end'>]</span></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_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='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.sale_information.staircasing_mortgage.mortgage_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.staircasing_mortgage.mortgage_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit'>deposit</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought_part_of_value'>stairbought_part_of_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>stairbought</span><span class='words_sep'> </span><span class='tstring_content'>type</span><span class='tstring_end'>]</span></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_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='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.sale_information.staircasing_mortgage.mortgage_not_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.staircasing_mortgage.mortgage_not_used</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></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="check_staircasing_socialhomebuy_mortgage-instance_method"> |
|
|
|
#<strong>check_staircasing_socialhomebuy_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 198</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_check_staircasing_socialhomebuy_mortgage'>check_staircasing_socialhomebuy_mortgage</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_cashdis'>cashdis</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='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_mortgage'>mortgage</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_deposit_and_discount_total'>mortgage_deposit_and_discount_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought_part_of_value'>stairbought_part_of_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>cashdis</span><span class='words_sep'> </span><span class='tstring_content'>stairbought</span><span class='tstring_end'>]</span></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_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='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.sale_information.staircasing_mortgage.mortgage_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.staircasing_mortgage.mortgage_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</span> |
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit_and_discount_total'>deposit_and_discount_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_stairbought_part_of_value'>stairbought_part_of_value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>cashdis</span><span class='words_sep'> </span><span class='tstring_content'>stairbought</span><span class='tstring_end'>]</span></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_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='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.sale_information.staircasing_mortgage.mortgage_not_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.staircasing_mortgage.mortgage_not_used_socialhomebuy</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>deposit_and_discount_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>deposit_and_discount_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>stairbought_part_of_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stairbought_part_of_value</span><span class='tstring_end'>"</span></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="over_tolerance?-instance_method"> |
|
|
|
#<strong>over_tolerance?</strong>(expected, actual, tolerance) ⇒ <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"> |
|
|
|
|
|
250 |
|
251 |
|
252</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 250</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_expected'>expected</span><span class='comma'>,</span> <span class='id identifier rubyid_actual'>actual</span><span class='comma'>,</span> <span class='id identifier rubyid_tolerance'>tolerance</span><span class='rparen'>)</span> |
|
<span class='lparen'>(</span><span class='id identifier rubyid_expected'>expected</span> <span class='op'>-</span> <span class='id identifier rubyid_actual'>actual</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span> <span class='op'>>=</span> <span class='id identifier rubyid_tolerance'>tolerance</span> |
|
<span class='kw'>end</span></pre> |
|
</td> |
|
</tr> |
|
</table> |
|
</div> |
|
|
|
<div class="method_details "> |
|
<h3 class="signature " id="validate_basic_monthly_rent-instance_method"> |
|
|
|
#<strong>validate_basic_monthly_rent</strong>(record) ⇒ <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 'sales/sale_information_validations.rb', line 71</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_basic_monthly_rent'>validate_basic_monthly_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_mrent'>mrent</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ownershipsch'>ownershipsch</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> |
|
|
|
<span class='kw'>if</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='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_old_persons_shared_ownership?'>old_persons_shared_ownership?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mrent'>mrent</span> <span class='op'>></span> <span class='int'>9999</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'>:mrent</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.sale_information.monthly_rent.higher_than_expected</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.monthly_rent.higher_than_expected</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_discount_and_value-instance_method"> |
|
|
|
#<strong>validate_discount_and_value</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 108</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_discount_and_value'>validate_discount_and_value</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_discount'>discount</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</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_la'>la</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'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_discount_value'>discount_value</span> <span class='op'>></span> <span class='int'>136_400</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>discount</span><span class='words_sep'> </span><span class='tstring_content'>value</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='words_sep'> </span><span class='tstring_content'>uprn</span><span class='tstring_end'>]</span></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_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='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.sale_information.value.over_discounted_london_max</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>discount_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>discount_value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_discount_value'>discount_value</span> <span class='op'>></span> <span class='int'>102_400</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>discount</span><span class='words_sep'> </span><span class='tstring_content'>value</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='words_sep'> </span><span class='tstring_content'>uprn</span><span class='tstring_end'>]</span></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_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='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.sale_information.value.over_discounted_max</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>discount_value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>discount_value</span><span class='tstring_end'>"</span></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_discounted_ownership_value-instance_method"> |
|
|
|
#<strong>validate_discounted_ownership_value</strong>(record) ⇒ <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</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 44</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_discounted_ownership_value'>validate_discounted_ownership_value</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_value'>value</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit'>deposit</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_ownershipsch'>ownershipsch</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_mortgage'>mortgage</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</span> <span class='op'>==</span> <span class='int'>2</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</span> <span class='op'>==</span> <span class='int'>3</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_discount'>discount</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_grant'>grant</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='int'>29</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_deposit_and_grant_total'>mortgage_deposit_and_grant_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_value_with_discount'>value_with_discount</span><span class='comma'>,</span> <span class='int'>1</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_discounted_ownership_sale?'>discounted_ownership_sale?</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='words_sep'> </span><span class='tstring_content'>ownershipsch</span><span class='words_sep'> </span><span class='tstring_content'>discount</span><span class='words_sep'> </span><span class='tstring_content'>grant</span><span class='tstring_end'>]</span></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_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='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.sale_information.discounted_ownership_value</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_deposit_and_grant_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_deposit_and_grant_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>value_with_discount:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>value_with_discount</span><span class='tstring_end'>"</span></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_exchange_date-instance_method"> |
|
|
|
#<strong>validate_exchange_date</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 21</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_exchange_date'>validate_exchange_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_exdate'>exdate</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_saledate'>saledate</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_exdate'>exdate</span> <span class='op'>></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'>:exdate</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.sale_information.exdate.must_be_before_saledate</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.saledate.must_be_after_exdate</span><span class='tstring_end'>"</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_saledate'>saledate</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_exdate'>exdate</span> <span class='op'>>=</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</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'>:exdate</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.sale_information.exdate.must_be_less_than_1_year_from_saledate</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.saledate.must_be_less_than_1_year_from_exdate</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_grant_amount-instance_method"> |
|
|
|
#<strong>validate_grant_amount</strong>(record) ⇒ <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/sale_information_validations.rb', line 80</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_grant_amount'>validate_grant_amount</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_grant'>grant</span> <span class='op'>&&</span> <span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='int'>8</span> <span class='op'>||</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='int'>21</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_grant'>grant</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span><span class='int'>9_000</span><span class='comma'>,</span> <span class='int'>16_000</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'>:grant</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.sale_information.grant.out_of_range</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_mortgage_used_and_stairbought-instance_method"> |
|
|
|
#<strong>validate_mortgage_used_and_stairbought</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 147</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_mortgage_used_and_stairbought'>validate_mortgage_used_and_stairbought</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_stairowned'>stairowned</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</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_stairowned_100?'>stairowned_100?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</span> <span class='op'>==</span> <span class='int'>3</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'>"</span><span class='tstring_content'>validations.sale_information.stairowned.mortgageused_dont_know</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'>:mortgageused</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.sale_information.stairowned.mortgageused_dont_know</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_mortgage_used_dont_know-instance_method"> |
|
|
|
#<strong>validate_mortgage_used_dont_know</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 236</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_mortgage_used_dont_know'>validate_mortgage_used_dont_know</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_mortgageused'>mortgageused</span> <span class='op'>==</span> <span class='int'>3</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='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'>:mortgageused</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.invalid_option</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>question:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Was a mortgage used for the purchase of this property?</span><span class='tstring_end'>"</span></span><span class='rparen'>)</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_outright_sale?'>outright_sale?</span> <span class='op'>&&</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='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'>:mortgageused</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.invalid_option</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>question:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Was a mortgage used for the purchase of this property?</span><span class='tstring_end'>"</span></span><span class='rparen'>)</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_shared_ownership_scheme?'>shared_ownership_scheme?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_staircase'>staircase</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_staircase'>staircase</span> <span class='op'>!=</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='lparen'>(</span><span class='symbol'>:mortgageused</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.invalid_option</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>question:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Was a mortgage used for the purchase of this property?</span><span class='tstring_end'>"</span></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_non_staircasing_mortgage-instance_method"> |
|
|
|
#<strong>validate_non_staircasing_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 123</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_non_staircasing_mortgage'>validate_non_staircasing_mortgage</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_value'>value</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit'>deposit</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_equity'>equity</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_shared_ownership_scheme?'>shared_ownership_scheme?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_not_staircasing?'>is_not_staircasing?</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_social_homebuy?'>social_homebuy?</span> |
|
<span class='id identifier rubyid_check_non_staircasing_socialhomebuy_mortgage'>check_non_staircasing_socialhomebuy_mortgage</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>else</span> |
|
<span class='id identifier rubyid_check_non_staircasing_non_socialhomebuy_mortgage'>check_non_staircasing_non_socialhomebuy_mortgage</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</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_outright_sale_value_matches_mortgage_plus_deposit-instance_method"> |
|
|
|
#<strong>validate_outright_sale_value_matches_mortgage_plus_deposit</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 57</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_outright_sale_value_matches_mortgage_plus_deposit'>validate_outright_sale_value_matches_mortgage_plus_deposit</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_outright_sale?'>outright_sale?</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_mortgage_used?'>mortgage_used?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage'>mortgage</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_deposit'>deposit</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_over_tolerance?'>over_tolerance?</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgage_and_deposit_total'>mortgage_and_deposit_total</span><span class='comma'>,</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span> |
|
<span class='qsymbols_beg'>%i[</span><span class='tstring_content'>mortgageused</span><span class='words_sep'> </span><span class='tstring_content'>mortgage</span><span class='words_sep'> </span><span class='tstring_content'>value</span><span class='words_sep'> </span><span class='tstring_content'>deposit</span><span class='tstring_end'>]</span></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_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='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.sale_information.outright_sale_value</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>value</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span> |
|
<span class='kw'>end</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='symbol'>:skip_bu_error</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'>"</span><span class='tstring_content'>validations.sale_information.outright_sale_value</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>mortgage_and_deposit_total:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>mortgage_and_deposit_total</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>value:</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_field_formatted_as_currency'>field_formatted_as_currency</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>value</span><span class='tstring_end'>"</span></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_practical_completion_date-instance_method"> |
|
|
|
#<strong>validate_practical_completion_date</strong>(record) ⇒ <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</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 6</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_practical_completion_date'>validate_practical_completion_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_hodate'>hodate</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>&&</span> <span class='id identifier rubyid_date_valid?'>date_valid?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hodate</span><span class='tstring_end'>"</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='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='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hodate'>hodate</span> <span class='op'>></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'>:hodate</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.sale_information.hodate.must_be_before_saledate</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.saledate.must_be_after_hodate</span><span class='tstring_end'>"</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_saledate'>saledate</span> <span class='op'>-</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_hodate'>hodate</span> <span class='op'>>=</span> <span class='int'>3</span><span class='period'>.</span><span class='id identifier rubyid_years'>years</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'>:hodate</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.sale_information.hodate.must_be_less_than_3_years_from_saledate</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.saledate.must_be_less_than_3_years_from_hodate</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_previous_property_unit_type-instance_method"> |
|
|
|
#<strong>validate_previous_property_unit_type</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 35</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_previous_property_unit_type'>validate_previous_property_unit_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_fromprop'>fromprop</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_frombeds'>frombeds</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_frombeds'>frombeds</span> <span class='op'>!=</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_fromprop'>fromprop</span> <span class='op'>==</span> <span class='int'>2</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'>:frombeds</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.sale_information.previous_property_type.property_type_bedsit</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'>:fromprop</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.sale_information.previous_property_type.property_type_bedsit</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_stairbought-instance_method"> |
|
|
|
#<strong>validate_stairbought</strong>(record) ⇒ <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 |
|
104 |
|
105 |
|
106</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 89</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_stairbought'>validate_stairbought</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'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</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_max_stairbought'>max_stairbought</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> |
|
<span class='kw'>when</span> <span class='int'>30</span><span class='comma'>,</span> <span class='int'>16</span><span class='comma'>,</span> <span class='int'>28</span><span class='comma'>,</span> <span class='int'>31</span><span class='comma'>,</span> <span class='int'>32</span> |
|
<span class='int'>90</span> |
|
<span class='kw'>when</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>18</span> |
|
<span class='int'>75</span> |
|
<span class='kw'>when</span> <span class='int'>24</span> |
|
<span class='int'>50</span> |
|
<span class='kw'>end</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_max_stairbought'>max_stairbought</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='op'>></span> <span class='id identifier rubyid_max_stairbought'>max_stairbought</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'>"</span><span class='tstring_content'>validations.sale_information.stairbought.over_max</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>max_stairbought:</span><span class='comma'>,</span> <span class='label'>type:</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'>"</span><span class='tstring_content'>type</span><span class='tstring_end'>"</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_answer_label'>answer_label</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</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'>: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'>"</span><span class='tstring_content'>validations.sale_information.stairbought.over_max</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>max_stairbought:</span><span class='comma'>,</span> <span class='label'>type:</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'>"</span><span class='tstring_content'>type</span><span class='tstring_end'>"</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_answer_label'>answer_label</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</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_staircasing_mortgage-instance_method"> |
|
|
|
#<strong>validate_staircasing_mortgage</strong>(record) ⇒ <tt>Object</tt> |
|
|
|
|
|
|
|
|
|
|
|
</h3><table class="source_code"> |
|
<tr> |
|
<td> |
|
<pre class="lines"> |
|
|
|
|
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145</pre> |
|
</td> |
|
<td> |
|
<pre class="code"><span class="info file"># File 'sales/sale_information_validations.rb', line 135</span> |
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_staircasing_mortgage'>validate_staircasing_mortgage</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_value'>value</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_deposit'>deposit</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='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_shared_ownership_scheme?'>shared_ownership_scheme?</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_mortgageused'>mortgageused</span> <span class='op'>&&</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_is_staircase?'>is_staircase?</span> |
|
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_social_homebuy?'>social_homebuy?</span> |
|
<span class='id identifier rubyid_check_staircasing_socialhomebuy_mortgage'>check_staircasing_socialhomebuy_mortgage</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> |
|
<span class='kw'>else</span> |
|
<span class='id identifier rubyid_check_staircasing_non_socialhomebuy_mortgage'>check_staircasing_non_socialhomebuy_mortgage</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</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> |