Revision 2e66dde5
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
43 | 43 |
use List::MoreUtils qw(any); |
44 | 44 |
use SL::DBUtils; |
45 | 45 |
use SL::DB::AuthUser; |
46 |
use SL::DB::Default; |
|
46 | 47 |
use SL::DB::Employee; |
47 | 48 |
|
48 | 49 |
use strict; |
... | ... | |
994 | 995 |
$filename =~ s|.*/||; |
995 | 996 |
} |
996 | 997 |
$display_filename = $filename; |
997 |
$filename = "$myconfig->{templates}/$filename";
|
|
998 |
$filename = SL::DB::Default->get->templates . "/$filename";
|
|
998 | 999 |
} |
999 | 1000 |
|
1000 | 1001 |
$main::lxdebug->leave_sub(); |
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
8 | 8 |
use English qw(-no_match_vars); |
9 | 9 |
|
10 | 10 |
use SL::DB::AuthUser; |
11 |
use SL::DB::Default; |
|
11 | 12 |
use SL::DB::Order; |
12 | 13 |
use SL::DB::Invoice; |
13 | 14 |
use SL::DB::PeriodicInvoice; |
... | ... | |
202 | 203 |
return unless $template; |
203 | 204 |
|
204 | 205 |
my $email_template = $config{periodic_invoices}->{email_template}; |
205 |
my $filename = $email_template || ( ($user->get_config_value('templates') || "templates/webpages") . "/periodic_invoices_email.txt" );
|
|
206 |
my $filename = $email_template || ( (SL::DB::Default->get->templates || "templates/webpages") . "/periodic_invoices_email.txt" );
|
|
206 | 207 |
my %params = ( POSTED_INVOICES => $posted_invoices, |
207 | 208 |
PRINTED_INVOICES => $printed_invoices ); |
208 | 209 |
|
SL/BackgroundJob/SelfTest.pm | ||
---|---|---|
11 | 11 |
use FindBin; |
12 | 12 |
|
13 | 13 |
use SL::DB::AuthUser; |
14 |
use SL::DB::Default; |
|
14 | 15 |
use SL::Common; |
15 | 16 |
|
16 | 17 |
use Rose::Object::MakeMethods::Generic ( |
... | ... | |
145 | 146 |
|
146 | 147 |
return unless $template; |
147 | 148 |
my $email_template = $self->config->{email_template}; |
148 |
my $filename = $email_template || ( ($user->get_config_value('templates') || "templates/mails") . "/self_test/status_mail.txt" );
|
|
149 |
my $filename = $email_template || ( (SL::DB::Default->get->templates || "templates/mails") . "/self_test/status_mail.txt" );
|
|
149 | 150 |
my $content_type = $filename =~ m/.html$/ ? 'text/html' : 'text/plain'; |
150 | 151 |
|
151 | 152 |
|
SL/CT.pm | ||
---|---|---|
42 | 42 |
use SL::Common; |
43 | 43 |
use SL::CVar; |
44 | 44 |
use SL::DBUtils; |
45 |
use SL::DB::Default; |
|
45 | 46 |
use SL::FU; |
46 | 47 |
use SL::Notes; |
47 | 48 |
use SL::TransNumber; |
... | ... | |
1080 | 1081 |
my ($self, $myconfig, $form) = @_; |
1081 | 1082 |
my $locale = $main::locale; |
1082 | 1083 |
|
1084 |
my $defaults = SL::DB::Default->get; |
|
1085 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
1086 |
$form->{templates} = $defaults->templates; |
|
1087 |
|
|
1083 | 1088 |
$form->{formname} = 'sales_quotation'; |
1084 | 1089 |
$form->{type} = 'sales_quotation'; |
1085 | 1090 |
$form->{format} = 'excel'; |
... | ... | |
1122 | 1127 |
|
1123 | 1128 |
$form->{notes} =~ s/^\s+//g; |
1124 | 1129 |
|
1125 |
$form->{templates} = $myconfig->{templates}; |
|
1126 |
|
|
1127 | 1130 |
delete $form->{printer_command}; |
1128 | 1131 |
|
1129 | 1132 |
$form->get_employee_info($myconfig); |
SL/DN.pm | ||
---|---|---|
36 | 36 |
|
37 | 37 |
use SL::Common; |
38 | 38 |
use SL::DBUtils; |
39 |
use SL::DB::Default; |
|
39 | 40 |
use SL::GenericTranslations; |
40 | 41 |
use SL::IS; |
41 | 42 |
use SL::Mailer; |
... | ... | |
394 | 395 |
|
395 | 396 |
my ($self, $myconfig, $form) = @_; |
396 | 397 |
|
397 |
$form->{templates} = "$myconfig->{templates}"; |
|
398 |
my $defaults = SL::DB::Default->get; |
|
399 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
400 |
$form->{templates} = $defaults->templates; |
|
398 | 401 |
$form->{language} = $form->get_template_language($myconfig); |
399 | 402 |
$form->{printer_code} = $form->get_printer_code($myconfig); |
400 | 403 |
|
... | ... | |
433 | 436 |
|
434 | 437 |
$form->{IN} = undef; |
435 | 438 |
for my $filename (@template_files) { |
436 |
if (-f "$form->{templates}/$filename") {
|
|
439 |
if (-f ($defaults->templates . "/$filename")) {
|
|
437 | 440 |
$form->{IN} = $filename; |
438 | 441 |
last; |
439 | 442 |
} |
SL/Form.pm | ||
---|---|---|
53 | 53 |
use SL::DB; |
54 | 54 |
use SL::DBConnect; |
55 | 55 |
use SL::DBUtils; |
56 |
use SL::DB::Default; |
|
56 | 57 |
use SL::DO; |
57 | 58 |
use SL::IC; |
58 | 59 |
use SL::IS; |
... | ... | |
3368 | 3369 |
sub prepare_for_printing { |
3369 | 3370 |
my ($self) = @_; |
3370 | 3371 |
|
3371 |
$self->{templates} ||= $::myconfig{templates}; |
|
3372 |
my $defaults = SL::DB::Default->get; |
|
3373 |
|
|
3374 |
$self->{templates} ||= $defaults->templates; |
|
3372 | 3375 |
$self->{formname} ||= $self->{type}; |
3373 | 3376 |
$self->{media} ||= 'email'; |
3374 | 3377 |
|
... | ... | |
3420 | 3423 |
} |
3421 | 3424 |
|
3422 | 3425 |
my $printer_code = $self->{printer_code} ? '_' . $self->{printer_code} : ''; |
3423 |
my $email_extension = -f "$::myconfig{templates}/$self->{formname}_email${language}.${extension}" ? '_email' : '';
|
|
3426 |
my $email_extension = -f ($defaults->templates . "/$self->{formname}_email${language}.${extension}") ? '_email' : '';
|
|
3424 | 3427 |
$self->{IN} = "$self->{formname}${email_extension}${language}${printer_code}.${extension}"; |
3425 | 3428 |
|
3426 | 3429 |
# Format dates. |
SL/Template/LaTeX.pm | ||
---|---|---|
12 | 12 |
use List::MoreUtils qw(any); |
13 | 13 |
use Unicode::Normalize qw(); |
14 | 14 |
|
15 |
use SL::DB::Default; |
|
16 |
|
|
15 | 17 |
sub new { |
16 | 18 |
my $type = shift; |
17 | 19 |
|
... | ... | |
516 | 518 |
$local_form->{IN} = $template_file_name; |
517 | 519 |
$local_form->{tmpdir} = $::lx_office_conf{paths}->{userspath}; |
518 | 520 |
$local_form->{tmpfile} = $tex_file_name; |
519 |
$local_form->{templates} = $::myconfig{templates};
|
|
521 |
$local_form->{templates} = SL::DB::Default->get->templates;
|
|
520 | 522 |
|
521 | 523 |
foreach (keys %params) { |
522 | 524 |
croak "The parameter '$_' must not be used." if exists $local_form->{$_}; |
bin/mozilla/amtemplates.pl | ||
---|---|---|
33 | 33 |
|
34 | 34 |
use File::Find; |
35 | 35 |
|
36 |
use SL::DB::Default; |
|
36 | 37 |
use SL::AM; |
37 | 38 |
use SL::Form; |
38 | 39 |
|
... | ... | |
115 | 116 |
|
116 | 117 |
$main::auth->assert('admin'); |
117 | 118 |
|
119 |
my $defaults = SL::DB::Default->get; |
|
120 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
121 |
|
|
118 | 122 |
if ($form->{"formname"} =~ m|\.\.| || $form->{"formname"} =~ m|^/|) { |
119 | 123 |
$form->{"formname"} =~ s|.*/||; |
120 | 124 |
} |
... | ... | |
205 | 209 |
|
206 | 210 |
my $fname = $File::Find::name; |
207 | 211 |
# remove template dir from name |
208 |
$fname =~ s|^$myconfig{templates}/||;
|
|
212 |
$fname =~ s|^templates/[^/+]/||;
|
|
209 | 213 |
# remove .tex from name |
210 | 214 |
$fname =~ s|.tex$||; |
211 | 215 |
|
212 | 216 |
push(@all_files, $fname); |
213 | 217 |
|
214 |
}, $myconfig{templates});
|
|
218 |
}, $defaults->templates);
|
|
215 | 219 |
|
216 | 220 |
# filter all files already set up (i.e. not already in @values) |
217 | 221 |
my @other_files = grep { my $a=$_; not grep {$a eq $_->{value}} @values } @all_files; |
bin/mozilla/io.pl | ||
---|---|---|
47 | 47 |
use SL::IC; |
48 | 48 |
use SL::IO; |
49 | 49 |
|
50 |
use SL::DB::Default; |
|
50 | 51 |
use SL::DB::Language; |
51 | 52 |
use SL::DB::Printer; |
52 | 53 |
use SL::Helper::Flash; |
... | ... | |
1224 | 1225 |
|
1225 | 1226 |
_check_io_auth(); |
1226 | 1227 |
|
1228 |
my $defaults = SL::DB::Default->get; |
|
1229 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
1230 |
$form->{templates} = $defaults->templates; |
|
1231 |
|
|
1227 | 1232 |
my ($old_form) = @_; |
1228 | 1233 |
|
1229 | 1234 |
my $inv = "inv"; |
... | ... | |
1447 | 1452 |
|
1448 | 1453 |
$form->{notes} =~ s/^\s+//g; |
1449 | 1454 |
|
1450 |
$form->{templates} = "$myconfig{templates}"; |
|
1451 |
|
|
1452 | 1455 |
delete $form->{printer_command}; |
1453 | 1456 |
|
1454 | 1457 |
$form->{language} = $form->get_template_language(\%myconfig); |
... | ... | |
1528 | 1531 |
push @template_files, "$form->{formname}.$extension"; |
1529 | 1532 |
push @template_files, "default.$extension"; |
1530 | 1533 |
@template_files = uniq @template_files; |
1531 |
$form->{IN} = first { -f "$myconfig{templates}/$_" } @template_files;
|
|
1534 |
$form->{IN} = first { -f ($defaults->templates . "/$_") } @template_files;
|
|
1532 | 1535 |
|
1533 | 1536 |
if (!defined $form->{IN}) { |
1534 | 1537 |
$::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files)); |
bin/mozilla/rp.pl | ||
---|---|---|
37 | 37 |
|
38 | 38 |
use POSIX qw(strftime); |
39 | 39 |
|
40 |
use SL::DB::Default; |
|
40 | 41 |
use SL::DB::Project; |
41 | 42 |
use SL::PE; |
42 | 43 |
use SL::RP; |
... | ... | |
220 | 221 |
my %myconfig = %main::myconfig; |
221 | 222 |
my $locale = $main::locale; |
222 | 223 |
|
224 |
my $defaults = SL::DB::Default->get; |
|
225 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
226 |
$form->{templates} = $defaults->templates; |
|
227 |
|
|
223 | 228 |
$form->{padding} = " "; |
224 | 229 |
$form->{bold} = "<b>"; |
225 | 230 |
$form->{endbold} = "</b>"; |
... | ... | |
374 | 379 |
my @a = qw(company address businessnumber); |
375 | 380 |
map { $form->{$_} = $myconfig{$_} } @a; |
376 | 381 |
|
377 |
$form->{templates} = $myconfig{templates}; |
|
378 |
|
|
379 | 382 |
$form->{IN} = "income_statement.html"; |
380 | 383 |
|
381 | 384 |
$form->parse_template; |
... | ... | |
387 | 390 |
$::lxdebug->enter_sub; |
388 | 391 |
$::auth->assert('report'); |
389 | 392 |
|
393 |
my $defaults = SL::DB::Default->get; |
|
394 |
$::form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
395 |
$::form->{templates} = $defaults->templates; |
|
390 | 396 |
$::form->{decimalplaces} = $::form->{decimalplaces} * 1 || 2; |
391 | 397 |
$::form->{padding} = " "; |
392 | 398 |
$::form->{bold} = "<b>"; |
... | ... | |
412 | 418 |
# setup company variables for the form |
413 | 419 |
map { $::form->{$_} = $::myconfig{$_} } qw(company address businessnumber nativecurr); |
414 | 420 |
|
415 |
$::form->{templates} = $::myconfig{templates}; |
|
416 |
|
|
417 | 421 |
$::form->header; |
418 | 422 |
print $::form->parse_html_template('rp/balance_sheet', $data); |
419 | 423 |
|
... | ... | |
1195 | 1199 |
my %myconfig = %main::myconfig; |
1196 | 1200 |
my $locale = $main::locale; |
1197 | 1201 |
|
1198 |
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1); |
|
1202 |
my $defaults = SL::DB::Default->get; |
|
1203 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
1204 |
$form->{templates} = $defaults->templates; |
|
1199 | 1205 |
|
1200 |
$form->{templates} = "$myconfig{templates}";
|
|
1206 |
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
|
|
1201 | 1207 |
|
1202 | 1208 |
my $suffix = "html"; |
1203 | 1209 |
my $attachment_suffix = "html"; |
... | ... | |
1631 | 1637 |
my %myconfig = %main::myconfig; |
1632 | 1638 |
my $locale = $main::locale; |
1633 | 1639 |
|
1640 |
my $defaults = SL::DB::Default->get; |
|
1641 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
1642 |
$form->{templates} = $defaults->templates; |
|
1643 |
|
|
1634 | 1644 |
$form->{padding} = " "; |
1635 | 1645 |
$form->{bold} = "<b>"; |
1636 | 1646 |
$form->{endbold} = "</b>"; |
... | ... | |
1821 | 1831 |
# setup variables for the form |
1822 | 1832 |
my @a = qw(company address businessnumber); |
1823 | 1833 |
map { $form->{$_} = $myconfig{$_} } @a; |
1824 |
$form->{templates} = $myconfig{templates}; |
|
1825 | 1834 |
|
1826 | 1835 |
$form->{IN} = "bwa.html"; |
1827 | 1836 |
|
bin/mozilla/ustva.pl | ||
---|---|---|
38 | 38 |
|
39 | 39 |
use List::Util qw(first); |
40 | 40 |
|
41 |
use SL::DB::Default; |
|
41 | 42 |
use SL::PE; |
42 | 43 |
use SL::RP; |
43 | 44 |
use SL::USTVA; |
... | ... | |
225 | 226 |
$::auth->assert('advance_turnover_tax_return'); |
226 | 227 |
|
227 | 228 |
# parse help documents under doc |
228 |
my $tmp = $::form->{templates}; |
|
229 | 229 |
$::form->{templates} = 'doc'; |
230 | 230 |
$::form->{help} = 'ustva'; |
231 | 231 |
$::form->{type} = 'help'; |
232 | 232 |
$::form->{format} = 'html'; |
233 | 233 |
generate_ustva(); |
234 | 234 |
|
235 |
#$form->{templates} = $tmp; |
|
236 | 235 |
$::lxdebug->leave_sub(); |
237 | 236 |
} |
238 | 237 |
|
... | ... | |
543 | 542 |
|
544 | 543 |
$::auth->assert('advance_turnover_tax_return'); |
545 | 544 |
|
545 |
my $defaults = SL::DB::Default->get; |
|
546 |
$form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates; |
|
547 |
$form->{templates} = $defaults->templates; |
|
548 |
|
|
546 | 549 |
# Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini |
547 | 550 |
|
548 | 551 |
my $ustva = USTVA->new(); |
... | ... | |
1060 | 1063 |
. '!'); |
1061 | 1064 |
} |
1062 | 1065 |
|
1063 |
$form->{templates} = $myconfig{templates}; |
|
1064 | 1066 |
$form->{templates} = "doc" if ( $form->{type} eq 'help' ); |
1065 | 1067 |
|
1066 | 1068 |
if ($form->{format} eq 'generic'){ |
Auch abrufbar als: Unified diff
'templates' nicht aus %::myconfig, sondern aus Defaults-Tabelle holen