Revision 250fa402
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/DB/Helper/ALL.pm | ||
---|---|---|
53 | 53 |
use SL::DB::PartsGroup; |
54 | 54 |
use SL::DB::PartsTax; |
55 | 55 |
use SL::DB::PaymentTerm; |
56 |
use SL::DB::PeriodicInvoice; |
|
57 |
use SL::DB::PeriodicInvoicesConfig; |
|
56 | 58 |
use SL::DB::PriceFactor; |
57 | 59 |
use SL::DB::Pricegroup; |
58 | 60 |
use SL::DB::Prices; |
SL/DB/Helper/Mappings.pm | ||
---|---|---|
66 | 66 |
partsgroup => 'parts_group', |
67 | 67 |
partstax => 'parts_tax', |
68 | 68 |
payment_terms => 'payment_term', |
69 |
periodic_invoices => 'periodic_invoice', |
|
70 |
periodic_invoices_configs => 'periodic_invoices_config', |
|
69 | 71 |
prices => 'prices', |
70 | 72 |
price_factors => 'price_factor', |
71 | 73 |
pricegroup => 'pricegroup', |
SL/DB/MetaSetup/PeriodicInvoice.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::PeriodicInvoice; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'periodic_invoices', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
config_id => { type => 'integer', not_null => 1 }, |
|
15 |
ar_id => { type => 'integer', not_null => 1 }, |
|
16 |
period_start_date => { type => 'date', not_null => 1 }, |
|
17 |
itime => { type => 'timestamp', default => 'now()' }, |
|
18 |
], |
|
19 |
|
|
20 |
primary_key_columns => [ 'id' ], |
|
21 |
|
|
22 |
allow_inline_column_values => 1, |
|
23 |
|
|
24 |
foreign_keys => [ |
|
25 |
ar => { |
|
26 |
class => 'SL::DB::Invoice', |
|
27 |
key_columns => { ar_id => 'id' }, |
|
28 |
}, |
|
29 |
|
|
30 |
config => { |
|
31 |
class => 'SL::DB::PeriodicInvoicesConfig', |
|
32 |
key_columns => { config_id => 'id' }, |
|
33 |
}, |
|
34 |
], |
|
35 |
); |
|
36 |
|
|
37 |
1; |
|
38 |
; |
SL/DB/MetaSetup/PeriodicInvoicesConfig.pm | ||
---|---|---|
1 |
# This file has been auto-generated. Do not modify it; it will be overwritten |
|
2 |
# by rose_auto_create_model.pl automatically. |
|
3 |
package SL::DB::PeriodicInvoicesConfig; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use base qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'periodic_invoices_configs', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
oe_id => { type => 'integer', not_null => 1 }, |
|
15 |
periodicity => { type => 'varchar', length => 10, not_null => 1 }, |
|
16 |
print => { type => 'boolean', default => 'false' }, |
|
17 |
printer_id => { type => 'integer' }, |
|
18 |
copies => { type => 'integer' }, |
|
19 |
active => { type => 'boolean', default => 'true' }, |
|
20 |
start_date => { type => 'date' }, |
|
21 |
ar_chart_id => { type => 'integer', not_null => 1 }, |
|
22 |
], |
|
23 |
|
|
24 |
primary_key_columns => [ 'id' ], |
|
25 |
|
|
26 |
foreign_keys => [ |
|
27 |
ar_chart => { |
|
28 |
class => 'SL::DB::Chart', |
|
29 |
key_columns => { ar_chart_id => 'id' }, |
|
30 |
}, |
|
31 |
|
|
32 |
oe => { |
|
33 |
class => 'SL::DB::Order', |
|
34 |
key_columns => { oe_id => 'id' }, |
|
35 |
}, |
|
36 |
|
|
37 |
printer => { |
|
38 |
class => 'SL::DB::Printer', |
|
39 |
key_columns => { printer_id => 'id' }, |
|
40 |
}, |
|
41 |
], |
|
42 |
); |
|
43 |
|
|
44 |
1; |
|
45 |
; |
SL/DB/Order.pm | ||
---|---|---|
17 | 17 |
manager_args => { |
18 | 18 |
with_objects => [ 'part' ] |
19 | 19 |
} |
20 |
} |
|
20 |
}, |
|
21 |
periodic_invoices_config => { |
|
22 |
type => 'one to one', |
|
23 |
class => 'SL::DB::PeriodicInvoicesConfig', |
|
24 |
column_map => { id => 'oe_id' }, |
|
25 |
}, |
|
26 |
periodic_invoices => { |
|
27 |
type => 'one to many', |
|
28 |
class => 'SL::DB::PeriodicInvoice', |
|
29 |
column_map => { id => 'oe_id' }, |
|
30 |
}, |
|
21 | 31 |
); |
22 | 32 |
|
23 | 33 |
__PACKAGE__->meta->initialize; |
SL/DB/PeriodicInvoice.pm | ||
---|---|---|
1 |
package SL::DB::PeriodicInvoice; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use SL::DB::MetaSetup::PeriodicInvoice; |
|
6 |
|
|
7 |
__PACKAGE__->meta->add_relationships( |
|
8 |
invoice => { |
|
9 |
type => 'one to one', |
|
10 |
class => 'SL::DB::Invoice', |
|
11 |
column_map => { ar_id => 'id' }, |
|
12 |
}, |
|
13 |
); |
|
14 |
|
|
15 |
__PACKAGE__->meta->initialize; |
|
16 |
|
|
17 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
18 |
__PACKAGE__->meta->make_manager_class; |
|
19 |
|
|
20 |
1; |
SL/DB/PeriodicInvoicesConfig.pm | ||
---|---|---|
1 |
package SL::DB::PeriodicInvoicesConfig; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use SL::DB::MetaSetup::PeriodicInvoicesConfig; |
|
6 |
|
|
7 |
__PACKAGE__->meta->add_relationships( |
|
8 |
order => { |
|
9 |
type => 'one to one', |
|
10 |
class => 'SL::DB::Order', |
|
11 |
column_map => { oe_id => 'id' }, |
|
12 |
}, |
|
13 |
); |
|
14 |
|
|
15 |
__PACKAGE__->meta->initialize; |
|
16 |
|
|
17 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
18 |
__PACKAGE__->meta->make_manager_class; |
|
19 |
|
|
20 |
1; |
sql/Pg-upgrade2/periodic_invoices.sql | ||
---|---|---|
1 |
-- @tag: periodic_invoices |
|
2 |
-- @description: Neue Tabellen und Spalten f?r Wiederkehrende Rechnungen |
|
3 |
-- @depends: release_2_6_1 |
|
4 |
CREATE TABLE periodic_invoices_configs ( |
|
5 |
id integer NOT NULL DEFAULT nextval('id'), |
|
6 |
oe_id integer NOT NULL, |
|
7 |
periodicity varchar(10) NOT NULL, |
|
8 |
print boolean DEFAULT 'f', |
|
9 |
printer_id integer, |
|
10 |
copies integer, |
|
11 |
active boolean DEFAULT 't', |
|
12 |
start_date date, |
|
13 |
ar_chart_id integer NOT NULL, |
|
14 |
|
|
15 |
PRIMARY KEY (id), |
|
16 |
FOREIGN KEY (oe_id) REFERENCES oe (id), |
|
17 |
FOREIGN KEY (printer_id) REFERENCES printers (id), |
|
18 |
FOREIGN KEY (ar_chart_id) REFERENCES chart (id) |
|
19 |
); |
|
20 |
|
|
21 |
CREATE TABLE periodic_invoices ( |
|
22 |
id integer NOT NULL DEFAULT nextval('id'), |
|
23 |
config_id integer NOT NULL, |
|
24 |
ar_id integer NOT NULL, |
|
25 |
period_start_date date NOT NULL, |
|
26 |
itime timestamp DEFAULT now(), |
|
27 |
|
|
28 |
PRIMARY KEY (id), |
|
29 |
FOREIGN KEY (config_id) REFERENCES periodic_invoices_configs (id), |
|
30 |
FOREIGN KEY (ar_id) REFERENCES ar (id) |
|
31 |
); |
Auch abrufbar als: Unified diff
Datenbankupgradescript, Rose-Models für Wiederkehrende Rechnungen