From 83f70978574fef3401020cb11cf651d12c139b3b Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sat, 24 Mar 2012 18:47:07 -0700 Subject: better display/edit of contacts on customer view, RT#16819 --- httemplate/view/cust_main.cgi | 5 ++ httemplate/view/cust_main/billing.html | 16 ++-- httemplate/view/cust_main/contacts.html | 119 ++++++++++++++-------------- httemplate/view/cust_main/contacts_new.html | 37 +++++++-- httemplate/view/cust_main/misc.html | 4 +- 5 files changed, 107 insertions(+), 74 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index dcadf9912..fda4db0d9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -150,6 +150,11 @@ function areyousure(href, message) { + + + <& cust_main/contacts_new.html, $cust_main &> + + % } diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index f1add6fcc..522c6db86 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -1,4 +1,4 @@ -<% mt('Billing information') |h %> +<% mt('Billing information') |h %> %# If we can't see the unencrypted card, then bill now is an exercise in %# frustration (without some sort of job queue magic to send it to a secure %# machine, anyway) @@ -6,14 +6,14 @@ % && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { %# (<% mt('Bill now') |h %>) - (<& /elements/bill.html, - custnum => $cust_main->custnum, - label => emt('Bill now'), - url => $p.'view/cust_main.cgi?'.$cust_main->custnum, - &>) + <& /elements/bill.html, + custnum => $cust_main->custnum, + label => emt('Bill now'), + url => $p.'view/cust_main.cgi?'.$cust_main->custnum, + &> % } -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> + %( my $balance = $cust_main->balance ) % =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; @@ -285,7 +285,7 @@ % } -
+ <%once> my $paystate_label = FS::Msgcat::_gettext('paystate'); diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 68e3b17ad..b3e52b556 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -5,8 +5,8 @@ % foreach my $which ( '', 'ship_' ) { % my $pre = $cust_main->get("${which}last") ? $which : ''; -<% $which{$which} %> <% mt('address') |h %> -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> +<% $which{$which} %> <% mt('address') |h %> + % } + % if ( $conf->exists('cust-email-high-visibility') && $which eq '') { - - - - + + + + % } - - - - + +% if ( $cust_main->get("${pre}company") ) { + + + + +% } + @@ -74,42 +79,30 @@ &> % } - - - - - - - - - - - - - - - - +% foreach my $phone (grep $cust_main->get($pre.$_), qw( daytime night mobile )){ + + + + + + +% } + +% if ( $cust_main->get("${pre}fax") ) { + + + + +% } + % if ( $which eq '' && $conf->exists('show_stateid') ) { @@ -118,23 +111,31 @@ % } -
<% mt('Contact name') |h %> @@ -17,18 +17,23 @@ <% $cust_main->masked('ss') || ' ' %>
<% mt('Email invoices') |h %> - <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %> -
<% mt('Email invoices') |h %> + <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %> +
<% mt('Company') |h %><% $cust_main->get("${pre}company") |h %>
<% mt('Company') |h %><% $cust_main->get("${pre}company") |h %>
<% mt('Address') |h %> <% $cust_main->get("${pre}address1") |h %>
<% $daytime_label %> - <& /elements/phonenumber.html, - $cust_main->get("${pre}daytime"), - 'callable'=>1, - 'calling_list_exempt'=>$cust_main->calling_list_exempt, - &> -
<% $night_label %> - <& /elements/phonenumber.html, - $cust_main->get("${pre}night"), - 'callable'=>1, - 'calling_list_exempt'=>$cust_main->calling_list_exempt, - &> -
<% $mobile_label %> - <& /elements/phonenumber.html, - $cust_main->get("${pre}mobile"), - 'callable'=>1, - 'calling_list_exempt'=>$cust_main->calling_list_exempt, - &> -
<% mt('Fax') |h %> - <% $cust_main->get("${pre}fax") || ' ' %> -
<% $phone_label{$phone} %> + <& /elements/phonenumber.html, + $cust_main->get($pre.$phone), + 'callable'=>1, + 'calling_list_exempt'=>$cust_main->calling_list_exempt, + &> +
<% mt('Fax') |h %> + <% $cust_main->get("${pre}fax") || ' ' %> +
<% $stateid_label %><% $cust_main->stateid_state || ' ' %>
+ + % if ( $which ne 'ship_' ) {
% } % } -<& contacts_new.html, $cust_main &> <%once> -my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ - ? 'Day Phone' - : FS::Msgcat::_gettext('daytime'); -my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ - ? 'Night Phone' - : FS::Msgcat::_gettext('night'); -my $mobile_label = FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/ - ? 'Mobile Phone' - : FS::Msgcat::_gettext('Mobile'); +my %phone_label = ( + + 'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day Phone' + : FS::Msgcat::_gettext('daytime') + ), + + 'night' => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/ + ? 'Night Phone' + : FS::Msgcat::_gettext('night') + ), + + 'mobile' => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/ + ? 'Mobile Phone' + : FS::Msgcat::_gettext('Mobile') + ), +); my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ ? 'Driver’s License' diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index bd812c7e7..155490fe1 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -1,17 +1,44 @@ -% if ( @contacts ) {
-Contacts -<% ntable("#cccccc",2) %> +Contacts +Edit contacts + % foreach my $contact ( @contacts ) { +% #XXX maybe this should be a table with alternating colors instead - + + +% my @contact_email = $contact->contact_email; +% if (@contact_email) { + + +% } + +% foreach my $phone_type (@phone_type) { +% my $contact_phone = +% qsearchs('contact_phone', { +% 'contactnum' => $contact->contactnum, +% 'phonetypenum' => $phone_type->phonetypenum, +% }) +% or next; + + +% } + +% if ( $contact->comment ) { + + + +% } + % }
Contact<% $contact->contact_classname %> Contact <% $contact->line %>   Email<% join(', ', map $_->emailaddress, @contact_email) %>   <% $phone_type->typename %> phone<% $contact_phone->phonenum |h %>   Comment<% $contact->comment |h %>
+<%once> -% } +my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'}); + <%init> my( $cust_main ) = @_; diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 28414ef2d..295328721 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -1,4 +1,4 @@ -<% ntable("#cccccc") %><% &ntable("#cccccc",2) %> + @@ -150,7 +150,7 @@ <% $cust_main->pvf($_)->widget('HTML', 'view', $cust_main->getfield($_)) %> % } -
<% mt('Customer number') |h %>
+ <%init> my( $cust_main ) = @_; -- cgit v1.2.1