Revision e09347c8
Von Geoffrey Richardson vor mehr als 15 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
194 | 194 |
|
195 | 195 |
my $dbh = $form->dbconnect($myconfig); |
196 | 196 |
|
197 |
$query = |
|
198 |
qq|SELECT DISTINCT(cp_greeting) | . |
|
199 |
qq|FROM contacts | . |
|
200 |
qq|WHERE cp_greeting ~ '[a-zA-Z]' | . |
|
201 |
qq|ORDER BY cp_greeting|; |
|
202 |
$form->{GREETINGS} = [ selectall_array_query($form, $dbh, $query) ]; |
|
203 |
|
|
204 |
$query = |
|
205 |
qq|SELECT DISTINCT(greeting) | . |
|
206 |
qq|FROM customer | . |
|
207 |
qq|WHERE greeting ~ '[a-zA-Z]' | . |
|
208 |
qq|UNION | . |
|
209 |
qq|SELECT DISTINCT(greeting) | . |
|
210 |
qq|FROM vendor | . |
|
211 |
qq|WHERE greeting ~ '[a-zA-Z]' | . |
|
212 |
qq|ORDER BY greeting|; |
|
213 |
my %tmp; |
|
214 |
map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query)); |
|
215 |
$form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ]; |
|
197 |
# edit: cp_greeting wurde entfernt, wird durch cp_gender ersetzt |
|
198 |
# $query = |
|
199 |
# qq|SELECT DISTINCT(cp_greeting) | . |
|
200 |
# qq|FROM contacts | . |
|
201 |
# qq|WHERE cp_greeting ~ '[a-zA-Z]' | . |
|
202 |
# qq|ORDER BY cp_greeting|; |
|
203 |
# $form->{GREETINGS} = [ selectall_array_query($form, $dbh, $query) ]; |
|
204 |
# |
|
205 |
# $query = |
|
206 |
# qq|SELECT DISTINCT(greeting) | . |
|
207 |
# qq|FROM customer | . |
|
208 |
# qq|WHERE greeting ~ '[a-zA-Z]' | . |
|
209 |
# qq|UNION | . |
|
210 |
# qq|SELECT DISTINCT(greeting) | . |
|
211 |
# qq|FROM vendor | . |
|
212 |
# qq|WHERE greeting ~ '[a-zA-Z]' | . |
|
213 |
# qq|ORDER BY greeting|; |
|
214 |
# my %tmp; |
|
215 |
# map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query)); |
|
216 |
# $form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ]; |
|
216 | 217 |
|
217 | 218 |
$query = |
218 | 219 |
qq|SELECT DISTINCT(cp_title) | . |
... | ... | |
392 | 393 |
qq|cp_project = ?, | . |
393 | 394 |
qq|cp_privatphone = ?, | . |
394 | 395 |
qq|cp_privatemail = ?, | . |
395 |
qq|cp_birthday = ? | . |
|
396 |
qq|cp_birthday = ?, | . |
|
397 |
qq|cp_gender = ? | . |
|
396 | 398 |
qq|WHERE cp_id = ?|; |
397 | 399 |
@values = ( |
398 | 400 |
$form->{cp_greeting}, |
... | ... | |
412 | 414 |
$form->{cp_privatphone}, |
413 | 415 |
$form->{cp_privatemail}, |
414 | 416 |
$form->{cp_birthday}, |
417 |
$form->{cp_gender} eq 'f' ? 'f' : 'm', |
|
415 | 418 |
$form->{cp_id} |
416 | 419 |
); |
417 | 420 |
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) { |
... | ... | |
419 | 422 |
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | . |
420 | 423 |
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | . |
421 | 424 |
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | . |
422 |
qq| cp_birthday) | . |
|
423 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
|
425 |
qq| cp_birthday, cp_gender) | .
|
|
426 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
|
424 | 427 |
@values = ( |
425 | 428 |
$form->{id}, |
426 | 429 |
$form->{cp_greeting}, |
... | ... | |
439 | 442 |
$form->{cp_project}, |
440 | 443 |
$form->{cp_privatphone}, |
441 | 444 |
$form->{cp_privatemail}, |
442 |
$form->{cp_birthday} |
|
445 |
$form->{cp_birthday}, |
|
446 |
$form->{cp_gender} eq 'f' ? 'f' : 'm', |
|
443 | 447 |
); |
444 | 448 |
} |
445 | 449 |
do_query( $form, $dbh, $query, @values ) if ($query); |
... | ... | |
598 | 602 |
qq|cp_privatphone = ?, | . |
599 | 603 |
qq|cp_privatemail = ?, | . |
600 | 604 |
qq|cp_birthday = ? | . |
605 |
qq|cp_gender = ? | . |
|
601 | 606 |
qq|WHERE cp_id = ?|; |
602 | 607 |
@values = ( |
603 | 608 |
$form->{cp_greeting}, |
... | ... | |
617 | 622 |
$form->{cp_privatphone}, |
618 | 623 |
$form->{cp_privatemail}, |
619 | 624 |
$form->{cp_birthday}, |
625 |
$form->{cp_gender} eq 'f' ? 'f' : 'm', |
|
620 | 626 |
$form->{cp_id} |
621 | 627 |
); |
622 | 628 |
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) { |
... | ... | |
624 | 630 |
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | . |
625 | 631 |
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | . |
626 | 632 |
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | . |
627 |
qq| cp_birthday) | . |
|
628 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
|
633 |
qq| cp_birthday, cp_gender) | .
|
|
634 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
|
629 | 635 |
@values = ( |
630 | 636 |
$form->{id}, |
631 | 637 |
$form->{cp_greeting}, |
Auch abrufbar als: Unified diff
Ansprechpartner: cp_greeting durch cp_gender ersetzt
contacts->cp_greeting, was normalerweise fuer Frau/Herr benutzt wird,
wird durch cp_gender (m/f) ersetzt, was den Vorteil hat, dass man je
nach beim Kunden definierter Sprache verschiedene Anreden generieren und
die Anreden zentral verwalten kann.
1. cp_gender wird fuer alle Ansprechpartner auf "m" gesetzt
2. cp_gender wird fuer die Ansprechpartner auf "f" gesetzt, bei denen in
cp_greeting Frau/Mrs/Miss vorkam, bei abweichender weiblicher Deklaration muss
hier also noch nachgepflegt werden
3. alle cp_greeting-Eintraege, die nicht Herr/Frau/Mrs/Miss enthalten
werden nach cp_title verschoben
4. cp_greeting wird geloescht