add ability to edit referring customer, RT#7174
authorivan <ivan>
Thu, 4 Feb 2010 10:00:33 +0000 (10:00 +0000)
committerivan <ivan>
Thu, 4 Feb 2010 10:00:33 +0000 (10:00 +0000)
FS/FS/AccessRight.pm
httemplate/edit/cust_main/top_misc.html
httemplate/elements/search-cust_main.html

index ab263a3..1528ed4 100644 (file)
@@ -108,6 +108,7 @@ tie my %rights, 'Tie::IxHash',
     'View customer',
     #'View Customer | View tickets',
     'Edit customer',
+    'Edit referring customer',
     'View customer history',
     'Cancel customer',
     'Complimentary customer', #aka users-allow_comp 
index 7c9e039..11ea52a 100644 (file)
@@ -52,6 +52,7 @@
 %if ( $cust_main->referral_custnum
 %     and $referring_cust_main =
 %           qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
+%     and ! $curuser->access_right('Edit referring customer')
 %) {
 
   <TR>
@@ -61,8 +62,8 @@
     </TD>
   </TR>
   <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->referral_custnum %>">
-% } elsif ( ! $conf->exists('disable_customer_referrals') ) { 
 
+% } elsif ( ! $conf->exists('disable_customer_referrals') ) { 
 
   <TR>
     <TD ALIGN="right">Referring customer</TD>
       <!-- <INPUT TYPE="text" NAME="referral_custnum" VALUE=""> -->
       <% include('/elements/search-cust_main.html',
                     'field_name' => 'referral_custnum',
+                    'curr_value' => $cust_main->referral_custnum,
                  )
       %>
     </TD>
   </TR>
-% } else { 
-
 
+% } else { 
   <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
 % } 
 
@@ -101,6 +102,8 @@ my $custnum = $opt{'custnum'};
 
 my $conf = new FS::Conf;
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
 
 </%init>
index dbcc2ed..ef0d22c 100644 (file)
@@ -1,3 +1,15 @@
+<%doc>
+
+Example:
+
+  include( '/elements/search-cust_main.html,
+             'field_name'  => 'custnum',
+             'find_button' => 1, #add a "find" button to the field
+             'curr_value'  => 54, #current value
+             'value        => 32, #deprecated synonym for curr_value
+  );
+
+</%doc>
 <INPUT TYPE="hidden" NAME="<% $opt{'field_name'} %>" VALUE="<% $value %>">
 
 <!-- some false laziness w/ misc/batch-cust_pay.html, though not as bad as i'd thought at first... -->