summaryrefslogtreecommitdiff
path: root/FS/FS/class_Common.pm
diff options
context:
space:
mode:
authorJoshua Goodman <jgoodman1990@gmail.com>2015-01-16 00:25:37 +0000
committerJoshua Goodman <jgoodman1990@gmail.com>2015-01-16 00:25:37 +0000
commit2b22859ec037627196e3153719359efe46e42178 (patch)
tree4293243a82506db63fbc81fbff885bbce5165681 /FS/FS/class_Common.pm
parent14e0c529bcfbe96964cb659018c3c91e5ce9a483 (diff)
Change $_category_table to be a hash which maps packages to category tables. A bug was found where "part_svc_category" was returned when FS::part_pkg->insert() was called.
Diffstat (limited to 'FS/FS/class_Common.pm')
-rw-r--r--FS/FS/class_Common.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/FS/FS/class_Common.pm b/FS/FS/class_Common.pm
index 455cb9f..01048ec 100644
--- a/FS/FS/class_Common.pm
+++ b/FS/FS/class_Common.pm
@@ -122,14 +122,15 @@ sub _target_table {
sub _target_column { 'classnum'; }
-use vars qw( $_category_table );
+use vars qw( %_category_table );
sub _category_table {
- return $_category_table if $_category_table;
my $self = shift;
- $_category_table = $self->table;
- $_category_table =~ s/class/category/ # s/_class$/_category/
- or die "can't determine an automatic category table for $_category_table";
- $_category_table;
+ return $_category_table{ ref $self } ||= do {
+ my $category_table = $self->table;
+ $category_table =~ s/class/category/ # s/_class$/_category/
+ or die "can't determine an automatic category table for $category_table";
+ $category_table;
+ }
}
=head1 BUGS