From 9bc403900c57c9bc3afd5a1a429d2e1f71dd8aa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 3 Sep 2009 13:17:51 +0200 Subject: [PATCH] =?utf8?q?sub=20retrieve=5Fsimple.=20(ersatz=20f=C3=BCr=20?= =?utf8?q?OE->retrieve)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/SL/OE.pm b/SL/OE.pm index 0b9256e50..ce8c9281c 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -41,6 +41,20 @@ use SL::CVar; use SL::DBUtils; use SL::IC; +=head1 NAME + +OE.pm - Order entry module + +=head1 DESCRIPTION + +OE.pm is part of the OE module. OE is responsible for sales and purchase orders, as well as sales quotations and purchase requests. This file abstracts the database tables C and C. + +=head1 FUNCTIONS + +=over 4 + +=cut + sub transactions { $main::lxdebug->enter_sub(); @@ -736,7 +750,7 @@ sub retrieve { "quonumber" : "ordnumber"}; # set all entries for multiple ids blank that yield different information - while ($ref = $sth->fetchrow_hashref(NAME_lc)) { + while ($ref = $sth->fetchrow_hashref("NAME_lc")) { map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref; } @@ -930,6 +944,46 @@ sub retrieve { return $rc; } +=item retrieve_simple PARAMS + +simple OE retrieval by id. does not look up customer, vendor, units or any other stuff. only oe and orderitems. + + my $order = retrieve_simple(id => 2); + + $order => { + %_OE_CONTENT, + orderitems => [ + %_ORDERITEM_ROW_1, + %_ORDERITEM_ROW_2, + ... + ] + } + +=cut +sub retrieve_simple { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + Common::check_params(\%params, qw(id)); + + my $myconfig = \%main::myconfig; + my $form = $main::form; + + my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + + 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})); + + $main::lxdebug->leave_sub(); + + return $order; +} + sub order_details { $main::lxdebug->enter_sub(); -- 2.20.1