Revision 992a539d
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
378 | 378 |
$form->{taxzone_id} *= 1; |
379 | 379 |
$form->{creditlimit} = $form->parse_amount($myconfig, $form->{creditlimit}); |
380 | 380 |
|
381 |
my ($query, $sth); |
|
381 |
my ($query, $sth, $f_id);
|
|
382 | 382 |
|
383 | 383 |
if ($form->{id}) { |
384 |
|
|
385 |
$query = qq|SELECT id FROM customer |
|
386 |
WHERE customernumber = '$form->{customernumber}'|; |
|
387 |
$sth = $dbh->prepare($query); |
|
388 |
$sth->execute || $form->dberror($query); |
|
389 |
(${f_id}) = $sth->fetchrow_array; |
|
390 |
$sth->finish; |
|
391 |
if ((${f_id} ne $form->{id}) and (${f_id} ne "")) { |
|
392 |
|
|
393 |
$main::lxdebug->leave_sub(); |
|
394 |
return 3; |
|
395 |
} |
|
384 | 396 |
$query = qq|DELETE FROM customertax |
385 | 397 |
WHERE customer_id = $form->{id}|; |
386 | 398 |
$dbh->do($query) || $form->dberror($query); |
... | ... | |
389 | 401 |
# WHERE trans_id = $form->{id} AND module = 'CT'|; |
390 | 402 |
# $dbh->do($query) || $form->dberror($query); |
391 | 403 |
} else { |
404 |
|
|
392 | 405 |
my $uid = rand() . time; |
393 | 406 |
|
394 | 407 |
$uid .= $form->{login}; |
395 | 408 |
|
396 | 409 |
$uid = substr($uid, 2, 75); |
410 |
if (!$form->{customernumber} && $form->{business}) { |
|
411 |
$form->{customernumber} = |
|
412 |
$form->update_business($myconfig, $form->{business}); |
|
413 |
} |
|
414 |
if (!$form->{customernumber}) { |
|
415 |
$form->{customernumber} = |
|
416 |
$form->update_defaults($myconfig, "customernumber"); |
|
417 |
} |
|
418 |
|
|
419 |
$query = qq|SELECT c.id FROM customer c |
|
420 |
WHERE c.customernumber = '$form->{customernumber}'|; |
|
421 |
$sth = $dbh->prepare($query); |
|
422 |
$sth->execute || $form->dberror($query); |
|
423 |
(${f_id}) = $sth->fetchrow_array; |
|
424 |
$sth->finish; |
|
425 |
if (${f_id} ne "") { |
|
426 |
$main::lxdebug->leave_sub(); |
|
427 |
return 3; |
|
428 |
} |
|
397 | 429 |
|
398 | 430 |
$query = qq|INSERT INTO customer (name) |
399 | 431 |
VALUES ('$uid')|; |
... | ... | |
406 | 438 |
|
407 | 439 |
($form->{id}) = $sth->fetchrow_array; |
408 | 440 |
$sth->finish; |
409 |
if (!$form->{customernumber} && $form->{business}) { |
|
410 |
$form->{customernumber} = |
|
411 |
$form->update_business($myconfig, $form->{business}); |
|
412 |
} |
|
413 |
if (!$form->{customernumber}) { |
|
414 |
$form->{customernumber} = |
|
415 |
$form->update_defaults($myconfig, "customernumber"); |
|
416 |
} |
|
417 |
|
|
418 | 441 |
} |
419 |
|
|
420 | 442 |
$query = qq|UPDATE customer SET |
421 | 443 |
customernumber = '$form->{customernumber}', |
422 | 444 |
name = '$form->{name}', |
bin/mozilla/ct.pl | ||
---|---|---|
806 | 806 |
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; |
807 | 807 |
$form->{creditlimit} = |
808 | 808 |
$form->format_amount(\%myconfig, $form->{creditlimit}, 0); |
809 |
$form->{discount} = |
|
810 |
$form->format_amount(\%myconfig, $form->{discount}); |
|
809 |
$form->{discount} = $form->format_amount(\%myconfig, $form->{discount}); |
|
811 | 810 |
|
812 | 811 |
if ($myconfig{role} eq 'admin') { |
813 | 812 |
$bcc = qq| |
... | ... | |
1573 | 1572 |
if ($vertreter && $form->{db} eq "customer") { |
1574 | 1573 |
$form->isblank("salesman_id", $locale->text("Salesman missing!")); |
1575 | 1574 |
} |
1576 |
&{"CT::save_$form->{db}"}("", \%myconfig, \%$form); |
|
1577 |
|
|
1575 |
$rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); |
|
1576 |
if ($rc == 3) { |
|
1577 |
$form->error($locale->text('customernumber not unique!')); |
|
1578 |
} |
|
1578 | 1579 |
$form->redirect($locale->text($msg)); |
1579 | 1580 |
|
1580 | 1581 |
$lxdebug->leave_sub(); |
locale/de/all | ||
---|---|---|
1067 | 1067 |
'choice part' => 'Artikel ausw?hlen', |
1068 | 1068 |
'config' => 'Konfiguration', |
1069 | 1069 |
'continue' => 'weiter', |
1070 |
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben', |
|
1070 | 1071 |
'days' => 'Tage', |
1071 | 1072 |
'debug' => 'Debug', |
1072 | 1073 |
'deliverydate' => 'Lieferdatum', |
locale/de/ct | ||
---|---|---|
116 | 116 |
'Year' => 'Jahr', |
117 | 117 |
'Zipcode' => 'PLZ', |
118 | 118 |
'button' => '?', |
119 |
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben', |
|
119 | 120 |
'days' => 'Tage', |
120 | 121 |
's' => 's', |
121 | 122 |
}; |
Auch abrufbar als: Unified diff
Recommit von r1168 von skoehler: Kundennummer laesst sich nur einmal vergegen, nicht ueber Datenbankschema unique bwz. primary key