Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c123e944

Von Tamino Steinert vor etwa 2 Monaten hinzugefügt

  • ID c123e9440f8c26b6e7221e0f5aeccf34e923e84e
  • Vorgänger 76779674
  • Nachfolger 93ae5d0f

S:D:PeriodicInvoiceItemsConfig: DB-Tabelle erstellt

Unterschiede anzeigen:

SL/DB/Helper/ALL.pm
97 97
use SL::DB::PaymentTerm;
98 98
use SL::DB::PeriodicInvoice;
99 99
use SL::DB::PeriodicInvoicesConfig;
100
use SL::DB::PeriodicInvoiceItemsConfig;
100 101
use SL::DB::PriceFactor;
101 102
use SL::DB::Pricegroup;
102 103
use SL::DB::Price;
SL/DB/Helper/Mappings.pm
176 176
  payment_terms                  => 'payment_term',
177 177
  periodic_invoices              => 'periodic_invoice',
178 178
  periodic_invoices_configs      => 'periodic_invoices_config',
179
  periodic_invoice_items_configs => 'PeriodicInvoiceItemsConfig',
179 180
  prices                         => 'price',
180 181
  price_factors                  => 'price_factor',
181 182
  price_rules                    => 'price_rule',
SL/DB/Manager/PeriodicInvoiceItemsConfig.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::PeriodicInvoiceItemsConfig;
5

  
6
use strict;
7

  
8
use parent qw(SL::DB::Helper::Manager);
9

  
10
sub object_class { 'SL::DB::PeriodicInvoiceItemsConfig' }
11

  
12
__PACKAGE__->make_manager_methods;
13

  
14
1;
SL/DB/MetaSetup/OrderItem.pm
9 9
__PACKAGE__->meta->table('orderitems');
10 10

  
11 11
__PACKAGE__->meta->columns(
12
  active_discount_source       => { type => 'text', default => '', not_null => 1 },
13
  active_price_source          => { type => 'text', default => '', not_null => 1 },
14
  base_qty                     => { type => 'float', precision => 4, scale => 4 },
15
  cusordnumber                 => { type => 'text' },
16
  description                  => { type => 'text' },
17
  discount                     => { type => 'float', precision => 4, scale => 4 },
18
  id                           => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
19
  itime                        => { type => 'timestamp', default => 'now()' },
20
  lastcost                     => { type => 'numeric', precision => 15, scale => 5 },
21
  longdescription              => { type => 'text' },
22
  marge_percent                => { type => 'numeric', precision => 15, scale => 5 },
23
  marge_price_factor           => { type => 'numeric', default => 1, precision => 15, scale => 5 },
24
  marge_total                  => { type => 'numeric', precision => 15, scale => 5 },
25
  mtime                        => { type => 'timestamp' },
26
  optional                     => { type => 'boolean', default => 'false' },
27
  orderer_id                   => { type => 'integer' },
28
  ordnumber                    => { type => 'text' },
29
  parts_id                     => { type => 'integer' },
30
  position                     => { type => 'integer', not_null => 1 },
31
  price_factor                 => { type => 'numeric', default => 1, precision => 15, scale => 5 },
32
  price_factor_id              => { type => 'integer' },
33
  pricegroup_id                => { type => 'integer' },
34
  project_id                   => { type => 'integer' },
35
  qty                          => { type => 'numeric', precision => 25, scale => 5 },
36
  recurring_billing_invoice_id => { type => 'integer' },
37
  recurring_billing_mode       => { type => 'enum', check_in => [ 'never', 'once', 'always' ], db_type => 'items_recurring_billing_mode', default => 'always', not_null => 1 },
38
  reqdate                      => { type => 'date' },
39
  sellprice                    => { type => 'numeric', precision => 15, scale => 5 },
40
  serialnumber                 => { type => 'text' },
41
  ship                         => { type => 'float', precision => 4, scale => 4 },
42
  subtotal                     => { type => 'boolean', default => 'false' },
43
  trans_id                     => { type => 'integer' },
44
  transdate                    => { type => 'text' },
45
  unit                         => { type => 'varchar', length => 20 },
12
  active_discount_source => { type => 'text', default => '', not_null => 1 },
13
  active_price_source    => { type => 'text', default => '', not_null => 1 },
14
  base_qty               => { type => 'float', precision => 4, scale => 4 },
15
  cusordnumber           => { type => 'text' },
16
  description            => { type => 'text' },
17
  discount               => { type => 'float', precision => 4, scale => 4 },
18
  id                     => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
19
  itime                  => { type => 'timestamp', default => 'now()' },
20
  lastcost               => { type => 'numeric', precision => 15, scale => 5 },
21
  longdescription        => { type => 'text' },
22
  marge_percent          => { type => 'numeric', precision => 15, scale => 5 },
23
  marge_price_factor     => { type => 'numeric', default => 1, precision => 15, scale => 5 },
24
  marge_total            => { type => 'numeric', precision => 15, scale => 5 },
25
  mtime                  => { type => 'timestamp' },
26
  optional               => { type => 'boolean', default => 'false' },
27
  orderer_id             => { type => 'integer' },
28
  ordnumber              => { type => 'text' },
29
  parts_id               => { type => 'integer' },
30
  position               => { type => 'integer', not_null => 1 },
31
  price_factor           => { type => 'numeric', default => 1, precision => 15, scale => 5 },
32
  price_factor_id        => { type => 'integer' },
33
  pricegroup_id          => { type => 'integer' },
34
  project_id             => { type => 'integer' },
35
  qty                    => { type => 'numeric', precision => 25, scale => 5 },
36
  reqdate                => { type => 'date' },
37
  sellprice              => { type => 'numeric', precision => 15, scale => 5 },
38
  serialnumber           => { type => 'text' },
39
  ship                   => { type => 'float', precision => 4, scale => 4 },
40
  subtotal               => { type => 'boolean', default => 'false' },
41
  trans_id               => { type => 'integer' },
42
  transdate              => { type => 'text' },
43
  unit                   => { type => 'varchar', length => 20 },
46 44
);
47 45

  
48 46
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
......
80 78
    key_columns => { project_id => 'id' },
81 79
  },
82 80

  
83
  recurring_billing_invoice => {
84
    class       => 'SL::DB::Invoice',
85
    key_columns => { recurring_billing_invoice_id => 'id' },
86
  },
87

  
88 81
  unit_obj => {
89 82
    class       => 'SL::DB::Unit',
90 83
    key_columns => { unit => 'name' },
SL/DB/MetaSetup/PeriodicInvoiceItemsConfig.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::PeriodicInvoiceItemsConfig;
4

  
5
use strict;
6

  
7
use parent qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('periodic_invoice_items_configs');
10

  
11
__PACKAGE__->meta->columns(
12
  end_date                => { type => 'date' },
13
  extend_automatically_by => { type => 'integer' },
14
  once_invoice_id         => { type => 'integer' },
15
  order_item_id           => { type => 'integer', not_null => 1 },
16
  periodicity             => { type => 'varchar', length => 10, not_null => 1 },
17
  start_date              => { type => 'date' },
18
  terminated              => { type => 'boolean' },
19
);
20

  
21
__PACKAGE__->meta->primary_key_columns([ 'order_item_id' ]);
22

  
23
__PACKAGE__->meta->foreign_keys(
24
  once_invoice => {
25
    class       => 'SL::DB::Invoice',
26
    key_columns => { once_invoice_id => 'id' },
27
  },
28

  
29
  order_item => {
30
    class       => 'SL::DB::OrderItem',
31
    key_columns => { order_item_id => 'id' },
32
    rel_type    => 'one to one',
33
  },
34
);
35

  
36
1;
37
;
SL/DB/PeriodicInvoiceItemsConfig.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::PeriodicInvoiceItemsConfig;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::PeriodicInvoiceItemsConfig;
9
use SL::DB::Manager::PeriodicInvoiceItemsConfig;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
sql/Pg-upgrade2/periodic_invoices_items.sql
1
-- @tag: periodic_invoices_items
2
-- @description: Separate Tabelle für Positionen von Wiederkehrende Rechnungen
3
-- @depends: periodic_invoices sales_orders_recurring_billing_mode
4
CREATE TABLE periodic_invoice_items_configs (
5
  order_item_id           INTEGER     NOT NULL  REFERENCES orderitems (id) ON DELETE CASCADE,
6
  periodicity             VARCHAR(10) NOT NULL,
7
  terminated              BOOLEAN,
8
  start_date              DATE,
9
  end_date                DATE,
10
  extend_automatically_by INTEGER,
11
  once_invoice_id         INTEGER               REFERENCES ar (id) ON DELETE SET NULL,
12

  
13
  PRIMARY KEY (order_item_id)
14
);
15

  
16
INSERT INTO periodic_invoice_items_configs (
17
  order_item_id, periodicity, once_invoice_id
18
) SELECT id, 'o', recurring_billing_invoice_id
19
FROM orderitems
20
WHERE recurring_billing_mode = 'once';
21

  
22
INSERT INTO periodic_invoice_items_configs (
23
  order_item_id, periodicity, once_invoice_id
24
) SELECT id, 'n', recurring_billing_invoice_id
25
FROM orderitems
26
WHERE recurring_billing_mode = 'never';
27

  
28
INSERT INTO periodic_invoice_items_configs (
29
  order_item_id, periodicity, once_invoice_id
30
) SELECT id, 'p', recurring_billing_invoice_id
31
FROM orderitems
32
WHERE recurring_billing_mode = 'always' and recurring_billing_invoice_id IS NOT NULL;
33

  
34
ALTER TABLE orderitems DROP COLUMN recurring_billing_invoice_id;
35
ALTER TABLE orderitems DROP COLUMN recurring_billing_mode;

Auch abrufbar als: Unified diff