summaryrefslogtreecommitdiff
path: root/FS/FS/agent_type.pm
diff options
context:
space:
mode:
authorivan <ivan>2006-06-21 08:42:18 +0000
committerivan <ivan>2006-06-21 08:42:18 +0000
commit6c472b9d7eb5d64026baf188623cc133416253f6 (patch)
tree96f486bdddcd4dcddf598dc86d832f041d661f61 /FS/FS/agent_type.pm
parentb5c26536197f16a3e1ea47c14c94884312c7fd24 (diff)
speed up the agent type report when there are lots of package definitions
Diffstat (limited to 'FS/FS/agent_type.pm')
-rw-r--r--FS/FS/agent_type.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/FS/FS/agent_type.pm b/FS/FS/agent_type.pm
index b28c572..2660bb4 100644
--- a/FS/FS/agent_type.pm
+++ b/FS/FS/agent_type.pm
@@ -136,6 +136,27 @@ sub type_pkgs {
qsearch('type_pkgs', { 'typenum' => $self->typenum } );
}
+=item type_pkgs_enabled
+
+Returns all FS::type_pkg objects (see L<FS::type_pkgs>) that link to enabled
+package definitions (see L<FS::part_pkg>).
+
+An additional strange feature is that the returned type_pkg objects also have
+all fields of the associated part_pkg object.
+
+=cut
+
+sub type_pkgs_enabled {
+ my $self = shift;
+ qsearch({
+ 'table' => 'type_pkgs',
+ 'addl_from' => 'JOIN part_pkg USING ( pkgpart )',
+ 'hashref' => { 'typenum' => $self->typenum },
+ 'extra_sql' => " AND ( disabled = '' OR disabled IS NULL )".
+ " ORDER BY pkg",
+ });
+}
+
=item pkgpart
Returns the pkgpart of all package definitions (see L<FS::part_pkg>) for this
@@ -152,6 +173,13 @@ sub pkgpart {
=head1 BUGS
+type_pkgs_enabled should order itself by something (pkg?)
+
+type_pkgs_enabled should populate something that caches for the part_pkg method
+rather than add fields to this object, right? In fact we need a "poop" object
+framework that does that automatically for any joined search at some point....
+right?
+
=head1 SEE ALSO
L<FS::Record>, L<FS::agent>, L<FS::type_pkgs>, L<FS::cust_main>,