X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cust-part_pkg.html;h=f4af405fcf7875faff6938e3d133a024af6ad947;hp=e55cbee30c86a6c31a65775e2b02fa7d54cf45d2;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=73ccbbf60928661e385c826de893e6fd57c7e364 diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index e55cbee30..f4af405fc 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,9 +5,12 @@ +% if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) { <% mt('Package Class') |h %> @@ -66,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' => 'enable_order_pkg', + '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 }, &> @@ -89,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({ @@ -99,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 =