Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / view / cust_main / contacts_new.html
1 <BR>
2 <FONT CLASS="fsinnerbox-title">Contacts</FONT>
3 <A HREF="<%$p%>edit/cust_main-contacts.html?<% $cust_main->custnum %>">Edit contacts</A>
4
5 <& /elements/table-grid.html &>
6 % my $bgcolor1 = '#eeeeee';
7 %     my $bgcolor2 = '#ffffff';
8 %     my $bgcolor = $bgcolor2;
9 % my $th = '<TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">';
10 <TR>
11   <%$th%>Type</TH>
12   <%$th%>Contact</TH>
13   <%$th%>Email</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
21 %   foreach my $cust_contact ( @cust_contacts ) {
22 %     my $contact = $cust_contact->contact;
23 %     my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
24
25       <TR>
26         <%$td%><% $cust_contact->contact_classname |h %></TD>
27         <%$td%><% $contact->line |h %></TD>
28
29 %       my @contact_email = $contact->contact_email;
30         <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
31
32         <%$td%>
33 %         if ( $cust_contact->selfservice_access ) {
34             Enabled
35 %#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
36 %#                            <A HREF="XXX">re-email</A></FONT>
37 %         } else {
38             Disabled
39 %#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
40 %        }
41        </TD>
42
43 %       foreach my $phone_type (@phone_type) {
44 %         my $contact_phone =
45 %           qsearchs('contact_phone', {
46 %                      'contactnum'   => $contact->contactnum,
47 %                      'phonetypenum' => $phone_type->phonetypenum,
48 %                   });
49           <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
50 %       }
51
52         <%$td%><% $cust_contact->comment |h %></TD>
53
54       </TR>
55
56 %     if ( $bgcolor eq $bgcolor1 ) {
57 %        $bgcolor = $bgcolor2;
58 %      } else {
59 %        $bgcolor = $bgcolor1;
60 %      }
61 %   }
62 </TABLE>
63 <%once>
64
65 my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
66
67 </%once>
68 <%init>
69
70 my( $cust_main ) = @_;
71 #my $conf = new FS::Conf;
72
73 my @cust_contacts = $cust_main->cust_contact;
74
75 </%init>