X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCommon.pm;h=371bb8a7dea1bc5d92ca7e4a2e3a777a56a4f712;hb=4f50aaa53044225294e14002bd4170513d224d64;hp=bdc4c5dd6227d5d961f2d2bee0e82ad104c13519;hpb=e09347c89ca119213c4d8ba43083653cda793399;p=kivitendo-erp.git diff --git a/SL/Common.pm b/SL/Common.pm index bdc4c5dd6..371bb8a7d 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -8,11 +8,15 @@ package Common; +use utf8; +use strict; + use Time::HiRes qw(gettimeofday); +use Data::Dumper; use SL::DBUtils; -use vars qw(@db_encodings %db_encoding_to_charset); +use vars qw(@db_encodings %db_encoding_to_charset %charset_to_db_encoding); @db_encodings = ( { "label" => "ASCII", "dbencoding" => "SQL_ASCII", "charset" => "ASCII" }, @@ -283,8 +287,9 @@ sub retrieve_vendor { my $query = qq!SELECT id, name, customernumber, (street || ', ' || zipcode || city) AS address FROM customer ! . - qq!WHERE $filter business_id = (SELECT id FROM business WHERE description = 'Händler') ! . + qq!WHERE $filter business_id = (SELECT id FROM business WHERE description = ?') ! . qq!ORDER BY $order_by $order_dir!; + push @filter_values, $::locale->{iconv_utf8}->convert('Händler'); my $sth = $dbh->prepare($query); $sth->execute(@filter_values) || $form->dberror($query . " (" . join(", ", @filter_values) . ")"); @@ -331,7 +336,7 @@ sub webdav_folder { my ($form) = @_; return $main::lxdebug->leave_sub() - unless ($main::webdav && $form->{id}); + unless ($::lx_office_conf{features}->{webdav} && $form->{id}); my ($path, $number); @@ -345,6 +350,10 @@ sub webdav_folder { ($path, $number) = ("anfragen", $form->{quonumber}); } elsif ($form->{type} eq "purchase_order") { ($path, $number) = ("lieferantenbestellungen", $form->{ordnumber}); + } elsif ($form->{type} eq "sales_delivery_order") { + ($path, $number) = ("verkaufslieferscheine", $form->{donumber}); + } elsif ($form->{type} eq "purchase_delivery_order") { + ($path, $number) = ("einkaufslieferscheine", $form->{donumber}); } elsif ($form->{type} eq "credit_note") { ($path, $number) = ("gutschriften", $form->{invnumber}); } elsif ($form->{vc} eq "customer") { @@ -363,10 +372,9 @@ sub webdav_folder { mkdir_with_parents($path); } else { - my $base_path = substr($ENV{'SCRIPT_NAME'}, 1); + my $base_path = $ENV{'SCRIPT_NAME'}; $base_path =~ s|[^/]+$||; - $base_path =~ s|/$||; - # wo kommt der wert für dir her? es wird doch gar nichts übergeben? fix für strict my $dir jb 21.2. + # wo kommt der wert für dir her? es wird doch gar nichts übergeben? fix für strict my $dir jb 21.2. if (opendir my $dir, $path) { foreach my $file (sort { lc $a cmp lc $b } readdir $dir) { next if (($file eq '.') || ($file eq '..')); @@ -381,7 +389,7 @@ sub webdav_folder { push @{ $form->{WEBDAV} }, { 'name' => $fname, - 'link' => ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file", + 'link' => $base_path . $file, 'type' => $is_directory ? $main::locale->text('Directory') : $main::locale->text('File'), }; } @@ -488,8 +496,8 @@ sub save_email_status { $intnotes .= "\n\n" if ($intnotes); - my $cc = $main::locale->text('Cc') . ": $form->{cc}\n" if $form->{cc}; - my $bcc = $main::locale->text('Bcc') . ": $form->{bcc}\n" if $form->{bcc}; + my $cc = $form->{cc} ? $main::locale->text('Cc') . ": $form->{cc}\n" : ''; + my $bcc = $form->{bcc} ? $main::locale->text('Bcc') . ": $form->{bcc}\n" : ''; my $now = scalar localtime; $intnotes .= $main::locale->text('[email]') . "\n" @@ -516,6 +524,8 @@ sub check_params { foreach my $key (@_) { if ((ref $key eq '') && !defined $params->{$key}) { my $subroutine = (caller(1))[3]; + $main::lxdebug->message(LXDebug->BACKTRACE_ON_ERROR, "[Common::check_params] failed, params object dumped below"); + $main::lxdebug->message(LXDebug->BACKTRACE_ON_ERROR, Dumper($params)); $main::form->error($main::locale->text("Missing parameter #1 in call to sub #2.", $key, $subroutine)); } elsif (ref $key eq 'ARRAY') { @@ -529,6 +539,8 @@ sub check_params { if (!$found) { my $subroutine = (caller(1))[3]; + $main::lxdebug->message(LXDebug->BACKTRACE_ON_ERROR, "[Common::check_params] failed, params object dumped below"); + $main::lxdebug->message(LXDebug->BACKTRACE_ON_ERROR, Dumper($params)); $main::form->error($main::locale->text("Missing parameter (at least one of #1) in call to sub #2.", join(', ', @{ $key }), $subroutine)); } }