% ###
% # Services
% ###
% foreach my $part_svc ( $cust_pkg->part_svc ) {
% my $num_cust_svc = $cust_pkg->num_cust_svc( $part_svc->svcpart );
% if ( $opt{'cust_pkg-large_pkg_size'} > 0 and
% $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) {
% # summarize
% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart.
% ";pkgnum=".$cust_pkg->pkgnum;
<% $part_svc->svc %>
|
(<% mt("view all [_1]", $num_cust_svc) |h %>)
|
% my $hint = $hints{$part_svc->svcdb};
% if ( $hint ) {
|
|
% } #$hint
% }
% else { # don't summarize
% foreach my $cust_svc ( @{ $part_svc->cust_pkg_svc } ) {
% if ( $cust_pkg->getfield('cancel') > 0 ) {
<& /elements/tr-cust_svc_cancel.html,
%opt,
'part_svc' => $part_svc,
'cust_svc' => $cust_svc,
'cust_pkg' => $cust_pkg,
&>
% }
% else {
<& /elements/tr-cust_svc.html,
%opt,
'part_svc' => $part_svc,
'cust_svc' => $cust_svc,
'cust_pkg' => $cust_pkg,
&>
% } #if cancel > 0
% } #foreach $cust_svc
% } #if summarizing
% if ( ! $cust_pkg->get('cancel')
% && $curuser->access_right('Provision customer service')
% && $part_svc->num_avail
% ) {
<% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
% if ( $curuser->access_right('Bulk provision customer service')
% && $part_svc->svcdb eq 'svc_phone' ) {
<% mt('Browse Received DID Inventory') |h %>
% }
|
% }
% }
|
<%init>
my %opt = @_;
my $bgcolor = $opt{'bgcolor'};
my $cust_pkg = $opt{'cust_pkg'};
my $part_pkg = $opt{'part_pkg'};
my $curuser = $FS::CurrentUser::CurrentUser;
my $conf = new FS::Conf;
sub svc_provision_link {
my ($cust_pkg, $part_svc, $opt, $curuser) = @_;
( my $svc_nbsp = $part_svc->svc ) =~ s/\s+/ /g;
my $num_avail = $part_svc->num_avail;
my $pkgnum_svcpart = "pkgnum=". $cust_pkg->pkgnum. ';'.
"svcpart=". $part_svc->svcpart;
my $url;
if ( $part_svc->svcdb eq 'svc_external' #could be generalized
&& $opt->{'svc_external-skip_manual'}
) {
$url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$pkgnum_svcpart";
} else {
$url = svc_url(
'm' => $m,
'action' => 'edit',
'part_svc' => $part_svc,
'query' => $pkgnum_svcpart,
);
}
my $link = qq!!.
emt("Provision [_1] ([_2])",$svc_nbsp,$num_avail).'';
if ( $opt->{'legacy_link'}
&& $curuser->access_right('View/link unlinked services')
)
{
$link .= '
'.
qq!!.
emt("Link to legacy [_1] ([_2])",$svc_nbsp,$num_avail).'';
}
$link;
}
my %hints = (
svc_acct => emt('(user or email)'),
svc_domain => emt('(domain)'),
svc_broadband => emt('(ip or mac)'),
svc_forward => emt('(email)'),
svc_phone => emt('(phone)'),
svc_pbx => emt('(phone)'),
);
%init>