X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Frose_auto_create_model.pl;h=b23a75d29356a1e1d9eb0af79248b3944d796514;hb=19c22ca6c21e330f3a2c83427684cdab20faa81d;hp=7793d6096427534e4ce52e01538a9c27bf4035e7;hpb=3d145cb7b03f04100c13892750c814d157cd99f4;p=kivitendo-erp.git diff --git a/scripts/rose_auto_create_model.pl b/scripts/rose_auto_create_model.pl index 7793d6096..b23a75d29 100755 --- a/scripts/rose_auto_create_model.pl +++ b/scripts/rose_auto_create_model.pl @@ -31,7 +31,6 @@ my %blacklist = SL::DB::Helper::Mappings->get_blacklist; my %package_names = SL::DB::Helper::Mappings->get_package_names; our $form; -our $cgi; our $auth; our %lx_office_conf; @@ -56,13 +55,13 @@ sub setup { usage(); } - $::lxdebug = LXDebug->new(); + $::lxdebug = LXDebug->new(); $::locale = Locale->new("de"); $::form = new Form; - $::cgi = new CGI(''); $::auth = SL::Auth->new(); - $::user = User->new($login); - %::myconfig = $auth->read_user($login); + $::user = User->new(login => $login); + %::myconfig = $auth->read_user(login => $login); + $::request = { cgi => CGI->new({}) }; $form->{script} = 'rose_meta_data.pl'; $form->{login} = $login; @@ -161,18 +160,15 @@ CODE sub parse_args { my ($options) = @_; GetOptions( - 'login|user=s' => \ my $login, - all => \ my $all, - sugar => \ my $sugar, - 'no-commit' => \ my $nocommit, - 'dry-run' => \ my $nocommit, - help => sub { pod2usage(verbose => 99, sections => 'NAME|SYNOPSIS|OPTIONS') }, - verbose => \ my $verbose, - diff => \ my $diff, + 'login|user=s' => \ my $login, + all => \ my $all, + 'no-commit|dry-run' => \ my $nocommit, + help => sub { pod2usage(verbose => 99, sections => 'NAME|SYNOPSIS|OPTIONS') }, + verbose => \ my $verbose, + diff => \ my $diff, ); $options->{login} = $login if $login; - $options->{sugar} = $sugar; $options->{all} = $all; $options->{nocommit} = $nocommit; $options->{verbose} = $verbose; @@ -207,17 +203,16 @@ sub usage { sub make_tables { my @tables; - if ($config{all} || $config{sugar}) { - my ($type, $prefix) = $config{sugar} ? ('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} } } + if ($config{all}) { + my $db = SL::DB::create(undef, 'LXOFFICE'); + @tables = + map { $package_names{LXOFFICE}->{$_} ? "$_=" . $package_names{LXOFFICE}->{$_} : $_ } + grep { my $table = $_; !any { $_ eq $table } @{ $blacklist{LXOFFICE} } } $db->list_tables; } elsif (@ARGV) { @tables = @ARGV; } else { - error("You specified neither --sugar nor --all nor any specific tables."); + error("You specified neither --all nor any specific tables."); usage(); } @@ -256,7 +251,7 @@ rose_auto_create_model - mana Rose::DB::Object classes for Lx-Office =head1 SYNOPSIS scripts/rose_create_model.pl --login login table1[=package1] [table2[=package2] ...] - scripts/rose_create_model.pl --login login [--all|-a] [--sugar|-s] + scripts/rose_create_model.pl --login login [--all|-a] # updates all models scripts/rose_create_model.pl --login login --all @@ -326,12 +321,8 @@ C. If that too is not found, an error is thrown. Process all tables from the database. Only those that are blacklistes in L are excluded. -=item C<--sugar, -s> - -Process tables in sugar schema instead of standard schema. Rarely useful unless -you debug schema awareness of the RDBO layer. - =item C<--no-commit, -n> + =item C<--dry-run> Do not write back generated files. This will do everything as usual but not