fix location release CSV export
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
module CsvExportable
|
module CsvExportable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
COMMON_HEADERS = %i[approved? notes tags signed_at].freeze
|
COMMON_HEADERS = %i[notes tags signed_at].freeze
|
||||||
COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze
|
COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze
|
||||||
|
|
||||||
included do
|
included do
|
||||||
@@ -29,11 +29,12 @@ module CsvExportable
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def contact_info
|
def contact_info(name: nil, address: nil, phone: nil, email: nil)
|
||||||
contact_info = ''
|
contact_info = ''
|
||||||
contact_info += "#{person_address}; " if person_address.present?
|
contact_info += "#{name}; " if name.present?
|
||||||
contact_info += "P: #{person_phone}; " if person_phone.present?
|
contact_info += "#{address}; " if address.present?
|
||||||
contact_info += "E: #{person_email}" if person_email.present?
|
contact_info += "P: #{phone}; " if phone.present?
|
||||||
|
contact_info += "E: #{email}" if email.present?
|
||||||
contact_info.delete_suffix '; '
|
contact_info.delete_suffix '; '
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class LocationRelease < ApplicationRecord
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def custom_csv_exportable_headers
|
def custom_csv_exportable_headers
|
||||||
%i[name address]
|
%i[approved? location_info owner_info amendment_signed_column]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -67,6 +67,22 @@ class LocationRelease < ApplicationRecord
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def location_info
|
||||||
|
contact_info(name: name, address: address)
|
||||||
|
end
|
||||||
|
|
||||||
|
def owner_info
|
||||||
|
contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email)
|
||||||
|
end
|
||||||
|
|
||||||
|
def amendment_signed_column
|
||||||
|
if amendment_signable?
|
||||||
|
amendment_signed?
|
||||||
|
else
|
||||||
|
I18n.t('location_releases.csv.no_amendment_clause')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def end_date_after_start_date
|
def end_date_after_start_date
|
||||||
|
|||||||
@@ -850,7 +850,9 @@ en:
|
|||||||
empty: Location Releases will appear here
|
empty: Location Releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
amendment_signed: Amendment
|
amendment_signed: Amendment
|
||||||
|
amendment_signed_column: Amendment
|
||||||
approved: Approved
|
approved: Approved
|
||||||
|
approved?: Approved
|
||||||
location_info: Location Info
|
location_info: Location Info
|
||||||
notes: Notes
|
notes: Notes
|
||||||
owner_info: Owner Info
|
owner_info: Owner Info
|
||||||
@@ -870,6 +872,8 @@ en:
|
|||||||
heading: Import Location Release
|
heading: Import Location Release
|
||||||
update:
|
update:
|
||||||
notice: The location release has been updated
|
notice: The location release has been updated
|
||||||
|
csv:
|
||||||
|
no_amendment_clause: No amendment clause
|
||||||
material_releases:
|
material_releases:
|
||||||
create:
|
create:
|
||||||
notice: The material release has been created
|
notice: The material release has been created
|
||||||
|
|||||||
@@ -410,15 +410,20 @@ es:
|
|||||||
table_headers:
|
table_headers:
|
||||||
address: Address (ES)
|
address: Address (ES)
|
||||||
amendment_signed: Amendment (ES)
|
amendment_signed: Amendment (ES)
|
||||||
|
amendment_signed_column: Amendment signed (ES)
|
||||||
notes: Notes (ES)
|
notes: Notes (ES)
|
||||||
signed_at: Date Signed (ES)
|
signed_at: Date Signed (ES)
|
||||||
tags: Tags (ES)
|
tags: Tags (ES)
|
||||||
|
approved: Approved (ES)
|
||||||
|
approved?: Approved (ES)
|
||||||
location_release:
|
location_release:
|
||||||
actions:
|
actions:
|
||||||
sign_amendment: Sign Amendment (ES)
|
sign_amendment: Sign Amendment (ES)
|
||||||
messages:
|
messages:
|
||||||
amendment_not_signed_tooltip: Amendment not yet signed (ES)
|
amendment_not_signed_tooltip: Amendment not yet signed (ES)
|
||||||
amendment_signed_tooltip: Amendment Signed (ES)
|
amendment_signed_tooltip: Amendment Signed (ES)
|
||||||
|
csv:
|
||||||
|
no_amendment_clause: No amendment clause (ES)
|
||||||
material_releases:
|
material_releases:
|
||||||
create:
|
create:
|
||||||
notice: The acquired media release has been created (ES)
|
notice: The acquired media release has been created (ES)
|
||||||
|
|||||||
Reference in New Issue
Block a user