X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Ftop_misc.html;h=c19f347c3297b6cb32372002b148210bdc669c33;hb=622c72770c971ae44d37dfb59a0f25972051a25a;hp=e25506f52af1d8399a4fb481d7227ebdf9c5ff75;hpb=d1b6cd3f7c583041bc21a799069059a746b28476;p=freeside.git diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index e25506f52..c19f347c3 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -27,18 +27,22 @@ if ( what.checked == (what.value == 'Commercial' ) ) { document.getElementById('company_row').style.display = ''; document.getElementById('contacts_div').style.display = ''; + document.getElementById('spouse_row').style.display = 'none'; } else { if ( document.getElementById('company').value.length == 0 ) { document.getElementById('company_row').style.display = 'none'; } document.getElementById('contacts_div').style.display = 'none'; + document.getElementById('spouse_row').style.display = ''; } } var ship_locked_agents = <% encode_json(\%ship_locked_agents) %>; - var ship_fields = ['address1', 'city', 'state', 'zip', 'country', - 'latitude', 'longitude', 'district']; + var ship_fields = [ + 'locationname', 'address1',<% $conf->exists('cust_main-no_city_in_address') ? '' : q( 'city',) %> 'state', 'zip', 'country', + 'latitude', 'longitude', 'district' + ]; function agent_changed(what) { var agentnum = what.value; @@ -79,6 +83,7 @@ } <&| /elements/onload.js &> + rescom_changed(document.getElementById('residential_commercial_Residential')); agent_changed(document.getElementById('agentnum')) @@ -236,6 +241,8 @@ my( $cust_main, %opt ) = @_; my $custnum = $opt{'custnum'}; +my $conf = new FS::Conf; + if ( $cgi->param('error') ) { $cust_main->set('residential_commercial', ($cgi->param('residential_commercial') eq 'Commercial') @@ -249,12 +256,13 @@ if ( $cgi->param('error') ) { : 'Residential' ); } else { #new customer - #config to default to commercial and/or disable residential when someone needs - $cust_main->set('residential_commercial', 'Residential'); + $cust_main->set('residential_commercial', + $conf->exists('cust_main-default_commercial') + ? 'Commercial' + : 'Residential' + ); } -my $conf = new FS::Conf; - my $curuser = $FS::CurrentUser::CurrentUser; my $r = qq!* !; @@ -268,7 +276,10 @@ foreach (qsearch('agent',{})) { my $agent_ship_location = $cust_main->ship_location; $ship_locked_agents{$agentnum} = +{ map { $_ => $agent_ship_location->$_ } - qw(address1 city state zip country latitude longitude district) + ( + qw(locationname address1 state zip country latitude longitude district), + ($conf->exists('cust_main-no_city_in_address') ? () : 'city') + ) }; }