Factur-X/ZUGFeRD: neues Feld »Unsere Leitweg-ID beim Kunden« in Kundenstammdaten
[kivitendo-erp.git] / SL / DB / MetaSetup / Customer.pm
index 82d808c..1daa719 100644 (file)
@@ -4,79 +4,110 @@ package SL::DB::Customer;
 
 use strict;
 
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
 
-__PACKAGE__->meta->setup(
-  table   => 'customer',
+__PACKAGE__->meta->table('customer');
 
-  columns => [
-    id                  => { type => 'integer', not_null => 1, sequence => 'id' },
-    name                => { type => 'text', not_null => 1 },
-    department_1        => { type => 'varchar', length => 75 },
-    department_2        => { type => 'varchar', length => 75 },
-    street              => { type => 'varchar', length => 75 },
-    zipcode             => { type => 'varchar', length => 10 },
-    city                => { type => 'varchar', length => 75 },
-    country             => { type => 'varchar', length => 75 },
-    contact             => { type => 'text' },
-    phone               => { type => 'text' },
-    fax                 => { type => 'varchar', length => 30 },
-    homepage            => { type => 'text' },
-    email               => { type => 'text' },
-    notes               => { type => 'text' },
-    discount            => { type => 'float', precision => 4 },
-    taxincluded         => { type => 'boolean' },
-    creditlimit         => { type => 'numeric', default => '0', precision => 5, scale => 15 },
-    terms               => { type => 'integer', default => '0' },
-    customernumber      => { type => 'text' },
-    cc                  => { type => 'text' },
-    bcc                 => { type => 'text' },
-    business_id         => { type => 'integer' },
-    taxnumber           => { type => 'text' },
-    account_number      => { type => 'text' },
-    bank_code           => { type => 'text' },
-    bank                => { type => 'text' },
-    language            => { type => 'varchar', length => 5 },
-    itime               => { type => 'timestamp', default => 'now()' },
-    mtime               => { type => 'timestamp' },
-    obsolete            => { type => 'boolean', default => 'false' },
-    username            => { type => 'varchar', length => 50 },
-    user_password       => { type => 'text' },
-    salesman_id         => { type => 'integer' },
-    c_vendor_id         => { type => 'text' },
-    klass               => { type => 'integer', default => '0' },
-    language_id         => { type => 'integer' },
-    payment_id          => { type => 'integer' },
-    taxzone_id          => { type => 'integer', default => '0', not_null => 1 },
-    greeting            => { type => 'text' },
-    ustid               => { type => 'text' },
-    iban                => { type => 'varchar', length => 100 },
-    bic                 => { type => 'varchar', length => 100 },
-    direct_debit        => { type => 'boolean', default => 'false' },
-    curr                => { type => 'text' },
-    taxincluded_checked => { type => 'boolean' },
-  ],
+__PACKAGE__->meta->columns(
+  account_number            => { type => 'text' },
+  bank                      => { type => 'text' },
+  bank_code                 => { type => 'text' },
+  bcc                       => { type => 'text' },
+  bic                       => { type => 'text' },
+  business_id               => { type => 'integer' },
+  c_vendor_id               => { type => 'text' },
+  c_vendor_routing_id       => { type => 'text' },
+  cc                        => { type => 'text' },
+  city                      => { type => 'text' },
+  commercial_court          => { type => 'text' },
+  contact                   => { type => 'text' },
+  contact_origin            => { type => 'text' },
+  country                   => { type => 'text' },
+  create_zugferd_invoices   => { type => 'integer', default => '-1', not_null => 1 },
+  creditlimit               => { type => 'numeric', default => '0', precision => 15, scale => 5 },
+  currency_id               => { type => 'integer', not_null => 1 },
+  customernumber            => { type => 'text' },
+  delivery_order_mail       => { type => 'text' },
+  delivery_term_id          => { type => 'integer' },
+  department_1              => { type => 'text' },
+  department_2              => { type => 'text' },
+  depositor                 => { type => 'text' },
+  direct_debit              => { type => 'boolean', default => 'false' },
+  discount                  => { type => 'float', precision => 4, scale => 4 },
+  email                     => { type => 'text' },
+  fax                       => { type => 'text' },
+  gln                       => { type => 'text' },
+  greeting                  => { type => 'text' },
+  homepage                  => { type => 'text' },
+  hourly_rate               => { type => 'numeric', precision => 8, scale => 2 },
+  iban                      => { type => 'text' },
+  id                        => { type => 'integer', not_null => 1, sequence => 'id' },
+  invoice_mail              => { type => 'text' },
+  itime                     => { type => 'timestamp', default => 'now()' },
+  language                  => { type => 'text' },
+  language_id               => { type => 'integer' },
+  mandate_date_of_signature => { type => 'date' },
+  mandator_id               => { type => 'text' },
+  mtime                     => { type => 'timestamp' },
+  name                      => { type => 'text', not_null => 1 },
+  natural_person            => { type => 'boolean', default => 'false' },
+  notes                     => { type => 'text' },
+  obsolete                  => { type => 'boolean', default => 'false' },
+  order_lock                => { type => 'boolean', default => 'false' },
+  payment_id                => { type => 'integer' },
+  phone                     => { type => 'text' },
+  pricegroup_id             => { type => 'integer' },
+  salesman_id               => { type => 'integer' },
+  street                    => { type => 'text' },
+  taxincluded               => { type => 'boolean' },
+  taxincluded_checked       => { type => 'boolean' },
+  taxnumber                 => { type => 'text' },
+  taxzone_id                => { type => 'integer', not_null => 1 },
+  user_password             => { type => 'text' },
+  username                  => { type => 'text' },
+  ustid                     => { type => 'text' },
+  zipcode                   => { type => 'text' },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+__PACKAGE__->meta->allow_inline_column_values(1);
+
+__PACKAGE__->meta->foreign_keys(
+  business => {
+    class       => 'SL::DB::Business',
+    key_columns => { business_id => 'id' },
+  },
+
+  currency => {
+    class       => 'SL::DB::Currency',
+    key_columns => { currency_id => 'id' },
+  },
 
-  primary_key_columns => [ 'id' ],
+  delivery_term => {
+    class       => 'SL::DB::DeliveryTerm',
+    key_columns => { delivery_term_id => 'id' },
+  },
 
-  allow_inline_column_values => 1,
+  language_obj => {
+    class       => 'SL::DB::Language',
+    key_columns => { language_id => 'id' },
+  },
 
-  foreign_keys => [
-    business => {
-      class       => 'SL::DB::Business',
-      key_columns => { business_id => 'id' },
-    },
+  payment => {
+    class       => 'SL::DB::PaymentTerm',
+    key_columns => { payment_id => 'id' },
+  },
 
-    language_obj => {
-      class       => 'SL::DB::Language',
-      key_columns => { language_id => 'id' },
-    },
+  pricegroup => {
+    class       => 'SL::DB::Pricegroup',
+    key_columns => { pricegroup_id => 'id' },
+  },
 
-    payment => {
-      class       => 'SL::DB::PaymentTerm',
-      key_columns => { payment_id => 'id' },
-    },
-  ],
+  taxzone => {
+    class       => 'SL::DB::TaxZone',
+    key_columns => { taxzone_id => 'id' },
+  },
 );
 
 1;