use SL::DB::PaymentTerm;
use SL::DB::Language;
use SL::Helper::Flash;
+use SL::Locale::String qw(t8);
use Rose::Object::MakeMethods::Generic
(
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);
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'));
}
$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;
'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.',
'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',
'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',
-[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %]
+[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]
<h1>[% FORM.title %]</h1>
- <form method="post" action="controller.pl">
+ <form method="post" action="controller.pl" id="form">
[%- INCLUDE 'common/flash.html' %]
<tr>
<td>[%- 'Description' | $T8 %]</td>
<td>
- <input name="payment_term.description" value="[%- HTML.escape(SELF.payment_term.description) %]">
+ [% P.input_tag("payment_term.description", SELF.payment_term.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]
</td>
</tr>
<tr>
<td>[%- 'Long Description' | $T8 %]</td>
<td>
- <input name="payment_term.description_long" value="[%- HTML.escape(SELF.payment_term.description_long) %]" size="60">
+ [% 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")) %]
</td>
<td>
- <input name="payment_term.description_long_invoice" value="[%- HTML.escape(SELF.payment_term.description_long_invoice) %]" size="60">
+ [% 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")) %]
</td>
</tr>
[%- END %]
</table>
- <p>
- <input type="hidden" name="id" value="[% SELF.payment_term.id %]">
- <input type="hidden" name="action" value="PaymentTerm/dispatch">
- <input type="submit" class="submit" name="action_[% IF SELF.payment_term.id %]update[% ELSE %]create[% END %]" value="[% 'Save' | $T8 %]">
- [%- IF SELF.payment_term.id %]
- <input type="submit" class="submit" name="action_destroy" value="[% 'Delete' | $T8 %]"
- onclick="if (confirm('[% 'Are you sure you want to delete this payment term?' | $T8 %]')) return true; else return false;">
- [%- END %]
- <a href="[% SELF.url_for(action => 'list') %]">[%- 'Abort' | $T8 %]</a>
- </p>
+ [% P.hidden_tag("id", SELF.payment_term.id) %]
<hr size="3" noshade>
</tbody>
</table>
[%- END %]
-
- <p>
- <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new payment term' | $T8 %]</a>
- </p>
</form>
[% L.sortable_element('#payment_term_list tbody', url => 'controller.pl?action=PaymentTerm/reorder', with => 'payment_term_id') %]