From: Sven Schöling Date: Fri, 11 May 2012 09:26:49 +0000 (+0200) Subject: Bug in CT: SQL Fehler wenn es keine Ansprechpartner gibt aber CVars für Ansprechpartn... X-Git-Tag: release-3.0.0beta1~335^2~1^2~2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=77442185c794607d40197877896ae33cea1c511c;p=kivitendo-erp.git Bug in CT: SQL Fehler wenn es keine Ansprechpartner gibt aber CVars für Ansprechpartner angelegt wurden. gibt aber CVars für Ansprechpartner angelegt wurden. --- diff --git a/SL/CT.pm b/SL/CT.pm index 888634894..49eb59154 100644 --- 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();