Revision 9d679693
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
183 | 183 |
if ($form->{id} && $form->{orphaned}) { |
184 | 184 |
$query = qq|UPDATE chart SET |
185 | 185 |
accno = ?, description = ?, charttype = ?, |
186 |
gifi_accno = ?, category = ?, link = ?,
|
|
186 |
gifi_accno = ?, category = ?, link = ?,
|
|
187 | 187 |
taxkey_id = ?, |
188 | 188 |
pos_ustva = ?, pos_bwa = ?, pos_bilanz = ?, |
189 | 189 |
pos_eur = ?, new_chart_id = ?, valid_from = ? |
190 |
WHERE id = ?|;
|
|
190 |
WHERE id = ?|;
|
|
191 | 191 |
@values = ($form->{accno}, $form->{description}, $form->{charttype}, |
192 |
$form->{gifi_accno}, $form->{category}, $form->{link},
|
|
193 |
conv_i($taxkey),
|
|
194 |
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
|
|
195 |
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
|
|
196 |
conv_i($form->{new_chart_id}),
|
|
197 |
conv_date($form->{valid_from}),
|
|
198 |
$form->{id});
|
|
192 |
$form->{gifi_accno}, $form->{category}, $form->{link},
|
|
193 |
conv_i($taxkey),
|
|
194 |
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
|
|
195 |
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
|
|
196 |
conv_i($form->{new_chart_id}),
|
|
197 |
conv_date($form->{valid_from}),
|
|
198 |
$form->{id});
|
|
199 | 199 |
|
200 | 200 |
} elsif ($form->{id} && !$form->{new_chart_valid}) { |
201 | 201 |
$query = qq|UPDATE chart SET new_chart_id = ?, valid_from = ? |
202 |
WHERE id = ?|;
|
|
202 |
WHERE id = ?|;
|
|
203 | 203 |
@values = (conv_i($form->{new_chart_id}), conv_date($form->{valid_from}), |
204 |
$form->{id});
|
|
204 |
$form->{id});
|
|
205 | 205 |
} else { |
206 | 206 |
$query = qq|INSERT INTO chart |
207 | 207 |
(accno, description, charttype, |
... | ... | |
211 | 211 |
new_chart_id, valid_from) |
212 | 212 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
213 | 213 |
@values = ($form->{accno}, $form->{description}, $form->{charttype}, |
214 |
$form->{gifi_accno}, $form->{category}, $form->{link},
|
|
215 |
conv_i($taxkey),
|
|
216 |
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
|
|
217 |
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
|
|
218 |
conv_i($form->{new_chart_id}),
|
|
219 |
conv_date($form->{valid_from}));
|
|
214 |
$form->{gifi_accno}, $form->{category}, $form->{link},
|
|
215 |
conv_i($taxkey),
|
|
216 |
conv_i($form->{pos_ustva}), conv_i($form->{pos_bwa}),
|
|
217 |
conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
|
|
218 |
conv_i($form->{new_chart_id}),
|
|
219 |
conv_date($form->{valid_from}));
|
|
220 | 220 |
|
221 | 221 |
} |
222 | 222 |
do_query($form, $dbh, $query, @values); |
... | ... | |
228 | 228 |
qq|(chart_id, tax_id, taxkey_id, pos_ustva, startdate) | . |
229 | 229 |
qq|VALUES ((SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|; |
230 | 230 |
do_query($form, $dbh, $query, |
231 |
$form->{accno}, conv_i($tax_id), conv_i($taxkey),
|
|
232 |
conv_i($form->{pos_ustva}), conv_date($startdate));
|
|
231 |
$form->{accno}, conv_i($tax_id), conv_i($taxkey),
|
|
232 |
conv_i($form->{pos_ustva}), conv_date($startdate));
|
|
233 | 233 |
|
234 | 234 |
} else { |
235 | 235 |
$query = qq|DELETE FROM taxkeys WHERE chart_id = ? AND tax_id = ?|; |
... | ... | |
240 | 240 |
qq|(chart_id, tax_id, taxkey_id, pos_ustva, startdate) | . |
241 | 241 |
qq|VALUES (?, ?, ?, ?, ?)|; |
242 | 242 |
do_query($form, $dbh, $query, |
243 |
$form->{id}, conv_i($tax_id), conv_i($taxkey),
|
|
244 |
conv_i($form->{pos_ustva}), conv_date($startdate));
|
|
243 |
$form->{id}, conv_i($tax_id), conv_i($taxkey),
|
|
244 |
conv_i($form->{pos_ustva}), conv_date($startdate));
|
|
245 | 245 |
} |
246 | 246 |
|
247 | 247 |
# commit |
... | ... | |
310 | 310 |
|
311 | 311 |
my $query = qq|SELECT d.id, d.description, d.role |
312 | 312 |
FROM department d |
313 |
ORDER BY 2|;
|
|
313 |
ORDER BY 2|;
|
|
314 | 314 |
|
315 | 315 |
$sth = $dbh->prepare($query); |
316 | 316 |
$sth->execute || $form->dberror($query); |
317 | 317 |
|
318 |
$form->{ALL} = []; |
|
318 | 319 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
319 | 320 |
push @{ $form->{ALL} }, $ref; |
320 | 321 |
} |
... | ... | |
335 | 336 |
|
336 | 337 |
my $query = qq|SELECT d.description, d.role |
337 | 338 |
FROM department d |
338 |
WHERE d.id = $form->{id}|;
|
|
339 |
WHERE d.id = ?|;
|
|
339 | 340 |
my $sth = $dbh->prepare($query); |
340 |
$sth->execute || $form->dberror($query);
|
|
341 |
$sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
|
|
341 | 342 |
|
342 | 343 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
343 | 344 |
|
... | ... | |
347 | 348 |
|
348 | 349 |
# see if it is in use |
349 | 350 |
$query = qq|SELECT count(*) FROM dpt_trans d |
350 |
WHERE d.department_id = $form->{id}|; |
|
351 |
$sth = $dbh->prepare($query); |
|
352 |
$sth->execute || $form->dberror($query); |
|
351 |
WHERE d.department_id = ?|; |
|
352 |
($form->{orphaned}) = selectrow_query($form, $dbh, $query, $form->{id}); |
|
353 | 353 |
|
354 |
($form->{orphaned}) = $sth->fetchrow_array; |
|
355 | 354 |
$form->{orphaned} = !$form->{orphaned}; |
356 | 355 |
$sth->finish; |
357 | 356 |
|
... | ... | |
368 | 367 |
# connect to database |
369 | 368 |
my $dbh = $form->dbconnect($myconfig); |
370 | 369 |
|
371 |
$form->{description} =~ s/\'/\'\'/g; |
|
372 |
|
|
370 |
my @values = ($form->{description}, $form->{role}); |
|
373 | 371 |
if ($form->{id}) { |
374 | 372 |
$query = qq|UPDATE department SET |
375 |
description = '$form->{description}',
|
|
376 |
role = '$form->{role}'
|
|
377 |
WHERE id = $form->{id}|;
|
|
373 |
description = ?, role = ?
|
|
374 |
WHERE id = ?|;
|
|
375 |
push(@values, $form->{id});
|
|
378 | 376 |
} else { |
379 | 377 |
$query = qq|INSERT INTO department |
380 | 378 |
(description, role) |
381 |
VALUES ('$form->{description}', '$form->{role}')|;
|
|
379 |
VALUES (?, ?)|;
|
|
382 | 380 |
} |
383 |
$dbh->do($query) || $form->dberror($query);
|
|
381 |
do_query($form, $dbh, $query, @values);
|
|
384 | 382 |
|
385 | 383 |
$dbh->disconnect; |
386 | 384 |
|
... | ... | |
396 | 394 |
my $dbh = $form->dbconnect($myconfig); |
397 | 395 |
|
398 | 396 |
$query = qq|DELETE FROM department |
399 |
WHERE id = $form->{id}|;
|
|
400 |
$dbh->do($query) || $form->dberror($query);
|
|
397 |
WHERE id = ?|;
|
|
398 |
do_query($form, $dbh, $query, $form->{id});
|
|
401 | 399 |
|
402 | 400 |
$dbh->disconnect; |
403 | 401 |
|
... | ... | |
414 | 412 |
|
415 | 413 |
my $query = qq|SELECT id, lead |
416 | 414 |
FROM leads |
417 |
ORDER BY 2|;
|
|
415 |
ORDER BY 2|;
|
|
418 | 416 |
|
419 | 417 |
$sth = $dbh->prepare($query); |
420 | 418 |
$sth->execute || $form->dberror($query); |
421 | 419 |
|
420 |
$form->{ALL}; |
|
422 | 421 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
423 | 422 |
push @{ $form->{ALL} }, $ref; |
424 | 423 |
} |
... | ... | |
438 | 437 |
my $dbh = $form->dbconnect($myconfig); |
439 | 438 |
|
440 | 439 |
my $query = |
441 |
qq|SELECT l.id, l.lead |
|
442 |
FROM leads l
|
|
443 |
WHERE l.id = $form->{id}|;
|
|
440 |
qq|SELECT l.id, l.lead | .
|
|
441 |
qq|FROM leads l | .
|
|
442 |
qq|WHERE l.id = ?|;
|
|
444 | 443 |
my $sth = $dbh->prepare($query); |
445 |
$sth->execute || $form->dberror($query);
|
|
444 |
$sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
|
|
446 | 445 |
|
447 | 446 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
448 | 447 |
|
... | ... | |
463 | 462 |
# connect to database |
464 | 463 |
my $dbh = $form->dbconnect($myconfig); |
465 | 464 |
|
466 |
$form->{lead} =~ s/\'/\'\'/g; |
|
467 |
|
|
465 |
my @values = ($form->{description}); |
|
468 | 466 |
# id is the old record |
469 | 467 |
if ($form->{id}) { |
470 | 468 |
$query = qq|UPDATE leads SET |
471 |
lead = '$form->{description}' |
|
472 |
WHERE id = $form->{id}|; |
|
469 |
lead = ? |
|
470 |
WHERE id = ?|; |
|
471 |
puhs(@values, $form->{id}); |
|
473 | 472 |
} else { |
474 | 473 |
$query = qq|INSERT INTO leads |
475 | 474 |
(lead) |
476 |
VALUES ('$form->{description}')|;
|
|
475 |
VALUES (?)|;
|
|
477 | 476 |
} |
478 |
$dbh->do($query) || $form->dberror($query);
|
|
477 |
do_query($form, $dbh, $query, @values);
|
|
479 | 478 |
|
480 | 479 |
$dbh->disconnect; |
481 | 480 |
|
... | ... | |
491 | 490 |
my $dbh = $form->dbconnect($myconfig); |
492 | 491 |
|
493 | 492 |
$query = qq|DELETE FROM leads |
494 |
WHERE id = $form->{id}|;
|
|
495 |
$dbh->do($query) || $form->dberror($query);
|
|
493 |
WHERE id = ?|;
|
|
494 |
do_query($form, $dbh, $query, $form->{id});
|
|
496 | 495 |
|
497 | 496 |
$dbh->disconnect; |
498 | 497 |
|
... | ... | |
509 | 508 |
|
510 | 509 |
my $query = qq|SELECT id, description, discount, customernumberinit, salesman |
511 | 510 |
FROM business |
512 |
ORDER BY 2|;
|
|
511 |
ORDER BY 2|;
|
|
513 | 512 |
|
514 | 513 |
$sth = $dbh->prepare($query); |
515 | 514 |
$sth->execute || $form->dberror($query); |
516 | 515 |
|
516 |
$form->{ALL}; |
|
517 | 517 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
518 | 518 |
push @{ $form->{ALL} }, $ref; |
519 | 519 |
} |
... | ... | |
534 | 534 |
|
535 | 535 |
my $query = |
536 | 536 |
qq|SELECT b.description, b.discount, b.customernumberinit, b.salesman |
537 |
FROM business b
|
|
538 |
WHERE b.id = $form->{id}|;
|
|
537 |
FROM business b |
|
538 |
WHERE b.id = ?|;
|
|
539 | 539 |
my $sth = $dbh->prepare($query); |
540 |
$sth->execute || $form->dberror($query);
|
|
540 |
$sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
|
|
541 | 541 |
|
542 | 542 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
543 | 543 |
|
... | ... | |
558 | 558 |
# connect to database |
559 | 559 |
my $dbh = $form->dbconnect($myconfig); |
560 | 560 |
|
561 |
$form->{description} =~ s/\'/\'\'/g; |
|
562 |
$form->{discount} /= 100; |
|
563 |
$form->{salesman} *= 1; |
|
564 |
|
|
561 |
my @values = ($form->{description}, $form->{discount}, |
|
562 |
$form->{customernumberinit}, $form->{salesman} ? 't' : 'f'); |
|
565 | 563 |
# id is the old record |
566 | 564 |
if ($form->{id}) { |
567 | 565 |
$query = qq|UPDATE business SET |
568 |
description = '$form->{description}', |
|
569 |
discount = $form->{discount}, |
|
570 |
customernumberinit = '$form->{customernumberinit}', |
|
571 |
salesman = '$form->{salesman}' |
|
572 |
WHERE id = $form->{id}|; |
|
566 |
description = ?, |
|
567 |
discount = ?, |
|
568 |
customernumberinit = ?, |
|
569 |
salesman = ? |
|
570 |
WHERE id = ?|; |
|
571 |
push(@values, $form->{id}); |
|
573 | 572 |
} else { |
574 | 573 |
$query = qq|INSERT INTO business |
575 | 574 |
(description, discount, customernumberinit, salesman) |
576 |
VALUES ('$form->{description}', $form->{discount}, '$form->{customernumberinit}', '$form->{salesman}')|;
|
|
575 |
VALUES (?, ?, ?, ?)|;
|
|
577 | 576 |
} |
578 |
$dbh->do($query) || $form->dberror($query);
|
|
577 |
do_query($form, $dbh, $query, @values);
|
|
579 | 578 |
|
580 | 579 |
$dbh->disconnect; |
581 | 580 |
|
... | ... | |
591 | 590 |
my $dbh = $form->dbconnect($myconfig); |
592 | 591 |
|
593 | 592 |
$query = qq|DELETE FROM business |
594 |
WHERE id = $form->{id}|;
|
|
595 |
$dbh->do($query) || $form->dberror($query);
|
|
593 |
WHERE id = ?|;
|
|
594 |
do_query($form, $dbh, $query, $form->{id});
|
|
596 | 595 |
|
597 | 596 |
$dbh->disconnect; |
598 | 597 |
|
... | ... | |
672 | 671 |
"SELECT template_code, " . |
673 | 672 |
" output_numberformat, output_dateformat, output_longdates " . |
674 | 673 |
"FROM language WHERE id = ?"; |
675 |
my @res = $dbh->selectrow_array($query, undef, $id);
|
|
674 |
my @res = selectrow_query($form, $dbh, $query, $id);
|
|
676 | 675 |
$dbh->disconnect; |
677 | 676 |
|
678 | 677 |
$main::lxdebug->leave_sub(); |
... | ... | |
709 | 708 |
" output_numberformat, output_dateformat, output_longdates" . |
710 | 709 |
") VALUES (?, ?, ?, ?, ?, ?)"; |
711 | 710 |
} |
712 |
$dbh->do($query, undef, @values) || |
|
713 |
$form->dberror($query . " (" . join(", ", @values) . ")"); |
|
711 |
do_query($form, $dbh, $query, @values); |
|
714 | 712 |
|
715 | 713 |
$dbh->disconnect; |
716 | 714 |
|
... | ... | |
827 | 825 |
qq|SELECT count(id) = 0 AS orphaned |
828 | 826 |
FROM parts |
829 | 827 |
WHERE buchungsgruppen_id = ?|; |
830 |
($form->{orphaned}) = $dbh->selectrow_array($query, undef, $form->{id});
|
|
828 |
($form->{orphaned}) = selectrow_arra($query, undef, $form->{id});
|
|
831 | 829 |
$form->dberror($query . " ($form->{id})") if ($dbh->err); |
832 | 830 |
} |
833 | 831 |
|
... | ... | |
982 | 980 |
|
983 | 981 |
my $query = qq|SELECT id, printer_description, template_code, printer_command |
984 | 982 |
FROM printers |
985 |
ORDER BY 2|;
|
|
983 |
ORDER BY 2|;
|
|
986 | 984 |
|
987 | 985 |
$sth = $dbh->prepare($query); |
988 | 986 |
$sth->execute || $form->dberror($query); |
... | ... | |
1008 | 1006 |
|
1009 | 1007 |
my $query = |
1010 | 1008 |
qq|SELECT p.printer_description, p.template_code, p.printer_command |
1011 |
FROM printers p
|
|
1012 |
WHERE p.id = $form->{id}|;
|
|
1009 |
FROM printers p |
|
1010 |
WHERE p.id = ?|;
|
|
1013 | 1011 |
my $sth = $dbh->prepare($query); |
1014 |
$sth->execute || $form->dberror($query);
|
|
1012 |
$sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})");
|
|
1015 | 1013 |
|
1016 | 1014 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
1017 | 1015 |
|
... | ... | |
1032 | 1030 |
# connect to database |
1033 | 1031 |
my $dbh = $form->dbconnect($myconfig); |
1034 | 1032 |
|
1035 |
$form->{printer_description} =~ s/\'/\'\'/g; |
|
1036 |
$form->{printer_command} =~ s/\'/\'\'/g; |
|
1037 |
$form->{template_code} =~ s/\'/\'\'/g; |
|
1038 |
|
|
1033 |
my @values = ($form->{printer_description}, |
|
1034 |
$form->{template_code}, |
|
1035 |
$form->{printer_command}); |
|
1039 | 1036 |
|
1040 | 1037 |
# id is the old record |
1041 | 1038 |
if ($form->{id}) { |
1042 | 1039 |
$query = qq|UPDATE printers SET |
1043 |
printer_description = '$form->{printer_description}', |
|
1044 |
template_code = '$form->{template_code}', |
|
1045 |
printer_command = '$form->{printer_command}' |
|
1046 |
WHERE id = $form->{id}|; |
|
1040 |
printer_description = ?, template_code = ?, printer_command = ? |
|
1041 |
WHERE id = ?|; |
|
1042 |
push(@values, $form->{id}); |
|
1047 | 1043 |
} else { |
1048 | 1044 |
$query = qq|INSERT INTO printers |
1049 | 1045 |
(printer_description, template_code, printer_command) |
1050 |
VALUES ('$form->{printer_description}', '$form->{template_code}', '$form->{printer_command}')|;
|
|
1046 |
VALUES (?, ?, ?)|;
|
|
1051 | 1047 |
} |
1052 |
$dbh->do($query) || $form->dberror($query);
|
|
1048 |
do_query($form, $dbh, $query, @values);
|
|
1053 | 1049 |
|
1054 | 1050 |
$dbh->disconnect; |
1055 | 1051 |
|
... | ... | |
1065 | 1061 |
my $dbh = $form->dbconnect($myconfig); |
1066 | 1062 |
|
1067 | 1063 |
$query = qq|DELETE FROM printers |
1068 |
WHERE id = $form->{id}|;
|
|
1069 |
$dbh->do($query) || $form->dberror($query);
|
|
1064 |
WHERE id = ?|;
|
|
1065 |
do_query($form, $dbh, $query, $form->{id});
|
|
1070 | 1066 |
|
1071 | 1067 |
$dbh->disconnect; |
1072 | 1068 |
|
... | ... | |
1120 | 1116 |
qq|WHERE t.payment_terms_id = ? | . |
1121 | 1117 |
qq|UNION | . |
1122 | 1118 |
qq|SELECT l.id AS language_id, NULL AS description_long, | . |
1123 |
qq|l.description AS language | . |
|
1119 |
qq| l.description AS language | .
|
|
1124 | 1120 |
qq|FROM language l|; |
1125 | 1121 |
$sth = $dbh->prepare($query); |
1126 | 1122 |
$sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); |
... | ... | |
1228 | 1224 |
$main::lxdebug->leave_sub(); |
1229 | 1225 |
} |
1230 | 1226 |
|
1231 |
sub sic { |
|
1232 |
$main::lxdebug->enter_sub(); |
|
1233 |
|
|
1234 |
my ($self, $myconfig, $form) = @_; |
|
1235 |
|
|
1236 |
# connect to database |
|
1237 |
my $dbh = $form->dbconnect($myconfig); |
|
1238 |
|
|
1239 |
my $query = qq|SELECT code, sictype, description |
|
1240 |
FROM sic |
|
1241 |
ORDER BY code|; |
|
1242 |
|
|
1243 |
$sth = $dbh->prepare($query); |
|
1244 |
$sth->execute || $form->dberror($query); |
|
1245 |
|
|
1246 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
|
1247 |
push @{ $form->{ALL} }, $ref; |
|
1248 |
} |
|
1249 |
|
|
1250 |
$sth->finish; |
|
1251 |
$dbh->disconnect; |
|
1252 |
|
|
1253 |
$main::lxdebug->leave_sub(); |
|
1254 |
} |
|
1255 |
|
|
1256 |
sub get_sic { |
|
1257 |
$main::lxdebug->enter_sub(); |
|
1258 |
|
|
1259 |
my ($self, $myconfig, $form) = @_; |
|
1260 |
|
|
1261 |
# connect to database |
|
1262 |
my $dbh = $form->dbconnect($myconfig); |
|
1263 |
|
|
1264 |
my $query = qq|SELECT s.code, s.sictype, s.description |
|
1265 |
FROM sic s |
|
1266 |
WHERE s.code = '$form->{code}'|; |
|
1267 |
my $sth = $dbh->prepare($query); |
|
1268 |
$sth->execute || $form->dberror($query); |
|
1269 |
|
|
1270 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
|
1271 |
|
|
1272 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
|
1273 |
|
|
1274 |
$sth->finish; |
|
1275 |
|
|
1276 |
$dbh->disconnect; |
|
1277 |
|
|
1278 |
$main::lxdebug->leave_sub(); |
|
1279 |
} |
|
1280 |
|
|
1281 |
sub save_sic { |
|
1282 |
$main::lxdebug->enter_sub(); |
|
1283 |
|
|
1284 |
my ($self, $myconfig, $form) = @_; |
|
1285 |
|
|
1286 |
# connect to database |
|
1287 |
my $dbh = $form->dbconnect($myconfig); |
|
1288 |
|
|
1289 |
$form->{code} =~ s/\'/\'\'/g; |
|
1290 |
$form->{description} =~ s/\'/\'\'/g; |
|
1291 |
|
|
1292 |
# if there is an id |
|
1293 |
if ($form->{id}) { |
|
1294 |
$query = qq|UPDATE sic SET |
|
1295 |
code = '$form->{code}', |
|
1296 |
sictype = '$form->{sictype}', |
|
1297 |
description = '$form->{description}' |
|
1298 |
WHERE code = '$form->{id}'|; |
|
1299 |
} else { |
|
1300 |
$query = qq|INSERT INTO sic |
|
1301 |
(code, sictype, description) |
|
1302 |
VALUES ('$form->{code}', '$form->{sictype}', '$form->{description}')|; |
|
1303 |
} |
|
1304 |
$dbh->do($query) || $form->dberror($query); |
|
1305 |
|
|
1306 |
$dbh->disconnect; |
|
1307 |
|
|
1308 |
$main::lxdebug->leave_sub(); |
|
1309 |
} |
|
1310 |
|
|
1311 |
sub delete_sic { |
|
1312 |
$main::lxdebug->enter_sub(); |
|
1313 |
|
|
1314 |
my ($self, $myconfig, $form) = @_; |
|
1315 |
|
|
1316 |
# connect to database |
|
1317 |
my $dbh = $form->dbconnect($myconfig); |
|
1318 |
|
|
1319 |
$query = qq|DELETE FROM sic |
|
1320 |
WHERE code = '$form->{code}'|; |
|
1321 |
$dbh->do($query) || $form->dberror($query); |
|
1322 |
|
|
1323 |
$dbh->disconnect; |
|
1324 |
|
|
1325 |
$main::lxdebug->leave_sub(); |
|
1326 |
} |
|
1327 |
|
|
1328 | 1227 |
sub load_template { |
1329 | 1228 |
$main::lxdebug->enter_sub(); |
1330 | 1229 |
|
... | ... | |
1376 | 1275 |
# these defaults are database wide |
1377 | 1276 |
# user specific variables are in myconfig |
1378 | 1277 |
# save defaults |
1379 |
my $query = qq|UPDATE defaults SET
|
|
1380 |
inventory_accno_id =
|
|
1381 |
(SELECT c.id FROM chart c
|
|
1382 |
WHERE c.accno = '$form->{inventory_accno}'),
|
|
1383 |
income_accno_id =
|
|
1384 |
(SELECT c.id FROM chart c
|
|
1385 |
WHERE c.accno = '$form->{income_accno}'),
|
|
1386 |
expense_accno_id =
|
|
1387 |
(SELECT c.id FROM chart c
|
|
1388 |
WHERE c.accno = '$form->{expense_accno}'),
|
|
1389 |
fxgain_accno_id =
|
|
1390 |
(SELECT c.id FROM chart c
|
|
1391 |
WHERE c.accno = '$form->{fxgain_accno}'),
|
|
1392 |
fxloss_accno_id =
|
|
1393 |
(SELECT c.id FROM chart c
|
|
1394 |
WHERE c.accno = '$form->{fxloss_accno}'),
|
|
1395 |
invnumber = '$form->{invnumber}',
|
|
1396 |
cnnumber = '$form->{cnnumber}',
|
|
1397 |
sonumber = '$form->{sonumber}',
|
|
1398 |
ponumber = '$form->{ponumber}',
|
|
1399 |
sqnumber = '$form->{sqnumber}',
|
|
1400 |
rfqnumber = '$form->{rfqnumber}',
|
|
1401 |
customernumber = '$form->{customernumber}',
|
|
1402 |
vendornumber = '$form->{vendornumber}',
|
|
1403 |
articlenumber = '$form->{articlenumber}',
|
|
1404 |
servicenumber = '$form->{servicenumber}',
|
|
1405 |
yearend = '$form->{yearend}',
|
|
1406 |
curr = '$form->{curr}',
|
|
1407 |
businessnumber = '$form->{businessnumber}'
|
|
1408 |
|;
|
|
1409 |
$dbh->do($query) || $form->dberror($query);
|
|
1278 |
my $query = |
|
1279 |
qq|UPDATE defaults SET | .
|
|
1280 |
qq|inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
|
|
1281 |
qq|income_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
|
|
1282 |
qq|expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
|
|
1283 |
qq|fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
|
|
1284 |
qq|fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | .
|
|
1285 |
qq|invnumber = ?, | .
|
|
1286 |
qq|cnnumber = ?, | .
|
|
1287 |
qq|sonumber = ?, | .
|
|
1288 |
qq|ponumber = ?, | .
|
|
1289 |
qq|sqnumber = ?, | .
|
|
1290 |
qq|rfqnumber = ?, | .
|
|
1291 |
qq|customernumber = ?, | .
|
|
1292 |
qq|vendornumber = ?, | .
|
|
1293 |
qq|articlenumber = ?, | .
|
|
1294 |
qq|servicenumber = ?, | .
|
|
1295 |
qq|yearend = ?, | .
|
|
1296 |
qq|curr = ?, | .
|
|
1297 |
qq|businessnumber = ?|;
|
|
1298 |
my @values = ($form->{inventory_accno}, $form->{income_accno},
|
|
1299 |
$form->{expense_accno},
|
|
1300 |
$form->{fxgain_accno}, $form->{fxloss_accno},
|
|
1301 |
$form->{invnumber}, $form->{cnnumber},
|
|
1302 |
$form->{sonumber}, $form->{ponumber},
|
|
1303 |
$form->{sqnumber}, $form->{rfqnumber},
|
|
1304 |
$form->{customernumber}, $form->{vendornumber},
|
|
1305 |
$form->{articlenumber}, $form->{servicenumber},
|
|
1306 |
$form->{yearend}, $form->{curr},
|
|
1307 |
$form->{businessnumber});
|
|
1308 |
do_query($form, $dbh, $query, @values);
|
|
1410 | 1309 |
|
1411 | 1310 |
# update name |
1412 |
my $name = $form->{name}; |
|
1413 |
$name =~ s/\'/\'\'/g; |
|
1414 | 1311 |
$query = qq|UPDATE employee |
1415 |
SET name = '$name' |
|
1416 |
WHERE login = '$form->{login}'|; |
|
1417 |
$dbh->do($query) || $form->dberror($query); |
|
1418 |
|
|
1419 |
# foreach my $item (split(/ /, $form->{taxaccounts})) { |
|
1420 |
# $query = qq|UPDATE tax |
|
1421 |
# SET rate = | . ($form->{$item} / 100) . qq|, |
|
1422 |
# taxnumber = '$form->{"taxnumber_$item"}' |
|
1423 |
# WHERE chart_id = $item|; |
|
1424 |
# $dbh->do($query) || $form->dberror($query); |
|
1425 |
# } |
|
1312 |
SET name = ? |
|
1313 |
WHERE login = ?|; |
|
1314 |
do_query($form, $dbh, $query, $form->{name}, $form->{login}); |
|
1426 | 1315 |
|
1427 | 1316 |
my $rc = $dbh->commit; |
1428 | 1317 |
$dbh->disconnect; |
... | ... | |
1528 | 1417 |
|
1529 | 1418 |
$query = qq|SELECT c.id, c.accno, c.description |
1530 | 1419 |
FROM chart c |
1531 |
WHERE c.category = 'I'
|
|
1532 |
AND c.charttype = 'A'
|
|
1420 |
WHERE c.category = 'I'
|
|
1421 |
AND c.charttype = 'A'
|
|
1533 | 1422 |
ORDER BY c.accno|; |
1534 | 1423 |
$sth = $dbh->prepare($query); |
1535 | 1424 |
$sth->execute || $self->dberror($query); |
... | ... | |
1544 | 1433 |
|
1545 | 1434 |
$query = qq|SELECT c.id, c.accno, c.description |
1546 | 1435 |
FROM chart c |
1547 |
WHERE c.category = 'E'
|
|
1548 |
AND c.charttype = 'A'
|
|
1436 |
WHERE c.category = 'E'
|
|
1437 |
AND c.charttype = 'A'
|
|
1549 | 1438 |
ORDER BY c.accno|; |
1550 | 1439 |
$sth = $dbh->prepare($query); |
1551 | 1440 |
$sth->execute || $self->dberror($query); |
... | ... | |
1562 | 1451 |
$query = qq|SELECT c.id, c.accno, c.description, |
1563 | 1452 |
t.rate * 100 AS rate, t.taxnumber |
1564 | 1453 |
FROM chart c, tax t |
1565 |
WHERE c.id = t.chart_id|;
|
|
1454 |
WHERE c.id = t.chart_id|;
|
|
1566 | 1455 |
|
1567 | 1456 |
$sth = $dbh->prepare($query); |
1568 | 1457 |
$sth->execute || $form->dberror($query); |
... | ... | |
1581 | 1470 |
$main::lxdebug->leave_sub(); |
1582 | 1471 |
} |
1583 | 1472 |
|
1584 |
sub backup { |
|
1585 |
$main::lxdebug->enter_sub(); |
|
1586 |
|
|
1587 |
my ($self, $myconfig, $form, $userspath) = @_; |
|
1588 |
|
|
1589 |
my $mail; |
|
1590 |
my $err; |
|
1591 |
my $boundary = time; |
|
1592 |
my $tmpfile = |
|
1593 |
"$userspath/$boundary.$myconfig->{dbname}-$form->{dbversion}.sql"; |
|
1594 |
my $out = $form->{OUT}; |
|
1595 |
$form->{OUT} = ">$tmpfile"; |
|
1596 |
|
|
1597 |
if ($form->{media} eq 'email') { |
|
1598 |
|
|
1599 |
use SL::Mailer; |
|
1600 |
$mail = new Mailer; |
|
1601 |
|
|
1602 |
$mail->{to} = qq|"$myconfig->{name}" <$myconfig->{email}>|; |
|
1603 |
$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; |
|
1604 |
$mail->{subject} = |
|
1605 |
"Lx-Office Backup / $myconfig->{dbname}-$form->{dbversion}.sql"; |
|
1606 |
@{ $mail->{attachments} } = ($tmpfile); |
|
1607 |
$mail->{version} = $form->{version}; |
|
1608 |
$mail->{fileid} = "$boundary."; |
|
1609 |
|
|
1610 |
$myconfig->{signature} =~ s/\\n/\r\n/g; |
|
1611 |
$mail->{message} = "--\n$myconfig->{signature}"; |
|
1612 |
|
|
1613 |
} |
|
1614 |
|
|
1615 |
open(OUT, "$form->{OUT}") or $form->error("$form->{OUT} : $!"); |
|
1616 |
|
|
1617 |
# get sequences, functions and triggers |
|
1618 |
open(FH, "sql/lx-office.sql") or $form->error("sql/lx-office.sql : $!"); |
|
1619 |
|
|
1620 |
my @sequences = (); |
|
1621 |
my @functions = (); |
|
1622 |
my @triggers = (); |
|
1623 |
my @indices = (); |
|
1624 |
my %tablespecs; |
|
1625 |
|
|
1626 |
my $query = ""; |
|
1627 |
my @quote_chars; |
|
1628 |
|
|
1629 |
while (<FH>) { |
|
1630 |
|
|
1631 |
# Remove DOS and Unix style line endings. |
|
1632 |
s/[\r\n]//g; |
|
1633 |
|
|
1634 |
# ignore comments or empty lines |
|
1635 |
next if /^(--.*|\s+)$/; |
|
1636 |
|
|
1637 |
for (my $i = 0; $i < length($_); $i++) { |
|
1638 |
my $char = substr($_, $i, 1); |
|
1639 |
|
|
1640 |
# Are we inside a string? |
|
1641 |
if (@quote_chars) { |
|
1642 |
if ($char eq $quote_chars[-1]) { |
|
1643 |
pop(@quote_chars); |
|
1644 |
} |
|
1645 |
$query .= $char; |
|
1646 |
|
|
1647 |
} else { |
|
1648 |
if (($char eq "'") || ($char eq "\"")) { |
|
1649 |
push(@quote_chars, $char); |
|
1650 |
|
|
1651 |
} elsif ($char eq ";") { |
|
1652 |
|
|
1653 |
# Query is complete. Check for triggers and functions. |
|
1654 |
if ($query =~ /^create\s+function\s+\"?(\w+)\"?/i) { |
|
1655 |
push(@functions, $query); |
|
1656 |
|
|
1657 |
} elsif ($query =~ /^create\s+trigger\s+\"?(\w+)\"?/i) { |
|
1658 |
push(@triggers, $query); |
|
1659 |
|
|
1660 |
} elsif ($query =~ /^create\s+sequence\s+\"?(\w+)\"?/i) { |
|
1661 |
push(@sequences, $1); |
|
1662 |
|
|
1663 |
} elsif ($query =~ /^create\s+table\s+\"?(\w+)\"?/i) { |
|
1664 |
$tablespecs{$1} = $query; |
|
1665 |
|
|
1666 |
} elsif ($query =~ /^create\s+index\s+\"?(\w+)\"?/i) { |
|
1667 |
push(@indices, $query); |
|
1668 |
|
|
1669 |
} |
|
1670 |
|
|
1671 |
$query = ""; |
|
1672 |
$char = ""; |
|
1673 |
} |
|
1674 |
|
|
1675 |
$query .= $char; |
|
1676 |
} |
|
1677 |
} |
|
1678 |
} |
|
1679 |
close(FH); |
|
1680 |
|
|
1681 |
# connect to database |
|
1682 |
my $dbh = $form->dbconnect($myconfig); |
|
1683 |
|
|
1684 |
# get all the tables |
|
1685 |
my @tables = $dbh->tables('', '', 'customer', '', { noprefix => 0 }); |
|
1686 |
|
|
1687 |
my $today = scalar localtime; |
|
1688 |
|
|
1689 |
$myconfig->{dbhost} = 'localhost' unless $myconfig->{dbhost}; |
|
1690 |
|
|
1691 |
print OUT qq|-- Lx-Office Backup |
|
1692 |
-- Dataset: $myconfig->{dbname} |
|
1693 |
-- Version: $form->{dbversion} |
|
1694 |
-- Host: $myconfig->{dbhost} |
|
1695 |
-- Login: $form->{login} |
|
1696 |
-- User: $myconfig->{name} |
|
1697 |
-- Date: $today |
|
1698 |
-- |
|
1699 |
-- set options |
|
1700 |
$myconfig->{dboptions}; |
|
1701 |
-- |
|
1702 |
|; |
|
1703 |
|
|
1704 |
print OUT "-- DROP Sequences\n"; |
|
1705 |
my $item; |
|
1706 |
foreach $item (@sequences) { |
|
1707 |
print OUT qq|DROP SEQUENCE $item;\n|; |
|
1708 |
} |
|
1709 |
|
|
1710 |
print OUT "-- DROP Triggers\n"; |
|
1711 |
|
|
1712 |
foreach $item (@triggers) { |
|
1713 |
if ($item =~ /^create\s+trigger\s+\"?(\w+)\"?\s+.*on\s+\"?(\w+)\"?\s+/i) { |
|
1714 |
print OUT qq|DROP TRIGGER "$1" ON "$2";\n|; |
|
1715 |
} |
|
1716 |
} |
|
1717 |
|
|
1718 |
print OUT "-- DROP Functions\n"; |
|
1719 |
|
|
1720 |
foreach $item (@functions) { |
|
1721 |
if ($item =~ /^create\s+function\s+\"?(\w+)\"?/i) { |
|
1722 |
print OUT qq|DROP FUNCTION "$1" ();\n|; |
|
1723 |
} |
|
1724 |
} |
|
1725 |
|
|
1726 |
foreach $table (@tables) { |
|
1727 |
if (!($table =~ /^sql_.*/)) { |
|
1728 |
my $query = qq|SELECT * FROM $table|; |
|
1729 |
|
|
1730 |
my $sth = $dbh->prepare($query); |
|
1731 |
$sth->execute || $form->dberror($query); |
|
1732 |
|
|
1733 |
$query = "INSERT INTO $table ("; |
|
1734 |
map { $query .= qq|$sth->{NAME}->[$_],| } |
|
1735 |
(0 .. $sth->{NUM_OF_FIELDS} - 1); |
|
1736 |
chop $query; |
|
1737 |
|
|
1738 |
$query .= ") VALUES"; |
|
1739 |
|
|
1740 |
if ($tablespecs{$table}) { |
|
1741 |
print(OUT "--\n"); |
|
1742 |
print(OUT "DROP TABLE $table;\n"); |
|
1743 |
print(OUT $tablespecs{$table}, ";\n"); |
|
1744 |
} else { |
|
1745 |
print(OUT "--\n"); |
|
1746 |
print(OUT "DELETE FROM $table;\n"); |
|
1747 |
} |
|
1748 |
while (my @arr = $sth->fetchrow_array) { |
|
1749 |
|
|
1750 |
$fields = "("; |
|
1751 |
foreach my $item (@arr) { |
|
1752 |
if (defined $item) { |
|
1753 |
$item =~ s/\'/\'\'/g; |
|
1754 |
$fields .= qq|'$item',|; |
|
1755 |
} else { |
|
1756 |
$fields .= 'NULL,'; |
|
1757 |
} |
|
1758 |
} |
|
1759 |
|
|
1760 |
chop $fields; |
|
1761 |
$fields .= ")"; |
|
1762 |
|
|
1763 |
print OUT qq|$query $fields;\n|; |
|
1764 |
} |
|
1765 |
|
|
1766 |
$sth->finish; |
|
1767 |
} |
|
1768 |
} |
|
1769 |
|
|
1770 |
# create indices, sequences, functions and triggers |
|
1771 |
|
|
1772 |
print(OUT "-- CREATE Indices\n"); |
|
1773 |
map({ print(OUT "$_;\n"); } @indices); |
|
1774 |
|
|
1775 |
print OUT "-- CREATE Sequences\n"; |
|
1776 |
foreach $item (@sequences) { |
|
1777 |
$query = qq|SELECT last_value FROM $item|; |
|
1778 |
$sth = $dbh->prepare($query); |
|
1779 |
$sth->execute || $form->dberror($query); |
|
1780 |
my ($id) = $sth->fetchrow_array; |
|
1781 |
$sth->finish; |
|
1782 |
|
|
1783 |
print OUT qq|-- |
|
1784 |
CREATE SEQUENCE $item START $id; |
|
1785 |
|; |
|
1786 |
} |
|
1787 |
|
|
1788 |
print OUT "-- CREATE Functions\n"; |
|
1789 |
|
|
1790 |
# functions |
|
1791 |
map { print(OUT $_, ";\n"); } @functions; |
|
1792 |
|
|
1793 |
print OUT "-- CREATE Triggers\n"; |
|
1794 |
|
|
1795 |
# triggers |
|
1796 |
map { print(OUT $_, ";\n"); } @triggers; |
|
1797 |
|
|
1798 |
close(OUT); |
|
1799 |
|
|
1800 |
$dbh->disconnect; |
|
1801 |
|
|
1802 |
# compress backup |
|
1803 |
my @args = ("gzip", "$tmpfile"); |
|
1804 |
system(@args) == 0 or $form->error("$args[0] : $?"); |
|
1805 |
|
|
1806 |
$tmpfile .= ".gz"; |
|
1807 |
|
|
1808 |
if ($form->{media} eq 'email') { |
|
1809 |
@{ $mail->{attachments} } = ($tmpfile); |
|
1810 |
$err = $mail->send($out); |
|
1811 |
} |
|
1812 |
|
|
1813 |
if ($form->{media} eq 'file') { |
|
1814 |
|
|
1815 |
open(IN, "$tmpfile") or $form->error("$tmpfile : $!"); |
|
1816 |
open(OUT, ">-") or $form->error("STDOUT : $!"); |
|
1817 |
|
|
1818 |
print OUT qq|Content-Type: application/x-tar-gzip; |
|
1819 |
Content-Disposition: attachment; filename="$myconfig->{dbname}-$form->{dbversion}.sql.gz" |
|
1820 |
|
|
1821 |
|; |
|
1822 |
|
|
1823 |
while (<IN>) { |
|
1824 |
print OUT $_; |
|
1825 |
} |
|
1826 |
|
|
1827 |
close(IN); |
|
1828 |
close(OUT); |
|
1829 |
|
|
1830 |
} |
|
1831 |
|
|
1832 |
unlink "$tmpfile"; |
|
1833 |
|
|
1834 |
$main::lxdebug->leave_sub(); |
|
1835 |
} |
|
1836 |
|
|
1837 | 1473 |
sub closedto { |
1838 | 1474 |
$main::lxdebug->enter_sub(); |
1839 | 1475 |
|
... | ... | |
1861 | 1497 |
|
1862 | 1498 |
my $dbh = $form->dbconnect($myconfig); |
1863 | 1499 |
|
1500 |
my ($query, @values); |
|
1501 |
|
|
1864 | 1502 |
if ($form->{revtrans}) { |
1503 |
$query = qq|UPDATE defaults SET closedto = NULL, revtrans = '1'|; |
|
1865 | 1504 |
|
1866 |
$query = qq|UPDATE defaults SET closedto = NULL, |
|
1867 |
revtrans = '1'|; |
|
1868 | 1505 |
} elsif ($form->{closedto}) { |
1506 |
$query = qq|UPDATE defaults SET closedto = ?, revtrans = '0'|; |
|
1507 |
@values = (conv_date($form->{closedto})); |
|
1869 | 1508 |
|
1870 |
$query = qq|UPDATE defaults SET closedto = '$form->{closedto}', |
|
1871 |
revtrans = '0'|; |
|
1872 | 1509 |
} else { |
1873 |
|
|
1874 |
$query = qq|UPDATE defaults SET closedto = NULL, |
|
1875 |
revtrans = '0'|; |
|
1510 |
$query = qq|UPDATE defaults SET closedto = NULL, revtrans = '0'|; |
|
1876 | 1511 |
} |
1877 | 1512 |
|
1878 | 1513 |
# set close in defaults |
1879 |
$dbh->do($query) || $form->dberror($query);
|
|
1514 |
do_query($form, $dbh, $query, @values);
|
|
1880 | 1515 |
|
1881 | 1516 |
$dbh->disconnect; |
1882 | 1517 |
|
... | ... | |
1987 | 1622 |
|
1988 | 1623 |
my $dbh = $form->dbconnect($myconfig); |
1989 | 1624 |
|
1625 |
map({ $_->{"in_use"} = 0; } values(%{$units})); |
|
1626 |
|
|
1990 | 1627 |
foreach my $unit (values(%{$units})) { |
1991 | 1628 |
my $base_unit = $unit->{"original_base_unit"}; |
1992 | 1629 |
while ($base_unit) { |
1630 |
$units->{$base_unit}->{"in_use"} = 1; |
|
1993 | 1631 |
$units->{$base_unit}->{"DEPENDING_UNITS"} = [] unless ($units->{$base_unit}->{"DEPENDING_UNITS"}); |
1994 | 1632 |
push(@{$units->{$base_unit}->{"DEPENDING_UNITS"}}, $unit->{"name"}); |
1995 | 1633 |
$base_unit = $units->{$base_unit}->{"original_base_unit"}; |
... | ... | |
1997 | 1635 |
} |
1998 | 1636 |
|
1999 | 1637 |
foreach my $unit (values(%{$units})) { |
2000 |
$unit->{"in_use"} = 0; |
|
2001 | 1638 |
map({ $_ = $dbh->quote($_); } @{$unit->{"DEPENDING_UNITS"}}); |
2002 | 1639 |
|
2003 | 1640 |
foreach my $table (qw(parts invoice orderitems)) { |
... | ... | |
2006 | 1643 |
if (0 == scalar(@{$unit->{"DEPENDING_UNITS"}})) { |
2007 | 1644 |
$query .= "= " . $dbh->quote($unit->{"name"}); |
2008 | 1645 |
} else { |
2009 |
$query .= "IN (" . $dbh->quote($unit->{"name"}) . "," . join(",", @{$unit->{"DEPENDING_UNITS"}}) . ")"; |
|
1646 |
$query .= "IN (" . $dbh->quote($unit->{"name"}) . "," . |
|
1647 |
join(",", map({ $dbh->quote($_) } @{$unit->{"DEPENDING_UNITS"}})) . ")"; |
|
2010 | 1648 |
} |
2011 | 1649 |
|
2012 | 1650 |
my ($count) = $dbh->selectrow_array($query); |
bin/mozilla/am.pl | ||
---|---|---|
1110 | 1110 |
|; |
1111 | 1111 |
|
1112 | 1112 |
$discount = |
1113 |
$form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " ");
|
|
1113 |
$form->format_amount(\%myconfig, $ref->{discount} * 100); |
|
1114 | 1114 |
$description = |
1115 | 1115 |
($ref->{salesman}) |
1116 | 1116 |
? "<b>$ref->{description}</b>" |
... | ... | |
1216 | 1216 |
$lxdebug->enter_sub(); |
1217 | 1217 |
|
1218 | 1218 |
$form->isblank("description", $locale->text('Description missing!')); |
1219 |
$form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100; |
|
1219 | 1220 |
AM->save_business(\%myconfig, \%$form); |
1220 | 1221 |
$form->redirect($locale->text('Business saved!')); |
1221 | 1222 |
|
... | ... | |
2416 | 2417 |
$lxdebug->leave_sub(); |
2417 | 2418 |
} |
2418 | 2419 |
|
2419 |
sub add_sic { |
|
2420 |
$lxdebug->enter_sub(); |
|
2421 |
|
|
2422 |
$form->{title} = "Add"; |
|
2423 |
|
|
2424 |
$form->{callback} = |
|
2425 |
"$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}" |
|
2426 |
unless $form->{callback}; |
|
2427 |
|
|
2428 |
&sic_header; |
|
2429 |
&form_footer; |
|
2430 |
|
|
2431 |
$lxdebug->leave_sub(); |
|
2432 |
} |
|
2433 |
|
|
2434 |
sub edit_sic { |
|
2435 |
$lxdebug->enter_sub(); |
|
2436 |
|
|
2437 |
$form->{title} = "Edit"; |
|
2438 |
|
|
2439 |
AM->get_sic(\%myconfig, \%$form); |
|
2440 |
|
|
2441 |
&sic_header; |
|
2442 |
|
|
2443 |
$form->{orphaned} = 1; |
|
2444 |
&form_footer; |
|
2445 |
|
|
2446 |
$lxdebug->leave_sub(); |
|
2447 |
} |
|
2448 |
|
|
2449 |
sub list_sic { |
|
2450 |
$lxdebug->enter_sub(); |
|
2451 |
|
|
2452 |
AM->sic(\%myconfig, \%$form); |
|
2453 |
|
|
2454 |
$form->{callback} = |
|
2455 |
"$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
2456 |
|
|
2457 |
$callback = $form->escape($form->{callback}); |
|
2458 |
|
|
2459 |
$form->{title} = $locale->text('Standard Industrial Codes'); |
|
2460 |
|
|
2461 |
@column_index = qw(code description); |
|
2462 |
|
|
2463 |
$column_header{code} = |
|
2464 |
qq|<th class=listheading>| . $locale->text('Code') . qq|</th>|; |
|
2465 |
$column_header{description} = |
|
2466 |
qq|<th class=listheading>| . $locale->text('Description') . qq|</th>|; |
|
2467 |
|
|
2468 |
$form->header; |
|
2469 |
|
|
2470 |
print qq| |
|
2471 |
<body> |
|
2472 |
|
|
2473 |
<table width=100%> |
|
2474 |
<tr> |
|
2475 |
<th class=listtop>$form->{title}</th> |
|
2476 |
</tr> |
|
2477 |
<tr height="5"></tr> |
|
2478 |
<tr> |
|
2479 |
<td> |
|
2480 |
<table width=100%> |
|
2481 |
<tr class=listheading> |
|
2482 |
|; |
|
2483 |
|
|
2484 |
map { print "$column_header{$_}\n" } @column_index; |
|
2485 |
|
|
2486 |
print qq| |
|
2487 |
</tr> |
|
2488 |
|; |
|
2489 |
|
|
2490 |
foreach $ref (@{ $form->{ALL} }) { |
|
2491 |
|
|
2492 |
$i++; |
|
2493 |
$i %= 2; |
|
2494 |
|
|
2495 |
if ($ref->{sictype} eq 'H') { |
|
2496 |
print qq| |
|
2497 |
<tr valign=top class=listheading> |
|
2498 |
|; |
|
2499 |
$column_data{code} = |
|
2500 |
qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</th>|; |
|
2501 |
$column_data{description} = qq|<th>$ref->{description}</th>|; |
|
2502 |
|
|
2503 |
} else { |
|
2504 |
print qq| |
|
2505 |
<tr valign=top class=listrow$i> |
|
2506 |
|; |
|
2507 |
|
|
2508 |
$column_data{code} = |
|
2509 |
qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}</td>|; |
|
2510 |
$column_data{description} = qq|<td>$ref->{description}</td>|; |
|
2511 |
|
|
2512 |
} |
|
2513 |
|
|
2514 |
map { print "$column_data{$_}\n" } @column_index; |
|
2515 |
|
|
2516 |
print qq| |
|
2517 |
</tr> |
|
2518 |
|; |
|
2519 |
} |
|
2520 |
|
|
2521 |
print qq| |
|
2522 |
</table> |
|
2523 |
</td> |
|
2524 |
</tr> |
|
2525 |
<tr> |
|
2526 |
<td><hr size=3 noshade></td> |
|
2527 |
</tr> |
|
2528 |
</table> |
|
2529 |
|
|
2530 |
<br> |
|
2531 |
<form method=post action=$form->{script}> |
|
2532 |
|
|
2533 |
<input name=callback type=hidden value="$form->{callback}"> |
|
2534 |
|
|
2535 |
<input type=hidden name=type value=sic> |
|
2536 |
|
|
2537 |
<input type=hidden name=path value=$form->{path}> |
|
2538 |
<input type=hidden name=login value=$form->{login}> |
|
2539 |
<input type=hidden name=password value=$form->{password}> |
|
2540 |
|
|
2541 |
<input class=submit type=submit name=action value="| |
|
2542 |
. $locale->text('Add') . qq|"> |
|
2543 |
|
|
2544 |
</form> |
|
2545 |
|
|
2546 |
</body> |
|
2547 |
</html> |
|
2548 |
|; |
|
2549 |
|
|
2550 |
$lxdebug->leave_sub(); |
|
2551 |
} |
|
2552 |
|
|
2553 |
sub sic_header { |
|
2554 |
$lxdebug->enter_sub(); |
|
2555 |
|
|
2556 |
$form->{title} = $locale->text("$form->{title} SIC"); |
|
2557 |
|
|
2558 |
# $locale->text('Add SIC') |
|
2559 |
# $locale->text('Edit SIC') |
|
2560 |
|
|
2561 |
$form->{code} =~ s/\"/"/g; |
|
2562 |
$form->{description} =~ s/\"/"/g; |
|
2563 |
|
|
2564 |
$checked = ($form->{sictype} eq 'H') ? "checked" : ""; |
|
2565 |
|
|
2566 |
$form->header; |
|
2567 |
|
|
2568 |
print qq| |
|
2569 |
<body> |
|
2570 |
|
|
2571 |
<form method=post action=$form->{script}> |
|
2572 |
|
|
2573 |
<input type=hidden name=type value=sic> |
|
2574 |
<input type=hidden name=id value=$form->{code}> |
|
2575 |
|
|
2576 |
<table width=100%> |
|
2577 |
<tr> |
|
2578 |
<th class=listtop colspan=2>$form->{title}</th> |
|
2579 |
</tr> |
|
2580 |
<tr height="5"></tr> |
|
2581 |
<tr> |
|
2582 |
<th align=right>| . $locale->text('Code') . qq|</th> |
|
2583 |
<td><input name=code size=10 value=$form->{code}></td> |
|
2584 |
<tr> |
|
2585 |
<tr> |
|
2586 |
<td></td> |
|
2587 |
<th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> | |
|
2588 |
. $locale->text('Heading') . qq|</th> |
|
2589 |
<tr> |
|
2590 |
<tr> |
|
2591 |
<th align=right>| . $locale->text('Description') . qq|</th> |
|
2592 |
<td><input name=description size=60 value="$form->{description}"></td> |
|
2593 |
</tr> |
|
2594 |
<td colspan=2><hr size=3 noshade></td> |
|
2595 |
</tr> |
|
2596 |
</table> |
|
2597 |
|; |
|
2598 |
|
|
2599 |
$lxdebug->leave_sub(); |
|
2600 |
} |
|
2601 |
|
|
2602 |
sub save_sic { |
|
2603 |
$lxdebug->enter_sub(); |
|
2604 |
|
|
2605 |
$form->isblank("code", $locale->text('Code missing!')); |
|
2606 |
$form->isblank("description", $locale->text('Description missing!')); |
|
2607 |
AM->save_sic(\%myconfig, \%$form); |
|
2608 |
$form->redirect($locale->text('SIC saved!')); |
|
2609 |
|
|
2610 |
$lxdebug->leave_sub(); |
|
2611 |
} |
|
2612 |
|
|
2613 |
sub delete_sic { |
|
2614 |
$lxdebug->enter_sub(); |
|
2615 |
|
|
2616 |
AM->delete_sic(\%myconfig, \%$form); |
|
2617 |
$form->redirect($locale->text('SIC deleted!')); |
|
2618 |
|
|
2619 |
$lxdebug->leave_sub(); |
|
2620 |
} |
|
2621 |
|
|
2622 | 2420 |
sub display_stylesheet { |
2623 | 2421 |
$lxdebug->enter_sub(); |
2624 | 2422 |
|
... | ... | |
3132 | 2930 |
$lxdebug->leave_sub(); |
3133 | 2931 |
} |
3134 | 2932 |
|
3135 |
sub backup { |
|
3136 |
$lxdebug->enter_sub(); |
|
3137 |
|
|
3138 |
if ($form->{media} eq 'email') { |
|
3139 |
$form->error($locale->text('No email address for') . " $myconfig{name}") |
|
3140 |
unless ($myconfig{email}); |
|
3141 |
|
|
3142 |
$form->{OUT} = "$sendmail"; |
|
3143 |
|
|
3144 |
} |
|
3145 |
|
|
3146 |
AM->backup(\%myconfig, \%$form, $userspath); |
|
3147 |
|
|
3148 |
if ($form->{media} eq 'email') { |
|
3149 |
$form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|); |
|
3150 |
} |
|
3151 |
|
|
3152 |
$lxdebug->leave_sub(); |
|
3153 |
} |
|
3154 |
|
|
3155 | 2933 |
sub audit_control { |
3156 | 2934 |
$lxdebug->enter_sub(); |
3157 | 2935 |
|
locale/de/all | ||
---|---|---|
104 | 104 |
'Add Quotation' => 'Angebot erfassen', |
105 | 105 |
'Add RFQ' => 'Neue Preisanfrage', |
106 | 106 |
'Add Request for Quotation' => 'Anfrage erfassen', |
107 |
'Add SIC' => 'SIC erfassen', |
|
108 | 107 |
'Add Sales Invoice' => 'Rechnung erfassen', |
109 | 108 |
'Add Sales Order' => 'Auftrag erfassen', |
110 | 109 |
'Add Service' => 'Dienstleistung erfassen', |
... | ... | |
165 | 164 |
'BOM' => 'St?ckliste', |
166 | 165 |
'BWA' => 'BWA', |
167 | 166 |
'Back' => 'Zurück', |
168 |
'Backup sent to' => 'Eine Sicherungskopie wurde gesandt an', |
|
169 | 167 |
'Balance' => 'Bilanz', |
170 | 168 |
'Balance Sheet' => 'Bilanz', |
171 | 169 |
'Bank' => 'Bank', |
... | ... | |
254 | 252 |
'Close' => '?bernehmen', |
255 | 253 |
'Close Books up to' => 'Die B?cher abschlie?en bis zum', |
256 | 254 |
'Closed' => 'Geschlossen', |
257 |
'Code' => 'kode', |
|
258 |
'Code missing!' => 'kode fehlt!', |
|
259 | 255 |
'Collective Orders only work for orders from one customer!' => 'Sammelauftr?ge funktionieren nur f?r Auftr?ge von einem Kunden!', |
260 | 256 |
'Comment' => 'Kommentar', |
261 | 257 |
'Company' => 'Firma', |
... | ... | |
423 | 419 |
'Edit Purchase Order' => 'Lieferantenaufrag bearbeiten', |
424 | 420 |
'Edit Quotation' => 'Angebot bearbeiten', |
425 | 421 |
'Edit Request for Quotation' => 'Anfrage bearbeiten', |
426 |
'Edit SIC' => 'SIC bearbeiten', |
|
427 | 422 |
'Edit Sales Invoice' => 'Rechnung bearbeiten', |
428 | 423 |
'Edit Sales Order' => 'Auftrag bearbeiten', |
429 | 424 |
'Edit Service' => 'Dienstleistung bearbeiten', |
... | ... | |
672 | 667 |
'No Database Drivers available!' => 'Kein Datenbanktreiber verf?gbar!', |
673 | 668 |
'No Dataset selected!' => 'Keine Datenbank ausgew?hlt!', |
674 | 669 |
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein H?ndler gefunden', |
675 |
'No email address for' => 'Keine eMailaddresse f?r', |
|
676 | 670 |
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.', |
677 | 671 |
'No entries were found which had no unit assigned to them.' => 'Es wurden keine Einträge gefunden, denen keine Einheit zugeordnet war.', |
678 | 672 |
'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.', |
... | ... | |
860 | 854 |
'Revenue' => 'Erl?skonto', |
861 | 855 |
'Revenue Account' => 'Erl?skonto', |
862 | 856 |
'SIC' => 'SIC', |
863 |
'SIC deleted!' => 'SIC gel?scht', |
|
864 |
'SIC saved!' => 'SIC gespeichert', |
|
865 | 857 |
'Sales Invoice' => 'Rechnung', |
866 | 858 |
'Sales Invoices' => 'Kundenrechnung', |
867 | 859 |
'Sales Order' => 'Kundenauftrag', |
... | ... | |
928 | 920 |
'Sold' => 'Verkauft', |
929 | 921 |
'Source' => 'Beleg', |
930 | 922 |
'Spoolfile' => 'Druckdatei', |
931 |
'Standard Industrial Codes' => 'SIC', |
|
932 | 923 |
'Start Dunning Process' => 'Mahnprozess starten', |
933 | 924 |
'Startdate' => 'G?ltig ab', |
934 | 925 |
'Statement' => 'Sammelrechnung', |
locale/de/am | ||
---|---|---|
51 | 51 |
'Add Lead' => 'Kundenquelle erfassen', |
52 | 52 |
'Add Payment Terms' => 'Zahlungskonditionen hinzuf?gen', |
53 | 53 |
'Add Printer' => 'Drucker hinzuf?gen', |
54 |
'Add SIC' => 'SIC erfassen', |
|
55 | 54 |
'Add and edit %s' => '%s hinzufügen und bearbeiten', |
56 | 55 |
'Address' => 'Adresse', |
57 | 56 |
'Article Code' => 'Artikelk?rzel', |
... | ... | |
64 | 63 |
'Aufwand EU o. UStId' => 'Aufwand EU o. UStId', |
65 | 64 |
'Aufwand Inland' => 'Aufwand Inland', |
66 | 65 |
'BWA' => 'BWA', |
67 |
'Backup sent to' => 'Eine Sicherungskopie wurde gesandt an', |
|
68 | 66 |
'Bestandskonto' => 'Bestandskonto', |
69 | 67 |
'Bilanz' => 'Bilanz', |
70 | 68 |
'Books are open' => 'Die B?cher sind ge?ffnet.', |
... | ... | |
83 | 81 |
'Cannot save preferences!' => 'Benutzereinstellungen k?nnen nicht gespeichert werden!', |
84 | 82 |
'Chart of Accounts' => 'Konten?bersicht', |
85 | 83 |
'Close Books up to' => 'Die B?cher abschlie?en bis zum', |
86 |
'Code' => 'kode', |
|
87 |
'Code missing!' => 'kode fehlt!', |
|
88 | 84 |
'Company' => 'Firma', |
89 | 85 |
'Continue' => 'Weiter', |
90 | 86 |
'Cost Center' => 'Kostenstelle', |
... | ... | |
118 | 114 |
'Edit Payment Terms' => 'Zahlungskonditionen bearbeiten', |
119 | 115 |
'Edit Preferences for' => 'Benutzereinstellungen f?r', |
120 | 116 |
'Edit Printer' => 'Drucker bearbeiten', |
121 |
'Edit SIC' => 'SIC bearbeiten', |
|
122 | 117 |
'Edit Template' => 'Vorlage bearbeiten', |
123 | 118 |
'Enforce transaction reversal for all dates' => 'Gegenbuchungen f?r jeden Zeitraum aktualisieren', |
124 | 119 |
'Enter longdescription' => 'Langtext eingeben', |
... | ... | |
172 | 167 |
'No' => 'Nein', |
173 | 168 |
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', |
174 | 169 |
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein H?ndler gefunden', |
175 |
'No email address for' => 'Keine eMailaddresse f?r', |
|
176 | 170 |
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.', |
177 | 171 |
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', |
178 | 172 |
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.', |
... | ... | |
214 | 208 |
'Receivables' => 'Forderungen', |
215 | 209 |
'Revenue' => 'Erl?skonto', |
216 | 210 |
'Revenue Account' => 'Erl?skonto', |
217 |
'SIC deleted!' => 'SIC gel?scht', |
|
218 |
'SIC saved!' => 'SIC gespeichert', |
|
219 | 211 |
'Salesman' => 'Vertreter', |
220 | 212 |
'Save' => 'Speichern', |
221 | 213 |
'Screen' => 'Bildschirm', |
... | ... | |
229 | 221 |
'Signature' => 'Unterschrift', |
230 | 222 |
'Skonto' => 'Skonto', |
231 | 223 |
'Skonto Terms' => 'Zahlungsziel Skonto', |
232 |
'Standard Industrial Codes' => 'SIC', |
|
233 | 224 |
'Steuersatz' => 'Steuersatz', |
234 | 225 |
'Stylesheet' => 'Stilvorlage', |
235 | 226 |
'Tax' => 'Steuer', |
... | ... | |
335 | 326 |
'add_lead' => 'add_lead', |
336 | 327 |
'add_payment' => 'add_payment', |
337 | 328 |
'add_printer' => 'add_printer', |
338 |
'add_sic' => 'add_sic', |
|
339 | 329 |
'add_unit' => 'add_unit', |
340 | 330 |
'audit_control' => 'audit_control', |
341 |
'backup' => 'backup', |
|
342 | 331 |
'buchungsgruppe_header' => 'buchungsgruppe_header', |
343 | 332 |
'build_std_url' => 'build_std_url', |
344 | 333 |
'business_header' => 'business_header', |
... | ... | |
354 | 343 |
'delete_lead' => 'delete_lead', |
355 | 344 |
'delete_payment' => 'delete_payment', |
356 | 345 |
'delete_printer' => 'delete_printer', |
357 |
'delete_sic' => 'delete_sic', |
|
358 | 346 |
'delivery_customer_selection' => 'delivery_customer_selection', |
359 | 347 |
'department_header' => 'department_header', |
360 | 348 |
'display_form' => 'display_form', |
... | ... | |
369 | 357 |
'edit_lead' => 'edit_lead', |
370 | 358 |
'edit_payment' => 'edit_payment', |
371 | 359 |
'edit_printer' => 'edit_printer', |
372 |
'edit_sic' => 'edit_sic', |
|
373 | 360 |
'edit_template' => 'edit_template', |
374 | 361 |
'edit_units' => 'edit_units', |
375 | 362 |
'employee_selection_internal' => 'employee_selection_internal', |
... | ... | |
385 | 372 |
'list_lead' => 'list_lead', |
386 | 373 |
'list_payment' => 'list_payment', |
387 | 374 |
'list_printer' => 'list_printer', |
388 |
'list_sic' => 'list_sic', |
|
389 | 375 |
'part_selection_internal' => 'part_selection_internal', |
390 | 376 |
'payment_header' => 'payment_header', |
391 | 377 |
'printer_header' => 'printer_header', |
... | ... | |
403 | 389 |
'save_payment' => 'save_payment', |
404 | 390 |
'save_preferences' => 'save_preferences', |
405 | 391 |
'save_printer' => 'save_printer', |
406 |
'save_sic' => 'save_sic', |
|
407 | 392 |
'save_template' => 'save_template', |
408 | 393 |
'save_unit' => 'save_unit', |
409 | 394 |
'select_employee' => 'select_employee', |
... | ... | |
412 | 397 |
'select_part_internal' => 'select_part_internal', |
413 | 398 |
'set_longdescription' => 'set_longdescription', |
414 | 399 |
'set_unit_languages' => 'set_unit_languages', |
415 |
'sic_header' => 'sic_header', |
|
416 | 400 |
'swap_buchungsgruppen' => 'swap_buchungsgruppen', |
417 | 401 |
'swap_payment_terms' => 'swap_payment_terms', |
418 | 402 |
'swap_units' => 'swap_units', |
menu.ini | ||
---|---|---|
567 | 567 |
[System--Import CSV--Parts] |
568 | 568 |
module=lxo-import/partsB.php |
569 | 569 |
|
570 |
#[System--SIC] |
|
571 |
#module=menu.pl |
|
572 |
#action=acc_menu |
|
573 |
#target=acc_menu |
|
574 |
#submenu=1 |
|
575 |
# |
|
576 |
#[System--SIC--Add SIC] |
|
577 |
#module=am.pl |
|
578 |
#action=add_sic |
|
579 |
# |
|
580 |
#[System--SIC--List SIC] |
|
581 |
#module=am.pl |
|
582 |
#action=list_sic |
|
583 | 570 |
|
584 | 571 |
[System--HTML Templates] |
585 | 572 |
module=menu.pl |
Auch abrufbar als: Unified diff
Verhinderung von SQL injection durch Verwendung von parametrisierten Abfragen. Entfernen der Verwaltungsfunktionen für "SIC".