Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated seed file with invoice issuer info #1158

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions db/migrate/20231006095158_update_invoice_issuer_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
class UpdateInvoiceIssuerInfo < ActiveRecord::Migration[7.0]
def up
# Default invoice issuer
invoice_issuer_description = <<~TEXT.squish
Text that should appear in invoice as issuer. Usually contains a company name.
TEXT

invoice_issuer_value = <<~TEXT.squish
Eesti Interneti SA
TEXT

invoice_issuer_setting = Setting.find_by(code: :invoice_issuer)

invoice_issuer_setting.update(value: invoice_issuer_value,
description: invoice_issuer_description)

# Default invoice issuer registration no
invoice_issuer_reg_no_description = <<~TEXT.squish
Invoice issuer registration number.
TEXT

invoice_issuer_reg_no_value = <<~TEXT.squish
90010019
TEXT

invoice_issuer_reg_no_setting = Setting.new(code: :invoice_issuer_reg_no, value: invoice_issuer_reg_no_value,
description: invoice_issuer_reg_no_description,
value_format: 'string')

invoice_issuer_reg_no_setting.save

# Default invoice issuer VAT no
invoice_issuer_vat_no_description = <<~TEXT.squish
Invoice issuer VAT number.
TEXT

invoice_issuer_vat_no_value = <<~TEXT.squish
EE101286464
TEXT

invoice_issuer_vat_no_setting = Setting.new(code: :invoice_issuer_vat_no, value: invoice_issuer_vat_no_value,
description: invoice_issuer_vat_no_description,
value_format: 'string')

invoice_issuer_vat_no_setting.save

# Default invoice issuer street name
invoice_issuer_street_description = <<~TEXT.squish
Invoice issuer street name.
TEXT

invoice_issuer_street_value = <<~TEXT.squish
Paldiski mnt 80
TEXT

invoice_issuer_street_setting = Setting.new(code: :invoice_issuer_street, value: invoice_issuer_street_value,
description: invoice_issuer_street_description,
value_format: 'string')

invoice_issuer_street_setting.save

# Default invoice issuer state name
invoice_issuer_state_description = <<~TEXT.squish
Invoice issuer state name.
TEXT

invoice_issuer_state_value = <<~TEXT.squish
Harjumaa
TEXT

invoice_issuer_state_setting = Setting.new(code: :invoice_issuer_state, value: invoice_issuer_state_value,
description: invoice_issuer_state_description,
value_format: 'string')

invoice_issuer_state_setting.save

# Default invoice issuer postal code
invoice_issuer_zip_description = <<~TEXT.squish
Invoice issuer zip code.
TEXT

invoice_issuer_zip_value = <<~TEXT.squish
10617
TEXT

invoice_issuer_zip_setting = Setting.new(code: :invoice_issuer_zip, value: invoice_issuer_zip_value,
description: invoice_issuer_zip_description,
value_format: 'string')

invoice_issuer_zip_setting.save

# Default invoice issuer city name
invoice_issuer_city_description = <<~TEXT.squish
Invoice issuer city name.
TEXT

invoice_issuer_city_value = <<~TEXT.squish
Tallinn
TEXT

invoice_issuer_city_setting = Setting.new(code: :invoice_issuer_city, value: invoice_issuer_city_value,
description: invoice_issuer_city_description,
value_format: 'string')

invoice_issuer_city_setting.save

# Default invoice issuer country code
invoice_issuer_country_code_description = <<~TEXT.squish
Invoice issuer country code.
TEXT

invoice_issuer_country_code_value = <<~TEXT.squish
EE
TEXT

invoice_issuer_country_code_setting = Setting.new(code: :invoice_issuer_country_code, value: invoice_issuer_country_code_value,
description: invoice_issuer_country_code_description,
value_format: 'string')

invoice_issuer_country_code_setting.save
end

def down
Seting.find_by(code: :invoice_issuer_reg_no).delete
Seting.find_by(code: :invoice_issuer_vat_no).delete
Seting.find_by(code: :invoice_issuer_street).delete
Seting.find_by(code: :invoice_issuer_state).delete
Seting.find_by(code: :invoice_issuer_zip).delete
Seting.find_by(code: :invoice_issuer_city).delete
Seting.find_by(code: :invoice_issuer_country_code).delete
end
end
111 changes: 107 additions & 4 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,11 @@

# Default invoice issuer
invoice_issuer_description = <<~TEXT.squish
Text that should appear in invoice as issuer. Usually contains company name, VAT number and
local court registration number.
Text that should appear in invoice as issuer. Usually contains a company name.
TEXT

invoice_issuer_value = <<~TEXT.squish
Eesti Interneti SA Paldiski mnt 80, Tallinn, Harjumaa, 10617 Estonia,
Reg. no 90010019, VAT number EE101286464
Eesti Interneti SA
TEXT

invoice_issuer_setting = Setting.new(code: :invoice_issuer, value: invoice_issuer_value,
Expand All @@ -200,6 +198,111 @@

invoice_issuer_setting.save

# Default invoice issuer registration no
invoice_issuer_reg_no_description = <<~TEXT.squish
Invoice issuer registration number
TEXT

invoice_issuer_reg_no_value = <<~TEXT.squish
90010019
TEXT

invoice_issuer_reg_no_setting = Setting.new(code: :invoice_issuer_reg_no, value: invoice_issuer_reg_no_value,
description: invoice_issuer_reg_no_description,
value_format: 'string')

invoice_issuer_reg_no_setting.save

# Default invoice issuer VAT no
invoice_issuer_vat_no_description = <<~TEXT.squish
Invoice issuer VAT number.
TEXT

invoice_issuer_vat_no_value = <<~TEXT.squish
EE101286464
TEXT

invoice_issuer_vat_no_setting = Setting.new(code: :invoice_issuer_vat_no, value: invoice_issuer_vat_no_value,
description: invoice_issuer_vat_no_description,
value_format: 'string')

invoice_issuer_vat_no_setting.save

# Default invoice issuer street name
invoice_issuer_street_description = <<~TEXT.squish
Invoice issuer street name.
TEXT

invoice_issuer_street_value = <<~TEXT.squish
Paldiski mnt 80
TEXT

invoice_issuer_street_setting = Setting.new(code: :invoice_issuer_street, value: invoice_issuer_street_value,
description: invoice_issuer_street_description,
value_format: 'string')

invoice_issuer_street_setting.save

# Default invoice issuer state name
invoice_issuer_state_description = <<~TEXT.squish
Invoice issuer state name.
TEXT

invoice_issuer_state_value = <<~TEXT.squish
Harjumaa
TEXT

invoice_issuer_state_setting = Setting.new(code: :invoice_issuer_state, value: invoice_issuer_state_value,
description: invoice_issuer_state_description,
value_format: 'string')

invoice_issuer_state_setting.save

# Default invoice issuer postal code
invoice_issuer_zip_description = <<~TEXT.squish
Invoice issuer zip code.
TEXT

invoice_issuer_zip_value = <<~TEXT.squish
10617
TEXT

invoice_issuer_zip_setting = Setting.new(code: :invoice_issuer_zip, value: invoice_issuer_zip_value,
description: invoice_issuer_zip_description,
value_format: 'string')

invoice_issuer_zip_setting.save

# Default invoice issuer city name
invoice_issuer_city_description = <<~TEXT.squish
Invoice issuer city name.
TEXT

invoice_issuer_city_value = <<~TEXT.squish
10617
TEXT

invoice_issuer_city_setting = Setting.new(code: :invoice_issuer_city, value: invoice_issuer_city_value,
description: invoice_issuer_city_description,
value_format: 'string')

invoice_issuer_city_setting.save

# Default invoice issuer country code
invoice_issuer_country_code_description = <<~TEXT.squish
Invoice issuer country code.
TEXT

invoice_issuer_country_code_value = <<~TEXT.squish
EE
TEXT

invoice_issuer_country_code_setting = Setting.new(code: :invoice_issuer_country_code, value: invoice_issuer_country_code_value,
description: invoice_issuer_country_code_description,
value_format: 'string')

invoice_issuer_country_code_setting.save

# Default invoice reminder
invoice_reminder_description = <<~TEXT.squish
Number of days before due date on which reminders about unpaid invoices are sent.
Expand Down
6 changes: 5 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,7 @@ CREATE TRIGGER process_user_audit AFTER INSERT OR DELETE OR UPDATE ON public.use

CREATE TRIGGER process_wishlist_item_audit AFTER INSERT OR DELETE OR UPDATE ON public.wishlist_items FOR EACH ROW EXECUTE FUNCTION public.process_wishlist_item_audit();


--
-- Name: bans fk_rails_070022cd76; Type: FK CONSTRAINT; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3125,4 +3126,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230607092953'),
('20230705192353'),
('20230925130405'),
('20230927114150');
('20230927114150'),
('20231006095158');


Loading