projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
80f722b
)
additional by-otaker searches fixed for the brave new world of usernum, RT#9555
author
ivan
<ivan>
Sun, 15 Aug 2010 07:00:21 +0000
(07:00 +0000)
committer
ivan
<ivan>
Sun, 15 Aug 2010 07:00:21 +0000
(07:00 +0000)
httemplate/elements/select-user.html
patch
|
blob
|
history
httemplate/search/cust_bill_pkg_discount.html
patch
|
blob
|
history
httemplate/search/cust_credit.html
patch
|
blob
|
history
httemplate/search/cust_pkg_discount.html
patch
|
blob
|
history
httemplate/search/report_cust_bill_pkg_discount.html
patch
|
blob
|
history
httemplate/search/report_cust_credit.html
patch
|
blob
|
history
httemplate/search/report_cust_pkg_discount.html
patch
|
blob
|
history
httemplate/search/report_h_cust_pay.html
patch
|
blob
|
history
diff --git
a/httemplate/elements/select-user.html
b/httemplate/elements/select-user.html
index
6264398
..
ec2341b
100644
(file)
--- a/
httemplate/elements/select-user.html
+++ b/
httemplate/elements/select-user.html
@@
-4,7
+4,10
@@
<OPTION VALUE="">all</OPTION>
% }
<OPTION VALUE="">all</OPTION>
% }
-% foreach my $usernum ( keys %{ $opt{'access_user'} } ) {
+% foreach my $usernum (
+% sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} }
+% keys %{ $opt{'access_user'} }
+% ) {
<OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION>
% }
<OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION>
% }
@@
-16,12
+19,9
@@
my %opt = @_;
unless ( $opt{'access_user'} ) {
unless ( $opt{'access_user'} ) {
- tie %{ $opt{'access_user'} }, 'Tie::IxHash';
-
my $sth = dbh->prepare("
SELECT usernum, username FROM access_user
WHERE disabled = '' or disabled IS NULL
my $sth = dbh->prepare("
SELECT usernum, username FROM access_user
WHERE disabled = '' or disabled IS NULL
- ORDER BY username
") or die dbh->errstr;
$sth->execute or die $sth->errstr;
while ( my $row = $sth->fetchrow_arrayref ) {
") or die dbh->errstr;
$sth->execute or die $sth->errstr;
while ( my $row = $sth->fetchrow_arrayref ) {
diff --git
a/httemplate/search/cust_bill_pkg_discount.html
b/httemplate/search/cust_bill_pkg_discount.html
index
088b291
..
b472366
100644
(file)
--- a/
httemplate/search/cust_bill_pkg_discount.html
+++ b/
httemplate/search/cust_bill_pkg_discount.html
@@
-85,6
+85,11
@@
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
push @where, "cust_main.agentnum = $1";
}
+#usernum
+if ( $cgi->param('usernum') =~ /^(\d+)$/ ) {
+ push @where, "cust_pkg_discount.usernum = $1";
+}
+
# #classnum
# # not specified: all classes
# # 0: empty class
# #classnum
# # not specified: all classes
# # 0: empty class
@@
-110,18
+115,25
@@
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
my $count_query = "SELECT COUNT(*), SUM(amount)";
my $count_query = "SELECT COUNT(*), SUM(amount)";
-my $join_cust = ' JOIN cust_bill_pkg USING ( billpkgnum )
- JOIN cust_bill USING ( invnum )
- LEFT JOIN cust_main USING ( custnum ) ';
+my $join_cust_pkg_discount =
+ 'LEFT JOIN cust_pkg_discount USING (pkgdiscountnum)';
+
+my $join_cust =
+ ' JOIN cust_bill_pkg USING ( billpkgnum )
+ JOIN cust_bill USING ( invnum )
+ LEFT JOIN cust_main USING ( custnum ) ';
-my $join_pkg = ' LEFT JOIN cust_pkg USING ( pkgnum )
- LEFT JOIN part_pkg USING ( pkgpart ) ';
- #LEFT JOIN part_pkg AS override
- # ON pkgpart_override = override.pkgpart ';
+my $join_pkg =
+ ' LEFT JOIN cust_pkg ON ( cust_bill_pkg.pkgnum = cust_pkg.pkgnum )
+ LEFT JOIN part_pkg USING ( pkgpart ) ';
+ #LEFT JOIN part_pkg AS override
+ # ON pkgpart_override = override.pkgpart ';
my $where = ' WHERE '. join(' AND ', @where);
my $where = ' WHERE '. join(' AND ', @where);
-$count_query .= " FROM cust_bill_pkg_discount $join_cust $join_pkg $where";
+$count_query .=
+ " FROM cust_bill_pkg_discount $join_cust_pkg_discount $join_cust $join_pkg ".
+ $where;
my @select = (
'cust_bill_pkg_discount.*',
my @select = (
'cust_bill_pkg_discount.*',
@@
-135,7
+147,7
@@
push @select, 'cust_main.custnum',
my $query = {
'table' => 'cust_bill_pkg_discount',
my $query = {
'table' => 'cust_bill_pkg_discount',
- 'addl_from' => "$join_cust $join_pkg",
+ 'addl_from' => "$join_cust
_pkg_discount $join_cust
$join_pkg",
'hashref' => {},
'select' => join(', ', @select ),
'extra_sql' => $where,
'hashref' => {},
'select' => join(', ', @select ),
'extra_sql' => $where,
diff --git
a/httemplate/search/cust_credit.html
b/httemplate/search/cust_credit.html
index
9a14dce
..
ad84721
100755
(executable)
--- a/
httemplate/search/cust_credit.html
+++ b/
httemplate/search/cust_credit.html
@@
-56,8
+56,8
@@
my $title = 'Credit Search Results';
my @search = ();
my @search = ();
-if ( $cgi->param('
otaker') && $cgi->param('otaker') =~ /^([\w\.\-]
+)$/ ) {
- push @search, "cust_credit.
otaker = '$1'
";
+if ( $cgi->param('
usernum') =~ /^(\d
+)$/ ) {
+ push @search, "cust_credit.
usernum = $1
";
}
if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
}
if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
diff --git
a/httemplate/search/cust_pkg_discount.html
b/httemplate/search/cust_pkg_discount.html
index
233345e
..
d70c311
100644
(file)
--- a/
httemplate/search/cust_pkg_discount.html
+++ b/
httemplate/search/cust_pkg_discount.html
@@
-78,9
+78,9
@@
if ( $cgi->param('status') eq 'active' ) {
"; #XXX also end date
}
"; #XXX also end date
}
-#
otaker
-if ( $cgi->param('
otaker') && $cgi->param('otaker') =~ /^([\w\.\-]
+)$/ ) {
- push @where, "cust_pkg_discount.
otaker = '$1'
";
+#
usernum
+if ( $cgi->param('
usernum') =~ /^(\d
+)$/ ) {
+ push @where, "cust_pkg_discount.
usernum = $1
";
}
#agent
}
#agent
diff --git
a/httemplate/search/report_cust_bill_pkg_discount.html
b/httemplate/search/report_cust_bill_pkg_discount.html
index
f1879d4
..
f9ab901
100644
(file)
--- a/
httemplate/search/report_cust_bill_pkg_discount.html
+++ b/
httemplate/search/report_cust_bill_pkg_discount.html
@@
-5,9
+5,9
@@
<TABLE>
<TABLE>
- <% include( '/elements/tr-select-
otak
er.html',
- 'label' => 'Discounts by employee: ',
- '
otakers' => \@otakers
,
+ <% include( '/elements/tr-select-
us
er.html',
+ 'label'
=> 'Discounts by employee: ',
+ '
access_user' => \%access_user
,
)
%>
)
%>
@@
-39,9
+39,12
@@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT
otaker
FROM cust_pkg_discount")
+my $sth = dbh->prepare("SELECT DISTINCT
usernum
FROM cust_pkg_discount")
or die dbh->errstr;
$sth->execute or die $sth->errstr;
or die dbh->errstr;
$sth->execute or die $sth->errstr;
-my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
+my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
+my %access_user =
+ map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
+ @usernum;
</%init>
</%init>
diff --git
a/httemplate/search/report_cust_credit.html
b/httemplate/search/report_cust_credit.html
index
9c719b7
..
c7e5522
100644
(file)
--- a/
httemplate/search/report_cust_credit.html
+++ b/
httemplate/search/report_cust_credit.html
@@
-5,9
+5,9
@@
<TABLE>
<TABLE>
- <% include( '/elements/tr-select-
otak
er.html',
- 'label' => 'Credits by employee: ',
- '
otakers' => \@otakers
,
+ <% include( '/elements/tr-select-
us
er.html',
+ 'label'
=> 'Credits by employee: ',
+ '
access_user' => \%access_user
,
)
%>
)
%>
@@
-40,9
+40,13
@@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT
otaker
FROM cust_credit")
+my $sth = dbh->prepare("SELECT DISTINCT
usernum
FROM cust_credit")
or die dbh->errstr;
$sth->execute or die $sth->errstr;
or die dbh->errstr;
$sth->execute or die $sth->errstr;
-my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
+my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
+my %access_user =
+ map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
+ @usernum;
+
</%init>
</%init>
diff --git
a/httemplate/search/report_cust_pkg_discount.html
b/httemplate/search/report_cust_pkg_discount.html
index
7ebd44f
..
31774c3
100644
(file)
--- a/
httemplate/search/report_cust_pkg_discount.html
+++ b/
httemplate/search/report_cust_pkg_discount.html
@@
-16,9
+16,9
@@
</TD>
</TR>
</TD>
</TR>
- <% include( '/elements/tr-select-
otak
er.html',
- 'label' => 'Discounts by employee: ',
- '
otakers' => \@otakers
,
+ <% include( '/elements/tr-select-
us
er.html',
+ 'label'
=> 'Discounts by employee: ',
+ '
access_user' => \%access_user
,
)
%>
)
%>
@@
-42,9
+42,12
@@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT
otaker
FROM cust_pkg_discount")
+my $sth = dbh->prepare("SELECT DISTINCT
usernum
FROM cust_pkg_discount")
or die dbh->errstr;
$sth->execute or die $sth->errstr;
or die dbh->errstr;
$sth->execute or die $sth->errstr;
-my @otakers = map { $_->[0] } @{$sth->fetchall_arrayref};
+my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
+my %access_user =
+ map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
+ @usernum;
</%init>
</%init>
diff --git
a/httemplate/search/report_h_cust_pay.html
b/httemplate/search/report_h_cust_pay.html
index
fe7c4a9
..
5c7f27a
100644
(file)
--- a/
httemplate/search/report_h_cust_pay.html
+++ b/
httemplate/search/report_h_cust_pay.html
@@
-88,7
+88,7
@@
)
%>
)
%>
- <% include( '/elements/tr-select-
otak
er.html' ) %>
+ <% include( '/elements/tr-select-
us
er.html' ) %>
<TR>
<TD ALIGN="right" VALIGN="center">Payment</TD>
<TR>
<TD ALIGN="right" VALIGN="center">Payment</TD>