diff options
| author | ivan <ivan> | 2010-05-21 23:35:47 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2010-05-21 23:35:47 +0000 |
| commit | 42ed7ef03700fb17467bfeedead3639da9efc4a4 (patch) | |
| tree | ac9ac209fee11c0a0fd4b122b8554e4d58c15037 /httemplate/search | |
| parent | 4eae5a24723dd6cbac93bb646284a4fdf1553e73 (diff) | |
reporting on agent inventory, RT#7010
Diffstat (limited to 'httemplate/search')
| -rw-r--r-- | httemplate/search/agent_inventory.html | 40 | ||||
| -rw-r--r-- | httemplate/search/inventory_item.html | 6 | ||||
| -rw-r--r-- | httemplate/search/report_agent_inventory.html | 26 |
3 files changed, 72 insertions, 0 deletions
diff --git a/httemplate/search/agent_inventory.html b/httemplate/search/agent_inventory.html new file mode 100644 index 000000000..ac65371ca --- /dev/null +++ b/httemplate/search/agent_inventory.html @@ -0,0 +1,40 @@ +<% include('elements/search.html', + 'title' => 'Inventory summary per agent', + 'name_singular' => 'agent', + 'query' => { 'table' => 'agent', + 'hashref' => { 'disabled' => '' }, + 'extra_sql' => "AND $agentnums_sql", + }, + 'count_query' => "SELECT COUNT(*) FROM agent". + " WHERE disabled = '' OR disabled IS NULL". + " AND $agentnums_sql", + 'header' => \@header, + 'fields' => \@fields, + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +#XXX List inventory + +my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql; + +my @header = ('Agent'); +my @fields = ('agent'); + + #{ 'disabled' => '' } +foreach my $inventory_class ( qsearch('inventory_class', {}) ) { + push @header, $inventory_class->classname; + push @fields, sub { + my $agent = shift; + my $sub = FS::inventory_class->countcell_factory( + 'p' => $p, 'agentnum' => $agent->agentnum, + ); + &{$sub}($inventory_class); + }; +} + +#XXX show global inventory too + +</%init> diff --git a/httemplate/search/inventory_item.html b/httemplate/search/inventory_item.html index 681e5dbac..37914e0a7 100644 --- a/httemplate/search/inventory_item.html +++ b/httemplate/search/inventory_item.html @@ -103,6 +103,12 @@ my $inventory_class = qsearchs( { my $title = $inventory_class->classname. ' Inventory'; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $extra_sql .= " AND inventory_item.agentnum = $1 "; + my $agent = qsearchs('agent', { 'agentnum' => $1 }) or die "unknown agentnum"; + $title = $agent->agent. " $title"; +} + #little false laziness with SQL fragments in inventory_class.pm if ( $cgi->param('avail') ) { $extra_sql .= ' AND ( svcnum IS NULL OR svcnum = 0 )'; diff --git a/httemplate/search/report_agent_inventory.html b/httemplate/search/report_agent_inventory.html new file mode 100644 index 000000000..af66043a6 --- /dev/null +++ b/httemplate/search/report_agent_inventory.html @@ -0,0 +1,26 @@ +<% include('/elements/header.html', 'Inventory summary per agent' ) %> + +<FORM ACTION="agent_inventory.html" METHOD="GET"> + +<TABLE BGCOLOR="#cccccc" CELLSPACING=0> + +%# select agents + +%# select inventory classes + +</TABLE> + +<BR> +<INPUT TYPE="submit" VALUE="Search"> + +</FORM> + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +#XXX List inventory + +</%init> + |
