-% if ( @contacts ) {
<BR>
-Contacts
-<% ntable("#cccccc",2) %>
+<FONT CLASS="fsinnerbox-title">Contacts</FONT>
+<A HREF="<%$p%>edit/cust_main-contacts.html?<% $cust_main->custnum %>">Edit contacts</A>
+<TABLE CLASS="fsinnerbox">
% foreach my $contact ( @contacts ) {
+% #XXX maybe this should be a table with alternating colors instead
<TR>
- <TD ALIGN="right">Contact</TD>
+ <TD ALIGN="right"><% $contact->contact_classname %> Contact</TD>
<TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
+
+% my @contact_email = $contact->contact_email;
+% if (@contact_email) {
+ <TD ALIGN="right"> Email</TD>
+ <TD BGCOLOR="#FFFFFF"><% join(', ', map $_->emailaddress, @contact_email) %></TD>
+% }
+
+% foreach my $phone_type (@phone_type) {
+% my $contact_phone =
+% qsearchs('contact_phone', {
+% 'contactnum' => $contact->contactnum,
+% 'phonetypenum' => $phone_type->phonetypenum,
+% })
+% or next;
+ <TD ALIGN="right"> <% $phone_type->typename %> phone</TD>
+ <TD BGCOLOR="#FFFFFF"><% $contact_phone->phonenum_pretty |h %></TD>
+% }
+
</TR>
% }
</TABLE>
+<%once>
-% }
+my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
+</%once>
<%init>
my( $cust_main ) = @_;