From: Moritz Bunkus Date: Wed, 6 Sep 2017 13:27:20 +0000 (+0200) Subject: benutzerdefinierte Variablen Ansprechpersonen beim Ausdruck als cp_cvar_… X-Git-Tag: release-3.5.4~830 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=98056ff901abcbbbcf3f0499c3149056628631e8;p=kivitendo-erp.git benutzerdefinierte Variablen Ansprechpersonen beim Ausdruck als cp_cvar_… --- diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 5166ff9b2..ddc5f0696 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -107,6 +107,7 @@ sub flatten_to_form { } _copy_custom_variables($self, $form, 'vc_cvar_', '', $cvar_validity{vc}); + _copy_custom_variables($self->contact, $form, 'cp_cvar_', '') if $self->contact; return $self; } @@ -133,7 +134,7 @@ sub _copy { sub _copy_custom_variables { my ($src, $form, $prefix, $postfix, $cvar_validity) = @_; - my $obj = (any { ref($src) eq $_ } qw(SL::DB::OrderItem SL::DB::DeliveryOrderItem SL::DB::InvoiceItem)) + my $obj = (any { ref($src) eq $_ } qw(SL::DB::OrderItem SL::DB::DeliveryOrderItem SL::DB::InvoiceItem SL::DB::Contact)) ? $src : $src->customervendor; diff --git a/SL/DN.pm b/SL/DN.pm index 51ab07b3c..adb58b711 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -1033,6 +1033,13 @@ sub set_customer_cvars { translation_type => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'), language_id => $form->{language_id}, allow_fallback => 1); + if ($form->{cp_id}) { + $custom_variables = CVar->get_custom_variables(dbh => $form->get_standard_dbh, + module => 'Contacts', + trans_id => $form->{cp_id}); + $form->{"cp_cvar_$_->{name}"} = $_->{value} for @{ $custom_variables }; + } + } 1; diff --git a/SL/IR.pm b/SL/IR.pm index f3f1fd0ca..891f24a6f 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -1447,6 +1447,13 @@ sub vendor_details { 'trans_id' => $form->{vendor_id}); map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables }; + if ($form->{cp_id}) { + $custom_variables = CVar->get_custom_variables(dbh => $dbh, + module => 'Contacts', + trans_id => $form->{cp_id}); + $form->{"cp_cvar_$_->{name}"} = $_->{value} for @{ $custom_variables }; + } + $form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh, 'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'), 'allow_fallback' => 1); diff --git a/SL/IS.pm b/SL/IS.pm index 1df0eb2f9..7ff850039 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -664,6 +664,13 @@ sub customer_details { 'trans_id' => $form->{customer_id}); map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables }; + if ($form->{cp_id}) { + $custom_variables = CVar->get_custom_variables(dbh => $dbh, + module => 'Contacts', + trans_id => $form->{cp_id}); + $form->{"cp_cvar_$_->{name}"} = $_->{value} for @{ $custom_variables }; + } + $form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh, 'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'), 'language_id' => $language_id, diff --git a/doc/dokumentation.xml b/doc/dokumentation.xml index 8b05300c3..1244963de 100644 --- a/doc/dokumentation.xml +++ b/doc/dokumentation.xml @@ -5391,6 +5391,8 @@ systemctl enable kivitendo-task-server.service Die benutzerdefinierten Variablen der Lieferadressen stehen unter einem ähnlichen Namensschema zur Verfügung. Hier lautet der Präfix shiptocvar_. + + Analog stehen die benutzerdefinierten Variablen für Ansprechpersonen mit dem Namenspräfix cp_cvar_ zur Verfügung.