|
|
|
@ -432,6 +432,7 @@ class BulkUpload::Lettings::Year2024::RowParser |
|
|
|
|
|
|
|
|
|
|
|
validate :validate_assigned_to_exists, on: :after_log |
|
|
|
validate :validate_assigned_to_exists, on: :after_log |
|
|
|
validate :validate_assigned_to_related, on: :after_log |
|
|
|
validate :validate_assigned_to_related, on: :after_log |
|
|
|
|
|
|
|
validate :validate_assigned_to_when_support, on: :after_log |
|
|
|
validate :validate_all_charges_given, on: :after_log, if: proc { is_carehome.zero? } |
|
|
|
validate :validate_all_charges_given, on: :after_log, if: proc { is_carehome.zero? } |
|
|
|
|
|
|
|
|
|
|
|
validate :validate_address_option_found, on: :after_log, unless: -> { supported_housing? } |
|
|
|
validate :validate_address_option_found, on: :after_log, unless: -> { supported_housing? } |
|
|
|
@ -580,6 +581,13 @@ private |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validate_assigned_to_when_support |
|
|
|
|
|
|
|
if field_3.blank? && bulk_upload.user.support? |
|
|
|
|
|
|
|
block_log_creation! |
|
|
|
|
|
|
|
errors.add(:field_3, :setup, message: "User was not provided") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def validate_assigned_to_related |
|
|
|
def validate_assigned_to_related |
|
|
|
return unless assigned_to |
|
|
|
return unless assigned_to |
|
|
|
return if assigned_to.organisation == owning_organisation || assigned_to.organisation == managing_organisation |
|
|
|
return if assigned_to.organisation == owning_organisation || assigned_to.organisation == managing_organisation |
|
|
|
@ -891,14 +899,15 @@ private |
|
|
|
def validate_owning_org_permitted |
|
|
|
def validate_owning_org_permitted |
|
|
|
return unless owning_organisation |
|
|
|
return unless owning_organisation |
|
|
|
|
|
|
|
|
|
|
|
if (bulk_upload.user.support? && !bulk_upload.organisation.affiliated_stock_owners.include?(bulk_upload.organisation)) || (!bulk_upload.user.support? && !bulk_upload.user.organisation.affiliated_stock_owners.include?(owning_organisation)) |
|
|
|
return if (bulk_upload.user.support? && bulk_upload.organisation.affiliated_stock_owners.include?(bulk_upload.organisation)) || |
|
|
|
|
|
|
|
(!bulk_upload.user.support? && bulk_upload.user.organisation.affiliated_stock_owners.include?(owning_organisation)) |
|
|
|
|
|
|
|
|
|
|
|
block_log_creation! |
|
|
|
block_log_creation! |
|
|
|
|
|
|
|
|
|
|
|
if errors[:field_1].blank? |
|
|
|
if errors[:field_1].blank? |
|
|
|
errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) |
|
|
|
errors.add(:field_1, "You do not have permission to add logs for this owning organisation", category: :setup) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validate_all_charges_given |
|
|
|
def validate_all_charges_given |
|
|
|
return if supported_housing? && field_125 == 1 |
|
|
|
return if supported_housing? && field_125 == 1 |
|
|
|
|