--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+package SL::DB::Chart;
+
+use strict;
+
+use SL::DB::MetaSetup::Chart;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+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
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
+;
--- /dev/null
+# 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;
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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;
--- /dev/null
+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
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+package SL::DB::Printer;
+
+use strict;
+
+use SL::DB::MetaSetup::Printer;
+
+__PACKAGE__->meta->make_manager_class;
+
+1;
--- /dev/null
+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
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
--- /dev/null
+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;
--- /dev/null
+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;
--- /dev/null
+# 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;
--- /dev/null
+# 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;
#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:
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-use SL::Dispatcher;
-
-SL::Dispatcher::pre_startup();
-SL::Dispatcher::handle_request('CGI');
-
-1;
+++ /dev/null
-admin.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
$main::lxdebug->leave_sub();
}
+if ($::use_rdbo) {
+ eval {
+ require SL::DB::Helpers::Mappings;
+ sub db {
+ goto &SL::DB::Helpers::Mappings::db;
+ }
+ } or die $@;
+}
+
1;
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
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";
$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
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-admin.pl
\ No newline at end of file
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+
+use SL::Dispatcher;
+
+SL::Dispatcher::pre_startup();
+SL::Dispatcher::handle_request('CGI');
+
+1;
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-common.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-admin.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-admin.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
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';
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.
{ 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;
--- /dev/null
+#!/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);
+}
+++ /dev/null
-am.pl
\ No newline at end of file
--- /dev/null
+-- @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);
--- /dev/null
+-- @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;
--- /dev/null
+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');
+
--- /dev/null
+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';
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file
+++ /dev/null
-am.pl
\ No newline at end of file