InvoiceItem, OrderItem, DeliveryOrderItem: diverse Fremdschlüssel eingeführt
[kivitendo-erp.git] / SL / CT.pm
index 93c3fce..a32486b 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -551,8 +551,19 @@ sub _save_contact {
 
   my @columns = qw(cp_title cp_givenname cp_name cp_email cp_phone1 cp_phone2 cp_abteilung cp_fax
                    cp_mobile1 cp_mobile2 cp_satphone cp_satfax cp_project cp_privatphone cp_privatemail cp_birthday cp_gender
-                   cp_street cp_zipcode cp_city);
-  my @values  = map { $_ eq 'cp_gender' ? ($form->{$_} eq 'f' ? 'f' : 'm') : $form->{$_} } @columns;
+                   cp_street cp_zipcode cp_city cp_position);
+  my @values  = map(
+    {
+      if ( $_ eq 'cp_gender' ) {
+        $form->{$_} eq 'f' ? 'f' : 'm';
+      } elsif ( $_ eq 'cp_birthday' && $form->{cp_birthday} eq '' ) {
+        undef;
+      } else {
+        $form->{$_};
+      }
+    }
+    @columns
+  );
 
   my ($query, $cp_id);
   if ($form->{cp_id}) {
@@ -1112,7 +1123,7 @@ sub search_contacts {
     'vcnumber'  => 'vcnumber, cp_name, cp_givenname',
     );
 
-  my %sortcols  = map { $_ => 1 } qw(cp_name cp_givenname cp_phone1 cp_phone2 cp_mobile1 cp_email cp_street cp_zipcode cp_city vcname vcnumber);
+  my %sortcols  = map { $_ => 1 } qw(cp_name cp_givenname cp_phone1 cp_phone2 cp_mobile1 cp_email cp_street cp_zipcode cp_city cp_position vcname vcnumber);
 
   my $order_by  = $sortcols{$::form->{sort}} ? $::form->{sort} : 'cp_name';
   $::form->{sort} = $order_by;