return $rc;
}
+sub delete_transfers {
+ $main::lxdebug->enter_sub();
+
+ my ($self) = @_;
+
+ my $myconfig = \%main::myconfig;
+ my $form = $main::form;
+
+ my $rc = SL::DB::Order->new->db->with_transaction(sub {
+
+ my $do = SL::DB::DeliveryOrder->new(id => $form->{id})->load;
+ die "No valid delivery order found" unless ref $do eq 'SL::DB::DeliveryOrder';
+
+ my $dt = DateTime->today->subtract(days => $::instance_conf->get_undo_transfer_interval);
+ croak "Wrong call. Please check undoing interval" unless DateTime->compare($do->itime, $dt) == 1;
+
+ foreach my $doi (@{ $do->orderitems }) {
+ foreach my $dois (@{ $doi->delivery_order_stock_entries}) {
+ $dois->inventory->delete;
+ $dois->delete;
+ }
+ }
+ $do->update_attributes(delivered => 0);
+
+ 1;
+ });
+
+ $main::lxdebug->leave_sub();
+
+ return $rc;
+}
+
sub retrieve {
$main::lxdebug->enter_sub();
# $main::locale->text('SCREENED')
# $main::locale->text('CANCELED')
# $main::locale->text('IMPORT')
+# $main::locale->text('UNDO TRANSFER')
# $main::locale->text('UNIMPORT')
# $main::locale->text('invoice')
# $main::locale->text('proforma')
my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
my $is_customer = $::form->{vc} eq 'customer';
+ my $undo_date = DateTime->today->subtract(days => $::instance_conf->get_undo_transfer_interval);
+ my $insertdate = DateTime->from_kivitendo($::form->{insertdate});
+ my $undo_transfer = 0;
+ if (ref $undo_date eq 'DateTime' && ref $insertdate eq 'DateTime') {
+ # DateTime->compare it returns 1 if $dt1 > $dt2
+ $undo_transfer = DateTime->compare($insertdate, $undo_date) == 1 ? 1 : 0;
+ }
for my $bar ($::request->layout->get('actionbar')) {
$bar->add(
action =>
disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
only_if => !$is_customer && $::instance_conf->get_transfer_default,
],
+ action => [
+ t8('Undo Transfer'),
+ submit => [ '#form', { action => "delete_transfers" } ],
+ checks => [ 'kivi.validate_form' ],
+ only_if => $::form->{delivered},
+ disabled => !$undo_transfer ? t8('Transfer date exceeds the maximum allowed interval.') : undef,
+ ],
], # end of combobox "Transfer out"
$main::lxdebug->leave_sub();
}
+sub delete_transfers {
+ $main::lxdebug->enter_sub();
+
+ check_do_access();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $ret;
+
+ die "Invalid form type" unless $form->{type} =~ m/^(sales|purchase)_delivery_order$/;
+
+ if ($ret = DO->delete_transfers()) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|donumber_| . $form->{donumber};
+ $form->{addition} = "UNDO TRANSFER";
+ $form->save_history;
+ }
+ # /saving the history
+
+ flash_later('info', $locale->text("Transfer undone."));
+
+ $form->{callback} = 'do.pl?action=edit&type=' . $form->{type} . '&id=' . $form->escape($form->{id});
+ $form->redirect;
+ }
+
+ $form->error($locale->text('Cannot undo delivery order transfer!') . $ret);
+
+ $main::lxdebug->leave_sub();
+}
sub invoice {
$main::lxdebug->enter_sub();
Mahnung
Kleinere neue Features und Detailverbesserungen:
-
+ - Ausgelagerte Lieferscheinen können zurückgelagerte werden insofern der
+ konfigurierbare Zurücklagerungszeitraum noch nicht überschritten ist.
- Angebote und Aufträge im Ein- und Verkauf können optionale Positionen enthalten.
Optionale Positionen werden in der zweiten Zeile der Position aktiviert.
Die einzelne Position wird dann berechnet und erscheint im Ausdruck mit dem
'Cannot transfer negative entries.' => 'Kann keine negativen Mengen auslagern.',
'Cannot transfer negative quantities.' => 'Negative Mengen können nicht ausgelagert werden.',
'Cannot transfer. <br> Reason:<br>#1' => 'Kann nicht ein-/auslagern. <br>Grund:<br>#1',
+ 'Cannot undo delivery order transfer!' => 'Kann Lagerbewegung des Lieferscheins nicht zurücklagern!',
'Cannot unlink payment for a closed period!' => 'Ein oder alle Bankbewegungen befinden sich innerhalb einer geschloßenen Periode. ',
'Carry over account for year-end closing' => 'Saldenvortragskonto',
'Carry over shipping address' => 'Lieferadresse übernehmen',
'Default transport article number' => 'Standard Versand / Transport-Erinnerungs-Artikel',
'Default unit' => 'Standardeinheit',
'Default value' => 'Standardwert',
+ 'Defines the interval where undoing transfers from a delivery order are allowed.' => 'Zeitintervall in Tagen, an denen ein Zurücklagern der Lagerbewegung innerhalb eines Lieferscheins möglich ist.',
'Delete' => 'Löschen',
'Delete Account' => 'Konto löschen',
'Delete Attachments' => 'Anhänge löschen',
'Transfer To Stock' => 'Lagereingang',
'Transfer all marked' => 'Markierte übernehmen',
'Transfer data to Geierlein ELSTER application' => 'Daten in Geierlein ELSTER-Anwendung übernehmen',
+ 'Transfer date exceeds the maximum allowed interval.' => 'Das Belegdatum ist älter als das maximale Zurücklagerungs-Intervall es zulässt.',
'Transfer from warehouse' => 'Quelllager',
'Transfer in' => 'Einlagern',
'Transfer in via default' => 'Einlagern über Standard-Lagerplatz',
'Transfer qty' => 'Umlagermenge',
'Transfer services via default' => 'Falls Ein- /Auslagern über Standardlagerplatz aktiviert ist, auch die Dienstleistungen standardmässig Ein- und Auslagern',
'Transfer successful' => 'Lagervorgang erfolgreich',
+ 'Transfer undone.' => 'Zurücklagerung erfolgreich',
'Transferred' => 'Übernommen',
'Translation' => 'Übersetzung',
'Translations' => 'Übersetzungen',
'Type of Vendor' => 'Lieferantentyp',
'TypeAbbreviation' => 'Typ-Abkürzung',
'Types of Business' => 'Kunden-/Lieferantentypen',
+ 'UNDO TRANSFER' => 'Zurücklagern',
'UNIMPORT' => 'Import rückgängig',
'USTVA' => 'USTVA',
'USTVA 2004' => 'USTVA 2004',
'Unbalanced Ledger' => 'Bilanzfehler',
'Unchecked custom variables will not appear in orders and invoices.' => 'Unmarkierte Variablen werden für diesen Artikel nicht in Aufträgen und Rechnungen angezeigt.',
'Undo SEPA exports' => 'SEPA-Exporte rückgängig machen',
+ 'Undo Transfer' => 'Zurücklagern',
+ 'Undo Transfer Interval' => 'Zurücklagerungs-Intervall',
'Unfinished follow-ups' => 'Nicht erledigte Wiedervorlagen',
'Unfortunately you have no warehouse defined.' => 'Leider, gibt es kein Lager in diesem Mandanten.',
'Unimport all' => 'Alle zurück zur Quelle',
'Cannot transfer negative entries.' => '',
'Cannot transfer negative quantities.' => '',
'Cannot transfer. <br> Reason:<br>#1' => '',
+ 'Cannot undo delivery order transfer!' => '',
'Cannot unlink payment for a closed period!' => '',
'Carry over account for year-end closing' => '',
'Carry over shipping address' => '',
'Default transport article number' => '',
'Default unit' => '',
'Default value' => '',
+ 'Defines the interval where undoing transfers from a delivery order are allowed.' => '',
'Delete' => '',
'Delete Account' => '',
'Delete Attachments' => '',
'Transfer To Stock' => '',
'Transfer all marked' => '',
'Transfer data to Geierlein ELSTER application' => '',
+ 'Transfer date exceeds the maximum allowed interval.' => '',
'Transfer from warehouse' => '',
'Transfer in' => '',
'Transfer in via default' => '',
'Transfer qty' => '',
'Transfer services via default' => '',
'Transfer successful' => '',
+ 'Transfer undone.' => '',
'Transferred' => '',
'Translation' => '',
'Translations' => '',
'Type of Vendor' => '',
'TypeAbbreviation' => '',
'Types of Business' => '',
+ 'UNDO TRANSFER' => '',
'UNIMPORT' => '',
'USTVA' => '',
'USTVA 2004' => '',
'Unbalanced Ledger' => '',
'Unchecked custom variables will not appear in orders and invoices.' => '',
'Undo SEPA exports' => '',
+ 'Undo Transfer' => '',
+ 'Undo Transfer Interval' => '',
'Unfinished follow-ups' => '',
'Unfortunately you have no warehouse defined.' => '',
'Unimport all' => '',