Revision 468eee22
Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt
bin/mozilla/do.pl | ||
---|---|---|
118 | 118 |
$main::lxdebug->leave_sub(); |
119 | 119 |
} |
120 | 120 |
|
121 |
sub add_from_reclamation { |
|
122 |
|
|
123 |
require SL::DB::Reclamation; |
|
124 |
my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load; |
|
125 |
my ($delivery_order, $error) = $reclamation->convert_to_delivery_order(); |
|
126 |
if($error) { |
|
127 |
croak("Error while converting: " . $error); |
|
128 |
} |
|
129 |
|
|
130 |
# edit new saved delivery order |
|
131 |
$::form->{id} = $delivery_order->id; |
|
132 |
edit(); |
|
133 |
} |
|
134 |
|
|
121 | 135 |
sub edit { |
122 | 136 |
$main::lxdebug->enter_sub(); |
123 | 137 |
|
... | ... | |
366 | 380 |
|
367 | 381 |
'separator', |
368 | 382 |
|
369 |
action => [ |
|
370 |
t8('Invoice'), |
|
371 |
submit => [ '#form', { action => "invoice" } ], |
|
372 |
disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef, |
|
373 |
confirm => $::form->{delivered} ? undef |
|
374 |
: ($::form->{vc} eq 'customer' && $::instance_conf->get_sales_delivery_order_check_stocked) ? t8('This record has not been stocked out. Proceed?') |
|
375 |
: ($::form->{vc} eq 'vendor' && $::instance_conf->get_purchase_delivery_order_check_stocked) ? t8('This record has not been stocked in. Proceed?') |
|
376 |
: undef, |
|
383 |
combobox => [ |
|
384 |
action => [ t8('Workflow') ], |
|
385 |
action => [ |
|
386 |
t8('Invoice'), |
|
387 |
submit => [ '#form', { action => "invoice" } ], |
|
388 |
disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef, |
|
389 |
confirm => $::form->{delivered} ? undef |
|
390 |
: ($::form->{vc} eq 'customer' && $::instance_conf->get_sales_delivery_order_check_stocked) ? t8('This record has not been stocked out. Proceed?') |
|
391 |
: ($::form->{vc} eq 'vendor' && $::instance_conf->get_purchase_delivery_order_check_stocked) ? t8('This record has not been stocked in. Proceed?') |
|
392 |
: undef, |
|
393 |
], |
|
394 |
action => [ |
|
395 |
t8('Save and Reclamation'), |
|
396 |
submit => [ '#form', { action => "save_and_reclamation" } ], |
|
397 |
], |
|
377 | 398 |
], |
378 | 399 |
|
379 | 400 |
combobox => [ |
... | ... | |
1303 | 1324 |
$main::lxdebug->leave_sub(); |
1304 | 1325 |
} |
1305 | 1326 |
|
1327 |
sub save_and_reclamation { |
|
1328 |
my $form = $main::form; |
|
1329 |
my $type = $form->{type}; |
|
1330 |
|
|
1331 |
# save the delivery order |
|
1332 |
save(no_redirect => 1); |
|
1333 |
|
|
1334 |
my $to_reclamation_type = |
|
1335 |
$type eq 'sales_delivery_order' ? 'sales_reclamation' |
|
1336 |
: 'purchase_reclamation'; |
|
1337 |
$form->{callback} = |
|
1338 |
'controller.pl?action=Reclamation/add_from_delivery_order' . |
|
1339 |
'&type=' . $to_reclamation_type . |
|
1340 |
'&from_id=' . $form->escape($form->{id}); |
|
1341 |
$form->redirect; |
|
1342 |
} |
|
1343 |
|
|
1306 | 1344 |
sub save_as_new { |
1307 | 1345 |
$main::lxdebug->enter_sub(); |
1308 | 1346 |
|
Auch abrufbar als: Unified diff
Workflow: delivery_order ↔ reclamation