Revision d85280af
Von Werner Hahn vor mehr als 2 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
|
||
require SL::DB::Reclamation;
|
||
my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
|
||
my ($delivery_order, $error) = $reclamation->convert_to_delivery_order();
|
||
my $type = $reclamation->type eq 'sales_reclamation' ? 'rma_delivery_order' : 'supplier_delivery_order';
|
||
my ($delivery_order, $error) = $reclamation->convert_to_delivery_order(type => $type);
|
||
if($error) {
|
||
croak("Error while converting: " . $error);
|
||
}
|
||
... | ... | |
|
||
# TODO move to type data
|
||
my $trans_type = $inout eq 'in'
|
||
? SL::DB::Manager::TransferType->find_by(direction => "id", description => "stock")
|
||
? SL::DB::Manager::TransferType->find_by(direction => "in", description => "stock")
|
||
: SL::DB::Manager::TransferType->find_by(direction => "out", description => "shipped");
|
||
|
||
|
||
my @transfer_requests;
|
||
|
||
for my $item (@{ $order->items_sorted }) {
|
||
... | ... | |
my $transfer = SL::DB::Inventory->new_from($stock);
|
||
$transfer->trans_type($trans_type);
|
||
$transfer->qty($transfer->qty * -1) if $inout eq 'out';
|
||
$transfer->qty($transfer->qty * 1) if $inout eq 'in';
|
||
|
||
push @transfer_requests, $transfer if defined $transfer->qty && $transfer->qty != 0;
|
||
};
|
Auch abrufbar als: Unified diff
ReclamationsController: Workflow Lieferschein neuer DeliveryController