[freeside-commits] freeside/httemplate/edit part_pkg.cgi,1.54,1.55
Ivan,,,
ivan at wavetail.420.am
Tue Jul 12 02:22:20 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail:/tmp/cvs-serv7880
Modified Files:
part_pkg.cgi
Log Message:
<rjbs> This patch is part of my continuing effort to avoid using SQL and qsearch from templates to find the pkg_svc records for a package.
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- part_pkg.cgi 1 Jun 2005 02:39:16 -0000 1.54
+++ part_pkg.cgi 12 Jul 2005 09:22:18 -0000 1.55
@@ -187,22 +187,20 @@
)";
}
my @part_svc = qsearch('part_svc', {}, '', $where);
+my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc;
my @fixups = ();
my $count = 0;
my $columns = 3;
foreach my $part_svc ( @part_svc ) {
my $svcpart = $part_svc->svcpart;
- my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', {
- 'pkgpart' => $pkgpart,
- 'svcpart' => $svcpart,
- } ) || new FS::pkg_svc ( {
- 'pkgpart' => $pkgpart,
- 'svcpart' => $svcpart,
- 'quantity' => 0,
- 'primary_svc' => '',
- });
- #? #next unless $pkg_svc;
+ my $pkg_svc = $pkg_svc{$svcpart}
+ || new FS::pkg_svc ( {
+ 'pkgpart' => $pkgpart,
+ 'svcpart' => $svcpart,
+ 'quantity' => 0,
+ 'primary_svc' => '',
+ } );
push @fixups, "pkg_svc$svcpart";
More information about the freeside-commits
mailing list