Revision dedbaf15
Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
367 | 367 |
do_query( $form, $dbh, $query, @values ); |
368 | 368 |
|
369 | 369 |
$query = undef; |
370 |
my @columns = qw(cp_title cp_givenname cp_name cp_email cp_phone1 cp_phone2 cp_abteilung cp_fax |
|
371 |
cp_mobile1 cp_mobile2 cp_satphone cp_satfax cp_project cp_privatphone cp_privatemail cp_birthday cp_gender |
|
372 |
cp_street cp_zipcode cp_city); |
|
373 |
@values = map { $_ eq 'cp_gender' ? ($form->{$_} eq 'f' ? 'f' : 'm') : $form->{$_} } @columns; |
|
374 |
|
|
370 | 375 |
if ( $form->{cp_id} ) { |
371 |
$query = qq|UPDATE contacts SET | . |
|
372 |
qq|cp_title = ?, | . |
|
373 |
qq|cp_givenname = ?, | . |
|
374 |
qq|cp_name = ?, | . |
|
375 |
qq|cp_email = ?, | . |
|
376 |
qq|cp_phone1 = ?, | . |
|
377 |
qq|cp_phone2 = ?, | . |
|
378 |
qq|cp_abteilung = ?, | . |
|
379 |
qq|cp_fax = ?, | . |
|
380 |
qq|cp_mobile1 = ?, | . |
|
381 |
qq|cp_mobile2 = ?, | . |
|
382 |
qq|cp_satphone = ?, | . |
|
383 |
qq|cp_satfax = ?, | . |
|
384 |
qq|cp_project = ?, | . |
|
385 |
qq|cp_privatphone = ?, | . |
|
386 |
qq|cp_privatemail = ?, | . |
|
387 |
qq|cp_birthday = ?, | . |
|
388 |
qq|cp_gender = ? | . |
|
389 |
qq|WHERE cp_id = ?|; |
|
390 |
@values = ( |
|
391 |
$form->{cp_title}, |
|
392 |
$form->{cp_givenname}, |
|
393 |
$form->{cp_name}, |
|
394 |
$form->{cp_email}, |
|
395 |
$form->{cp_phone1}, |
|
396 |
$form->{cp_phone2}, |
|
397 |
$form->{cp_abteilung}, |
|
398 |
$form->{cp_fax}, |
|
399 |
$form->{cp_mobile1}, |
|
400 |
$form->{cp_mobile2}, |
|
401 |
$form->{cp_satphone}, |
|
402 |
$form->{cp_satfax}, |
|
403 |
$form->{cp_project}, |
|
404 |
$form->{cp_privatphone}, |
|
405 |
$form->{cp_privatemail}, |
|
406 |
$form->{cp_birthday}, |
|
407 |
$form->{cp_gender} eq 'f' ? 'f' : 'm', |
|
408 |
$form->{cp_id} |
|
409 |
); |
|
376 |
$query = qq|UPDATE contacts SET | . join(', ', map { "${_} = ?" } @columns) . qq| WHERE cp_id = ?|; |
|
377 |
push @values, $form->{cp_id}; |
|
378 |
|
|
410 | 379 |
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) { |
411 |
$query = |
|
412 |
qq|INSERT INTO contacts ( cp_cv_id, cp_title, cp_givenname, | . |
|
413 |
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | . |
|
414 |
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | . |
|
415 |
qq| cp_birthday, cp_gender) | . |
|
416 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
|
417 |
@values = ( |
|
418 |
$form->{id}, |
|
419 |
$form->{cp_title}, |
|
420 |
$form->{cp_givenname}, |
|
421 |
$form->{cp_name}, |
|
422 |
$form->{cp_email}, |
|
423 |
$form->{cp_phone1}, |
|
424 |
$form->{cp_phone2}, |
|
425 |
$form->{cp_abteilung}, |
|
426 |
$form->{cp_fax}, |
|
427 |
$form->{cp_mobile1}, |
|
428 |
$form->{cp_mobile2}, |
|
429 |
$form->{cp_satphone}, |
|
430 |
$form->{cp_satfax}, |
|
431 |
$form->{cp_project}, |
|
432 |
$form->{cp_privatphone}, |
|
433 |
$form->{cp_privatemail}, |
|
434 |
$form->{cp_birthday}, |
|
435 |
$form->{cp_gender} eq 'f' ? 'f' : 'm', |
|
436 |
); |
|
380 |
$query = qq|INSERT INTO contacts (| . join(', ', 'cp_cv_id', @columns) . qq|) VALUES (?, | . join(', ', ('?') x scalar(@columns)) . qq|)|; |
|
381 |
unshift @values, $form->{id}; |
|
437 | 382 |
} |
438 | 383 |
do_query( $form, $dbh, $query, @values ) if ($query); |
439 | 384 |
|
Auch abrufbar als: Unified diff
Straße, PLZ, Ort bei Ansprechpersonen bearbeiten
Behebt #1931.