X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Ftr-select-cust-part_pkg.html;h=f4af405fcf7875faff6938e3d133a024af6ad947;hb=081638aa4a483577a9c5bc7ac9ea518370cf2381;hp=75f1f6f0abdd5fd1ddd8daa3de272f796efc0c0e;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git
diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html
index 75f1f6f0a..f4af405fc 100644
--- a/httemplate/elements/tr-select-cust-part_pkg.html
+++ b/httemplate/elements/tr-select-cust-part_pkg.html
@@ -1,15 +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 },
+ &>
|
@@ -81,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({
@@ -94,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 =