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=878af4d90a046af17ba3c6c7f54fb3292a428830;hb=7b0bbc4117a7959b9f7b7b2cf999b8188ba34160;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index 878af4d90..f4af405fc 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -1,16 +1,16 @@ -%if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) { - - <% include('/elements/xmlhttp.html', + <& /elements/xmlhttp.html, 'url' => $p.'misc/cust-part_pkg.cgi', 'subs' => [ 'get_part_pkg' ], - ) - %> + &> +% if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) { - Package Class + <% mt('Package Class') |h %> - <% include('/elements/select-cust-pkg_class.html', + <& /elements/select-cust-pkg_class.html, 'curr_value' => $opt{'classnum'}, 'pkg_class' => \@pkg_class, 'onchange' => 'classnum_changed', - ) - %> + &> -%} +% } else { # so that the rest of the page works correctly + +% } - Package + <% mt('Package') |h %> - <% include('/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', - ) - %> + <& /elements/select-cust-part_pkg.html, + '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 }, + &> @@ -92,11 +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 @pkg_class = sort { $a->classname cmp $b->classname } -# qsearch( 'pkg_class', { 'disabled' => '' } ); +my $agent = $cust_main ? $cust_main->agent : $prospect_main->agent; #"normal" part_pkg agent virtualization (agentnum or type) my @part_pkg = qsearch({ @@ -105,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 =