blob: 0de33c02585d09af2fbd179cb94c9b230603f456 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
% if ( @part_pkg ) {
<BR><BR>
<FONT SIZE="+1"><B>First package</B></FONT>
<% ntable("#cccccc") %>
<TR>
<TD COLSPAN=2>
<% include('first_pkg/select-part_pkg.html',
'part_pkg' => \@part_pkg,
%opt,
# map { $_ => $opt{$_} } qw( pkgpart_svcpart saved_domsvc )
)
%>
% }
<%init>
my( $cust_main, %opt ) = @_;
# pry the wrong place for this logic. also pretty expensive
#false laziness, copied from FS::cust_pkg::order
my $pkgpart;
my $agentnum = '';
my @agents = $FS::CurrentUser::CurrentUser->agents;
if ( scalar(@agents) == 1 ) {
# $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART
$pkgpart = $agents[0]->pkgpart_hashref;
$agentnum = $agents[0]->agentnum;
} else {
#can't know (agent not chosen), so, allow all
$agentnum = 'all';
my %typenum;
foreach my $agent ( @agents ) {
next if $typenum{$agent->typenum}++;
$pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref }
}
}
#eslaf
my @first_svc = ( 'svc_acct', 'svc_phone' );
my @part_pkg =
grep { $_->svcpart(\@first_svc)
&& ( $pkgpart->{ $_->pkgpart }
|| $agentnum eq 'all'
|| ( $agentnum ne 'all' && $agentnum && $_->agentnum
&& $_->agentnum == $agentnum
)
)
}
qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case?
</%init>
|