freeside/httemplate/edit part_pkg.cgi,1.52,1.53
Ivan Kohler
ivan at pouncequick.420.am
Tue May 31 16:32:45 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory pouncequick:/tmp/cvs-serv29137
Modified Files:
part_pkg.cgi
Log Message:
ack, this should finally fix the package editing problem
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- part_pkg.cgi 26 May 2005 03:45:10 -0000 1.52
+++ part_pkg.cgi 31 May 2005 23:32:42 -0000 1.53
@@ -13,21 +13,26 @@
}
my ($query) = $cgi->keywords;
-my $action = '';
+
my $part_pkg = '';
if ( $cgi->param('error') ) {
$part_pkg = new FS::part_pkg ( {
map { $_, scalar($cgi->param($_)) } fields('part_pkg')
} );
}
+
+my $action = '';
my $clone_part_pkg = '';
+my $pkgpart = '';
if ( $cgi->param('clone') ) {
+ $pkgpart = $cgi->param('clone');
$action = 'Custom Pricing';
$clone_part_pkg= qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } );
$part_pkg ||= $clone_part_pkg->clone;
$part_pkg->disabled('Y');
} elsif ( $query && $query =~ /^(\d+)$/ ) {
$part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
+ $pkgpart = $part_pkg->pkgpart;
} else {
unless ( $part_pkg ) {
$part_pkg = new FS::part_pkg {};
@@ -173,21 +178,19 @@
END
}
+
+my $where = "WHERE disabled IS NULL OR disabled = ''";
+if ( $pkgpart ) {
+ $where .= " OR 0 < ( SELECT quantity FROM pkg_svc
+ WHERE pkg_svc.svcpart = part_svc.svcpart
+ AND pkgpart = $pkgpart
+ )";
+}
my @fixups = ();
my $count = 0;
my $columns = 3;
-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
- )"
-);
-foreach my $part_svc ( @part_svc ) {
+foreach my $part_svc ( qsearch('part_svc', {}, '', $where) ) {
my $svcpart = $part_svc->svcpart;
- my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart;
my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', {
'pkgpart' => $pkgpart,
'svcpart' => $svcpart,
More information about the freeside-commits
mailing list