]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/MetaSetup/OrderItem.pm
kivitendo 3.9.2-0.2
[mfinanz.git] / SL / DB / MetaSetup / OrderItem.pm
index e83b65bda7d61aba4e91a4d506e8d75c27a6337c..4e1a6d213ac4e5647fdd2a2c62564f496773aca3 100644 (file)
@@ -9,37 +9,40 @@ use parent qw(SL::DB::Object);
 __PACKAGE__->meta->table('orderitems');
 
 __PACKAGE__->meta->columns(
-  active_discount_source => { type => 'text', default => '', not_null => 1 },
-  active_price_source    => { type => 'text', default => '', not_null => 1 },
-  base_qty               => { type => 'float', precision => 4, scale => 4 },
-  cusordnumber           => { type => 'text' },
-  description            => { type => 'text' },
-  discount               => { type => 'float', precision => 4, scale => 4 },
-  id                     => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
-  itime                  => { type => 'timestamp', default => 'now()' },
-  lastcost               => { type => 'numeric', precision => 15, scale => 5 },
-  longdescription        => { type => 'text' },
-  marge_percent          => { type => 'numeric', precision => 15, scale => 5 },
-  marge_price_factor     => { type => 'numeric', default => 1, precision => 15, scale => 5 },
-  marge_total            => { type => 'numeric', precision => 15, scale => 5 },
-  mtime                  => { type => 'timestamp' },
-  optional               => { type => 'boolean', default => 'false' },
-  ordnumber              => { type => 'text' },
-  parts_id               => { type => 'integer' },
-  position               => { type => 'integer', not_null => 1 },
-  price_factor           => { type => 'numeric', default => 1, precision => 15, scale => 5 },
-  price_factor_id        => { type => 'integer' },
-  pricegroup_id          => { type => 'integer' },
-  project_id             => { type => 'integer' },
-  qty                    => { type => 'numeric', precision => 25, scale => 5 },
-  reqdate                => { type => 'date' },
-  sellprice              => { type => 'numeric', precision => 15, scale => 5 },
-  serialnumber           => { type => 'text' },
-  ship                   => { type => 'float', precision => 4, scale => 4 },
-  subtotal               => { type => 'boolean', default => 'false' },
-  trans_id               => { type => 'integer' },
-  transdate              => { type => 'text' },
-  unit                   => { type => 'varchar', length => 20 },
+  active_discount_source       => { type => 'text', default => '', not_null => 1 },
+  active_price_source          => { type => 'text', default => '', not_null => 1 },
+  base_qty                     => { type => 'float', precision => 4, scale => 4 },
+  cusordnumber                 => { type => 'text' },
+  description                  => { type => 'text' },
+  discount                     => { type => 'float', precision => 4, scale => 4 },
+  id                           => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
+  itime                        => { type => 'timestamp', default => 'now()' },
+  lastcost                     => { type => 'numeric', precision => 15, scale => 5 },
+  longdescription              => { type => 'text' },
+  marge_percent                => { type => 'numeric', precision => 15, scale => 5 },
+  marge_price_factor           => { type => 'numeric', default => 1, precision => 15, scale => 5 },
+  marge_total                  => { type => 'numeric', precision => 15, scale => 5 },
+  mtime                        => { type => 'timestamp' },
+  optional                     => { type => 'boolean', default => 'false' },
+  orderer_id                   => { type => 'integer' },
+  ordnumber                    => { type => 'text' },
+  parts_id                     => { type => 'integer' },
+  position                     => { type => 'integer', not_null => 1 },
+  price_factor                 => { type => 'numeric', default => 1, precision => 15, scale => 5 },
+  price_factor_id              => { type => 'integer' },
+  pricegroup_id                => { type => 'integer' },
+  project_id                   => { type => 'integer' },
+  qty                          => { type => 'numeric', precision => 25, scale => 5 },
+  recurring_billing_invoice_id => { type => 'integer' },
+  recurring_billing_mode       => { type => 'enum', check_in => [ 'never', 'once', 'always' ], db_type => 'items_recurring_billing_mode', default => 'always', not_null => 1 },
+  reqdate                      => { type => 'date' },
+  sellprice                    => { type => 'numeric', precision => 15, scale => 5 },
+  serialnumber                 => { type => 'text' },
+  ship                         => { type => 'float', precision => 4, scale => 4 },
+  subtotal                     => { type => 'boolean', default => 'false' },
+  trans_id                     => { type => 'integer' },
+  transdate                    => { type => 'text' },
+  unit                         => { type => 'varchar', length => 20 },
 );
 
 __PACKAGE__->meta->primary_key_columns([ 'id' ]);
@@ -52,6 +55,11 @@ __PACKAGE__->meta->foreign_keys(
     key_columns => { trans_id => 'id' },
   },
 
+  orderer => {
+    class       => 'SL::DB::Employee',
+    key_columns => { orderer_id => 'id' },
+  },
+
   part => {
     class       => 'SL::DB::Part',
     key_columns => { parts_id => 'id' },
@@ -72,6 +80,11 @@ __PACKAGE__->meta->foreign_keys(
     key_columns => { project_id => 'id' },
   },
 
+  recurring_billing_invoice => {
+    class       => 'SL::DB::Invoice',
+    key_columns => { recurring_billing_invoice_id => 'id' },
+  },
+
   unit_obj => {
     class       => 'SL::DB::Unit',
     key_columns => { unit => 'name' },