summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhttemplate/edit/part_pkg.cgi15
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi4
2 files changed, 15 insertions, 4 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 1790cdfeb..fd2aa2bfc 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -176,7 +176,16 @@ END
my @fixups = ();
my $count = 0;
my $columns = 3;
-my @part_svc = qsearch( 'part_svc', { 'disabled' => '' } );
+my @part_svc = qsearch(
+ 'part_svc',
+ {},
+ '',
+ "WHERE disabled IS NULL OR disabled = ''
+ OR 0 < ( SELECT quantity FROM pkg_svc
+ WHERE pkg_svc.svcpart = part_svc.svcpart
+ AND pkgpart = 72
+ )"
+);
foreach my $part_svc ( @part_svc ) {
my $svcpart = $part_svc->svcpart;
my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart;
@@ -206,7 +215,9 @@ foreach my $part_svc ( @part_svc ) {
print '></TD>';
}
print qq!<TD><A HREF="part_svc.cgi?!,$part_svc->svcpart,
- qq!">!, $part_svc->getfield('svc'), "</A></TD></TR>";
+ qq!">!, $part_svc->getfield('svc'), '</A>';
+ print ' (DISABLED)' if $part_svc->disabled =~ /^Y/i;
+ print '</TD></TR>';
# print "</TABLE></TD><TD>$thead" if ++$count == int(scalar(@part_svc) / 2);
$count+=1;
foreach ( 1 .. $columns-1 ) {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 2d6b34432..1a7f52838 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -19,11 +19,11 @@ foreach (qw( setuptax recurtax disabled )) {
my $new = new FS::part_pkg ( {
map {
- $_, scalar($cgi->param($_));
+ $_ => scalar($cgi->param($_));
} fields('part_pkg')
} );
-my %pkg_svc = map { $_ => $cgi->param("pkg_svc$_") }
+my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) }
map { $_->svcpart }
qsearch('part_svc', {} );