Revision 9d60642b
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2299 | 2299 |
sub _get_customers { |
2300 | 2300 |
$main::lxdebug->enter_sub(); |
2301 | 2301 |
|
2302 |
my ($self, $dbh, $key, $limit) = @_; |
|
2303 |
|
|
2304 |
$key = "all_customers" unless ($key); |
|
2305 |
my $limit_clause = "LIMIT $limit" if $limit; |
|
2302 |
my ($self, $dbh, $key) = @_; |
|
2306 | 2303 |
|
2307 |
my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name $limit_clause|; |
|
2304 |
my $options = ref $key eq 'HASH' ? $key : { key => $key }; |
|
2305 |
$options->{key} ||= "all_customers"; |
|
2306 |
my $limit_clause = "LIMIT $options->{limit}" if $options->{limit}; |
|
2307 |
my $where = $options->{business_is_salesman} ? qq| AND business_id IN (SELECT id FROM business WHERE salesman)| : ''; |
|
2308 | 2308 |
|
2309 |
$self->{$key} = selectall_hashref_query($self, $dbh, $query); |
|
2309 |
my $query = qq|SELECT * FROM customer WHERE NOT obsolete $where ORDER BY name $limit_clause|; |
|
2310 |
$self->{ $options->{key} } = selectall_hashref_query($self, $dbh, $query); |
|
2310 | 2311 |
|
2311 | 2312 |
$main::lxdebug->leave_sub(); |
2312 | 2313 |
} |
... | ... | |
2473 | 2474 |
} |
2474 | 2475 |
|
2475 | 2476 |
if($params{"customers"}) { |
2476 |
if (ref $params{"customers"} eq 'HASH') { |
|
2477 |
$self->_get_customers($dbh, $params{"customers"}{key}, $params{"customers"}{limit}); |
|
2478 |
} else { |
|
2479 |
$self->_get_customers($dbh, $params{"customers"}); |
|
2480 |
} |
|
2477 |
$self->_get_customers($dbh, $params{"customers"}); |
|
2481 | 2478 |
} |
2482 | 2479 |
|
2483 | 2480 |
if($params{"vendors"}) { |
Auch abrufbar als: Unified diff
"Vertreter" sind Kunden mit Kundentyp mit Vertreter-Flag, nicht die Kundentypen selber