1 % if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) {
3 <INPUT TYPE="hidden" NAME="lock_pkgpart" VALUE="<% $1 %>">
10 <FONT CLASS="fsinnerbox-title"><% mt('First package') |h %></FONT>
11 <% ntable("#cccccc") %>
15 <& first_pkg/select-part_pkg.html,
16 'part_pkg' => \@part_pkg,
17 'first_svc' => \@first_svc,
24 my( $cust_main, %opt ) = @_;
26 # pry the wrong place for this logic. also pretty expensive
28 #false laziness, copied from FS::cust_pkg::order
31 my @agents = $FS::CurrentUser::CurrentUser->agents;
32 if ( scalar(@agents) == 1 ) {
33 # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART
34 $pkgpart = $agents[0]->pkgpart_hashref;
35 $agentnum = $agents[0]->agentnum;
36 } elsif ( $cgi->param('lock_agentnum') =~ /^(\d+)$/
37 && $FS::CurrentUser::CurrentUser->agentnum($1) ) {
39 my $agent = (grep { $_->agentnum == $agentnum } @agents)[0];
40 $pkgpart = $agent->pkgpart_hashref;
42 #can't know (agent not chosen), so, allow all
45 foreach my $agent ( @agents ) {
46 next if $typenum{$agent->typenum}++;
47 $pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref }
53 if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) {
55 my $lock_pkgpart = $1;
58 'table' => 'part_pkg',
59 'hashref' => { 'disabled' => '' },
60 'extra_sql' => "AND pkgpart IN ($lock_pkgpart)",
61 'order_by' => 'ORDER BY pkg', # case?
67 qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case?
71 my @first_svc = ( 'svc_acct', 'svc_phone', 'svc_dsl' );
74 grep { $_->svcpart(\@first_svc)
75 && ( $pkgpart->{ $_->pkgpart }
77 || ( $agentnum ne 'all' && $agentnum && $_->agentnum
78 && $_->agentnum == $agentnum