fix customer category selection, RT#17487
authorIvan Kohler <ivan@freeside.biz>
Sun, 22 Apr 2012 21:14:39 +0000 (14:14 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 22 Apr 2012 21:14:39 +0000 (14:14 -0700)
httemplate/edit/elements/class_Common.html

index a0025b3..0a0916e 100644 (file)
@@ -22,14 +22,15 @@ my %opt = @_;
 my $table = $opt{'table'};
 
 my @category;
+my $category_table;
 unless ( $opt{'nocat'} ) {
-    ( my $category_table = $table ) =~ s/class/category/ or die;
+    ( $category_table = $table ) =~ s/class/category/ or die;
     @category = qsearch($category_table, { 'disabled' => '' });
 }
 
 my $fields = [   'classname',
         (scalar(@category)
-          ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>'pkg_category', 'name_col'=>'categoryname' }
+          ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>$category_table, 'name_col'=>'categoryname' }
           : { field=>'categorynum', type=>'hidden' }
         ),
         { field=>'disabled', type=>'checkbox', value=>'Y', },