X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/9bc403900c57c9bc3afd5a1a429d2e1f71dd8aa6..1465da30:/SL/OE.pm diff --git a/SL/OE.pm b/SL/OE.pm index ce8c9281c..3f7dbaa75 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -41,6 +41,8 @@ use SL::CVar; use SL::DBUtils; use SL::IC; +use strict; + =head1 NAME OE.pm - Order entry module @@ -88,7 +90,7 @@ sub transactions { qq| ex.$rate AS exchangerate, | . qq| pr.projectnumber AS globalprojectnumber, | . qq| e.name AS employee, s.name AS salesman, | . - qq| ct.country, ct.ustid | . + qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid | . qq|FROM oe o | . qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | . qq|LEFT JOIN employee e ON (o.employee_id = e.id) | . @@ -111,7 +113,18 @@ sub transactions { qq|AND ((globalproject_id = ?) OR EXISTS | . qq| (SELECT * FROM orderitems oi | . qq| WHERE oi.project_id = ? AND oi.trans_id = o.id))|; - push(@values, $form->{"project_id"}, $form->{"project_id"}); + push(@values, conv_i($form->{"project_id"}), conv_i($form->{"project_id"})); + } + + if ($form->{"projectnumber"}) { + $query .= <{"projectnumber"} . "%", "%" . $form->{"projectnumber"} . "%" ; } if ($form->{"${vc}_id"}) { @@ -976,8 +989,8 @@ sub retrieve_simple { my $oe_query = qq|SELECT * FROM oe WHERE id = ?|; my $oi_query = qq|SELECT * FROM orderitems WHERE trans_id = ?|; - my ($order) = selectall_array_query($form, $dbh, $oe_query, conv_i($params{id})); - $order->{orderitems} = selectall_array_query($form, $dbh, $oi_query, conv_i($params{id})); + my $order = selectfirst_hashref_query($form, $dbh, $oe_query, conv_i($params{id})); + $order->{orderitems} = selectall_hashref_query( $form, $dbh, $oi_query, conv_i($params{id})); $main::lxdebug->leave_sub(); @@ -1294,4 +1307,37 @@ sub project_description { return $value; } +########################## +# Get data for the submitted order id +# from database +# +sub get_order_data_by_ordnumber { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + Common::check_params(\%params, qw(ordnumber)); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $dbh = $form->get_standard_dbh(); + + my @values = ($params{ordnumber}); + + # We query the database for the fields we need using the submitted "ordnumber" + my $query = <leave_sub(); + + return $result; +} + 1;