Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / view / prospect_main.html
index 6c4595d..d6bcbe7 100644 (file)
@@ -1,39 +1,44 @@
-<% include('/elements/header.html',
-             'Prospect View: '. $prospect_main->company
-          )
-%>
+<& /elements/header.html, $title &>
 
 % if ( $curuser->access_right('Edit prospect') ) { 
   <A HREF="<% $p %>edit/prospect_main.html?<% $prospectnum %>">Edit this prospect</A>
 % } 
 
-<% ntable("#cccccc",2) %>
-
-<TR>
-  <TD ALIGN="right">Prospect #</TD>
-  <TD BGCOLOR="#FFFFFF"><B><% $prospectnum %></B></TD>
-</TR>
+<TABLE CLASS="fsinnerbox">
 
-%unless ( scalar(@agentnums) == 1
-%         && !$curuser->access_right('View customers of all agents') ) {
-%  my $agent = qsearchs('agent',{ 'agentnum' => $prospect_main->agentnum } );
+%unless ( ! $prospect_main->refnum ) { # || scalar(@part_referral) == 1 ) {
+%  my $part_referral = qsearchs('part_referral',{ 'refnum' => $prospect_main->refnum } );
    <TR>
-     <TD ALIGN="right">Agent</TD>
-     <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD>
+     <TH ALIGN="right">Advertising source</TD>
+     <TD BGCOLOR="#ffffff"><% $part_referral->referral |h %></TD>
    </TR>
 %}
 
 % if ( $prospect_main->company ) { 
   <TR>
-    <TD ALIGN="right">Company</TD>
+    <TH ALIGN="right">Company</TD>
     <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
   </TR>
 % }
 
-% foreach my $contact ( $prospect_main->contact ) {
+% foreach my $prospect_contact ( $prospect_main->prospect_contact ) {
+%   my $contact = $prospect_contact->contact;
     <TR>
-      <TD ALIGN="right"><% $contact->contact_classname %> Contact</TD>
-      <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
+      <TH ALIGN="right" VALIGN="top"><% $prospect_contact->contact_classname |h %> Contact</TH>
+      <TD BGCOLOR="#FFFFFF">
+          <% $contact->line |h %><br>
+          <table>
+%         for my $row ( $contact->contact_email ) {
+            <tr><th>E-Mail:</th><td><% $row->emailaddress |h %></td></tr>
+%         }
+%         for my $row ( $contact->contact_phone ) {
+            <tr><th><% $row->phone_type->typename |h %>:</th><td><% $row->phonenum_pretty |h %></td></tr>
+%         }
+%         if ( $prospect_contact->comment ) {
+            <tr><th>Comment:</th><td><% $prospect_contact->comment |h %></td></tr>
+%         }
+          </table>
+      </TD>
     </TR>
 %}
 
@@ -42,7 +47,7 @@
 % #but only one, for now
 % foreach my $cust_location (@cust_location) {
     <TR>
-      <TD ALIGN="right">Address</TD>
+      <TH ALIGN="right">Address</TD>
       <TD BGCOLOR="#FFFFFF">
         <% $cust_location->location_label(
              'join_string'     => '<BR>',
       &>
 %   }
 % }
+% if ( my $tax_status = $prospect_main->tax_status ) {
+  <TR>
+    <TH ALIGN="right">Tax status</TD>
+    <TD BGCOLOR="#FFFFFF">
+      <B><% $tax_status->taxstatus %>:</B> <% $tax_status->description %>
+    </TD>
+  </TR>
+% }
 
 </TABLE>
 
 <BR>
 
-% if ( $curuser->access_right('Generate quotation') ) { 
-  <FONT CLASS="fsinnerbox-title"><% mt( 'Quotations' ) |h %></FONT>
-  <A HREF="<%$p%>edit/quotation.html?prospectnum=<% $prospectnum %>">New quotation</A>
-% my @quotations = $prospect_main->quotation;
-% if ( @quotations ) {
-    <& /elements/table-grid.html &>
-%     my $bgcolor1 = '#eeeeee';
-%     my $bgcolor2 = '#ffffff';
-%     my $bgcolor = '';
-      <TR>
-        <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
-        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
-      </TR>
-%     foreach my $quotation (@quotations) {
-%       if ( $bgcolor eq $bgcolor1 ) {
-%         $bgcolor = $bgcolor2;
-%       } else {
-%         $bgcolor = $bgcolor1;
-%       }
-%       my $a = qq(<A HREF="$p/view/quotation.html?quotationnum=). #"
-%               $quotation->quotationnum. '">';
-        <TR>
-          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotationnum %></A></TD>
-          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% time2str($date_format, $quotation->_date) |h %></A></TD>
-        </TR>
-%     }
-    </TABLE>
-% }
-    <BR><BR>
-% }
-
+<& /elements/quotations.html, prospect_main=>$prospect_main &>
 
 % if ( $curuser->access_right('Qualify service') ) { 
 <% include( '/elements/popup_link-prospect_main.html',
               'action'        => $p. 'misc/qual.html',
-              'label'         => 'New&nbsp;Qualification',
+              'label'         => 'New Qualification',
               'actionlabel'   => 'New Qualification',
               'color'         => '#333399',
               'prospect_main' => $prospect_main,
     <BR><BR>
 % }
 
-<!--
-<% ntable("#cccccc") %>
-
-<TR>
-  <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Tickets</FONT></TH>
-</TR>
-
-</TABLE>
--->
+%# XXX display prospect tickets
 
 <%init>
 
@@ -129,10 +104,6 @@ my $curuser = $FS::CurrentUser::CurrentUser;
 die "access denied"
   unless $curuser->access_right('View prospect');
 
-my $conf = new FS::Conf;
-
-my $date_format = $conf->config('date_format') || '%m/%d/%Y';
-
 my $prospectnum;
 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
   $prospectnum = $1;
@@ -150,6 +121,13 @@ my $prospect_main = qsearchs( {
 });
 die "Prospect not found!" unless $prospect_main;
 
+my $title = mt("Prospect"). ': '. $prospect_main->name;
+$title .= ' ('.mt('DISABLED').')'
+  if $prospect_main->disabled;
+
 my @agentnums = $curuser->agentnums;
+if (scalar(@agentnums) > 1 ) {
+  $title = encode_entities($prospect_main->agent->agent). " $title";
+}
 
 </%init>