X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=f5f439fce4f37b31e5440d6e5ca1da8059408107;hb=0421095640741a61180e2df732d3a387b9c05ec9;hp=0b9256e500b0e9a885c390bc7e51d1246a0b24e3;hpb=90daea72226506cd9f797ba2bfd7d3c39e19fe3e;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index 0b9256e50..f5f439fce 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(); @@ -97,7 +111,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"}) { @@ -736,7 +761,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 +955,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 = 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(); + + return $order; +} + sub order_details { $main::lxdebug->enter_sub();