Revision da55cfa0
Von Bernd Bleßmann vor fast 9 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
81 | 81 |
); |
82 | 82 |
} |
83 | 83 |
|
84 |
sub action_delete { |
|
85 |
my ($self) = @_; |
|
86 |
|
|
87 |
my $errors = $self->_delete(); |
|
88 |
|
|
89 |
if (scalar @{ $errors }) { |
|
90 |
$self->js->flash('error', $_) foreach @{ $errors }; |
|
91 |
return $self->js->render(); |
|
92 |
} |
|
93 |
|
|
94 |
flash_later('info', $::locale->text('The order has been deleted')); |
|
95 |
my @redirect_params = ( |
|
96 |
action => 'edit', |
|
97 |
type => $self->type, |
|
98 |
); |
|
99 |
|
|
100 |
$self->redirect_to(@redirect_params); |
|
101 |
} |
|
102 |
|
|
84 | 103 |
sub action_save { |
85 | 104 |
my ($self) = @_; |
86 | 105 |
|
... | ... | |
343 | 362 |
} |
344 | 363 |
|
345 | 364 |
|
365 |
sub _delete { |
|
366 |
my ($self) = @_; |
|
367 |
|
|
368 |
my $errors = []; |
|
369 |
my $db = $self->order->db; |
|
370 |
|
|
371 |
$db->do_transaction( |
|
372 |
sub { |
|
373 |
my @spoolfiles = grep { $_ } map { $_->spoolfile } @{ SL::DB::Manager::Status->get_all(where => [ trans_id => $self->order->id ]) }; |
|
374 |
$self->order->delete; |
|
375 |
my $spool = $::lx_office_conf{paths}->{spool}; |
|
376 |
unlink map { "$spool/$_" } @spoolfiles if $spool; |
|
377 |
|
|
378 |
1; |
|
379 |
}) || push(@{$errors}, $db->error); |
|
380 |
|
|
381 |
return $errors; |
|
382 |
} |
|
383 |
|
|
384 |
|
|
346 | 385 |
sub _save { |
347 | 386 |
my ($self) = @_; |
348 | 387 |
|
locale/de/all | ||
---|---|---|
2839 | 2839 |
'The number of days for full payment' => 'Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss', |
2840 | 2840 |
'The numbering will start at 1 with each requirement spec.' => 'Die Nummerierung beginnt bei jedem Pflichtenheft bei 1.', |
2841 | 2841 |
'The option field is empty.' => 'Das Optionsfeld ist leer.', |
2842 |
'The order has been deleted' => 'Der Auftrag wurde gelöscht.', |
|
2842 | 2843 |
'The order has been saved' => 'Der Auftrag wurde gespeichert.', |
2843 | 2844 |
'The package name is invalid.' => 'Der Paketname ist ungültig.', |
2844 | 2845 |
'The parts for this delivery order have already been transferred in.' => 'Die Artikel dieses Lieferscheins wurden bereits eingelagert.', |
templates/webpages/order/form.html | ||
---|---|---|
31 | 31 |
[% L.hidden_tag('action', 'Order/dispatch') %] |
32 | 32 |
|
33 | 33 |
[% L.button_tag('save()', LxERP.t8('Save')) %] |
34 |
[%- IF SELF.order.id && ( (SELF.cv == 'customer' && INSTANCE_CONF.get_sales_order_show_delete) || (SELF.cv == 'vendor' && INSTANCE_CONF.get_purchase_order_show_delete) ) %] |
|
35 |
[% L.button_tag('delete_order()', LxERP.t8('Delete'), confirm=LxERP.t8("Are you sure?")) %] |
|
36 |
[%- END %] |
|
34 | 37 |
|
35 | 38 |
</form> |
36 | 39 |
|
37 | 40 |
|
38 | 41 |
<script type='text/javascript'> |
39 | 42 |
|
43 |
function delete_order() { |
|
44 |
var data = $('#order_form').serializeArray(); |
|
45 |
data.push({ name: 'action', value: 'Order/delete' }); |
|
46 |
|
|
47 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
48 |
} |
|
49 |
|
|
40 | 50 |
function save() { |
41 | 51 |
if (!check_cv()) return; |
42 | 52 |
var data = $('#order_form').serialize(); |
Auch abrufbar als: Unified diff
Auftrags-Controller: Auftrag löschen können.