From b59a412755582d30b4f7be2147b6ad32037e6f59 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Sep 2003 05:51:50 +0000 Subject: agents can be disabled (auto-sensing based on schema) --- httemplate/edit/agent.cgi | 65 +++++++++++++++++++++++-------------------- httemplate/edit/cust_main.cgi | 6 ++-- 2 files changed, 39 insertions(+), 32 deletions(-) (limited to 'httemplate/edit') diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index 449456cdd..8a1cb2ae1 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -16,59 +16,64 @@ if ( $cgi->param('error') ) { my $action = $agent->agentnum ? 'Edit' : 'Add'; my $hashref = $agent->hashref; -print header("$action Agent", menubar( +%> + +<%= header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', -)); +)) %> -print qq!Error: !, $cgi->param('error'), - "" - if $cgi->param('error'); +<% if ( $cgi->param('error') ) { %> +Error: <%= $cgi->param('error') %> +<% } %> -print '
', - qq!!, - "Agent #", $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)"; + + +Agent #<%= $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)" %> -print &ntable("#cccccc", 2, ''), < Agent - + Agent type {disabled} eq 'Y' ? ' CHECKED' : '' %>> + +<% } %> - + - + +<% if ( dbdef->table('agent')->column('username') ) { %> + + Agent interface username + + + + Agent interface password + + +<% } %> -END -print qq!
!; - -print <"> -END - -%> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index eeceed889..73a0eef49 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -75,9 +75,11 @@ print qq!
!, my $r = qq!* !; -my @agents = qsearch( 'agent', {} ); +my %agent_search = dbdef->table('agent')->column('disabled') + ? ( 'disabled' => '' ) : (); +my @agents = qsearch( 'agent', \%agent_search ); #die "No agents created!" unless @agents; -eidiot "You have not created any agents. You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; +eidiot "You have not created any agents (or all agents are disabled). You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first if ( scalar(@agents) == 1 ) { print qq!!; -- cgit v1.2.1