Revision 761f4a3f
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
9 | 9 |
use SL::DBUtils; |
10 | 10 |
use SL::Helper::Flash; |
11 | 11 |
use SL::Locale::String; |
12 |
use SL::Util qw(trim); |
|
12 | 13 |
use SL::Controller::Helper::GetModels; |
13 | 14 |
use SL::Controller::Helper::ReportGenerator; |
14 | 15 |
use SL::Controller::Helper::ParseFilter; |
... | ... | |
17 | 18 |
use SL::DB::Vendor; |
18 | 19 |
use SL::DB::Business; |
19 | 20 |
use SL::DB::Employee; |
21 |
use SL::DB::Greeting; |
|
20 | 22 |
use SL::DB::Language; |
21 | 23 |
use SL::DB::TaxZone; |
22 | 24 |
use SL::DB::Note; |
... | ... | |
161 | 163 |
$::dispatcher->end_request; |
162 | 164 |
} |
163 | 165 |
|
166 |
$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; |
|
170 |
|
|
164 | 171 |
my $db = $self->{cv}->db; |
165 | 172 |
|
166 | 173 |
$db->with_transaction(sub { |
... | ... | |
186 | 193 |
|
187 | 194 |
$self->{cv}->save(cascade => 1); |
188 | 195 |
|
196 |
SL::DB::Greeting->new(description => $self->{cv}->greeting)->save if $save_greeting; |
|
197 |
|
|
189 | 198 |
$self->{contact}->cp_cv_id($self->{cv}->id); |
190 | 199 |
if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) { |
191 | 200 |
$self->{contact}->save(cascade => 1); |
... | ... | |
922 | 931 |
|
923 | 932 |
$self->{all_employees} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); |
924 | 933 |
|
925 |
$query = |
|
926 |
'SELECT DISTINCT(greeting) |
|
927 |
FROM customer |
|
928 |
WHERE greeting IS NOT NULL AND greeting != \'\' |
|
929 |
UNION |
|
930 |
SELECT DISTINCT(greeting) |
|
931 |
FROM vendor |
|
932 |
WHERE greeting IS NOT NULL AND greeting != \'\' |
|
933 |
ORDER BY greeting'; |
|
934 |
$self->{all_greetings} = [ |
|
935 |
map( |
|
936 |
{ $_->{greeting}; } |
|
937 |
selectall_hashref_query($::form, $dbh, $query) |
|
938 |
) |
|
939 |
]; |
|
934 |
$self->{all_greetings} = SL::DB::Manager::Greeting->get_all_sorted(); |
|
935 |
if ($self->{cv}->id && $self->{cv}->greeting && !grep {$self->{cv}->greeting eq $_->description} @{$self->{all_greetings}}) { |
|
936 |
unshift @{$self->{all_greetings}}, (SL::DB::Greeting->new(description => $self->{cv}->greeting)); |
|
937 |
} |
|
938 |
|
|
940 | 939 |
|
941 | 940 |
$query = |
942 | 941 |
'SELECT DISTINCT(cp_title) AS title |
Auch abrufbar als: Unified diff
Anreden: Kunden-/Lieferantenstamm: Freitext-Feld und/oder Auswahlliste
Die Anrede 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 greetings gespeichert.
In der Mandantenkonfiguration ist das Freitext-Feld (altes Verhalten)
abschaltbar.
Todo: Fremdschlüsselbeziehung zwischen customer/vendor und greetings