Revision 12a2df6c
Von Werner Hahn vor fast 2 Jahren hinzugefügt
SL/Controller/DeliveryOrder.pm | ||
---|---|---|
1138 | 1138 |
|
1139 | 1139 |
} |
1140 | 1140 |
|
1141 |
sub action_undo_transfers { |
|
1142 |
my ( $self ) = @_; |
|
1143 |
|
|
1144 |
SL::DB->client->with_transaction(sub { |
|
1145 |
foreach my $item (@{$self->order->orderitems}) { |
|
1146 |
foreach my $inv_item (@{ $item->delivery_order_stock_entries}) { |
|
1147 |
$inv_item->inventory->delete; |
|
1148 |
$inv_item->delete; |
|
1149 |
} |
|
1150 |
} |
|
1151 |
$self->order->update_attributes(delivered => 0); |
|
1152 |
$self->order->update_attributes(closed => 0); |
|
1153 |
}); |
|
1154 |
|
|
1155 |
flash_later('info', t8("Transfer undone")); |
|
1156 |
my @redirect_params = ( |
|
1157 |
action => 'edit', |
|
1158 |
type => $self->type, |
|
1159 |
id => $self->order->id, |
|
1160 |
); |
|
1161 |
|
|
1162 |
$self->redirect_to(@redirect_params); |
|
1163 |
|
|
1164 |
} |
|
1165 |
|
|
1141 | 1166 |
sub js_load_second_row { |
1142 | 1167 |
my ($self, $item, $item_id, $do_parse) = @_; |
1143 | 1168 |
|
... | ... | |
2003 | 2028 |
only_if => $self->type_data->properties('transfer') eq 'in', |
2004 | 2029 |
confirm => t8('Do you really want to transfer the stock and set this order to delivered?'), |
2005 | 2030 |
], |
2031 |
action => [ |
|
2032 |
t8('Undo Transfer'), |
|
2033 |
id => 'undo_transfer', |
|
2034 |
call => [ 'kivi.DeliveryOrder.save', { action => 'undo_transfers' } ], |
|
2035 |
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') |
|
2036 |
: !$self->order->id ? t8('This object has not been saved yet.') |
|
2037 |
: undef, |
|
2038 |
only_if => $self->order->delivered, |
|
2039 |
confirm => t8('Do you really want undo transfers the stock and set this order to undelivered?'), |
|
2040 |
], |
|
2006 | 2041 |
], |
2007 | 2042 |
|
2008 | 2043 |
combobox => [ |
Auch abrufbar als: Unified diff
DeliveryOrder zurücklagern