custom fields, RT11714
[freeside.git] / httemplate / edit / cust_main / top_misc.html
1 <% &ntable("#cccccc") %>
2
3 % foreach my $field ($cust_main->virtual_fields) {
4     <% $cust_main->pvf($field)->widget('HTML', 'edit',$cust_main->getfield($field)) %>
5 % }
6
7 %# tags
8 <& /elements/tr-select-cust_tag.html,
9              'custnum' => $custnum,
10              'cgi'     => $cgi,
11 &>
12
13 %# agent
14 % if ( $cgi->param('lock_agentnum') =~ /^(\d+)$/ && $curuser->agentnum($1) ) {
15 %
16 %   my $agentnum = $1;
17 %   $cust_main->agentnum($agentnum);
18
19     <INPUT TYPE="hidden" NAME="lock_agentnum" VALUE="<% $agentnum %>">
20     <INPUT TYPE="hidden" NAME="agentnum"      VALUE="<% $agentnum %>">
21     <TR>
22       <TD ALIGN="right"><% mt('Agent') |h %></TD>
23       <TD CLASS="fsdisabled"><% $cust_main->agent->agent |h %></TD>
24     </TR>
25  
26 % } else {
27
28   <& /elements/tr-select-agent.html, 
29                 'curr_value'    => $cust_main->agentnum,
30                 'label'         => "<B>${r}".emt('Agent')."</B>",
31                 'empty_label'   => emt('Select agent'),
32                 'disable_empty' => ( $cust_main->agentnum ? 1 : 0 ),
33                 'viewall_right' => emt('None'), 
34   &>
35
36 % }
37
38 %# agent_custid
39 % if ( $conf->exists('cust_main-edit_agent_custid') ) {
40
41     <TR>
42       <TD ALIGN="right"><% mt('Customer identifier') |h %></TD>
43       <TD><INPUT TYPE="text" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>"></TD>
44     </TR>
45
46 % } else {
47
48     <INPUT TYPE="hidden" NAME="agent_custid" VALUE="<% $cust_main->agent_custid %>">
49
50 % }
51
52 %# class
53 <& /elements/tr-select-cust_class.html,
54              'curr_value'  => $cust_main->classnum,
55              'label'       => emt("Class"),
56 &>
57
58 %# referral (advertising source)
59 %my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
60 %if ( $custnum && ! $conf->exists('editreferrals') ) {
61
62   <INPUT TYPE="hidden" NAME="refnum" VALUE="<% $refnum %>">
63
64 % } else { 
65
66    <& /elements/tr-select-part_referral.html,
67                 'curr_value' => $refnum
68    &>
69 % } 
70
71
72 %# referring customer
73 %my $referring_cust_main = '';
74 %if ( $cust_main->referral_custnum
75 %     and $referring_cust_main =
76 %           qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
77 %     and ! $curuser->access_right('Edit referring customer')
78 %) {
79
80   <TR>
81     <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
82     <TD>
83       <A HREF="<% popurl(1) %>/cust_main.cgi?<% $cust_main->referral_custnum %>"><% $cust_main->referral_custnum %>: <% $referring_cust_main->name %></A>
84     </TD>
85   </TR>
86   <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->referral_custnum %>">
87
88 % } elsif ( ! $conf->exists('disable_customer_referrals') ) { 
89
90   <TR>
91     <TD ALIGN="right"><% mt('Referring customer') |h %></TD>
92     <TD>
93       <& /elements/search-cust_main.html,
94                     'field_name' => 'referral_custnum',
95                     'curr_value' => $cust_main->referral_custnum,
96       &>
97     </TD>
98   </TR>
99
100 % } else { 
101   <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
102 % } 
103
104 %# signup date
105 % if ( $conf->exists('cust_main-edit_signupdate') ) {
106     <& /elements/tr-input-date-field.html, {
107                   'name'        => 'signupdate',
108                   'value'       => $cust_main->signupdate,
109                   'label'       => emt('Signup date'),
110                   'format'      => ( $conf->config('date_format') || "%m/%d/%Y" ),
111               }
112     &>
113 % }
114
115 % # permission to edit ticket subjects
116 % if ( $conf->exists('ticket_system-selfservice_edit_subject') ) {
117   <TR>
118     <TD ALIGN="right">
119       <INPUT TYPE="checkbox" NAME="edit_subject" VALUE="Y" <% 
120         $cust_main->edit_subject ? 'CHECKED' : '' %>></TD>
121     <TD ALIGN="left"><% mt('Can edit ticket subjects') |h %></TD>
122   </TR>
123 % }
124
125 </TABLE>
126
127 <%init>
128
129 my( $cust_main, %opt ) = @_;
130
131 my $custnum = $opt{'custnum'};
132
133 my $conf = new FS::Conf;
134
135 my $curuser = $FS::CurrentUser::CurrentUser;
136
137 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
138
139 </%init>