diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-03-26 19:20:29 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-03-26 19:20:29 -0700 |
commit | f62a68016f32b443084705b0e7851497b308f81d (patch) | |
tree | 669ab13c6febb3b815613cd0d2227446f3c1b46a /httemplate/edit/cust_main | |
parent | 8f6c0d7b137391c6dd9cd1397a73293cd575da13 (diff) |
more contact-aware new customer screen, RT#16819
Diffstat (limited to 'httemplate/edit/cust_main')
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 4 | ||||
-rw-r--r-- | httemplate/edit/cust_main/contact.html | 211 | ||||
-rw-r--r-- | httemplate/edit/cust_main/contacts_new.html | 61 | ||||
-rw-r--r-- | httemplate/edit/cust_main/first_pkg.html | 4 | ||||
-rw-r--r-- | httemplate/edit/cust_main/top_misc.html | 64 |
5 files changed, 227 insertions, 117 deletions
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index bf6c62339..18c7ae9a6 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -34,7 +34,7 @@ % % my $r = qq!<font color="#ff0000">*</font> !; - <BR><FONT SIZE="+1"><B><% mt('Billing information') |h %></B></FONT> + <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT> <% &ntable("#cccccc") %> <TR> @@ -580,7 +580,7 @@ function toggle(obj) { </TABLE> - <% $r %> <% mt('required fields') |h %> + <% $r %><% mt('required fields') |h %> % } <script type="text/javascript"> diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index 4912327c6..57490b962 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -1,4 +1,4 @@ -<% &ntable("#cccccc") %> +<TABLE CLASS="fsinnerbox"> <TR> <TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></TH> @@ -14,8 +14,6 @@ <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD> % } - - </TR> % if ( $conf->exists('cust-email-high-visibility') && !$pre ) { @@ -30,100 +28,19 @@ </TR> % } -% unless ( $conf->exists('cust-edit-alt-field-order') ) { -<TR> - <TD ALIGN="right"><% mt('Company') |h %></TD> - <TD COLSPAN=7> - <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<& /elements/location.html, - 'prefix' => $pre, - 'object' => $cust_main, - 'onchange' => $onchange, - 'disabled' => $disabled, - 'style' => \@style, - 'same_checked' => $opt{'same_checked'}, - 'geocode' => $opt{'geocode'}, - 'censustract' => $opt{'censustract'}, -&> - -<TR> - <TD ALIGN="right"><% $daytime_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<TR> - <TD ALIGN="right"><% $night_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<TR> - <TD ALIGN="right"><% $mobile_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<TR> - <TD ALIGN="right"><% mt('Fax') |h %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -% } else { - -<TR> - <TD ALIGN="right"><% $daytime_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> +% unless ( $conf->exists('cust-edit-alt-field-order') ) { #standard order -<TR> - <TD ALIGN="right"><% $night_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> + <& company &> + <& location &> + <& phones &> + <& fax &> -<TR> - <TD ALIGN="right"><% $mobile_label %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<& /elements/location.html, - 'prefix' => $pre, - 'object' => $cust_main, - 'onchange' => $onchange, - 'disabled' => $disabled, - 'style' => \@style, - 'same_checked' => $opt{'same_checked'}, - 'geocode' => $opt{'geocode'}, - 'censustract' => $opt{'censustract'}, -&> +% } else { #alternate field order -<TR> - <TD ALIGN="right"><% mt('Fax') |h %></TD> - <TD COLSPAN=5> - <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> - -<TR> - <TD ALIGN="right"><% mt('Company') |h %></TD> - <TD COLSPAN=7> - <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>> - </TD> -</TR> + <& phones &> + <& location &> + <& fax &> + <& company &> % } @@ -152,16 +69,88 @@ </TABLE> <%$r%><% mt('required fields') |h %><BR> +<%def company> +% my $display = ($cust_main->residential_commercial eq 'Commercial') +% ? '' : 'none'; + <TR ID="<%$pre%>company_row" STYLE="display:<%$display%>"> + <TD ALIGN="right"><% mt('Company') |h %></TD> + <TD COLSPAN=7> + <INPUT TYPE="text" NAME="<%$pre%>company" ID="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=60 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + </TD> + </TR> +</%def> + +<%def location> + <& /elements/location.html, + 'prefix' => $pre, + 'object' => $cust_main, + 'onchange' => $onchange, + 'disabled' => $disabled, + 'style' => \@style, + 'same_checked' => $opt{'same_checked'}, + 'geocode' => $opt{'geocode'}, + 'censustract' => $opt{'censustract'}, + &> +</%def> + +<%def phones> + <TR> + <TD ALIGN="right" VALIGN="top"><% mt('Phones') %></TD> + <TD COLSPAN=6> + + <TABLE CELLSPACING=0 CELLPADDING=0> + <TR> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $daytime_label %></FONT> + </TD> + <TD> </TD> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $night_label %></FONT> + </TD> + <TD> </TD> + <TD> + <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + <BR><FONT SIZE=-1><% $mobile_label %></FONT> + </TD> + </TR> + </TABLE> + </TD> + </TR> +</%def> + +<%def fax> + <TR> + <TD ALIGN="right"><% mt('Fax') |h %></TD> + <TD COLSPAN=5> + <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>> + </TD> + </TR> +</%def> + +<%once> + +my $r = qq!<font color="#ff0000">*</font> !; + +</%once> +<%shared> + +my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style, + $daytime_label, $night_label, $mobile_label, + ); + +</%shared> <%init> -my %opt = @_; -my $cust_main = $opt{'cust_main'}; -my $pre = $opt{'pre'}; -my $onchange = $opt{'onchange'}; -my $disabled = $opt{'disabled'}; -my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () ); +%opt = @_; +$cust_main = $opt{'cust_main'}; +$pre = $opt{'pre'}; +$onchange = $opt{'onchange'}; +$disabled = $opt{'disabled'}; +@style = ( $opt{'style'} ? @{ $opt{'style'} } : () ); -my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : ''; +$style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : ''; my $conf = new FS::Conf; @@ -189,15 +178,15 @@ if ( $conf->exists('cust_main-require_censustract') ) { $opt{censustract} ||= $cust_main->censustract; } -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') || 'Night Phone'; -my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/ - ? 'Mobile Phone' - : FS::Msgcat::_gettext('mobile') || 'Mobile Phone'; +$daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day' + : FS::Msgcat::_gettext('daytime'); +$night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/ + ? 'Night' + : FS::Msgcat::_gettext('night') || 'Night'; +$mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/ + ? 'Mobile' + : FS::Msgcat::_gettext('mobile') || 'Mobile'; my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ ? 'Driver’s License' @@ -206,8 +195,6 @@ my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_st ? 'Driver’s License State' : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State'; -my $r = qq!<font color="#ff0000">*</font> !; - my @invoicing_list = $cust_main->invoicing_list; my $agentnum = $cust_main->agentnum if $cust_main->custnum; diff --git a/httemplate/edit/cust_main/contacts_new.html b/httemplate/edit/cust_main/contacts_new.html new file mode 100644 index 000000000..f59126a66 --- /dev/null +++ b/httemplate/edit/cust_main/contacts_new.html @@ -0,0 +1,61 @@ +<DIV ID="contacts_div" STYLE="display:<% $display %>"> +<BR> +<FONT CLASS="fsinnerbox-title">Contacts</FONT> +<% include('/edit/elements/edit.html', + 'embed' => $opt{cust_main}, + 'table' => 'cust_main', + 'labels' => { 'contactnum' => 'Contact', + #'locationnum' => ' ', + }, + 'fields' => [ + { 'field' => 'contactnum', + 'type' => 'contact', + 'colspan' => 6, + 'm2m_method' => 'cust_contact', + 'm2m_dstcol' => 'contactnum', + 'm2_label' => 'Contact', + 'm2_error_callback' => $m2_error_callback, + }, + ], + 'agent_virt' => 1, + ) +%> +</DIV> +<%init> + +my %opt = @_; + +my $display = ($opt{'cust_main'}->residential_commercial eq 'Commercial') + ? '' + : 'none'; + +my $curuser = $FS::CurrentUser::CurrentUser; +my $conf = new FS::Conf; + +my $m2_error_callback = sub { + my($cgi, $object) = @_; + + #process_o2m fields in process/cust_main-contacts.html + my @fields = qw( first last title comment ); + my @gfields = ( '', map "_$_", @fields ); + + map { + if ( /^contactnum(\d+)$/ ) { + my $num = $1; + if ( grep $cgi->param("contactnum$num$_"), @gfields ) { + my $x = new FS::contact { + 'contactnum' => scalar($cgi->param("contactnum$num")), + map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields, + }; + $x; + } else { + (); + } + } else { + (); + } + } + $cgi->param; +}; + +</%init> diff --git a/httemplate/edit/cust_main/first_pkg.html b/httemplate/edit/cust_main/first_pkg.html index 2e9f36f99..ad118b4a9 100644 --- a/httemplate/edit/cust_main/first_pkg.html +++ b/httemplate/edit/cust_main/first_pkg.html @@ -6,8 +6,8 @@ % % if ( @part_pkg ) { - <BR><BR> - <FONT SIZE="+1"><B><% mt('First package') |h %></B></FONT> + <BR> + <FONT CLASS="fsinnerbox-title"><% mt('First package') |h %></FONT> <% ntable("#cccccc") %> <TR> diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 2d1d978e3..7ba167b7f 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -1,4 +1,49 @@ -<% &ntable("#cccccc") %> +<TABLE CLASS="fsinnerbox"> + +<TR> + <TD ALIGN="right">Residential</TD> + <TD><INPUT TYPE = "radio" + NAME = "residential_commercial" + ID = "residential_commercial_Residential" + VALUE = "Residential" + onChange = "rescom_changed(this)" + <% $cust_main->residential_commercial eq 'Commercial' ? '' : 'CHECKED' %> + ></TD> +</TR> +<TR> + <TD ALIGN="right">Commercial</TD> + <TD><INPUT TYPE = "radio" + NAME = "residential_commercial" + ID = "residential_commercial_Commercial" + VALUE = "Commercial" + onChange = "rescom_changed(this)" + <% $cust_main->residential_commercial eq 'Commercial' ? 'CHECKED' : '' %> + ></TD> +</TR> + +<SCRIPT TYPE="text/javascript"> + function rescom_changed() { + var f = document.CustomerForm; + + if ( f.residential_commercial_Residential.checked ) { + document.getElementById('contacts_div').style.display = 'none'; + } else { // if ( f.residential_commercial_Commercial.checked ) { + document.getElementById('contacts_div').style.display = ''; + } + + if ( f.residential_commercial_Residential.checked && ! f.company.value.length ) { + document.getElementById('company_row').style.display = 'none' + } else { // if ( f.residential_commercial_Commercial.checked ) { + document.getElementById('company_row').style.display = ''; + } + + if ( f.residential_commercial_Residential.checked && ! f.ship_company.value.length ) { + document.getElementById('ship_company_row').style.display = 'none' + } else { // if ( f.residential_commercial_Commercial.checked ) { + document.getElementById('ship_company_row').style.display = ''; + } + } +</SCRIPT> % foreach my $field ($cust_main->virtual_fields) { <% $cust_main->pvf($field)->widget('HTML', 'edit',$cust_main->getfield($field)) %> @@ -144,6 +189,23 @@ my( $cust_main, %opt ) = @_; my $custnum = $opt{'custnum'}; +if ( $cgi->param('error') ) { + $cust_main->set('residential_commercial', + ($cgi->param('residential_commercial') eq 'Commercial') + ? 'Commercial' + : 'Residential' + ); +} elsif ( $custnum ) { #editing + $cust_main->set('residential_commercial', + length($cust_main->company) + ? 'Commercial' + : 'Residential' + ); +} else { #new customer + #config to default to commercial and/or disable residential when someone needs + $cust_main->set('residential_commercial', 'Residential'); +} + my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; |