Revision 97982cd2
Von Werner Hahn vor etwa 2 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
1102 | 1102 |
|
1103 | 1103 |
} |
1104 | 1104 |
|
1105 |
sub action_undo_transfers { |
|
1106 |
my ( $self ) = @_; |
|
1107 |
|
|
1108 |
SL::DB->client->with_transaction(sub { |
|
1109 |
foreach my $item (@{$self->order->orderitems}) { |
|
1110 |
foreach my $inv_item (@{ $item->delivery_order_stock_entries}) { |
|
1111 |
$inv_item->inventory->delete; |
|
1112 |
$inv_item->delete; |
|
1113 |
} |
|
1114 |
} |
|
1115 |
$self->order->update_attributes(delivered => 0); |
|
1116 |
$self->order->update_attributes(closed => 0); |
|
1117 |
}); |
|
1118 |
|
|
1119 |
flash_later('info', t8("Transfer undone")); |
|
1120 |
my @redirect_params = ( |
|
1121 |
action => 'edit', |
|
1122 |
type => $self->type, |
|
1123 |
id => $self->order->id, |
|
1124 |
); |
|
1125 |
|
|
1126 |
$self->redirect_to(@redirect_params); |
|
1127 |
|
|
1128 |
} |
|
1129 |
|
|
1105 | 1130 |
sub js_load_second_row { |
1106 | 1131 |
my ($self, $item, $item_id, $do_parse) = @_; |
1107 | 1132 |
|
... | ... | |
1945 | 1970 |
only_if => $self->type_data->properties('transfer') eq 'in', |
1946 | 1971 |
confirm => t8('Do you really want to transfer the stock and set this order to delivered?'), |
1947 | 1972 |
], |
1973 |
action => [ |
|
1974 |
t8('Undo Transfer'), |
|
1975 |
id => 'undo_transfer', |
|
1976 |
call => [ 'kivi.DeliveryOrder.save', { action => 'undo_transfers' } ], |
|
1977 |
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') |
|
1978 |
: !$self->order->id ? t8('This object has not been saved yet.') |
|
1979 |
: undef, |
|
1980 |
only_if => $self->order->delivered, |
|
1981 |
confirm => t8('Do you really want undo transfers the stock and set this order to undelivered?'), |
|
1982 |
], |
|
1948 | 1983 |
], |
1949 | 1984 |
|
1950 | 1985 |
combobox => [ |
Auch abrufbar als: Unified diff
DeliveryOrder zurücklagern