X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=82962803c26872179ad52fc10a10fa79efa71b03;hb=0b749d12146e361b25af606af074438d71282954;hp=e0a3d23ec0abf07c924e99af7eccdd6b02df05f2;hpb=e5abe3effc8d6f5e45b75648ee10342a814f3ff2;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index e0a3d23ec..82962803c 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -219,6 +219,25 @@ sub unquote { } +sub quote_html { + $main::lxdebug->enter_sub(2); + + my ($self, $str) = @_; + + my %replace = + ('order' => ['"', '<', '>'], + '<' => '<', + '>' => '>', + '"' => '"', + ); + + map({ $str =~ s/$_/$replace{$_}/g; } @{ $replace{"order"} }); + + $main::lxdebug->leave_sub(2); + + return $str; +} + sub hide_form { my $self = shift; @@ -778,6 +797,7 @@ sub parse_template { $mail->{to} = qq|$self->{email}|; $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; $mail->{fileid} = "$fileid."; + $myconfig->{signature} =~ s/\\r\\n/\\n/g; # if we send html or plain text inline if (($self->{format} eq 'html') && ($self->{sendmode} eq 'inline')) { @@ -785,7 +805,7 @@ sub parse_template { $mail->{message} =~ s/\r\n/
\n/g; $myconfig->{signature} =~ s/\\n/
\n/g; - $mail->{message} .= "
\n--
\n$myconfig->{signature}\n
"; + $mail->{message} .= "
\n--
\n$myconfig->{signature}\n
"; open(IN, $self->{tmpfile}) or $self->error($self->cleanup . "$self->{tmpfile} : $!"); @@ -799,8 +819,9 @@ sub parse_template { @{ $mail->{attachments} } = ($self->{tmpfile}) unless ($form->{do_not_attach}); - $myconfig->{signature} =~ s/\\n/\r\n/g; - $mail->{message} .= "\r\n--\r\n$myconfig->{signature}"; + $mail->{message} =~ s/\r\n/\n/g; + $myconfig->{signature} =~ s/\\n/\n/g; + $mail->{message} .= "\n-- \n$myconfig->{signature}"; } @@ -1208,7 +1229,7 @@ sub get_shipto { my $query = qq|SELECT s.* FROM shipto s - WHERE s.id = $self->{shipto_id}|; + WHERE s.shipto_id = $self->{shipto_id}|; my $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); $ref = $sth->fetchrow_hashref(NAME_lc); @@ -1235,7 +1256,6 @@ sub add_shipto { } $self->{"shipto$item"} =~ s/\'/\'\'/g; } - if ($shipto) { if ($self->{shipto_id}) { my $query = qq| UPDATE shipto set @@ -1250,7 +1270,7 @@ sub add_shipto { shiptophone = '$self->{shiptophone}', shiptofax = '$self->{shiptofax}', shiptoemail = '$self->{shiptoemail}' - WHERE id = $self->{shipto_id}|; + WHERE shipto_id = $self->{shipto_id}|; $dbh->do($query) || $self->dberror($query); } else { my $query = @@ -1562,18 +1582,6 @@ sub language_payment { } $sth->finish; - # get adr - $query = qq|SELECT id, adr_description, adr_code - FROM adr|; - $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - - $self->{ADR} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { - push @{ $self->{ADR} }, $ref; - } - $sth->finish; $dbh->disconnect; $main::lxdebug->leave_sub(); } @@ -2311,10 +2319,14 @@ sub new { my ($type, $country, $NLS_file) = @_; my $self = {}; - %self = (); if ($country && -d "locale/$country") { + local *IN; $self->{countrycode} = $country; - eval { require "locale/$country/$NLS_file"; }; + if (open(IN, "locale/$country/$NLS_file")) { + my $code = join("", ); + eval($code); + close(IN); + } } $self->{NLS_file} = $NLS_file; @@ -2334,7 +2346,7 @@ sub new { sub text { my ($self, $text) = @_; - return (exists $self{texts}{$text}) ? $self{texts}{$text} : $text; + return (exists $self->{texts}{$text}) ? $self->{texts}{$text} : $text; } sub findsub { @@ -2342,8 +2354,8 @@ sub findsub { my ($self, $text) = @_; - if (exists $self{subs}{$text}) { - $text = $self{subs}{$text}; + if (exists $self->{subs}{$text}) { + $text = $self->{subs}{$text}; } else { if ($self->{countrycode} && $self->{NLS_file}) { Form->error(