From 604765d5156076bdac2e2bf305ec287c6b0a0096 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 14 Jan 2013 14:35:51 +0100 Subject: [PATCH] =?utf8?q?Spalte=20'cp=5Ffunction'=20in=20'cp=5Fposition'?= =?utf8?q?=20umbenennen=20zwecks=20Kompatibilit=C3=A4t=20mit=20CRM?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/CT.pm | 4 ++-- SL/DB/MetaSetup/Contact.pm | 2 +- bin/mozilla/ct.pl | 4 ++-- sql/Pg-upgrade2/contacts_add_cp_function.sql | 5 ----- sql/Pg-upgrade2/contacts_add_cp_position.pl | 18 ++++++++++++++++++ templates/webpages/ct/_contact.html | 2 +- templates/webpages/ct/search_contact.html | 2 +- 7 files changed, 25 insertions(+), 12 deletions(-) delete mode 100644 sql/Pg-upgrade2/contacts_add_cp_function.sql create mode 100644 sql/Pg-upgrade2/contacts_add_cp_position.pl diff --git a/SL/CT.pm b/SL/CT.pm index a19609525..a32486b59 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -551,7 +551,7 @@ 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 cp_function); + cp_street cp_zipcode cp_city cp_position); my @values = map( { if ( $_ eq 'cp_gender' ) { @@ -1123,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 cp_function 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; diff --git a/SL/DB/MetaSetup/Contact.pm b/SL/DB/MetaSetup/Contact.pm index 20dae29d5..8dd8b5b6d 100644 --- a/SL/DB/MetaSetup/Contact.pm +++ b/SL/DB/MetaSetup/Contact.pm @@ -34,7 +34,7 @@ __PACKAGE__->meta->setup( cp_zipcode => { type => 'text' }, cp_city => { type => 'text' }, cp_birthday => { type => 'date' }, - cp_function => { type => 'text' }, + cp_position => { type => 'character', length => 75 }, ], primary_key_columns => [ 'cp_id' ], diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 7c1b2248f..ff7eedef6 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -303,7 +303,7 @@ sub list_contacts { my @columns = qw( 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_function cp_birthday cp_gender + cp_mobile1 cp_mobile2 cp_email cp_abteilung cp_position cp_birthday cp_gender ); my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; @@ -336,7 +336,7 @@ sub list_contacts { 'cp_mobile2' => { 'text' => $::locale->text('Mobile2'), }, 'cp_email' => { 'text' => $::locale->text('E-mail'), }, 'cp_abteilung' => { 'text' => $::locale->text('Department'), }, - 'cp_function' => { 'text' => $::locale->text('Function/position'), }, + 'cp_position' => { 'text' => $::locale->text('Function/position'), }, 'cp_birthday' => { 'text' => $::locale->text('Birthday'), }, 'cp_gender' => { 'text' => $::locale->text('Gender'), }, %column_defs_cvars, diff --git a/sql/Pg-upgrade2/contacts_add_cp_function.sql b/sql/Pg-upgrade2/contacts_add_cp_function.sql deleted file mode 100644 index 571d61e3d..000000000 --- a/sql/Pg-upgrade2/contacts_add_cp_function.sql +++ /dev/null @@ -1,5 +0,0 @@ --- @tag: contacts_add_cp_function --- @description: Feld 'Funktion/Position' zu Kontakten --- @depends: release_3_0_0 --- @charset: utf-8 -ALTER TABLE contacts ADD COLUMN cp_function text; diff --git a/sql/Pg-upgrade2/contacts_add_cp_position.pl b/sql/Pg-upgrade2/contacts_add_cp_position.pl new file mode 100644 index 000000000..bd5470777 --- /dev/null +++ b/sql/Pg-upgrade2/contacts_add_cp_position.pl @@ -0,0 +1,18 @@ +# @tag: contacts_add_cp_position +# @description: Feld 'Funktion/Position' zu Kontakten +# @depends: release_3_0_0 +# @charset: utf-8 + +package contacts_add_cp_position; +use strict; + +die 'This script cannot be run from the command line.' if !$::form; + +my $query = 'ALTER TABLE contacts ADD COLUMN cp_position VARCHAR(75)'; + +if (!$dbh->do($query)) { + $dbh->rollback; + $dbh->begin_work; +} + +1; diff --git a/templates/webpages/ct/_contact.html b/templates/webpages/ct/_contact.html index f6c9b8a5a..d1db2e228 100644 --- a/templates/webpages/ct/_contact.html +++ b/templates/webpages/ct/_contact.html @@ -37,7 +37,7 @@ [% 'Function/position' | $T8 %] - [% L.input_tag('cp_function', cp_function, size=40) %] + [% L.input_tag('cp_position', cp_position, size=40, maxlength=75) %] diff --git a/templates/webpages/ct/search_contact.html b/templates/webpages/ct/search_contact.html index af95c2d00..fe26d47de 100644 --- a/templates/webpages/ct/search_contact.html +++ b/templates/webpages/ct/search_contact.html @@ -113,7 +113,7 @@ - [% L.checkbox_tag('l.cp_function', value='Y', label=LxERP.t8('Function/position'), class='checkbox') %] + [% L.checkbox_tag('l.cp_position', value='Y', label=LxERP.t8('Function/position'), class='checkbox') %] -- 2.20.1