unepwcmc/SAPI — pull request #92 by agnessa (2013-10-21 13:25:54+00:00)
Title: Species name source code w country

Adds the following validations:

Source code = 'W' + Country of Origin
Source code = 'W' + Export country (when Country of origin blank)

in shell console:
rake db:migrate

in rails console:
```
Trade::InclusionValidationRule.create(
:scope => {
:source_code => 'W'
},
:column_names => ['species_name', 'country_of_origin'],
:valid_values_view => 'valid_species_name_country_of_origin_view',
:run_order => 4,
:is_primary => false
)
Trade::PovInclusionValidationRule.create(
:scope => {
:source_code => 'W', :country_of_origin_blank => true
},
:column_names => ['species_name', 'exporter'],
:valid_values_view => 'valid_species_name_exporter_view',
:run_order => 4,
:is_primary => false
)
```
Note: this adds a view for every trade sandbox, that combines the shipment attributes and the annual report upload attributes (importer / exporter, point of view) for easier access in validations.