Skip to content

Commit

Permalink
Salesforce - doi_estimate_year_one field. (Allow doi_estimate to be s…
Browse files Browse the repository at this point in the history
…et for any org type.)
  • Loading branch information
svogt0511 committed Mar 14, 2022
1 parent 4c2dfd3 commit 7df417e
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -840,24 +840,20 @@ def activity_id_not_changed
end

def doi_estimate_field
if member_type == "consortium_organization"
begin
num = Integer(doi_estimate)
if num < 0
errors.add(
:doi_estimate,
:doi_estimate_invalid,
value: "The doi_estimate must be a nonnegative integer.",
)
end
rescue
errors.add(
:doi_estimate,
:doi_estimate_invalid,
value: "The doi_estimate must be a nonnegative integer.",
)
end
num = Integer(doi_estimate)
if num < 0
errors.add(
:doi_estimate,
:doi_estimate_invalid,
value: "The doi_estimate must be a nonnegative integer.",
)
end
rescue
errors.add(
:doi_estimate,
:doi_estimate_invalid,
value: "The doi_estimate must be a nonnegative integer.",
)
end

# attributes to be sent to elasticsearch index
Expand Down Expand Up @@ -947,11 +943,7 @@ def set_defaults
self.billing_information = {} if billing_information.blank?
self.consortium_id = nil unless member_type == "consortium_organization"
self.non_profit_status = "non-profit" if non_profit_status.blank?
if member_type == "consortium_organization"
self.doi_estimate = doi_estimate.to_i
else
self.doi_estimate = 0
end
self.doi_estimate = doi_estimate.to_i

# custom filename for attachment as data URLs don't support filenames
if logo_content_type.present?
Expand Down

0 comments on commit 7df417e

Please sign in to comment.