From 1bfbab83c338f6a11ae26c4d197ad775c568ebde Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 4 Feb 2010 10:00:33 +0000 Subject: [PATCH] add ability to edit referring customer, RT#7174 --- FS/FS/AccessRight.pm | 1 + httemplate/edit/cust_main/top_misc.html | 9 ++++++--- httemplate/elements/search-cust_main.html | 12 ++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index ab263a3b8..1528ed42c 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -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 diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 7c9e0395c..11ea52afd 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -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') %) { @@ -61,8 +62,8 @@ -% } elsif ( ! $conf->exists('disable_customer_referrals') ) { +% } elsif ( ! $conf->exists('disable_customer_referrals') ) { Referring customer @@ -70,13 +71,13 @@ <% include('/elements/search-cust_main.html', 'field_name' => 'referral_custnum', + 'curr_value' => $cust_main->referral_custnum, ) %> -% } else { - +% } else { % } @@ -101,6 +102,8 @@ my $custnum = $opt{'custnum'}; my $conf = new FS::Conf; +my $curuser = $FS::CurrentUser::CurrentUser; + my $r = qq!* !; diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index dbcc2ed0b..ef0d22ced 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -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 + ); + + -- 2.11.0