Revision afe8a81b
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
44 | 44 |
use CGI::Ajax; |
45 | 45 |
use SL::DBUtils; |
46 | 46 |
use SL::Menu; |
47 |
use SL::User; |
|
47 | 48 |
use CGI; |
48 | 49 |
|
49 | 50 |
sub _input_to_hash { |
... | ... | |
1377 | 1378 |
$main::lxdebug->leave_sub(); |
1378 | 1379 |
} |
1379 | 1380 |
|
1381 |
sub get_salesman { |
|
1382 |
$main::lxdebug->enter_sub(); |
|
1383 |
|
|
1384 |
my ($self, $myconfig, $salesman_id) = @_; |
|
1385 |
|
|
1386 |
my $dbh = $self->dbconnect($myconfig); |
|
1387 |
|
|
1388 |
my ($login) = |
|
1389 |
selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|, |
|
1390 |
$salesman_id); |
|
1391 |
|
|
1392 |
if ($login) { |
|
1393 |
my $user = new User($main::memberfile, $login); |
|
1394 |
map({ $self->{"salesman_$_"} = $user->{$_}; } |
|
1395 |
qw(address businessnumber co_ustid company duns email fax name |
|
1396 |
taxnumber tel)); |
|
1397 |
$self->{salesman_login} = $login; |
|
1398 |
|
|
1399 |
$self->{salesman_name} = $login |
|
1400 |
if ($self->{salesman_name} eq ""); |
|
1401 |
|
|
1402 |
map({ $self->{"salesman_$_"} =~ s/\\n/\n/g; } qw(address company)); |
|
1403 |
} |
|
1404 |
|
|
1405 |
$dbh->disconnect(); |
|
1406 |
|
|
1407 |
$main::lxdebug->leave_sub(); |
|
1408 |
} |
|
1409 |
|
|
1380 | 1410 |
sub get_duedate { |
1381 | 1411 |
$main::lxdebug->enter_sub(); |
1382 | 1412 |
|
... | ... | |
2498 | 2528 |
return $var; |
2499 | 2529 |
} |
2500 | 2530 |
|
2501 |
sub get_salesman { |
|
2502 |
$main::lxdebug->enter_sub(); |
|
2503 |
|
|
2504 |
my ($self, $myconfig, $salesman) = @_; |
|
2505 |
|
|
2506 |
my $dbh = $self->dbconnect($myconfig); |
|
2507 |
my $query = |
|
2508 |
qq|SELECT id, name FROM customer WHERE (customernumber ilike '%$salesman%' OR name ilike '%$salesman%') AND business_id in (SELECT id from business WHERE salesman)|; |
|
2509 |
my $sth = $dbh->prepare($query); |
|
2510 |
$sth->execute || $self->dberror($query); |
|
2511 |
|
|
2512 |
my $i = 0; |
|
2513 |
while ($ref = $sth->fetchrow_hashref(NAME_lc)) { |
|
2514 |
push(@{ $self->{salesman_list} }, $ref); |
|
2515 |
$i++; |
|
2516 |
} |
|
2517 |
$dbh->commit; |
|
2518 |
$main::lxdebug->leave_sub(); |
|
2519 |
|
|
2520 |
return $i; |
|
2521 |
} |
|
2522 |
|
|
2523 | 2531 |
sub get_partsgroup { |
2524 | 2532 |
$main::lxdebug->enter_sub(); |
2525 | 2533 |
|
Auch abrufbar als: Unified diff
Beim Ausdruck die Variablen für den Verkäufer (salesman_*) füllen.