summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-cust_svc.html
blob: ca5de86b4d119b1644823d74d3ef9692e2256161 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<%doc>
tr-cust_svc - Short display of a customer service for use in view/cust_main.

Formerly part of view/cust_main/packages/services.html

Usage:

  <% include('/elements/tr-cust_svc.html',
                #required
                'part_svc' => $part_svc,
                'cust_svc' => $cust_svc,
                'cust_pkg' => $cust_pkg,
                #optional
                'cust_pkg-display_times'    => '', #bool
                'manage_link'               => '', #for svc_broadband
                'manage_link_text'          => '', #default 'Manage Device'
                'manage_link_loc'           => '', #default 'bottom', or 'right'
                'maestro-status_test'       => '',
            )
  %>

</%doc>
<TR>
  <TD ALIGN="right" VALIGN="top"><% 
FS::UI::Web::svc_link($m, $part_svc, $cust_svc)
%></TD>
  <TD STYLE="padding-bottom:0px"><B><%
FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc)
%></B></TD>
<TD ALIGN="right"><% FS::UI::Web::svc_export_links($m, $part_svc, $cust_svc) %>
%   if ( $manage_link and $opt{'manage_link_loc'} eq 'right' ) {
      <A HREF="<% $manage_link %>" <% $manage_target %>><% $opt{'manage_link_text'} |h %></A>
% }
</TD>
</TR>
% if ( $cust_svc->overlimit ) {
<TR>
  <TD ALIGN="right" COLSPAN="3" VALIGN="top"
      STYLE="padding-bottom:1px; padding-top:0px">
    <FONT SIZE="-2" COLOR="#FFD000">Overlimit: <%
time2str('%b %o %Y' . $opt{'cust_pkg-display_times'} ? ' %l:%M %P' : '',
$cust_svc->overlimit )
    %></FONT>
  </TD>
</TR>
% }
<TR>
% # first column: recharge link
  <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px; padding-top:0px">
% if ( $curuser->access_right('Recharge customer service') 
%     && $part_svc->svcdb eq 'svc_acct'
%     && ( $svc_x->seconds ne '' 
%       || $svc_x->upbytes ne ''
%       || $svc_x->downbytes ne ''
%       || $svc_x->totalbytes ne ''
%     )
% ) {
    <FONT SIZE="-2">(&nbsp;<% svc_recharge_link($cust_svc)%>&nbsp;)</FONT>
% }
  </TD>
% # second column: all other action links
  <TD ALIGN="right" VALIGN="top" STYLE="padding-bottom:5px; padding-top:0px">
% if ( $part_svc->svcdb eq 'svc_broadband' ) {
    <FONT SIZE="-2">(&nbsp;<%
      include('/elements/popup_link-ping.html',
              'ip' => $svc_x->ip_addr
      ) %>&nbsp;)</FONT>
%   if ( $manage_link and $opt{'manage_link_loc'} eq 'bottom' ) {
      <FONT SIZE="-2">(&nbsp;<A HREF="<% $manage_link %>" <% $manage_target %>><% $opt{'manage_link_text'} |h %></A>&nbsp;)</FONT>
%   }
% } #svc_broadband
% if ( $curuser->access_right('Unprovision customer service') ) {
    <FONT SIZE="-2">(&nbsp;<% $svc_unprovision_link %>&nbsp;)</FONT>
% }
% if ( $part_svc->svcdb eq 'svc_pbx' && $opt{'maestro-status_test'} ) {
    <FONT SIZE="-2">(&nbsp;<A HREF="<%$p%>misc/maestro-customer_status-test.html?<% $cust_pkg->custnum.'+'.$cust_svc->svcnum %>">Test maestro status</A>&nbsp;)
    </FONT>
% }
  </TD>
</TR>

<%init>
my %opt = @_;
my $curuser = $FS::CurrentUser::CurrentUser;

my $cust_svc = $opt{'cust_svc'};
my $part_svc = $opt{'part_svc'} || $cust_svc->part_svc;
my $cust_pkg = $opt{'cust_pkg'} || $cust_svc->cust_pkg;
my $svc_x = $cust_svc->svc_x;

my $svc_unprovision_link = 
  qq!<A HREF="javascript:areyousure('${p}misc/unprovision.cgi?! .
  $cust_svc->svcnum .
  qq!', '!.emt('Permanently unprovision and delete this service?').qq!')">!.emt('Unprovision').'</A>';

my $manage_link = $opt{'manage_link'};
my $manage_target = '';
if ( $part_svc->svcdb eq 'svc_broadband' and $manage_link ) {
  my $ip_addr = $svc_x->ip_addr; #substitution for $manage_link
  $manage_link = eval(qq("$manage_link"));
  $opt{'manage_link_text'} ||= mt('Manage Device');
  $opt{'manage_link_loc'}  ||= 'bottom';
  $manage_target = ' target="_blank"' if $opt{'manage_link-new_window'};
}
else {
  $manage_link = '';
}

</%init>