X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=55ac6332065a173eb6524c16ed7fda6298c99ca6;hb=0ebb8f829ac2d23b65e8d993c7d03aa0b172b637;hp=cd73fa09d69dc58e7480358cbe66df811c46d165;hpb=0f9adc27f1ace40310fe4d4c61afba843c5f6479;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index cd73fa09d..55ac63320 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -79,6 +79,7 @@ use SL::Request; use SL::Template; use SL::User; use SL::Util; +use SL::Version; use SL::X; use Template; use URI; @@ -91,14 +92,7 @@ use SL::Helper::CreatePDF qw(merge_pdfs); use strict; sub read_version { - my ($self) = @_; - - open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file - my $version = ; - $version =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code. - close VERSION_FILE; - - return $version; + SL::Version->get_version; } sub new { @@ -116,8 +110,6 @@ sub new { bless $self, $type; - $self->{version} = $self->read_version; - $main::lxdebug->leave_sub(); return $self; @@ -158,7 +150,7 @@ sub _flatten_variables_rec { $first_array_entry = 0; } } else { - @result = ({ 'key' => $prefix . $key . ($first_array_entry ? '[+]' : '[]'), 'value' => $element }); + push @result, { 'key' => $prefix . $key . '[]', 'value' => $element }; } } } @@ -189,7 +181,7 @@ sub flatten_standard_variables { $main::lxdebug->enter_sub(2); my $self = shift; - my %skip_keys = map { $_ => 1 } (qw(login password header stylesheet titlebar version), @_); + my %skip_keys = map { $_ => 1 } (qw(login password header stylesheet titlebar), @_); my @variables; @@ -202,36 +194,6 @@ sub flatten_standard_variables { return @variables; } -sub debug { - $main::lxdebug->enter_sub(); - - my ($self) = @_; - - print "\n"; - - map { print "$_ = $self->{$_}\n" } (sort keys %{$self}); - - $main::lxdebug->leave_sub(); -} - -sub dumper { - $main::lxdebug->enter_sub(2); - - my $self = shift; - my $password = $self->{password}; - - $self->{password} = 'X' x 8; - - local $Data::Dumper::Sortkeys = 1; - my $output = Dumper($self); - - $self->{password} = $password; - - $main::lxdebug->leave_sub(2); - - return $output; -} - sub escape { my ($self, $str) = @_; @@ -476,7 +438,7 @@ sub header { ), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}"); $self->{favicon} ||= "favicon.ico"; - $self->{titlebar} = join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->{version} if $self->{title} || !$self->{titlebar}; + $self->{titlebar} = join ' - ', grep $_, $self->{title}, $self->{login}, $::myconfig{dbname}, $self->read_version if $self->{title} || !$self->{titlebar}; # build includes if ($self->{refresh_url} || $self->{refresh_time}) { @@ -570,7 +532,7 @@ sub set_standard_title { $::lxdebug->enter_sub; my $self = shift; - $self->{titlebar} = "kivitendo " . $::locale->text('Version') . " $self->{version}"; + $self->{titlebar} = "kivitendo " . $::locale->text('Version') . " " . $self->read_version; $self->{titlebar} .= "- $::myconfig{name}" if $::myconfig{name}; $self->{titlebar} .= "- $::myconfig{dbname}" if $::myconfig{name}; @@ -1135,7 +1097,7 @@ sub send_email { my $mail = Mailer->new; map { $mail->{$_} = $self->{$_} } - qw(cc subject message version format); + qw(cc subject message format); $mail->{bcc} = $self->get_bcc_defaults($myconfig, $self->{bcc}); $mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; @@ -1148,7 +1110,7 @@ sub send_email { my @attfiles; # if we send html or plain text inline if (($self->{format} eq 'html') && ($self->{sendmode} eq 'inline')) { - $mail->{contenttype} = "text/html"; + $mail->{content_type} = "text/html"; $mail->{message} =~ s/\r//g; $mail->{message} =~ s/\n/
\n/g; $full_signature =~ s/\n/
\n/g; @@ -1382,7 +1344,7 @@ sub generate_email_subject { sub generate_email_body { $main::lxdebug->enter_sub(); - my ($self) = @_; + my ($self, %params) = @_; # simple german and english will work grammatically (most european languages as well) # Dear Mr Alan Greenspan: # Sehr geehrte Frau Meyer, @@ -1390,7 +1352,7 @@ sub generate_email_body { # Gentile Signora Ferrari, my $body = ''; - if ($self->{cp_id}) { + if ($self->{cp_id} && !$params{record_email}) { my $givenname = SL::DB::Contact->load_cached($self->{cp_id})->cp_givenname; # for qw(gender givename name); my $name = SL::DB::Contact->load_cached($self->{cp_id})->cp_name; # for qw(gender givename name); my $gender = SL::DB::Contact->load_cached($self->{cp_id})->cp_gender; # for qw(gender givename name); @@ -3623,29 +3585,6 @@ sub create_email_signature { }; -sub layout { - my ($self) = @_; - $::lxdebug->enter_sub; - - my %style_to_script_map = ( - v3 => 'v3', - neu => 'new', - ); - - my $menu_script = $style_to_script_map{$::myconfig{menustyle}} || ''; - - package main; - require "bin/mozilla/menu$menu_script.pl"; - package Form; - require SL::Controller::FrameHeader; - - - my $layout = SL::Controller::FrameHeader->new->action_header . ::render(); - - $::lxdebug->leave_sub; - return $layout; -} - sub calculate_tax { # this function calculates the net amount and tax for the lines in ar, ap and # gl and is used for update as well as post. When used with update the return