projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TaskServer-Steuerung: Temp-Datei automatisch entfernen lassen
[kivitendo-erp.git]
/
scripts
/
rose_auto_create_model.pl
diff --git
a/scripts/rose_auto_create_model.pl
b/scripts/rose_auto_create_model.pl
index
e65adc0
..
36c78da
100755
(executable)
--- a/
scripts/rose_auto_create_model.pl
+++ b/
scripts/rose_auto_create_model.pl
@@
-13,7
+13,7
@@
use Data::Dumper;
use Digest::MD5 qw(md5_hex);
use English qw( -no_match_vars );
use Getopt::Long;
use Digest::MD5 qw(md5_hex);
use English qw( -no_match_vars );
use Getopt::Long;
-use List::MoreUtils qw(
none
);
+use List::MoreUtils qw(
apply none uniq
);
use List::UtilsBy qw(partition_by);
use Pod::Usage;
use Rose::DB::Object 0.809;
use List::UtilsBy qw(partition_by);
use Pod::Usage;
use Rose::DB::Object 0.809;
@@
-70,10
+70,13
@@
our %foreign_key_name_map = (
orderitems => { parts_id => 'part', trans_id => 'order', },
delivery_order_items => { parts_id => 'part' },
invoice => { parts_id => 'part' },
orderitems => { parts_id => 'part', trans_id => 'order', },
delivery_order_items => { parts_id => 'part' },
invoice => { parts_id => 'part' },
- follow_ups => { created_for_user => 'created_for
', created_by => 'created_by
', },
+ follow_ups => { created_for_user => 'created_for
_employee', created_by => 'created_by_employee
', },
follow_up_access => { who => 'with_access', what => 'to_follow_ups_by', },
follow_up_access => { who => 'with_access', what => 'to_follow_ups_by', },
- periodic_invoices_configs => { oe_id => 'order' },
+ periodic_invoices_configs => { oe_id => 'order', email_recipient_contact_id => 'email_recipient_contact' },
+ reconciliation_links => { acc_trans_id => 'acc_trans' },
+
+ assembly => { parts_id => 'part', id => 'assembly_part' },
},
);
},
);
@@
-147,8
+150,7
@@
CODE
eval <<CODE;
package SL::DB::AUTO::$package;
eval <<CODE;
package SL::DB::AUTO::$package;
- use SL::DB::Object;
- use base qw(SL::DB::Object);
+ use parent qw(SL::DB::Object);
__PACKAGE__->meta->table('$table');
$schema_str
__PACKAGE__->meta->table('$table');
$schema_str
@@
-207,6
+209,7
@@
CODE
}
$definition =~ s/(meta->table.*)\n/$1\n$schema_str/m if $schema;
}
$definition =~ s/(meta->table.*)\n/$1\n$schema_str/m if $schema;
+ $definition =~ s{^use base}{use parent}m;
my $full_definition = <<CODE;
# This file has been auto-generated. Do not modify it; it will be overwritten
my $full_definition = <<CODE;
# This file has been auto-generated. Do not modify it; it will be overwritten
@@
-273,8
+276,7
@@
package SL::DB::Manager::${package};
use strict;
use strict;
-use SL::DB::Helper::Manager;
-use base qw(SL::DB::Helper::Manager);
+use parent qw(SL::DB::Helper::Manager);
sub object_class { 'SL::DB::${package}' }
sub object_class { 'SL::DB::${package}' }
@@
-340,6
+342,22
@@
sub usage {
pod2usage(verbose => 99, sections => 'SYNOPSIS');
}
pod2usage(verbose => 99, sections => 'SYNOPSIS');
}
+sub list_all_tables {
+ my ($db) = @_;
+
+ my @schemas = (undef, uniq apply { s{\..*}{} } grep { m{\.} } keys %{ $package_names{KIVITENDO} });
+ my @tables;
+
+ foreach my $schema (@schemas) {
+ $db->schema($schema);
+ push @tables, map { $schema ? "${schema}.${_}" : $_ } $db->list_tables;
+ }
+
+ $db->schema(undef);
+
+ return @tables;
+}
+
sub make_tables {
my %tables_by_domain;
if ($config{all}) {
sub make_tables {
my %tables_by_domain;
if ($config{all}) {
@@
-347,7
+365,7
@@
sub make_tables {
foreach my $domain (@domains) {
my $db = SL::DB::create(undef, $domain);
foreach my $domain (@domains) {
my $db = SL::DB::create(undef, $domain);
- $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } }
$db->list_tables
];
+ $tables_by_domain{$domain} = [ grep { my $table = $_; none { $_ eq $table } @{ $blacklist{$domain} } }
list_all_tables($db)
];
$db->disconnect;
}
$db->disconnect;
}