summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_main/contacts_new.html
blob: bd213d1dd558c6f8845d3adeefba652690bbb9cf (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
% if ( $display and @cust_contacts ) {
<BR>
<FONT CLASS="fsinnerbox-title">Contacts</FONT>

<& /elements/table-grid.html &>
<THEAD>
% my $th = '<TH CLASS="grid" ALIGN="left">';
<TR>
  <%$th%>Type</TH>
  <%$th%>Contact</TH>
  <%$th%>Email</TH>
  <%$th%>Send invoices</TH>
  <%$th%>Send messages</TH>
  <%$th%>Self-service</TH>
% foreach my $phone_type (@phone_type) {
    <%$th%><% $phone_type->typename |h %></TH>
% }
  <%$th%>Comment</TH>
</TR>
</THEAD>

%   my $bgcolor1 = '#ffffff';
%   my $bgcolor2 = '#eeeeee';
%   my $bgcolor = $bgcolor2;
%   my $count = 0;
%   foreach my $cust_contact ( @cust_contacts ) {
%     my $contact = $cust_contact->contact;
%     my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);

      <TR>
        <%$td%><% $cust_contact->contact_classname |h %></TD>
        <%$td%><% $contact->line |h %></TD>

%       my @contact_email = $contact->contact_email;
        <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
        <%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %></TD>
        <%$td%><% $cust_contact->message_dest eq 'Y' ? 'Yes' : 'No' %></TD>
        <%$td%>
%         if ( $cust_contact->selfservice_access ) {
            Enabled
%#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
%#                            <A HREF="XXX">re-email</A></FONT>
            <FONT SIZE="-1">
              <& /elements/change_password.html,
                'contact_num'      => $cust_contact->contactnum,
                'custnum'          => $cust_contact->custnum,
                'no_label_display' => '',
                'label'            => 'change password',
                'curr_value'       => '',
                'pre_pwd_field_label' => 'contact'.$count.'_',
              &>
            </FONT>
%         } else {
            Disabled
%#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
%        }
       </TD>

%       foreach my $phone_type (@phone_type) {
%         my $contact_phone =
%           qsearchs('contact_phone', {
%                      'contactnum'   => $contact->contactnum,
%                      'phonetypenum' => $phone_type->phonetypenum,
%                   });
          <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
%       }

        <%$td%><% $cust_contact->comment |h %></TD>

      </TR>

%     if ( $bgcolor eq $bgcolor1 ) {
%        $bgcolor = $bgcolor2;
%      } else {
%        $bgcolor = $bgcolor1;
%      }
%     $count++;
%   }
</TABLE>
%}
<%once>

my @phone_type = FS::phone_type->get_phone_types();

</%once>
<%init>

my( $cust_main ) = @_;
#my $conf = new FS::Conf;

my @cust_contacts = $cust_main->cust_contact;

# residential customers have a default "invisible" contact, but if they
# somehow get more than one contact, show them
my $display = scalar(@cust_contacts) > 0;

</%init>