use List::MoreUtils qw(any);
use SL::DBUtils;
use SL::DB::AuthUser;
+use SL::DB::Default;
use SL::DB::Employee;
use strict;
$filename =~ s|.*/||;
}
$display_filename = $filename;
- $filename = "$myconfig->{templates}/$filename";
+ $filename = SL::DB::Default->get->templates . "/$filename";
}
$main::lxdebug->leave_sub();
use English qw(-no_match_vars);
use SL::DB::AuthUser;
+use SL::DB::Default;
use SL::DB::Order;
use SL::DB::Invoice;
use SL::DB::PeriodicInvoice;
return unless $template;
my $email_template = $config{periodic_invoices}->{email_template};
- my $filename = $email_template || ( ($user->get_config_value('templates') || "templates/webpages") . "/periodic_invoices_email.txt" );
+ my $filename = $email_template || ( (SL::DB::Default->get->templates || "templates/webpages") . "/periodic_invoices_email.txt" );
my %params = ( POSTED_INVOICES => $posted_invoices,
PRINTED_INVOICES => $printed_invoices );
use FindBin;
use SL::DB::AuthUser;
+use SL::DB::Default;
use SL::Common;
use Rose::Object::MakeMethods::Generic (
return unless $template;
my $email_template = $self->config->{email_template};
- my $filename = $email_template || ( ($user->get_config_value('templates') || "templates/mails") . "/self_test/status_mail.txt" );
+ my $filename = $email_template || ( (SL::DB::Default->get->templates || "templates/mails") . "/self_test/status_mail.txt" );
my $content_type = $filename =~ m/.html$/ ? 'text/html' : 'text/plain';
use SL::Common;
use SL::CVar;
use SL::DBUtils;
+use SL::DB::Default;
use SL::FU;
use SL::Notes;
use SL::TransNumber;
my ($self, $myconfig, $form) = @_;
my $locale = $main::locale;
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
+
$form->{formname} = 'sales_quotation';
$form->{type} = 'sales_quotation';
$form->{format} = 'excel';
$form->{notes} =~ s/^\s+//g;
- $form->{templates} = $myconfig->{templates};
-
delete $form->{printer_command};
$form->get_employee_info($myconfig);
use SL::Common;
use SL::DBUtils;
+use SL::DB::Default;
use SL::GenericTranslations;
use SL::IS;
use SL::Mailer;
my ($self, $myconfig, $form) = @_;
- $form->{templates} = "$myconfig->{templates}";
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
$form->{language} = $form->get_template_language($myconfig);
$form->{printer_code} = $form->get_printer_code($myconfig);
$form->{IN} = undef;
for my $filename (@template_files) {
- if (-f "$form->{templates}/$filename") {
+ if (-f ($defaults->templates . "/$filename")) {
$form->{IN} = $filename;
last;
}
use SL::DB;
use SL::DBConnect;
use SL::DBUtils;
+use SL::DB::Default;
use SL::DO;
use SL::IC;
use SL::IS;
sub prepare_for_printing {
my ($self) = @_;
- $self->{templates} ||= $::myconfig{templates};
+ my $defaults = SL::DB::Default->get;
+
+ $self->{templates} ||= $defaults->templates;
$self->{formname} ||= $self->{type};
$self->{media} ||= 'email';
}
my $printer_code = $self->{printer_code} ? '_' . $self->{printer_code} : '';
- my $email_extension = -f "$::myconfig{templates}/$self->{formname}_email${language}.${extension}" ? '_email' : '';
+ my $email_extension = -f ($defaults->templates . "/$self->{formname}_email${language}.${extension}") ? '_email' : '';
$self->{IN} = "$self->{formname}${email_extension}${language}${printer_code}.${extension}";
# Format dates.
use List::MoreUtils qw(any);
use Unicode::Normalize qw();
+use SL::DB::Default;
+
sub new {
my $type = shift;
$local_form->{IN} = $template_file_name;
$local_form->{tmpdir} = $::lx_office_conf{paths}->{userspath};
$local_form->{tmpfile} = $tex_file_name;
- $local_form->{templates} = $::myconfig{templates};
+ $local_form->{templates} = SL::DB::Default->get->templates;
foreach (keys %params) {
croak "The parameter '$_' must not be used." if exists $local_form->{$_};
use File::Find;
+use SL::DB::Default;
use SL::AM;
use SL::Form;
$main::auth->assert('admin');
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+
if ($form->{"formname"} =~ m|\.\.| || $form->{"formname"} =~ m|^/|) {
$form->{"formname"} =~ s|.*/||;
}
my $fname = $File::Find::name;
# remove template dir from name
- $fname =~ s|^$myconfig{templates}/||;
+ $fname =~ s|^templates/[^/+]/||;
# remove .tex from name
$fname =~ s|.tex$||;
push(@all_files, $fname);
- }, $myconfig{templates});
+ }, $defaults->templates);
# filter all files already set up (i.e. not already in @values)
my @other_files = grep { my $a=$_; not grep {$a eq $_->{value}} @values } @all_files;
use SL::IC;
use SL::IO;
+use SL::DB::Default;
use SL::DB::Language;
use SL::DB::Printer;
use SL::Helper::Flash;
_check_io_auth();
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
+
my ($old_form) = @_;
my $inv = "inv";
$form->{notes} =~ s/^\s+//g;
- $form->{templates} = "$myconfig{templates}";
-
delete $form->{printer_command};
$form->{language} = $form->get_template_language(\%myconfig);
push @template_files, "$form->{formname}.$extension";
push @template_files, "default.$extension";
@template_files = uniq @template_files;
- $form->{IN} = first { -f "$myconfig{templates}/$_" } @template_files;
+ $form->{IN} = first { -f ($defaults->templates . "/$_") } @template_files;
if (!defined $form->{IN}) {
$::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));
use POSIX qw(strftime);
+use SL::DB::Default;
use SL::DB::Project;
use SL::PE;
use SL::RP;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
+
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{endbold} = "</b>";
my @a = qw(company address businessnumber);
map { $form->{$_} = $myconfig{$_} } @a;
- $form->{templates} = $myconfig{templates};
-
$form->{IN} = "income_statement.html";
$form->parse_template;
$::lxdebug->enter_sub;
$::auth->assert('report');
+ my $defaults = SL::DB::Default->get;
+ $::form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $::form->{templates} = $defaults->templates;
$::form->{decimalplaces} = $::form->{decimalplaces} * 1 || 2;
$::form->{padding} = " ";
$::form->{bold} = "<b>";
# setup company variables for the form
map { $::form->{$_} = $::myconfig{$_} } qw(company address businessnumber nativecurr);
- $::form->{templates} = $::myconfig{templates};
-
$::form->header;
print $::form->parse_html_template('rp/balance_sheet', $data);
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
- $form->{templates} = "$myconfig{templates}";
+ $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
my $suffix = "html";
my $attachment_suffix = "html";
my %myconfig = %main::myconfig;
my $locale = $main::locale;
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
+
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{endbold} = "</b>";
# setup variables for the form
my @a = qw(company address businessnumber);
map { $form->{$_} = $myconfig{$_} } @a;
- $form->{templates} = $myconfig{templates};
$form->{IN} = "bwa.html";
use List::Util qw(first);
+use SL::DB::Default;
use SL::PE;
use SL::RP;
use SL::USTVA;
$::auth->assert('advance_turnover_tax_return');
# parse help documents under doc
- my $tmp = $::form->{templates};
$::form->{templates} = 'doc';
$::form->{help} = 'ustva';
$::form->{type} = 'help';
$::form->{format} = 'html';
generate_ustva();
- #$form->{templates} = $tmp;
$::lxdebug->leave_sub();
}
$::auth->assert('advance_turnover_tax_return');
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
+
# Aufruf von get_config zum Einlesen der Finanzamtdaten aus finanzamt.ini
my $ustva = USTVA->new();
. '!');
}
- $form->{templates} = $myconfig{templates};
$form->{templates} = "doc" if ( $form->{type} eq 'help' );
if ($form->{format} eq 'generic'){