194 |
194 |
|
195 |
195 |
my $dbh = $form->dbconnect($myconfig);
|
196 |
196 |
|
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)) ];
|
|
197 |
$query =
|
|
198 |
qq|SELECT DISTINCT(greeting) | .
|
|
199 |
qq|FROM customer | .
|
|
200 |
qq|WHERE greeting ~ '[a-zA-Z]' | .
|
|
201 |
qq|UNION | .
|
|
202 |
qq|SELECT DISTINCT(greeting) | .
|
|
203 |
qq|FROM vendor | .
|
|
204 |
qq|WHERE greeting ~ '[a-zA-Z]' | .
|
|
205 |
qq|ORDER BY greeting|;
|
|
206 |
my %tmp;
|
|
207 |
map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query));
|
|
208 |
$form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ];
|
217 |
209 |
|
218 |
210 |
$query =
|
219 |
211 |
qq|SELECT DISTINCT(cp_title) | .
|
... | ... | |
377 |
369 |
$query = undef;
|
378 |
370 |
if ( $form->{cp_id} ) {
|
379 |
371 |
$query = qq|UPDATE contacts SET | .
|
380 |
|
qq|cp_greeting = ?, | .
|
381 |
372 |
qq|cp_title = ?, | .
|
382 |
373 |
qq|cp_givenname = ?, | .
|
383 |
374 |
qq|cp_name = ?, | .
|
... | ... | |
397 |
388 |
qq|cp_gender = ? | .
|
398 |
389 |
qq|WHERE cp_id = ?|;
|
399 |
390 |
@values = (
|
400 |
|
$form->{cp_greeting},
|
401 |
391 |
$form->{cp_title},
|
402 |
392 |
$form->{cp_givenname},
|
403 |
393 |
$form->{cp_name},
|
... | ... | |
419 |
409 |
);
|
420 |
410 |
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
|
421 |
411 |
$query =
|
422 |
|
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | .
|
|
412 |
qq|INSERT INTO contacts ( cp_cv_id, cp_title, cp_givenname, | .
|
423 |
413 |
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | .
|
424 |
414 |
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | .
|
425 |
415 |
qq| cp_birthday, cp_gender) | .
|
426 |
|
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
|
416 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
427 |
417 |
@values = (
|
428 |
418 |
$form->{id},
|
429 |
|
$form->{cp_greeting},
|
430 |
419 |
$form->{cp_title},
|
431 |
420 |
$form->{cp_givenname},
|
432 |
421 |
$form->{cp_name},
|
... | ... | |
585 |
574 |
$query = undef;
|
586 |
575 |
if ( $form->{cp_id} ) {
|
587 |
576 |
$query = qq|UPDATE contacts SET | .
|
588 |
|
qq|cp_greeting = ?, | .
|
589 |
577 |
qq|cp_title = ?, | .
|
590 |
578 |
qq|cp_givenname = ?, | .
|
591 |
579 |
qq|cp_name = ?, | .
|
... | ... | |
605 |
593 |
qq|cp_gender = ? | .
|
606 |
594 |
qq|WHERE cp_id = ?|;
|
607 |
595 |
@values = (
|
608 |
|
$form->{cp_greeting},
|
609 |
596 |
$form->{cp_title},
|
610 |
597 |
$form->{cp_givenname},
|
611 |
598 |
$form->{cp_name},
|
... | ... | |
627 |
614 |
);
|
628 |
615 |
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
|
629 |
616 |
$query =
|
630 |
|
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | .
|
|
617 |
qq|INSERT INTO contacts ( cp_cv_id, cp_title, cp_givenname, | .
|
631 |
618 |
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | .
|
632 |
619 |
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | .
|
633 |
620 |
qq| cp_birthday, cp_gender) | .
|
634 |
|
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
|
621 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
|
635 |
622 |
@values = (
|
636 |
623 |
$form->{id},
|
637 |
|
$form->{cp_greeting},
|
638 |
624 |
$form->{cp_title},
|
639 |
625 |
$form->{cp_givenname},
|
640 |
626 |
$form->{cp_name},
|
... | ... | |
650 |
636 |
$form->{cp_project},
|
651 |
637 |
$form->{cp_privatphone},
|
652 |
638 |
$form->{cp_privatemail},
|
653 |
|
$form->{cp_birthday}
|
|
639 |
$form->{cp_birthday},
|
|
640 |
$form->{cp_gender}
|
654 |
641 |
);
|
655 |
642 |
}
|
656 |
643 |
do_query($form, $dbh, $query, @values) if ($query);
|
cp_greeting durch cp_gender ersetzt in CT.pm und ct.pl