From a3b8cfa7b754629f39ee42e1cadd88d013666a14 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 14 Jan 2019 14:37:36 +0100 Subject: [PATCH] fixt: #345 Mahnungsersteller im Ausdruck konfigurierbar machen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Im Menüpunkt Mahnungen konfigurieren, kann man nun wählen, ob der aktuelle Mitarbeiter für die Mahnung/Zahlungserinnerung gesetzt ist oder der ursprüngliche Mitarbeiter/Ersteller der Rechnung --- SL/DB/MetaSetup/Default.pm | 1 + SL/DN.pm | 18 +++++++++++++----- locale/de/all | 3 +++ .../defaults_set_dunning_creator.sql | 7 +++++++ templates/webpages/dunning/edit_config.html | 6 ++++++ 5 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 sql/Pg-upgrade2/defaults_set_dunning_creator.sql diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index b948198bc..95aeee2b0 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -60,6 +60,7 @@ __PACKAGE__->meta->columns( dunning_ar => { type => 'integer' }, dunning_ar_amount_fee => { type => 'integer' }, dunning_ar_amount_interest => { type => 'integer' }, + dunning_creator => { type => 'enum', check_in => [ 'current_employee', 'invoice_employee' ], db_type => 'dunning_creator', default => 'current_employee' }, duns => { type => 'text' }, email_journal => { type => 'integer', default => 2 }, expense_accno_id => { type => 'integer' }, diff --git a/SL/DN.pm b/SL/DN.pm index cf800dac5..3ba676733 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -38,6 +38,7 @@ package DN; use SL::Common; use SL::DBUtils; use SL::DB::Default; +use SL::DB::Employee; use SL::GenericTranslations; use SL::IS; use SL::Mailer; @@ -71,9 +72,10 @@ sub get_config { } $query = - qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar + qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar, dunning_creator FROM defaults|; - ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query); + ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}, $form->{dunning_creator}) + = selectrow_query($form, $dbh, $query); $main::lxdebug->leave_sub(); } @@ -135,8 +137,10 @@ sub _save_config { } } - $query = qq|UPDATE defaults SET dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|; - @values = (conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR})); + $query = qq|UPDATE defaults SET dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?, + dunning_creator = ?|; + @values = (conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR}), + $form->{dunning_creator}); do_query($form, $dbh, $query, @values); return 1; @@ -907,7 +911,11 @@ sub print_dunning { push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'path' => "${spool}/$filename", 'name' => $form->get_formname_translation('dunning') . "_${dunning_id}.pdf" }; - $form->get_employee_data('prefix' => 'employee', 'id' => $form->{employee_id}); + my $employee_id = ($::instance_conf->get_dunning_creator eq 'invoice_employee') ? + $form->{employee_id} : + SL::DB::Manager::Employee->current->id; + + $form->get_employee_data('prefix' => 'employee', 'id' => $employee_id); $form->get_employee_data('prefix' => 'salesman', 'id' => $form->{salesman_id}); $form->{attachment_type} = "dunning"; diff --git a/locale/de/all b/locale/de/all index eed975a50..5b90ed66b 100755 --- a/locale/de/all +++ b/locale/de/all @@ -782,6 +782,7 @@ $self->{texts} = { 'Currency names must not be empty.' => 'Währungsnamen dürfen nicht leer sein.', 'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel', 'Current Earnings' => 'Gewinn', + 'Current Employee' => 'Aktuelle Mitarbeiter', 'Current assets account' => 'Konto für Umlaufvermögen', 'Current filter' => 'Aktueller Filter', 'Current picture' => 'Aktuelles Bild', @@ -1084,6 +1085,7 @@ $self->{texts} = { 'Dunned open amount: #1' => 'Angemahnter, offener Betrag: #1', 'Dunning' => 'Mahnung', 'Dunning Amount' => 'gemahnter Betrag', + 'Dunning Creator' => 'Mahnungsersteller', 'Dunning Date' => 'Mahndatum', 'Dunning Date from' => 'Mahnungen von', 'Dunning Description' => 'Mahnstufenbeschreibung', @@ -1225,6 +1227,7 @@ $self->{texts} = { 'Employee' => 'Bearbeiter', 'Employee #1 saved!' => 'Benutzer #1 gespeichert!', 'Employee (database ID)' => 'Bearbeiter (Datenbank-ID)', + 'Employee from the original invoice' => 'Mitarbeiter der Ursprungs-Rechnung', 'Employees' => 'Benutzer', 'Empty selection for warehouse will not be added, even if the old bin is still visible (use back and forth to edit again).' => 'Leere Lager-Auswahl wird ignoriert, selbst wenn noch ein Lagerplatz ausgewählt ist. Alle Daten können durch zurück und vorwärts korrigiert werden.', 'Empty transaction!' => 'Buchung ist leer!', diff --git a/sql/Pg-upgrade2/defaults_set_dunning_creator.sql b/sql/Pg-upgrade2/defaults_set_dunning_creator.sql new file mode 100644 index 000000000..7a89b4302 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_set_dunning_creator.sql @@ -0,0 +1,7 @@ +-- @tag: defaults_set_dunning_creator +-- @description: Ersteller der Mahnungen konfigurierbar machen +-- @depends: release_3_5_3 + +CREATE TYPE dunning_creator AS ENUM ('current_employee', 'invoice_employee'); +ALTER TABLE defaults ADD COLUMN dunning_creator dunning_creator default 'current_employee'; + diff --git a/templates/webpages/dunning/edit_config.html b/templates/webpages/dunning/edit_config.html index 8c29bd083..1cef95f7e 100644 --- a/templates/webpages/dunning/edit_config.html +++ b/templates/webpages/dunning/edit_config.html @@ -1,5 +1,6 @@ [%- USE T8 %] [%- USE HTML %] +[%- USE LxERP -%][%- USE L -%]

[% title %]

@@ -119,6 +120,11 @@ + + [% 'Dunning Creator' | $T8 %] + [% L.select_tag('dunning_creator', [ [ 'current_employee', LxERP.t8('Current Employee') ],[ 'invoice_employee', LxERP.t8('Employee from the original invoice') ] ], default=dunning_creator) %] + + -- 2.20.1