From 29a62cccf8471a4cf9b77a5da1da1c2d741b9352 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 15 Oct 2013 15:30:00 +0200 Subject: [PATCH] Warnung bei Auftragspeichern mit aktiver wiederk. Rechnung, wenn schon eine Rechnung erzeugt wurde --- bin/mozilla/oe.pl | 13 +++++++++++++ js/edit_periodic_invoices_config.js | 4 ++++ js/locale/de.js | 3 ++- locale/de/all | 1 + templates/webpages/oe/form_footer.html | 4 ++-- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index e59e95c8f..ff759883b 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -35,6 +35,7 @@ use Carp; use POSIX qw(strftime); +use SL::DB::Order; use SL::DO; use SL::FU; use SL::OE; @@ -312,6 +313,18 @@ sub form_header { # Container for template variables. Unfortunately this has to be # visible in form_footer too, so package local level and not my here. %TMPL_VAR = (); + if ($form->{id}) { + my $obj = SL::DB::Order->new(id => $form->{id})->load; + $TMPL_VAR{warn_save_active_periodic_invoice} = + $obj->is_type('sales_order') + && $obj->periodic_invoices_config + && $obj->periodic_invoices_config->active + && ( !$obj->periodic_invoices_config->end_date + || ($obj->periodic_invoices_config->end_date > DateTime->today_local)) + && $obj->periodic_invoices_config->get_previous_invoice_date; + + $TMPL_VAR{oe_obj} = $obj; + } $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); diff --git a/js/edit_periodic_invoices_config.js b/js/edit_periodic_invoices_config.js index 6aaf88ef4..9392eb146 100644 --- a/js/edit_periodic_invoices_config.js +++ b/js/edit_periodic_invoices_config.js @@ -14,3 +14,7 @@ function edit_periodic_invoices_config() { // alert(url); window.open(url, "_new_generic", parm); } + +function warn_save_active_periodic_invoice() { + return confirm(kivi.t8('This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?')); +} diff --git a/js/locale/de.js b/js/locale/de.js index 3fbe53804..ac0f1367b 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -10,5 +10,6 @@ namespace("kivi").setupLocale({ "The name is missing.":"Der Name fehlt.", "The name must only consist of letters, numbers and underscores and start with a letter.":"Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.", "The option field is empty.":"Das Optionsfeld ist leer.", -"The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?" +"The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?", +"This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?":"Dieser Auftrag besitzt eine aktive Konfiguration für wiederkehrende Rechnungen. Wenn Sie jetzt speichern, so werden alle zukünftig hieraus erzeugten Rechnungen die Änderungen enthalten, nicht aber die bereits erzeugten Rechnungen. Wollen Sie speichern?" }); diff --git a/locale/de/all b/locale/de/all index 62892ef54..e1361b2e9 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2346,6 +2346,7 @@ $self->{texts} = { 'This option controls the posting and calculation behavior for the accounting method.' => 'Dieser Parameter steuert die Buchungs- und Berechnungsmethoden für die Versteuerungsart.', 'This partnumber is not unique. You should change it.' => 'Diese Artikelnummer ist nicht eindeutig. Bitte wählen Sie eine andere.', 'This requires you to manually correct entries for which an automatic conversion failed and to check those for which it succeeded.' => 'Dies erfordert, dass Sie diejenigen Einträge manuell korrigieren, für die die automatische Umstellung fehlschlug, sowie dass Sie diejenigen überprüfen, für die die Umstellung erfolgreich war.', + 'This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?' => 'Dieser Auftrag besitzt eine aktive Konfiguration für wiederkehrende Rechnungen. Wenn Sie jetzt speichern, so werden alle zukünftig hieraus erzeugten Rechnungen die Änderungen enthalten, nicht aber die bereits erzeugten Rechnungen. Wollen Sie speichern?', 'This transaction has to be split into several transactions manually.' => 'Diese Buchung muss manuell in mehrere Buchungen aufgeteilt werden.', 'This update will change the nature the onhand of goods is tracked.' => 'Dieses update ändert die Art und Weise wie Lagermengen gezält werden.', 'This user is a member in the following groups' => 'Dieser Benutzer ist Mitglied in den folgenden Gruppen', diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index ebd4c6f09..1896f7609 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -131,8 +131,8 @@ - - + + [%- IF id %] -- 2.20.1