bd213d1dd558c6f8845d3adeefba652690bbb9cf
[freeside.git] / httemplate / view / cust_main / contacts_new.html
1 % if ( $display and @cust_contacts ) {
2 <BR>
3 <FONT CLASS="fsinnerbox-title">Contacts</FONT>
4
5 <& /elements/table-grid.html &>
6 <THEAD>
7 % my $th = '<TH CLASS="grid" ALIGN="left">';
8 <TR>
9   <%$th%>Type</TH>
10   <%$th%>Contact</TH>
11   <%$th%>Email</TH>
12   <%$th%>Send invoices</TH>
13   <%$th%>Send messages</TH>
14   <%$th%>Self-service</TH>
15 % foreach my $phone_type (@phone_type) {
16     <%$th%><% $phone_type->typename |h %></TH>
17 % }
18   <%$th%>Comment</TH>
19 </TR>
20 </THEAD>
21
22 %   my $bgcolor1 = '#ffffff';
23 %   my $bgcolor2 = '#eeeeee';
24 %   my $bgcolor = $bgcolor2;
25 %   my $count = 0;
26 %   foreach my $cust_contact ( @cust_contacts ) {
27 %     my $contact = $cust_contact->contact;
28 %     my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
29
30       <TR>
31         <%$td%><% $cust_contact->contact_classname |h %></TD>
32         <%$td%><% $contact->line |h %></TD>
33
34 %       my @contact_email = $contact->contact_email;
35         <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
36         <%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %></TD>
37         <%$td%><% $cust_contact->message_dest eq 'Y' ? 'Yes' : 'No' %></TD>
38         <%$td%>
39 %         if ( $cust_contact->selfservice_access ) {
40             Enabled
41 %#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
42 %#                            <A HREF="XXX">re-email</A></FONT>
43             <FONT SIZE="-1">
44               <& /elements/change_password.html,
45                 'contact_num'      => $cust_contact->contactnum,
46                 'custnum'          => $cust_contact->custnum,
47                 'no_label_display' => '',
48                 'label'            => 'change password',
49                 'curr_value'       => '',
50                 'pre_pwd_field_label' => 'contact'.$count.'_',
51               &>
52             </FONT>
53 %         } else {
54             Disabled
55 %#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
56 %        }
57        </TD>
58
59 %       foreach my $phone_type (@phone_type) {
60 %         my $contact_phone =
61 %           qsearchs('contact_phone', {
62 %                      'contactnum'   => $contact->contactnum,
63 %                      'phonetypenum' => $phone_type->phonetypenum,
64 %                   });
65           <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
66 %       }
67
68         <%$td%><% $cust_contact->comment |h %></TD>
69
70       </TR>
71
72 %     if ( $bgcolor eq $bgcolor1 ) {
73 %        $bgcolor = $bgcolor2;
74 %      } else {
75 %        $bgcolor = $bgcolor1;
76 %      }
77 %     $count++;
78 %   }
79 </TABLE>
80 %}
81 <%once>
82
83 my @phone_type = FS::phone_type->get_phone_types();
84
85 </%once>
86 <%init>
87
88 my( $cust_main ) = @_;
89 #my $conf = new FS::Conf;
90
91 my @cust_contacts = $cust_main->cust_contact;
92
93 # residential customers have a default "invisible" contact, but if they
94 # somehow get more than one contact, show them
95 my $display = scalar(@cust_contacts) > 0;
96
97 </%init>