Revision dcfea9c2
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/BP.pm | ||
---|---|---|
40 | 40 |
|
41 | 41 |
use strict; |
42 | 42 |
|
43 |
sub get_vc { |
|
44 |
$main::lxdebug->enter_sub(); |
|
45 |
|
|
46 |
my ($self, $myconfig, $form) = @_; |
|
47 |
|
|
48 |
# connect to database |
|
49 |
my $dbh = $form->dbconnect($myconfig); |
|
50 |
|
|
51 |
my %arap = (invoice => 'ar', |
|
52 |
sales_order => 'oe', |
|
53 |
purchase_order => 'oe', |
|
54 |
sales_quotation => 'oe', |
|
55 |
request_quotation => 'oe', |
|
56 |
check => 'ap', |
|
57 |
receipt => 'ar'); |
|
58 |
|
|
59 |
my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; |
|
60 |
my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar'; |
|
61 |
|
|
62 |
my $query = |
|
63 |
qq|SELECT count(*) | . |
|
64 |
qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | . |
|
65 |
qq| WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . |
|
66 |
qq| AND s.spoolfile IS NOT NULL) AS total|; |
|
67 |
|
|
68 |
my ($count) = selectrow_query($form, $dbh, $query, $form->{type}); |
|
69 |
|
|
70 |
# build selection list |
|
71 |
if ($count < $myconfig->{vclimit}) { |
|
72 |
$query = |
|
73 |
qq|SELECT DISTINCT ON (vc.id) vc.id, vc.name | . |
|
74 |
qq|FROM $vc vc, $arap_type a, status s | . |
|
75 |
qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . |
|
76 |
qq| AND s.spoolfile IS NOT NULL|; |
|
77 |
|
|
78 |
my $sth = $dbh->prepare($query); |
|
79 |
$sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})"); |
|
80 |
|
|
81 |
$form->{"all_${vc}"} = []; |
|
82 |
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { |
|
83 |
push @{ $form->{"all_${vc}"} }, $ref; |
|
84 |
} |
|
85 |
$sth->finish; |
|
86 |
} |
|
87 |
|
|
88 |
$main::lxdebug->leave_sub(); |
|
89 |
} |
|
90 |
|
|
91 | 43 |
sub payment_accounts { |
92 | 44 |
$main::lxdebug->enter_sub(); |
93 | 45 |
|
... | ... | |
312 | 264 |
} |
313 | 265 |
|
314 | 266 |
1; |
315 |
|
bin/mozilla/bp.pl | ||
---|---|---|
69 | 69 |
|
70 | 70 |
assert_bp_access(); |
71 | 71 |
|
72 |
# setup customer/vendor selection |
|
73 |
BP->get_vc(\%::myconfig, $::form); |
|
74 |
|
|
75 | 72 |
my %label = ( |
76 | 73 |
invoice => { title => $::locale->text('Sales Invoices'), invnumber => 1, ordnumber => 1 }, |
77 | 74 |
sales_order => { title => $::locale->text('Sales Orders'), ordnumber => 1, }, |
templates/webpages/bp/search.html | ||
---|---|---|
9 | 9 |
<table> |
10 | 10 |
<tr> |
11 | 11 |
<th align=right>[% 'Customer' | $T8 %]</th> |
12 |
<td colspan=3> |
|
13 |
[%- IF vc == 'customer' ? all_customer.size : all_vendor.size %] |
|
14 |
[%- INCLUDE 'generic/multibox.html' |
|
15 |
name = vc, |
|
16 |
DATA = vc == 'customer' ? all_customer : all_vendor, |
|
17 |
id_sub = 'vc_keys', |
|
18 |
label_sub = 'vc_keys', |
|
19 |
select = vc_select, |
|
20 |
limit = vclimit, |
|
21 |
show_empty = 1, |
|
22 |
allow_textbox = 1, |
|
23 |
-%] |
|
24 |
[%- ELSE %] |
|
25 |
[% L.input_tag(vc, '', size=35) %] |
|
26 |
[%- END %] |
|
27 |
</td> |
|
12 |
<td colspan=3>[% L.input_tag(vc, '', size=35) %]</td> |
|
28 | 13 |
</tr> |
29 | 14 |
[% IF show_accounts %] |
30 | 15 |
<tr> |
... | ... | |
81 | 66 |
[% L.submit_tag('action', LxERP.t8('Continue')) %] |
82 | 67 |
|
83 | 68 |
</form> |
84 |
|
|
85 |
|
Auch abrufbar als: Unified diff
Warteschlangen-Druck: keine Multibox mehr verwenden