diff options
| author | mark <mark> | 2011-10-25 01:15:14 +0000 | 
|---|---|---|
| committer | mark <mark> | 2011-10-25 01:15:14 +0000 | 
| commit | f63936fb0404dc44fc8d3aa45c4edd4fa6670821 (patch) | |
| tree | 00aecf531fbd2d2838f1074373631548dd076dc7 | |
| parent | 410af63a9dac5e99ba7f095dfe3c32c39e05631e (diff) | |
custom_link interpolation, #14895
| -rw-r--r-- | FS/FS/Conf.pm | 4 | ||||
| -rw-r--r-- | httemplate/misc/custom_link_proxy.cgi | 9 | 
2 files changed, 10 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 590a5c3ec..113bac083 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4428,8 +4428,8 @@ and customer address. Include units.',    {      'key'         => 'cust_main-custom_link',      'section'     => 'UI', -    'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The custnum will be appended.', -    'type'        => 'text', +    'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere.  "$agentnum" will be replaced with the agent number.', +    'type'        => 'textarea',    },    { diff --git a/httemplate/misc/custom_link_proxy.cgi b/httemplate/misc/custom_link_proxy.cgi index e5934e4a6..417fcebae 100644 --- a/httemplate/misc/custom_link_proxy.cgi +++ b/httemplate/misc/custom_link_proxy.cgi @@ -11,7 +11,14 @@ my $cust_main = qsearchs('cust_main', { custnum => $custnum } )    or die "custnum '$custnum' not found"; # just check for existence  my $conf = new FS::Conf; -my $url = $conf->config('cust_main-custom_link') . $cust_main->custnum; +my $url = $conf->config('cust_main-custom_link'); + +my $agentnum = $cust_main->agentnum; +# like eval(qq("$url")) but with fewer things that can go wrong +# and if $custnum isn't mentioned, assume it goes at the end +$url =~ s/\$custnum/$custnum/ or $url .= $custnum; +$url =~ s/\$agentnum/$agentnum/; +  #warn $url;  my $curuser = $FS::CurrentUser::CurrentUser;  | 
