benutzerdefinierte Variablen Ansprechpersonen beim Ausdruck als cp_cvar_…
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 Sep 2017 13:27:20 +0000 (15:27 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 6 Sep 2017 13:31:51 +0000 (15:31 +0200)
SL/DB/Helper/FlattenToForm.pm
SL/DN.pm
SL/IR.pm
SL/IS.pm
doc/dokumentation.xml

index 5166ff9..ddc5f06 100644 (file)
@@ -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;
 
index 51ab07b..adb58b7 100644 (file)
--- 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;
index f3f1fd0..891f24a 100644 (file)
--- 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);
index 1df0eb2..7ff8500 100644 (file)
--- 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,
index 8b05300..1244963 100644 (file)
@@ -5391,6 +5391,8 @@ systemctl enable kivitendo-task-server.service</programlisting>
           <para>Die benutzerdefinierten Variablen der Lieferadressen stehen
           unter einem ähnlichen Namensschema zur Verfügung. Hier lautet der
           Präfix <varname>shiptocvar_</varname>.</para>
+
+          <para>Analog stehen die benutzerdefinierten Variablen für Ansprechpersonen mit dem Namenspräfix <varname>cp_cvar_</varname> zur Verfügung.</para>
         </sect3>
       </sect2>