From dbbf892309056494e9243df8b7599096ef9e42c5 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 12 May 2011 10:26:48 +0200 Subject: [PATCH] Verwaltung von Zahlungsbedingungen auf Controller/Model umgestellt Conflicts: locale/de/all --- SL/AM.pm | 156 +------- SL/Controller/PaymentTerm.pm | 117 ++++++ SL/DB/Manager/PaymentTerm.pm | 21 + SL/DB/PaymentTerm.pm | 17 +- SL/Form.pm | 8 +- bin/mozilla/am.pl | 363 ------------------ locale/de/all | 48 ++- menu.ini | 8 +- .../payment_terms_translation2.sql | 9 + sql/Pg-upgrade2/schema_normalization_2.sql | 1 - templates/webpages/payment_term/form.html | 89 +++++ templates/webpages/payment_term/list.html | 57 +++ 12 files changed, 344 insertions(+), 550 deletions(-) create mode 100644 SL/Controller/PaymentTerm.pm create mode 100644 SL/DB/Manager/PaymentTerm.pm create mode 100644 sql/Pg-upgrade2/payment_terms_translation2.sql create mode 100644 templates/webpages/payment_term/form.html create mode 100644 templates/webpages/payment_term/list.html diff --git a/SL/AM.pm b/SL/AM.pm index 445abd2e3..c80177293 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -880,7 +880,7 @@ sub delete_language { # connect to database my $dbh = $form->dbconnect_noauto($myconfig); - foreach my $table (qw(translation_payment_terms units_language)) { + foreach my $table (qw(generic_translations units_language)) { $query = qq|DELETE FROM $table WHERE language_id = ?|; do_query($form, $dbh, $query, $form->{"id"}); } @@ -1124,160 +1124,6 @@ sub swap_sortkeys { $main::lxdebug->leave_sub(); } -sub payment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT * FROM payment_terms ORDER BY sortkey|; - - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - $form->{ALL} = []; - while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $form->{ALL} }, $ref; - } - - $sth->finish; - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub get_payment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT * FROM payment_terms WHERE id = ?|; - my $sth = $dbh->prepare($query); - $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); - - my $ref = $sth->fetchrow_hashref("NAME_lc"); - map { $form->{$_} = $ref->{$_} } keys %$ref; - $sth->finish(); - - $query = - qq|SELECT t.language_id, t.description_long, l.description AS language | . - qq|FROM translation_payment_terms t | . - qq|LEFT JOIN language l ON t.language_id = l.id | . - qq|WHERE t.payment_terms_id = ? | . - qq|UNION | . - qq|SELECT l.id AS language_id, NULL AS description_long, | . - qq| l.description AS language | . - qq|FROM language l|; - $sth = $dbh->prepare($query); - $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); - - my %mapping; - while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - $mapping{ $ref->{"language_id"} } = $ref - unless (defined($mapping{ $ref->{"language_id"} })); - } - $sth->finish; - - $form->{"TRANSLATION"} = [sort({ $a->{"language"} cmp $b->{"language"} } - values(%mapping))]; - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub save_payment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); - - my $query; - - if (!$form->{id}) { - $query = qq|SELECT nextval('id'), COALESCE(MAX(sortkey) + 1, 1) | . - qq|FROM payment_terms|; - my $sortkey; - ($form->{id}, $sortkey) = selectrow_query($form, $dbh, $query); - - $query = qq|INSERT INTO payment_terms (id, sortkey) VALUES (?, ?)|; - do_query($form, $dbh, $query, $form->{id}, $sortkey); - - } else { - $query = - qq|DELETE FROM translation_payment_terms | . - qq|WHERE payment_terms_id = ?|; - do_query($form, $dbh, $query, $form->{"id"}); - } - - $query = qq|UPDATE payment_terms SET - description = ?, description_long = ?, - terms_netto = ?, terms_skonto = ?, - percent_skonto = ? - WHERE id = ?|; - my @values = ($form->{description}, $form->{description_long}, - $form->{terms_netto} * 1, $form->{terms_skonto} * 1, - $form->{percent_skonto} * 1, - $form->{id}); - do_query($form, $dbh, $query, @values); - - $query = qq|SELECT id FROM language|; - my @language_ids; - my $sth = $dbh->prepare($query); - $sth->execute() || $form->dberror($query); - - while (my ($id) = $sth->fetchrow_array()) { - push(@language_ids, $id); - } - $sth->finish(); - - $query = - qq|INSERT INTO translation_payment_terms | . - qq|(language_id, payment_terms_id, description_long) | . - qq|VALUES (?, ?, ?)|; - $sth = $dbh->prepare($query); - - foreach my $language_id (@language_ids) { - do_statement($form, $sth, $query, $language_id, $form->{"id"}, - $form->{"description_long_${language_id}"}); - } - $sth->finish(); - - $dbh->commit(); - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub delete_payment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); - - my $query = - qq|DELETE FROM translation_payment_terms WHERE payment_terms_id = ?|; - do_query($form, $dbh, $query, $form->{"id"}); - - $query = qq|DELETE FROM payment_terms WHERE id = ?|; - do_query($form, $dbh, $query, $form->{"id"}); - - $dbh->commit(); - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - - sub prepare_template_filename { $main::lxdebug->enter_sub(); diff --git a/SL/Controller/PaymentTerm.pm b/SL/Controller/PaymentTerm.pm new file mode 100644 index 000000000..631428edb --- /dev/null +++ b/SL/Controller/PaymentTerm.pm @@ -0,0 +1,117 @@ +package SL::Controller::PaymentTerm; + +use strict; + +use parent qw(SL::Controller::Base); + +use SL::DB::PaymentTerm; +use SL::DB::Language; +use SL::Helper::Flash; + +use Rose::Object::MakeMethods::Generic +( + scalar => [ qw(payment_term languages) ], +); + +__PACKAGE__->run_before('load_payment_term', only => [ qw( edit update destroy move_up move_down) ]); +__PACKAGE__->run_before('load_languages', only => [ qw(new list edit create update) ]); + +# +# actions +# + +sub action_list { + my ($self) = @_; + + $self->render('payment_term/list', + title => $::locale->text('Payment terms'), + PAYMENT_TERMS => SL::DB::Manager::PaymentTerm->get_all_sorted); +} + +sub action_new { + my ($self) = @_; + + $self->{payment_term} = SL::DB::PaymentTerm->new; + $self->render('payment_term/form', title => $::locale->text('Create a new payment term')); +} + +sub action_edit { + my ($self) = @_; + $self->render('payment_term/form', title => $::locale->text('Edit payment term')); +} + +sub action_create { + my ($self) = @_; + + $self->{payment_term} = SL::DB::PaymentTerm->new; + $self->create_or_update; +} + +sub action_update { + my ($self) = @_; + $self->create_or_update; +} + +sub action_destroy { + my ($self) = @_; + + if (eval { $self->{payment_term}->delete; 1; }) { + flash_later('info', $::locale->text('The payment term has been deleted.')); + } else { + flash_later('error', $::locale->text('The payment term is in use and cannot be deleted.')); + } + + $self->redirect_to(action => 'list'); +} + +sub action_move_up { + my ($self) = @_; + $self->{payment_term}->move_position_up; + $self->redirect_to(action => 'list'); +} + +sub action_move_down { + my ($self) = @_; + $self->{payment_term}->move_position_down; + $self->redirect_to(action => 'list'); +} + +# +# helpers +# + +sub create_or_update { + my $self = shift; + my $is_new = !$self->{payment_term}->id; + my $params = delete($::form->{payment_term}) || { }; + + $self->{payment_term}->assign_attributes(%{ $params }); + + my @errors = $self->{payment_term}->validate; + + if (@errors) { + flash('error', @errors); + $self->render('payment_term/form', title => $is_new ? $::locale->text('Create a new payment term') : $::locale->text('Edit payment term')); + return; + } + + $self->{payment_term}->save; + foreach my $language (@{ $self->{languages} }) { + $self->{payment_term}->save_attribute_translation('description_long', $language, $::form->{"translation_" . $language->id}); + } + + flash_later('info', $is_new ? $::locale->text('The payment term has been created.') : $::locale->text('The payment term has been saved.')); + $self->redirect_to(action => 'list'); +} + +sub load_payment_term { + my ($self) = @_; + $self->{payment_term} = SL::DB::PaymentTerm->new(id => $::form->{id})->load; +} + +sub load_languages { + my ($self) = @_; + $self->{languages} = SL::DB::Manager::Language->get_all_sorted; +} + +1; diff --git a/SL/DB/Manager/PaymentTerm.pm b/SL/DB/Manager/PaymentTerm.pm new file mode 100644 index 000000000..abe6837fa --- /dev/null +++ b/SL/DB/Manager/PaymentTerm.pm @@ -0,0 +1,21 @@ +package SL::DB::Manager::PaymentTerm; + +use strict; + +use SL::DB::Helper::Manager; +use base qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Sorted; + +sub object_class { 'SL::DB::PaymentTerm' } + +__PACKAGE__->make_manager_methods; + +sub _sort_spec { + return ( default => [ 'sortkey', 1 ], + columns => { SIMPLE => 'ALL', + map { ( $_ => "lower(payment_terms.${_})" ) } qw(description description_long), + }); +} + +1; diff --git a/SL/DB/PaymentTerm.pm b/SL/DB/PaymentTerm.pm index b525910e9..3630a7094 100644 --- a/SL/DB/PaymentTerm.pm +++ b/SL/DB/PaymentTerm.pm @@ -1,13 +1,20 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::PaymentTerm; use strict; use SL::DB::MetaSetup::PaymentTerm; +use SL::DB::Manager::PaymentTerm; +use SL::DB::Helper::ActsAsList; +use SL::DB::Helper::TranslatedAttributes; + +sub validate { + my ($self) = @_; + + my @errors; + push @errors, $::locale->text('The description is missing.') if !$self->description; + push @errors, $::locale->text('The long description is missing.') if !$self->description_long; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; + return @errors; +} 1; diff --git a/SL/Form.pm b/SL/Form.pm index 28e12258a..4c9030435 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1904,10 +1904,12 @@ sub set_payment_options { if ($self->{"language_id"}) { $query = - qq|SELECT t.description_long, l.output_numberformat, l.output_dateformat, l.output_longdates | . - qq|FROM translation_payment_terms t | . + qq|SELECT t.translation, l.output_numberformat, l.output_dateformat, l.output_longdates | . + qq|FROM generic_translations t | . qq|LEFT JOIN language l ON t.language_id = l.id | . - qq|WHERE (t.language_id = ?) AND (t.payment_terms_id = ?)|; + qq|WHERE (t.language_id = ?) + AND (t.translation_id = ?) + AND (t.translation_type = 'SL::DB::PaymentTerm/description_long')|; my ($description_long, $output_numberformat, $output_dateformat, $output_longdates) = selectrow_query($self, $dbh, $query, diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e96c604a1..5dfb72f00 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -2018,369 +2018,6 @@ sub swap_buchungsgruppen { $main::lxdebug->leave_sub(); } -sub add_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_payment" unless $form->{callback}; - - $form->{terms_netto} = 0; - $form->{terms_skonto} = 0; - $form->{percent_skonto} = 0; - my @languages = AM->language(\%myconfig, $form, 1); - map({ $_->{"language"} = $_->{"description"}; - $_->{"language_id"} = $_->{"id"}; } @languages); - $form->{"TRANSLATION"} = \@languages; - &payment_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_payment(\%myconfig, $form); - $form->{percent_skonto} = - $form->format_amount(\%myconfig, $form->{percent_skonto} * 100); - - &payment_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->payment(\%myconfig, \%$form); - - $form->{callback} = build_std_url("action=list_payment"); - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Payment Terms'); - - my @column_index = qw(up down description description_long terms_netto - terms_skonto percent_skonto); - my %column_header; - $column_header{up} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{down} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{description_long} = - qq|| - . $locale->text('Long Description') - . qq||; - $column_header{terms_netto} = - qq|| - . $locale->text('Netto Terms') - . qq||; - $column_header{terms_skonto} = - qq|| - . $locale->text('Skonto Terms') - . qq||; - $column_header{percent_skonto} = - qq|| - . $locale->text('Skonto') - . qq| %|; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my $swap_link = build_std_url("action=swap_payment_terms"); - - my $row = 0; - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - if ($row) { - my $pref = $form->{ALL}->[$row - 1]; - $column_data{up} = - qq||; - } else { - $column_data{up} = qq||; - } - - if ($row == (scalar(@{ $form->{ALL} }) - 1)) { - $column_data{down} = qq||; - } else { - my $nref = $form->{ALL}->[$row + 1]; - $column_data{down} = - qq||; - } - - $column_data{description} = - qq||; - $column_data{description_long} = - qq||; - $column_data{terms_netto} = - qq||; - $column_data{terms_skonto} = - qq||; - $column_data{percent_skonto} = - qq||; - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - $row++; - } - - print qq| -
| . - qq|| . - qq|| . $locale->text(| . - qq|  | . - qq|| . - qq|| . $locale->text(| . - qq|{id}", "callback=$callback") . - qq|">| . H($ref->{description}) . qq|| . H($ref->{description_long}) . qq|$ref->{terms_netto}$ref->{terms_skonto}| . - $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) . - qq|%
-

- -
-
- - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub payment_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Payment Terms"); - - # $locale->text('Add Payment Terms') - # $locale->text('Edit Payment Terms') - - $form->{description} =~ s/\"/"/g; - - - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - -|; - - foreach my $language (@{ $form->{"TRANSLATION"} }) { - print qq| - - - - -|; - } - - print qq| - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Description') . qq|
| . $locale->text('Long Description') . qq|
| . - sprintf($locale->text('Translation (%s)'), - $language->{"language"}) - . qq|
| . $locale->text('Netto Terms') . qq|
| . $locale->text('Skonto Terms') . qq|
| . $locale->text('Skonto') . qq| %

- -

| . $locale->text("You can use the following strings in the long " . - "description and all translations. They will be " . - "replaced by their actual values by Lx-Office " . - "before they're output.") -. qq|

- -|; - - $main::lxdebug->leave_sub(); -} - -sub save_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - $form->{"percent_skonto"} = - $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100; - AM->save_payment(\%myconfig, \%$form); - $form->redirect($locale->text('Payment Terms saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_payment(\%myconfig, \%$form); - $form->redirect($locale->text('Payment terms deleted!')); - - $main::lxdebug->leave_sub(); -} - -sub swap_payment_terms { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - AM->swap_sortkeys(\%myconfig, $form, "payment_terms"); - list_payment(); - - $main::lxdebug->leave_sub(); -} - sub edit_defaults { $main::lxdebug->enter_sub(); diff --git a/locale/de/all b/locale/de/all index ded1a3279..3eeba996a 100644 --- a/locale/de/all +++ b/locale/de/all @@ -14,19 +14,6 @@ $self->{texts} = { ' Part Number missing!' => ' Artikelnummer fehlt!', ' missing!' => ' fehlt!', '#1 prices were updated.' => '#1 Preise wurden aktualisiert.', - '<%account_number%> -- Your account number' => '<%account_number%> -- Ihre Kontonummer', - '<%bank%> -- Your bank' => '<%bank%> -- Der Name Ihrer Bank', - '<%bank_code%> -- Your bank code' => '<%bank_code%> -- Die Bankleitzahl Ihrer Bank', - '<%currency%> -- The selected currency' => '<%currency%> -- Die ausgewählte Währung', - '<%invtotal%> -- Invoice total' => '<%invtotal%> -- Die Rechnungssumme', - '<%invtotal_wo_skonto%> -- Invoice total less discount' => '<%invtotal_wo_skonto%> -- Rechnungssumme abzüglich Skonto', - '<%netto_date%> -- Date the payment is due in full' => '<%netto_date%> -- Das Datum, bis die Rechnung in voller Höhe bezahlt werden muss', - '<%skonto_amount%> -- The deductible amount' => '<%skonto_amount%> -- Der abziehbare Skontobetrag', - '<%skonto_date%> -- Date the payment is due with discount' => '<%skonto_date%> -- Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann', - '<%skonto_in_percent%> -- The discount in percent' => '<%skonto_in_percent%> -- Der prozentuale Rabatt', - '<%terms_netto%> -- The number of days for full payment' => '<%terms_netto%> -- Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss', - '<%total%> -- Amount payable' => '<%total%> -- Noch zu bezahlender Betrag', - '<%total_wo_skonto%> -- Amount payable less discount' => '<%total_wo_skonto%> -- Noch zu bezahlender Betrag abzüglich Skonto', '*/' => '*/', '---please select---' => '---bitte auswählen---', '...after loggin in' => '...nach dem Anmelden', @@ -64,6 +51,7 @@ $self->{texts} = { 'AR Transaction (abbreviation)' => 'D', 'AR Transactions' => 'Debitorenbuchungen', 'ASSETS' => 'AKTIVA', + 'Abort' => 'Abbrechen', 'Abrechnungsnummer' => 'Abrechnungsnummer', 'Abteilung' => 'Abteilung', 'Account' => 'Konto', @@ -184,6 +172,8 @@ $self->{texts} = { 'Amount' => 'Betrag', 'Amount Due' => 'Betrag fällig', 'Amount has to be greater then zero! Wrong row number: ' => 'Leere Eingabe oder Werte kleiner, gleich null eingegeben. Fehler in Reihe Nummer: ', + 'Amount payable' => 'Noch zu bezahlender Betrag', + 'Amount payable less discount' => 'Noch zu bezahlender Betrag abzüglich Skonto', 'An invalid character was used (invalid characters: #1).' => 'Ein ungültiges Zeichen wurde benutzt (ungültige Zeichen: #1).', 'An invalid character was used (valid characters: #1).' => 'Ein ungültiges Zeichen wurde benutzt (gültige Zeichen: #1).', 'An upper-case character is required.' => 'Ein Großbuchstabe ist vorgeschrieben.', @@ -202,6 +192,7 @@ $self->{texts} = { 'Are you sure you want to delete Order Number' => 'Soll der Auftrag mit folgender Nummer wirklich gelöscht werden:', 'Are you sure you want to delete Quotation Number' => 'Sind Sie sicher, dass Angebotnummer gelöscht werden soll?', 'Are you sure you want to delete Transaction' => 'Buchung wirklich löschen?', + '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?', 'Article Code' => 'Artikelkürzel', @@ -420,6 +411,7 @@ $self->{texts} = { 'Create Chart of Accounts' => 'Zu verwendender Kontenplan', 'Create Dataset' => 'Neue Datenbank anlegen', 'Create Date' => 'Erstelldatum', + 'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen', 'Create a standard group' => 'Eine Standard-Benutzergruppe anlegen', 'Create and edit RFQs' => 'Lieferantenanfragen erfassen und bearbeiten', 'Create and edit customers and vendors' => 'Kunden und Lieferanten erfassen und bearbeiten', @@ -439,6 +431,7 @@ $self->{texts} = { 'Create bank transfer via SEPA XML' => 'Überweisung via SEPA XML erzeugen', 'Create invoice?' => 'Rechnung erstellen?', 'Create new' => 'Neu erfassen', + 'Create new payment term' => 'Neue Zahlungsbedingung anlegen', 'Create tables' => 'Tabellen anlegen', 'Created by' => 'Erstellt von', 'Created for' => 'Erstellt für', @@ -509,6 +502,8 @@ $self->{texts} = { 'Date Paid' => 'Zahlungsdatum', 'Date and timestamp variables: If the default value equals \'NOW\' then the current date/current timestamp will be used. Otherwise the default value is copied as-is.' => 'Datums- und Uhrzeitvariablen: Wenn der Standardwert \'NOW\' ist, so wird das aktuelle Datum/die aktuelle Uhrzeit eingefügt. Andernfalls wird der Standardwert so wie er ist benutzt.', 'Date missing!' => 'Datum fehlt!', + 'Date the payment is due in full' => 'Das Datum, bis die Rechnung in voller Höhe bezahlt werden muss', + 'Date the payment is due with discount' => 'Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann', 'Datevautomatik' => 'Datevexport', 'Datum von' => 'Datum von', 'Debit' => 'Soll', @@ -652,7 +647,6 @@ $self->{texts} = { 'Edit Language' => 'Sprache bearbeiten', 'Edit Lead' => 'Kundenquelle bearbeiten', 'Edit Part' => 'Ware bearbeiten', - 'Edit Payment Terms' => 'Zahlungskonditionen bearbeiten', 'Edit Preferences for #1' => 'Einstellungen von #1 bearbeiten', 'Edit Price Factor' => 'Preisfaktor bearbeiten', 'Edit Pricegroup' => 'Preisgruppe bearbeiten', @@ -683,6 +677,7 @@ $self->{texts} = { 'Edit groups' => 'Gruppen bearbeiten', 'Edit membership' => 'Mitgliedschaft bearbeiten', 'Edit note' => 'Notiz bearbeiten', + 'Edit payment term' => 'Zahlungsbedingungen bearbeiten', 'Edit rights' => 'Rechte bearbeiten', 'Edit templates' => 'Vorlagen bearbeiten', 'Edit the Delivery Order' => 'Lieferschein bearbeiten', @@ -757,6 +752,7 @@ $self->{texts} = { 'Feb' => 'Feb', 'February' => 'Februar', 'Fee' => 'Gebühr', + 'Field' => 'Feld', 'File' => 'Datei', 'File name' => 'Dateiname', 'Files created by Lx-Office\'s "Backup Dataset" function are such files.' => 'Dateien, die von Lx-Office\' Funktion "Datenbank sichern" erstellt wurden, erfüllen diese Kriterien.', @@ -903,6 +899,8 @@ $self->{texts} = { 'Invoice for fees' => 'Rechnung über Gebühren', 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.', 'Invoice number' => 'Rechnungsnummer', + 'Invoice total' => 'Die Rechnungssumme', + 'Invoice total less discount' => 'Rechnungssumme abzüglich Skonto', 'Invoice with Storno (abbreviation)' => 'R(S)', 'Invoices' => 'Rechnungen', 'Is Searchable' => 'Durchsuchbar', @@ -971,7 +969,7 @@ $self->{texts} = { 'List Groups' => 'Warengruppen anzeigen', 'List Languages' => 'Sprachen anzeigen', 'List Lead' => 'Kundenquelle anzeigen', - 'List Payment Terms' => 'Zahlungskonditionen anzeigen', + 'List Payment Terms' => 'Zahlungsbedingungen anzeigen', 'List Price' => 'Listenpreis', 'List Price Factors' => 'Preisfaktoren anzeigen', 'List Pricegroups' => 'Preisgruppen anzeigen', @@ -1102,6 +1100,7 @@ $self->{texts} = { 'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.', 'No or an unknown authenticantion module specified in "config/lx_office.conf".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/lx_office.conf" angegeben.', 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', + 'No payment term has been created yet.' => 'Es wurden noch keine Zahlungsbedingungen angelegt.', 'No prices will be updated because no prices have been entered.' => 'Es werden keine Preise aktualisiert, weil keine gültigen Preisänderungen eingegeben wurden.', 'No problems were recognized.' => 'Es wurden keine Probleme gefunden.', 'No transaction selected!' => 'Keine Transaktion ausgewählt', @@ -1209,13 +1208,12 @@ $self->{texts} = { 'Payables' => 'Verbindlichkeiten', 'Payment' => 'Zahlungsausgang', 'Payment Reminder' => 'Zahlungserinnerung', - 'Payment Terms' => 'Zahlungskonditionen', + 'Payment Terms' => 'Zahlungsbedingungen', 'Payment Terms missing in row ' => 'Zahlungsfrist fehlt in Zeile ', - 'Payment Terms saved!' => 'Zahlungskonditionen gespeichert!', 'Payment date missing!' => 'Tag der Zahlung fehlt!', 'Payment list as PDF' => 'Zahlungsliste als PDF', 'Payment posted!' => 'Zahlung gebucht!', - 'Payment terms deleted!' => 'Zahlungskonditionen gelöscht!', + 'Payment terms' => 'Zahlungsbedingungen', 'Payments' => 'Zahlungsausgänge', 'Per. Inv.' => 'Wied. Rech.', 'Period' => 'Zeitraum', @@ -1650,12 +1648,14 @@ $self->{texts} = { 'The dataset backup has been sent via email to #1.' => 'Die Datenbanksicherung wurde per Email an #1 verschickt.', 'The dataset has to exist before a restoration can be started.' => 'Die Datenbank muss vor der Wiederherstellung bereits angelegt worden sein.', 'The dataset name is missing.' => 'Der Datenbankname fehlt.', + 'The deductible amount' => 'Der abziehbare Skontobetrag', 'The default value depends on the variable type:' => 'Die Bedeutung des Standardwertes hängt vom Variablentypen ab:', 'The delivery order has not been marked as delivered. The warehouse contents have not changed.' => 'Der Lieferschein wurde nicht als geliefert markiert. Der Lagerinhalt wurde nicht verändert.', 'The description is missing.' => 'Die Beschreibung fehlt.', 'The description is shown on the form. Chose something short and descriptive.' => 'Die Beschreibung wird in der jeweiligen Maske angezeigt. Sie sollte kurz und prägnant sein.', 'The directory "%s" could not be created:\n%s' => 'Das Verzeichnis "%s" konnte nicht erstellt werden:\n%s', 'The directory %s does not exist.' => 'Das Verzeichnis %s existiert nicht.', + 'The discount in percent' => 'Der prozentuale Rabatt', 'The dunning process started' => 'Der Mahnprozess ist gestartet.', 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', 'The email address is missing.' => 'Die Emailadresse fehlt.', @@ -1684,10 +1684,12 @@ $self->{texts} = { 'The licensing module has been deactivated in the configuration.' => 'Das Lizenzverwaltungsmodul wurde in der Konfiguration deaktiviert.', 'The list has been printed.' => 'Die Liste wurde ausgedruckt.', 'The login is missing.' => 'Das Login fehlt.', + 'The long description is missing.' => 'Der Langtext fehlt.', 'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.', 'The name is missing in row %d.' => 'Der Name fehlt in Zeile %d.', '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 number of days for full payment' => 'Die Anzahl Tage, bis die Rechnung in voller Höhe bezahlt werden muss', 'The old file containing the user information is still present ("#1"). Do you want to migrate these users into the database? If not then you will not be able to log in with any of the users present in the old file.' => 'Die alte Datei mit den Benutzerdaten existiert in dieser Installation noch immer ("#1"). Wollen Sie diese Benutzer in die neue Authentifizierungsdatenbank migrieren lassen? Falls nicht, so werden Sie sich nicht mehr mit den Benutzerdaten aus der alten Mitgliedsdatei anmelden können.', 'The option field is empty.' => 'Das Optionsfeld ist leer.', 'The parts for this delivery order have already been transferred in.' => 'Die Artikel dieses Lieferscheins wurden bereits eingelagert.', @@ -1698,6 +1700,10 @@ $self->{texts} = { 'The password is too long (maximum length: #1).' => 'Das Passwort ist zu lang (maximale Länge: #1).', 'The password is too short (minimum length: #1).' => 'Das Password ist zu kurz (minimale Länge: #1).', 'The password is weak (e.g. it can be found in a dictionary).' => 'Das Passwort ist schwach (z.B. wenn es in einem Wörterbuch steht).', + 'The payment term has been created.' => 'Die Zahlungsbedingungen wurden angelegt.', + 'The payment term has been deleted.' => 'Die Zahlungsbedingungen wurden gelöscht.', + 'The payment term has been saved.' => 'Die Zahlungsbedingungen wurden gespeichert.', + 'The payment term is in use and cannot be deleted.' => 'Die Zahlungsbedingungen werden bereits benutzt und können nicht gelöscht werden.', 'The payments have been posted.' => 'Die Zahlungen wurden gebucht.', 'The pg_dump process could not be started.' => 'Der pg_dump-Prozess konnte nicht gestartet werden.', 'The pg_restore process could not be started.' => 'Der pg_restore-Prozess konnte nicht gestartet werden.', @@ -1712,6 +1718,7 @@ $self->{texts} = { 'The selected PostgreSQL installation uses UTF-8 as its encoding. Therefore you have to configure Lx-Office to use UTF-8 as well.' => 'Die ausgewählte PostgreSQL-Installation benutzt UTF-8 als Zeichensatz. Deshalb müssen Sie Lx-Office so konfigurieren, dass es ebenfalls UTF-8 als Zeichensatz benutzt.', 'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.', 'The selected bin does not exist.' => 'Der ausgewählte Lagerplatz existiert nicht.', + 'The selected currency' => 'Die ausgewählte Währung', 'The selected exports have been closed.' => 'Die ausgewählten Exporte wurden abgeschlossen.', 'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.', 'The selected warehouse is empty, or no stocked items where found that match the filter settings.' => 'Das ausgewählte Lager ist leer, oder in ihm wurden keine zu den Sucheinstellungen passenden eingelagerten Artikel gefunden.', @@ -1812,7 +1819,7 @@ $self->{texts} = { 'Transfer in' => 'Einlagern', 'Transfer out' => 'Auslagern', 'Transfer qty' => 'Umlagermenge', - 'Translation (%s)' => 'Übersetzung (%s)', + 'Translation' => 'Übersetzung', 'Trial Balance' => 'Summen- und Saldenliste', 'Trial balance between %s and %s' => 'Summen- und Saldenlisten vom %s bis zum %s', 'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', @@ -1972,6 +1979,9 @@ $self->{texts} = { 'You\'ve already chosen the following limitations:' => 'Sie haben bereits die folgenden Einschränkungen vorgenommen:', 'Your PostgreSQL installationen uses UTF-8 as its encoding. Therefore you have to configure Lx-Office to use UTF-8 as well.' => 'Ihre PostgreSQL-Installation benutzt UTF-8 als Zeichensatz. Sie müssen deshalb Lx-Office so konfigurieren, dass es ebenfalls UTF-8 als Zeichensatz benutzt.', 'Your TODO list' => 'Ihre Aufgabenliste', + 'Your account number' => 'Ihre Kontonummer', + 'Your bank' => 'Der Name Ihrer Bank', + 'Your bank code' => 'Die Bankleitzahl Ihrer Bank', 'Your browser does not currently support Javascript.' => 'Ihr Browser unterstützt im Moment kein Javascript!', 'Your download does not exist anymore. Please re-run the DATEV export assistant.' => 'Ihr Download existiert nicht mehr. Bitte starten Sie den DATEV-Exportassistenten erneut.', 'Zeitpunkt' => 'Zeitpunkt', diff --git a/menu.ini b/menu.ini index 19a5a7d2a..0dd0a5e1b 100644 --- a/menu.ini +++ b/menu.ini @@ -698,12 +698,12 @@ target=acc_menu submenu=1 [System--Payment Terms--Add Payment Terms] -module=am.pl -action=add_payment +module=controller.pl +action=PaymentTerm/new [System--Payment Terms--List Payment Terms] -module=am.pl -action=list_payment +module=controller.pl +action=PaymentTerm/list [System--Manage Custom Variables] module=menu.pl diff --git a/sql/Pg-upgrade2/payment_terms_translation2.sql b/sql/Pg-upgrade2/payment_terms_translation2.sql new file mode 100644 index 000000000..09b26f0c9 --- /dev/null +++ b/sql/Pg-upgrade2/payment_terms_translation2.sql @@ -0,0 +1,9 @@ +-- @tag: payment_terms_translation2 +-- @description: Eingliederung von payment_terms_translation in generic_translations +-- @depends: release_2_6_1 +-- @charset: utf-8 +INSERT INTO generic_translations (language_id, translation_type, translation_id, translation) + SELECT language_id, 'SL::DB::PaymentTerm/description_long', payment_terms_id, description_long + FROM translation_payment_terms; + +DROP TABLE translation_payment_terms; diff --git a/sql/Pg-upgrade2/schema_normalization_2.sql b/sql/Pg-upgrade2/schema_normalization_2.sql index 87ab63692..d6b2b3bd2 100644 --- a/sql/Pg-upgrade2/schema_normalization_2.sql +++ b/sql/Pg-upgrade2/schema_normalization_2.sql @@ -24,6 +24,5 @@ ALTER TABLE status ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE tax_zones ADD PRIMARY KEY (id); ALTER TABLE todo_user_config ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE translation ADD COLUMN id SERIAL PRIMARY KEY; -ALTER TABLE translation_payment_terms ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE units_language ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE vendortax ADD COLUMN id SERIAL PRIMARY KEY; diff --git a/templates/webpages/payment_term/form.html b/templates/webpages/payment_term/form.html new file mode 100644 index 000000000..3ea1cdbaa --- /dev/null +++ b/templates/webpages/payment_term/form.html @@ -0,0 +1,89 @@ +[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] + + + +
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + + + + + + + + + + + + + [%- FOREACH language = SELF.languages %] + + + + + [%- END %] + + + + + + + + + + + + + + + +
[%- 'Description' | $T8 %] + +
[%- 'Long Description' | $T8 %] + +
[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %]) + +
[%- 'Netto Terms' | $T8 %] + +
[%- 'Skonto Terms' | $T8 %] + +
[%- 'Skonto' | $T8 %] + % +
+ +

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

+ +
+ +

[% LxERP.t8("You can use the following strings in the long description and all translations. They will be replaced by their actual values by Lx-Office before they're output.") %]

+ + + + + + + + + + + + + + + + +
[%- LxERP.t8('Field') %][%- LxERP.t8('Description') %]
<%netto_date%>[% LxERP.t8("Date the payment is due in full") %]
<%skonto_date%>[% LxERP.t8("Date the payment is due with discount") %]
<%skonto_amount%>[% LxERP.t8("The deductible amount") %]
<%skonto_in_percent%>[% LxERP.t8("The discount in percent") %]
<%total%>[% LxERP.t8("Amount payable") %]
<%total_wo_skonto%>[% LxERP.t8("Amount payable less discount") %]
<%invtotal%>[% LxERP.t8("Invoice total") %]
<%invtotal_wo_skonto%>[% LxERP.t8("Invoice total less discount") %]
<%currency%>[% LxERP.t8("The selected currency") %]
<%terms_netto%>[% LxERP.t8("The number of days for full payment") %]
<%account_number%>[% LxERP.t8("Your account number") %]
<%bank%>[% LxERP.t8("Your bank") %]
<%bank_code%>[% LxERP.t8("Your bank code") %]
+
+ + + diff --git a/templates/webpages/payment_term/list.html b/templates/webpages/payment_term/list.html new file mode 100644 index 000000000..e26e07f83 --- /dev/null +++ b/templates/webpages/payment_term/list.html @@ -0,0 +1,57 @@ +[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] + +
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + +
+ [% IF !PAYMENT_TERMS.size %] +

+ [%- 'No payment term has been created yet.' | $T8 %] +

+ + [%- ELSE %] + + + + + + + + + + + + [%- FOREACH payment_term = PAYMENT_TERMS %] + + + + + + + + + + [%- END %] +
[%- 'Description' | $T8 %][%- 'Long Description' | $T8 %][%- 'Netto Terms' | $T8 %][%- 'Skonto Terms' | $T8 %][%- 'Skonto' | $T8 %]
+ [%- UNLESS loop.first %] + + [%- END %] + + [%- UNLESS loop.last %] + + [%- END %] + + + [%- HTML.escape(payment_term.description) %] + + [%- HTML.escape(payment_term.description_long) %][%- HTML.escape(payment_term.terms_netto_as_number) %][%- HTML.escape(payment_term.terms_skonto_as_number) %][%- HTML.escape(payment_term.percent_skonto_as_number) %] %
+ [%- END %] + +

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

+
+ + + -- 2.20.1