X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FOE.pm;h=6cc4a5004350f2f4998c4b216603c066dcdfa8d5;hb=acbc5dafe5f409ac2f4e84ca13e9647e74359537;hp=f5f439fce4f37b31e5440d6e5ca1da8059408107;hpb=777d9b30c494c0a6dfd86e638c16ef8b27658ed9;p=kivitendo-erp.git diff --git a/SL/OE.pm b/SL/OE.pm index f5f439fce..6cc4a5004 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -41,19 +41,7 @@ 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 +use strict; sub transactions { $main::lxdebug->enter_sub(); @@ -88,7 +76,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) | . @@ -134,6 +122,10 @@ SQL push(@values, '%' . $form->{$vc} . '%'); } + if (!$main::auth->assert('sales_all_edit', 1)) { + $query .= " AND o.employee_id = (select id from employee where login= ?)"; + push @values, $form->{login}; + } if ($form->{employee_id}) { $query .= " AND o.employee_id = ?"; push @values, conv_i($form->{employee_id}); @@ -955,22 +947,6 @@ 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(); @@ -1225,13 +1201,13 @@ sub order_details { } $query = qq|SELECT p.partnumber, p.description, p.unit, a.qty, | . - qq|pg.partsgroup | . - qq|FROM assembly a | . - qq| JOIN parts p ON (a.parts_id = p.id) | . - qq| LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) | . - qq| WHERE a.bom = '1' | . - qq| AND a.id = ? | . $sortorder; - @values = ($form->{"id_$i"}); + qq|pg.partsgroup | . + qq|FROM assembly a | . + qq| JOIN parts p ON (a.parts_id = p.id) | . + qq| LEFT JOIN partsgroup pg ON (p.partsgroup_id = pg.id) | . + qq| WHERE a.bom = '1' | . + qq| AND a.id = ? | . $sortorder; + @values = ($form->{"id_$i"}); $sth = $dbh->prepare($query); $sth->execute(@values) || $form->dberror($query); @@ -1305,4 +1281,70 @@ 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; + +__END__ + +=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 + +=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, + ... + ] + } + +=back + +=cut