+#
+# initializers
+#
+
+sub init_defaults { SL::DB::Default->get }
+sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted }
+sub init_all_languages { SL::DB::Manager::Language->get_all_sorted }
+sub init_all_currencies { SL::DB::Manager::Currency->get_all_sorted }
+sub init_all_weightunits { my $unit = SL::DB::Manager::Unit->find_by(name => 'g'); $unit ? $unit->convertible_units : [] }
+sub init_all_templates { +{ SL::Template->available_templates } }
+
+sub init_posting_options {
+ [ { title => t8("never"), value => 0 },
+ { title => t8("every time"), value => 1 },
+ { title => t8("on the same day"), value => 2 }, ]
+}
+
+sub init_payment_options {
+ [ { title => t8("never"), value => 0 },
+ { title => t8("every time"), value => 1 },
+ { title => t8("on the same day"), value => 2 }, ]
+}
+
+sub init_accounting_options {
+ [ { title => t8("Accrual"), value => "accrual" },
+ { title => t8("cash"), value => "cash" }, ]
+}
+
+sub init_inventory_options {
+ [ { title => t8("perpetual"), value => "perpetual" },
+ { title => t8("periodic"), value => "periodic" }, ]
+}
+
+sub init_profit_options {
+ [ { title => t8("balance"), value => "balance" },
+ { title => t8("income"), value => "income" }, ]
+}
+
+sub init_accounts {
+ my %accounts;
+
+ foreach my $chart (@{ SL::DB::Manager::Chart->get_all(where => [ link => { like => '%IC%' } ], sort_by => 'accno ASC') }) {
+ my %added;
+
+ foreach my $link (split m/:/, $chart->link) {
+ my $key = lc($link =~ /cogs/ ? 'IC_expense' : $link =~ /sale/ ? 'IC_income' : $link);
+ next if $added{$key};