X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=3910b4b8499e478fe68468ca90db9c53ca4d163a;hb=4d599c8ce382f51d7bfbb4172cdc73a2c8bd400d;hp=4a8f70540ed12702a4536f4b87f452d2f46cf03f;hpb=2041a9143fac20b79ead4a1ae01224dedf5b27c2;p=freeside.git diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 4a8f70540..3910b4b84 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -64,20 +64,23 @@ if ( $cgi->param('error') ) { $cgi->delete_all(); my $action = $custnum ? 'Edit' : 'Add'; -# top +%> -my $p1 = popurl(1); -print header("Customer $action", '', ' onUnload="myclose()"'); -print qq!Error: !, $error, "" - if $error; + -print qq!
!, - qq!!, - qq!Customer # !, ( $custnum ? "$custnum" : " (NEW)" ), - -; +<%= header("Customer $action", '', ' onUnload="myclose()"') %> + +<% if ( $error ) { %> +Error: <%= $error %> +<% } %> + + + +Customer # <%= $custnum ? "$custnum" : " (NEW)" %> -# agent + + +<% my $r = qq!* !; @@ -87,21 +90,22 @@ my @agents = qsearch( 'agent', \%agent_search ); #die "No agents created!" unless @agents; eidiot "You have not created any agents (or all agents are disabled). You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first -if ( scalar(@agents) == 1 ) { - print qq!!; -} else { - print qq!

${r}Agent "; -} + +%> + +<% if ( scalar(@agents) == 1 ) { %> + +<% } else { %> +

<%=$r%>Agent +<% } %> + +<% + +# (referral and referring customer still need to be "template"ized) #referral @@ -150,108 +154,54 @@ if ( $cust_main->referral_custnum print ''; } -# contact info - -my($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( - $cust_main->last, - $cust_main->first, - $cust_main->ss, - $cust_main->company, - $cust_main->address1, - $cust_main->address2, - $cust_main->city, - $cust_main->zip, -); - -print "

Billing address", &itable("#cccccc"), <${r}Contact name
(last, first) -END - -print < , - - -END - -if ( $conf->exists('show_ss') ) { - print qq!SS#!; -} else { - print qq!!; -} - -print < -Company -${r}Address -${r}City${r}State -END - -#false laziness with ship state -my $countrydefault = $conf->config('countrydefault') || 'US'; -$cust_main->country( $countrydefault ) unless $cust_main->country; - -my $statedefault = $conf->config('statedefault') - || ($countrydefault eq 'US' ? 'CA' : ''); -$cust_main->state( $statedefault ) - unless $cust_main->state || $cust_main->country ne $countrydefault; - -my($county_html, $state_html, $country_html) = - FS::cust_main_county::regionselector( $cust_main->county, - $cust_main->state, - $cust_main->country ); - -print "$county_html $state_html"; - -print qq!${r}Zip!; - -my($daytime,$night,$fax)=( - $cust_main->daytime, - $cust_main->night, - $cust_main->fax, -); - -my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; -my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; +%> -print <${r}Country$country_html -$daytime_label -$night_label -Fax -END + -print "${r}required fields
"; +

+Billing address +<%= include('cust_main/contact.html', $cust_main, '', 'bill_changed(this)', '' ) %> -# service address + -if ( defined $cust_main->dbdef_table->column('ship_last') ) { +<% if ( defined $cust_main->dbdef_table->column('ship_last') ) { %> - print "\n", < - function changed(what) { - what.form.same.checked = false; + -END +} + - print '
Service address ', - '(ship_last && $cgi->param('same') ne 'Y' ) { - print ' CHECKED'; + $checked = 'CHECKED'; + $disabled = 'DISABLED style="background-color: #dddddd"'; foreach ( qw( last first company address1 address2 city county state zip country daytime night fax ) @@ -259,70 +209,16 @@ END $cust_main->set("ship_$_", $cust_main->get($_) ); } } - print '>same as billing address)
'; - - my($ship_last,$ship_first,$ship_company,$ship_address1,$ship_address2,$ship_city,$ship_zip)=( - $cust_main->ship_last, - $cust_main->ship_first, - $cust_main->ship_company, - $cust_main->ship_address1, - $cust_main->ship_address2, - $cust_main->ship_city, - $cust_main->ship_zip, - ); - - print &itable("#cccccc"), <${r}Contact name
(last, first) -END - - print < , - -END - - print < - Company - ${r}Address -   - ${r}City${r}State -END - - #false laziness with regular state - $cust_main->ship_country( $countrydefault ) unless $cust_main->ship_country; - - $cust_main->ship_state( $statedefault ) - unless $cust_main->ship_state - || $cust_main->ship_country ne $countrydefault; - - my($ship_county_html, $ship_state_html, $ship_country_html) = - FS::cust_main_county::regionselector( $cust_main->ship_county, - $cust_main->ship_state, - $cust_main->ship_country, - 'ship_', - 'changed(this)', ); - - print "$ship_county_html $ship_state_html"; - - print qq!${r}Zip!; - - my($ship_daytime,$ship_night,$ship_fax)=( - $cust_main->ship_daytime, - $cust_main->ship_night, - $cust_main->ship_fax, - ); - - print <${r}Country$ship_country_html - $daytime_label - $night_label - Fax -END +%> - print "${r}required fields
"; +
+Service address +(>same as billing address) +<%= include('cust_main/contact.html', $cust_main, 'ship_', '', $disabled ) %> -} +<% } %> +<% # billing info sub expselect {