projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fa1f500
)
fix customer package search (fallout from customer classes) & add "not yet billed...
author
ivan
<ivan>
Wed, 4 Nov 2009 00:53:12 +0000
(
00:53
+0000)
committer
ivan
<ivan>
Wed, 4 Nov 2009 00:53:12 +0000
(
00:53
+0000)
FS/FS/cust_pkg.pm
patch
|
blob
|
history
httemplate/browse/part_pkg.cgi
patch
|
blob
|
history
diff --git
a/FS/FS/cust_pkg.pm
b/FS/FS/cust_pkg.pm
index
e4846ec
..
e195ed8
100644
(file)
--- a/
FS/FS/cust_pkg.pm
+++ b/
FS/FS/cust_pkg.pm
@@
-2221,6
+2221,7
@@
Returns an SQL expression identifying active packages.
sub active_sql { "
". $_[0]->recurring_sql(). "
sub active_sql { "
". $_[0]->recurring_sql(). "
+ AND cust_pkg.setup IS NOT NULL AND cust_pkg.setup != 0
AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )
AND ( cust_pkg.susp IS NULL OR cust_pkg.susp = 0 )
"; }
AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )
AND ( cust_pkg.susp IS NULL OR cust_pkg.susp = 0 )
"; }
@@
-2384,8
+2385,8
@@
sub search_sql {
push @where, FS::cust_pkg->active_sql();
push @where, FS::cust_pkg->active_sql();
- } elsif ( $params->{'magic'}
eq 'not yet billed'
- || $params->{'status'}
eq 'not yet billed'
) {
+ } elsif ( $params->{'magic'}
=~ /^not[ _]yet[ _]billed$/
+ || $params->{'status'}
=~ /^not[ _]yet[ _]billed$/
) {
push @where, FS::cust_pkg->not_yet_billed_sql();
push @where, FS::cust_pkg->not_yet_billed_sql();
@@
-2419,7
+2420,7
@@
sub search_sql {
{
$classnum = $1;
if ( $classnum ) { #a specific class
{
$classnum = $1;
if ( $classnum ) { #a specific class
- push @where, "classnum = $classnum";
+ push @where, "
part_pkg.
classnum = $classnum";
#@pkg_class = ( qsearchs('pkg_class', { 'classnum' => $classnum } ) );
#die "classnum $classnum not found!" unless $pkg_class[0];
#@pkg_class = ( qsearchs('pkg_class', { 'classnum' => $classnum } ) );
#die "classnum $classnum not found!" unless $pkg_class[0];
@@
-2427,7
+2428,7
@@
sub search_sql {
} elsif ( $classnum eq '' ) { #the empty class
} elsif ( $classnum eq '' ) { #the empty class
- push @where, "classnum IS NULL";
+ push @where, "
part_pkg.
classnum IS NULL";
#$title .= 'Empty class ';
#@pkg_class = ( '(empty class)' );
} elsif ( $classnum eq '0' ) {
#$title .= 'Empty class ';
#@pkg_class = ( '(empty class)' );
} elsif ( $classnum eq '0' ) {
@@
-2591,9
+2592,9
@@
sub search_sql {
my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : '';
my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : '';
- my $addl_from = 'LEFT JOIN
cust_main USING ( custnum
) '.
- 'LEFT JOIN p
art_pkg USING ( pkgpart
) '.
- 'LEFT JOIN
pkg_class USING ( classnum
) ';
+ my $addl_from = 'LEFT JOIN
part_pkg USING ( pkgpart
) '.
+ 'LEFT JOIN p
kg_class USING ( classnum
) '.
+ 'LEFT JOIN
cust_main USING ( custnum
) ';
my $count_query = "SELECT COUNT(*) FROM cust_pkg $addl_from $extra_sql";
my $count_query = "SELECT COUNT(*) FROM cust_pkg $addl_from $extra_sql";
diff --git
a/httemplate/browse/part_pkg.cgi
b/httemplate/browse/part_pkg.cgi
index
c6cbb81
..
d9b90cf
100755
(executable)
--- a/
httemplate/browse/part_pkg.cgi
+++ b/
httemplate/browse/part_pkg.cgi
@@
-96,8
+96,15
@@
$select = "
*,
( $count_cust_pkg
*,
( $count_cust_pkg
+ AND ( setup IS NULL OR cancel = 0 )
AND ( cancel IS NULL OR cancel = 0 )
AND ( cancel IS NULL OR cancel = 0 )
- AND ( susp IS NULL OR susp = 0 )
+ AND ( susp IS NULL OR susp = 0 )
+ ) AS num_not_yet_billed,
+
+ ( $count_cust_pkg
+ AND setup IS NOT NULL AND setup != 0
+ AND ( cancel IS NULL OR cancel = 0 )
+ AND ( susp IS NULL OR susp = 0 )
) AS num_active,
( $count_cust_pkg
) AS num_active,
( $count_cust_pkg
@@
-283,6
+290,8
@@
if ( $acl_edit_global ) {
'cancelled' => 'FF0000',
#'one-time charge' => '000000',
'charge' => '000000',
'cancelled' => 'FF0000',
#'one-time charge' => '000000',
'charge' => '000000',
+ #'not yet billed' => '000000',
+ 'not yet billed' => '000000',
);
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
push @fields, sub { my $part_pkg = shift;
);
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
push @fields, sub { my $part_pkg = shift;
@@
-294,6
+303,8
@@
if ( $acl_edit_global ) {
$magic = 'inactive';
#$label = 'one-time charge',
$label = 'charge',
$magic = 'inactive';
#$label = 'one-time charge',
$label = 'charge',
+ } else {
+ $label =~ s/_/ /g;
}
[
}
[
@@
-319,7
+330,7
@@
if ( $acl_edit_global ) {
),
},
],
),
},
],
- }
(qw( active suspended cancelled )
)
+ }
qw(not_yet_billed active suspended cancelled
)
]; };
$align .= 'r';
#}
]; };
$align .= 'r';
#}