Revision 5dd059ff
Von Stephan Köhler vor mehr als 18 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
248 | 248 |
$form->{salesman_id} *= 1; |
249 | 249 |
$form->{creditlimit} = $form->parse_amount($myconfig, $form->{creditlimit}); |
250 | 250 |
|
251 |
my ($query, $sth); |
|
251 |
my ($query, $sth, $f_id);
|
|
252 | 252 |
|
253 | 253 |
if ($form->{id}) { |
254 |
|
|
255 |
$query = qq|SELECT id FROM customer |
|
256 |
WHERE customernumber = '$form->{customernumber}'|; |
|
257 |
$sth = $dbh->prepare($query); |
|
258 |
$sth->execute || $form->dberror($query); |
|
259 |
(${f_id}) = $sth->fetchrow_array; |
|
260 |
$sth->finish; |
|
261 |
if ((${f_id} ne $form->{id}) and (${f_id} ne "")) { |
|
262 |
|
|
263 |
$main::lxdebug->leave_sub(); |
|
264 |
return 3; |
|
265 |
} |
|
254 | 266 |
$query = qq|DELETE FROM customertax |
255 | 267 |
WHERE customer_id = $form->{id}|; |
256 | 268 |
$dbh->do($query) || $form->dberror($query); |
... | ... | |
259 | 271 |
WHERE trans_id = $form->{id}|; |
260 | 272 |
$dbh->do($query) || $form->dberror($query); |
261 | 273 |
} else { |
274 |
|
|
262 | 275 |
my $uid = rand() . time; |
263 | 276 |
|
264 | 277 |
$uid .= $form->{login}; |
265 | 278 |
|
266 | 279 |
$uid = substr($uid, 2, 75); |
280 |
if (!$form->{customernumber} && $form->{business}) { |
|
281 |
$form->{customernumber} = |
|
282 |
$form->update_business($myconfig, $form->{business}); |
|
283 |
} |
|
284 |
if (!$form->{customernumber}) { |
|
285 |
$form->{customernumber} = |
|
286 |
$form->update_defaults($myconfig, "customernumber"); |
|
287 |
} |
|
288 |
|
|
289 |
$query = qq|SELECT c.id FROM customer c |
|
290 |
WHERE c.customernumber = '$form->{customernumber}'|; |
|
291 |
$sth = $dbh->prepare($query); |
|
292 |
$sth->execute || $form->dberror($query); |
|
293 |
(${f_id}) = $sth->fetchrow_array; |
|
294 |
$sth->finish; |
|
295 |
if (${f_id} ne "") { |
|
296 |
$main::lxdebug->leave_sub(); |
|
297 |
return 3; |
|
298 |
} |
|
267 | 299 |
|
268 | 300 |
$query = qq|INSERT INTO customer (name) |
269 | 301 |
VALUES ('$uid')|; |
... | ... | |
276 | 308 |
|
277 | 309 |
($form->{id}) = $sth->fetchrow_array; |
278 | 310 |
$sth->finish; |
279 |
if (!$form->{customernumber} && $form->{business}) { |
|
280 |
$form->{customernumber} = |
|
281 |
$form->update_business($myconfig, $form->{business}); |
|
282 |
} |
|
283 |
if (!$form->{customernumber}) { |
|
284 |
$form->{customernumber} = |
|
285 |
$form->update_defaults($myconfig, "customernumber"); |
|
286 |
} |
|
287 |
|
|
288 | 311 |
} |
289 |
|
|
290 | 312 |
$query = qq|UPDATE customer SET |
291 | 313 |
customernumber = '$form->{customernumber}', |
292 | 314 |
name = '$form->{name}', |
bin/mozilla/ct.pl | ||
---|---|---|
463 | 463 |
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; |
464 | 464 |
$form->{creditlimit} = |
465 | 465 |
$form->format_amount(\%myconfig, $form->{creditlimit}, 0); |
466 |
$form->{discount} = |
|
467 |
$form->format_amount(\%myconfig, $form->{discount}); |
|
466 |
$form->{discount} = $form->format_amount(\%myconfig, $form->{discount}); |
|
468 | 467 |
|
469 | 468 |
if ($myconfig{role} eq 'admin') { |
470 | 469 |
$bcc = qq| |
... | ... | |
977 | 976 |
if ($vertreter && $form->{db} eq "customer") { |
978 | 977 |
$form->isblank("salesman_id", $locale->text("Salesman missing!")); |
979 | 978 |
} |
980 |
&{"CT::save_$form->{db}"}("", \%myconfig, \%$form); |
|
981 |
|
|
979 |
$rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form); |
|
980 |
if ($rc == 3) { |
|
981 |
$form->error($locale->text('customernumber not unique!')); |
|
982 |
} |
|
982 | 983 |
$form->redirect($locale->text($msg)); |
983 | 984 |
|
984 | 985 |
$lxdebug->leave_sub(); |
locale/de/all | ||
---|---|---|
848 | 848 |
'choice part' => 'Artikel ausw?hlen', |
849 | 849 |
'config' => 'Konfiguration', |
850 | 850 |
'continue' => 'weiter', |
851 |
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben', |
|
851 | 852 |
'days' => 'Tage', |
852 | 853 |
'debug' => 'Debug', |
853 | 854 |
'deliverydate' => 'Lieferdatum', |
locale/de/ct | ||
---|---|---|
87 | 87 |
'Vendor saved!' => 'Lieferant gespeichert!', |
88 | 88 |
'Vendors' => 'Lieferanten', |
89 | 89 |
'Zipcode' => 'PLZ', |
90 |
'customernumber not unique!' => 'Die Kundennummer ist schon vergeben', |
|
90 | 91 |
'days' => 'Tage', |
91 | 92 |
's' => 's', |
92 | 93 |
}; |
Auch abrufbar als: Unified diff
Kundennummer laesst sich nur einmal vergegen,
nicht ueber Datenbankschema unique bwz. primary key