X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Frose_auto_create_model.pl;h=bfb3e3d6aeb175db1a9fbc76a981c54ba9afd724;hb=2ff2f6c9c9f95845ddb83d1cef264e580977759c;hp=f222cfa974dcac496b74ffa347d9d68a09dbddb9;hpb=624c53dc0cb5056d2c259aec6f815e69b8313ae0;p=kivitendo-erp.git diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl index f222cfa97..bfb3e3d6a 100755 --- a/scripts/rose_auto_create_model.pl +++ b/scripts/rose_auto_create_model.pl @@ -8,6 +8,7 @@ BEGIN { } use CGI qw( -no_xhtml); +use Config::Std; use Data::Dumper; use English qw( -no_match_vars ); use List::MoreUtils qw(any); @@ -18,12 +19,14 @@ use SL::DB; use SL::Form; use SL::Locale; use SL::LXDebug; +use SL::LxOfficeConf; use SL::DB::Helper::ALL; use SL::DB::Helper::Mappings; our $form; our $cgi; our $auth; +our %lx_office_conf; our $script = __FILE__; $script =~ s:.*/::; @@ -40,17 +43,12 @@ sub setup { exit 1; } - my $login = shift @ARGV; + SL::LxOfficeConf->read; - $::userspath = "users"; - $::templates = "templates"; - $::sendmail = "| /usr/sbin/sendmail -t"; + my $login = shift @ARGV; $::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; @@ -71,17 +69,24 @@ sub setup { sub process_table { my @spec = split(/=/, shift, 2); my $table = $spec[0]; + my $schema = ''; + ($schema, $table) = split(m/\./, $table) if $table =~ m/\./; 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"; + $schema = <meta->schema('$schema'); +CODE + my $definition = eval <meta->table('$table'); +$schema __PACKAGE__->meta->auto_initialize; __PACKAGE__->meta->perl_class_definition(indent => 2); # , braces => 'bsd'