{
'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',
},
{
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;