1 <% &ntable("#cccccc") %>
4 <& /elements/tr-select-cust_tag.html,
9 <SCRIPT TYPE="text/javascript">
10 var ship_locked_agents = <% encode_json(\%ship_locked_agents) %>;
11 var ship_fields = ['address1', 'city', 'state',
12 'zip', 'country', 'latitude', 'longitude'];
13 function agent_changed(what) {
14 var agentnum = what.value;
16 if ( ship_locked_agents[agentnum] ) {
17 f['same'].checked = false;
18 samechanged(f['same']); // enable everything, then...
19 f['same'].disabled = true;
20 for(var x in ship_locked_agents[agentnum]) {
21 f['ship_'+x].value = ship_locked_agents[agentnum][x];
22 f['ship_'+x].disabled = true;
23 f['ship_'+x].style.backgroundColor = '#dddddd';
25 f['ship_address2'].disabled = false;
26 f['ship_address2'].style.backgroundColor = '#ffffff';
28 if ( f['same'].disabled ) { // only if switching from a locked agent
29 f['same'].disabled = false;
30 f['same'].checked = true;
31 samechanged(f['same']); // re-enable everything
35 window.onload = function() {
36 samechanged(document.getElementById('same'));
37 agent_changed(document.getElementById('agentnum'));
41 % if ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ && $curuser->agentnum($1) ) {
44 % $cust_main->agentnum($agentnum);
46 <INPUT TYPE="hidden" NAME="lock_agentnum" VALUE="<% $agentnum %>">
47 <INPUT TYPE="hidden" NAME="agentnum" ID="agentnum"
48 VALUE="<% $agentnum %>">
50 <TD ALIGN="right"><% mt('Agent') |h %></TD>
51 <TD CLASS="fsdisabled"><% $cust_main->agent->agent |h %></TD>
56 <& /elements/tr-select-agent.html,
57 'curr_value' => $cust_main->agentnum,
58 'label' => "<B>${r}".emt('Agent')."</B>",
59 'empty_label' => emt('Select agent'),
60 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ),
61 'viewall_right' => emt('None'),
62 'onchange' => 'agent_changed(this)',
68 % if ( $conf->exists('cust_main-edit_agent_custid') ) {
71 <TD ALIGN="right"><% mt('Customer identifier') |h %></TD>
72 <TD><INPUT TYPE="text" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>"></TD>
77 <INPUT TYPE="hidden" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>">
82 <& /elements/tr-select-cust_class.html,
83 'curr_value' => $cust_main->classnum,
84 'label' => emt("Class"),
87 %# referral (advertising source)
88 %my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
89 %if ( $custnum && ! $conf->exists('editreferrals') ) {
91 <INPUT TYPE="hidden" NAME="refnum" VALUE="<% $refnum %>">
95 <& /elements/tr-select-part_referral.html,
96 'curr_value' => $refnum
101 %# referring customer
102 %my $referring_cust_main = '';
103 %if ( $cust_main->referral_custnum
104 % and $referring_cust_main =
105 % qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
106 % and ! $curuser->access_right('Edit referring customer')
110 <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
112 <A HREF="<% popurl(1) %>/cust_main.cgi?<% $cust_main->referral_custnum %>"><% $cust_main->referral_custnum %>: <% $referring_cust_main->name |h %></A>
115 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->referral_custnum %>">
117 % } elsif ( ! $conf->exists('disable_customer_referrals') ) {
120 <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
122 <& /elements/search-cust_main.html,
123 'field_name' => 'referral_custnum',
124 'curr_value' => $cust_main->referral_custnum,
130 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
134 % if ( $conf->exists('cust_main-edit_signupdate') ) {
135 <& /elements/tr-input-date-field.html, {
136 'name' => 'signupdate',
137 'value' => $cust_main->signupdate,
138 'label' => emt('Signup date'),
139 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ),
144 % # permission to edit ticket subjects
145 % if ( $conf->exists('ticket_system-selfservice_edit_subject') ) {
148 <INPUT TYPE="checkbox" NAME="edit_subject" VALUE="Y" <%
149 $cust_main->edit_subject ? 'CHECKED' : '' %>></TD>
150 <TD ALIGN="left"><% mt('Can edit ticket subjects') |h %></TD>
153 <INPUT TYPE="hidden" NAME="edit_subject" VALUE="<% $cust_main->edit_subject %>">
156 % # permission to edit
157 % if ( $conf->exists('cust_main-edit_calling_list_exempt') ) {
160 <INPUT TYPE="checkbox" NAME="calling_list_exempt" VALUE="Y" <%
161 $cust_main->calling_list_exempt ? 'CHECKED' : '' %>></TD>
162 <TD ALIGN="left"><% mt('Calling list exempt') |h %></TD>
165 <INPUT TYPE="hidden" NAME="calling_list_exempt" VALUE="<% $cust_main->calling_list_exempt %>">
172 my( $cust_main, %opt ) = @_;
174 my $custnum = $opt{'custnum'};
176 my $conf = new FS::Conf;
178 my $curuser = $FS::CurrentUser::CurrentUser;
180 my $r = qq!<font color="#ff0000">*</font> !;
182 # which agents lock the service address, if any
183 my %ship_locked_agents;
184 foreach (qsearch('agent',{})) {
185 my $agentnum = $_->agentnum;
186 next unless $conf->exists('agent-ship_address', $_->agentnum);
187 my $agent_cust_main = $_->agent_cust_main or next;
189 $pre = 'ship_' if $agent_cust_main->has_ship_address;
190 $ship_locked_agents{$agentnum} = +{
191 map { $_ => $agent_cust_main->get($pre.$_) }
192 qw(address1 city state zip country latitude longitude)