Revision a4a09b2a
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2453 | 2453 |
return scalar(@{ $self->{name_list} }); |
2454 | 2454 |
} |
2455 | 2455 |
|
2456 |
# the selection sub is used in the AR, AP, IS, IR, DO and OE module |
|
2457 |
# |
|
2458 |
sub all_vc { |
|
2459 |
$main::lxdebug->enter_sub(); |
|
2460 |
|
|
2461 |
my ($self, $myconfig, $table, $module) = @_; |
|
2462 |
|
|
2463 |
my $ref; |
|
2464 |
my $dbh = $self->get_standard_dbh; |
|
2465 |
|
|
2466 |
$table = $table eq "customer" ? "customer" : "vendor"; |
|
2467 |
|
|
2468 |
# build selection list |
|
2469 |
# Hotfix für Bug 1837 - Besser wäre es alte Buchungsbelege |
|
2470 |
# OHNE Auswahlliste (reines Textfeld) zu laden. Hilft aber auch |
|
2471 |
# nicht für veränderbare Belege (oe, do, ...) |
|
2472 |
my $obsolete = $self->{id} ? '' : "WHERE NOT obsolete"; |
|
2473 |
my $query = qq|SELECT count(*) FROM $table $obsolete|; |
|
2474 |
my ($count) = selectrow_query($self, $dbh, $query); |
|
2475 |
|
|
2476 |
if ($count <= $myconfig->{vclimit}) { |
|
2477 |
$query = qq|SELECT id, name, salesman_id |
|
2478 |
FROM $table $obsolete |
|
2479 |
ORDER BY name|; |
|
2480 |
$self->{"all_$table"} = selectall_hashref_query($self, $dbh, $query); |
|
2481 |
} |
|
2482 |
|
|
2483 |
# get self |
|
2484 |
$self->get_employee($dbh); |
|
2485 |
|
|
2486 |
# setup sales contacts |
|
2487 |
$query = qq|SELECT e.id, e.name |
|
2488 |
FROM employee e |
|
2489 |
WHERE (e.sales = '1') AND (NOT e.id = ?) |
|
2490 |
ORDER BY name|; |
|
2491 |
$self->{all_employees} = selectall_hashref_query($self, $dbh, $query, $self->{employee_id}); |
|
2492 |
|
|
2493 |
# this is for self |
|
2494 |
push(@{ $self->{all_employees} }, |
|
2495 |
{ id => $self->{employee_id}, |
|
2496 |
name => $self->{employee} }); |
|
2497 |
|
|
2498 |
# prepare query for departments |
|
2499 |
$query = qq|SELECT id, description |
|
2500 |
FROM department |
|
2501 |
ORDER BY description|; |
|
2502 |
|
|
2503 |
$self->{all_departments} = selectall_hashref_query($self, $dbh, $query); |
|
2504 |
|
|
2505 |
# get languages |
|
2506 |
$query = qq|SELECT id, description |
|
2507 |
FROM language |
|
2508 |
ORDER BY id|; |
|
2509 |
|
|
2510 |
$self->{languages} = selectall_hashref_query($self, $dbh, $query); |
|
2511 |
|
|
2512 |
# get printer |
|
2513 |
$query = qq|SELECT printer_description, id |
|
2514 |
FROM printers |
|
2515 |
ORDER BY printer_description|; |
|
2516 |
|
|
2517 |
$self->{printers} = selectall_hashref_query($self, $dbh, $query); |
|
2518 |
|
|
2519 |
# get payment terms |
|
2520 |
$query = qq|SELECT id, description |
|
2521 |
FROM payment_terms |
|
2522 |
WHERE ( obsolete IS FALSE OR id = ? ) |
|
2523 |
ORDER BY sortkey |; |
|
2524 |
$self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef); |
|
2525 |
|
|
2526 |
$main::lxdebug->leave_sub(); |
|
2527 |
} |
|
2528 |
|
|
2529 | 2456 |
sub new_lastmtime { |
2530 | 2457 |
$main::lxdebug->enter_sub(); |
2531 | 2458 |
|
Auch abrufbar als: Unified diff
Form->all_vc: entfernt, da inzwischen unbenutzt