Revision 0674bc84
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/DB.pm | ||
---|---|---|
50 | 50 |
my $initial_sql; |
51 | 51 |
|
52 | 52 |
if (!%::myconfig) { |
53 |
$type = 'LXOFFICE_EMPTY';
|
|
53 |
$type = 'KIVITENDO_EMPTY';
|
|
54 | 54 |
%connect_settings = ( driver => 'Pg' ); |
55 | 55 |
|
56 |
} elsif ($type eq 'LXOFFICE_AUTH') {
|
|
56 |
} elsif ($type eq 'KIVITENDO_AUTH') {
|
|
57 | 57 |
%connect_settings = ( driver => $::myconfig{dbdriver} || 'Pg', |
58 | 58 |
database => $::auth->{DB_config}->{db}, |
59 | 59 |
host => $::auth->{DB_config}->{host} || 'localhost', |
... | ... | |
82 | 82 |
|
83 | 83 |
my %flattened_settings = _flatten_settings(%connect_settings); |
84 | 84 |
|
85 |
$domain = 'LXOFFICE' if $type =~ m/^LXOFFICE/;
|
|
85 |
$domain = 'KIVITENDO' if $type =~ m/^KIVITENDO/;
|
|
86 | 86 |
$type .= join($SUBSCRIPT_SEPARATOR, map { ($_, $flattened_settings{$_} || '') } sort grep { $_ ne 'dbpasswd' } keys %flattened_settings); |
87 | 87 |
my $idx = "${domain}::${type}"; |
88 | 88 |
|
SL/DB/Helper/Mappings.pm | ||
---|---|---|
11 | 11 |
|
12 | 12 |
# these will not be managed as Rose::DB models, because they are not normalized, |
13 | 13 |
# significant changes are needed to get them done, or they were done by CRM. |
14 |
my @lxoffice_blacklist_permanent = qw(
|
|
14 |
my @kivitendo_blacklist_permanent = qw(
|
|
15 | 15 |
leads |
16 | 16 |
); |
17 | 17 |
|
18 | 18 |
# these are not managed _yet_, but will hopefully at some point. |
19 | 19 |
# if you are confident that one of these works, remove it here. |
20 |
my @lxoffice_blacklist_temp = qw(
|
|
20 |
my @kivitendo_blacklist_temp = qw(
|
|
21 | 21 |
); |
22 | 22 |
|
23 | 23 |
# tables created by crm module |
... | ... | |
29 | 29 |
ekartikel ekbon ekkunde ektext erptasten |
30 | 30 |
); |
31 | 31 |
|
32 |
my @lxoffice_blacklist = (@lxoffice_blacklist_permanent, @lxoffice_blacklist_temp, @crm_blacklist, @cash_register_blacklist);
|
|
32 |
my @kivitendo_blacklist = (@kivitendo_blacklist_permanent, @kivitendo_blacklist_temp, @crm_blacklist, @cash_register_blacklist);
|
|
33 | 33 |
|
34 | 34 |
# map table names to their models. |
35 | 35 |
# unlike rails we have no singular<->plural magic. |
36 | 36 |
# remeber: tables should be named as the plural of the model name. |
37 |
my %lxoffice_package_names = (
|
|
37 |
my %kivitendo_package_names = (
|
|
38 | 38 |
acc_trans => 'acc_transaction', |
39 | 39 |
audittrail => 'audit_trail', |
40 | 40 |
'auth.clients' => 'auth_client', |
... | ... | |
112 | 112 |
vendor => 'vendor', |
113 | 113 |
); |
114 | 114 |
|
115 |
my (%lxoffice_tables_to_packages, %lxoffice_tables_to_manager_packages, %lxoffice_packages_to_tables);
|
|
115 |
my (%kivitendo_tables_to_packages, %kivitendo_tables_to_manager_packages, %kivitendo_packages_to_tables);
|
|
116 | 116 |
|
117 | 117 |
sub get_blacklist { |
118 |
return LXOFFICE => \@lxoffice_blacklist;
|
|
118 |
return KIVITENDO => \@kivitendo_blacklist;
|
|
119 | 119 |
} |
120 | 120 |
|
121 | 121 |
sub get_package_names { |
122 |
return LXOFFICE => \%lxoffice_package_names;
|
|
122 |
return KIVITENDO => \%kivitendo_package_names;
|
|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
sub get_package_for_table { |
126 |
%lxoffice_tables_to_packages = map { ($_ => "SL::DB::" . camelify($lxoffice_package_names{$_})) } keys %lxoffice_package_names
|
|
127 |
unless %lxoffice_tables_to_packages;
|
|
126 |
%kivitendo_tables_to_packages = map { ($_ => "SL::DB::" . camelify($kivitendo_package_names{$_})) } keys %kivitendo_package_names
|
|
127 |
unless %kivitendo_tables_to_packages;
|
|
128 | 128 |
|
129 |
return $lxoffice_tables_to_packages{ $_[0] };
|
|
129 |
return $kivitendo_tables_to_packages{ $_[0] };
|
|
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
sub get_manager_package_for_table { |
133 |
%lxoffice_tables_to_manager_packages = map { ($_ => "SL::DB::Manager::" . camelify($lxoffice_package_names{$_})) } keys %lxoffice_package_names
|
|
134 |
unless %lxoffice_tables_to_manager_packages;
|
|
133 |
%kivitendo_tables_to_manager_packages = map { ($_ => "SL::DB::Manager::" . camelify($kivitendo_package_names{$_})) } keys %kivitendo_package_names
|
|
134 |
unless %kivitendo_tables_to_manager_packages;
|
|
135 | 135 |
|
136 |
return $lxoffice_tables_to_manager_packages{ $_[0] };
|
|
136 |
return $kivitendo_tables_to_manager_packages{ $_[0] };
|
|
137 | 137 |
} |
138 | 138 |
|
139 | 139 |
sub get_table_for_package { |
140 |
get_package_for_table('dummy') if !%lxoffice_tables_to_packages;
|
|
141 |
%lxoffice_packages_to_tables = reverse %lxoffice_tables_to_packages unless %lxoffice_packages_to_tables;
|
|
140 |
get_package_for_table('dummy') if !%kivitendo_tables_to_packages;
|
|
141 |
%kivitendo_packages_to_tables = reverse %kivitendo_tables_to_packages unless %kivitendo_packages_to_tables;
|
|
142 | 142 |
|
143 | 143 |
my $package = $_[0] =~ m/^SL::DB::/ ? $_[0] : "SL::DB::" . $_[0]; |
144 |
return $lxoffice_packages_to_tables{ $package };
|
|
144 |
return $kivitendo_packages_to_tables{ $package };
|
|
145 | 145 |
} |
146 | 146 |
|
147 | 147 |
sub db { |
148 | 148 |
my $string = $_[0]; |
149 |
my $lookup = $lxoffice_package_names{$_[0]} ||
|
|
150 |
plurify($lxoffice_package_names{singlify($_[0])});
|
|
149 |
my $lookup = $kivitendo_package_names{$_[0]} ||
|
|
150 |
plurify($kivitendo_package_names{singlify($_[0])});
|
|
151 | 151 |
|
152 | 152 |
for my $thing ($string, $lookup) { |
153 | 153 |
|
SL/DB/Object.pm | ||
---|---|---|
26 | 26 |
sub init_db { |
27 | 27 |
my $class_or_self = shift; |
28 | 28 |
my $class = ref($class_or_self) || $class_or_self; |
29 |
my $type = $class =~ m/::Auth/ ? 'LXOFFICE_AUTH' : 'LXOFFICE';
|
|
29 |
my $type = $class =~ m/::Auth/ ? 'KIVITENDO_AUTH' : 'KIVITENDO';
|
|
30 | 30 |
|
31 | 31 |
return SL::DB::create(undef, $type); |
32 | 32 |
} |
modules/override/Rose/DBx/Cache/Anywhere.pm | ||
---|---|---|
43 | 43 |
return; |
44 | 44 |
} |
45 | 45 |
|
46 |
# if this a dummy lx office dbh, don't try to actually prepare this.
|
|
47 |
if ($db->type =~ /LXOFFICE_EMPTY/) {
|
|
46 |
# if this a dummy kivitendo dbh, don't try to actually prepare this.
|
|
47 |
if ($db->type =~ /KIVITENDO_EMPTY/) {
|
|
48 | 48 |
return; |
49 | 49 |
} |
50 | 50 |
|
scripts/rose_auto_create_model.pl | ||
---|---|---|
222 | 222 |
sub make_tables { |
223 | 223 |
my @tables; |
224 | 224 |
if ($config{all}) { |
225 |
my $db = SL::DB::create(undef, 'LXOFFICE');
|
|
225 |
my $db = SL::DB::create(undef, 'KIVITENDO');
|
|
226 | 226 |
@tables = |
227 |
map { $package_names{LXOFFICE}->{$_} ? "$_=" . $package_names{LXOFFICE}->{$_} : $_ }
|
|
228 |
grep { my $table = $_; !any { $_ eq $table } @{ $blacklist{LXOFFICE} } }
|
|
227 |
map { $package_names{KIVITENDO}->{$_} ? "$_=" . $package_names{KIVITENDO}->{$_} : $_ }
|
|
228 |
grep { my $table = $_; !any { $_ eq $table } @{ $blacklist{KIVITENDO} } }
|
|
229 | 229 |
$db->list_tables; |
230 | 230 |
} elsif (@ARGV) { |
231 | 231 |
@tables = @ARGV; |
... | ... | |
251 | 251 |
|
252 | 252 |
for my $table (@tables) { |
253 | 253 |
# add default model name unless model name is given or no defaults exists |
254 |
$table .= '=' . $package_names{LXOFFICE}->{lc $table} if $table !~ /=/ && $package_names{LXOFFICE}->{lc $table};
|
|
254 |
$table .= '=' . $package_names{KIVITENDO}->{lc $table} if $table !~ /=/ && $package_names{KIVITENDO}->{lc $table};
|
|
255 | 255 |
|
256 | 256 |
process_table($table); |
257 | 257 |
} |
Auch abrufbar als: Unified diff
Vorkommen von "LxOffice" (und andere Schreibweisen) durch "kivitendo" ersetzen