From 91a32996446e5f7cc637ae2f3eb5188dd5042b31 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Wed, 14 Sep 2016 13:15:30 +0200 Subject: [PATCH] FlattenToForm - Employee-Daten mit integrieren MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Wenn Rechnungen per flatten_to_form gedruckt werden, sollten auch die Druckvorlagenvariablen employee_tel, employee_fax und employee_email im Template zur Verfügung stehen. Diese Daten stehen aber nur in der $::auth. --- SL/DB/Helper/FlattenToForm.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 7a3922c99..cda59e7d6 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -52,6 +52,11 @@ sub flatten_to_form { _copy($self->salesman, $form, 'salesman_', '', 0, map { $_->name } SL::DB::Employee->meta->columns) if _has($self, 'salesman_id'); _copy($self->acceptance_confirmed_by, $form, 'acceptance_confirmed_by_', '', 0, map { $_->name } SL::DB::Employee->meta->columns) if _has($self, 'acceptance_confirmed_by_id'); + if (_has($self, 'employee_id')) { + my $user = User->new(login => $self->employee->login); + $form->{"employee_$_"} = $user->{$_} for qw(tel email fax); + } + $form->{employee} = $self->employee->name if _has($self, 'employee_id'); $form->{language} = $self->language->template_code if _has($self, 'language_id'); $form->{department} = $self->department->description if _has($self, 'department_id'); -- 2.20.1