From 51d044c74ff531b744a6b570fe4a178654a0e7da Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Oct 2008 00:38:09 +0000 Subject: add a master custnum field to agents, RT#2933 (roundabout) --- httemplate/browse/agent.cgi | 12 ++++++++ httemplate/edit/agent.cgi | 12 ++++++++ httemplate/elements/search-cust_main.html | 51 ++++++++++++++++++++----------- 3 files changed, 58 insertions(+), 17 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 234bfa74a..89739f00b 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -26,6 +26,7 @@ full offerings (via their type).

param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent Type + Master Customer Invoice
Template
Customers Customer
packages
@@ -84,6 +85,17 @@ full offerings (via their type).

<% $agent->agent_type->atype %> + +% if ( $agent->agent_custnum ) { + <% include('/elements/small_custview.html', + $agent->agent_custnum, + scalar($conf->config('countrydefault')), + 1, #show balance + ) + %> +% } + + <% $agent->invoice_template || '(Default)' %> diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 11bfc5932..0c2520510 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -29,6 +29,18 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %> + + Master customer + + <% include('/elements/search-cust_main.html', + 'field_name' => 'agent_custnum', + 'curr_value' => $agent->agent_custnum, + 'find_button' => 1, + ) + %> + + + Disable disabled eq 'Y' ? ' CHECKED' : '' %>> diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index f2b17eacb..dbcc2ed0b 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -1,23 +1,24 @@ -% -% my( %opt ) = @_; -% $opt{'field_name'} ||= 'custnum'; -% -% my $cust_main = ''; -% if ( $opt{'value'} ) { -% $cust_main = qsearchs( -% 'table' => 'cust_main', -% 'hashref' => { 'custnum' => $opt{'value'} }, -% 'extra_sql' => " AND ". $FS::CurrentUser::CurrentUser->agentnums_sql, -% ); -% } -% - - - + - + + +% if ( $opt{'find_button'} ) { + +% } @@ -161,4 +162,20 @@ } +<%init> +my( %opt ) = @_; +$opt{'field_name'} ||= 'custnum'; + +my $value = $opt{'curr_value'} || $opt{'value'}; + +my $cust_main = ''; +if ( $value ) { + $cust_main = qsearchs({ + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $value }, + 'extra_sql' => " AND ". $FS::CurrentUser::CurrentUser->agentnums_sql, + }); +} + + -- cgit v1.2.1