X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Ffirst_pkg.html;h=6845b2c90444ed53cf8913b5a4937cebb5d19011;hp=0de33c02585d09af2fbd179cb94c9b230603f456;hb=9aee669886202be7035e6c6049fc71bc99dd3013;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2 diff --git a/httemplate/edit/cust_main/first_pkg.html b/httemplate/edit/cust_main/first_pkg.html index 0de33c025..6845b2c90 100644 --- a/httemplate/edit/cust_main/first_pkg.html +++ b/httemplate/edit/cust_main/first_pkg.html @@ -1,17 +1,22 @@ +% if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) { + + + +% } +% % if ( @part_pkg ) { -

- First package - <% ntable("#cccccc") %> +
+ <% mt('First package') |h %> +
- <% include('first_pkg/select-part_pkg.html', - 'part_pkg' => \@part_pkg, + <& first_pkg/select-part_pkg.html, + 'part_pkg' => \@part_pkg, + 'first_svc' => \@first_svc, %opt, - # map { $_ => $opt{$_} } qw( pkgpart_svcpart saved_domsvc ) - ) - %> + &> % } <%init> @@ -28,6 +33,11 @@ if ( scalar(@agents) == 1 ) { # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART $pkgpart = $agents[0]->pkgpart_hashref; $agentnum = $agents[0]->agentnum; +} elsif ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ + && $FS::CurrentUser::CurrentUser->agentnum($1) ) { + $agentnum = $1; + my $agent = (grep { $_->agentnum == $agentnum } @agents)[0]; + $pkgpart = $agent->pkgpart_hashref; } else { #can't know (agent not chosen), so, allow all $agentnum = 'all'; @@ -39,9 +49,28 @@ if ( scalar(@agents) == 1 ) { } #eslaf -my @first_svc = ( 'svc_acct', 'svc_phone' ); +my @part_pkg = (); +if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) { + + my $lock_pkgpart = $1; + + @part_pkg = qsearch({ + 'table' => 'part_pkg', + 'hashref' => { 'disabled' => '' }, + 'extra_sql' => "AND pkgpart IN ($lock_pkgpart)", + 'order_by' => 'ORDER BY pkg', # case? + }); + +} else { + + @part_pkg = + qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + +} + +my @first_svc = ( 'svc_acct', 'svc_phone', 'svc_dsl' ); -my @part_pkg = +@part_pkg = grep { $_->svcpart(\@first_svc) && ( $pkgpart->{ $_->pkgpart } || $agentnum eq 'all' @@ -50,6 +79,6 @@ my @part_pkg = ) ) } - qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? + @part_pkg;