From: Moritz Bunkus Date: Fri, 22 Jun 2012 12:04:39 +0000 (+0200) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~319 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/969e749ceb3bcf8c40dac0e84094de03f4ded9d7?hp=346be50ec6aac3cb58bc2a4c427777b414f07bd1 Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- diff --git a/SL/CT.pm b/SL/CT.pm index 49eb59154..fabc3cac8 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -367,73 +367,18 @@ sub save_customer { do_query( $form, $dbh, $query, @values ); $query = undef; + 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); + @values = map { $_ eq 'cp_gender' ? ($form->{$_} eq 'f' ? 'f' : 'm') : $form->{$_} } @columns; + if ( $form->{cp_id} ) { - $query = qq|UPDATE contacts SET | . - qq|cp_title = ?, | . - qq|cp_givenname = ?, | . - qq|cp_name = ?, | . - qq|cp_email = ?, | . - qq|cp_phone1 = ?, | . - qq|cp_phone2 = ?, | . - qq|cp_abteilung = ?, | . - qq|cp_fax = ?, | . - qq|cp_mobile1 = ?, | . - qq|cp_mobile2 = ?, | . - qq|cp_satphone = ?, | . - qq|cp_satfax = ?, | . - qq|cp_project = ?, | . - qq|cp_privatphone = ?, | . - qq|cp_privatemail = ?, | . - qq|cp_birthday = ?, | . - qq|cp_gender = ? | . - qq|WHERE cp_id = ?|; - @values = ( - $form->{cp_title}, - $form->{cp_givenname}, - $form->{cp_name}, - $form->{cp_email}, - $form->{cp_phone1}, - $form->{cp_phone2}, - $form->{cp_abteilung}, - $form->{cp_fax}, - $form->{cp_mobile1}, - $form->{cp_mobile2}, - $form->{cp_satphone}, - $form->{cp_satfax}, - $form->{cp_project}, - $form->{cp_privatphone}, - $form->{cp_privatemail}, - $form->{cp_birthday}, - $form->{cp_gender} eq 'f' ? 'f' : 'm', - $form->{cp_id} - ); + $query = qq|UPDATE contacts SET | . join(', ', map { "${_} = ?" } @columns) . qq| WHERE cp_id = ?|; + push @values, $form->{cp_id}; + } elsif ( $form->{cp_name} || $form->{cp_givenname} ) { - $query = - qq|INSERT INTO contacts ( cp_cv_id, cp_title, cp_givenname, | . - qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | . - qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | . - qq| cp_birthday, cp_gender) | . - qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; - @values = ( - $form->{id}, - $form->{cp_title}, - $form->{cp_givenname}, - $form->{cp_name}, - $form->{cp_email}, - $form->{cp_phone1}, - $form->{cp_phone2}, - $form->{cp_abteilung}, - $form->{cp_fax}, - $form->{cp_mobile1}, - $form->{cp_mobile2}, - $form->{cp_satphone}, - $form->{cp_satfax}, - $form->{cp_project}, - $form->{cp_privatphone}, - $form->{cp_privatemail}, - $form->{cp_birthday}, - $form->{cp_gender} eq 'f' ? 'f' : 'm', - ); + $query = qq|INSERT INTO contacts (| . join(', ', 'cp_cv_id', @columns) . qq|) VALUES (?, | . join(', ', ('?') x scalar(@columns)) . qq|)|; + unshift @values, $form->{id}; } do_query( $form, $dbh, $query, @values ) if ($query); @@ -1226,7 +1171,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 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 vcname vcnumber); my $order_by = $sortcols{$::form->{sort}} ? $::form->{sort} : 'cp_name'; $::form->{sort} = $order_by; diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 56fad897f..31c70d0cc 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -301,7 +301,7 @@ sub list_contacts { my $cvar_configs = CVar->get_configs('module' => 'Contacts'); my @columns = qw( - cp_id vcname vcnumber cp_name cp_givenname cp_street cp_phone1 cp_phone2 + cp_id vcname vcnumber cp_name cp_givenname cp_street cp_zipcode cp_city cp_phone1 cp_phone2 cp_mobile1 cp_mobile2 cp_email cp_abteilung cp_birthday cp_gender ); @@ -327,6 +327,8 @@ sub list_contacts { 'cp_name' => { 'text' => $::locale->text('Name'), }, 'cp_givenname' => { 'text' => $::locale->text('Given Name'), }, 'cp_street' => { 'text' => $::locale->text('Street'), }, + 'cp_zipcode' => { 'text' => $::locale->text('Zipcode'), }, + 'cp_city' => { 'text' => $::locale->text('City'), }, 'cp_phone1' => { 'text' => $::locale->text('Phone1'), }, 'cp_phone2' => { 'text' => $::locale->text('Phone2'), }, 'cp_mobile1' => { 'text' => $::locale->text('Mobile1'), }, diff --git a/templates/webpages/ct/_contact.html b/templates/webpages/ct/_contact.html index 1c24fe1d4..528ad8ddc 100644 --- a/templates/webpages/ct/_contact.html +++ b/templates/webpages/ct/_contact.html @@ -9,16 +9,15 @@ - - [% 'Gender' | $T8 %] - - - - - + + [% 'Gender' | $T8 %] + + + + [% 'Title' | $T8 %] @@ -46,6 +45,11 @@ + + [% 'E-mail' | $T8 %] + + + [% 'Phone1' | $T8 %] @@ -87,8 +91,16 @@ - [% 'E-mail' | $T8 %] - + [% 'Street' | $T8 %] + + + + + [% 'Zip, City' | $T8 %] + + + + diff --git a/templates/webpages/ct/search_contact.html b/templates/webpages/ct/search_contact.html index be678147a..0f7c12714 100644 --- a/templates/webpages/ct/search_contact.html +++ b/templates/webpages/ct/search_contact.html @@ -73,10 +73,20 @@ + + + + + + + + + +