1 <TABLE CLASS="fsinnerbox">
4 <TD ALIGN="right">Residential</TD>
5 <TD><INPUT TYPE = "radio"
6 NAME = "residential_commercial"
7 ID = "residential_commercial_Residential"
9 onChange = "rescom_changed(this)"
10 <% $cust_main->residential_commercial eq 'Commercial' ? '' : 'CHECKED' %>
14 <TD ALIGN="right">Commercial</TD>
15 <TD><INPUT TYPE = "radio"
16 NAME = "residential_commercial"
17 ID = "residential_commercial_Commercial"
19 onChange = "rescom_changed(this)"
20 <% $cust_main->residential_commercial eq 'Commercial' ? 'CHECKED' : '' %>
24 <SCRIPT TYPE="text/javascript">
25 function rescom_changed() {
26 var f = document.CustomerForm;
28 if ( f.residential_commercial_Residential.checked ) {
29 document.getElementById('contacts_div').style.display = 'none';
30 } else { // if ( f.residential_commercial_Commercial.checked ) {
31 document.getElementById('contacts_div').style.display = '';
34 if ( f.residential_commercial_Residential.checked && ! f.company.value.length ) {
35 document.getElementById('company_row').style.display = 'none'
36 } else { // if ( f.residential_commercial_Commercial.checked ) {
37 document.getElementById('company_row').style.display = '';
40 if ( f.residential_commercial_Residential.checked && ! f.ship_company.value.length ) {
41 document.getElementById('ship_company_row').style.display = 'none'
42 } else { // if ( f.residential_commercial_Commercial.checked ) {
43 document.getElementById('ship_company_row').style.display = '';
48 % foreach my $field ($cust_main->virtual_fields) {
49 <% $cust_main->pvf($field)->widget('HTML', 'edit',$cust_main->getfield($field)) %>
53 <& /elements/tr-select-cust_tag.html,
54 'custnum' => $custnum,
59 % if ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ && $curuser->agentnum($1) ) {
62 % $cust_main->agentnum($agentnum);
64 <INPUT TYPE="hidden" NAME="lock_agentnum" VALUE="<% $agentnum %>">
65 <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agentnum %>">
67 <TD ALIGN="right"><% mt('Agent') |h %></TD>
68 <TD CLASS="fsdisabled"><% $cust_main->agent->agent |h %></TD>
73 <& /elements/tr-select-agent.html,
74 'curr_value' => $cust_main->agentnum,
75 'label' => "<B>${r}".emt('Agent')."</B>",
76 'empty_label' => emt('Select agent'),
77 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ),
78 'viewall_right' => emt('None'),
84 % if ( $conf->exists('cust_main-edit_agent_custid') ) {
87 <TD ALIGN="right"><% mt('Customer identifier') |h %></TD>
88 <TD><INPUT TYPE="text" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>"></TD>
93 <INPUT TYPE="hidden" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>">
98 <& /elements/tr-select-cust_class.html,
99 'curr_value' => $cust_main->classnum,
100 'label' => emt("Class"),
103 %# referral (advertising source)
104 %my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
105 %if ( $custnum && ! $conf->exists('editreferrals') ) {
107 <INPUT TYPE="hidden" NAME="refnum" VALUE="<% $refnum %>">
111 <& /elements/tr-select-part_referral.html,
112 'curr_value' => $refnum
117 %# referring customer
118 %my $referring_cust_main = '';
119 %if ( $cust_main->referral_custnum
120 % and $referring_cust_main =
121 % qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
122 % and ! $curuser->access_right('Edit referring customer')
126 <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
128 <A HREF="<% popurl(1) %>/cust_main.cgi?<% $cust_main->referral_custnum %>"><% $cust_main->referral_custnum %>: <% $referring_cust_main->name %></A>
131 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->referral_custnum %>">
133 % } elsif ( ! $conf->exists('disable_customer_referrals') ) {
136 <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
138 <& /elements/search-cust_main.html,
139 'field_name' => 'referral_custnum',
140 'curr_value' => $cust_main->referral_custnum,
146 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
150 % if ( $conf->exists('cust_main-edit_signupdate') ) {
151 <& /elements/tr-input-date-field.html, {
152 'name' => 'signupdate',
153 'value' => $cust_main->signupdate,
154 'label' => emt('Signup date'),
155 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ),
160 % # permission to edit ticket subjects
161 % if ( $conf->exists('ticket_system-selfservice_edit_subject') ) {
164 <INPUT TYPE="checkbox" NAME="edit_subject" VALUE="Y" <%
165 $cust_main->edit_subject ? 'CHECKED' : '' %>></TD>
166 <TD ALIGN="left"><% mt('Can edit ticket subjects') |h %></TD>
169 <INPUT TYPE="hidden" NAME="edit_subject" VALUE="<% $cust_main->edit_subject %>">
172 % # permission to edit
173 % if ( $conf->exists('cust_main-edit_calling_list_exempt') ) {
176 <INPUT TYPE="checkbox" NAME="calling_list_exempt" VALUE="Y" <%
177 $cust_main->calling_list_exempt ? 'CHECKED' : '' %>></TD>
178 <TD ALIGN="left"><% mt('Calling list exempt') |h %></TD>
181 <INPUT TYPE="hidden" NAME="calling_list_exempt" VALUE="<% $cust_main->calling_list_exempt %>">
188 my( $cust_main, %opt ) = @_;
190 my $custnum = $opt{'custnum'};
192 if ( $cgi->param('error') ) {
193 $cust_main->set('residential_commercial',
194 ($cgi->param('residential_commercial') eq 'Commercial')
198 } elsif ( $custnum ) { #editing
199 $cust_main->set('residential_commercial',
200 length($cust_main->company)
204 } else { #new customer
205 #config to default to commercial and/or disable residential when someone needs
206 $cust_main->set('residential_commercial', 'Residential');
209 my $conf = new FS::Conf;
211 my $curuser = $FS::CurrentUser::CurrentUser;
213 my $r = qq!<font color="#ff0000">*</font> !;