Revision 1dd6d84a
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
17 | 17 |
use SL::DB::Customer; |
18 | 18 |
use SL::DB::Vendor; |
19 | 19 |
use SL::DB::Business; |
20 |
use SL::DB::ContactTitle; |
|
20 | 21 |
use SL::DB::Employee; |
21 | 22 |
use SL::DB::Greeting; |
22 | 23 |
use SL::DB::Language; |
... | ... | |
164 | 165 |
} |
165 | 166 |
|
166 | 167 |
$self->{cv}->greeting(trim $self->{cv}->greeting); |
167 |
my $save_greeting = $self->{cv}->greeting |
|
168 |
&& $::instance_conf->get_vc_greetings_use_textfield |
|
169 |
&& SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0; |
|
168 |
my $save_greeting = $self->{cv}->greeting |
|
169 |
&& $::instance_conf->get_vc_greetings_use_textfield |
|
170 |
&& SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0; |
|
171 |
|
|
172 |
$self->{contact}->cp_title(trim($self->{contact}->cp_title)); |
|
173 |
my $save_contact_title = $self->{contact}->cp_title |
|
174 |
&& $::instance_conf->get_contact_titles_use_textfield |
|
175 |
&& SL::DB::Manager::ContactTitle->get_all_count(where => [description => $self->{contact}->cp_title]) == 0; |
|
170 | 176 |
|
171 | 177 |
my $db = $self->{cv}->db; |
172 | 178 |
|
... | ... | |
197 | 203 |
|
198 | 204 |
$self->{contact}->cp_cv_id($self->{cv}->id); |
199 | 205 |
if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) { |
206 |
SL::DB::ContactTitle->new(description => $self->{contact}->cp_title)->save if $save_contact_title; |
|
207 |
|
|
200 | 208 |
$self->{contact}->save(cascade => 1); |
201 | 209 |
} |
202 | 210 |
|
... | ... | |
936 | 944 |
unshift @{$self->{all_greetings}}, (SL::DB::Greeting->new(description => $self->{cv}->greeting)); |
937 | 945 |
} |
938 | 946 |
|
939 |
|
|
940 |
$query = |
|
941 |
'SELECT DISTINCT(cp_title) AS title |
|
942 |
FROM contacts |
|
943 |
WHERE cp_title IS NOT NULL AND cp_title != \'\' |
|
944 |
ORDER BY cp_title'; |
|
945 |
$self->{all_titles} = [ |
|
946 |
map( |
|
947 |
{ $_->{title}; } |
|
948 |
selectall_hashref_query($::form, $dbh, $query) |
|
949 |
) |
|
950 |
]; |
|
947 |
$self->{all_contact_titles} = SL::DB::Manager::ContactTitle->get_all_sorted(); |
|
948 |
foreach my $contact (@{ $self->{cv}->contacts }) { |
|
949 |
if ($contact->cp_title && !grep {$contact->cp_title eq $_->description} @{$self->{all_contact_titles}}) { |
|
950 |
unshift @{$self->{all_contact_titles}}, (SL::DB::ContactTitle->new(description => $contact->cp_title)); |
|
951 |
} |
|
952 |
} |
|
951 | 953 |
|
952 | 954 |
$self->{all_currencies} = SL::DB::Manager::Currency->get_all(); |
953 | 955 |
|
Auch abrufbar als: Unified diff
Titel von Ansprechpersonen: Freitext-Feld und/oder Auswahlliste
Der Titel wird entweder nur mit einer Auswahlliste angezeigt oder mit
Freitext-Feld und Auswahlliste. Das ist annähernd das alte Verhalten - im
Freitext-Feld eingegebener Text wird auch in contact_titles gespeichert.
In der Mandantenkonfiguration ist das Freitext-Feld (altes Verhalten)
abschaltbar.
Todo: Fremdschlüsselbeziehung zwischen contacts und contact_titles