Merge branch 'master' of ssh://lx-office/~/lx-office-erp
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 15 Sep 2010 10:57:20 +0000 (12:57 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 15 Sep 2010 10:57:20 +0000 (12:57 +0200)
219 files changed:
SL/DB.pm [new file with mode: 0644]
SL/DB/AccTrans.pm [new file with mode: 0644]
SL/DB/AccTransaction.pm [new file with mode: 0644]
SL/DB/Assembly.pm [new file with mode: 0644]
SL/DB/AuditTrail.pm [new file with mode: 0644]
SL/DB/BankAccount.pm [new file with mode: 0644]
SL/DB/Bin.pm [new file with mode: 0644]
SL/DB/Buchungsgruppe.pm [new file with mode: 0644]
SL/DB/Business.pm [new file with mode: 0644]
SL/DB/Chart.pm [new file with mode: 0644]
SL/DB/Contact.pm [new file with mode: 0644]
SL/DB/CustomVariable.pm [new file with mode: 0644]
SL/DB/CustomVariableConfig.pm [new file with mode: 0644]
SL/DB/CustomVariableValidity.pm [new file with mode: 0644]
SL/DB/Customer.pm [new file with mode: 0644]
SL/DB/CustomerTax.pm [new file with mode: 0644]
SL/DB/Datev.pm [new file with mode: 0644]
SL/DB/Default.pm [new file with mode: 0644]
SL/DB/DeliveryOrder.pm [new file with mode: 0644]
SL/DB/DeliveryOrderItem.pm [new file with mode: 0644]
SL/DB/DeliveryOrderItemsStock.pm [new file with mode: 0644]
SL/DB/Department.pm [new file with mode: 0644]
SL/DB/DptTrans.pm [new file with mode: 0644]
SL/DB/Draft.pm [new file with mode: 0644]
SL/DB/Dunning.pm [new file with mode: 0644]
SL/DB/DunningConfig.pm [new file with mode: 0644]
SL/DB/Employee.pm [new file with mode: 0644]
SL/DB/Exchangerate.pm [new file with mode: 0644]
SL/DB/Finanzamt.pm [new file with mode: 0644]
SL/DB/FollowUp.pm [new file with mode: 0644]
SL/DB/FollowUpAccess.pm [new file with mode: 0644]
SL/DB/FollowUpLink.pm [new file with mode: 0644]
SL/DB/GLTransaction.pm [new file with mode: 0644]
SL/DB/GenericTranslation.pm [new file with mode: 0644]
SL/DB/Gifi.pm [new file with mode: 0644]
SL/DB/Helpers/ALL.pm [new file with mode: 0644]
SL/DB/Helpers/Attr.pm [new file with mode: 0644]
SL/DB/Helpers/ConventionManager.pm [new file with mode: 0644]
SL/DB/Helpers/Manager.pm [new file with mode: 0644]
SL/DB/Helpers/Mappings.pm [new file with mode: 0644]
SL/DB/Helpers/Metadata.pm [new file with mode: 0644]
SL/DB/History.pm [new file with mode: 0644]
SL/DB/Inventory.pm [new file with mode: 0644]
SL/DB/Invoice.pm [new file with mode: 0644]
SL/DB/InvoiceItem.pm [new file with mode: 0644]
SL/DB/Language.pm [new file with mode: 0644]
SL/DB/Lead.pm [new file with mode: 0644]
SL/DB/License.pm [new file with mode: 0644]
SL/DB/LicenseInvoice.pm [new file with mode: 0644]
SL/DB/MakeModel.pm [new file with mode: 0644]
SL/DB/Manager/DeliveryOrder.pm [new file with mode: 0644]
SL/DB/Manager/Invoice.pm [new file with mode: 0644]
SL/DB/Manager/Order.pm [new file with mode: 0644]
SL/DB/Manager/Part.pm [new file with mode: 0644]
SL/DB/Manager/PurchaseInvoice.pm [new file with mode: 0644]
SL/DB/Manager/TransferType.pm [new file with mode: 0644]
SL/DB/MetaSetup/AccTrans.pm [new file with mode: 0644]
SL/DB/MetaSetup/AccTransaction.pm [new file with mode: 0644]
SL/DB/MetaSetup/Assembly.pm [new file with mode: 0644]
SL/DB/MetaSetup/AuditTrail.pm [new file with mode: 0644]
SL/DB/MetaSetup/BankAccount.pm [new file with mode: 0644]
SL/DB/MetaSetup/Bin.pm [new file with mode: 0644]
SL/DB/MetaSetup/Buchungsgruppe.pm [new file with mode: 0644]
SL/DB/MetaSetup/Business.pm [new file with mode: 0644]
SL/DB/MetaSetup/Chart.pm [new file with mode: 0644]
SL/DB/MetaSetup/Contact.pm [new file with mode: 0644]
SL/DB/MetaSetup/CustomVariable.pm [new file with mode: 0644]
SL/DB/MetaSetup/CustomVariableConfig.pm [new file with mode: 0644]
SL/DB/MetaSetup/CustomVariableValidity.pm [new file with mode: 0644]
SL/DB/MetaSetup/Customer.pm [new file with mode: 0644]
SL/DB/MetaSetup/CustomerTax.pm [new file with mode: 0644]
SL/DB/MetaSetup/Datev.pm [new file with mode: 0644]
SL/DB/MetaSetup/Default.pm [new file with mode: 0644]
SL/DB/MetaSetup/DeliveryOrder.pm [new file with mode: 0644]
SL/DB/MetaSetup/DeliveryOrderItem.pm [new file with mode: 0644]
SL/DB/MetaSetup/DeliveryOrderItemsStock.pm [new file with mode: 0644]
SL/DB/MetaSetup/Department.pm [new file with mode: 0644]
SL/DB/MetaSetup/DptTrans.pm [new file with mode: 0644]
SL/DB/MetaSetup/Draft.pm [new file with mode: 0644]
SL/DB/MetaSetup/Dunning.pm [new file with mode: 0644]
SL/DB/MetaSetup/DunningConfig.pm [new file with mode: 0644]
SL/DB/MetaSetup/Employee.pm [new file with mode: 0644]
SL/DB/MetaSetup/Exchangerate.pm [new file with mode: 0644]
SL/DB/MetaSetup/Finanzamt.pm [new file with mode: 0644]
SL/DB/MetaSetup/FollowUp.pm [new file with mode: 0644]
SL/DB/MetaSetup/FollowUpAccess.pm [new file with mode: 0644]
SL/DB/MetaSetup/FollowUpLink.pm [new file with mode: 0644]
SL/DB/MetaSetup/GLTransaction.pm [new file with mode: 0644]
SL/DB/MetaSetup/GenericTranslation.pm [new file with mode: 0644]
SL/DB/MetaSetup/Gifi.pm [new file with mode: 0644]
SL/DB/MetaSetup/History.pm [new file with mode: 0644]
SL/DB/MetaSetup/Inventory.pm [new file with mode: 0644]
SL/DB/MetaSetup/Invoice.pm [new file with mode: 0644]
SL/DB/MetaSetup/InvoiceItem.pm [new file with mode: 0644]
SL/DB/MetaSetup/Language.pm [new file with mode: 0644]
SL/DB/MetaSetup/Lead.pm [new file with mode: 0644]
SL/DB/MetaSetup/Licemse.pm [new file with mode: 0644]
SL/DB/MetaSetup/License.pm [new file with mode: 0644]
SL/DB/MetaSetup/LicenseInvoice.pm [new file with mode: 0644]
SL/DB/MetaSetup/MakeModel.pm [new file with mode: 0644]
SL/DB/MetaSetup/Note.pm [new file with mode: 0644]
SL/DB/MetaSetup/Order.pm [new file with mode: 0644]
SL/DB/MetaSetup/OrderItem.pm [new file with mode: 0644]
SL/DB/MetaSetup/Part.pm [new file with mode: 0644]
SL/DB/MetaSetup/PartsGroup.pm [new file with mode: 0644]
SL/DB/MetaSetup/PartsTax.pm [new file with mode: 0644]
SL/DB/MetaSetup/PaymentTerm.pm [new file with mode: 0644]
SL/DB/MetaSetup/PriceFactor.pm [new file with mode: 0644]
SL/DB/MetaSetup/Pricegroup.pm [new file with mode: 0644]
SL/DB/MetaSetup/Prices.pm [new file with mode: 0644]
SL/DB/MetaSetup/Printer.pm [new file with mode: 0644]
SL/DB/MetaSetup/Project.pm [new file with mode: 0644]
SL/DB/MetaSetup/PurchaseInvoice.pm [new file with mode: 0644]
SL/DB/MetaSetup/RMA.pm [new file with mode: 0644]
SL/DB/MetaSetup/RMAItem.pm [new file with mode: 0644]
SL/DB/MetaSetup/RecordLink.pm [new file with mode: 0644]
SL/DB/MetaSetup/SchemaInfo.pm [new file with mode: 0644]
SL/DB/MetaSetup/SepaExport.pm [new file with mode: 0644]
SL/DB/MetaSetup/SepaExportItem.pm [new file with mode: 0644]
SL/DB/MetaSetup/Shipto.pm [new file with mode: 0644]
SL/DB/MetaSetup/Status.pm [new file with mode: 0644]
SL/DB/MetaSetup/Tax.pm [new file with mode: 0644]
SL/DB/MetaSetup/TaxKey.pm [new file with mode: 0644]
SL/DB/MetaSetup/TaxZone.pm [new file with mode: 0644]
SL/DB/MetaSetup/Taxkey.pm [new file with mode: 0644]
SL/DB/MetaSetup/TodoUserConfig.pm [new file with mode: 0644]
SL/DB/MetaSetup/TransferType.pm [new file with mode: 0644]
SL/DB/MetaSetup/Translation.pm [new file with mode: 0644]
SL/DB/MetaSetup/TranslationPaymentTerm.pm [new file with mode: 0644]
SL/DB/MetaSetup/Unit.pm [new file with mode: 0644]
SL/DB/MetaSetup/UnitsLanguage.pm [new file with mode: 0644]
SL/DB/MetaSetup/Vendor.pm [new file with mode: 0644]
SL/DB/MetaSetup/VendorTax.pm [new file with mode: 0644]
SL/DB/MetaSetup/Warehouse.pm [new file with mode: 0644]
SL/DB/Note.pm [new file with mode: 0644]
SL/DB/Object.pm [new file with mode: 0644]
SL/DB/Order.pm [new file with mode: 0644]
SL/DB/OrderItem.pm [new file with mode: 0644]
SL/DB/Part.pm [new file with mode: 0644]
SL/DB/PartsGroup.pm [new file with mode: 0644]
SL/DB/PartsTax.pm [new file with mode: 0644]
SL/DB/PaymentTerm.pm [new file with mode: 0644]
SL/DB/PriceFactor.pm [new file with mode: 0644]
SL/DB/Pricegroup.pm [new file with mode: 0644]
SL/DB/Prices.pm [new file with mode: 0644]
SL/DB/Printer.pm [new file with mode: 0644]
SL/DB/Project.pm [new file with mode: 0644]
SL/DB/PurchaseInvoice.pm [new file with mode: 0644]
SL/DB/RMA.pm [new file with mode: 0644]
SL/DB/RMAItem.pm [new file with mode: 0644]
SL/DB/RecordLink.pm [new file with mode: 0644]
SL/DB/SchemaInfo.pm [new file with mode: 0644]
SL/DB/SepaExport.pm [new file with mode: 0644]
SL/DB/SepaExportItem.pm [new file with mode: 0644]
SL/DB/Shipto.pm [new file with mode: 0644]
SL/DB/Status.pm [new file with mode: 0644]
SL/DB/Tax.pm [new file with mode: 0644]
SL/DB/TaxKey.pm [new file with mode: 0644]
SL/DB/TaxZone.pm [new file with mode: 0644]
SL/DB/TodoUserConfig.pm [new file with mode: 0644]
SL/DB/TransferType.pm [new file with mode: 0644]
SL/DB/Translation.pm [new file with mode: 0644]
SL/DB/TranslationPaymentTerm.pm [new file with mode: 0644]
SL/DB/Unit.pm [new file with mode: 0644]
SL/DB/UnitsLanguage.pm [new file with mode: 0644]
SL/DB/VC.pm [new file with mode: 0644]
SL/DB/Vendor.pm [new file with mode: 0644]
SL/DB/VendorTax.pm [new file with mode: 0644]
SL/DB/Warehouse.pm [new file with mode: 0644]
SL/ReportGenerator.pm
acctranscorrections.pl [deleted symlink]
admin.pl [deleted file]
am.pl [deleted symlink]
amcvar.pl [deleted symlink]
amtemplates.pl [deleted symlink]
ap.pl [deleted symlink]
ar.pl [deleted symlink]
bankaccounts.pl [deleted symlink]
bin/mozilla/common.pl
bp.pl [deleted symlink]
ca.pl [deleted symlink]
common.pl [deleted symlink]
config/lx-erp.conf
cp.pl [deleted symlink]
ct.pl [deleted symlink]
datev.pl [deleted symlink]
dispatcher.pl [changed from symlink to file mode: 0755]
dn.pl [deleted symlink]
do.pl [deleted symlink]
fu.pl [deleted symlink]
generictranslations.pl [deleted symlink]
gl.pl [deleted symlink]
ic.pl [deleted symlink]
ir.pl [deleted symlink]
is.pl [deleted symlink]
kopf.pl [deleted symlink]
licenses.pl [deleted symlink]
login.pl [deleted symlink]
menu.pl [deleted symlink]
menuXML.pl [deleted symlink]
menujs.pl [deleted symlink]
menunew.pl [deleted symlink]
menuv3.pl [deleted symlink]
menuv4.pl [deleted symlink]
oe.pl [deleted symlink]
pe.pl [deleted symlink]
projects.pl [deleted symlink]
rc.pl [deleted symlink]
rp.pl [deleted symlink]
scripts/console
scripts/rose_auto_create_model.pl [new file with mode: 0755]
sepa.pl [deleted symlink]
sql/Pg-upgrade2/schema_nomalization_1.sql [new file with mode: 0644]
sql/Pg-upgrade2/schema_nomalization_2.sql [new file with mode: 0644]
t/helper/attr.t [new file with mode: 0644]
t/helper/mapping.t [new file with mode: 0644]
todo.pl [deleted symlink]
ustva.pl [deleted symlink]
wh.pl [deleted symlink]

diff --git a/SL/DB.pm b/SL/DB.pm
new file mode 100644 (file)
index 0000000..18f8696
--- /dev/null
+++ b/SL/DB.pm
@@ -0,0 +1,54 @@
+package SL::DB;
+
+use strict;
+
+use Carp;
+use Data::Dumper;
+use English qw(-no_match_vars);
+use Rose::DB;
+
+use base qw(Rose::DB);
+
+__PACKAGE__->use_private_registry;
+
+my (%_db_registered, %_initial_sql_executed);
+
+sub create {
+  my $domain = shift || SL::DB->default_domain;
+  my $type   = shift || SL::DB->default_type;
+
+  if ($type eq 'LXOFFICE') {
+    $domain = 'LXEMPTY' unless %::myconfig && $::myconfig{dbname};
+    $type   = join $SUBSCRIPT_SEPARATOR, map { $::myconfig{$_} } qw(dbdriver dbname dbhost dbport dbuser dbpasswd) if %::myconfig;
+  }
+
+  _register_db($domain, $type);
+
+  my $db = __PACKAGE__->new_or_cached(domain => $domain, type => $type);
+
+  return $db;
+}
+
+sub _register_db {
+  my $domain = shift;
+  my $type   = shift;
+
+  my $idx    = "${domain}::${type}";
+  return if $_db_registered{$idx};
+
+  $_db_registered{$idx} = 1;
+
+  __PACKAGE__->register_db(domain          => $domain,
+                           type            => $type,
+                           driver          => $::myconfig{dbdriver} || 'Pg',
+                           database        => $::myconfig{dbname},
+                           host            => $::myconfig{dbhost},
+                           port            => $::myconfig{dbport} || 5432,
+                           username        => $::myconfig{dbuser},
+                           password        => $::myconfig{dbpasswd},
+                           connect_options => { pg_enable_utf8 => $::locale && $::locale->is_utf8,
+                                              },
+                          );
+}
+
+1;
diff --git a/SL/DB/AccTrans.pm b/SL/DB/AccTrans.pm
new file mode 100644 (file)
index 0000000..e058b8d
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AccTrans;
+
+use strict;
+
+use SL::DB::MetaSetup::AccTrans;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/AccTransaction.pm b/SL/DB/AccTransaction.pm
new file mode 100644 (file)
index 0000000..0f78717
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AccTransaction;
+
+use strict;
+
+use SL::DB::MetaSetup::AccTransaction;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Assembly.pm b/SL/DB/Assembly.pm
new file mode 100644 (file)
index 0000000..2bc9c16
--- /dev/null
@@ -0,0 +1,23 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Assembly;
+
+use strict;
+
+use SL::DB::MetaSetup::Assembly;
+
+__PACKAGE__->meta->add_relationships(
+  part => {
+    type         => 'one to one',
+    class        => 'SL::DB::Part',
+    column_map   => { parts_id => 'id' },
+  },
+);
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/SL/DB/AuditTrail.pm b/SL/DB/AuditTrail.pm
new file mode 100644 (file)
index 0000000..9c2fbc0
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::AuditTrail;
+
+use strict;
+
+use SL::DB::MetaSetup::AuditTrail;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/BankAccount.pm b/SL/DB/BankAccount.pm
new file mode 100644 (file)
index 0000000..c293c6c
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::BankAccount;
+
+use strict;
+
+use SL::DB::MetaSetup::BankAccount;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Bin.pm b/SL/DB/Bin.pm
new file mode 100644 (file)
index 0000000..d9d29b4
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Bin;
+
+use strict;
+
+use SL::DB::MetaSetup::Bin;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Buchungsgruppe.pm b/SL/DB/Buchungsgruppe.pm
new file mode 100644 (file)
index 0000000..2dffaa5
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Buchungsgruppe;
+
+use strict;
+
+use SL::DB::MetaSetup::Buchungsgruppe;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Business.pm b/SL/DB/Business.pm
new file mode 100644 (file)
index 0000000..badd0b5
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Business;
+
+use strict;
+
+use SL::DB::MetaSetup::Business;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Chart.pm b/SL/DB/Chart.pm
new file mode 100644 (file)
index 0000000..2d865b5
--- /dev/null
@@ -0,0 +1,9 @@
+package SL::DB::Chart;
+
+use strict;
+
+use SL::DB::MetaSetup::Chart;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Contact.pm b/SL/DB/Contact.pm
new file mode 100644 (file)
index 0000000..69d666f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Contact;
+
+use strict;
+
+use SL::DB::MetaSetup::Contact;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm
new file mode 100644 (file)
index 0000000..6410e3f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::CustomVariable;
+
+use strict;
+
+use SL::DB::MetaSetup::CustomVariable;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/CustomVariableConfig.pm b/SL/DB/CustomVariableConfig.pm
new file mode 100644 (file)
index 0000000..3410a49
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::CustomVariableConfig;
+
+use strict;
+
+use SL::DB::MetaSetup::CustomVariableConfig;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/CustomVariableValidity.pm b/SL/DB/CustomVariableValidity.pm
new file mode 100644 (file)
index 0000000..a96afdb
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::CustomVariableValidity;
+
+use strict;
+
+use SL::DB::MetaSetup::CustomVariableValidity;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Customer.pm b/SL/DB/Customer.pm
new file mode 100644 (file)
index 0000000..fd5f66e
--- /dev/null
@@ -0,0 +1,27 @@
+package SL::DB::Customer;
+
+use strict;
+
+use SL::DB::MetaSetup::Customer;
+
+use SL::DB::VC;
+
+__PACKAGE__->meta->add_relationship(
+  shipto => {
+    type         => 'one to many',
+    class        => 'SL::DB::Shipto',
+    column_map   => { id      => 'trans_id' },
+    manager_args => { sort_by => 'lower(shipto.shiptoname)' },
+    query_args   => [ 'shipto.module' => 'CT' ],
+  },
+  business => {
+    type         => 'one to one',
+    class        => 'SL::DB::Business',
+    column_map   => { business_id => 'id' },
+  },
+);
+
+__PACKAGE__->meta->make_manager_class;
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/SL/DB/CustomerTax.pm b/SL/DB/CustomerTax.pm
new file mode 100644 (file)
index 0000000..2efc60e
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::CustomerTax;
+
+use strict;
+
+use SL::DB::MetaSetup::CustomerTax;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Datev.pm b/SL/DB/Datev.pm
new file mode 100644 (file)
index 0000000..4d33d58
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Datev;
+
+use strict;
+
+use SL::DB::MetaSetup::Datev;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Default.pm b/SL/DB/Default.pm
new file mode 100644 (file)
index 0000000..497ce35
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Default;
+
+use strict;
+
+use SL::DB::MetaSetup::Default;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/DeliveryOrder.pm b/SL/DB/DeliveryOrder.pm
new file mode 100644 (file)
index 0000000..b5bdcb4
--- /dev/null
@@ -0,0 +1,36 @@
+package SL::DB::DeliveryOrder;
+
+use strict;
+
+use SL::DB::MetaSetup::DeliveryOrder;
+use SL::DB::Manager::DeliveryOrder;
+use SL::DB::Order;
+
+use List::Util qw(first);
+
+__PACKAGE__->meta->add_relationship(orderitems => { type         => 'one to many',
+                                                    class        => 'SL::DB::DeliveryOrderItem',
+                                                    column_map   => { id => 'trans_id' },
+                                                    manager_args => { with_objects => [ 'part' ] }
+                                                  },
+                                   );
+
+__PACKAGE__->meta->initialize;
+
+# methods
+
+sub sales_order {
+  my $self   = shift;
+  my %params = @_;
+
+  my $orders = SL::DB::Manager::Order->get_all(
+    query => [
+      ordnumber => $self->ordnumber,
+      @{ $params{query} || [] },
+    ],
+  );
+
+  return first { $_->is_type('sales_order') } @{ $orders };
+}
+
+1;
diff --git a/SL/DB/DeliveryOrderItem.pm b/SL/DB/DeliveryOrderItem.pm
new file mode 100644 (file)
index 0000000..2f508d3
--- /dev/null
@@ -0,0 +1,16 @@
+package SL::DB::DeliveryOrderItem;
+
+use strict;
+
+use SL::DB::MetaSetup::DeliveryOrderItem;
+
+__PACKAGE__->meta->make_manager_class;
+
+# methods
+
+sub part {
+  # canonial alias for parts.
+  return shift->parts;
+}
+
+1;
diff --git a/SL/DB/DeliveryOrderItemsStock.pm b/SL/DB/DeliveryOrderItemsStock.pm
new file mode 100644 (file)
index 0000000..2b951ef
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::DeliveryOrderItemsStock;
+
+use strict;
+
+use SL::DB::MetaSetup::DeliveryOrderItemsStock;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Department.pm b/SL/DB/Department.pm
new file mode 100644 (file)
index 0000000..ea62791
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Department;
+
+use strict;
+
+use SL::DB::MetaSetup::Department;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/DptTrans.pm b/SL/DB/DptTrans.pm
new file mode 100644 (file)
index 0000000..3712903
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::DptTrans;
+
+use strict;
+
+use SL::DB::MetaSetup::DptTrans;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Draft.pm b/SL/DB/Draft.pm
new file mode 100644 (file)
index 0000000..ea6ebd6
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Draft;
+
+use strict;
+
+use SL::DB::MetaSetup::Draft;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Dunning.pm b/SL/DB/Dunning.pm
new file mode 100644 (file)
index 0000000..80ffd77
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Dunning;
+
+use strict;
+
+use SL::DB::MetaSetup::Dunning;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/DunningConfig.pm b/SL/DB/DunningConfig.pm
new file mode 100644 (file)
index 0000000..059b798
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::DunningConfig;
+
+use strict;
+
+use SL::DB::MetaSetup::DunningConfig;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Employee.pm b/SL/DB/Employee.pm
new file mode 100644 (file)
index 0000000..841696b
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Employee;
+
+use strict;
+
+use SL::DB::MetaSetup::Employee;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Exchangerate.pm b/SL/DB/Exchangerate.pm
new file mode 100644 (file)
index 0000000..cd3eaee
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Exchangerate;
+
+use strict;
+
+use SL::DB::MetaSetup::Exchangerate;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Finanzamt.pm b/SL/DB/Finanzamt.pm
new file mode 100644 (file)
index 0000000..82daba1
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Finanzamt;
+
+use strict;
+
+use SL::DB::MetaSetup::Finanzamt;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/FollowUp.pm b/SL/DB/FollowUp.pm
new file mode 100644 (file)
index 0000000..b50c90f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::FollowUp;
+
+use strict;
+
+use SL::DB::MetaSetup::FollowUp;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/FollowUpAccess.pm b/SL/DB/FollowUpAccess.pm
new file mode 100644 (file)
index 0000000..581a497
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::FollowUpAccess;
+
+use strict;
+
+use SL::DB::MetaSetup::FollowUpAccess;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/FollowUpLink.pm b/SL/DB/FollowUpLink.pm
new file mode 100644 (file)
index 0000000..6945bfa
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::FollowUpLink;
+
+use strict;
+
+use SL::DB::MetaSetup::FollowUpLink;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/GLTransaction.pm b/SL/DB/GLTransaction.pm
new file mode 100644 (file)
index 0000000..b1550e9
--- /dev/null
@@ -0,0 +1,10 @@
+package SL::DB::GLTransaction;
+
+use strict;
+
+use SL::DB::MetaSetup::GLTransaction;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/GenericTranslation.pm b/SL/DB/GenericTranslation.pm
new file mode 100644 (file)
index 0000000..14b5618
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::GenericTranslation;
+
+use strict;
+
+use SL::DB::MetaSetup::GenericTranslation;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Gifi.pm b/SL/DB/Gifi.pm
new file mode 100644 (file)
index 0000000..9a1c7f5
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Gifi;
+
+use strict;
+
+use SL::DB::MetaSetup::Gifi;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Helpers/ALL.pm b/SL/DB/Helpers/ALL.pm
new file mode 100644 (file)
index 0000000..4a258ef
--- /dev/null
@@ -0,0 +1,108 @@
+package SL::DB::Helpers::ALL;
+
+use strict;
+
+use SL::DB::AccTrans;
+use SL::DB::AccTransaction;
+use SL::DB::Assembly;
+use SL::DB::AuditTrail;
+use SL::DB::BankAccount;
+use SL::DB::Bin;
+use SL::DB::Buchungsgruppe;
+use SL::DB::Business;
+use SL::DB::Chart;
+use SL::DB::Contact;
+use SL::DB::CustomVariable;
+use SL::DB::CustomVariableConfig;
+use SL::DB::CustomVariableValidity;
+use SL::DB::Customer;
+use SL::DB::CustomerTax;
+use SL::DB::Datev;
+use SL::DB::Default;
+use SL::DB::DeliveryOrder;
+use SL::DB::DeliveryOrderItem;
+use SL::DB::DeliveryOrderItemsStock;
+use SL::DB::Department;
+use SL::DB::DptTrans;
+use SL::DB::Draft;
+use SL::DB::Dunning;
+use SL::DB::DunningConfig;
+use SL::DB::Employee;
+use SL::DB::Exchangerate;
+use SL::DB::Finanzamt;
+use SL::DB::FollowUp;
+use SL::DB::FollowUpAccess;
+use SL::DB::FollowUpLink;
+use SL::DB::GLTransaction;
+use SL::DB::GenericTranslation;
+use SL::DB::Gifi;
+use SL::DB::History;
+use SL::DB::Inventory;
+use SL::DB::Invoice;
+use SL::DB::InvoiceItem;
+use SL::DB::Language;
+use SL::DB::Lead;
+use SL::DB::License;
+use SL::DB::LicenseInvoice;
+use SL::DB::MakeModel;
+use SL::DB::Note;
+use SL::DB::Order;
+use SL::DB::OrderItem;
+use SL::DB::Part;
+use SL::DB::PartsGroup;
+use SL::DB::PartsTax;
+use SL::DB::PaymentTerm;
+use SL::DB::PriceFactor;
+use SL::DB::Pricegroup;
+use SL::DB::Prices;
+use SL::DB::Printer;
+use SL::DB::Project;
+use SL::DB::PurchaseInvoice;
+use SL::DB::RMA;
+use SL::DB::RMAItem;
+use SL::DB::RecordLink;
+use SL::DB::SchemaInfo;
+use SL::DB::SepaExport;
+use SL::DB::SepaExportItem;
+use SL::DB::Shipto;
+use SL::DB::Status;
+use SL::DB::Tax;
+use SL::DB::TaxKey;
+use SL::DB::TaxZone;
+use SL::DB::TodoUserConfig;
+use SL::DB::TransferType;
+use SL::DB::Translation;
+use SL::DB::TranslationPaymentTerm;
+use SL::DB::Unit;
+use SL::DB::UnitsLanguage;
+use SL::DB::Vendor;
+use SL::DB::VendorTax;
+use SL::DB::Warehouse;
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+SL::DB::Helpers::ALL: Dependency-only package for all SL::DB::* modules
+
+=head1 SYNOPSIS
+
+  use SL::DB::Helpers::ALL;
+
+=head1 DESCRIPTION
+
+This module depends on all modules in SL/DB/*.pm for the convenience
+of being able to write a simple \C<use SL::DB::Helpers::ALL> and
+having everything loaded. This is supposed to be used only in the
+Lx-Office console. Normal modules should C<use> only the modules they
+actually need.
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/SL/DB/Helpers/Attr.pm b/SL/DB/Helpers/Attr.pm
new file mode 100644 (file)
index 0000000..01c97c2
--- /dev/null
@@ -0,0 +1,135 @@
+package SL::DB::Helper::Attr;
+
+use strict;
+
+sub auto_make {
+  my ($package, %params) = @_;
+
+  for my $col ($package->meta->columns) {
+    next if $col->primary_key_position; # don't make attr helper for primary keys
+    _make_by_type($package, $col->name, $col->type);
+  }
+
+  return $package;
+}
+
+sub make {
+  my ($package, %params) = @_;
+
+  for my $name (keys %params) {
+    my @types = ref $params{$name} eq 'ARRAY' ? @{ $params{$name} } : ($params{$name});
+    for my $type (@types) {
+      _make_by_type($package, $name, $type);
+    }
+  }
+  return $package;
+}
+
+
+
+sub _make_by_type {
+  my ($package, $name, $type) = @_;
+  _as_number ($package, $name, places => -2) if $type =~ /numeric | real | float/xi;
+  _as_percent($package, $name, places =>  0) if $type =~ /numeric | real | float/xi;
+  _as_number ($package, $name, places =>  0) if $type =~ /int/xi;
+  _as_date   ($package, $name)               if $type =~ /date | timestamp/xi;
+}
+
+sub _as_number {
+  my $package     = shift;
+  my $attribute   = shift;
+  my %params      = @_;
+
+  $params{places} = 2 if !defined($params{places});
+
+  no strict 'refs';
+  *{ $package . '::' . $attribute . '_as_number' } = sub {
+    my ($self, $string) = @_;
+
+    $self->$attribute($::form->parse_amount(\%::myconfig, $string)) if @_ > 1;
+
+    return $::form->format_amount(\%::myconfig, $self->$attribute, $params{places});
+  };
+}
+
+sub _as_percent {
+  my $package     = shift;
+  my $attribute   = shift;
+  my %params      = @_;
+
+  $params{places} = 2 if !defined($params{places});
+
+  no strict 'refs';
+  *{ $package . '::' . $attribute . '_as_percent' } = sub {
+    my ($self, $string) = @_;
+
+    $self->$attribute($::form->parse_amount(\%::myconfig, $string) / 100) if @_ > 1;
+
+    return $::form->format_amount(\%::myconfig, 100 * $self->$attribute, $params{places});
+  };
+
+  return 1;
+}
+
+sub _as_date {
+  my $package     = shift;
+  my $attribute   = shift;
+  my %params      = @_;
+
+  no strict 'refs';
+  *{ $package . '::' . $attribute . '_as_date' } = sub {
+    my ($self, $string) = @_;
+
+    if (@_ > 1) {
+      if ($string) {
+        my ($yy, $mm, $dd) = $::locale->parse_date(\%::myconfig, $string);
+        $self->$attribute(DateTime->new(year => $yy, month => $mm, day => $dd));
+      } else {
+        $self->$attribute(undef);
+      }
+    }
+
+    return $self->$attribute
+      ? $::locale->reformat_date(
+          { dateformat => 'yy-mm-dd' },
+          ( $self->$attribute eq 'now'
+             ? DateTime->now
+             : $self->$attribute
+          )->ymd,
+          $::myconfig{dateformat}
+        )
+      : undef;
+  };
+
+  return 1;
+}
+
+1;
+
+
+1;
+
+__END__
+
+=head1 NAME
+
+SL::DB::Helpers::Attr - attribute helpers
+
+=head1 SYNOPSIS
+
+  use SL::DB::Helpers::Attr;
+  SL::DB::Helpers::Attr::make($class,
+    method_name => 'numeric(15,5)',
+    datemethod  => 'date'
+  );
+  SL::DB::Helpers::Attr::auto_make($class);
+
+=head1 DESCRIPTION
+
+=head1 FUNCTIONS
+
+=head1 BUGS
+
+=head1 AUTHOR
+
+=cut
diff --git a/SL/DB/Helpers/ConventionManager.pm b/SL/DB/Helpers/ConventionManager.pm
new file mode 100644 (file)
index 0000000..1d9cd84
--- /dev/null
@@ -0,0 +1,29 @@
+package SL::DB::Helpers::ConventionManager;
+
+use strict;
+
+use Rose::DB::Object::ConventionManager;
+
+use base qw(Rose::DB::Object::ConventionManager);
+
+sub auto_manager_class_name {
+  my $self         = shift;
+  my $object_class = shift || $self->meta->class;
+
+  my @parts        = split m/::/, $object_class;
+  my $last         = pop @parts;
+
+  return join('::', @parts, 'Manager', $last);
+}
+
+# Base name used for 'make_manager_class', e.g. 'get_all',
+# 'update_all'
+sub auto_manager_base_name {
+  return 'all';
+}
+
+sub auto_manager_base_class {
+  return 'SL::DB::Helpers::Manager';
+}
+
+1;
diff --git a/SL/DB/Helpers/Manager.pm b/SL/DB/Helpers/Manager.pm
new file mode 100644 (file)
index 0000000..4399f5d
--- /dev/null
@@ -0,0 +1,27 @@
+package SL::DB::Helpers::Manager;
+
+use strict;
+
+use Rose::DB::Object::Manager;
+use base qw(Rose::DB::Object::Manager);
+
+sub make_manager_methods {
+  my $class  = shift;
+  my @params = scalar(@_) ? @_ : qw(all);
+  return $class->SUPER::make_manager_methods(@params);
+}
+
+sub find_by {
+  my $class = shift;
+
+  return if !@_;
+  return $class->get_all(query => [ @_ ], limit => 1)->[0];
+}
+
+sub get_first {
+  shift->get_all(
+    limit => 1,
+  )->[0];
+}
+
+1;
diff --git a/SL/DB/Helpers/Mappings.pm b/SL/DB/Helpers/Mappings.pm
new file mode 100644 (file)
index 0000000..7b0c959
--- /dev/null
@@ -0,0 +1,186 @@
+package SL::DB::Helpers::Mappings;
+
+use strict;
+
+# these will not be managed as Rose::DB models, because they are not normalized
+# significant changes are needed to get them done.
+my @lxoffice_blacklist_permanent = qw(
+);
+
+# these are not managed _yet_, but will hopefully at some point.
+# if you are confident that one of these works, remove it here.
+my @lxoffice_blacklist_temp = qw(
+);
+
+my @lxoffice_blacklist = (@lxoffice_blacklist_permanent, @lxoffice_blacklist_temp);
+
+# map table names to their models.
+# unlike rails we have no singular<->plural magic.
+# remeber: tables should be named as the plural of the model name.
+my %lxoffice_package_names = (
+  acc_trans                      => 'acc_transaction',
+  audittrail                     => 'audit_trail',
+  ar                             => 'invoice',
+  ap                             => 'purchase_invoice',
+  bank_accounts                  => 'bank_account',
+  buchungsgruppen                => 'buchungsgruppe',
+  contacts                       => 'contact',
+  custom_variable_configs        => 'custom_variable_config',
+  custom_variables               => 'custom_variable',
+  custom_variables_validity      => 'custom_variable_validity',
+  customertax                    => 'customer_tax',
+  datev                          => 'datev',
+  defaults                       => 'default',
+  delivery_orders                => 'delivery_order',
+  delivery_order_items           => 'delivery_order_item',
+  department                     => 'department',
+  dpt_trans                      => 'dpt_trans',
+  drafts                         => 'draft',
+  dunning                        => 'dunning',
+  dunning_config                 => 'dunning_config',
+  employee                       => 'employee',
+  exchangerate                   => 'exchangerate',
+  finanzamt                      => 'finanzamt',
+  follow_up_access               => 'follow_up_access',
+  follow_up_links                => 'follow_up_link',
+  follow_ups                     => 'follow_up',
+  generic_translations           => 'generic_translation',
+  gifi                           => 'gifi',
+  gl                             => 'GLTransaction',
+  history_erp                    => 'history',
+  inventory                      => 'inventory',
+  invoice                        => 'invoice_item',
+  language                       => 'language',
+  leads                          => 'lead',
+  license                        => 'license',
+  licenseinvoice                 => 'license_invoice',
+  makemodel                      => 'make_model',
+  notes                          => 'note',
+  orderitems                     => 'order_item',
+  oe                             => 'order',
+  parts                          => 'part',
+  partsgroup                     => 'parts_group',
+  partstax                       => 'parts_tax',
+  payment_terms                  => 'payment_term',
+  prices                         => 'prices',
+  price_factors                  => 'price_factor',
+  pricegroup                     => 'pricegroup',
+  printers                       => 'Printer',
+  record_links                   => 'record_link',
+  rma                            => 'RMA',
+  rmaitems                       => 'RMA_item',
+  sepa_export                    => 'sepa_export',
+  sepa_export_items              => 'sepa_export_item',
+  schema_info                    => 'schema_info',
+  status                         => 'status',
+  tax                            => 'tax',
+  taxkeys                        => 'tax_key',
+  tax_zones                      => 'tax_zone',
+  todo_user_config               => 'todo_user_config',
+  translation                    => 'translation',
+  translation_payment_terms      => 'translation_payment_term',
+  units                          => 'unit',
+  units_language                 => 'units_language',
+  vendortax                      => 'vendor_tax',
+);
+
+sub get_blacklist {
+  return LXOFFICE => \@lxoffice_blacklist;
+}
+
+sub get_package_names {
+  return LXOFFICE => \%lxoffice_package_names;
+}
+
+sub db {
+  my $string = $_[0];
+  my $lookup = $lxoffice_package_names{$_[0]} ||
+      plurify($lxoffice_package_names{singlify($_[0])});
+
+  for my $thing ($string, $lookup) {
+
+    # best guess? its already the name. like part. camelize it first
+    my $class = "SL::DB::" . camelify($thing);
+    return $class if defined *{ $class. '::' };
+
+    # next, someone wants a manager and pluralized.
+    my $manager = "SL::DB::Manager::" . singlify(camelify($thing));
+    return $manager if defined *{ $manager . '::' };
+  }
+
+  die "Can't resolve '$string' as a database model, sorry. Did you perhaps forgot to load it?";
+}
+
+sub camelify {
+  my ($str) = @_;
+  $str =~ s/_+(.)/uc($1)/ge;
+  ucfirst $str;
+}
+
+sub snakify {
+  my ($str) = @_;
+  $str =~ s/(?<!^)\u(.)/'_' . lc($1)/ge;
+  lcfirst $str;
+}
+
+sub plurify {
+  my ($str) = @_;
+  $str . 's';
+}
+
+sub singlify {
+  my ($str) = @_;
+  local $/ = 's';
+  chomp $str;
+  $str;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+SL::DB::Helpers::Mappings - Rose Table <-> Model mapping information
+
+=head1 SYNOPSIS
+
+  use SL::DB::Helpers::Mappings qw(@blacklist %table2model);
+
+=head1 DESCRIPTION
+
+This modul stores table <-> model mappings used by the
+L<scripts/rose_auto_create_model.pl> script.  If you add a new table that has
+custom mappings, add it here.
+
+=head2 db
+
+A special function provided here is E<db>. Without it you'd have to write:
+
+  my $part = SL::DB::Part->new(id => 1234);
+  my @all_parts = SL::DB::Manager::Part->get_all;
+
+with them it becomes:
+
+  my $part = db('part')->new(id => 123);
+  my @all_parts = db('parts')->get_all;
+
+You don't have to care about add that SL::DB:: incantation anymore. Also, a
+simple s at the end will get you the associated Manager class.
+
+db is written to try to make sense of what you give it, but if all fails, it
+will die with an error.
+
+=head1 BUGS
+
+nothing yet
+
+=head1 SEE ALSO
+
+L<scripts/rose_auto_create_model.pl>
+
+=head1 AUTHOR
+
+Sven Schöling <s.schoeling@linet-services.de>
+
+=cut
diff --git a/SL/DB/Helpers/Metadata.pm b/SL/DB/Helpers/Metadata.pm
new file mode 100644 (file)
index 0000000..30c59f4
--- /dev/null
@@ -0,0 +1,34 @@
+package SL::DB::Helpers::Metadata;
+
+use strict;
+
+use Rose::DB::Object::Metadata;
+use SL::DB::Helpers::ConventionManager;
+
+use base qw(Rose::DB::Object::Metadata);
+
+sub convention_manager_class {
+  return 'SL::DB::Helpers::ConventionManager';
+}
+
+sub default_manager_base_class {
+  return 'SL::DB::Helpers::Manager';
+}
+
+sub initialize {
+  my $self = shift;
+  $self->make_attr_auto_helpers;
+  $self->SUPER::initialize(@_);
+}
+
+sub make_attr_helpers {
+  my ($self, %params) = @_;
+  SL::DB::Helper::Attr::make($self->class, %params);
+}
+
+sub make_attr_auto_helpers {
+  my ($self) = @_;
+  SL::DB::Helper::Attr::auto_make($self->class);
+}
+
+1;
diff --git a/SL/DB/History.pm b/SL/DB/History.pm
new file mode 100644 (file)
index 0000000..c935a82
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::History;
+
+use strict;
+
+use SL::DB::MetaSetup::History;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Inventory.pm b/SL/DB/Inventory.pm
new file mode 100644 (file)
index 0000000..98d505d
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Inventory;
+
+use strict;
+
+use SL::DB::MetaSetup::Inventory;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm
new file mode 100644 (file)
index 0000000..993920c
--- /dev/null
@@ -0,0 +1,60 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Invoice;
+
+use strict;
+
+use List::Util qw(first);
+
+use SL::DB::MetaSetup::Invoice;
+use SL::DB::Manager::Invoice;
+
+__PACKAGE__->meta->add_relationship(
+  invoiceitems => {
+    type         => 'one to many',
+    class        => 'SL::DB::InvoiceItem',
+    column_map   => { id => 'trans_id' },
+    manager_args => {
+      with_objects => [ 'part' ]
+    }
+  },
+);
+
+__PACKAGE__->meta->initialize;
+
+# methods
+
+# it is assumed, that ordnumbers are unique here.
+sub first_order_by_ordnumber {
+  my $self = shift;
+
+  my $orders = SL::DB::Manager::Order->get_all(
+    query => [
+      ordnumber => $self->ordnumber,
+
+    ],
+  );
+
+  return first { $_->is_type('sales_order') } @{ $orders };
+}
+
+sub abschlag_percentage {
+  my $self         = shift;
+  my $order        = $self->first_order_by_ordnumber or return;
+  my $order_amount = $order->netamount               or return;
+  return $self->abschlag
+    ? $self->netamount / $order_amount
+    : undef;
+}
+
+sub taxamount {
+  my $self = shift;
+  die 'not a setter method' if @_;
+
+  return $self->amount - $self->netamount;
+}
+
+__PACKAGE__->meta->make_attr_helpers(taxamount => 'numeric(15,5)');
+
+1;
diff --git a/SL/DB/InvoiceItem.pm b/SL/DB/InvoiceItem.pm
new file mode 100644 (file)
index 0000000..d8b3903
--- /dev/null
@@ -0,0 +1,20 @@
+package SL::DB::InvoiceItem;
+
+use strict;
+
+use SL::DB::MetaSetup::InvoiceItem;
+
+__PACKAGE__->meta->add_relationship(
+  part => {
+    type         => 'one to one',
+    class        => 'SL::DB::Part',
+    column_map   => { parts_id => 'id' },
+  }
+);
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/SL/DB/Language.pm b/SL/DB/Language.pm
new file mode 100644 (file)
index 0000000..abfdebc
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Language;
+
+use strict;
+
+use SL::DB::MetaSetup::Language;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Lead.pm b/SL/DB/Lead.pm
new file mode 100644 (file)
index 0000000..0c12c5c
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Lead;
+
+use strict;
+
+use SL::DB::MetaSetup::Lead;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/License.pm b/SL/DB/License.pm
new file mode 100644 (file)
index 0000000..b75add7
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::License;
+
+use strict;
+
+use SL::DB::MetaSetup::License;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/LicenseInvoice.pm b/SL/DB/LicenseInvoice.pm
new file mode 100644 (file)
index 0000000..9a03e3a
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::LicenseInvoice;
+
+use strict;
+
+use SL::DB::MetaSetup::LicenseInvoice;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/MakeModel.pm b/SL/DB/MakeModel.pm
new file mode 100644 (file)
index 0000000..8831a66
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::MakeModel;
+
+use strict;
+
+use SL::DB::MetaSetup::MakeModel;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Manager/DeliveryOrder.pm b/SL/DB/Manager/DeliveryOrder.pm
new file mode 100644 (file)
index 0000000..f63987e
--- /dev/null
@@ -0,0 +1,22 @@
+package SL::DB::Manager::DeliveryOrder;
+
+use strict;
+
+use SL::DB::Helpers::Manager;
+use base qw(SL::DB::Helpers::Manager);
+
+sub object_class { 'SL::DB::DeliveryOrder' }
+
+__PACKAGE__->make_manager_methods;
+
+sub type_filter {
+  my $class = shift;
+  my $type  = lc(shift || '');
+
+  return ('!customer_id' => undef) if $type eq 'sales_delivery_order';
+  return ('!vendor_id'   => undef) if $type eq 'purchase_delivery_order';
+
+  die "Unknown type $type";
+}
+
+1;
diff --git a/SL/DB/Manager/Invoice.pm b/SL/DB/Manager/Invoice.pm
new file mode 100644 (file)
index 0000000..025f7f2
--- /dev/null
@@ -0,0 +1,24 @@
+package SL::DB::Manager::Invoice;
+
+use strict;
+
+use base qw(SL::DB::Helpers::Manager);
+
+sub object_class { 'SL::DB::Invoice' }
+
+__PACKAGE__->make_manager_methods;
+
+sub type_filter {
+  my $class = shift;
+  my $type  = lc(shift || '');
+
+  return (or  => [ invoice => 0, invoice => undef                                               ]) if $type eq 'ar_transaction';
+  return (and => [ invoice => 1, amount  => { ge => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
+  return (and => [ invoice => 1, amount  => { lt => 0 }, or => [ storno => 0, storno => undef ] ]) if $type eq 'credit_note';
+  return (and => [ invoice => 1, amount  => { lt => 0 },         storno => 1                    ]) if $type =~ m/(?:invoice_)?storno/;
+  return (and => [ invoice => 1, amount  => { ge => 0 },         storno => 1                    ]) if $type eq 'credit_note_storno';
+
+  die "Unknown type $type";
+}
+
+1;
diff --git a/SL/DB/Manager/Order.pm b/SL/DB/Manager/Order.pm
new file mode 100644 (file)
index 0000000..451a43a
--- /dev/null
@@ -0,0 +1,24 @@
+package SL::DB::Manager::Order;
+
+use strict;
+
+use SL::DB::Helpers::Manager;
+use base qw(SL::DB::Helpers::Manager);
+
+sub object_class { 'SL::DB::Order' }
+
+__PACKAGE__->make_manager_methods;
+
+sub type_filter {
+  my $class = shift;
+  my $type  = lc(shift || '');
+
+  return (and => [ '!customer_id' => undef,         quotation => 1                       ]) if $type eq 'sales_quotation';
+  return (and => [ '!vendor_id'   => undef,         quotation => 1                       ]) if $type eq 'request_quotation';
+  return (and => [ '!customer_id' => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'sales_order';
+  return (and => [ '!vendor_id'   => undef, or => [ quotation => 0, quotation => undef ] ]) if $type eq 'purchase_order';
+
+  die "Unknown type $type";
+}
+
+1;
diff --git a/SL/DB/Manager/Part.pm b/SL/DB/Manager/Part.pm
new file mode 100644 (file)
index 0000000..1564b9b
--- /dev/null
@@ -0,0 +1,63 @@
+package SL::DB::Manager::Part;
+
+use strict;
+
+use SL::DB::Helpers::Manager;
+use base qw(SL::DB::Helpers::Manager);
+
+use Carp;
+use SL::DBUtils;
+
+sub object_class { 'SL::DB::Part' }
+
+__PACKAGE__->make_manager_methods;
+
+sub type_filter {
+  my $class = shift;
+  my $type  = lc(shift || '');
+
+  if ($type =~ m/^part/) {
+    return (and => [ or                    => [ assembly => 0, assembly => undef ],
+                     '!inventory_accno_id' => 0,
+                     '!inventory_accno_id' => undef,
+                   ]);
+
+  } elsif ($type =~ m/^service/) {
+    return (and => [ or => [ assembly           => 0, assembly           => undef ],
+                     or => [ inventory_accno_id => 0, inventory_accno_id => undef ],
+                   ]);
+
+  } elsif ($type =~ m/^assembl/) {
+    return (assembly => 1);
+
+  }
+
+  return ();
+}
+
+sub get_ordered_qty {
+  my $class    = shift;
+  my @part_ids = @_;
+
+  return () unless @part_ids;
+
+  my $placeholders = join ',', ('?') x @part_ids;
+  my $query        = <<SQL;
+    SELECT oi.parts_id, SUM(oi.base_qty) AS qty
+    FROM orderitems oi
+    LEFT JOIN oe ON (oi.trans_id = oe.id)
+    WHERE (oi.parts_id IN ($placeholders))
+      AND (NOT COALESCE(oe.quotation, FALSE))
+      AND (NOT COALESCE(oe.closed,    FALSE))
+      AND (NOT COALESCE(oe.delivered, FALSE))
+      AND (COALESCE(oe.vendor_id, 0) <> 0)
+    GROUP BY oi.parts_id
+SQL
+
+  my %qty_by_id = map { $_->{parts_id} => $_->{qty} * 1 } @{ selectall_hashref_query($::form, $class->object_class->init_db->dbh, $query, @part_ids) };
+  map { $qty_by_id{$_} ||= 0 } @part_ids;
+
+  return %qty_by_id;
+}
+
+1;
diff --git a/SL/DB/Manager/PurchaseInvoice.pm b/SL/DB/Manager/PurchaseInvoice.pm
new file mode 100644 (file)
index 0000000..c717a04
--- /dev/null
@@ -0,0 +1,23 @@
+package SL::DB::Manager::PurchaseInvoice;
+
+use strict;
+
+use SL::DB::Helpers::Manager;
+use base qw(SL::DB::Helpers::Manager);
+
+sub object_class { 'SL::DB::PurchaseInvoice' }
+
+__PACKAGE__->make_manager_methods;
+
+sub type_filter {
+  my $class = shift;
+  my $type  = lc(shift || '');
+
+  return (or  => [ invoice => 0, invoice => undef                       ]) if $type eq 'ap_transaction';
+  return (and => [ invoice => 1, or => [ storno => 0, storno => undef ] ]) if $type eq 'invoice';
+  return (and => [ invoice => 1,         storno => 1                    ]) if $type =~ m/(?:invoice_)?storno/;
+
+  die "Unknown type $type";
+}
+
+1;
diff --git a/SL/DB/Manager/TransferType.pm b/SL/DB/Manager/TransferType.pm
new file mode 100644 (file)
index 0000000..82bcc5f
--- /dev/null
@@ -0,0 +1,27 @@
+package SL::DB::Manager::TransferType;
+
+use strict;
+
+use base qw(SL::DB::Helpers::Manager);
+
+use Carp;
+
+sub object_class { 'SL::DB::TransferType' }
+
+__PACKAGE__->make_manager_methods;
+
+# class functions
+
+sub get_all_in {
+  return shift()->get_all( query => [ direction => 'in', ] );
+}
+
+sub get_all_out {
+  return shift()->get_all( query => [ direction => 'out', ] );
+}
+
+sub get_all_transfer {
+  return shift()->get_all( query => [ direction => 'transfer', ] );
+}
+
+1;
diff --git a/SL/DB/MetaSetup/AccTrans.pm b/SL/DB/MetaSetup/AccTrans.pm
new file mode 100644 (file)
index 0000000..8fcedbc
--- /dev/null
@@ -0,0 +1,50 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AccTrans;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'acc_trans',
+
+  columns => [
+    acc_trans_id   => { type => 'bigint', sequence => 'acc_trans_id_seq' },
+    trans_id       => { type => 'integer', not_null => 1 },
+    chart_id       => { type => 'integer', not_null => 1 },
+    amount         => { type => 'numeric', precision => 5, scale => 15 },
+    transdate      => { type => 'date', default => 'now' },
+    gldate         => { type => 'date', default => 'now' },
+    source         => { type => 'text' },
+    cleared        => { type => 'boolean', default => 'false' },
+    fx_transaction => { type => 'boolean', default => 'false' },
+    ob_transaction => { type => 'boolean', default => 'false' },
+    cb_transaction => { type => 'boolean', default => 'false' },
+    project_id     => { type => 'integer' },
+    memo           => { type => 'text' },
+    taxkey         => { type => 'integer' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    id             => { type => 'integer', not_null => 1, sequence => 'acc_trans_id_seq1' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    chart => {
+      class       => 'SL::DB::Chart',
+      key_columns => { chart_id => 'id' },
+    },
+
+    project => {
+      class       => 'SL::DB::Project',
+      key_columns => { project_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/AccTransaction.pm b/SL/DB/MetaSetup/AccTransaction.pm
new file mode 100644 (file)
index 0000000..9f6e6b4
--- /dev/null
@@ -0,0 +1,50 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AccTransaction;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'acc_trans',
+
+  columns => [
+    acc_trans_id   => { type => 'bigint', sequence => 'acc_trans_id_seq' },
+    trans_id       => { type => 'integer', not_null => 1 },
+    chart_id       => { type => 'integer', not_null => 1 },
+    amount         => { type => 'numeric', precision => 5, scale => 15 },
+    transdate      => { type => 'date', default => 'now' },
+    gldate         => { type => 'date', default => 'now' },
+    source         => { type => 'text' },
+    cleared        => { type => 'boolean', default => 'false' },
+    fx_transaction => { type => 'boolean', default => 'false' },
+    ob_transaction => { type => 'boolean', default => 'false' },
+    cb_transaction => { type => 'boolean', default => 'false' },
+    project_id     => { type => 'integer' },
+    memo           => { type => 'text' },
+    taxkey         => { type => 'integer' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    id             => { type => 'integer', not_null => 1, sequence => 'acc_trans_id_seq1' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    chart => {
+      class       => 'SL::DB::Chart',
+      key_columns => { chart_id => 'id' },
+    },
+
+    project => {
+      class       => 'SL::DB::Project',
+      key_columns => { project_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Assembly.pm b/SL/DB/MetaSetup/Assembly.pm
new file mode 100644 (file)
index 0000000..408eea7
--- /dev/null
@@ -0,0 +1,30 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Assembly;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'assembly',
+
+  columns => [
+    id          => { type => 'integer' },
+    parts_id    => { type => 'integer' },
+    qty         => { type => 'float', precision => 4 },
+    bom         => { type => 'boolean' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    mtime       => { type => 'timestamp' },
+    variable    => { type => 'boolean', default => 'false', not_null => 1, remarks => 'true if this part of the assembly is variable, and can be modified' },
+    item_id     => { type => 'integer', remarks => 'used to group parts in an assembly for exclusive options' },
+    assembly_id => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'assembly_id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/AuditTrail.pm b/SL/DB/MetaSetup/AuditTrail.pm
new file mode 100644 (file)
index 0000000..0edc6ed
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::AuditTrail;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'audittrail',
+
+  columns => [
+    trans_id    => { type => 'integer' },
+    tablename   => { type => 'text' },
+    reference   => { type => 'text' },
+    formname    => { type => 'text' },
+    action      => { type => 'text' },
+    transdate   => { type => 'timestamp', default => 'now' },
+    employee_id => { type => 'integer' },
+    id          => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/BankAccount.pm b/SL/DB/MetaSetup/BankAccount.pm
new file mode 100644 (file)
index 0000000..5cd8e7a
--- /dev/null
@@ -0,0 +1,33 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::BankAccount;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'bank_accounts',
+
+  columns => [
+    id             => { type => 'integer', not_null => 1, sequence => 'id' },
+    account_number => { type => 'varchar', length => 100 },
+    bank_code      => { type => 'varchar', length => 100 },
+    iban           => { type => 'varchar', length => 100 },
+    bic            => { type => 'varchar', length => 100 },
+    bank           => { type => 'text' },
+    chart_id       => { type => 'integer', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    chart => {
+      class       => 'SL::DB::Chart',
+      key_columns => { chart_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Bin.pm b/SL/DB/MetaSetup/Bin.pm
new file mode 100644 (file)
index 0000000..ff22520
--- /dev/null
@@ -0,0 +1,33 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Bin;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'bin',
+
+  columns => [
+    id           => { type => 'integer', not_null => 1, sequence => 'id' },
+    warehouse_id => { type => 'integer', not_null => 1 },
+    description  => { type => 'text' },
+    itime        => { type => 'timestamp', default => 'now()' },
+    mtime        => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    warehouse => {
+      class       => 'SL::DB::Warehouse',
+      key_columns => { warehouse_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Buchungsgruppe.pm b/SL/DB/MetaSetup/Buchungsgruppe.pm
new file mode 100644 (file)
index 0000000..8acc5a7
--- /dev/null
@@ -0,0 +1,31 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Buchungsgruppe;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'buchungsgruppen',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'id' },
+    description        => { type => 'text' },
+    inventory_accno_id => { type => 'integer' },
+    income_accno_id_0  => { type => 'integer' },
+    expense_accno_id_0 => { type => 'integer' },
+    income_accno_id_1  => { type => 'integer' },
+    expense_accno_id_1 => { type => 'integer' },
+    income_accno_id_2  => { type => 'integer' },
+    expense_accno_id_2 => { type => 'integer' },
+    income_accno_id_3  => { type => 'integer' },
+    expense_accno_id_3 => { type => 'integer' },
+    sortkey            => { type => 'integer', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Business.pm b/SL/DB/MetaSetup/Business.pm
new file mode 100644 (file)
index 0000000..243d524
--- /dev/null
@@ -0,0 +1,28 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Business;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'business',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'id' },
+    description        => { type => 'text' },
+    discount           => { type => 'float', precision => 4 },
+    customernumberinit => { type => 'text' },
+    salesman           => { type => 'boolean', default => 'false' },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Chart.pm b/SL/DB/MetaSetup/Chart.pm
new file mode 100644 (file)
index 0000000..c6cce71
--- /dev/null
@@ -0,0 +1,40 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Chart;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'chart',
+
+  columns => [
+    id             => { type => 'integer', not_null => 1, sequence => 'id' },
+    accno          => { type => 'text', not_null => 1 },
+    description    => { type => 'text' },
+    charttype      => { type => 'character', default => 'A', length => 1 },
+    category       => { type => 'character', length => 1 },
+    link           => { type => 'text' },
+    gifi_accno     => { type => 'text' },
+    taxkey_id      => { type => 'integer' },
+    pos_ustva      => { type => 'integer' },
+    pos_bwa        => { type => 'integer' },
+    pos_bilanz     => { type => 'integer' },
+    pos_eur        => { type => 'integer' },
+    datevautomatik => { type => 'boolean', default => 'false' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    new_chart_id   => { type => 'integer' },
+    valid_from     => { type => 'date' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  unique_key => [ 'accno' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Contact.pm b/SL/DB/MetaSetup/Contact.pm
new file mode 100644 (file)
index 0000000..2eb4fa5
--- /dev/null
@@ -0,0 +1,42 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Contact;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'contacts',
+
+  columns => [
+    cp_id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    cp_cv_id       => { type => 'integer' },
+    cp_title       => { type => 'varchar', length => 75 },
+    cp_givenname   => { type => 'varchar', length => 75 },
+    cp_name        => { type => 'varchar', length => 75 },
+    cp_email       => { type => 'text' },
+    cp_phone1      => { type => 'varchar', length => 75 },
+    cp_phone2      => { type => 'varchar', length => 75 },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    cp_fax         => { type => 'text' },
+    cp_mobile1     => { type => 'text' },
+    cp_mobile2     => { type => 'text' },
+    cp_satphone    => { type => 'text' },
+    cp_satfax      => { type => 'text' },
+    cp_project     => { type => 'text' },
+    cp_privatphone => { type => 'text' },
+    cp_privatemail => { type => 'text' },
+    cp_birthday    => { type => 'text' },
+    cp_abteilung   => { type => 'text' },
+    cp_gender      => { type => 'character', length => 1 },
+  ],
+
+  primary_key_columns => [ 'cp_id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/CustomVariable.pm b/SL/DB/MetaSetup/CustomVariable.pm
new file mode 100644 (file)
index 0000000..bb2380a
--- /dev/null
@@ -0,0 +1,38 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::CustomVariable;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'custom_variables',
+
+  columns => [
+    id              => { type => 'integer', not_null => 1, sequence => 'custom_variables_id' },
+    config_id       => { type => 'integer', not_null => 1 },
+    trans_id        => { type => 'integer', not_null => 1 },
+    bool_value      => { type => 'boolean' },
+    timestamp_value => { type => 'timestamp' },
+    text_value      => { type => 'text' },
+    number_value    => { type => 'numeric', precision => 5, scale => 25 },
+    itime           => { type => 'timestamp', default => 'now()' },
+    mtime           => { type => 'timestamp' },
+    sub_module      => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    config => {
+      class       => 'SL::DB::CustomVariableConfig',
+      key_columns => { config_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/CustomVariableConfig.pm b/SL/DB/MetaSetup/CustomVariableConfig.pm
new file mode 100644 (file)
index 0000000..5ee01c1
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::CustomVariableConfig;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'custom_variable_configs',
+
+  columns => [
+    id                  => { type => 'integer', not_null => 1, sequence => 'custom_variable_configs_id' },
+    name                => { type => 'text' },
+    description         => { type => 'text' },
+    type                => { type => 'varchar', length => 20 },
+    module              => { type => 'varchar', length => 20 },
+    default_value       => { type => 'text' },
+    options             => { type => 'text' },
+    searchable          => { type => 'boolean' },
+    includeable         => { type => 'boolean' },
+    included_by_default => { type => 'boolean' },
+    sortkey             => { type => 'integer' },
+    itime               => { type => 'timestamp', default => 'now()' },
+    mtime               => { type => 'timestamp' },
+    flags               => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/CustomVariableValidity.pm b/SL/DB/MetaSetup/CustomVariableValidity.pm
new file mode 100644 (file)
index 0000000..25876d7
--- /dev/null
@@ -0,0 +1,32 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::CustomVariableValidity;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'custom_variables_validity',
+
+  columns => [
+    id        => { type => 'integer', not_null => 1, sequence => 'id' },
+    config_id => { type => 'integer', not_null => 1 },
+    trans_id  => { type => 'integer', not_null => 1 },
+    itime     => { type => 'timestamp', default => 'now()' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    config => {
+      class       => 'SL::DB::CustomVariableConfig',
+      key_columns => { config_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm
new file mode 100644 (file)
index 0000000..93f63b7
--- /dev/null
@@ -0,0 +1,65 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Customer;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'customer',
+
+  columns => [
+    id             => { type => 'integer', not_null => 1, sequence => 'id' },
+    name           => { type => 'varchar', length => 75, 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 => 'varchar', length => 75 },
+    phone          => { type => 'varchar', length => 30 },
+    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 => 'varchar', length => 15 },
+    bank_code      => { type => 'varchar', length => 10 },
+    bank           => { type => 'text' },
+    language       => { type => 'varchar', length => 5 },
+    datevexport    => { type => 'integer' },
+    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 => 'varchar', length => 14 },
+    direct_debit   => { type => 'boolean', default => 'false' },
+    iban           => { type => 'varchar', length => 100 },
+    bic            => { type => 'varchar', length => 100 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/CustomerTax.pm b/SL/DB/MetaSetup/CustomerTax.pm
new file mode 100644 (file)
index 0000000..2522995
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::CustomerTax;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'customertax',
+
+  columns => [
+    customer_id => { type => 'integer' },
+    chart_id    => { type => 'integer' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    mtime       => { type => 'timestamp' },
+    id          => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Datev.pm b/SL/DB/MetaSetup/Datev.pm
new file mode 100644 (file)
index 0000000..cc03ba3
--- /dev/null
@@ -0,0 +1,30 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Datev;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'datev',
+
+  columns => [
+    beraternr      => { type => 'varchar', length => 7 },
+    beratername    => { type => 'varchar', length => 9 },
+    mandantennr    => { type => 'varchar', length => 5 },
+    dfvkz          => { type => 'varchar', length => 2 },
+    datentraegernr => { type => 'varchar', length => 3 },
+    abrechnungsnr  => { type => 'varchar', length => 6 },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    id             => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm
new file mode 100644 (file)
index 0000000..4eb5e66
--- /dev/null
@@ -0,0 +1,54 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Default;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'defaults',
+
+  columns => [
+    inventory_accno_id         => { type => 'integer' },
+    income_accno_id            => { type => 'integer' },
+    expense_accno_id           => { type => 'integer' },
+    fxgain_accno_id            => { type => 'integer' },
+    fxloss_accno_id            => { type => 'integer' },
+    invnumber                  => { type => 'text' },
+    sonumber                   => { type => 'text' },
+    yearend                    => { type => 'varchar', length => 5 },
+    weightunit                 => { type => 'varchar', length => 5 },
+    businessnumber             => { type => 'text' },
+    version                    => { type => 'varchar', length => 8 },
+    curr                       => { type => 'text' },
+    closedto                   => { type => 'date' },
+    revtrans                   => { type => 'boolean', default => 'false' },
+    ponumber                   => { type => 'text' },
+    sqnumber                   => { type => 'text' },
+    rfqnumber                  => { type => 'text' },
+    customernumber             => { type => 'text' },
+    vendornumber               => { type => 'text' },
+    audittrail                 => { type => 'boolean', default => 'false' },
+    articlenumber              => { type => 'text' },
+    servicenumber              => { type => 'text' },
+    coa                        => { type => 'text' },
+    itime                      => { type => 'timestamp', default => 'now()' },
+    mtime                      => { type => 'timestamp' },
+    rmanumber                  => { type => 'text' },
+    cnnumber                   => { type => 'text' },
+    dunning_ar_amount_fee      => { type => 'integer' },
+    dunning_ar_amount_interest => { type => 'integer' },
+    dunning_ar                 => { type => 'integer' },
+    pdonumber                  => { type => 'text' },
+    sdonumber                  => { type => 'text' },
+    id                         => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/DeliveryOrder.pm b/SL/DB/MetaSetup/DeliveryOrder.pm
new file mode 100644 (file)
index 0000000..806c963
--- /dev/null
@@ -0,0 +1,89 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DeliveryOrder;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'delivery_orders',
+
+  columns => [
+    id                      => { type => 'integer', not_null => 1, sequence => 'id' },
+    donumber                => { type => 'text', not_null => 1 },
+    ordnumber               => { type => 'text' },
+    transdate               => { type => 'date', default => 'now()' },
+    vendor_id               => { type => 'integer' },
+    customer_id             => { type => 'integer' },
+    reqdate                 => { type => 'date' },
+    shippingpoint           => { type => 'text' },
+    notes                   => { type => 'text' },
+    intnotes                => { type => 'text' },
+    employee_id             => { type => 'integer' },
+    closed                  => { type => 'boolean', default => 'false' },
+    delivered               => { type => 'boolean', default => 'false' },
+    cusordnumber            => { type => 'text' },
+    oreqnumber              => { type => 'text' },
+    department_id           => { type => 'integer' },
+    shipvia                 => { type => 'text' },
+    cp_id                   => { type => 'integer' },
+    language_id             => { type => 'integer' },
+    shipto_id               => { type => 'integer' },
+    globalproject_id        => { type => 'integer' },
+    salesman_id             => { type => 'integer' },
+    transaction_description => { type => 'text' },
+    is_sales                => { type => 'boolean' },
+    itime                   => { type => 'timestamp', default => 'now()' },
+    mtime                   => { type => 'timestamp' },
+    notes_bottom            => { type => 'text' },
+    taxzone_id              => { type => 'integer' },
+    taxincluded             => { type => 'boolean' },
+    terms                   => { type => 'integer' },
+    curr                    => { type => 'character', length => 3 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    contact => {
+      class       => 'SL::DB::Contact',
+      key_columns => { cp_id => 'cp_id' },
+    },
+
+    customer => {
+      class       => 'SL::DB::Customer',
+      key_columns => { customer_id => 'id' },
+    },
+
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+
+    globalproject => {
+      class       => 'SL::DB::Project',
+      key_columns => { globalproject_id => 'id' },
+    },
+
+    language => {
+      class       => 'SL::DB::Language',
+      key_columns => { language_id => 'id' },
+    },
+
+    salesman => {
+      class       => 'SL::DB::Employee',
+      key_columns => { salesman_id => 'id' },
+    },
+
+    vendor => {
+      class       => 'SL::DB::Vendor',
+      key_columns => { vendor_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/DeliveryOrderItem.pm b/SL/DB/MetaSetup/DeliveryOrderItem.pm
new file mode 100644 (file)
index 0000000..6bdfe43
--- /dev/null
@@ -0,0 +1,65 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DeliveryOrderItem;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'delivery_order_items',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'delivery_order_items_id' },
+    delivery_order_id  => { type => 'integer', not_null => 1 },
+    parts_id           => { type => 'integer', not_null => 1 },
+    description        => { type => 'text' },
+    qty                => { type => 'numeric', precision => 5, scale => 25 },
+    sellprice          => { type => 'numeric', precision => 5, scale => 15 },
+    discount           => { type => 'float', precision => 4 },
+    project_id         => { type => 'integer' },
+    reqdate            => { type => 'date' },
+    serialnumber       => { type => 'text' },
+    ordnumber          => { type => 'text' },
+    transdate          => { type => 'text' },
+    cusordnumber       => { type => 'text' },
+    unit               => { type => 'varchar', length => 20 },
+    base_qty           => { type => 'float', precision => 4 },
+    longdescription    => { type => 'text' },
+    lastcost           => { type => 'numeric', precision => 5, scale => 15 },
+    price_factor_id    => { type => 'integer' },
+    price_factor       => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+    marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    delivery_order => {
+      class       => 'SL::DB::DeliveryOrder',
+      key_columns => { delivery_order_id => 'id' },
+    },
+
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+
+    price_factor_obj => {
+      class       => 'SL::DB::PriceFactor',
+      key_columns => { price_factor_id => 'id' },
+    },
+
+    project => {
+      class       => 'SL::DB::Project',
+      key_columns => { project_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm b/SL/DB/MetaSetup/DeliveryOrderItemsStock.pm
new file mode 100644 (file)
index 0000000..99a2925
--- /dev/null
@@ -0,0 +1,48 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DeliveryOrderItemsStock;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'delivery_order_items_stock',
+
+  columns => [
+    id                     => { type => 'integer', not_null => 1, sequence => 'id' },
+    delivery_order_item_id => { type => 'integer', not_null => 1 },
+    qty                    => { type => 'numeric', not_null => 1, precision => 5, scale => 15 },
+    unit                   => { type => 'varchar', length => 20, not_null => 1 },
+    warehouse_id           => { type => 'integer', not_null => 1 },
+    bin_id                 => { type => 'integer', not_null => 1 },
+    chargenumber           => { type => 'text' },
+    itime                  => { type => 'timestamp', default => 'now()' },
+    mtime                  => { type => 'timestamp' },
+    bestbefore             => { type => 'date' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    bin => {
+      class       => 'SL::DB::Bin',
+      key_columns => { bin_id => 'id' },
+    },
+
+    delivery_order_item => {
+      class       => 'SL::DB::DeliveryOrderItem',
+      key_columns => { delivery_order_item_id => 'id' },
+    },
+
+    warehouse => {
+      class       => 'SL::DB::Warehouse',
+      key_columns => { warehouse_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Department.pm b/SL/DB/MetaSetup/Department.pm
new file mode 100644 (file)
index 0000000..1d1d957
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Department;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'department',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    description => { type => 'text' },
+    role        => { type => 'character', default => 'P', length => 1 },
+    itime       => { type => 'timestamp', default => 'now()' },
+    mtime       => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/DptTrans.pm b/SL/DB/MetaSetup/DptTrans.pm
new file mode 100644 (file)
index 0000000..9d30883
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DptTrans;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'dpt_trans',
+
+  columns => [
+    trans_id      => { type => 'integer' },
+    department_id => { type => 'integer' },
+    itime         => { type => 'timestamp', default => 'now()' },
+    mtime         => { type => 'timestamp' },
+    id            => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Draft.pm b/SL/DB/MetaSetup/Draft.pm
new file mode 100644 (file)
index 0000000..1a8ffc6
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Draft;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'drafts',
+
+  columns => [
+    id          => { type => 'varchar', length => 50, not_null => 1 },
+    module      => { type => 'varchar', length => 50, not_null => 1 },
+    submodule   => { type => 'varchar', length => 50, not_null => 1 },
+    description => { type => 'text' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    form        => { type => 'text' },
+    employee_id => { type => 'integer' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Dunning.pm b/SL/DB/MetaSetup/Dunning.pm
new file mode 100644 (file)
index 0000000..bc4ba87
--- /dev/null
@@ -0,0 +1,45 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Dunning;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'dunning',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'id' },
+    trans_id           => { type => 'integer' },
+    dunning_id         => { type => 'integer' },
+    dunning_level      => { type => 'integer' },
+    transdate          => { type => 'date' },
+    duedate            => { type => 'date' },
+    fee                => { type => 'numeric', precision => 5, scale => 15 },
+    interest           => { type => 'numeric', precision => 5, scale => 15 },
+    dunning_config_id  => { type => 'integer' },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+    fee_interest_ar_id => { type => 'integer' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    dunning_config => {
+      class       => 'SL::DB::DunningConfig',
+      key_columns => { dunning_config_id => 'id' },
+    },
+
+    fee_interest_ar => {
+      class       => 'SL::DB::Invoice',
+      key_columns => { fee_interest_ar_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/DunningConfig.pm b/SL/DB/MetaSetup/DunningConfig.pm
new file mode 100644 (file)
index 0000000..c670265
--- /dev/null
@@ -0,0 +1,34 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::DunningConfig;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'dunning_config',
+
+  columns => [
+    id                       => { type => 'integer', not_null => 1, sequence => 'id' },
+    dunning_level            => { type => 'integer' },
+    dunning_description      => { type => 'text' },
+    active                   => { type => 'boolean' },
+    auto                     => { type => 'boolean' },
+    email                    => { type => 'boolean' },
+    terms                    => { type => 'integer' },
+    payment_terms            => { type => 'integer' },
+    fee                      => { type => 'numeric', precision => 5, scale => 15 },
+    interest_rate            => { type => 'numeric', precision => 5, scale => 15 },
+    email_body               => { type => 'text' },
+    email_subject            => { type => 'text' },
+    email_attachment         => { type => 'boolean' },
+    template                 => { type => 'text' },
+    create_invoices_for_fees => { type => 'boolean', default => 'true' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Employee.pm b/SL/DB/MetaSetup/Employee.pm
new file mode 100644 (file)
index 0000000..f86174f
--- /dev/null
@@ -0,0 +1,39 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Employee;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'employee',
+
+  columns => [
+    id        => { type => 'integer', not_null => 1, sequence => 'id' },
+    login     => { type => 'text' },
+    startdate => { type => 'date', default => 'now' },
+    enddate   => { type => 'date' },
+    notes     => { type => 'text' },
+    role      => { type => 'text' },
+    sales     => { type => 'boolean', default => 'true' },
+    itime     => { type => 'timestamp', default => 'now()' },
+    mtime     => { type => 'timestamp' },
+    name      => { type => 'text' },
+    addr1     => { type => 'text' },
+    addr2     => { type => 'text' },
+    addr3     => { type => 'text' },
+    addr4     => { type => 'text' },
+    homephone => { type => 'text' },
+    workphone => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  unique_key => [ 'login' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Exchangerate.pm b/SL/DB/MetaSetup/Exchangerate.pm
new file mode 100644 (file)
index 0000000..95ea23c
--- /dev/null
@@ -0,0 +1,28 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Exchangerate;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'exchangerate',
+
+  columns => [
+    curr      => { type => 'character', length => 3 },
+    transdate => { type => 'date' },
+    buy       => { type => 'numeric', precision => 5, scale => 15 },
+    sell      => { type => 'numeric', precision => 5, scale => 15 },
+    itime     => { type => 'timestamp', default => 'now()' },
+    mtime     => { type => 'timestamp' },
+    id        => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Finanzamt.pm b/SL/DB/MetaSetup/Finanzamt.pm
new file mode 100644 (file)
index 0000000..fa22919
--- /dev/null
@@ -0,0 +1,40 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Finanzamt;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'finanzamt',
+
+  columns => [
+    fa_land_nr           => { type => 'text' },
+    fa_bufa_nr           => { type => 'text' },
+    fa_name              => { type => 'text' },
+    fa_strasse           => { type => 'text' },
+    fa_plz               => { type => 'text' },
+    fa_ort               => { type => 'text' },
+    fa_telefon           => { type => 'text' },
+    fa_fax               => { type => 'text' },
+    fa_plz_grosskunden   => { type => 'text' },
+    fa_plz_postfach      => { type => 'text' },
+    fa_postfach          => { type => 'text' },
+    fa_blz_1             => { type => 'text' },
+    fa_kontonummer_1     => { type => 'text' },
+    fa_bankbezeichnung_1 => { type => 'text' },
+    fa_blz_2             => { type => 'text' },
+    fa_kontonummer_2     => { type => 'text' },
+    fa_bankbezeichnung_2 => { type => 'text' },
+    fa_oeffnungszeiten   => { type => 'text' },
+    fa_email             => { type => 'text' },
+    fa_internet          => { type => 'text' },
+    id                   => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/FollowUp.pm b/SL/DB/MetaSetup/FollowUp.pm
new file mode 100644 (file)
index 0000000..3e83f0e
--- /dev/null
@@ -0,0 +1,46 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::FollowUp;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'follow_ups',
+
+  columns => [
+    id               => { type => 'integer', not_null => 1, sequence => 'follow_up_id' },
+    follow_up_date   => { type => 'date', not_null => 1 },
+    created_for_user => { type => 'integer', not_null => 1 },
+    done             => { type => 'boolean', default => 'false' },
+    note_id          => { type => 'integer', not_null => 1 },
+    created_by       => { type => 'integer', not_null => 1 },
+    itime            => { type => 'timestamp', default => 'now()' },
+    mtime            => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { created_for_user => 'id' },
+    },
+
+    employee_obj => {
+      class       => 'SL::DB::Employee',
+      key_columns => { created_by => 'id' },
+    },
+
+    note => {
+      class       => 'SL::DB::Note',
+      key_columns => { note_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/FollowUpAccess.pm b/SL/DB/MetaSetup/FollowUpAccess.pm
new file mode 100644 (file)
index 0000000..0a26083
--- /dev/null
@@ -0,0 +1,34 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::FollowUpAccess;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'follow_up_access',
+
+  columns => [
+    who  => { type => 'integer', not_null => 1 },
+    what => { type => 'integer', not_null => 1 },
+    id   => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { who => 'id' },
+    },
+
+    employee_obj => {
+      class       => 'SL::DB::Employee',
+      key_columns => { what => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/FollowUpLink.pm b/SL/DB/MetaSetup/FollowUpLink.pm
new file mode 100644 (file)
index 0000000..7bfec7d
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::FollowUpLink;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'follow_up_links',
+
+  columns => [
+    id           => { type => 'integer', not_null => 1, sequence => 'follow_up_link_id' },
+    follow_up_id => { type => 'integer', not_null => 1 },
+    trans_id     => { type => 'integer', not_null => 1 },
+    trans_type   => { type => 'text', not_null => 1 },
+    trans_info   => { type => 'text' },
+    itime        => { type => 'timestamp', default => 'now()' },
+    mtime        => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    follow_up => {
+      class       => 'SL::DB::FollowUp',
+      key_columns => { follow_up_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/GLTransaction.pm b/SL/DB/MetaSetup/GLTransaction.pm
new file mode 100644 (file)
index 0000000..a7d25f7
--- /dev/null
@@ -0,0 +1,44 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::GLTransaction;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'gl',
+
+  columns => [
+    id             => { type => 'integer', not_null => 1, sequence => 'glid' },
+    reference      => { type => 'text' },
+    description    => { type => 'text' },
+    transdate      => { type => 'date', default => 'now' },
+    gldate         => { type => 'date', default => 'now' },
+    employee_id    => { type => 'integer' },
+    notes          => { type => 'text' },
+    department_id  => { type => 'integer', default => '0' },
+    taxincluded    => { type => 'boolean' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    type           => { type => 'text' },
+    storno         => { type => 'boolean', default => 'false' },
+    storno_id      => { type => 'integer' },
+    ob_transaction => { type => 'boolean' },
+    cb_transaction => { type => 'boolean' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    storno_obj => {
+      class       => 'SL::DB::GLTransaction',
+      key_columns => { storno_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/GenericTranslation.pm b/SL/DB/MetaSetup/GenericTranslation.pm
new file mode 100644 (file)
index 0000000..4522224
--- /dev/null
@@ -0,0 +1,31 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::GenericTranslation;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'generic_translations',
+
+  columns => [
+    id               => { type => 'serial', not_null => 1 },
+    language_id      => { type => 'integer' },
+    translation_type => { type => 'varchar', length => 100, not_null => 1 },
+    translation_id   => { type => 'integer' },
+    translation      => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    language => {
+      class       => 'SL::DB::Language',
+      key_columns => { language_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Gifi.pm b/SL/DB/MetaSetup/Gifi.pm
new file mode 100644 (file)
index 0000000..dc9c8b8
--- /dev/null
@@ -0,0 +1,24 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Gifi;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'gifi',
+
+  columns => [
+    accno       => { type => 'text' },
+    description => { type => 'text' },
+    id          => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  unique_key => [ 'accno' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/History.pm b/SL/DB/MetaSetup/History.pm
new file mode 100644 (file)
index 0000000..1146f8f
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::History;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'history_erp',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    trans_id    => { type => 'integer' },
+    employee_id => { type => 'integer' },
+    addition    => { type => 'text' },
+    what_done   => { type => 'text' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    snumbers    => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Inventory.pm b/SL/DB/MetaSetup/Inventory.pm
new file mode 100644 (file)
index 0000000..e732f88
--- /dev/null
@@ -0,0 +1,70 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Inventory;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'inventory',
+
+  columns => [
+    warehouse_id  => { type => 'integer', not_null => 1 },
+    parts_id      => { type => 'integer', not_null => 1 },
+    oe_id         => { type => 'integer' },
+    orderitems_id => { type => 'integer' },
+    shippingdate  => { type => 'date' },
+    employee_id   => { type => 'integer', not_null => 1 },
+    itime         => { type => 'timestamp', default => 'now()' },
+    mtime         => { type => 'timestamp' },
+    bin_id        => { type => 'integer', not_null => 1 },
+    qty           => { type => 'numeric', precision => 5, scale => 25 },
+    trans_id      => { type => 'integer', not_null => 1 },
+    trans_type_id => { type => 'integer', not_null => 1 },
+    project_id    => { type => 'integer' },
+    chargenumber  => { type => 'text' },
+    comment       => { type => 'text' },
+    bestbefore    => { type => 'date' },
+    id            => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    bin => {
+      class       => 'SL::DB::Bin',
+      key_columns => { bin_id => 'id' },
+    },
+
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+
+    project => {
+      class       => 'SL::DB::Project',
+      key_columns => { project_id => 'id' },
+    },
+
+    trans_type => {
+      class       => 'SL::DB::TransferType',
+      key_columns => { trans_type_id => 'id' },
+    },
+
+    warehouse => {
+      class       => 'SL::DB::Warehouse',
+      key_columns => { warehouse_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Invoice.pm b/SL/DB/MetaSetup/Invoice.pm
new file mode 100644 (file)
index 0000000..6269da9
--- /dev/null
@@ -0,0 +1,94 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Invoice;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'ar',
+
+  columns => [
+    id                      => { type => 'integer', not_null => 1, sequence => 'glid' },
+    invnumber               => { type => 'text', not_null => 1 },
+    transdate               => { type => 'date', default => 'now' },
+    gldate                  => { type => 'date', default => 'now' },
+    customer_id             => { type => 'integer' },
+    taxincluded             => { type => 'boolean' },
+    amount                  => { type => 'numeric', precision => 5, scale => 15 },
+    netamount               => { type => 'numeric', precision => 5, scale => 15 },
+    paid                    => { type => 'numeric', precision => 5, scale => 15 },
+    datepaid                => { type => 'date' },
+    duedate                 => { type => 'date' },
+    deliverydate            => { type => 'date' },
+    invoice                 => { type => 'boolean', default => 'false' },
+    shippingpoint           => { type => 'text' },
+    terms                   => { type => 'integer', default => '0' },
+    notes                   => { type => 'text' },
+    curr                    => { type => 'character', length => 3 },
+    ordnumber               => { type => 'text' },
+    employee_id             => { type => 'integer' },
+    quonumber               => { type => 'text' },
+    cusordnumber            => { type => 'text' },
+    intnotes                => { type => 'text' },
+    department_id           => { type => 'integer', default => '0' },
+    shipvia                 => { type => 'text' },
+    itime                   => { type => 'timestamp', default => 'now()' },
+    mtime                   => { type => 'timestamp' },
+    cp_id                   => { type => 'integer' },
+    language_id             => { type => 'integer' },
+    payment_id              => { type => 'integer' },
+    delivery_customer_id    => { type => 'integer' },
+    delivery_vendor_id      => { type => 'integer' },
+    storno                  => { type => 'boolean', default => 'false' },
+    taxzone_id              => { type => 'integer' },
+    shipto_id               => { type => 'integer' },
+    type                    => { type => 'text' },
+    dunning_config_id       => { type => 'integer' },
+    orddate                 => { type => 'date' },
+    quodate                 => { type => 'date' },
+    globalproject_id        => { type => 'integer' },
+    salesman_id             => { type => 'integer' },
+    transaction_description => { type => 'text' },
+    storno_id               => { type => 'integer' },
+    marge_total             => { type => 'numeric', precision => 5, scale => 15 },
+    marge_percent           => { type => 'numeric', precision => 5, scale => 15 },
+    notes_bottom            => { type => 'text' },
+    donumber                => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    customer => {
+      class       => 'SL::DB::Customer',
+      key_columns => { customer_id => 'id' },
+    },
+
+    dunning_config => {
+      class       => 'SL::DB::DunningConfig',
+      key_columns => { dunning_config_id => 'id' },
+    },
+
+    globalproject => {
+      class       => 'SL::DB::Project',
+      key_columns => { globalproject_id => 'id' },
+    },
+
+    salesman => {
+      class       => 'SL::DB::Employee',
+      key_columns => { salesman_id => 'id' },
+    },
+
+    storno_obj => {
+      class       => 'SL::DB::Invoice',
+      key_columns => { storno_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/InvoiceItem.pm b/SL/DB/MetaSetup/InvoiceItem.pm
new file mode 100644 (file)
index 0000000..9a851e0
--- /dev/null
@@ -0,0 +1,57 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::InvoiceItem;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'invoice',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'invoiceid' },
+    trans_id           => { type => 'integer' },
+    parts_id           => { type => 'integer' },
+    description        => { type => 'text' },
+    qty                => { type => 'float', precision => 4 },
+    allocated          => { type => 'float', precision => 4 },
+    sellprice          => { type => 'numeric', precision => 5, scale => 15 },
+    fxsellprice        => { type => 'numeric', precision => 5, scale => 15 },
+    discount           => { type => 'float', precision => 4 },
+    assemblyitem       => { type => 'boolean', default => 'false' },
+    project_id         => { type => 'integer' },
+    deliverydate       => { type => 'date' },
+    serialnumber       => { type => 'text' },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+    pricegroup_id      => { type => 'integer' },
+    ordnumber          => { type => 'text' },
+    transdate          => { type => 'text' },
+    cusordnumber       => { type => 'text' },
+    unit               => { type => 'varchar', length => 20 },
+    base_qty           => { type => 'float', precision => 4 },
+    subtotal           => { type => 'boolean', default => 'false' },
+    longdescription    => { type => 'text' },
+    marge_total        => { type => 'numeric', precision => 5, scale => 15 },
+    marge_percent      => { type => 'numeric', precision => 5, scale => 15 },
+    lastcost           => { type => 'numeric', precision => 5, scale => 15 },
+    price_factor_id    => { type => 'integer' },
+    price_factor       => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+    marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Language.pm b/SL/DB/MetaSetup/Language.pm
new file mode 100644 (file)
index 0000000..662abc9
--- /dev/null
@@ -0,0 +1,30 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Language;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'language',
+
+  columns => [
+    id                  => { type => 'integer', not_null => 1, sequence => 'id' },
+    description         => { type => 'text' },
+    template_code       => { type => 'text' },
+    article_code        => { type => 'text' },
+    itime               => { type => 'timestamp', default => 'now()' },
+    mtime               => { type => 'timestamp' },
+    output_numberformat => { type => 'text' },
+    output_dateformat   => { type => 'text' },
+    output_longdates    => { type => 'boolean' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Lead.pm b/SL/DB/MetaSetup/Lead.pm
new file mode 100644 (file)
index 0000000..e12069a
--- /dev/null
@@ -0,0 +1,21 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Lead;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'leads',
+
+  columns => [
+    id   => { type => 'integer', not_null => 1, sequence => 'id' },
+    lead => { type => 'varchar', length => 50 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Licemse.pm b/SL/DB/MetaSetup/Licemse.pm
new file mode 100644 (file)
index 0000000..aea45d2
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Licemse;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'license',
+
+  columns => [
+    id            => { type => 'integer', not_null => 1, sequence => 'id' },
+    parts_id      => { type => 'integer' },
+    customer_id   => { type => 'integer' },
+    comment       => { type => 'text' },
+    validuntil    => { type => 'date' },
+    issuedate     => { type => 'date', default => 'now' },
+    quantity      => { type => 'integer' },
+    licensenumber => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/License.pm b/SL/DB/MetaSetup/License.pm
new file mode 100644 (file)
index 0000000..6ea5da5
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::License;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'license',
+
+  columns => [
+    id            => { type => 'integer', not_null => 1, sequence => 'id' },
+    parts_id      => { type => 'integer' },
+    customer_id   => { type => 'integer' },
+    comment       => { type => 'text' },
+    validuntil    => { type => 'date' },
+    issuedate     => { type => 'date', default => 'now' },
+    quantity      => { type => 'integer' },
+    licensenumber => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/LicenseInvoice.pm b/SL/DB/MetaSetup/LicenseInvoice.pm
new file mode 100644 (file)
index 0000000..b14f2ca
--- /dev/null
@@ -0,0 +1,22 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::LicenseInvoice;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'licenseinvoice',
+
+  columns => [
+    trans_id   => { type => 'integer' },
+    license_id => { type => 'integer' },
+    id         => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/MakeModel.pm b/SL/DB/MetaSetup/MakeModel.pm
new file mode 100644 (file)
index 0000000..cc0ae7f
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::MakeModel;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'makemodel',
+
+  columns => [
+    parts_id => { type => 'integer' },
+    model    => { type => 'text' },
+    itime    => { type => 'timestamp', default => 'now()' },
+    mtime    => { type => 'timestamp' },
+    make     => { type => 'integer' },
+    id       => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Note.pm b/SL/DB/MetaSetup/Note.pm
new file mode 100644 (file)
index 0000000..a055c02
--- /dev/null
@@ -0,0 +1,36 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Note;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'notes',
+
+  columns => [
+    id           => { type => 'integer', not_null => 1, sequence => 'note_id' },
+    subject      => { type => 'text' },
+    body         => { type => 'text' },
+    created_by   => { type => 'integer', not_null => 1 },
+    trans_id     => { type => 'integer' },
+    trans_module => { type => 'varchar', length => 10 },
+    itime        => { type => 'timestamp', default => 'now()' },
+    mtime        => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { created_by => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Order.pm b/SL/DB/MetaSetup/Order.pm
new file mode 100644 (file)
index 0000000..914918d
--- /dev/null
@@ -0,0 +1,81 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Order;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'oe',
+
+  columns => [
+    id                      => { type => 'integer', not_null => 1, sequence => 'id' },
+    ordnumber               => { type => 'text', not_null => 1 },
+    transdate               => { type => 'date', default => 'now' },
+    vendor_id               => { type => 'integer' },
+    customer_id             => { type => 'integer' },
+    amount                  => { type => 'numeric', precision => 5, scale => 15 },
+    netamount               => { type => 'numeric', precision => 5, scale => 15 },
+    reqdate                 => { type => 'date' },
+    taxincluded             => { type => 'boolean' },
+    shippingpoint           => { type => 'text' },
+    notes                   => { type => 'text' },
+    curr                    => { type => 'character', length => 3 },
+    employee_id             => { type => 'integer' },
+    closed                  => { type => 'boolean', default => 'false' },
+    quotation               => { type => 'boolean', default => 'false' },
+    quonumber               => { type => 'text' },
+    cusordnumber            => { type => 'text' },
+    intnotes                => { type => 'text' },
+    department_id           => { type => 'integer', default => '0' },
+    itime                   => { type => 'timestamp', default => 'now()' },
+    mtime                   => { type => 'timestamp' },
+    shipvia                 => { type => 'text' },
+    cp_id                   => { type => 'integer' },
+    language_id             => { type => 'integer' },
+    payment_id              => { type => 'integer' },
+    delivery_customer_id    => { type => 'integer' },
+    delivery_vendor_id      => { type => 'integer' },
+    taxzone_id              => { type => 'integer' },
+    proforma                => { type => 'boolean', default => 'false' },
+    shipto_id               => { type => 'integer' },
+    delivered               => { type => 'boolean', default => 'false' },
+    globalproject_id        => { type => 'integer' },
+    salesman_id             => { type => 'integer' },
+    transaction_description => { type => 'text' },
+    marge_total             => { type => 'numeric', precision => 5, scale => 15 },
+    marge_percent           => { type => 'numeric', precision => 5, scale => 15 },
+    notes_bottom            => { type => 'text' },
+    project_manager_id      => { type => 'integer' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+
+    globalproject => {
+      class       => 'SL::DB::Project',
+      key_columns => { globalproject_id => 'id' },
+    },
+
+    project_manager => {
+      class       => 'SL::DB::Employee',
+      key_columns => { project_manager_id => 'id' },
+    },
+
+    salesman => {
+      class       => 'SL::DB::Employee',
+      key_columns => { salesman_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/OrderItem.pm b/SL/DB/MetaSetup/OrderItem.pm
new file mode 100644 (file)
index 0000000..3f048c3
--- /dev/null
@@ -0,0 +1,55 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::OrderItem;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'orderitems',
+
+  columns => [
+    trans_id           => { type => 'integer' },
+    parts_id           => { type => 'integer' },
+    description        => { type => 'text' },
+    qty                => { type => 'float', precision => 4 },
+    sellprice          => { type => 'numeric', precision => 5, scale => 15 },
+    discount           => { type => 'float', precision => 4 },
+    project_id         => { type => 'integer' },
+    reqdate            => { type => 'date' },
+    ship               => { type => 'float', precision => 4 },
+    serialnumber       => { type => 'text' },
+    id                 => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+    pricegroup_id      => { type => 'integer' },
+    ordnumber          => { type => 'text' },
+    transdate          => { type => 'text' },
+    cusordnumber       => { type => 'text' },
+    unit               => { type => 'varchar', length => 20 },
+    base_qty           => { type => 'float', precision => 4 },
+    subtotal           => { type => 'boolean', default => 'false' },
+    longdescription    => { type => 'text' },
+    marge_total        => { type => 'numeric', precision => 5, scale => 15 },
+    marge_percent      => { type => 'numeric', precision => 5, scale => 15 },
+    lastcost           => { type => 'numeric', precision => 5, scale => 15 },
+    price_factor_id    => { type => 'integer' },
+    price_factor       => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+    marge_price_factor => { type => 'numeric', default => 1, precision => 5, scale => 15 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Part.pm b/SL/DB/MetaSetup/Part.pm
new file mode 100644 (file)
index 0000000..d6814e8
--- /dev/null
@@ -0,0 +1,66 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Part;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'parts',
+
+  columns => [
+    id                 => { type => 'integer', not_null => 1, sequence => 'id' },
+    partnumber         => { type => 'text', not_null => 1 },
+    description        => { type => 'text' },
+    listprice          => { type => 'numeric', precision => 5, scale => 15 },
+    sellprice          => { type => 'numeric', precision => 5, scale => 15 },
+    lastcost           => { type => 'numeric', precision => 5, scale => 15 },
+    priceupdate        => { type => 'date', default => 'now' },
+    weight             => { type => 'float', precision => 4 },
+    notes              => { type => 'text' },
+    makemodel          => { type => 'boolean', default => 'false' },
+    assembly           => { type => 'boolean', default => 'false' },
+    alternate          => { type => 'boolean', default => 'false' },
+    rop                => { type => 'float', precision => 4 },
+    inventory_accno_id => { type => 'integer' },
+    income_accno_id    => { type => 'integer' },
+    expense_accno_id   => { type => 'integer' },
+    bin                => { type => 'text' },
+    shop               => { type => 'boolean', default => 'false' },
+    obsolete           => { type => 'boolean', default => 'false' },
+    bom                => { type => 'boolean', default => 'false' },
+    image              => { type => 'text' },
+    drawing            => { type => 'text' },
+    microfiche         => { type => 'text' },
+    partsgroup_id      => { type => 'integer' },
+    ve                 => { type => 'integer' },
+    gv                 => { type => 'numeric', precision => 5, scale => 15 },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+    unit               => { type => 'varchar', length => 20, not_null => 1 },
+    formel             => { type => 'text' },
+    not_discountable   => { type => 'boolean', default => 'false' },
+    buchungsgruppen_id => { type => 'integer' },
+    payment_id         => { type => 'integer' },
+    ean                => { type => 'text' },
+    price_factor_id    => { type => 'integer' },
+    onhand             => { type => 'numeric', default => '0', precision => 5, scale => 25 },
+    stockable          => { type => 'boolean', default => 'false' },
+    has_sernumber      => { type => 'boolean', default => 'false' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    buchungsgruppen => {
+      class       => 'SL::DB::Buchungsgruppe',
+      key_columns => { buchungsgruppen_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/PartsGroup.pm b/SL/DB/MetaSetup/PartsGroup.pm
new file mode 100644 (file)
index 0000000..166f2b8
--- /dev/null
@@ -0,0 +1,25 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PartsGroup;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'partsgroup',
+
+  columns => [
+    id         => { type => 'integer', not_null => 1, sequence => 'id' },
+    partsgroup => { type => 'text' },
+    itime      => { type => 'timestamp', default => 'now()' },
+    mtime      => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/PartsTax.pm b/SL/DB/MetaSetup/PartsTax.pm
new file mode 100644 (file)
index 0000000..9bcdb5d
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PartsTax;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'partstax',
+
+  columns => [
+    parts_id => { type => 'integer' },
+    chart_id => { type => 'integer' },
+    itime    => { type => 'timestamp', default => 'now()' },
+    mtime    => { type => 'timestamp' },
+    id       => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/PaymentTerm.pm b/SL/DB/MetaSetup/PaymentTerm.pm
new file mode 100644 (file)
index 0000000..4e18f5d
--- /dev/null
@@ -0,0 +1,31 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PaymentTerm;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'payment_terms',
+
+  columns => [
+    id               => { type => 'integer', not_null => 1, sequence => 'id' },
+    description      => { type => 'text' },
+    description_long => { type => 'text' },
+    terms_netto      => { type => 'integer' },
+    terms_skonto     => { type => 'integer' },
+    percent_skonto   => { type => 'float', precision => 4 },
+    itime            => { type => 'timestamp', default => 'now()' },
+    mtime            => { type => 'timestamp' },
+    ranking          => { type => 'integer' },
+    sortkey          => { type => 'integer', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/PriceFactor.pm b/SL/DB/MetaSetup/PriceFactor.pm
new file mode 100644 (file)
index 0000000..2eeb596
--- /dev/null
@@ -0,0 +1,23 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PriceFactor;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'price_factors',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    description => { type => 'text' },
+    factor      => { type => 'numeric', precision => 5, scale => 15 },
+    sortkey     => { type => 'integer' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Pricegroup.pm b/SL/DB/MetaSetup/Pricegroup.pm
new file mode 100644 (file)
index 0000000..09ce093
--- /dev/null
@@ -0,0 +1,21 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Pricegroup;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'pricegroup',
+
+  columns => [
+    id         => { type => 'integer', not_null => 1, sequence => 'id' },
+    pricegroup => { type => 'text', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Prices.pm b/SL/DB/MetaSetup/Prices.pm
new file mode 100644 (file)
index 0000000..819d14c
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Prices;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'prices',
+
+  columns => [
+    parts_id      => { type => 'integer' },
+    pricegroup_id => { type => 'integer' },
+    price         => { type => 'numeric', precision => 5, scale => 15 },
+    id            => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+
+    pricegroup => {
+      class       => 'SL::DB::Pricegroup',
+      key_columns => { pricegroup_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Printer.pm b/SL/DB/MetaSetup/Printer.pm
new file mode 100644 (file)
index 0000000..fc2446a
--- /dev/null
@@ -0,0 +1,23 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Printer;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'printers',
+
+  columns => [
+    id                  => { type => 'integer', not_null => 1, sequence => 'id' },
+    printer_description => { type => 'text', not_null => 1 },
+    printer_command     => { type => 'text' },
+    template_code       => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Project.pm b/SL/DB/MetaSetup/Project.pm
new file mode 100644 (file)
index 0000000..6b3ab91
--- /dev/null
@@ -0,0 +1,29 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Project;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'project',
+
+  columns => [
+    id            => { type => 'integer', not_null => 1, sequence => 'id' },
+    projectnumber => { type => 'text' },
+    description   => { type => 'text' },
+    itime         => { type => 'timestamp', default => 'now()' },
+    mtime         => { type => 'timestamp' },
+    active        => { type => 'boolean', default => 'true' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  unique_key => [ 'projectnumber' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/PurchaseInvoice.pm b/SL/DB/MetaSetup/PurchaseInvoice.pm
new file mode 100644 (file)
index 0000000..0ea9d10
--- /dev/null
@@ -0,0 +1,72 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::PurchaseInvoice;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'ap',
+
+  columns => [
+    id                      => { type => 'integer', not_null => 1, sequence => 'glid' },
+    invnumber               => { type => 'text', not_null => 1 },
+    transdate               => { type => 'date', default => 'now' },
+    gldate                  => { type => 'date', default => 'now' },
+    vendor_id               => { type => 'integer' },
+    taxincluded             => { type => 'boolean', default => 'false' },
+    amount                  => { type => 'numeric', precision => 5, scale => 15 },
+    netamount               => { type => 'numeric', precision => 5, scale => 15 },
+    paid                    => { type => 'numeric', precision => 5, scale => 15 },
+    datepaid                => { type => 'date' },
+    duedate                 => { type => 'date' },
+    invoice                 => { type => 'boolean', default => 'false' },
+    ordnumber               => { type => 'text' },
+    curr                    => { type => 'character', length => 3 },
+    notes                   => { type => 'text' },
+    employee_id             => { type => 'integer' },
+    quonumber               => { type => 'text' },
+    intnotes                => { type => 'text' },
+    department_id           => { type => 'integer', default => '0' },
+    itime                   => { type => 'timestamp', default => 'now()' },
+    mtime                   => { type => 'timestamp' },
+    shipvia                 => { type => 'text' },
+    cp_id                   => { type => 'integer' },
+    language_id             => { type => 'integer' },
+    payment_id              => { type => 'integer' },
+    storno                  => { type => 'boolean', default => 'false' },
+    taxzone_id              => { type => 'integer' },
+    type                    => { type => 'text' },
+    orddate                 => { type => 'date' },
+    quodate                 => { type => 'date' },
+    globalproject_id        => { type => 'integer' },
+    transaction_description => { type => 'text' },
+    storno_id               => { type => 'integer' },
+    notes_bottom            => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    globalproject => {
+      class       => 'SL::DB::Project',
+      key_columns => { globalproject_id => 'id' },
+    },
+
+    storno_obj => {
+      class       => 'SL::DB::PurchaseInvoice',
+      key_columns => { storno_id => 'id' },
+    },
+
+    vendor => {
+      class       => 'SL::DB::Vendor',
+      key_columns => { vendor_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/RMA.pm b/SL/DB/MetaSetup/RMA.pm
new file mode 100644 (file)
index 0000000..20790e3
--- /dev/null
@@ -0,0 +1,48 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::RMA;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'rma',
+
+  columns => [
+    id                   => { type => 'integer', not_null => 1, sequence => 'id' },
+    rmanumber            => { type => 'text', not_null => 1 },
+    transdate            => { type => 'date', default => 'now' },
+    vendor_id            => { type => 'integer' },
+    customer_id          => { type => 'integer' },
+    amount               => { type => 'numeric', precision => 5, scale => 15 },
+    netamount            => { type => 'numeric', precision => 5, scale => 15 },
+    reqdate              => { type => 'date' },
+    taxincluded          => { type => 'boolean' },
+    shippingpoint        => { type => 'text' },
+    notes                => { type => 'text' },
+    curr                 => { type => 'character', length => 3 },
+    employee_id          => { type => 'integer' },
+    closed               => { type => 'boolean', default => 'false' },
+    quotation            => { type => 'boolean', default => 'false' },
+    quonumber            => { type => 'text' },
+    cusrmanumber         => { type => 'text' },
+    intnotes             => { type => 'text' },
+    delivery_customer_id => { type => 'integer' },
+    delivery_vendor_id   => { type => 'integer' },
+    language_id          => { type => 'integer' },
+    payment_id           => { type => 'integer' },
+    department_id        => { type => 'integer', default => '0' },
+    itime                => { type => 'timestamp', default => 'now()' },
+    mtime                => { type => 'timestamp' },
+    shipvia              => { type => 'text' },
+    cp_id                => { type => 'integer' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/RMAItem.pm b/SL/DB/MetaSetup/RMAItem.pm
new file mode 100644 (file)
index 0000000..dd32700
--- /dev/null
@@ -0,0 +1,47 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::RMAItem;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'rmaitems',
+
+  columns => [
+    trans_id      => { type => 'integer' },
+    parts_id      => { type => 'integer' },
+    description   => { type => 'text' },
+    qty           => { type => 'float', precision => 4 },
+    base_qty      => { type => 'float', precision => 4 },
+    sellprice     => { type => 'numeric', precision => 5, scale => 15 },
+    discount      => { type => 'float', precision => 4 },
+    project_id    => { type => 'integer' },
+    reqdate       => { type => 'date' },
+    ship          => { type => 'float', precision => 4 },
+    serialnumber  => { type => 'text' },
+    id            => { type => 'integer', not_null => 1, sequence => 'orderitemsid' },
+    itime         => { type => 'timestamp', default => 'now()' },
+    mtime         => { type => 'timestamp' },
+    pricegroup_id => { type => 'integer' },
+    rmanumber     => { type => 'text' },
+    transdate     => { type => 'text' },
+    cusrmanumber  => { type => 'text' },
+    unit          => { type => 'varchar', length => 20 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    parts => {
+      class       => 'SL::DB::Part',
+      key_columns => { parts_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/RecordLink.pm b/SL/DB/MetaSetup/RecordLink.pm
new file mode 100644 (file)
index 0000000..4059be8
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::RecordLink;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'record_links',
+
+  columns => [
+    from_table => { type => 'varchar', length => 50, not_null => 1 },
+    from_id    => { type => 'integer', not_null => 1 },
+    to_table   => { type => 'varchar', length => 50, not_null => 1 },
+    to_id      => { type => 'integer', not_null => 1 },
+    itime      => { type => 'timestamp', default => 'now()' },
+    id         => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/SchemaInfo.pm b/SL/DB/MetaSetup/SchemaInfo.pm
new file mode 100644 (file)
index 0000000..0a1e70e
--- /dev/null
@@ -0,0 +1,24 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::SchemaInfo;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'schema_info',
+
+  columns => [
+    tag   => { type => 'text', not_null => 1 },
+    login => { type => 'text' },
+    itime => { type => 'timestamp', default => 'now()' },
+  ],
+
+  primary_key_columns => [ 'tag' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/SepaExport.pm b/SL/DB/MetaSetup/SepaExport.pm
new file mode 100644 (file)
index 0000000..943121a
--- /dev/null
@@ -0,0 +1,33 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::SepaExport;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'sepa_export',
+
+  columns => [
+    id          => { type => 'serial', not_null => 1 },
+    employee_id => { type => 'integer', not_null => 1 },
+    executed    => { type => 'boolean', default => 'false' },
+    closed      => { type => 'boolean', default => 'false' },
+    itime       => { type => 'timestamp', default => 'now()' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/SepaExportItem.pm b/SL/DB/MetaSetup/SepaExportItem.pm
new file mode 100644 (file)
index 0000000..b9899c2
--- /dev/null
@@ -0,0 +1,50 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::SepaExportItem;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'sepa_export_items',
+
+  columns => [
+    id                       => { type => 'integer', not_null => 1, sequence => 'id' },
+    sepa_export_id           => { type => 'integer', not_null => 1 },
+    ap_id                    => { type => 'integer', not_null => 1 },
+    chart_id                 => { type => 'integer', not_null => 1 },
+    amount                   => { type => 'numeric', precision => 5, scale => 25 },
+    reference                => { type => 'varchar', length => 35 },
+    requested_execution_date => { type => 'date' },
+    executed                 => { type => 'boolean', default => 'false' },
+    execution_date           => { type => 'date' },
+    our_iban                 => { type => 'varchar', length => 100 },
+    our_bic                  => { type => 'varchar', length => 100 },
+    vendor_iban              => { type => 'varchar', length => 100 },
+    vendor_bic               => { type => 'varchar', length => 100 },
+    end_to_end_id            => { type => 'varchar', length => 35 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    ap => {
+      class       => 'SL::DB::PurchaseInvoice',
+      key_columns => { ap_id => 'id' },
+    },
+
+    chart => {
+      class       => 'SL::DB::Chart',
+      key_columns => { chart_id => 'id' },
+    },
+
+    sepa_export => {
+      class       => 'SL::DB::SepaExport',
+      key_columns => { sepa_export_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Shipto.pm b/SL/DB/MetaSetup/Shipto.pm
new file mode 100644 (file)
index 0000000..0943c04
--- /dev/null
@@ -0,0 +1,37 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Shipto;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'shipto',
+
+  columns => [
+    trans_id           => { type => 'integer' },
+    shiptoname         => { type => 'varchar', length => 75 },
+    shiptodepartment_1 => { type => 'varchar', length => 75 },
+    shiptodepartment_2 => { type => 'varchar', length => 75 },
+    shiptostreet       => { type => 'varchar', length => 75 },
+    shiptozipcode      => { type => 'varchar', length => 75 },
+    shiptocity         => { type => 'varchar', length => 75 },
+    shiptocountry      => { type => 'varchar', length => 75 },
+    shiptocontact      => { type => 'varchar', length => 75 },
+    shiptophone        => { type => 'varchar', length => 30 },
+    shiptofax          => { type => 'varchar', length => 30 },
+    shiptoemail        => { type => 'text' },
+    itime              => { type => 'timestamp', default => 'now()' },
+    mtime              => { type => 'timestamp' },
+    module             => { type => 'text' },
+    shipto_id          => { type => 'integer', not_null => 1, sequence => 'id' },
+  ],
+
+  primary_key_columns => [ 'shipto_id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Status.pm b/SL/DB/MetaSetup/Status.pm
new file mode 100644 (file)
index 0000000..c916a78
--- /dev/null
@@ -0,0 +1,30 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Status;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'status',
+
+  columns => [
+    trans_id  => { type => 'integer' },
+    formname  => { type => 'text' },
+    printed   => { type => 'boolean', default => 'false' },
+    emailed   => { type => 'boolean', default => 'false' },
+    spoolfile => { type => 'text' },
+    chart_id  => { type => 'integer' },
+    itime     => { type => 'timestamp', default => 'now()' },
+    mtime     => { type => 'timestamp' },
+    id        => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Tax.pm b/SL/DB/MetaSetup/Tax.pm
new file mode 100644 (file)
index 0000000..793b649
--- /dev/null
@@ -0,0 +1,29 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Tax;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'tax',
+
+  columns => [
+    chart_id       => { type => 'integer' },
+    rate           => { type => 'numeric', precision => 5, scale => 15 },
+    taxnumber      => { type => 'text' },
+    taxkey         => { type => 'integer' },
+    taxdescription => { type => 'text' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    id             => { type => 'integer', not_null => 1, sequence => 'id' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/TaxKey.pm b/SL/DB/MetaSetup/TaxKey.pm
new file mode 100644 (file)
index 0000000..087903f
--- /dev/null
@@ -0,0 +1,32 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::TaxKey;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'taxkeys',
+
+  columns => [
+    id        => { type => 'integer', not_null => 1, sequence => 'id' },
+    chart_id  => { type => 'integer' },
+    tax_id    => { type => 'integer' },
+    taxkey_id => { type => 'integer' },
+    pos_ustva => { type => 'integer' },
+    startdate => { type => 'date' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    tax => {
+      class       => 'SL::DB::Tax',
+      key_columns => { tax_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/TaxZone.pm b/SL/DB/MetaSetup/TaxZone.pm
new file mode 100644 (file)
index 0000000..5823d68
--- /dev/null
@@ -0,0 +1,21 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::TaxZone;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'tax_zones',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1 },
+    description => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Taxkey.pm b/SL/DB/MetaSetup/Taxkey.pm
new file mode 100644 (file)
index 0000000..558163f
--- /dev/null
@@ -0,0 +1,32 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Taxkey;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'taxkeys',
+
+  columns => [
+    id        => { type => 'integer', not_null => 1, sequence => 'id' },
+    chart_id  => { type => 'integer' },
+    tax_id    => { type => 'integer' },
+    taxkey_id => { type => 'integer' },
+    pos_ustva => { type => 'integer' },
+    startdate => { type => 'date' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    tax => {
+      class       => 'SL::DB::Tax',
+      key_columns => { tax_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/TodoUserConfig.pm b/SL/DB/MetaSetup/TodoUserConfig.pm
new file mode 100644 (file)
index 0000000..2be46cd
--- /dev/null
@@ -0,0 +1,33 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::TodoUserConfig;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'todo_user_config',
+
+  columns => [
+    employee_id                         => { type => 'integer', not_null => 1 },
+    show_after_login                    => { type => 'boolean', default => 'true' },
+    show_follow_ups                     => { type => 'boolean', default => 'true' },
+    show_follow_ups_login               => { type => 'boolean', default => 'true' },
+    show_overdue_sales_quotations       => { type => 'boolean', default => 'true' },
+    show_overdue_sales_quotations_login => { type => 'boolean', default => 'true' },
+    id                                  => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    employee => {
+      class       => 'SL::DB::Employee',
+      key_columns => { employee_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/TransferType.pm b/SL/DB/MetaSetup/TransferType.pm
new file mode 100644 (file)
index 0000000..1f018bf
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::TransferType;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'transfer_type',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    direction   => { type => 'varchar', length => 10, not_null => 1 },
+    description => { type => 'text' },
+    sortkey     => { type => 'integer' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    mtime       => { type => 'timestamp' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Translation.pm b/SL/DB/MetaSetup/Translation.pm
new file mode 100644 (file)
index 0000000..acd9606
--- /dev/null
@@ -0,0 +1,28 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Translation;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'translation',
+
+  columns => [
+    parts_id        => { type => 'integer' },
+    language_id     => { type => 'integer' },
+    translation     => { type => 'text' },
+    itime           => { type => 'timestamp', default => 'now()' },
+    mtime           => { type => 'timestamp' },
+    longdescription => { type => 'text' },
+    id              => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/TranslationPaymentTerm.pm b/SL/DB/MetaSetup/TranslationPaymentTerm.pm
new file mode 100644 (file)
index 0000000..9f1fa1c
--- /dev/null
@@ -0,0 +1,35 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::TranslationPaymentTerm;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'translation_payment_terms',
+
+  columns => [
+    payment_terms_id => { type => 'integer', not_null => 1 },
+    language_id      => { type => 'integer', not_null => 1 },
+    description_long => { type => 'text' },
+    id               => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    language => {
+      class       => 'SL::DB::Language',
+      key_columns => { language_id => 'id' },
+    },
+
+    payment_terms => {
+      class       => 'SL::DB::PaymentTerm',
+      key_columns => { payment_terms_id => 'id' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Unit.pm b/SL/DB/MetaSetup/Unit.pm
new file mode 100644 (file)
index 0000000..c229462
--- /dev/null
@@ -0,0 +1,31 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Unit;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'units',
+
+  columns => [
+    name      => { type => 'varchar', length => 20, not_null => 1 },
+    base_unit => { type => 'varchar', length => 20 },
+    factor    => { type => 'numeric', precision => 5, scale => 20 },
+    type      => { type => 'varchar', length => 20 },
+    sortkey   => { type => 'integer', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'name' ],
+
+  foreign_keys => [
+    unit => {
+      class       => 'SL::DB::Unit',
+      key_columns => { base_unit => 'name' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/UnitsLanguage.pm b/SL/DB/MetaSetup/UnitsLanguage.pm
new file mode 100644 (file)
index 0000000..cd00dc8
--- /dev/null
@@ -0,0 +1,36 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::UnitsLanguage;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'units_language',
+
+  columns => [
+    unit             => { type => 'varchar', length => 20, not_null => 1 },
+    language_id      => { type => 'integer', not_null => 1 },
+    localized        => { type => 'varchar', length => 20 },
+    localized_plural => { type => 'varchar', length => 20 },
+    id               => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  foreign_keys => [
+    language => {
+      class       => 'SL::DB::Language',
+      key_columns => { language_id => 'id' },
+    },
+
+    unit_obj => {
+      class       => 'SL::DB::Unit',
+      key_columns => { unit => 'name' },
+    },
+  ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Vendor.pm b/SL/DB/MetaSetup/Vendor.pm
new file mode 100644 (file)
index 0000000..6d858e5
--- /dev/null
@@ -0,0 +1,65 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Vendor;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'vendor',
+
+  columns => [
+    id             => { type => 'integer', not_null => 1, sequence => 'id' },
+    name           => { type => 'varchar', length => 75, 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 => 'varchar', length => 75 },
+    phone          => { type => 'varchar', length => 30 },
+    fax            => { type => 'varchar', length => 30 },
+    homepage       => { type => 'text' },
+    email          => { type => 'text' },
+    notes          => { type => 'text' },
+    terms          => { type => 'integer', default => '0' },
+    taxincluded    => { type => 'boolean' },
+    vendornumber   => { type => 'text' },
+    cc             => { type => 'text' },
+    bcc            => { type => 'text' },
+    gifi_accno     => { type => 'text' },
+    business_id    => { type => 'integer' },
+    taxnumber      => { type => 'text' },
+    discount       => { type => 'float', precision => 4 },
+    creditlimit    => { type => 'numeric', precision => 5, scale => 15 },
+    account_number => { type => 'varchar', length => 15 },
+    bank_code      => { type => 'varchar', length => 10 },
+    bank           => { type => 'text' },
+    language       => { type => 'varchar', length => 5 },
+    datevexport    => { type => 'integer' },
+    itime          => { type => 'timestamp', default => 'now()' },
+    mtime          => { type => 'timestamp' },
+    obsolete       => { type => 'boolean', default => 'false' },
+    username       => { type => 'varchar', length => 50 },
+    user_password  => { type => 'varchar', length => 12 },
+    salesman_id    => { type => 'integer' },
+    v_customer_id  => { type => 'text' },
+    language_id    => { type => 'integer' },
+    payment_id     => { type => 'integer' },
+    taxzone_id     => { type => 'integer', default => '0', not_null => 1 },
+    greeting       => { type => 'text' },
+    ustid          => { type => 'varchar', length => 14 },
+    direct_debit   => { type => 'boolean', default => 'false' },
+    iban           => { type => 'varchar', length => 100 },
+    bic            => { type => 'varchar', length => 100 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/VendorTax.pm b/SL/DB/MetaSetup/VendorTax.pm
new file mode 100644 (file)
index 0000000..bbd3988
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::VendorTax;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'vendortax',
+
+  columns => [
+    vendor_id => { type => 'integer' },
+    chart_id  => { type => 'integer' },
+    itime     => { type => 'timestamp', default => 'now()' },
+    mtime     => { type => 'timestamp' },
+    id        => { type => 'serial', not_null => 1 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/Warehouse.pm b/SL/DB/MetaSetup/Warehouse.pm
new file mode 100644 (file)
index 0000000..0638b06
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::Warehouse;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'warehouse',
+
+  columns => [
+    id          => { type => 'integer', not_null => 1, sequence => 'id' },
+    description => { type => 'text' },
+    itime       => { type => 'timestamp', default => 'now()' },
+    mtime       => { type => 'timestamp' },
+    sortkey     => { type => 'integer' },
+    invalid     => { type => 'boolean' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+
+  allow_inline_column_values => 1,
+);
+
+1;
+;
diff --git a/SL/DB/Note.pm b/SL/DB/Note.pm
new file mode 100644 (file)
index 0000000..3678295
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Note;
+
+use strict;
+
+use SL::DB::MetaSetup::Note;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm
new file mode 100644 (file)
index 0000000..f138518
--- /dev/null
@@ -0,0 +1,140 @@
+package SL::DB::Object;
+
+use strict;
+
+use Readonly;
+use Rose::DB::Object;
+use List::MoreUtils qw(any);
+
+use SL::DB;
+use SL::DB::Helpers::Attr;
+use SL::DB::Helpers::Metadata;
+use SL::DB::Helpers::Manager;
+
+use base qw(Rose::DB::Object);
+
+sub new {
+  my $class = shift;
+  my $self  = $class->SUPER::new();
+
+  $self->_assign_attributes(@_) if $self;
+
+  return $self;
+}
+
+sub init_db {
+  my $class_or_self = shift;
+  my $class         = ref($class_or_self) || $class_or_self;
+  my $type          = 'LXOFFICE';
+
+  return SL::DB::create(undef, $type);
+}
+
+sub meta_class {
+  return 'SL::DB::Helpers::Metadata';
+}
+
+sub _get_manager_class {
+  my $class_or_self = shift;
+  my $class         = ref($class_or_self) || $class_or_self;
+
+  return $class->meta->convention_manager->auto_manager_class_name($class);
+}
+
+Readonly my %text_column_types => (text => 1, char => 1, varchar => 1);
+
+sub assign_attributes {
+  my $self       = shift;
+  my %attributes = @_;
+
+  my $pk         = ref($self)->meta->primary_key;
+  delete @attributes{$pk->column_names} if $pk;
+
+  return $self->_assign_attributes(%attributes);
+}
+
+sub _assign_attributes {
+  my $self       = shift;
+  my %attributes = @_;
+
+  my %types      = map { $_->name => $_->type } ref($self)->meta->columns;
+
+  while (my ($attribute, $value) = each %attributes) {
+    my $type = lc($types{$attribute} || 'text');
+    $value   = $type eq 'boolean'        ? ($value ? 't' : 'f')
+             : $text_column_types{$type} ? $value
+             :                             ($value || undef);
+    $self->$attribute($value);
+  }
+
+  return $self;
+}
+
+sub update_attributes {
+  my $self = shift;
+
+  $self->assign_attributes(@_)->save;
+
+  return $self;
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+SL::DB::Object: Base class for all of our model classes
+
+=head1 DESCRIPTION
+
+This is the base class from which all other model classes are
+derived. It contains functionality and settings required for all model
+classes.
+
+Several functions (e.g. C<make_manager_class>, C<init_db>) in this
+class are used for setting up the classes / base classes used for all
+model instances. They overwrite the functions from
+L<Rose::DB::Object>.
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item assign_attributes %attributes
+
+=item _assign_attributes %attributes
+
+Assigns all elements from C<%attributes> to the columns by calling
+their setter functions. The difference between the two functions is
+that C<assign_attributes> protects primary key columns while
+C<_assign_attributes> doesn't.
+
+Both functions handle values that are empty strings by replacing them
+with C<undef> for non-text columns. This allows the calling functions
+to use data from HTML forms as the input for C<assign_attributes>
+without having to remove empty strings themselves (think of
+e.g. select boxes with an empty option which should be turned into
+C<NULL> in the database).
+
+=item update_attributes %attributes
+
+Assigns the attributes from C<%attributes> by calling the
+C<assign_attributes> function and saves the object afterwards. Returns
+the object itself.
+
+=item _get_manager_class
+
+Returns the manager package for the object or class that it is called
+on. Can be used from methods in this package for getting the actual
+object's manager.
+
+=back
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/SL/DB/Order.pm b/SL/DB/Order.pm
new file mode 100644 (file)
index 0000000..2dd29c3
--- /dev/null
@@ -0,0 +1,103 @@
+package SL::DB::Order;
+
+use strict;
+
+use SL::RecordLinks;
+
+use SL::DB::MetaSetup::Order;
+use SL::DB::Manager::Order;
+use SL::DB::Invoice;
+
+__PACKAGE__->meta->add_relationship(
+  orderitems => {
+    type         => 'one to many',
+    class        => 'SL::DB::OrderItem',
+    column_map   => { id => 'trans_id' },
+    manager_args => {
+      with_objects => [ 'part' ]
+    }
+  }
+);
+
+__PACKAGE__->meta->initialize;
+
+# methods
+
+sub type {
+  my $self = shift;
+
+  return 'sales_order'       if $self->customer_id && ! $self->quotation;
+  return 'purchase_order'    if $self->vendor_id   && ! $self->quotation;
+  return 'sales_quotation'   if $self->customer_id &&   $self->quotation;
+  return 'request_quotation' if $self->vendor_id   &&   $self->quotation;
+
+  return;
+}
+
+sub is_type {
+  return shift->type eq shift;
+}
+
+sub invoices {
+  my $self   = shift;
+  my %params = @_;
+
+  if ($self->quotation) {
+    return [];
+  } else {
+    return SL::DB::Manager::Invoice->get_all(
+      query => [
+        ordnumber => $self->ordnumber,
+        @{ $params{query} || [] },
+      ]
+    );
+  }
+}
+
+sub abschlag_invoices {
+  return shift()->invoices(query => [ abschlag => 1 ]);
+}
+
+sub end_invoice {
+  return shift()->invoices(query => [ abschlag => 0 ]);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+SL::DB::Order - Order Datenbank Objekt.
+
+=head1 FUNCTIONS
+
+=head2 type
+
+Returns one of the following string types:
+
+=over 4
+
+=item saes_order
+
+=item purchase_order
+
+=item sales_quotation
+
+=item request_quotation
+
+=back
+
+=head2 is_type TYPE
+
+Rreturns true if the order is of the given type.
+
+=head1 BUGS
+
+Nothing here yet.
+
+=head1 AUTHOR
+
+  Sven Schöling <s.schoeling@linet-services.de>
+
+=cut
diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm
new file mode 100644 (file)
index 0000000..94d2bc8
--- /dev/null
@@ -0,0 +1,25 @@
+package SL::DB::OrderItem;
+
+use strict;
+
+use SL::DB::MetaSetup::OrderItem;
+
+__PACKAGE__->meta->add_relationship(
+  part => {
+    type         => 'one to one',
+    class        => 'SL::DB::Part',
+    column_map   => { parts_id => 'id' },
+  }
+);
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->initialize;
+
+sub is_price_update_available {
+  my $self = shift;
+  return $self->origprice > $self->part->sellprice;
+}
+
+1;
diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm
new file mode 100644 (file)
index 0000000..52b7520
--- /dev/null
@@ -0,0 +1,123 @@
+package SL::DB::Part;
+
+use strict;
+
+use Carp;
+use SL::DBUtils;
+use SL::DB::MetaSetup::Part;
+use SL::DB::Manager::Part;
+
+__PACKAGE__->meta->add_relationships(
+  unit_obj                     => {
+    type         => 'one to one',
+    class        => 'SL::DB::Unit',
+    column_map   => { unit => 'name' },
+  },
+  assemblies                     => {
+    type         => 'one to many',
+    class        => 'SL::DB::Assembly',
+    column_map   => { id => 'id' },
+  },
+);
+
+__PACKAGE__->meta->initialize;
+
+sub is_type {
+  my $self = shift;
+  my $type  = lc(shift || '');
+
+  if ($type =~ m/^part/) {
+    return !$self->assembly && $self->inventory_accno_id  ? 1 : 0;
+
+  } elsif ($type =~ m/^service/) {
+    return !$self->inventory_accno_id && !$self->assembly ? 1 : 0;
+
+  } elsif ($type =~ m/^assembl/) {
+    return $self->assembly                                ? 1 : 0;
+
+  }
+
+  confess "Unknown type parameter '$type'";
+}
+
+sub get_sellprice_info {
+  my $self   = shift;
+  my %params = @_;
+
+  confess "Missing part id" unless $self->id;
+
+  my $object = $self->load;
+
+  return { sellprice       => $object->sellprice,
+           price_factor_id => $object->price_factor_id };
+}
+
+sub get_ordered_qty {
+  my $self   = shift;
+  my %result = SL::DB::Manager::Part->get_ordered_qty($self->id);
+
+  return $result{ $self->id };
+}
+
+sub available_units {
+  shift->unit_obj->convertible_units;
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+SL::DB::Part: Model for the 'parts' table
+
+=head1 SYNOPSIS
+
+This is a standard Rose::DB::Object based model and can be used as one.
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item is_type $type
+
+Tests if the current object is a part, a service or an
+assembly. C<$type> must be one of the words 'part', 'service' or
+'assembly' (their plurals are ok, too).
+
+Returns 1 if the requested type matches, 0 if it doesn't and
+C<confess>es if an unknown C<$type> parameter is encountered.
+
+=item get_sellprice_info %params
+
+Retrieves the C<sellprice> and C<price_factor_id> for a part under
+different conditions and returns a hash reference with those two keys.
+
+If C<%params> contains a key C<project_id> then a project price list
+will be consulted if one exists for that project. In this case the
+parameter C<country_id> is evaluated as well: if a price list entry
+has been created for this country then it will be used. Otherwise an
+entry without a country set will be used.
+
+If none of the above conditions is met then the information from
+C<$self> is used.
+
+=item get_ordered_qty %params
+
+Retrieves the quantity that has been ordered from a vendor but that
+has not been delivered yet. Only open purchase orders are considered.
+
+=item get_uncommissioned_qty %params
+
+Retrieves the quantity that has been ordered by a customer but that
+has not been commissioned yet. Only open sales orders are considered.
+
+=back
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/SL/DB/PartsGroup.pm b/SL/DB/PartsGroup.pm
new file mode 100644 (file)
index 0000000..88ab22f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::PartsGroup;
+
+use strict;
+
+use SL::DB::MetaSetup::PartsGroup;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/PartsTax.pm b/SL/DB/PartsTax.pm
new file mode 100644 (file)
index 0000000..3bea19b
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::PartsTax;
+
+use strict;
+
+use SL::DB::MetaSetup::PartsTax;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/PaymentTerm.pm b/SL/DB/PaymentTerm.pm
new file mode 100644 (file)
index 0000000..b525910
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::PaymentTerm;
+
+use strict;
+
+use SL::DB::MetaSetup::PaymentTerm;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/PriceFactor.pm b/SL/DB/PriceFactor.pm
new file mode 100644 (file)
index 0000000..6680a12
--- /dev/null
@@ -0,0 +1,31 @@
+package SL::DB::PriceFactor;
+
+use strict;
+
+use SL::DB::MetaSetup::PriceFactor;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+SL::DB::PriceFactor: Model for the 'price_factors' table
+
+=head1 SYNOPSIS
+
+This is a standard Rose::DB::Object based model and can be used as one.
+
+=head1 FUNCTIONS
+
+None so far.
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/SL/DB/Pricegroup.pm b/SL/DB/Pricegroup.pm
new file mode 100644 (file)
index 0000000..8c9c372
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Pricegroup;
+
+use strict;
+
+use SL::DB::MetaSetup::Pricegroup;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Prices.pm b/SL/DB/Prices.pm
new file mode 100644 (file)
index 0000000..45d54a0
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Prices;
+
+use strict;
+
+use SL::DB::MetaSetup::Prices;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Printer.pm b/SL/DB/Printer.pm
new file mode 100644 (file)
index 0000000..2c3eacc
--- /dev/null
@@ -0,0 +1,9 @@
+package SL::DB::Printer;
+
+use strict;
+
+use SL::DB::MetaSetup::Printer;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Project.pm b/SL/DB/Project.pm
new file mode 100644 (file)
index 0000000..4b93c5a
--- /dev/null
@@ -0,0 +1,31 @@
+package SL::DB::Project;
+
+use strict;
+
+use SL::DB::MetaSetup::Project;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+SL::DB::Project: Model for the 'project' table
+
+=head1 SYNOPSIS
+
+This is a standard Rose::DB::Object based model and can be used as one.
+
+=head1 FUNCTIONS
+
+None so far.
+
+=head1 AUTHOR
+
+Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
+
+=cut
diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm
new file mode 100644 (file)
index 0000000..a06a3b6
--- /dev/null
@@ -0,0 +1,17 @@
+package SL::DB::PurchaseInvoice;
+
+use strict;
+
+use SL::DB::MetaSetup::PurchaseInvoice;
+use SL::DB::Manager::PurchaseInvoice;
+
+__PACKAGE__->meta->add_relationship(invoiceitems => { type         => 'one to many',
+                                                      class        => 'SL::DB::InvoiceItem',
+                                                      column_map   => { id => 'trans_id' },
+                                                      manager_args => { with_objects => [ 'part' ] }
+                                                    },
+                                   );
+
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/SL/DB/RMA.pm b/SL/DB/RMA.pm
new file mode 100644 (file)
index 0000000..49c8d71
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::RMA;
+
+use strict;
+
+use SL::DB::MetaSetup::RMA;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/RMAItem.pm b/SL/DB/RMAItem.pm
new file mode 100644 (file)
index 0000000..c62e807
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::RMAItem;
+
+use strict;
+
+use SL::DB::MetaSetup::RMAItem;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/RecordLink.pm b/SL/DB/RecordLink.pm
new file mode 100644 (file)
index 0000000..7aed15a
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::RecordLink;
+
+use strict;
+
+use SL::DB::MetaSetup::RecordLink;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/SchemaInfo.pm b/SL/DB/SchemaInfo.pm
new file mode 100644 (file)
index 0000000..b1c38d4
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::SchemaInfo;
+
+use strict;
+
+use SL::DB::MetaSetup::SchemaInfo;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/SepaExport.pm b/SL/DB/SepaExport.pm
new file mode 100644 (file)
index 0000000..ab45045
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::SepaExport;
+
+use strict;
+
+use SL::DB::MetaSetup::SepaExport;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/SepaExportItem.pm b/SL/DB/SepaExportItem.pm
new file mode 100644 (file)
index 0000000..3c46ee3
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::SepaExportItem;
+
+use strict;
+
+use SL::DB::MetaSetup::SepaExportItem;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Shipto.pm b/SL/DB/Shipto.pm
new file mode 100644 (file)
index 0000000..98b7ca1
--- /dev/null
@@ -0,0 +1,23 @@
+package SL::DB::Shipto;
+
+use strict;
+use Readonly;
+
+use SL::DB::MetaSetup::Shipto;
+
+Readonly our @SHIPTO_VARIABLES => qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
+                                     shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2);
+
+__PACKAGE__->meta->make_manager_class;
+
+sub displayable_id {
+  my $self = shift;
+  my $text = join('; ', grep { $_ } (map({ $self->$_ } qw(shiptoname shiptostreet)),
+                                     join(' ', grep { $_ }
+                                               map  { $self->$_ }
+                                               qw(shiptozipcode shiptocity))));
+
+  return $text;
+}
+
+1;
diff --git a/SL/DB/Status.pm b/SL/DB/Status.pm
new file mode 100644 (file)
index 0000000..38d230e
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Status;
+
+use strict;
+
+use SL::DB::MetaSetup::Status;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Tax.pm b/SL/DB/Tax.pm
new file mode 100644 (file)
index 0000000..58161ae
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Tax;
+
+use strict;
+
+use SL::DB::MetaSetup::Tax;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/TaxKey.pm b/SL/DB/TaxKey.pm
new file mode 100644 (file)
index 0000000..bd27ccf
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::TaxKey;
+
+use strict;
+
+use SL::DB::MetaSetup::TaxKey;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/TaxZone.pm b/SL/DB/TaxZone.pm
new file mode 100644 (file)
index 0000000..7e0f2e7
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::TaxZone;
+
+use strict;
+
+use SL::DB::MetaSetup::TaxZone;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/TodoUserConfig.pm b/SL/DB/TodoUserConfig.pm
new file mode 100644 (file)
index 0000000..fd12020
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::TodoUserConfig;
+
+use strict;
+
+use SL::DB::MetaSetup::TodoUserConfig;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/TransferType.pm b/SL/DB/TransferType.pm
new file mode 100644 (file)
index 0000000..9d13a86
--- /dev/null
@@ -0,0 +1,17 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::TransferType;
+
+use strict;
+
+use SL::DB::MetaSetup::TransferType;
+use SL::DB::Manager::TransferType;
+
+# methods
+
+sub description_t8 {
+  return $::locale->text(shift()->description);
+}
+
+1;
diff --git a/SL/DB/Translation.pm b/SL/DB/Translation.pm
new file mode 100644 (file)
index 0000000..841a3a8
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Translation;
+
+use strict;
+
+use SL::DB::MetaSetup::Translation;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/TranslationPaymentTerm.pm b/SL/DB/TranslationPaymentTerm.pm
new file mode 100644 (file)
index 0000000..92cf84a
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::TranslationPaymentTerm;
+
+use strict;
+
+use SL::DB::MetaSetup::TranslationPaymentTerm;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Unit.pm b/SL/DB/Unit.pm
new file mode 100644 (file)
index 0000000..6a19733
--- /dev/null
@@ -0,0 +1,41 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Unit;
+
+use strict;
+
+use SL::DB::MetaSetup::Unit;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->add_relationships(
+  base => {
+    type         => 'one to one',
+    class        => 'SL::DB::Unit',
+    column_map   => { base_unit => 'name' },
+  },
+);
+
+__PACKAGE__->meta->initialize;
+
+#methods
+
+sub unit_class {
+  my $self   = shift;
+
+  return $self if !$self->base_unit || $self->name eq $self->base_unit;
+  return $self->base->unit_class;
+}
+
+sub convertible_units {
+  my $self = shift;
+  return [
+    sort { $a->sortkey <=> $b->sortkey }
+    grep { $_->unit_class->name eq $self->unit_class->name }
+    @{ SL::DB::Manager::Unit->get_all }
+  ];
+}
+
+1;
diff --git a/SL/DB/UnitsLanguage.pm b/SL/DB/UnitsLanguage.pm
new file mode 100644 (file)
index 0000000..256da5f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::UnitsLanguage;
+
+use strict;
+
+use SL::DB::MetaSetup::UnitsLanguage;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/VC.pm b/SL/DB/VC.pm
new file mode 100644 (file)
index 0000000..44b2dbb
--- /dev/null
@@ -0,0 +1,53 @@
+package SL::DB::VC;
+
+use strict;
+
+require Exporter;
+use SL::DBUtils;
+
+our @ISA    = qw(Exporter);
+our @EXPORT = qw(get_credit_remaining);
+
+sub get_credit_remaining {
+  my $vc               = shift;
+  my ($type, $arap)    = ref $vc eq 'SL::DB::Customer' ? ('customer', 'ar') : ('vendor', 'ap');
+  my %params           = @_;
+
+  my $credit_remaining = $vc->creditlimit || 0;
+
+  my $query            = <<SQL;
+    SELECT SUM(${arap}.amount - ${arap}.paid)
+    FROM ${arap}
+    WHERE ${type}_id = ?
+SQL
+  my ($amount_unpaid)  = selectfirst_array_query($::form, $vc->dbh, $query, $vc->id);
+  $credit_remaining   -= $amount_unpaid;
+
+  $query = <<SQL;
+    SELECT o.amount,
+      (SELECT e.buy FROM exchangerate e
+       WHERE e.curr = o.curr
+         AND e.transdate = o.transdate)
+    FROM oe o
+    WHERE (o.${type}_id = ?)
+      AND NOT COALESCE(o.quotation, FALSE)
+      AND NOT COALESCE(o.closed,    FALSE)
+SQL
+
+  my @values;
+  if ($params{exclude_order_id}) {
+    $query .= qq| AND (o.id <> ?)|;
+    push @values, $params{exclude_order_id};
+  }
+
+  my $sth = prepare_execute_query($::form, $vc->dbh, $query, $vc->id, @values);
+
+  while (my ($amount, $exch) = $sth->fetchrow_array) {
+    $credit_remaining -= $amount * ($exch || 1);
+  }
+  $sth->finish;
+
+  return $credit_remaining;
+}
+
+1;
diff --git a/SL/DB/Vendor.pm b/SL/DB/Vendor.pm
new file mode 100644 (file)
index 0000000..11e23fe
--- /dev/null
@@ -0,0 +1,27 @@
+package SL::DB::Vendor;
+
+use strict;
+
+use SL::DB::MetaSetup::Vendor;
+
+use SL::DB::VC;
+
+__PACKAGE__->meta->add_relationship(
+  shipto => {
+    type         => 'one to many',
+    class        => 'SL::DB::Shipto',
+    column_map   => { id      => 'trans_id' },
+    manager_args => { sort_by => 'lower(shipto.shiptoname)' },
+    query_args   => [ 'shipto.module' => 'CT' ],
+  },
+  business => {
+    type         => 'one to one',
+    class        => 'SL::DB::Business',
+    column_map   => { business_id => 'id' },
+  },
+);
+
+__PACKAGE__->meta->make_manager_class;
+__PACKAGE__->meta->initialize;
+
+1;
diff --git a/SL/DB/VendorTax.pm b/SL/DB/VendorTax.pm
new file mode 100644 (file)
index 0000000..a4c6fc9
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::VendorTax;
+
+use strict;
+
+use SL::DB::MetaSetup::VendorTax;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/Warehouse.pm b/SL/DB/Warehouse.pm
new file mode 100644 (file)
index 0000000..938c31e
--- /dev/null
@@ -0,0 +1,29 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Warehouse;
+
+use strict;
+
+use SL::DB::MetaSetup::Warehouse;
+
+__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->add_relationship(
+  bins => {
+    type         => 'one to many',
+    class        => 'SL::DB::Bin',
+    column_map   => { id => 'warehouse_id' },
+  }
+);
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+#__PACKAGE__->meta->make_manager_class;
+
+__PACKAGE__->meta->initialize;
+
+sub first_bin {
+  return shift()->bins->[0];
+}
+
+1;
index e593a5e..afae863 100644 (file)
@@ -7,8 +7,6 @@ use Text::CSV_XS;
 #use PDF::API2;    # these two eat up to .75s on startup. only load them if we actually need them
 #use PDF::Table;
 
-use SL::Form;
-
 use strict;
 
 # Cause locales.pl to parse these files:
diff --git a/acctranscorrections.pl b/acctranscorrections.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/admin.pl b/admin.pl
deleted file mode 100755 (executable)
index 603d166..0000000
--- a/admin.pl
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-
-use SL::Dispatcher;
-
-SL::Dispatcher::pre_startup();
-SL::Dispatcher::handle_request('CGI');
-
-1;
diff --git a/am.pl b/am.pl
deleted file mode 120000 (symlink)
index 05c4a22..0000000
--- a/am.pl
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
diff --git a/amcvar.pl b/amcvar.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/amcvar.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/amtemplates.pl b/amtemplates.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ap.pl b/ap.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ap.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ar.pl b/ar.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ar.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/bankaccounts.pl b/bankaccounts.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
index b86ce78..2f0ee81 100644 (file)
@@ -727,4 +727,13 @@ sub gl_transaction {
   $main::lxdebug->leave_sub();
 }
 
+if ($::use_rdbo) {
+  eval {
+    require SL::DB::Helpers::Mappings;
+    sub db {
+      goto &SL::DB::Helpers::Mappings::db;
+    }
+  } or die $@;
+}
+
 1;
diff --git a/bp.pl b/bp.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/bp.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ca.pl b/ca.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ca.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/common.pl b/common.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/common.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
index e388b85..225098a 100644 (file)
@@ -1,8 +1,12 @@
 use Cwd;
 
-use vars qw($dbcharset $eur $ghostscript_bin $html2ps_bin $language $latex_bin $latex_templates $lizenzen $memberfile
-            $opendocument_templates $openofficeorg_daemon $openofficeorg_daemon_port $openofficeorg_writer_bin
-            $pg_dump_exe $pg_restore_exe $sendmail $show_best_before $sid $spool $templates $userspath $vertreter $webdav $xvfb_bin);
+use vars qw(
+$dbcharset $eur $ghostscript_bin $html2ps_bin $language $latex_bin
+$latex_templates $lizenzen $memberfile $opendocument_templates
+$openofficeorg_daemon $openofficeorg_daemon_port $openofficeorg_writer_bin
+$pg_dump_exe $pg_restore_exe $sendmail $show_best_before $sid $spool $templates
+$use_rdbo $userspath $vertreter $webdav $xvfb_bin
+);
 
 # path to user configuration files
 $userspath = "users";
@@ -92,6 +96,13 @@ $latex_bin = 'pdflatex';
 $pg_dump_exe    = "pg_dump";
 $pg_restore_exe = "pg_restore";
 
+# Rose::DB::Object Environment laden.
+# Die RDBO Klassen bieten für Addon Schreiber sehr einfache Interfaces zu den
+# bestehenden Klassen, haben aber den Nachteil, dass der Start des Programms
+# etwa 2s mehr dauert. Damit fällt die Möglichkeit Lx-Office über CGI zu
+# betreiben weg.
+$use_rdbo = 1;
+
 # Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind
 # LXDebug::NONE   - keine Debugausgaben
 # LXDebug::INFO
diff --git a/cp.pl b/cp.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/cp.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ct.pl b/ct.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ct.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/datev.pl b/datev.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/datev.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
deleted file mode 120000 (symlink)
index 05c4a229e0359f9b0c7f63ffb74d9cb5a41c9090..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..603d166b2ca7a63d4c7f36408ee3ca41741e849e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+
+use strict;
+
+use SL::Dispatcher;
+
+SL::Dispatcher::pre_startup();
+SL::Dispatcher::handle_request('CGI');
+
+1;
diff --git a/dn.pl b/dn.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/dn.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/do.pl b/do.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/do.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/fu.pl b/fu.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/fu.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/generictranslations.pl b/generictranslations.pl
deleted file mode 120000 (symlink)
index 19d25c9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-common.pl
\ No newline at end of file
diff --git a/gl.pl b/gl.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/gl.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ic.pl b/ic.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ic.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ir.pl b/ir.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ir.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/is.pl b/is.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/is.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/kopf.pl b/kopf.pl
deleted file mode 120000 (symlink)
index 05c4a22..0000000
--- a/kopf.pl
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
diff --git a/licenses.pl b/licenses.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/login.pl b/login.pl
deleted file mode 120000 (symlink)
index 05c4a22..0000000
--- a/login.pl
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
diff --git a/menu.pl b/menu.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/menu.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/menuXML.pl b/menuXML.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/menujs.pl b/menujs.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/menujs.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/menunew.pl b/menunew.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/menuv3.pl b/menuv3.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/menuv3.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/menuv4.pl b/menuv4.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/menuv4.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/oe.pl b/oe.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/oe.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/pe.pl b/pe.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/pe.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/projects.pl b/projects.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/rc.pl b/rc.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/rc.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/rp.pl b/rp.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/rp.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
index 6a9d000..c374d22 100755 (executable)
@@ -12,9 +12,7 @@ BEGIN {
 use Config::Std;
 use Data::Dumper;
 use Devel::REPL 1.002001;
-eval {
-require Term::ReadLine::Perl::Bind;     # use sane key binding for rxvt users
-};
+use Term::ReadLine::Perl::Bind;     # use sane key binding for rxvt users
 
 read_config 'config/console.conf' => my %config;# if -f 'config/console.conf';
 
@@ -36,6 +34,12 @@ $repl->run;
 
 package Devel::REPL;
 
+use CGI qw( -no_xhtml);
+use SL::Auth;
+use SL::Form;
+use SL::Locale;
+use SL::LXDebug;
+use Data::Dumper;
 
 # this is a cleaned up version of am.pl
 # it lacks redirection, some html setup and most of the authentication process.
@@ -51,25 +55,18 @@ sub lxinit {
   { no warnings 'once';
     $::userspath  = "users";
     $::templates  = "templates";
-    $::memberfile = "users/members";
     $::sendmail   = "| /usr/sbin/sendmail -t";
   }
 
-  use SL::LXDebug;
   $::lxdebug = LXDebug->new;
 
-  use CGI qw( -no_xhtml);
-  use SL::Auth;
-  use SL::Form;
-  use SL::Locale;
-  use Data::Dumper;
-
   eval { require "config/lx-erp.conf"; };
   eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf";
 
-  $::cgi  = CGI->new qw();
-  $::form = Form->new;
-  $::auth = SL::Auth->new;
+  $::locale = Locale->new($::language);
+  $::cgi    = CGI->new qw();
+  $::form   = Form->new;
+  $::auth   = SL::Auth->new;
 
   die 'cannot reach auth db'               unless $::auth->session_tables_present;
 
diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl
new file mode 100755 (executable)
index 0000000..b1a7040
--- /dev/null
@@ -0,0 +1,154 @@
+#!/usr/bin/perl
+
+use strict;
+
+BEGIN {
+  unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
+  push    @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
+}
+
+use CGI qw( -no_xhtml);
+use Data::Dumper;
+use English qw( -no_match_vars );
+use List::MoreUtils qw(any);
+
+use SL::Auth;
+use SL::DBUtils;
+use SL::DB;
+use SL::Form;
+use SL::Locale;
+use SL::LXDebug;
+use SL::DB::Helpers::ALL;
+use SL::DB::Helpers::Mappings;
+
+our $form;
+our $cgi;
+our $auth;
+
+our $script =  __FILE__;
+$script     =~ s:.*/::;
+
+$OUTPUT_AUTOFLUSH       = 1;
+$Data::Dumper::Sortkeys = 1;
+
+our $meta_path = "SL/DB/MetaSetup";
+
+sub setup {
+  if (@ARGV < 2) {
+    print "Usage: $PROGRAM_NAME login table1[=package1] [table2[=package2] ...]\n";
+    print "   or  $PROGRAM_NAME login [--all|-a] [--sugar|-s]\n";
+    exit 1;
+  }
+
+  my $login     = shift @ARGV;
+
+  $::userspath  = "users";
+  $::templates  = "templates";
+  $::sendmail   = "| /usr/sbin/sendmail -t";
+
+  $::lxdebug    = LXDebug->new();
+
+  require "config/lx-erp.conf";
+  require "config/lx-erp-local.conf" if -f "config/lx-erp-local.conf";
+
+  # locale messages
+  $::locale       = Locale->new("de");
+  $::form         = new Form;
+  $::cgi          = new CGI('');
+  $::auth         = SL::Auth->new();
+
+  $::user         = User->new($login);
+
+  %::myconfig     = $auth->read_user($login);
+  $form->{script} = 'rose_meta_data.pl';
+  $form->{login}  = $login;
+
+  map { $form->{$_} = $::myconfig{$_} } qw(stylesheet charset);
+
+  mkdir $meta_path unless -d $meta_path;
+}
+
+sub process_table {
+  my @spec       =  split(/=/, shift, 2);
+  my $table      =  $spec[0];
+  my $package    =  ucfirst($spec[1] || $spec[0]);
+  $package       =~ s/_+(.)/uc($1)/ge;
+  my $meta_file  =  "${meta_path}/${package}.pm";
+  my $file       =  "SL/DB/${package}.pm";
+
+  my $definition =  eval <<CODE;
+    package SL::DB::AUTO::$package;
+    use SL::DB::Object;
+    use base qw(SL::DB::Object);
+
+    __PACKAGE__->meta->table('$table');
+    __PACKAGE__->meta->auto_initialize;
+
+    __PACKAGE__->meta->perl_class_definition(indent => 2); # , braces => 'bsd'
+CODE
+
+  if ($EVAL_ERROR) {
+    print STDERR "Error in execution for table '$table': $EVAL_ERROR";
+    return;
+  }
+
+  $definition =~ s/::AUTO::/::/g;
+
+  my $file_exists = -f $meta_file;
+
+  open(OUT, ">$meta_file") || die;
+  print OUT <<CODE;
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by $::script automatically.
+$definition;
+CODE
+  close OUT;
+
+  print "File '$meta_file' " . ($file_exists ? 'updated' : 'created') . " for table '$table'\n";
+
+  if (! -f $file) {
+    open(OUT, ">$file") || die;
+    print OUT <<CODE;
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::${package};
+
+use strict;
+
+use SL::DB::MetaSetup::${package};
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
+CODE
+    close OUT;
+
+    print "File '$file' created as well.\n";
+  }
+}
+
+setup();
+
+my %blacklist     = SL::DB::Helpers::Mappings->get_blacklist;
+my %package_names = SL::DB::Helpers::Mappings->get_package_names;
+
+my @tables = ();
+if (($ARGV[0] eq '--all') || ($ARGV[0] eq '-a') || ($ARGV[0] eq '--sugar') || ($ARGV[0] eq '-s')) {
+  my ($type, $prefix) = ($ARGV[0] eq '--sugar') || ($ARGV[0] eq '-s') ? ('SUGAR', 'sugar_') : ('LXOFFICE', '');
+  my $db              = SL::DB::create(undef, $type);
+  @tables             = map  { $package_names{$type}->{$_} ? "${_}=" . $package_names{$type}->{$_} : $prefix ? "${_}=${prefix}${_}" : $_ }
+                        grep { my $table = $_; !any { $_ eq $table } @{ $blacklist{$type} } }
+                        $db->list_tables;
+
+} else {
+  @tables = @ARGV;
+}
+
+foreach my $table (@tables) {
+  # add default model name unless model name is given or no defaults exists
+  $table .= '=' . $package_names{LXOFFICE}->{lc $table} if $table !~ /=/ && $package_names{LXOFFICE}->{lc $table};
+
+  process_table($table);
+}
diff --git a/sepa.pl b/sepa.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/sepa.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/sql/Pg-upgrade2/schema_nomalization_1.sql b/sql/Pg-upgrade2/schema_nomalization_1.sql
new file mode 100644 (file)
index 0000000..2a54118
--- /dev/null
@@ -0,0 +1,38 @@
+-- @tag: schema_normalization_1
+-- @description: Datenbankschema Normalisierungen
+-- @depends: release_2_6_1
+
+-- assembly-id
+CREATE SEQUENCE assembly_assembly_id_seq;
+ALTER TABLE assembly ADD COLUMN assembly_id INTEGER;
+UPDATE assembly SET assembly_id = nextval('assembly_assembly_id_seq');
+ALTER TABLE assembly ADD PRIMARY KEY( assembly_id );
+ALTER TABLE assembly ALTER assembly_id SET DEFAULT nextval('assembly_assembly_id_seq');
+
+-- shipto_primary_key
+ALTER TABLE shipto ALTER COLUMN shipto_id SET NOT NULL;
+ALTER TABLE shipto ADD PRIMARY KEY (shipto_id);
+
+-- oe_vc_foreign_keys
+--ALTER TABLE oe ADD FOREIGN KEY (customer_id) REFERENCES customer (id);
+--ALTER TABLE oe ADD FOREIGN KEY (vendor_id)   REFERENCES vendor   (id);
+
+-- orderitems_primary_key
+ALTER TABLE orderitems ADD PRIMARY KEY (id);
+
+-- part_unit_not_null
+UPDATE parts SET unit = 'Stck' WHERE unit IS NULL;
+ALTER TABLE parts ALTER COLUMN unit SET NOT NULL;
+
+-- makemodel_id_column
+ALTER TABLE makemodel ADD COLUMN tmp integer;
+UPDATE makemodel SET tmp = make::integer WHERE COALESCE(make, '') <> '';
+ALTER TABLE makemodel DROP COLUMN make;
+ALTER TABLE makemodel RENAME COLUMN tmp TO make;
+
+CREATE SEQUENCE makemodel_id_seq;
+ALTER TABLE makemodel ADD COLUMN id integer;
+ALTER TABLE makemodel ALTER COLUMN id SET DEFAULT nextval('makemodel_id_seq');
+UPDATE makemodel SET id = nextval('makemodel_id_seq');
+ALTER TABLE makemodel ALTER COLUMN id SET NOT NULL;
+ALTER TABLE makemodel ADD PRIMARY KEY (id);
diff --git a/sql/Pg-upgrade2/schema_nomalization_2.sql b/sql/Pg-upgrade2/schema_nomalization_2.sql
new file mode 100644 (file)
index 0000000..61143bb
--- /dev/null
@@ -0,0 +1,30 @@
+-- @tag: schema_normalization_2
+-- @description: Datenbankschema Normalisierungen Teil 2
+-- @depends: schema_normalization_1
+
+ALTER TABLE acc_trans ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE audittrail ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE customertax ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE datev ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE defaults ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE department ADD PRIMARY KEY (id);
+ALTER TABLE dpt_trans ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE exchangerate ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE finanzamt ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE follow_up_access ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE gifi ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE inventory ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE licenseinvoice ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE leads ADD PRIMARY KEY (id);
+ALTER TABLE partsgroup ADD PRIMARY KEY (id);
+ALTER TABLE partstax ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE prices ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE record_links ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE rmaitems ADD PRIMARY KEY (id);
+ALTER TABLE status ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE tax_zones ADD PRIMARY KEY (id);
+ALTER TABLE todo_user_config ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE translation ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE translation_payment_terms ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE units_language ADD COLUMN id SERIAL PRIMARY KEY;
+ALTER TABLE vendortax ADD COLUMN id SERIAL PRIMARY KEY;
diff --git a/t/helper/attr.t b/t/helper/attr.t
new file mode 100644 (file)
index 0000000..4de1a53
--- /dev/null
@@ -0,0 +1,50 @@
+use Test::More tests => 29;
+
+use DateTime;
+
+use_ok 'SL::DB::Part';
+use_ok 'SL::DB::Order';
+use_ok 'SL::DB::Invoice';
+use_ok 'SL::Dispatcher';
+
+SL::Dispatcher::pre_startup_setup();
+
+$::form = Form->new;
+$::myconfig{numberformat} = '1.000,00';
+$::myconfig{dateformat} = 'dd.mm.yyyy';
+$::locale = Locale->new('de');
+
+my $p = new_ok 'SL::DB::Part';
+is($p->sellprice_as_number('2,30'), '2,30');
+is($p->sellprice, 2.30);
+is($p->sellprice_as_number, '2,30');
+is($p->sellprice_as_number('2,3442'), '2,3442');
+is($p->sellprice, 2.3442);
+is($p->sellprice_as_number, '2,3442');
+
+my $o = new_ok 'SL::DB::Order';
+is($o->reqdate_as_date('11.12.2007'), '11.12.2007');
+is($o->reqdate->year, 2007);
+is($o->reqdate->month, 12);
+is($o->reqdate->day, 11);
+is($o->reqdate_as_date, '11.12.2007');
+$o->reqdate(DateTime->new(year => 2010, month => 4, day => 12));
+is($o->reqdate_as_date, '12.04.2010');
+
+is($o->marge_percent_as_percent('40'), '40');
+is($o->marge_percent, 0.40);
+is($o->marge_percent_as_percent, '40');
+is($o->marge_percent_as_percent('22,4'), '22');
+is($o->marge_percent, 0.224);
+is($o->marge_percent_as_percent, '22');
+is($o->marge_percent(0.231), 0.231);
+is($o->marge_percent_as_percent, '23');
+
+# overloaded attr: invoice taxamount
+my $i = new_ok 'SL::DB::Invoice';
+
+is($i->taxamount_as_number, '0,00');
+$i->amount(12);
+$i->netamount(10.34);
+is($i->taxamount_as_number, '1,66');
+
diff --git a/t/helper/mapping.t b/t/helper/mapping.t
new file mode 100644 (file)
index 0000000..d0c015c
--- /dev/null
@@ -0,0 +1,19 @@
+use Test::More tests => 12;
+
+use_ok 'SL::DB::Helpers::ALL';
+use_ok 'SL::DB::Helpers::Mappings', qw(db);
+
+is db('part'), 'SL::DB::Part';
+is db('parts'), 'SL::DB::Manager::Part';
+
+is db('order'), 'SL::DB::Order';
+is db('orders'), 'SL::DB::Manager::Order';
+
+is db('gl'), 'SL::DB::GLTransaction';
+is db('gls'), 'SL::DB::Manager::GLTransaction';
+
+is db('ar'), 'SL::DB::Invoice';
+is db('ars'), 'SL::DB::Manager::Invoice';
+
+is db('Unit'), 'SL::DB::Unit';
+is db('Units'), 'SL::DB::Manager::Unit';
diff --git a/todo.pl b/todo.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/todo.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/ustva.pl b/ustva.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/ustva.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file
diff --git a/wh.pl b/wh.pl
deleted file mode 120000 (symlink)
index 385000d..0000000
--- a/wh.pl
+++ /dev/null
@@ -1 +0,0 @@
-am.pl
\ No newline at end of file