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