Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE...
[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 %   my $count = 0;
25 %   foreach my $cust_contact ( @cust_contacts ) {
26 %     my $contact = $cust_contact->contact;
27 %     my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
28
29       <TR>
30         <%$td%><% $cust_contact->contact_classname |h %></TD>
31         <%$td%><% $contact->line |h %></TD>
32
33 %       my @contact_email = $contact->contact_email;
34         <%$td%><% join(', ', map $_->emailaddress, @contact_email) %></TD>
35         <%$td%><% $cust_contact->invoice_dest eq 'Y' ? 'Yes' : 'No' %></TD>
36         <%$td%>
37 %         if ( $cust_contact->selfservice_access ) {
38             Enabled
39 %#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
40 %#                            <A HREF="XXX">re-email</A></FONT>
41             <FONT SIZE="-1">
42               <& /elements/change_password.html,
43                 'contact_num'      => $cust_contact->contactnum,
44                 'custnum'          => $cust_contact->custnum,
45                 'no_label_display' => '',
46                 'label'            => 'change password',
47                 'curr_value'       => '',
48                 'pre_pwd_field_label' => 'contact'.$count.'_',
49               &>
50             </FONT>
51 %         } else {
52             Disabled
53 %#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
54 %        }
55        </TD>
56
57 %       foreach my $phone_type (@phone_type) {
58 %         my $contact_phone =
59 %           qsearchs('contact_phone', {
60 %                      'contactnum'   => $contact->contactnum,
61 %                      'phonetypenum' => $phone_type->phonetypenum,
62 %                   });
63           <%$td%><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
64 %       }
65
66         <%$td%><% $cust_contact->comment |h %></TD>
67
68       </TR>
69
70 %     if ( $bgcolor eq $bgcolor1 ) {
71 %        $bgcolor = $bgcolor2;
72 %      } else {
73 %        $bgcolor = $bgcolor1;
74 %      }
75 %     $count++;
76 %   }
77 </TABLE>
78 %}
79 <%once>
80
81 my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
82
83 </%once>
84 <%init>
85
86 my( $cust_main ) = @_;
87 #my $conf = new FS::Conf;
88
89 my @cust_contacts = $cust_main->cust_contact;
90
91 # residential customers have a default "invisible" contact, but if they
92 # somehow get more than one contact, show them
93 my $display = scalar(@cust_contacts) > 0;
94
95 </%init>