|
|
|
@ -28,7 +28,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if FeatureToggle.merge_organisations_enabled? |
|
|
|
|
|
|
|
if log.owning_organisation_id.present? |
|
|
|
if log.owning_organisation_id.present? |
|
|
|
answer_opts[log.owning_organisation.id] = log.owning_organisation.name |
|
|
|
answer_opts[log.owning_organisation.id] = log.owning_organisation.name |
|
|
|
end |
|
|
|
end |
|
|
|
@ -59,12 +58,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
answer_opts |
|
|
|
answer_opts |
|
|
|
else |
|
|
|
|
|
|
|
Organisation.select(:id, :name).each_with_object(answer_opts) do |organisation, hsh| |
|
|
|
|
|
|
|
hsh[organisation.id] = organisation.name |
|
|
|
|
|
|
|
hsh |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def displayed_answer_options(log, user = nil) |
|
|
|
def displayed_answer_options(log, user = nil) |
|
|
|
@ -82,7 +75,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def hidden_in_check_answers?(_log, user = nil) |
|
|
|
def hidden_in_check_answers?(_log, user = nil) |
|
|
|
if FeatureToggle.merge_organisations_enabled? |
|
|
|
|
|
|
|
return false if user.support? |
|
|
|
return false if user.support? |
|
|
|
|
|
|
|
|
|
|
|
stock_owners = user.organisation.stock_owners + user.organisation.absorbed_organisations.where(holds_own_stock: true) |
|
|
|
stock_owners = user.organisation.stock_owners + user.organisation.absorbed_organisations.where(holds_own_stock: true) |
|
|
|
@ -92,9 +84,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question |
|
|
|
else |
|
|
|
else |
|
|
|
stock_owners.count <= 1 |
|
|
|
stock_owners.count <= 1 |
|
|
|
end |
|
|
|
end |
|
|
|
else |
|
|
|
|
|
|
|
!current_user.support? |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def enabled |
|
|
|
def enabled |
|
|
|
@ -104,11 +93,7 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question |
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def selected_answer_option_is_derived?(_log) |
|
|
|
def selected_answer_option_is_derived?(_log) |
|
|
|
if FeatureToggle.merge_organisations_enabled? |
|
|
|
|
|
|
|
true |
|
|
|
true |
|
|
|
else |
|
|
|
|
|
|
|
false |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def merged_organisation_label(name, merge_date) |
|
|
|
def merged_organisation_label(name, merge_date) |
|
|
|
|