X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbasics.html;h=32a03bbe61870aec5a60b9dc64051f0458e3f471;hp=91868d4a88de3698bdfa1d08149a45ee27e8bad9;hb=9aee669886202be7035e6c6049fc71bc99dd3013;hpb=7516e3da0f17eeecba27219ef96a8b5f46af2083 diff --git a/httemplate/edit/cust_main/basics.html b/httemplate/edit/cust_main/basics.html index 91868d4a8..32a03bbe6 100644 --- a/httemplate/edit/cust_main/basics.html +++ b/httemplate/edit/cust_main/basics.html @@ -25,22 +25,28 @@ function rescom_changed(what) { 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'; + $('#company_label').slideDown(); + $('#company_input').slideDown(); + $('#contacts_div').slideDown(); + $('#spouse_label').slideUp(); + $('#spouse_last_input').slideUp(); + $('#spouse_first_input').slideUp(); } else { if ( document.getElementById('company').value.length == 0 ) { - document.getElementById('company_row').style.display = 'none'; + $('#company_label').slideUp(); + $('#company_input').slideUp(); } - document.getElementById('contacts_div').style.display = 'none'; - document.getElementById('spouse_row').style.display = ''; + $('#contacts_div').slideUp(); + $('#spouse_label').slideDown(); + $('#spouse_last_input').slideDown(); + $('#spouse_first_input').slideDown(); } } var ship_locked_agents = <% encode_json(\%ship_locked_agents) %>; var ship_fields = [ - 'locationname', 'address1', 'city', 'state', 'zip', 'country', + 'locationname', 'address1',<% $conf->exists('cust_main-no_city_in_address') ? '' : q( 'city',) %> 'state', 'zip', 'country', 'latitude', 'longitude', 'district' ]; @@ -50,6 +56,7 @@ % # unlock/lock service location var f = what.form; + var was_same = f['same'].checked; if ( ship_locked_agents[agentnum] ) { % # For this agent, the service location (except address2) % # should be locked to the agent's location. @@ -66,16 +73,25 @@ % # disabled, then they contain some agent's address, which is % # no longer meaningful. So set them back to the customer's % # current location. + var is_same = true; for(var i=0; i - agent_changed(document.getElementById('agentnum')) + rescom_changed(document.getElementById('residential_commercial_Residential')); + agent_changed(document.getElementById('agentnum')); + + if ( $('#same').prop('checked') ) { + $('#div_ship_location').hide(); + } else { + $('#div_ship_location').show(); + } + @@ -108,7 +132,7 @@ - <% mt('Agent') |h %> + <% mt('Agent') |h %> <% $cust_main->agent->agent |h %> @@ -116,7 +140,7 @@ <& /elements/tr-select-agent.html, 'curr_value' => $cust_main->agentnum, - 'label' => "${r}".emt('Agent')."", + 'label' => $r. emt('Agent'), 'empty_label' => emt('Select agent'), 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ), 'viewall_right' => emt('None'), @@ -129,7 +153,7 @@ % if ( $conf->exists('cust_main-edit_agent_custid') ) { - <% mt('Customer identifier') |h %> + <% mt('Customer identifier') |h %> @@ -155,6 +179,7 @@ %#sales person <& /elements/tr-select-sales.html, 'curr_value' => $cust_main->salesnum, + 'th' => 1, &> %# referral (advertising source) @@ -167,7 +192,7 @@ <& /elements/tr-select-part_referral.html, 'curr_value' => $refnum, - 'label' => "${r}".emt('Advertising source')."" + 'label' => $r. emt('Advertising source'), &> % } @@ -181,7 +206,7 @@ %) { - <% mt('Referring customer') |h %> + <% mt('Referring customer') |h %> <% $cust_main->referral_custnum %>: <% $referring_cust_main->name |h %> @@ -191,7 +216,7 @@ % } elsif ( ! $conf->exists('disable_customer_referrals') ) { - <% mt('Referring customer') |h %> + <% mt('Referring customer') |h %> <& /elements/search-cust_main.html, 'field_name' => 'referral_custnum', @@ -247,6 +272,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') @@ -260,12 +287,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!* !; @@ -279,7 +307,10 @@ foreach (qsearch('agent',{})) { my $agent_ship_location = $cust_main->ship_location; $ship_locked_agents{$agentnum} = +{ map { $_ => $agent_ship_location->$_ } - qw(locationname 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') + ) }; }