From 032e3094aedff7d72652a4caf4fc1a1db9f3ad64 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 21 Mar 2017 15:32:21 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20=C2=BBSystem?= =?utf8?q?=C2=AB=20=E2=86=92=20=C2=BBZahlungsbedingungen=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/PaymentTerm.pm | 48 +++++++++++++++++++++++ locale/de/all | 4 +- templates/webpages/payment_term/form.html | 21 +++------- templates/webpages/payment_term/list.html | 4 -- 4 files changed, 56 insertions(+), 21 deletions(-) diff --git a/SL/Controller/PaymentTerm.pm b/SL/Controller/PaymentTerm.pm index f1eeb4477..bf3083d01 100644 --- a/SL/Controller/PaymentTerm.pm +++ b/SL/Controller/PaymentTerm.pm @@ -7,6 +7,7 @@ use parent qw(SL::Controller::Base); use SL::DB::PaymentTerm; use SL::DB::Language; use SL::Helper::Flash; +use SL::Locale::String qw(t8); use Rose::Object::MakeMethods::Generic ( @@ -25,6 +26,7 @@ __PACKAGE__->run_before('setup', only => [ qw(new edit) ]); sub action_list { my ($self) = @_; + $self->setup_list_action_bar; $self->render('payment_term/list', title => $::locale->text('Payment terms'), PAYMENT_TERMS => SL::DB::Manager::PaymentTerm->get_all_sorted); @@ -34,12 +36,14 @@ sub action_new { my ($self) = @_; $self->{payment_term} = SL::DB::PaymentTerm->new(auto_calculation => 1); + $self->setup_form_action_bar; $self->render('payment_term/form', title => $::locale->text('Create a new payment term')); } sub action_edit { my ($self) = @_; + $self->setup_form_action_bar; $self->render('payment_term/form', title => $::locale->text('Edit payment term')); } @@ -127,4 +131,48 @@ sub load_languages { $self->{languages} = SL::DB::Manager::Language->get_all_sorted; } +sub setup_list_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + link => [ + t8('Add'), + link => $self->url_for(action => 'new'), + ], + ); + } +} + +sub setup_form_action_bar { + my ($self) = @_; + + my $is_new = !$self->payment_term->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'PaymentTerm/' . ($is_new ? 'create' : 'update') } ], + checks => [ 'kivi.validate_form' ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'PaymentTerm/destroy' } ], + confirm => t8('Do you really want to delete this object?'), + disabled => $is_new ? t8('This object has not been saved yet.') : undef, + ], + + 'separator', + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list'), + ], + ); + } +} + 1; diff --git a/locale/de/all b/locale/de/all index 066901fa1..3f576a50e 100755 --- a/locale/de/all +++ b/locale/de/all @@ -302,7 +302,6 @@ $self->{texts} = { 'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:', 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', 'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', - 'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?', 'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?', 'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise aktualisieren wollen?', 'Are you sure you want to update the selected record template with the current values? This cannot be undone.' => 'Sind Sie sicher, dass Sie die ausgewählte Belegvorlage mit den aktuellen Daten aktualisieren wollen? Das kann nicht rückgängig gemacht werden.', @@ -714,7 +713,6 @@ $self->{texts} = { 'Create new' => 'Neu erfassen', 'Create new client #1' => 'Neuen Mandanten #1 anlegen', 'Create new delivery term' => 'Neue Lieferbedingungen anlegen', - 'Create new payment term' => 'Neue Zahlungsbedingung anlegen', 'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen', 'Create new quotation/order' => 'Neues Angebot/neuen Auftrag anlegen', 'Create new qutoation/order' => 'Neues Angebot/neuen Auftrag anlegen', @@ -1725,6 +1723,8 @@ $self->{texts} = { 'Long Description' => 'Langtext', 'Long Description (invoices)' => 'Langtext (Rechnungen)', 'Long Description (quotations & orders)' => 'Langtext (Angebote & Aufträge)', + 'Long Description for invoices' => 'Langtext für Rechnungen', + 'Long Description for quotations & orders' => 'Langtext für Angebote & Aufträge', 'Luxembourg' => 'Luxemburg', 'MAILED' => 'Gesendet', 'MD' => 'PT', diff --git a/templates/webpages/payment_term/form.html b/templates/webpages/payment_term/form.html index db7fdb17e..c371c463c 100755 --- a/templates/webpages/payment_term/form.html +++ b/templates/webpages/payment_term/form.html @@ -1,7 +1,7 @@ -[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] +[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]

[% FORM.title %]

-
+ [%- INCLUDE 'common/flash.html' %] @@ -14,7 +14,7 @@ [%- 'Description' | $T8 %] - + [% P.input_tag("payment_term.description", SELF.payment_term.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %] @@ -61,11 +61,11 @@ [%- 'Long Description' | $T8 %] - + [% P.input_tag("payment_term.description_long", SELF.payment_term.description_long, size="60", "data-validate"="required", "data-title"=LxERP.t8("Long Description for quotations & orders")) %] - + [% P.input_tag("payment_term.description_long_invoice", SELF.payment_term.description_long_invoice, size="60", "data-validate"="required", "data-title"=LxERP.t8("Long Description for invoices")) %] @@ -83,16 +83,7 @@ [%- END %] -

- - - - [%- IF SELF.payment_term.id %] - - [%- END %] - [%- 'Abort' | $T8 %] -

+ [% P.hidden_tag("id", SELF.payment_term.id) %]
diff --git a/templates/webpages/payment_term/list.html b/templates/webpages/payment_term/list.html index 7bedec8f4..bc56b9149 100644 --- a/templates/webpages/payment_term/list.html +++ b/templates/webpages/payment_term/list.html @@ -46,10 +46,6 @@ [%- END %] - -

- [%- 'Create new payment term' | $T8 %] -

[% L.sortable_element('#payment_term_list tbody', url => 'controller.pl?action=PaymentTerm/reorder', with => 'payment_term_id') %] -- 2.20.1