From 530b42f465b0ab31fbb4c2754d0e385b330f3b5f Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 17 Dec 2007 01:00:29 +0000 Subject: add cust_main-require_address2 config, reimplement address2-search config ("Unit #" search in searchbar), visual indication of require_invoicing_list_email, closes: RT#2926 --- httemplate/edit/cust_main.cgi | 85 ++++++++++++++++++++------------- httemplate/edit/cust_main/billing.html | 4 +- httemplate/edit/cust_main/contact.html | 18 ++++++- httemplate/elements/header.html | 29 ++++++++--- httemplate/search/cust_main.cgi | 5 +- httemplate/view/cust_main/contacts.html | 19 ++++++-- 6 files changed, 111 insertions(+), 49 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 5ab605f5d..9b3d7b6b9 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -203,13 +203,31 @@ +% my $same_checked = ''; +% my $ship_disabled = ''; +% unless ( $cust_main->ship_last && $same ne 'Y' ) { +% $same_checked = 'CHECKED'; +% $ship_disabled = 'DISABLED STYLE="background-color: #dddddd"'; +% foreach ( +% qw( last first company address1 address2 city county state zip country +% daytime night fax ) +% ) { +% $cust_main->set("ship_$_", $cust_main->get($_) ); +% } +% } +

Billing address -<% include('cust_main/contact.html', $cust_main, '', 'bill_changed(this)', '', 'ss' => $ss, 'stateid' => $stateid ) %> - - -% if ( defined $cust_main->dbdef_table->column('ship_last') ) { - +<% include('cust_main/contact.html', + 'cust_main' => $cust_main, + 'pre' => '', + 'onchange' => 'bill_changed(this)', + 'disabled' => '', + 'ss' => $ss, + 'stateid' => $stateid, + 'same_checked' => $same_checked, #for address2 "Unit #" labeling + ) +%> -% -% my $checked = ''; -% my $disabled = ''; -% my $disabledselect = ''; -% unless ( $cust_main->ship_last && $same ne 'Y' ) { -% $checked = 'CHECKED'; -% $disabled = 'DISABLED STYLE="background-color: #dddddd"'; -% foreach ( -% qw( last first company address1 address2 city county state zip country -% daytime night fax ) -% ) { -% $cust_main->set("ship_$_", $cust_main->get($_) ); -% } -% } -% -
Service address -(>same as billing address) -<% include('cust_main/contact.html', $cust_main, 'ship_', '', $disabled ) %> -% } +(>same as billing address) +<% include('cust_main/contact.html', + 'cust_main' => $cust_main, + 'pre' => 'ship_', + 'onchange' => '', + 'disabled' => $ship_disabled, + ) +%> diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 0b16f65b0..68d7437e5 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -426,7 +426,9 @@ % } - Email invoice + + <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es) + % if ( $conf->exists('voip-cust_cdr_spools') ) { diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index ac0debd12..fdc518e54 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -32,8 +32,16 @@ +% my $address2_label_style = +% ( $disabled +% || ! $conf->exists('cust_main-require_address2') +% || ( !$pre && !$opt{'same_checked'} ) +% ) +% ? 'visibility:hidden' +% : ''; + -   + * Unit # > @@ -106,7 +114,13 @@ <%init> -my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_; +#my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_; +my %opt = @_; +my $cust_main = $opt{'cust_main'}; +my $pre = $opt{'pre'}; +my $onchange = $opt{'onchange'}; +my $disabled = $opt{'disabled'}; + my $conf = new FS::Conf; foreach (qw(ss stateid)) { diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index b78789ed4..54cf6e9cd 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -19,6 +19,11 @@ what.value = ''; } + function clearhint_search_address2 (what) { + if ( what.value == '(Unit #)' ) + what.value = ''; + } + function clearhint_search_invoice (what) { if ( what.value == '(inv #)' ) what.value = ''; @@ -113,14 +118,14 @@ input.fsblackbuttonselected { - + % if ( $menu_position eq 'top' ) { - - - @@ -156,21 +161,31 @@ input.fsblackbuttonselected { + + + % if ( $cust_main->get("${pre}address2") ) { +% my $address2_label = +% ( $conf->exists('cust_main-require_address2') +% # && ( ( !$which && !$cust_main->has_ship_address ) +% # || ( $which && $cust_main->has_ship_address ) +% # ) +% && ! ( $which xor $cust_main->has_ship_address ) +% ) +% ? 'Unit #' +% : ' '; + + + + + - - - - % } -- cgit v1.2.1
+ @@ -129,12 +134,12 @@ input.fsblackbuttonselected {
+
+
+% if ( $conf->exists('address2-search') ) { +
+ + +
+ +
+% } +
% if ( $FS::CurrentUser::CurrentUser->access_right('View invoices') ) {
-% if ( $FS::CurrentUser::CurrentUser->access_right('List invoices') ) { +% if ( $FS::CurrentUser::CurrentUser->access_right('List invoices') ) { Advanced -% } +% }
% } -
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b0f657fbb..1ddafae0b 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -688,9 +688,8 @@ % { 'address2' => { 'op' => 'ILIKE', % 'value' => $address2 } } ); % push @cust_main, qsearch( 'cust_main', -% { 'address2' => { 'op' => 'ILIKE', -% 'value' => $address2 } } ) -% if defined dbdef->table('cust_main')->column('ship_last'); +% { 'ship_address2' => { 'op' => 'ILIKE', +% 'value' => $address2 } } ); % % \@cust_main; %} diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index b14769f78..52754d4cb 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -25,12 +25,23 @@ Address <% $cust_main->get("${pre}address1") %>
<% $address2_label %><% $cust_main->get("${pre}address2") %>
 <% $cust_main->get("${pre}address2") %>