% ###
<TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
- <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
+ <TABLE CLASS="inv" BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH="100%">
<SCRIPT TYPE="text/javascript">
function clearhint_search_cust_svc(obj, str) {
if (obj.value == str) obj.value = '';
}
</SCRIPT>
-% foreach my $part_svc ( $cust_pkg->part_svc ) {
-
+% my $showdidlink = browse_received_did_inventory($cust_pkg->custnum);
+% foreach my $part_svc (
+% $cust_pkg->part_svc(
+% 'summarize_size' => $opt{'cust_pkg-large_pkg_size'},
+% 'hide_discontinued' => $opt{'cust_pkg-hide_discontinued-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
+% $opt{'cust_pkg-large_pkg_size'} <= $num_cust_svc ) { # summarize
+%
<TR>
<TD ALIGN="right" VALIGN="top">
% my $href="${p}search/cust_pkg_svc.html?svcpart=".$part_svc->svcpart.
% ";pkgnum=".$cust_pkg->pkgnum;
- <A HREF="<% $href %>"><% $part_svc->svc %></A>
+ <A HREF="<% $href %>"><% $part_svc->svc |h %></A>
</TD>
<TD ALIGN="left" VALIGN="top">
<A HREF="<% $href %>"><B>(<% mt("view all [_1]", $num_cust_svc) |h %>)</B></A>
</TD>
</TR>
% } #$hint
-% }
-% else { # don't summarize
+%
+% } 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,
<TR>
<TD COLSPAN=3 ALIGN="center" STYLE="padding-bottom:4px;padding-top:0px">
- <B><% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %></B>
+
+ <B>
+% if ( $opt{no_links} ) {
+ <% $part_svc->svc |h %>: <% $part_svc->num_avail %>
+ <% mt('Available') |h %>
+% } else {
+ <% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
+% }
+ </B>
+
% if ( $curuser->access_right('Bulk provision customer service')
-% && $part_svc->svcdb eq 'svc_phone' ) {
+% && $part_svc->svcdb eq 'svc_phone'
+% && ! $opt{no_links}
+% )
+% {
% if ( $part_svc->num_avail > 5 ) {
-% $opt{'bulk'} = 1;
+% local $opt{'bulk'} = 1;
+% local $opt{'svc_phone_bulk_provision_simple'} = $svc_phone_bulk_provision_simple;
+% local $opt{'num_avail'} = $part_svc->num_avail;
<BR><% svc_provision_link($cust_pkg, $part_svc, \%opt, $curuser) %>
% }
-% #XXX if there's orders for this customer {
+% if ($showdidlink) {
<BR><A HREF="<%$p%>browse/did_order.html?custnum=<%$cust_pkg->custnum%>"><% mt('Browse Received DID Inventory') |h %></A>
-% #}
+% }
% }
</TD>
</TR>
-% }
+% }
+
+% } #foreach part_svc
+
+% if ($cust_pkg->get('cancel')) {
+% foreach my $svc (
+% $cust_pkg->uncancel_svc_summary('summarize_size' => $opt{'cust_pkg-large_pkg_size'}, 'no_test_reprovision' => 1)
+% ) {
+ <TR>
+ <TD ALIGN="right" VALIGN="top"><% $svc->{'svc'} |h %></TD>
+ <TD STYLE="padding-bottom:0px; font-style: italic">
+ <% $svc->{'num_cust_svc'}
+ ? $svc->{'num_cust_svc'} . ' ' . emt('services in history')
+ : (defined($svc->{'label'}) ? $svc->{'label'} : emt('(cannot load svc label)')) |h %>
+ </TD>
+ </TR>
+% }
+% }
-% }
</TABLE>
</TD>
my $bgcolor = $opt{'bgcolor'};
my $cust_pkg = $opt{'cust_pkg'};
my $part_pkg = $opt{'part_pkg'};
-my $curuser = $FS::CurrentUser::CurrentUser;
+my $svc_phone_bulk_provision_simple = $opt{'svc_phone-bulk_provision_simple'};
-my $conf = new FS::Conf;
+my $curuser = $FS::CurrentUser::CurrentUser;
sub svc_provision_link {
my ($cust_pkg, $part_svc, $opt, $curuser) = @_;
&& $opt->{'svc_external-skip_manual'}
) {
$url = "${p}edit/process/". $part_svc->svcdb. ".cgi?$query";
+ } elsif ( $part_svc->svcdb eq 'svc_phone' && $opt->{bulk}
+ && $opt->{svc_phone_bulk_provision_simple}
+ )
+ {
+ $query .= ';num_avail='. $opt->{num_avail};
+ $url = "${p}edit/bulk-svc_phone.html?$query";
} else {
$url = svc_url(
'm' => $m,
my $link = qq!<A CLASS="provision" HREF="$url">!.
emt("$action [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
+
if ( $opt->{'legacy_link'}
&& $curuser->access_right('View/link unlinked services')
+ && ! $opt{bulk}
)
{
$link .= '<BR>'.
qq!<A CLASS="provision" HREF="${p}misc/link.cgi?$query">!.
emt("Link to legacy [_1] ([_2])",$svc_nbsp,$num_avail).'</A>';
}
+
$link;
}
+sub browse_received_did_inventory {
+ local($FS::Record::qsearch_qualify_columns) = 1;
+ qsearch({
+ 'table' => 'did_order',
+ 'hashref' => { 'custnum' => $_[0] },
+ 'extra_sql' => ' LIMIT 1'
+ }) ||
+ qsearch({
+ 'table' => 'did_order_item',
+ 'hashref' => { 'custnum' => $_[0] },
+ 'addl_from' => ' INNER JOIN did_order ON did_order_item.ordernum = did_order.ordernum',
+ 'extra_sql' => ' LIMIT 1'
+ });
+}
+
my %hints = (
svc_acct => emt('(user or email)'),
svc_domain => emt('(domain)'),