94488670df7f7e9a8af76767f15727b480c1073f
[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%>Self-service</TH>
14 % foreach my $phone_type (@phone_type) {
15     <%$th%><% $phone_type->typename |h %></TH>
16 % }
17   <%$th%>Comment</TH>
18 </TR>
19 </THEAD>
20
21 %   my $bgcolor1 = '#ffffff';
22 %   my $bgcolor2 = '#eeeeee';
23 %   my $bgcolor = $bgcolor2;
24 %   foreach my $cust_contact ( @cust_contacts ) {
25 %     my $contact = $cust_contact->contact;
26 %     my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
27
28       <TR>
29         <%$td%><% $cust_contact->contact_classname |h %></TD>
30         <%$td%><% $contact->line |h %></TD>
31
32 %       my @contact_email = $contact->contact_email;
33         <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
34         <%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %></TD>
35         <%$td%>
36 %         if ( $cust_contact->selfservice_access ) {
37             Enabled
38 %#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
39 %#                            <A HREF="XXX">re-email</A></FONT>
40 %         } else {
41             Disabled
42 %#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
43 %        }
44        </TD>
45
46 %       foreach my $phone_type (@phone_type) {
47 %         my $contact_phone =
48 %           qsearchs('contact_phone', {
49 %                      'contactnum'   => $contact->contactnum,
50 %                      'phonetypenum' => $phone_type->phonetypenum,
51 %                   });
52           <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
53 %       }
54
55         <%$td%><% $cust_contact->comment |h %></TD>
56
57       </TR>
58
59 %     if ( $bgcolor eq $bgcolor1 ) {
60 %        $bgcolor = $bgcolor2;
61 %      } else {
62 %        $bgcolor = $bgcolor1;
63 %      }
64 %   }
65 </TABLE>
66 %}
67 <%once>
68
69 my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
70
71 </%once>
72 <%init>
73
74 my( $cust_main ) = @_;
75 #my $conf = new FS::Conf;
76
77 my @cust_contacts = $cust_main->cust_contact;
78
79 # residential customers have a default "invisible" contact, but if they
80 # somehow get more than one contact, show them
81 my $display = scalar(@cust_contacts) > 1;
82
83 </%init>