RT#71447: OQM Service label override is not showing when provisioning or viewing...
[freeside.git] / httemplate / view / svc_acct / basics.html
1 <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
2
3 <& /view/elements/tr.html, label=> $part_svc->part_svc_column('svc')->columnlabel || mt('Service'),  value=>$part_svc->svc &>
4 % if ( $opt{cust_svc}->agent_svcid ) {
5   <& /view/elements/tr.html, label=>mt('Legacy ID'),  value=>$opt{cust_svc}->agent_svcid &>
6 % }
7 <& /view/elements/tr.html, label=> $part_svc->part_svc_column('username')->columnlabel || mt('Username'), value=>$svc_acct->username &>
8 <& /view/elements/tr.html, label=> $part_svc->part_svc_column('domsvc')->columnlabel || mt('Domain'),   value=>$domain &>
9
10 % if ( $opt{'communigate'} ) {
11   <& /view/elements/tr.html, label=>mt('Aliases'), value=>$svc_acct->cgp_aliases &>
12 %}
13
14 % if ( $svc_acct->pbxsvc ) {
15   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('pbxsvc')->columnlabel || mt('PBX'), value=>$svc_acct->pbx_title &>
16 %}
17
18 % my $show_pw = '';
19 % my $password = $svc_acct->get_cleartext_password; 
20 % if ( $password =~ /^\*\w+\* (.*)$/ ) {
21 %   $password = $1;
22 %   $show_pw .= '<I>('. mt('login disabled') .')</I> ';
23 % }
24 % if ( ! $password
25 %      && $svc_acct->_password_encryption ne 'plain'
26 %      && $svc_acct->_password
27 %    )
28 % {
29 %   $show_pw .= '<I>('. uc($svc_acct->_password_encryption). ' '.mt('encrypted').')</I>';
30 % } elsif ( $conf->exists('showpasswords') ) { 
31 %   $show_pw .= '<SPAN >'. encode_entities($password). '</PRE>';
32 % } else { 
33 %   $password = '';
34 %   $show_pw .= '<I>('. mt('hidden') .')</I>';
35 % }
36 % my $psc = $part_svc->part_svc_column('_password');
37 % if ( $psc->columnflag eq 'F' and $psc->columnvalue eq '' ) {
38 %   # show nothing
39 % } else {
40 <TR>
41   <TD ALIGN="right"><% $psc->columnlabel || mt('Password') %></TD>
42   <TD STYLE="background-color: #ffffff; white-space: nowrap">
43   <% $show_pw %>
44 %   my $curuser = $FS::CurrentUser::CurrentUser;
45 %   if ( $curuser->access_right('Provision customer service') or
46 %       ($curuser->access_right('Edit password') and
47 %       ! $part_svc->restrict_edit_password)
48 %        and $psc->columnflag ne 'F'
49 %      )
50 %   {
51   <& /elements/change_password.html,
52       'svc_acct'    => $svc_acct,
53       'curr_value'  => $password,
54   &>
55 %   }
56   </TD>
57 </TR>
58 % }
59
60 % if ( $conf->exists('security_phrase') ) {
61   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('sec_phrase')->columnlabel || mt('Security phrase'), value=>$svc_acct->sec_phrase &>
62 % } 
63
64 % if ( $svc_acct->popnum ) {
65 %   my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
66     <& /view/elements/tr.html, label=> $part_svc->part_svc_column('popnum')->columnlabel || mt('Access number'), value=>$svc_acct_pop->text &>
67 % } 
68
69 % if ( $svc_acct->sectornum && $conf->exists('svc_acct-tower_sector') ) {
70 %   my $tower_sector = $svc_acct->tower_sector;
71 %   my $link = $tower_sector->ip_addr
72 %                ? '<A HREF="http://'. $tower_sector->ip_addr. '">'
73 %                : '';
74     <& /view/elements/tr.html,
75         label =>  $part_svc->part_svc_column('sectornum')->columnlabel || mt('Tower sector'),
76         value => $link. $tower_sector->description. ($link ? '</A>' : ''),
77     &>
78 % }
79
80 <& /view/elements/tr-svc_export_machine.html,
81      'svc'      => $svc_acct,
82      'part_svc' => $part_svc,
83 &>
84
85 % if ($svc_acct->uid ne '') { 
86   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('uid')->columnlabel || mt('UID'), value=>$svc_acct->uid &>
87 % } 
88
89 % if ($svc_acct->gid ne '') { 
90   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('gid')->columnlabel || mt('GID'), value=>$svc_acct->gid &>
91 % } 
92
93 % if ($svc_acct->finger ne '') { 
94   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('finger')->columnlabel || mt('Real Name'), value=>$svc_acct->finger &>
95 % } 
96
97 % if ($svc_acct->dir ne '') { 
98   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('dir')->columnlabel || mt('Home directory'), value=>$svc_acct->dir &>
99 % } 
100
101 % if ($svc_acct->shell ne '') { 
102   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('shell')->columnlabel || mt('Shell'), value=>$svc_acct->shell &>
103 % } 
104
105 % if ($svc_acct->quota ne '' && ! $opt{'communigate'} ) { 
106
107   <& /view/elements/tr.html, label=> $part_svc->part_svc_column('quota')->columnlabel || mt('Quota'), value=>$svc_acct->quota &>
108
109 % } elsif ( $opt{'communigate'} ) {
110
111   <& communigate.html, %opt &>
112
113 % }
114
115 <%perl>
116 # minor false laziness w/ view/svc_broadband.cgi
117 sub slipip {
118   my $svc_acct = shift;
119   my $out = $svc_acct->slipip or return '';
120   if ( $out eq '0.0.0.0' or $out eq '0e0' ) {
121     return '<I>('.mt('Dynamic').'</I>';
122   }
123   $out .= ' ('.
124           include('/elements/popup_link-ping.html', ip => $svc_acct->slipip).
125           ')';
126   if ( my $addr_block = $svc_acct->addr_block ) {
127     $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
128             '<br>Gateway: ' . $addr_block->ip_gateway;
129   }
130   $out;
131 }
132 </%perl>
133
134 % if ($svc_acct->slipip) { 
135   <& /view/elements/tr.html,
136        label=> $part_svc->part_svc_column('slipip')->columnlabel || mt('IP address'),
137        value=> slipip($svc_acct)
138   &>
139 % } 
140
141 <& usage.html, 'svc_acct' => $svc_acct &>
142
143 % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
144 %   $attribute =~ /^radius_(.*)$/;
145 %   my $pattribute = $FS::raddb::attrib{$1};
146     <& /view/elements/tr.html, label=>mt("Radius (reply) [_1]",$pattribute),
147                           value=>$svc_acct->getfield($attribute)
148     &>
149 % } 
150
151 % foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
152 %   $attribute =~ /^rc_(.*)$/;
153 %   my $pattribute = $FS::raddb::attrib{$1};
154     <& /view/elements/tr.html, label=>mt("Radius (check) [_1]",$pattribute),
155                           value=>$svc_acct->getfield($attribute)
156     &>
157 % } 
158
159 <& /view/elements/tr.html, label=> $part_svc->part_svc_column('usergroup')->columnlabel || mt('RADIUS groups'),
160     value=>join('<BR>', $svc_acct->radius_groups('long_description')) &>
161
162 <& router.html, 'svc_acct' => $svc_acct &>
163
164 %# Can this be abstracted further?  Maybe a library function like
165 %# widget('HTML', 'view', $svc_acct) ?  It would definitely make UI 
166 %# style management easier.
167 % foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { 
168   <% $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %>
169 % } 
170
171 </TABLE></TD></TR></TABLE>
172 <%init>
173
174 my %opt = @_;
175
176 my $conf = new FS::Conf;
177
178 my $svc_acct = $opt{'svc_acct'};
179 my $part_svc = $opt{'part_svc'};
180
181 die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum
182   unless $svc_acct->domsvc;
183 my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
184 die 'Unknown domain (domsvc '. $svc_acct->domsvc.
185     ' for svc_acct.svcnum '. $svc_acct->svcnum. ')'
186   unless $svc_domain;
187 my $domain = $svc_domain->domain;
188
189 </%init>