1 % if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) {
3 <INPUT TYPE="hidden" NAME="lock_pkgpart" VALUE="<% $1 %>">
10 <FONT SIZE="+1"><B>First package</B></FONT>
11 <% ntable("#cccccc") %>
15 <% include('first_pkg/select-part_pkg.html',
16 'part_pkg' => \@part_pkg,
17 'first_svc' => \@first_svc,
19 # map { $_ => $opt{$_} } qw( pkgpart_svcpart saved_domsvc )
26 my( $cust_main, %opt ) = @_;
28 # pry the wrong place for this logic. also pretty expensive
30 #false laziness, copied from FS::cust_pkg::order
33 my @agents = $FS::CurrentUser::CurrentUser->agents;
34 if ( scalar(@agents) == 1 ) {
35 # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART
36 $pkgpart = $agents[0]->pkgpart_hashref;
37 $agentnum = $agents[0]->agentnum;
38 } elsif ( $cgi->param('lock_agentnum') =~ /^(\d+)$/
39 && $FS::CurrentUser::CurrentUser->agentnum($1) ) {
41 my $agent = (grep { $_->agentnum == $agentnum } @agents)[0];
42 $pkgpart = $agent->pkgpart_hashref;
44 #can't know (agent not chosen), so, allow all
47 foreach my $agent ( @agents ) {
48 next if $typenum{$agent->typenum}++;
49 $pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref }
55 if ( $cgi->param('lock_pkgpart') =~ /^([\d, ]+)$/ ) {
57 my $lock_pkgpart = $1;
60 'table' => 'part_pkg',
61 'hashref' => { 'disabled' => '' },
62 'extra_sql' => "AND pkgpart IN ($lock_pkgpart)",
63 'order_by' => 'ORDER BY pkg', # case?
69 qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case?
73 my @first_svc = ( 'svc_acct', 'svc_phone', 'svc_dsl' );
76 grep { $_->svcpart(\@first_svc)
77 && ( $pkgpart->{ $_->pkgpart }
79 || ( $agentnum ne 'all' && $agentnum && $_->agentnum
80 && $_->agentnum == $agentnum