From: Jan Büren Date: Mon, 14 Jan 2019 13:37:36 +0000 (+0100) Subject: fixt: #345 Mahnungsersteller im Ausdruck konfigurierbar machen X-Git-Tag: release-3.5.4~173 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a3b8cfa7b7546;p=kivitendo-erp.git fixt: #345 Mahnungsersteller im Ausdruck konfigurierbar machen 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 --- 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) %] + +