projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Leeren String in undef für anständige DB-Abfrage umwandeln
[kivitendo-erp.git]
/
SL
/
Form.pm
diff --git
a/SL/Form.pm
b/SL/Form.pm
index
b2cb1de
..
28e1225
100644
(file)
--- a/
SL/Form.pm
+++ b/
SL/Form.pm
@@
-52,6
+52,7
@@
use SL::AM;
use SL::Common;
use SL::CVar;
use SL::DB;
use SL::Common;
use SL::CVar;
use SL::DB;
+use SL::DBConnect;
use SL::DBUtils;
use SL::DO;
use SL::IC;
use SL::DBUtils;
use SL::DO;
use SL::IC;
@@
-61,6
+62,7
@@
use SL::Menu;
use SL::OE;
use SL::Template;
use SL::User;
use SL::OE;
use SL::Template;
use SL::User;
+use SL::X;
use Template;
use URI;
use List::Util qw(first max min sum);
use Template;
use URI;
use List::Util qw(first max min sum);
@@
-457,7
+459,7
@@
sub hide_form {
sub throw_on_error {
my ($self, $code) = @_;
sub throw_on_error {
my ($self, $code) = @_;
- local $self->{__ERROR_HANDLER} = sub { die
({ error => $_[0] }
) };
+ local $self->{__ERROR_HANDLER} = sub { die
SL::X::FormError->new($_[0]
) };
$code->();
}
$code->();
}
@@
-629,6
+631,8
@@
sub create_http_response {
$cgi_params{'-charset'} = $params{charset} if ($params{charset});
$cgi_params{'-cookie'} = $session_cookie if ($session_cookie);
$cgi_params{'-charset'} = $params{charset} if ($params{charset});
$cgi_params{'-cookie'} = $session_cookie if ($session_cookie);
+ map { $cgi_params{'-' . $_} = $params{$_} if exists $params{$_} } qw(content_disposition content_length);
+
my $output = $cgi->header(%cgi_params);
$main::lxdebug->leave_sub();
my $output = $cgi->header(%cgi_params);
$main::lxdebug->leave_sub();
@@
-743,7
+747,7
@@
sub redirect_header {
my $base_uri = $self->_get_request_uri;
my $new_uri = URI->new_abs($new_url, $base_uri);
my $base_uri = $self->_get_request_uri;
my $new_uri = URI->new_abs($new_url, $base_uri);
- die "Headers already sent" if $
::
self->{header};
+ die "Headers already sent" if $self->{header};
$self->{header} = 1;
my $cgi = $main::cgi || CGI->new('');
$self->{header} = 1;
my $cgi = $main::cgi || CGI->new('');
@@
-993,17
+997,13
@@
sub redirect {
my ($self, $msg) = @_;
if (!$self->{callback}) {
my ($self, $msg) = @_;
if (!$self->{callback}) {
-
$self->info($msg);
$self->info($msg);
- ::end_of_request();
- }
-# my ($script, $argv) = split(/\?/, $self->{callback}, 2);
-# $script =~ s|.*/||;
-# $script =~ s|[^a-zA-Z0-9_\.]||g;
-# exec("perl", "$script", $argv);
+ } else {
+ print $::form->redirect_header($self->{callback});
+ }
-
print $::form->redirect_header($self->{callback}
);
+
::end_of_request(
);
$main::lxdebug->leave_sub();
}
$main::lxdebug->leave_sub();
}
@@
-1580,7
+1580,7
@@
sub dbconnect {
my ($self, $myconfig) = @_;
# connect to database
my ($self, $myconfig) = @_;
# connect to database
- my $dbh =
DBI
->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
+ my $dbh =
SL::DBConnect
->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options)
or $self->dberror;
# set db options
or $self->dberror;
# set db options
@@
-1599,7
+1599,7
@@
sub dbconnect_noauto {
my ($self, $myconfig) = @_;
# connect to database
my ($self, $myconfig) = @_;
# connect to database
- my $dbh =
DBI
->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
+ my $dbh =
SL::DBConnect
->connect($myconfig->{dbconnect}, $myconfig->{dbuser}, $myconfig->{dbpasswd}, $self->_dbconnect_options(AutoCommit => 0))
or $self->dberror;
# set db options
or $self->dberror;
# set db options
@@
-2381,7
+2381,7
@@
$main::lxdebug->enter_sub();
$key = "all_payments" unless ($key);
$key = "all_payments" unless ($key);
- my $query = qq|SELECT * FROM payment_terms ORDER BY
id
|;
+ my $query = qq|SELECT * FROM payment_terms ORDER BY
sortkey
|;
$self->{$key} = selectall_hashref_query($self, $dbh, $query);
$self->{$key} = selectall_hashref_query($self, $dbh, $query);
@@
-2459,7
+2459,8
@@
sub _get_warehouses {
$self->{$key} = selectall_hashref_query($self, $dbh, $query);
if ($bins_key) {
$self->{$key} = selectall_hashref_query($self, $dbh, $query);
if ($bins_key) {
- $query = qq|SELECT id, description FROM bin WHERE warehouse_id = ?|;
+ $query = qq|SELECT id, description FROM bin WHERE warehouse_id = ?
+ ORDER BY description|;
my $sth = prepare_query($self, $dbh, $query);
foreach my $warehouse (@{ $self->{$key} }) {
my $sth = prepare_query($self, $dbh, $query);
foreach my $warehouse (@{ $self->{$key} }) {