use SL::DB::PartsGroup;
use SL::DB::PartsTax;
use SL::DB::PaymentTerm;
+use SL::DB::PeriodicInvoice;
+use SL::DB::PeriodicInvoicesConfig;
use SL::DB::PriceFactor;
use SL::DB::Pricegroup;
use SL::DB::Prices;
partsgroup => 'parts_group',
partstax => 'parts_tax',
payment_terms => 'payment_term',
+ periodic_invoices => 'periodic_invoice',
+ periodic_invoices_configs => 'periodic_invoices_config',
prices => 'prices',
price_factors => 'price_factor',
pricegroup => 'pricegroup',
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PeriodicInvoice;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+ table => 'periodic_invoices',
+
+ columns => [
+ id => { type => 'integer', not_null => 1, sequence => 'id' },
+ config_id => { type => 'integer', not_null => 1 },
+ ar_id => { type => 'integer', not_null => 1 },
+ period_start_date => { type => 'date', not_null => 1 },
+ itime => { type => 'timestamp', default => 'now()' },
+ ],
+
+ primary_key_columns => [ 'id' ],
+
+ allow_inline_column_values => 1,
+
+ foreign_keys => [
+ ar => {
+ class => 'SL::DB::Invoice',
+ key_columns => { ar_id => 'id' },
+ },
+
+ config => {
+ class => 'SL::DB::PeriodicInvoicesConfig',
+ key_columns => { config_id => 'id' },
+ },
+ ],
+);
+
+1;
+;
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PeriodicInvoicesConfig;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+ table => 'periodic_invoices_configs',
+
+ columns => [
+ id => { type => 'integer', not_null => 1, sequence => 'id' },
+ oe_id => { type => 'integer', not_null => 1 },
+ periodicity => { type => 'varchar', length => 10, not_null => 1 },
+ print => { type => 'boolean', default => 'false' },
+ printer_id => { type => 'integer' },
+ copies => { type => 'integer' },
+ active => { type => 'boolean', default => 'true' },
+ start_date => { type => 'date' },
+ ar_chart_id => { type => 'integer', not_null => 1 },
+ ],
+
+ primary_key_columns => [ 'id' ],
+
+ foreign_keys => [
+ ar_chart => {
+ class => 'SL::DB::Chart',
+ key_columns => { ar_chart_id => 'id' },
+ },
+
+ oe => {
+ class => 'SL::DB::Order',
+ key_columns => { oe_id => 'id' },
+ },
+
+ printer => {
+ class => 'SL::DB::Printer',
+ key_columns => { printer_id => 'id' },
+ },
+ ],
+);
+
+1;
+;
manager_args => {
with_objects => [ 'part' ]
}
- }
+ },
+ periodic_invoices_config => {
+ type => 'one to one',
+ class => 'SL::DB::PeriodicInvoicesConfig',
+ column_map => { id => 'oe_id' },
+ },
+ periodic_invoices => {
+ type => 'one to many',
+ class => 'SL::DB::PeriodicInvoice',
+ column_map => { id => 'oe_id' },
+ },
);
__PACKAGE__->meta->initialize;
--- /dev/null
+package SL::DB::PeriodicInvoice;
+
+use strict;
+
+use SL::DB::MetaSetup::PeriodicInvoice;
+
+__PACKAGE__->meta->add_relationships(
+ invoice => {
+ type => 'one to one',
+ class => 'SL::DB::Invoice',
+ column_map => { ar_id => 'id' },
+ },
+);
+
+__PACKAGE__->meta->initialize;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
--- /dev/null
+package SL::DB::PeriodicInvoicesConfig;
+
+use strict;
+
+use SL::DB::MetaSetup::PeriodicInvoicesConfig;
+
+__PACKAGE__->meta->add_relationships(
+ order => {
+ type => 'one to one',
+ class => 'SL::DB::Order',
+ column_map => { oe_id => 'id' },
+ },
+);
+
+__PACKAGE__->meta->initialize;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
--- /dev/null
+-- @tag: periodic_invoices
+-- @description: Neue Tabellen und Spalten für Wiederkehrende Rechnungen
+-- @depends: release_2_6_1
+CREATE TABLE periodic_invoices_configs (
+ id integer NOT NULL DEFAULT nextval('id'),
+ oe_id integer NOT NULL,
+ periodicity varchar(10) NOT NULL,
+ print boolean DEFAULT 'f',
+ printer_id integer,
+ copies integer,
+ active boolean DEFAULT 't',
+ start_date date,
+ ar_chart_id integer NOT NULL,
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (oe_id) REFERENCES oe (id),
+ FOREIGN KEY (printer_id) REFERENCES printers (id),
+ FOREIGN KEY (ar_chart_id) REFERENCES chart (id)
+);
+
+CREATE TABLE periodic_invoices (
+ id integer NOT NULL DEFAULT nextval('id'),
+ config_id integer NOT NULL,
+ ar_id integer NOT NULL,
+ period_start_date date NOT NULL,
+ itime timestamp DEFAULT now(),
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (config_id) REFERENCES periodic_invoices_configs (id),
+ FOREIGN KEY (ar_id) REFERENCES ar (id)
+);