Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d17e1b9d

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID d17e1b9d1b761bb19d0cb79a742ea70a07028998
  • Vorgänger 0bbc7ffd
  • Nachfolger baac72df

Pflichtenhefte: Datenbankschema und Rose-DB-Models

Unterschiede anzeigen:

SL/DB/Helper/ALL.pm
72 72
use SL::DB::ProjectType;
73 73
use SL::DB::PurchaseInvoice;
74 74
use SL::DB::RecordLink;
75
use SL::DB::RequirementSpecAcceptanceStatus;
76
use SL::DB::RequirementSpecComplexity;
77
use SL::DB::RequirementSpecDependency;
78
use SL::DB::RequirementSpecItem;
79
use SL::DB::RequirementSpecPredefinedText;
80
use SL::DB::RequirementSpecRisk;
81
use SL::DB::RequirementSpecStatus;
82
use SL::DB::RequirementSpecTextBlock;
83
use SL::DB::RequirementSpecType;
84
use SL::DB::RequirementSpecVersion;
85
use SL::DB::RequirementSpec;
75 86
use SL::DB::SchemaInfo;
76 87
use SL::DB::SepaExport;
77 88
use SL::DB::SepaExportItem;
SL/DB/Helper/Mappings.pm
152 152
  project                        => 'project',
153 153
  project_types                  => 'ProjectType',
154 154
  record_links                   => 'record_link',
155
  requirement_spec_acceptance_statuses => 'RequirementSpecAcceptanceStatus',
156
  requirement_spec_complexities        => 'RequirementSpecComplexity',
157
  requirement_spec_item_dependencies   => 'RequirementSpecDependency',
158
  requirement_spec_items               => 'RequirementSpecItem',
159
  requirement_spec_predefined_texts    => 'RequirementSpecPredefinedText',
160
  requirement_spec_risks               => 'RequirementSpecRisk',
161
  requirement_spec_statuses            => 'RequirementSpecStatus',
162
  requirement_spec_text_blocks         => 'RequirementSpecTextBlock',
163
  requirement_spec_types               => 'RequirementSpecType',
164
  requirement_spec_versions            => 'RequirementSpecVersion',
165
  requirement_specs                    => 'RequirementSpec',
155 166
  sepa_export                    => 'sepa_export',
156 167
  sepa_export_items              => 'sepa_export_item',
157 168
  schema_info                    => 'schema_info',
SL/DB/MetaSetup/Customer.pm
33 33
  fax                       => { type => 'varchar', length => 30 },
34 34
  greeting                  => { type => 'text' },
35 35
  homepage                  => { type => 'text' },
36
  hourly_rate               => { type => 'numeric', precision => 2, scale => 8 },
36 37
  iban                      => { type => 'varchar', length => 100 },
37 38
  id                        => { type => 'integer', not_null => 1, sequence => 'id' },
38 39
  itime                     => { type => 'timestamp', default => 'now()' },
SL/DB/MetaSetup/Default.pm
9 9
__PACKAGE__->meta->table('defaults');
10 10

  
11 11
__PACKAGE__->meta->columns(
12
  accounting_method                       => { type => 'text' },
13
  address                                 => { type => 'text' },
14
  ap_changeable                           => { type => 'integer', default => 2, not_null => 1 },
15
  ap_show_mark_as_paid                    => { type => 'boolean', default => 'true' },
16
  ar_changeable                           => { type => 'integer', default => 2, not_null => 1 },
17
  ar_paid_accno_id                        => { type => 'integer' },
18
  ar_show_mark_as_paid                    => { type => 'boolean', default => 'true' },
19
  articlenumber                           => { type => 'text' },
20
  assemblynumber                          => { type => 'text' },
21
  balance_startdate_method                => { type => 'text' },
22
  bin_id                                  => { type => 'integer' },
23
  bin_id_ignore_onhand                    => { type => 'integer' },
24
  businessnumber                          => { type => 'text' },
25
  closedto                                => { type => 'date' },
26
  cnnumber                                => { type => 'text' },
27
  co_ustid                                => { type => 'text' },
28
  coa                                     => { type => 'text' },
29
  company                                 => { type => 'text' },
30
  currency_id                             => { type => 'integer', not_null => 1 },
31
  customernumber                          => { type => 'text' },
32
  datev_check_on_ap_transaction           => { type => 'boolean', default => 'true' },
33
  datev_check_on_ar_transaction           => { type => 'boolean', default => 'true' },
34
  datev_check_on_gl_transaction           => { type => 'boolean', default => 'true' },
35
  datev_check_on_purchase_invoice         => { type => 'boolean', default => 'true' },
36
  datev_check_on_sales_invoice            => { type => 'boolean', default => 'true' },
37
  dunning_ar                              => { type => 'integer' },
38
  dunning_ar_amount_fee                   => { type => 'integer' },
39
  dunning_ar_amount_interest              => { type => 'integer' },
40
  duns                                    => { type => 'text' },
41
  expense_accno_id                        => { type => 'integer' },
42
  fxgain_accno_id                         => { type => 'integer' },
43
  fxloss_accno_id                         => { type => 'integer' },
44
  gl_changeable                           => { type => 'integer', default => 2, not_null => 1 },
45
  id                                      => { type => 'serial', not_null => 1 },
46
  income_accno_id                         => { type => 'integer' },
47
  inventory_accno_id                      => { type => 'integer' },
48
  inventory_system                        => { type => 'text' },
49
  invnumber                               => { type => 'text' },
50
  ir_changeable                           => { type => 'integer', default => 2, not_null => 1 },
51
  ir_show_mark_as_paid                    => { type => 'boolean', default => 'true' },
52
  is_changeable                           => { type => 'integer', default => 2, not_null => 1 },
53
  is_show_mark_as_paid                    => { type => 'boolean', default => 'true' },
54
  itime                                   => { type => 'timestamp', default => 'now()' },
55
  language_id                             => { type => 'integer' },
56
  max_future_booking_interval             => { type => 'integer', default => 360 },
57
  mtime                                   => { type => 'timestamp' },
58
  normalize_part_descriptions             => { type => 'boolean', default => 'true' },
59
  normalize_vc_names                      => { type => 'boolean', default => 'true' },
60
  parts_image_css                         => { type => 'text', default => 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;' },
61
  parts_listing_image                     => { type => 'boolean', default => 'true' },
62
  parts_show_image                        => { type => 'boolean', default => 'true' },
63
  payments_changeable                     => { type => 'integer', default => '0', not_null => 1 },
64
  pdonumber                               => { type => 'text' },
65
  ponumber                                => { type => 'text' },
66
  profit_determination                    => { type => 'text' },
67
  purchase_delivery_order_show_delete     => { type => 'boolean', default => 'true' },
68
  purchase_order_show_delete              => { type => 'boolean', default => 'true' },
69
  revtrans                                => { type => 'boolean', default => 'false' },
70
  rfqnumber                               => { type => 'text' },
71
  rmanumber                               => { type => 'text' },
72
  sales_delivery_order_show_delete        => { type => 'boolean', default => 'true' },
73
  sales_order_show_delete                 => { type => 'boolean', default => 'true' },
74
  sdonumber                               => { type => 'text' },
75
  sepa_creditor_id                        => { type => 'text' },
76
  servicenumber                           => { type => 'text' },
77
  show_bestbefore                         => { type => 'boolean', default => 'false' },
78
  show_weight                             => { type => 'boolean', default => 'false', not_null => 1 },
79
  signature                               => { type => 'text' },
80
  sonumber                                => { type => 'text' },
81
  sqnumber                                => { type => 'text' },
82
  taxnumber                               => { type => 'text' },
83
  templates                               => { type => 'text' },
84
  transfer_default                        => { type => 'boolean', default => 'true' },
85
  transfer_default_ignore_onhand          => { type => 'boolean', default => 'false' },
86
  transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' },
87
  vendornumber                            => { type => 'text' },
88
  version                                 => { type => 'varchar', length => 8 },
89
  vertreter                               => { type => 'boolean', default => 'false' },
90
  warehouse_id                            => { type => 'integer' },
91
  warehouse_id_ignore_onhand              => { type => 'integer' },
92
  webdav                                  => { type => 'boolean', default => 'false' },
93
  webdav_documents                        => { type => 'boolean', default => 'false' },
94
  weightunit                              => { type => 'varchar', length => 5 },
12
  accounting_method                             => { type => 'text' },
13
  address                                       => { type => 'text' },
14
  ap_changeable                                 => { type => 'integer', default => 2, not_null => 1 },
15
  ap_show_mark_as_paid                          => { type => 'boolean', default => 'true' },
16
  ar_changeable                                 => { type => 'integer', default => 2, not_null => 1 },
17
  ar_paid_accno_id                              => { type => 'integer' },
18
  ar_show_mark_as_paid                          => { type => 'boolean', default => 'true' },
19
  articlenumber                                 => { type => 'text' },
20
  assemblynumber                                => { type => 'text' },
21
  balance_startdate_method                      => { type => 'text' },
22
  bin_id                                        => { type => 'integer' },
23
  bin_id_ignore_onhand                          => { type => 'integer' },
24
  businessnumber                                => { type => 'text' },
25
  closedto                                      => { type => 'date' },
26
  cnnumber                                      => { type => 'text' },
27
  co_ustid                                      => { type => 'text' },
28
  coa                                           => { type => 'text' },
29
  company                                       => { type => 'text' },
30
  currency_id                                   => { type => 'integer', not_null => 1 },
31
  customernumber                                => { type => 'text' },
32
  datev_check_on_ap_transaction                 => { type => 'boolean', default => 'true' },
33
  datev_check_on_ar_transaction                 => { type => 'boolean', default => 'true' },
34
  datev_check_on_gl_transaction                 => { type => 'boolean', default => 'true' },
35
  datev_check_on_purchase_invoice               => { type => 'boolean', default => 'true' },
36
  datev_check_on_sales_invoice                  => { type => 'boolean', default => 'true' },
37
  dunning_ar                                    => { type => 'integer' },
38
  dunning_ar_amount_fee                         => { type => 'integer' },
39
  dunning_ar_amount_interest                    => { type => 'integer' },
40
  duns                                          => { type => 'text' },
41
  expense_accno_id                              => { type => 'integer' },
42
  fxgain_accno_id                               => { type => 'integer' },
43
  fxloss_accno_id                               => { type => 'integer' },
44
  gl_changeable                                 => { type => 'integer', default => 2, not_null => 1 },
45
  id                                            => { type => 'serial', not_null => 1 },
46
  income_accno_id                               => { type => 'integer' },
47
  inventory_accno_id                            => { type => 'integer' },
48
  inventory_system                              => { type => 'text' },
49
  invnumber                                     => { type => 'text' },
50
  ir_changeable                                 => { type => 'integer', default => 2, not_null => 1 },
51
  ir_show_mark_as_paid                          => { type => 'boolean', default => 'true' },
52
  is_changeable                                 => { type => 'integer', default => 2, not_null => 1 },
53
  is_show_mark_as_paid                          => { type => 'boolean', default => 'true' },
54
  itime                                         => { type => 'timestamp', default => 'now()' },
55
  language_id                                   => { type => 'integer' },
56
  max_future_booking_interval                   => { type => 'integer', default => 360 },
57
  mtime                                         => { type => 'timestamp' },
58
  normalize_part_descriptions                   => { type => 'boolean', default => 'true' },
59
  normalize_vc_names                            => { type => 'boolean', default => 'true' },
60
  parts_image_css                               => { type => 'text', default => 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;' },
61
  parts_listing_image                           => { type => 'boolean', default => 'true' },
62
  parts_show_image                              => { type => 'boolean', default => 'true' },
63
  payments_changeable                           => { type => 'integer', default => '0', not_null => 1 },
64
  pdonumber                                     => { type => 'text' },
65
  ponumber                                      => { type => 'text' },
66
  profit_determination                          => { type => 'text' },
67
  purchase_delivery_order_show_delete           => { type => 'boolean', default => 'true' },
68
  purchase_order_show_delete                    => { type => 'boolean', default => 'true' },
69
  requirement_spec_section_number_format        => { type => 'text', default => 'A00', not_null => 1 },
70
  requirement_spec_function_block_number_format => { type => 'text', default => 'FB000', not_null => 1 },
71
  revtrans                                      => { type => 'boolean', default => 'false' },
72
  rfqnumber                                     => { type => 'text' },
73
  rmanumber                                     => { type => 'text' },
74
  sales_delivery_order_show_delete              => { type => 'boolean', default => 'true' },
75
  sales_order_show_delete                       => { type => 'boolean', default => 'true' },
76
  sdonumber                                     => { type => 'text' },
77
  sepa_creditor_id                              => { type => 'text' },
78
  servicenumber                                 => { type => 'text' },
79
  show_bestbefore                               => { type => 'boolean', default => 'false' },
80
  show_weight                                   => { type => 'boolean', default => 'false', not_null => 1 },
81
  signature                                     => { type => 'text' },
82
  sonumber                                      => { type => 'text' },
83
  sqnumber                                      => { type => 'text' },
84
  taxnumber                                     => { type => 'text' },
85
  templates                                     => { type => 'text' },
86
  transfer_default                              => { type => 'boolean', default => 'true' },
87
  transfer_default_ignore_onhand                => { type => 'boolean', default => 'false' },
88
  transfer_default_use_master_default_bin       => { type => 'boolean', default => 'false' },
89
  vendornumber                                  => { type => 'text' },
90
  version                                       => { type => 'varchar', length => 8 },
91
  vertreter                                     => { type => 'boolean', default => 'false' },
92
  warehouse_id                                  => { type => 'integer' },
93
  warehouse_id_ignore_onhand                    => { type => 'integer' },
94
  webdav                                        => { type => 'boolean', default => 'false' },
95
  webdav_documents                              => { type => 'boolean', default => 'false' },
96
  weightunit                                    => { type => 'varchar', length => 5 },
95 97
);
96 98

  
97 99
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
SL/DB/MetaSetup/RequirementSpec.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::RequirementSpec;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_specs',
11

  
12
  columns => [
13
    id                      => { type => 'serial', not_null => 1 },
14
    type_id                 => { type => 'integer', not_null => 1 },
15
    status_id               => { type => 'integer', not_null => 1 },
16
    version_id              => { type => 'integer' },
17
    customer_id             => { type => 'integer', not_null => 1 },
18
    project_id              => { type => 'integer' },
19
    title                   => { type => 'text', not_null => 1 },
20
    hourly_rate             => { type => 'numeric', default => '0', not_null => 1, precision => 2, scale => 8 },
21
    net_sum                 => { type => 'numeric', default => '0', not_null => 1, precision => 2, scale => 12 },
22
    working_copy_id         => { type => 'integer' },
23
    previous_section_number => { type => 'integer', not_null => 1 },
24
    previous_fb_number      => { type => 'integer', not_null => 1 },
25
    is_template             => { type => 'boolean', default => 'false' },
26
    itime                   => { type => 'timestamp', default => 'now()' },
27
    mtime                   => { type => 'timestamp' },
28
  ],
29

  
30
  primary_key_columns => [ 'id' ],
31

  
32
  allow_inline_column_values => 1,
33

  
34
  foreign_keys => [
35
    customer => {
36
      class       => 'SL::DB::Customer',
37
      key_columns => { customer_id => 'id' },
38
    },
39

  
40
    project => {
41
      class       => 'SL::DB::Project',
42
      key_columns => { project_id => 'id' },
43
    },
44

  
45
    status => {
46
      class       => 'SL::DB::RequirementSpecStatus',
47
      key_columns => { status_id => 'id' },
48
    },
49

  
50
    type => {
51
      class       => 'SL::DB::RequirementSpecType',
52
      key_columns => { type_id => 'id' },
53
    },
54

  
55
    version => {
56
      class       => 'SL::DB::RequirementSpecVersion',
57
      key_columns => { version_id => 'id' },
58
    },
59

  
60
    working_copy => {
61
      class       => 'SL::DB::RequirementSpec',
62
      key_columns => { working_copy_id => 'id' },
63
    },
64
  ],
65
);
66

  
67
1;
68
;
SL/DB/MetaSetup/RequirementSpecAcceptanceStatus.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::RequirementSpecAcceptanceStatus;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_acceptance_statuses',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    name        => { type => 'text', not_null => 1 },
15
    description => { type => 'text' },
16
    position    => { type => 'integer', not_null => 1 },
17
    itime       => { type => 'timestamp', default => 'now()' },
18
    mtime       => { type => 'timestamp' },
19
  ],
20

  
21
  primary_key_columns => [ 'id' ],
22

  
23
  unique_key => [ 'name', 'description' ],
24

  
25
  allow_inline_column_values => 1,
26
);
27

  
28
1;
29
;
SL/DB/MetaSetup/RequirementSpecComplexity.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::RequirementSpecComplexity;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_complexities',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    description => { type => 'text', not_null => 1 },
15
    position    => { type => 'integer', not_null => 1 },
16
    itime       => { type => 'timestamp', default => 'now()' },
17
    mtime       => { type => 'timestamp' },
18
  ],
19

  
20
  primary_key_columns => [ 'id' ],
21

  
22
  unique_key => [ 'description' ],
23

  
24
  allow_inline_column_values => 1,
25
);
26

  
27
1;
28
;
SL/DB/MetaSetup/RequirementSpecDependency.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::RequirementSpecDependency;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_item_dependencies',
11

  
12
  columns => [
13
    depending_item_id => { type => 'integer', not_null => 1 },
14
    depended_item_id  => { type => 'integer', not_null => 1 },
15
  ],
16

  
17
  primary_key_columns => [ 'depending_item_id', 'depended_item_id' ],
18
);
19

  
20
1;
21
;
SL/DB/MetaSetup/RequirementSpecItem.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::RequirementSpecItem;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_items',
11

  
12
  columns => [
13
    id                   => { type => 'serial', not_null => 1 },
14
    requirement_spec_id  => { type => 'integer', not_null => 1 },
15
    parent_id            => { type => 'integer' },
16
    position             => { type => 'integer', not_null => 1 },
17
    fb_number            => { type => 'text', not_null => 1 },
18
    title                => { type => 'text' },
19
    description          => { type => 'text' },
20
    complexity_id        => { type => 'integer' },
21
    risk_id              => { type => 'integer' },
22
    time_estimation      => { type => 'numeric', default => '0', not_null => 1, precision => 2, scale => 12 },
23
    net_sum              => { type => 'numeric', default => '0', not_null => 1, precision => 2, scale => 12 },
24
    is_flagged           => { type => 'boolean', default => 'false', not_null => 1 },
25
    acceptance_status_id => { type => 'integer' },
26
    acceptance_text      => { type => 'text' },
27
    itime                => { type => 'timestamp', default => 'now()', not_null => 1 },
28
    mtime                => { type => 'timestamp' },
29
  ],
30

  
31
  primary_key_columns => [ 'id' ],
32

  
33
  allow_inline_column_values => 1,
34

  
35
  foreign_keys => [
36
    acceptance_status => {
37
      class       => 'SL::DB::RequirementSpecAcceptanceStatus',
38
      key_columns => { acceptance_status_id => 'id' },
39
    },
40

  
41
    complexity => {
42
      class       => 'SL::DB::RequirementSpecComplexity',
43
      key_columns => { complexity_id => 'id' },
44
    },
45

  
46
    parent => {
47
      class       => 'SL::DB::RequirementSpecItem',
48
      key_columns => { parent_id => 'id' },
49
    },
50
  ],
51

  
52
  relationships => [
53
    depended_items => {
54
      map_class => 'SL::DB::RequirementSpecDependency',
55
      map_from  => 'depending_item',
56
      map_to    => 'depended_item',
57
      type      => 'many to many',
58
    },
59

  
60
    depending_items => {
61
      map_class => 'SL::DB::RequirementSpecDependency',
62
      map_from  => 'depended_item',
63
      map_to    => 'depending_item',
64
      type      => 'many to many',
65
    },
66
  ],
67
);
68

  
69
1;
70
;
SL/DB/MetaSetup/RequirementSpecPredefinedText.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::RequirementSpecPredefinedText;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_predefined_texts',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    description => { type => 'text', not_null => 1 },
15
    title       => { type => 'text', not_null => 1 },
16
    text        => { type => 'text', not_null => 1 },
17
    position    => { type => 'integer', not_null => 1 },
18
    itime       => { type => 'timestamp', default => 'now()' },
19
    mtime       => { type => 'timestamp' },
20
  ],
21

  
22
  primary_key_columns => [ 'id' ],
23

  
24
  unique_key => [ 'description' ],
25

  
26
  allow_inline_column_values => 1,
27
);
28

  
29
1;
30
;
SL/DB/MetaSetup/RequirementSpecRisk.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::RequirementSpecRisk;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_risks',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    description => { type => 'text', not_null => 1 },
15
    position    => { type => 'integer', not_null => 1 },
16
    itime       => { type => 'timestamp', default => 'now()' },
17
    mtime       => { type => 'timestamp' },
18
  ],
19

  
20
  primary_key_columns => [ 'id' ],
21

  
22
  unique_key => [ 'description' ],
23

  
24
  allow_inline_column_values => 1,
25
);
26

  
27
1;
28
;
SL/DB/MetaSetup/RequirementSpecStatus.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::RequirementSpecStatus;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_statuses',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    name        => { type => 'text', not_null => 1 },
15
    description => { type => 'text', not_null => 1 },
16
    position    => { type => 'integer', not_null => 1 },
17
    itime       => { type => 'timestamp', default => 'now()' },
18
    mtime       => { type => 'timestamp' },
19
  ],
20

  
21
  primary_key_columns => [ 'id' ],
22

  
23
  unique_key => [ 'name', 'description' ],
24

  
25
  allow_inline_column_values => 1,
26
);
27

  
28
1;
29
;
SL/DB/MetaSetup/RequirementSpecTextBlock.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::RequirementSpecTextBlock;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_text_blocks',
11

  
12
  columns => [
13
    id                  => { type => 'serial', not_null => 1 },
14
    requirement_spec_id => { type => 'integer', not_null => 1 },
15
    title               => { type => 'text', not_null => 1 },
16
    text                => { type => 'text' },
17
    position            => { type => 'integer', not_null => 1 },
18
    output_position     => { type => 'integer', default => 1, not_null => 1 },
19
    itime               => { type => 'timestamp', default => 'now()', not_null => 1 },
20
    mtime               => { type => 'timestamp' },
21
  ],
22

  
23
  primary_key_columns => [ 'id' ],
24

  
25
  allow_inline_column_values => 1,
26
);
27

  
28
1;
29
;
SL/DB/MetaSetup/RequirementSpecType.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::RequirementSpecType;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_types',
11

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    description => { type => 'text', not_null => 1 },
15
    position    => { type => 'integer', not_null => 1 },
16
    itime       => { type => 'timestamp', default => 'now()' },
17
    mtime       => { type => 'timestamp' },
18
  ],
19

  
20
  primary_key_columns => [ 'id' ],
21

  
22
  unique_key => [ 'description' ],
23

  
24
  allow_inline_column_values => 1,
25
);
26

  
27
1;
28
;
SL/DB/MetaSetup/RequirementSpecVersion.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::RequirementSpecVersion;
4

  
5
use strict;
6

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

  
9
__PACKAGE__->meta->setup(
10
  table   => 'requirement_spec_versions',
11

  
12
  columns => [
13
    id             => { type => 'serial', not_null => 1 },
14
    version_number => { type => 'integer' },
15
    description    => { type => 'text', not_null => 1 },
16
    comment        => { type => 'text' },
17
    order_date     => { type => 'date' },
18
    order_number   => { type => 'text' },
19
    order_id       => { type => 'integer' },
20
    itime          => { type => 'timestamp', default => 'now()' },
21
    mtime          => { type => 'timestamp' },
22
  ],
23

  
24
  primary_key_columns => [ 'id' ],
25

  
26
  allow_inline_column_values => 1,
27

  
28
  foreign_keys => [
29
    order => {
30
      class       => 'SL::DB::Order',
31
      key_columns => { order_id => 'id' },
32
    },
33
  ],
34
);
35

  
36
1;
37
;
SL/DB/RequirementSpec.pm
1
package SL::DB::RequirementSpec;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpec;
6
use SL::Locale::String;
7

  
8
__PACKAGE__->meta->add_relationship(
9
  items          => {
10
    type         => 'one to many',
11
    class        => 'SL::DB::RequirementSpecItem',
12
    column_map   => { id => 'requirement_spec_id' },
13
  },
14
  text_blocks    => {
15
    type         => 'one to many',
16
    class        => 'SL::DB::RequirementSpecTextBlock',
17
    column_map   => { id => 'requirement_spec_id' },
18
  },
19
);
20

  
21
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
22
__PACKAGE__->meta->make_manager_class;
23

  
24
__PACKAGE__->meta->initialize;
25

  
26
sub validate {
27
  my ($self) = @_;
28

  
29
  my @errors;
30
  push @errors, t8('The title is missing.') if !$self->title;
31

  
32
  return @errors;
33
}
34

  
35
1;
SL/DB/RequirementSpecAcceptanceStatus.pm
1
package SL::DB::RequirementSpecAcceptanceStatus;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecAcceptanceStatus;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16
  push @errors, t8('The description is missing.') if !$self->description;
17

  
18
  return @errors;
19
}
20

  
21
1;
SL/DB/RequirementSpecComplexity.pm
1
package SL::DB::RequirementSpecComplexity;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecComplexity;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16
  push @errors, t8('The description is missing.') if !$self->description;
17

  
18
  return @errors;
19
}
20

  
21
1;
SL/DB/RequirementSpecDependency.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::RequirementSpecDependency;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::RequirementSpecDependency;
9

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11
__PACKAGE__->meta->make_manager_class;
12

  
13
1;
SL/DB/RequirementSpecItem.pm
1
package SL::DB::RequirementSpecItem;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecItem;
6

  
7
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
8
__PACKAGE__->meta->make_manager_class;
9

  
10
1;
SL/DB/RequirementSpecPredefinedText.pm
1
package SL::DB::RequirementSpecPredefinedText;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecPredefinedText;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16
  push @errors, t8('The title is missing.')       if !$self->title;
17
  push @errors, t8('The description is missing.') if !$self->description;
18

  
19
  return @errors;
20
}
21

  
22
1;
SL/DB/RequirementSpecRisk.pm
1
package SL::DB::RequirementSpecRisk;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecRisk;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16
  push @errors, t8('The description is missing.') if !$self->description;
17

  
18
  return @errors;
19
}
20

  
21
1;
SL/DB/RequirementSpecStatus.pm
1
package SL::DB::RequirementSpecStatus;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecStatus;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16

  
17
  push @errors, t8('The name is missing.')        if !$self->name;
18
  push @errors, t8('The description is missing.') if !$self->description;
19

  
20
  return @errors;
21
}
22

  
23
1;
SL/DB/RequirementSpecTextBlock.pm
1
package SL::DB::RequirementSpecTextBlock;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecTextBlock;
6
# ActsAsList does not support position arguments grouped by other
7
# columns, e.g. by the requirement_spec_id in this case. So we cannot
8
# use it yet.
9
# use SL::DB::Helper::ActsAsList;
10
use SL::Locale::String;
11

  
12
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
13
__PACKAGE__->meta->make_manager_class;
14

  
15
sub validate {
16
  my ($self) = @_;
17

  
18
  my @errors;
19
  push @errors, t8('The title is missing.') if !$self->title;
20

  
21
  return @errors;
22
}
23

  
24
1;
SL/DB/RequirementSpecType.pm
1
package SL::DB::RequirementSpecType;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecType;
6
use SL::DB::Helper::ActsAsList;
7
use SL::Locale::String;
8

  
9
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
10
__PACKAGE__->meta->make_manager_class;
11

  
12
sub validate {
13
  my ($self) = @_;
14

  
15
  my @errors;
16
  push @errors, t8('The description is missing.') if !$self->description;
17

  
18
  return @errors;
19
}
20

  
21
1;
SL/DB/RequirementSpecVersion.pm
1
package SL::DB::RequirementSpecVersion;
2

  
3
use strict;
4

  
5
use SL::DB::MetaSetup::RequirementSpecVersion;
6
use SL::Locale::String;
7

  
8
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
9
__PACKAGE__->meta->make_manager_class;
10

  
11
sub validate {
12
  my ($self) = @_;
13

  
14
  my @errors;
15
  push @errors, t8('The version number is missing.') if !$self->version_number;
16
  push @errors, t8('The description is missing.')    if !$self->description;
17

  
18
  return @errors;
19
}
20

  
21
1;
locale/de/all
2269 2269
  'The task server was stopped successfully.' => 'Der Task-Server wurde erfolgreich beendet.',
2270 2270
  'The third way is to download the module from the above mentioned URL and to install the module manually following the installations instructions contained in the source archive.' => 'Die dritte Variante besteht darin, das Paket von der oben genannten URL herunterzuladen und es manuell zu installieren. Beachten Sie dabei die im Paket enthaltenen Installationsanweisungen.',
2271 2271
  'The three columns "make_X", "model_X" and "lastcost_X" with the same number "X" are used to import vendor part numbers and vendor prices.' => 'Die drei Spalten "make_X", "model_X" und "lastcost_X" mit derselben Nummer "X" werden zum Import von Lieferantenartikelnummern und -preisen genutzt.',
2272
  'The title is missing.'       => 'Der Titel fehlt.',
2272 2273
  'The transaction is shown below in its current state.' => 'Nachfolgend wird angezeigt, wie die Buchung momentan aussieht.',
2273 2274
  'The type is missing.'        => 'Der Typ fehlt.',
2274 2275
  'The unit has been saved.'    => 'Die Einheit wurde gespeichert.',
......
2285 2286
  'The user has been deleted.'  => 'Der Benutzer wurde gelöscht.',
2286 2287
  'The user has been saved.'    => 'Der Benutzer wurde gespeichert.',
2287 2288
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken',
2289
  'The version number is missing.' => 'Die Versionsnummer fehlt.',
2288 2290
  'The warehouse could not be deleted because it has already been used.' => 'Das Lager konnte nicht gelöscht werden, da es bereits in Benutzung war.',
2289 2291
  'The warehouse does not contain any bins.' => 'Das Lager enthält keine Lagerplätze.',
2290 2292
  'The warehouse or the bin is missing.' => 'Das Lager oder der Lagerplatz fehlen.',
sql/Pg-upgrade2/requirement_specs.sql
1
-- @tag: requirement_specs
2
-- @description: Pflichtenhefte
3
-- @depends: release_3_0_0
4
-- @charset: utf-8
5

  
6
-- Nur für Entwicklungszwecke:
7

  
8
-- DELETE FROM schema_info WHERE tag = 'requirement_specs';
9

  
10
-- BEGIN;
11
-- DROP TABLE requirement_spec_item_dependencies;
12
-- DROP TABLE requirement_spec_items;
13
-- DROP TABLE requirement_spec_text_blocks;
14
-- DROP TABLE requirement_specs;
15
-- DROP TABLE requirement_spec_versions;
16
-- DROP TABLE requirement_spec_predefined_texts;
17
-- DROP TABLE requirement_spec_types;
18
-- DROP TABLE requirement_spec_statuses;
19
-- DROP TABLE requirement_spec_risks;
20
-- DROP TABLE requirement_spec_complexities;
21
-- DROP TABLE requirement_spec_acceptance_statuses;
22
-- ALTER TABLE customer DROP COLUMN hourly_rate;
23
-- ALTER TABLE defaults DROP COLUMN requirement_spec_section_number_format;
24
-- ALTER TABLE defaults DROP COLUMN requirement_spec_function_block_number_format;
25

  
26
CREATE TABLE requirement_spec_acceptance_statuses (
27
       id          SERIAL,
28
       name        TEXT      NOT NULL,
29
       description TEXT,
30
       position    INTEGER   NOT NULL,
31
       itime       TIMESTAMP DEFAULT now(),
32
       mtime       TIMESTAMP,
33

  
34
       PRIMARY KEY (id),
35
       UNIQUE (name, description)
36
);
37
CREATE TRIGGER mtime_requirement_spec_acceptance_statuses BEFORE UPDATE ON requirement_spec_acceptance_statuses FOR EACH ROW EXECUTE PROCEDURE set_mtime();
38

  
39
INSERT INTO requirement_spec_acceptance_statuses (name, description, position) VALUES ('accepted',                          'Abgenommen',                                1);
40
INSERT INTO requirement_spec_acceptance_statuses (name, description, position) VALUES ('accepted_with_defects',             'Mit Mängeln abgenommen',                    2);
41
INSERT INTO requirement_spec_acceptance_statuses (name, description, position) VALUES ('accepted_with_defects_to_be_fixed', 'Mit noch zu behebenden Mängeln abgenommen', 3);
42
INSERT INTO requirement_spec_acceptance_statuses (name, description, position) VALUES ('not_accepted',                      'Nicht abgenommen',                          4);
43

  
44

  
45

  
46
CREATE TABLE requirement_spec_complexities (
47
       id          SERIAL,
48
       description TEXT      NOT NULL,
49
       position    INTEGER   NOT NULL,
50
       itime       TIMESTAMP DEFAULT now(),
51
       mtime       TIMESTAMP,
52

  
53
       PRIMARY KEY (id),
54
       UNIQUE (description)
55
);
56
CREATE TRIGGER mtime_requirement_spec_complexities BEFORE UPDATE ON requirement_spec_complexities FOR EACH ROW EXECUTE PROCEDURE set_mtime();
57

  
58
INSERT INTO requirement_spec_complexities (description, position) VALUES ('nicht bewertet',  1);
59
INSERT INTO requirement_spec_complexities (description, position) VALUES ('nur Anforderung', 2);
60
INSERT INTO requirement_spec_complexities (description, position) VALUES ('gering',          3);
61
INSERT INTO requirement_spec_complexities (description, position) VALUES ('mittel',          4);
62
INSERT INTO requirement_spec_complexities (description, position) VALUES ('hoch',            5);
63

  
64

  
65

  
66
CREATE TABLE requirement_spec_risks (
67
       id          SERIAL,
68
       description TEXT      NOT NULL,
69
       position    INTEGER   NOT NULL,
70
       itime       TIMESTAMP DEFAULT now(),
71
       mtime       TIMESTAMP,
72

  
73
       PRIMARY KEY (id),
74
       UNIQUE (description)
75
);
76
CREATE TRIGGER mtime_requirement_spec_risks BEFORE UPDATE ON requirement_spec_risks FOR EACH ROW EXECUTE PROCEDURE set_mtime();
77

  
78
INSERT INTO requirement_spec_risks (description, position) VALUES ('nicht bewertet',  1);
79
INSERT INTO requirement_spec_risks (description, position) VALUES ('nur Anforderung', 2);
80
INSERT INTO requirement_spec_risks (description, position) VALUES ('gering',          3);
81
INSERT INTO requirement_spec_risks (description, position) VALUES ('mittel',          4);
82
INSERT INTO requirement_spec_risks (description, position) VALUES ('hoch',            5);
83

  
84

  
85

  
86
CREATE TABLE requirement_spec_statuses (
87
       id          SERIAL,
88
       name        TEXT      NOT NULL,
89
       description TEXT      NOT NULL,
90
       position    INTEGER   NOT NULL,
91
       itime       TIMESTAMP DEFAULT now(),
92
       mtime       TIMESTAMP,
93

  
94
       PRIMARY KEY (id),
95
       UNIQUE (name, description)
96
);
97
CREATE TRIGGER mtime_requirement_spec_statuses BEFORE UPDATE ON requirement_spec_statuses FOR EACH ROW EXECUTE PROCEDURE set_mtime();
98

  
99
INSERT INTO requirement_spec_statuses (name, description, position) VALUES ('planning', 'In Planung',     1);
100
INSERT INTO requirement_spec_statuses (name, description, position) VALUES ('running',  'In Bearbeitung', 2);
101
INSERT INTO requirement_spec_statuses (name, description, position) VALUES ('done',     'Fertiggestellt', 3);
102

  
103

  
104

  
105
CREATE TABLE requirement_spec_types (
106
       id          SERIAL,
107
       description TEXT      NOT NULL,
108
       position    INTEGER   NOT NULL,
109
       itime       TIMESTAMP DEFAULT now(),
110
       mtime       TIMESTAMP,
111

  
112
       PRIMARY KEY (id),
113
       UNIQUE (description)
114
);
115
CREATE TRIGGER mtime_requirement_spec_types BEFORE UPDATE ON requirement_spec_types FOR EACH ROW EXECUTE PROCEDURE set_mtime();
116

  
117
INSERT INTO requirement_spec_types (description, position) VALUES ('Pflichtenheft', 1);
118
INSERT INTO requirement_spec_types (description, position) VALUES ('Konzept',       2);
119

  
120

  
121

  
122
CREATE TABLE requirement_spec_predefined_texts (
123
       id          SERIAL,
124
       description TEXT      NOT NULL,
125
       title       TEXT      NOT NULL,
126
       text        TEXT      NOT NULL,
127
       position    INTEGER   NOT NULL,
128
       itime       TIMESTAMP DEFAULT now(),
129
       mtime       TIMESTAMP,
130

  
131
       PRIMARY KEY (id),
132
       UNIQUE (description)
133
);
134
CREATE TRIGGER mtime_requirement_spec_predefined_texts BEFORE UPDATE ON requirement_spec_predefined_texts FOR EACH ROW EXECUTE PROCEDURE set_mtime();
135

  
136

  
137

  
138
CREATE TABLE requirement_spec_versions (
139
       id             SERIAL,
140
       version_number INTEGER,
141
       description    TEXT NOT NULL,
142
       comment        TEXT,
143
       order_date     DATE,
144
       order_number   TEXT,
145
       order_id       INTEGER,
146
       itime          TIMESTAMP DEFAULT now(),
147
       mtime          TIMESTAMP,
148

  
149
       PRIMARY KEY (id),
150
       FOREIGN KEY (order_id) REFERENCES oe (id)
151
);
152
CREATE TRIGGER mtime_requirement_spec_versions BEFORE UPDATE ON requirement_spec_versions FOR EACH ROW EXECUTE PROCEDURE set_mtime();
153

  
154

  
155

  
156
CREATE TABLE requirement_specs (
157
       id                      SERIAL,
158
       type_id                 INTEGER        NOT NULL,
159
       status_id               INTEGER        NOT NULL,
160
       version_id              INTEGER,
161
       customer_id             INTEGER        NOT NULL,
162
       project_id              INTEGER,
163
       title                   TEXT           NOT NULL,
164
       hourly_rate             NUMERIC(8, 2)  NOT NULL DEFAULT 0,
165
       net_sum                 NUMERIC(12, 2) NOT NULL DEFAULT 0,
166
       working_copy_id         INTEGER,
167
       previous_section_number INTEGER        NOT NULL,
168
       previous_fb_number      INTEGER        NOT NULL,
169
       is_template             BOOLEAN                 DEFAULT FALSE,
170
       itime                   TIMESTAMP               DEFAULT now(),
171
       mtime                   TIMESTAMP,
172

  
173
       PRIMARY KEY (id),
174
       FOREIGN KEY (type_id)         REFERENCES requirement_spec_types    (id),
175
       FOREIGN KEY (status_id)       REFERENCES requirement_spec_statuses (id),
176
       FOREIGN KEY (version_id)      REFERENCES requirement_spec_versions (id),
177
       FOREIGN KEY (working_copy_id) REFERENCES requirement_specs         (id),
178
       FOREIGN KEY (customer_id)     REFERENCES customer                  (id),
179
       FOREIGN KEY (project_id)      REFERENCES project                   (id)
180
);
181
CREATE TRIGGER mtime_requirement_specs BEFORE UPDATE ON requirement_specs FOR EACH ROW EXECUTE PROCEDURE set_mtime();
182

  
183

  
184

  
185
CREATE TABLE requirement_spec_text_blocks (
186
       id                  SERIAL,
187
       requirement_spec_id INTEGER   NOT NULL,
188
       title               TEXT      NOT NULL,
189
       text                TEXT,
190
       position            INTEGER   NOT NULL,
191
       output_position     INTEGER   NOT NULL DEFAULT 1,
192
       itime               TIMESTAMP NOT NULL DEFAULT now(),
193
       mtime               TIMESTAMP,
194

  
195
       PRIMARY KEY (id),
196
       FOREIGN KEY (requirement_spec_id) REFERENCES requirement_specs (id)
197
);
198
CREATE TRIGGER mtime_requirement_spec_text_blocks BEFORE UPDATE ON requirement_spec_text_blocks FOR EACH ROW EXECUTE PROCEDURE set_mtime();
199

  
200

  
201
CREATE TABLE requirement_spec_items (
202
       id                   SERIAL,
203
       requirement_spec_id  INTEGER        NOT NULL,
204
       item_type            TEXT           NOT NULL,
205
       parent_id            INTEGER,
206
       position             INTEGER        NOT NULL,
207
       fb_number            TEXT           NOT NULL,
208
       title                TEXT,
209
       description          TEXT,
210
       complexity_id        INTEGER,
211
       risk_id              INTEGER,
212
       time_estimation      NUMERIC(12, 2) NOT NULL DEFAULT 0,
213
       net_sum              NUMERIC(12, 2) NOT NULL DEFAULT 0,
214
       is_flagged           BOOLEAN        NOT NULL DEFAULT FALSE,
215
       acceptance_status_id INTEGER,
216
       acceptance_text      TEXT,
217
       itime                TIMESTAMP      NOT NULL DEFAULT now(),
218
       mtime                TIMESTAMP,
219

  
220
       PRIMARY KEY (id),
221
       FOREIGN KEY (requirement_spec_id)  REFERENCES requirement_specs (id),
222
       FOREIGN KEY (parent_id)            REFERENCES requirement_spec_items (id),
223
       FOREIGN KEY (complexity_id)        REFERENCES requirement_spec_complexities (id),
224
       FOREIGN KEY (risk_id)              REFERENCES requirement_spec_risks (id),
225
       FOREIGN KEY (acceptance_status_id) REFERENCES requirement_spec_acceptance_statuses (id),
226

  
227
       CONSTRAINT valid_item_type CHECK ((item_type = 'section') OR (item_type = 'function-block') OR (item_type = 'sub-function-block')),
228
       CONSTRAINT valid_parent_id_for_item_type CHECK (CASE
229
         WHEN (item_type = 'section') THEN parent_id IS NULL
230
         ELSE                              parent_id IS NOT NULL
231
       END)
232
);
233
CREATE TRIGGER mtime_requirement_spec_items BEFORE UPDATE ON requirement_spec_items FOR EACH ROW EXECUTE PROCEDURE set_mtime();
234

  
235

  
236

  
237
CREATE TABLE requirement_spec_item_dependencies (
238
       depending_item_id INTEGER NOT NULL,
239
       depended_item_id  INTEGER NOT NULL,
240

  
241
       PRIMARY KEY (depending_item_id, depended_item_id),
242
       FOREIGN KEY (depending_item_id) REFERENCES requirement_spec_items (id),
243
       FOREIGN KEY (depended_item_id)  REFERENCES requirement_spec_items (id)
244
);
245

  
246
ALTER TABLE customer ADD COLUMN hourly_rate NUMERIC(8, 2);
247

  
248

  
249
-- Trigger for updating time_estimation of function blocks from their
250
-- children (not for sections, not for sub function blocks).
251
CREATE OR REPLACE FUNCTION update_requirement_spec_item_time_estimation(item_id INTEGER) RETURNS BOOLEAN AS $$
252
  DECLARE
253
    item   RECORD;
254
    parent RECORD;
255
  BEGIN
256
    IF item_id IS NULL THEN
257
      RAISE DEBUG 'updateRSIE: item_id IS NULL';
258
      RETURN FALSE;
259
    END IF;
260

  
261
    SELECT * INTO item FROM requirement_spec_items WHERE id = item_id;
262
    RAISE DEBUG 'updateRSIE: item_id % parent_id %', item_id, item.parent_id;
263

  
264
    IF item.parent_id IS NULL THEN
265
      -- Don't do anything for sections.
266
      RAISE DEBUG 'updateRSIE: this is a section.';
267
      RETURN FALSE;
268
    END IF;
269

  
270
    SELECT * INTO parent FROM requirement_spec_items WHERE id = item.parent_id;
271
    RAISE DEBUG 'updateRSIE: parent_id of parent of item: %', parent.parent_id;
272

  
273
    IF parent.parent_id IS NOT NULL THEN
274
      -- Don't do anything for sub function blocks.
275
      RAISE DEBUG 'updateRSIE: this is sub function block.';
276
      RETURN FALSE;
277
    END IF;
278

  
279
    RAISE DEBUG 'updateRSIE: will do stuff now';
280

  
281
    UPDATE requirement_spec_items
282
      SET time_estimation = COALESCE((
283
        SELECT SUM(time_estimation)
284
        FROM requirement_spec_items
285
        WHERE parent_id = item_id
286
      ), 0)
287
      WHERE id = item_id;
288

  
289
    RETURN TRUE;
290
  END;
291
$$ LANGUAGE plpgsql;
292

  
293
CREATE OR REPLACE FUNCTION requirement_spec_item_time_estimation_updater_trigger() RETURNS trigger AS $$
294
  BEGIN
295
    IF ((TG_OP = 'UPDATE') OR (TG_OP = 'DELETE')) THEN
296
      PERFORM update_requirement_spec_item_time_estimation(OLD.parent_id);
297
    END IF;
298
    IF ((TG_OP = 'UPDATE') OR (TG_OP = 'INSERT')) THEN
299
      PERFORM update_requirement_spec_item_time_estimation(NEW.parent_id);
300
    END IF;
301
    RETURN NULL;
302
  END;
303
$$ LANGUAGE plpgsql;
304

  
305
DROP TRIGGER IF EXISTS update_requirement_spec_item_time_estimation ON requirement_spec_items;
306
CREATE TRIGGER update_requirement_spec_item_time_estimation
307
AFTER INSERT OR UPDATE OR DELETE ON requirement_spec_items
308
FOR EACH ROW EXECUTE PROCEDURE requirement_spec_item_time_estimation_updater_trigger();
309

  
310

  
311
-- Trigger for deleting depending stuff if a requirement spec item is deleted.
312
CREATE OR REPLACE FUNCTION requirement_spec_item_before_delete_trigger() RETURNS trigger AS $$
313
  BEGIN
314
    RAISE DEBUG 'delete trig RSitem old id %', OLD.id;
315
    DELETE FROM requirement_spec_item_dependencies WHERE (depending_item_id = OLD.id) OR (depended_item_id = OLD.id);
316
    DELETE FROM requirement_spec_items             WHERE (parent_id         = OLD.id);
317

  
318
    RETURN OLD;
319
  END;
320
$$ LANGUAGE plpgsql;
321

  
322
DROP TRIGGER IF EXISTS delete_requirement_spec_item_dependencies ON requirement_spec_items;
323
CREATE TRIGGER delete_requirement_spec_item_dependencies
324
BEFORE DELETE ON requirement_spec_items
325
FOR EACH ROW EXECUTE PROCEDURE requirement_spec_item_before_delete_trigger();
326

  
327

  
328
-- Trigger for deleting depending stuff if a requirement spec is deleted.
329
CREATE OR REPLACE FUNCTION requirement_spec_delete_trigger() RETURNS trigger AS $$
330
  DECLARE
331
    tname TEXT;
332
  BEGIN
333
    tname := 'tmp_delete_reqspec' || OLD.id;
334

  
335
    IF TG_WHEN = 'AFTER' THEN
336
      RAISE DEBUG 'after trigger on %; deleting from versions', OLD.id;
337
      EXECUTE 'DELETE FROM requirement_spec_versions ' ||
338
              'WHERE id IN (SELECT version_id FROM ' || tname || ')';
339

  
340
      RAISE DEBUG '  dropping table';
341
      EXECUTE 'DROP TABLE ' || tname;
342

  
343
      RETURN OLD;
344
    END IF;
345

  
346
    RAISE DEBUG 'before delete trigger on %', OLD.id;
347

  
348
    EXECUTE 'CREATE TEMPORARY TABLE ' || tname || ' AS ' ||
349
      'SELECT DISTINCT version_id '     ||
350
      'FROM requirement_specs '         ||
351
      'WHERE (version_id IS NOT NULL) ' ||
352
      '  AND ((id = ' || OLD.id || ') OR (working_copy_id = ' || OLD.id || '))';
353

  
354
    RAISE DEBUG '  Updating version_id and items for %', OLD.id;
355
    UPDATE requirement_specs      SET version_id = NULL                        WHERE (id <> OLD.id) AND (working_copy_id = OLD.id);
356
    UPDATE requirement_spec_items SET item_type  = 'section', parent_id = NULL WHERE requirement_spec_id = OLD.id;
357

  
358
    RAISE DEBUG '  Deleting stuff for %', OLD.id;
359

  
360
    DELETE FROM requirement_spec_text_blocks WHERE (requirement_spec_id = OLD.id);
361
    DELETE FROM requirement_spec_items       WHERE (requirement_spec_id = OLD.id);
362
    DELETE FROM requirement_specs            WHERE (working_copy_id     = OLD.id);
363

  
364
    RAISE DEBUG '  And we out for %', OLD.id;
365

  
366
    RETURN OLD;
367
  END;
368
$$ LANGUAGE plpgsql;
369

  
370
DROP TRIGGER IF EXISTS delete_requirement_spec_dependencies ON requirement_specs;
371
CREATE TRIGGER delete_requirement_spec_dependencies
372
BEFORE DELETE ON requirement_specs
373
FOR EACH ROW EXECUTE PROCEDURE requirement_spec_delete_trigger();
374

  
375
DROP TRIGGER IF EXISTS after_delete_requirement_spec_dependencies ON requirement_specs;
376
CREATE TRIGGER after_delete_requirement_spec_dependencies
377
AFTER DELETE ON requirement_specs
378
FOR EACH ROW EXECUTE PROCEDURE requirement_spec_delete_trigger();
379

  
380

  
381
-- Add formats for section/function block numbers to defaults
382
ALTER TABLE defaults ADD   COLUMN requirement_spec_section_number_format        TEXT;
383
ALTER TABLE defaults ALTER COLUMN requirement_spec_section_number_format        SET DEFAULT 'A00';
384
ALTER TABLE defaults ADD   COLUMN requirement_spec_function_block_number_format TEXT;
385
ALTER TABLE defaults ALTER COLUMN requirement_spec_function_block_number_format SET DEFAULT 'FB000';
386

  
387
UPDATE defaults SET requirement_spec_section_number_format        = 'A00';
388
UPDATE defaults SET requirement_spec_function_block_number_format = 'FB000';
389

  
390
ALTER TABLE defaults ALTER COLUMN requirement_spec_section_number_format        SET NOT NULL;
391
ALTER TABLE defaults ALTER COLUMN requirement_spec_function_block_number_format SET NOT NULL;

Auch abrufbar als: Unified diff