add latitude/longitude to prospects, customers and package locations, RT#15539
[freeside.git] / httemplate / view / cust_main / contacts.html
index 4837155..3d4043a 100644 (file)
-<%
-  my( $cust_main ) = @_;
-  my $conf = new FS::Conf;
-%>
+% my %which = (
+%   ''      => emt('Billing'),
+%   'ship_' => emt('Service'),
+% );
+% foreach my $which ( '', 'ship_' ) {
+%   my $pre = $cust_main->get("${which}last") ? $which : '';
 
-Billing address
-<%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
+<% $which{$which} %> <% mt('address') |h %>
+<% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
 <TR>
-  <TD ALIGN="right">Contact&nbsp;name</TD>
-  <TD COLSPAN=3 BGCOLOR="#ffffff">
-    <%= $cust_main->last. ', '. $cust_main->first %>
+  <TD ALIGN="right"><% mt('Contact name') |h %></TD>
+  <TD COLSPAN=5 BGCOLOR="#ffffff">
+    <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %>
   </TD>
-<% if ( $conf->exists('show_ss') ) { %>
-  <TD ALIGN="right">SS#</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->ss || '&nbsp' %></TD>
-<% } %>
-</TR>
-<TR>
-  <TD ALIGN="right">Company</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->company %></TD>
-</TR>
-<TR>
-  <TD ALIGN="right">Address</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->address1 %></TD>
-</TR>
-<% if ( $cust_main->address2 ) { %>
-<TR>
-  <TD ALIGN="right">&nbsp;</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->address2 %></TD>
-</TR>
-<% } %>
-<TR>
-  <TD ALIGN="right">City</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->city %></TD>
-  <TD ALIGN="right">State</TD>
-  <TD BGCOLOR="#ffffff"><%= state_label($cust_main->state, $cust_main->country) %></TD>
-  <TD ALIGN="right">Zip</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->zip %></TD>
-</TR>
-<TR>
-  <TD ALIGN="right">Country</TD>
-  <TD BGCOLOR="#ffffff"><%= code2country($cust_main->country) %></TD>
+% if ( $which eq '' && $conf->exists('show_ss') ) { 
+    <TD ALIGN="right"><% mt('SS#') |h %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->masked('ss') || '&nbsp' %></TD>
+% } 
 </TR>
-<%
-  my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
-                        ? 'Day&nbsp;Phone'
-                        : FS::Msgcat::_gettext('daytime');
-  my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
-                        ? 'Night&nbsp;Phone'
-                        : FS::Msgcat::_gettext('night');
-%>
+% if ( $conf->exists('cust-email-high-visibility') && $which eq '') {
 <TR>
-  <TD ALIGN="right"><%= $daytime_label %></TD>
-  <TD COLSPAN=6 BGCOLOR="#ffffff">
-    <%= include('/elements/phonenumber.html',
-                  $cust_main->daytime,
-                  'callable'=>1
-               )
-    %>
+  <TD ALIGN="right"><% mt('Email invoices') |h %></TD>
+  <TD BGCOLOR="#ffff00">
+    <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %>
   </TD>
 </TR>
+% }
 <TR>
-  <TD ALIGN="right"><%= $night_label %></TD>
-  <TD COLSPAN=6 BGCOLOR="#ffffff">
-    <%= include('/elements/phonenumber.html',
-                  $cust_main->night,
-                  'callable'=>1
-               )
-    %>
-  </TD>
+  <TD ALIGN="right"><% mt('Company') |h %></TD>
+  <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") |h %></TD>
 </TR>
 <TR>
-  <TD ALIGN="right">Fax</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->fax || '&nbsp' %>
-  </TD>
+  <TD ALIGN="right"><% mt('Address') |h %></TD>
+  <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") |h %></TD>
 </TR>
-</TABLE></TD></TR></TABLE>
 
-<% if ( defined $cust_main->dbdef_table->column('ship_last') ) {
-     my $pre = $cust_main->ship_last ? 'ship_' : '';
-%>
+% if ( $cust_main->get("${pre}address2") ) { 
+%   my $address2_label =
+%     ( $conf->exists('cust_main-require_address2')
+%       && ! ( $pre xor $cust_main->has_ship_address )
+%     )
+%       ? emt('Unit #')
+%       : ' ';
+
+  <TR>
+    <TD ALIGN="right"><% $address2_label %></TD>
+    <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") |h %></TD>
+  </TR>
+
+% } 
 
-<BR>
-Service address
-<%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
-<TR>
-  <TD ALIGN="right">Contact name</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") %>
-  </TD>
-</TR>
-<TR>
-  <TD ALIGN="right">Company</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->get("${pre}company") %></TD>
-</TR>
-<TR>
-  <TD ALIGN="right">Address</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->get("${pre}address1") %></TD>
-</TR>
-<% if ( $cust_main->get("${pre}address2") ) { %>
-<TR>
-  <TD ALIGN="right">&nbsp;</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff"><%= $cust_main->get("${pre}address2") %></TD>
-</TR>
-<% } %>
 <TR>
-  <TD ALIGN="right">City</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->get("${pre}city") %></TD>
-  <TD ALIGN="right">State</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->get("${pre}state") %></TD>
-  <TD ALIGN="right">Zip</TD>
-  <TD BGCOLOR="#ffffff"><%= $cust_main->get("${pre}zip") %></TD>
+  <TD ALIGN="right"><% mt('City') |h %></TD>
+  <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") |h %></TD>
+% if ( $cust_main->get("${pre}county") ) {
+    <TD ALIGN="right"><% mt('County') |h %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") |h %></TD>
+% }
+  <TD ALIGN="right"><% mt('State') |h %></TD>
+  <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %></TD>
+  <TD ALIGN="right"><% mt('Zip') |h %></TD>
+  <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD>
 </TR>
 <TR>
-  <TD ALIGN="right">Country</TD>
-  <TD BGCOLOR="#ffffff"><%= code2country( $cust_main->get("${pre}country") ) %></TD>
+  <TD ALIGN="right"><% mt('Country') |h %></TD>
+  <TD BGCOLOR="#ffffff"><% code2country( $cust_main->get("${pre}country") ) %></TD>
 </TR>
+
+% if ( $cust_main->get($pre.'latitude') && $cust_main->get($pre.'longitude') ) {
+  <& /elements/tr-coords.html, $cust_main->get($pre.'latitude'),
+                               $cust_main->get($pre.'longitude'),
+                               $cust_main->name_short,
+  &>
+% }
+
 <TR>
-  <TD ALIGN="right"><%= $daytime_label %></TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= include('/elements/phonenumber.html',
+  <TD ALIGN="right"><% $daytime_label %></TD>
+  <TD COLSPAN=3 BGCOLOR="#ffffff">
+    <& /elements/phonenumber.html,
                   $cust_main->get("${pre}daytime"),
-                  'callable'=>1
-               )
-    %>
+                  'callable'=>1,
+                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
+    &>
   </TD>
 </TR>
 <TR>
-  <TD ALIGN="right"><%= $night_label %></TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= include('/elements/phonenumber.html',
+  <TD ALIGN="right"><% $night_label %></TD>
+  <TD COLSPAN=3 BGCOLOR="#ffffff">
+    <& /elements/phonenumber.html,
                   $cust_main->get("${pre}night"),
-                  'callable'=>1
-               )
-    %>
+                  'callable'=>1,
+                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
+    &>
   </TD>
 </TR>
 <TR>
-  <TD ALIGN="right">Fax</TD>
-  <TD COLSPAN=5 BGCOLOR="#ffffff">
-    <%= $cust_main->get("${pre}fax") || '&nbsp' %>
+  <TD ALIGN="right"><% $mobile_label %></TD>
+  <TD COLSPAN=3 BGCOLOR="#ffffff">
+    <& /elements/phonenumber.html,
+                  $cust_main->get("${pre}mobile"),
+                  'callable'=>1,
+                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
+    &>
+  </TD>
+</TR>
+<TR>
+  <TD ALIGN="right"><% mt('Fax') |h %></TD>
+  <TD COLSPAN=3 BGCOLOR="#ffffff">
+    <% $cust_main->get("${pre}fax") || '&nbsp' %>
   </TD>
 </TR>
+% if ( $which eq '' && $conf->exists('show_stateid') ) { 
+  <TR>
+    <TD ALIGN="right"><% $stateid_label %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
+    <TD ALIGN="right"><% $stateid_state_label %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
+  </TR>
+% } 
 </TABLE></TD></TR></TABLE>
+% if ( $which ne 'ship_' ) {
+<BR>
+% }
+% } 
+<& contacts_new.html, $cust_main &>
+<%once>
+
+my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
+                      ? 'Day&nbsp;Phone'
+                      : FS::Msgcat::_gettext('daytime');
+my $night_label   = FS::Msgcat::_gettext('night') =~ /^(night)?$/
+                      ? 'Night&nbsp;Phone'
+                      : FS::Msgcat::_gettext('night');
+my $mobile_label = FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/
+                      ? 'Mobile&nbsp;Phone'
+                      : FS::Msgcat::_gettext('Mobile');
+
+my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
+                      ? 'Driver&rsquo;s&nbsp;License'
+                      : FS::Msgcat::_gettext('stateid');
+my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
+                      ? 'Driver&rsquo;s&nbsp;License State'
+                      : FS::Msgcat::_gettext('stateid_state');
+
+</%once>
+<%init>
+
+my( $cust_main ) = @_;
+my $conf = new FS::Conf;
+my @invoicing_list = $cust_main->invoicing_list;
+my $no = emt('no');
+
+</%init>
 
-<% } %>