Bug in CT: SQL Fehler wenn es keine Ansprechpartner gibt aber CVars für Ansprechpartn...
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 11 May 2012 09:26:49 +0000 (11:26 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 11 May 2012 09:26:49 +0000 (11:26 +0200)
SL/CT.pm

index 8886348..49eb591 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -448,12 +448,14 @@ sub save_customer {
                               'trans_id'  => $form->{id},
                               'variables' => $form,
                               'always_valid' => 1);
-  CVar->save_custom_variables('dbh'       => $dbh,
-                              'module'    => 'Contacts',
-                              'trans_id'  => $form->{cp_id},
-                              'variables' => $form,
-                              'name_prefix'  => 'cp',
-                              'always_valid' => 1);
+  if ($form->{cp_id}) {
+    CVar->save_custom_variables('dbh'       => $dbh,
+                                'module'    => 'Contacts',
+                                'trans_id'  => $form->{cp_id},
+                                'variables' => $form,
+                                'name_prefix'  => 'cp',
+                                'always_valid' => 1);
+  }
 
   my $rc = $dbh->commit();
 
@@ -663,12 +665,14 @@ sub save_vendor {
                               'trans_id'  => $form->{id},
                               'variables' => $form,
                               'always_valid' => 1);
-  CVar->save_custom_variables('dbh'       => $dbh,
-                              'module'    => 'Contacts',
-                              'trans_id'  => $form->{cp_id},
-                              'variables' => $form,
-                              'name_prefix'  => 'cp',
-                              'always_valid' => 1);
+  if ($form->{cp_id}) {
+    CVar->save_custom_variables('dbh'       => $dbh,
+                                'module'    => 'Contacts',
+                                'trans_id'  => $form->{cp_id},
+                                'variables' => $form,
+                                'name_prefix'  => 'cp',
+                                'always_valid' => 1);
+  }
 
   my $rc = $dbh->commit();