X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDO.pm;h=034189fc347e1dd5c5d8afa559f5357876a781b5;hb=c4a8cd8ca761b16e89fa7ed5616d0e3fd888b82f;hp=3dde867c24d51f53d418f137d9153215c0a66e24;hpb=d1f44c84d990f57982854c6a4716c0f233f45bca;p=kivitendo-erp.git diff --git a/SL/DO.pm b/SL/DO.pm index 3dde867c2..034189fc3 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -36,7 +36,7 @@ package DO; use Carp; use List::Util qw(max); -use YAML; +use Text::ParseWords; use SL::AM; use SL::Common; @@ -51,6 +51,7 @@ use SL::IC; use SL::TransNumber; use SL::DB; use SL::Util qw(trim); +use SL::YAML; use strict; @@ -128,7 +129,7 @@ sub transactions { push @where, "dord.$item = ?"; push @values, conv_i($form->{$item}); } - if (!$main::auth->assert('sales_all_edit', 1)) { + if ( !(($vc eq 'customer' && $main::auth->assert('sales_all_edit', 1)) || ($vc eq 'vendor' && $main::auth->assert('purchase_all_edit', 1))) ) { push @where, qq|dord.employee_id = (select id from employee where login= ?)|; push @values, $::myconfig{login}; } @@ -211,6 +212,17 @@ SQL push @values, like($form->{parts_description}); } + if ($form->{all}) { + my @tokens = parse_line('\s+', 0, $form->{all}); + # ordnumber quonumber customer.name vendor.name transaction_description + push @where, <{bin_id})); $h_item_stock_id->finish(); # write back the id to the form (important if only transfer was clicked (id fk for invoice) - $form->{"stock_${in_out}_$i"} = YAML::Dump($stock_info); + $form->{"stock_${in_out}_$i"} = SL::YAML::Dump($stock_info); } @values = ($form->{"delivery_order_items_id_$i"}, $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}), conv_i($sinfo->{bin_id}), $sinfo->{chargenumber}, conv_date($sinfo->{bestbefore}), @@ -821,7 +833,7 @@ sub retrieve { push @{ $requests }, $ref; } - $doi->{"stock_${in_out}"} = YAML::Dump($requests); + $doi->{"stock_${in_out}"} = SL::YAML::Dump($requests); } $sth->finish(); @@ -1011,16 +1023,16 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}{si_unit}[$si_position-1] }, $si->{unit}; } - if ($form->{"assembly_$i"}) { + if ($form->{"part_type_$i"} eq 'assembly') { $sameitem = ""; # get parts and push them onto the stack my $sortorder = ""; if ($form->{groupitems}) { $sortorder = - qq|ORDER BY pg.partsgroup, a.oid|; + qq|ORDER BY pg.partsgroup, a.position|; } else { - $sortorder = qq|ORDER BY a.oid|; + $sortorder = qq|ORDER BY a.position|; } do_statement($form, $h_pg, $q_pg, conv_i($form->{"id_$i"})); @@ -1073,21 +1085,6 @@ sub order_details { $main::lxdebug->leave_sub(); } -sub project_description { - $main::lxdebug->enter_sub(); - - my ($self, $dbh, $id) = @_; - - my $form = $main::form; - - my $query = qq|SELECT description FROM project WHERE id = ?|; - my ($value) = selectrow_query($form, $dbh, $query, $id); - - $main::lxdebug->leave_sub(); - - return $value; -} - sub unpack_stock_information { $main::lxdebug->enter_sub(); @@ -1098,7 +1095,7 @@ sub unpack_stock_information { my $unpacked; - eval { $unpacked = $params{packed} ? YAML::Load($params{packed}) : []; }; + eval { $unpacked = $params{packed} ? SL::YAML::Load($params{packed}) : []; }; $unpacked = [] if (!$unpacked || ('ARRAY' ne ref $unpacked));