X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust-part_pkg.html;h=6244b6cb72c5113523810c9f929d48a4bec2946e;hb=11df448ba461eed4d33fded0f21ed15c155a7896;hp=767d23264ba3197e7f3ca3091a0680c67fe01681;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git
diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html
index 767d23264..6244b6cb7 100644
--- a/httemplate/elements/tr-select-cust-part_pkg.html
+++ b/httemplate/elements/tr-select-cust-part_pkg.html
@@ -1,5 +1,3 @@
-%if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
-
<& /elements/xmlhttp.html,
'url' => $p.'misc/cust-part_pkg.cgi',
'subs' => [ 'get_part_pkg' ],
@@ -7,10 +5,12 @@
+% if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
<% mt('Package Class') |h %> |
@@ -68,16 +85,20 @@
|
-%}
+% } else { # so that the rest of the page works correctly
+
+% }
<% mt('Package') |h %> |
<& /elements/select-cust-part_pkg.html,
- 'curr_value' => $opt{'curr_value'}, #$pkgpart
- 'classnum' => $opt{'classnum'},
- 'cust_main' => $opt{'cust_main'}, #$cust_main
- 'onchange' => 'pkg_changed',
+ 'curr_value' => $opt{'curr_value'}, #$pkgpart
+ 'classnum' => $opt{'classnum'},
+ 'cust_main' => $opt{'cust_main'}, #$cust_main
+ 'prospect_main' => $opt{'prospect_main'}, #$prospect_main
+ 'onchange' => 'pkg_changed',
+ 'label_callback' => sub { shift->pkg_comment },
&>
|
@@ -91,8 +112,13 @@ my %opt = @_;
my $pre_label = $opt{'pre_label'} || '';
$pre_label .= ' ' if length($pre_label) && $pre_label =~ /\S$/;
-my $cust_main = $opt{'cust_main'}
- or die "cust_main not specified";
+my $cust_main = $opt{'cust_main'};
+my $prospect_main = $opt{'prospect_main'};
+
+die "neither cust_main nor prospect_main specified"
+ unless $cust_main || $prospect_main;
+
+my $agent = $cust_main ? $cust_main->agent : $prospect_main->agent;
#"normal" part_pkg agent virtualization (agentnum or type)
my @part_pkg = qsearch({
@@ -101,7 +127,7 @@ my @part_pkg = qsearch({
'hashref' => { 'disabled' => '' },
'extra_sql' =>
' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( 'null'=>1 ).
- ' AND '. FS::part_pkg->agent_pkgs_sql( $opt{'cust_main'}->agent ),
+ ' AND '. FS::part_pkg->agent_pkgs_sql( $agent ),
});
my @pkg_class =