X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust-part_pkg.html;h=8431beb4e36ab83ec74819b7c1bba7ecec67509b;hb=57d9974e8e0164453ad7e6b5df4cd8cd78897ef0;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..8431beb4e 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -7,10 +7,11 @@ @@ -74,10 +87,11 @@ <% 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', &> @@ -91,8 +105,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 +120,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 =