5 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
6 <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH="100%">
7 <SCRIPT TYPE="text/javascript">
8 function clearhint_search_cust_svc(obj, str) {
9 if (obj.value == str) obj.value = '';
13 % foreach my $part_svc ( $cust_pkg->part_svc(
14 % 'summarize_size' => $opt{'cust_pkg-large_pkg_size'}
18 % my $num_cust_svc = $cust_pkg->num_cust_svc( $part_svc->svcpart );
20 % if ( $opt{'cust_pkg-large_pkg_size'} > 0 and
21 % $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) { # summarize
24 <TD ALIGN="right" VALIGN="top">
25 % my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart.
26 % ";pkgnum=".$cust_pkg->pkgnum;
27 <A HREF="<% $href %>"><% $part_svc->svc |h %></A>
29 <TD ALIGN="left" VALIGN="top">
30 <A HREF="<% $href %>"><B>(<% mt("view all [_1]", $num_cust_svc) |h %>)</B></A>
33 % my $hint = $hints{$part_svc->svcdb};
37 <TD ALIGN="left" VALIGN="top">
38 <FORM name="svcpart<%$part_svc->svcpart%>_search" STYLE="display:inline"
39 ACTION="<%$p%>search/cust_pkg_svc.html" METHOD="GET">
40 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%$part_svc->svcpart%>">
41 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<%$cust_pkg->pkgnum%>">
42 <INPUT TYPE="text" NAME="search_svc"
43 onfocus="clearhint_search_cust_svc(this, '<%$hint%>')" VALUE="<%$hint%>">
44 <INPUT TYPE="submit" VALUE="Search"></FORM>
49 % } else { # don't summarize
51 % foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) {
52 % if ( $cust_pkg->getfield('cancel') > 0 ) {
53 <& /elements/tr-cust_svc_cancel.html,
55 'part_svc' => $part_svc,
56 'cust_svc' => $cust_svc,
57 'cust_pkg' => $cust_pkg,
61 <& /elements/tr-cust_svc.html,
63 'part_svc' => $part_svc,
64 'cust_svc' => $cust_svc,
65 'cust_pkg' => $cust_pkg,
68 % } #foreach $cust_svc
70 % if ( ! $cust_pkg->get('cancel')
71 % && $curuser->access_right('Provision customer service')
72 % && $part_svc->num_avail
76 <TD COLSPAN=3 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
79 % if ( $opt{no_links} ) {
80 <% $part_svc->svc |h %>: <% $part_svc->num_avail %>
81 <% mt('Available') |h %>
83 <% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
87 % if ( $curuser->access_right('Bulk provision customer service')
88 % && $part_svc->svcdb eq 'svc_phone'
92 % if ( $part_svc->num_avail > 5 ) {
93 % local $opt{'bulk'} = 1;
94 <BR><% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
96 % #XXX if there's orders for this customer {
97 <BR><A HREF="<%$p%>browse/did_order.html?custnum=<%$cust_pkg->custnum%>"><% mt('Browse Received DID Inventory') |h %></A>
114 my $bgcolor = $opt{'bgcolor'};
115 my $cust_pkg = $opt{'cust_pkg'};
116 my $part_pkg = $opt{'part_pkg'};
117 my $curuser = $FS::CurrentUser::CurrentUser;
119 my $conf = new FS::Conf;
121 sub svc_provision_link {
122 my ($cust_pkg, $part_svc, $opt, $curuser) = @_;
124 ( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/ /g;
125 my $num_avail = $part_svc->num_avail;
127 my $query = "pkgnum=". $cust_pkg->pkgnum. ';'.
128 "svcpart=". $part_svc->svcpart;
129 $query .= ';bulk=1' if $opt->{bulk};
132 if ( $part_svc->svcdb eq 'svc_external' #could be generalized
133 && $opt->{'svc_external-skip_manual'}
135 $url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$query";
140 'part_svc' => $part_svc,
145 my $action = $opt->{bulk} ? 'Bulk provision' : 'Provision';
147 my $link = qq!<A CLASS="provision" HREF="$url">!.
148 emt("$action [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
149 if ( $opt->{'legacy_link'}
150 && $curuser->access_right('View/link unlinked services')
154 qq!<A CLASS="provision" HREF="${p}misc/link.cgi?$query">!.
155 emt("Link to legacy [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
161 svc_acct => emt('(user or email)'),
162 svc_domain => emt('(domain)'),
163 svc_broadband => emt('(ip or mac)'),
164 svc_forward => emt('(email)'),
165 svc_phone => emt('(phone)'),
166 svc_pbx => emt('(phone)'),