diff options
author | ivan <ivan> | 2008-10-19 00:38:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-10-19 00:38:09 +0000 |
commit | 51d044c74ff531b744a6b570fe4a178654a0e7da (patch) | |
tree | 62f4435d7032ca93770ba035d1f94f2b0cdba2dc /httemplate | |
parent | 86a09d3645f2b92ecd735ce8354e5f99a64b050f (diff) |
add a master custnum field to agents, RT#2933 (roundabout)
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/browse/agent.cgi | 12 | ||||
-rwxr-xr-x | httemplate/edit/agent.cgi | 12 | ||||
-rw-r--r-- | httemplate/elements/search-cust_main.html | 51 |
3 files changed, 58 insertions, 17 deletions
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).<BR><BR> <TR> <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% ( $cgi->param('showdisabled') || !dbdef->table('agent')->column('disabled') ) ? 2 : 3 %>>Agent</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">Master Customer</TH> <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Invoice<BR>Template</FONT></TH> <TH CLASS="grid" BGCOLOR="#cccccc">Customers</TH> <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1>Customer<BR>packages</FONT></TH> @@ -84,6 +85,17 @@ full offerings (via their type).<BR><BR> <A HREF="<%$p%>edit/agent_type.cgi?<% $agent->typenum %>"><% $agent->agent_type->atype %></A> </TD> + <TD CLASS="inv" BGCOLOR="<% $bgcolor %>"> +% if ( $agent->agent_custnum ) { + <% include('/elements/small_custview.html', + $agent->agent_custnum, + scalar($conf->config('countrydefault')), + 1, #show balance + ) + %> +% } + </TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $agent->invoice_template || '(Default)' %> </TD> 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 @@ -30,6 +30,18 @@ Agent #<% $agent->agentnum ? $agent->agentnum : "(NEW)" %> </TR> <TR> + <TH ALIGN="right">Master customer</TH> + <TD> + <% include('/elements/search-cust_main.html', + 'field_name' => 'agent_custnum', + 'curr_value' => $agent->agent_custnum, + 'find_button' => 1, + ) + %> + </TD> + </TR> + + <TR> <TD ALIGN="right">Disable</TD> <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $agent->disabled eq 'Y' ? ' CHECKED' : '' %>></TD> </TR> 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, -% ); -% } -% - - -<INPUT TYPE="hidden" NAME="<% $opt{'field_name'} %>" VALUE="<% $opt{'value'} %>"> +<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... --> -<INPUT TYPE="text" NAME="<% $opt{'field_name'} %>_search" ID="<% $opt{'field_name'} %>_search" SIZE="32" VALUE="<% $cust_main ? $cust_main->name : '(cust #, name or company)' %>" onFocus="clearhint_<% $opt{'field_name'} %>_search(this);" onClick="clearhint_<% $opt{'field_name'} %>_search(this);" onChange="smart_<% $opt{'field_name'} %>_search(this);"> +<INPUT TYPE = "text" + NAME = "<% $opt{'field_name'} %>_search" + ID = "<% $opt{'field_name'} %>_search" + SIZE = "32" + VALUE="<% $cust_main ? $cust_main->name : '(cust #, name or company)' %>" + onFocus="clearhint_<% $opt{'field_name'} %>_search(this);" + onClick="clearhint_<% $opt{'field_name'} %>_search(this);" + onChange="smart_<% $opt{'field_name'} %>_search(this);" +> + +% if ( $opt{'find_button'} ) { + <INPUT TYPE = "button" + VALUE = 'Find', + NAME = "<% $opt{'field_name'} %>_findbutton" + onClick = "smart_<% $opt{'field_name'} %>_search(this.form.<% $opt{'field_name'} %>_search);" + > +% } <SELECT NAME="<% $opt{'field_name'} %>_select" ID="<% $opt{'field_name'} %>_select" STYLE="color:#ff0000; display:none" onChange="select_<% $opt{'field_name'} %>(this);"> </SELECT> @@ -161,4 +162,20 @@ } </SCRIPT> +<%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, + }); +} + +</%init> |