Revision 927ec727
Von Jan Büren vor mehr als 3 Jahren hinzugefügt
bin/mozilla/do.pl | ||
---|---|---|
241 | 241 |
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps; |
242 | 242 |
my $is_customer = $::form->{vc} eq 'customer'; |
243 | 243 |
|
244 |
my $undo_date = DateTime->today->subtract(days => $::instance_conf->get_undo_transfer_interval); |
|
245 |
my $insertdate = DateTime->from_kivitendo($::form->{insertdate}); |
|
246 |
my $undo_transfer = 0; |
|
247 |
if (ref $undo_date eq 'DateTime' && ref $insertdate eq 'DateTime') { |
|
248 |
# DateTime->compare it returns 1 if $dt1 > $dt2 |
|
249 |
$undo_transfer = DateTime->compare($insertdate, $undo_date) == 1 ? 1 : 0; |
|
250 |
} |
|
244 | 251 |
for my $bar ($::request->layout->get('actionbar')) { |
245 | 252 |
$bar->add( |
246 | 253 |
action => |
... | ... | |
314 | 321 |
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef, |
315 | 322 |
only_if => !$is_customer && $::instance_conf->get_transfer_default, |
316 | 323 |
], |
324 |
action => [ |
|
325 |
t8('Undo Transfer'), |
|
326 |
submit => [ '#form', { action => "delete_transfers" } ], |
|
327 |
checks => [ 'kivi.validate_form' ], |
|
328 |
only_if => $::form->{delivered}, |
|
329 |
disabled => !$undo_transfer ? t8('Transfer date exceeds the maximum allowed interval.') : undef, |
|
330 |
], |
|
317 | 331 |
], # end of combobox "Transfer out" |
318 | 332 |
|
319 | 333 |
|
... | ... | |
969 | 983 |
|
970 | 984 |
$main::lxdebug->leave_sub(); |
971 | 985 |
} |
986 |
sub delete_transfers { |
|
987 |
$main::lxdebug->enter_sub(); |
|
988 |
|
|
989 |
check_do_access(); |
|
990 |
|
|
991 |
my $form = $main::form; |
|
992 |
my %myconfig = %main::myconfig; |
|
993 |
my $locale = $main::locale; |
|
994 |
my $ret; |
|
995 |
|
|
996 |
die "Invalid form type" unless $form->{type} =~ m/^(sales|purchase)_delivery_order$/; |
|
997 |
|
|
998 |
if ($ret = DO->delete_transfers()) { |
|
999 |
# saving the history |
|
1000 |
if(!exists $form->{addition}) { |
|
1001 |
$form->{snumbers} = qq|donumber_| . $form->{donumber}; |
|
1002 |
$form->{addition} = "UNDO TRANSFER"; |
|
1003 |
$form->save_history; |
|
1004 |
} |
|
1005 |
# /saving the history |
|
1006 |
|
|
1007 |
flash_later('info', $locale->text("Transfer undone.")); |
|
1008 |
|
|
1009 |
$form->{callback} = 'do.pl?action=edit&type=' . $form->{type} . '&id=' . $form->escape($form->{id}); |
|
1010 |
$form->redirect; |
|
1011 |
} |
|
1012 |
|
|
1013 |
$form->error($locale->text('Cannot undo delivery order transfer!') . $ret); |
|
1014 |
|
|
1015 |
$main::lxdebug->leave_sub(); |
|
1016 |
} |
|
972 | 1017 |
|
973 | 1018 |
sub invoice { |
974 | 1019 |
$main::lxdebug->enter_sub(); |
Auch abrufbar als: Unified diff
Lieferscheine neue Funktion Zurücklagern
Belege die nicht älter als das Zurücklagerungs-Intervall sind
können wieder "entlagert" werden.
Lieferschein die ausgelagert sind, wurden bisher strikter
als Rechnungen behandelt. Ein Zurücklagern war nur über
die Lagerkorrektur möglich.