diff options
author | ivan <ivan> | 2010-05-20 22:48:42 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-05-20 22:48:42 +0000 |
commit | f1cd7f98b487e74aa60b6c41d3377cc60f7ac25a (patch) | |
tree | 9cb67dd062685eaad04db1cb78ac00516c866718 /httemplate | |
parent | 85c3933c8b7508ab2aeb0f9e6b96dd1b6432fb9f (diff) |
agent virt inventory, RT#7010
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/inventory_class.html | 20 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 5 | ||||
-rw-r--r-- | httemplate/misc/inventory_item-import.html | 6 | ||||
-rw-r--r-- | httemplate/search/elements/search.html | 5 | ||||
-rw-r--r-- | httemplate/search/inventory_item.html | 17 |
5 files changed, 41 insertions, 12 deletions
diff --git a/httemplate/browse/inventory_class.html b/httemplate/browse/inventory_class.html index 8ce131ac2..4ad72a2ea 100644 --- a/httemplate/browse/inventory_class.html +++ b/httemplate/browse/inventory_class.html @@ -1,9 +1,7 @@ <% include( 'elements/browse.html', 'title' => 'Inventory Classes', 'name' => 'inventory classes', - 'menubar' => [ 'Add a new inventory class' => - $p.'edit/inventory_class.html', - ], + 'menubar' => $menubar, 'query' => { 'table' => 'inventory_class', }, 'count_query' => 'SELECT COUNT(*) FROM inventory_class', 'header' => [ '#', 'Inventory class', 'Inventory' ], @@ -66,8 +64,12 @@ %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $curuser->access_right('Edit inventory') + || $curuser->access_right('Edit global inventory') + || $curuser->access_right('Configuration'); tie my %labels, 'Tie::IxHash', 'num_avail' => 'Available', # <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>', @@ -88,6 +90,14 @@ my %inv_action_link = ( ], ); -my $link = [ "${p}edit/inventory_class.html?", 'classnum' ]; +my $menubar = $curuser->access_right('Configuration') + ? [ 'Add a new inventory class' => + $p.'edit/inventory_class.html', + ] + : []; + +my $link = $curuser->access_right('Configuration') + ? [ "${p}edit/inventory_class.html?", 'classnum' ] + : ''; </%init> diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 8b4a06885..fc5498f84 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -469,8 +469,11 @@ $config_misc{'Advertising sources'} = [ $fsurl.'browse/part_referral.html', 'Whe if ( $curuser->access_right('Configuration') ) { $config_misc{'Virtual fields'} = [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ]; $config_misc{'Message catalog'} = [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ]; - $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ]; } +$config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ] + if $curuser->access_right('Edit inventory') + || $curuser->access_right('Edit global inventory') + || $curuser->access_right('Configuration'); tie my %config_menu, 'Tie::IxHash'; if ( $curuser->access_right('Configuration' ) ) { diff --git a/httemplate/misc/inventory_item-import.html b/httemplate/misc/inventory_item-import.html index c7edac609..990c14ffc 100644 --- a/httemplate/misc/inventory_item-import.html +++ b/httemplate/misc/inventory_item-import.html @@ -7,8 +7,8 @@ Import a file containing <% PL($inventory_class->classname) %>, one per line. 'name' => 'InventoryItemImportForm', 'action' => 'process/inventory_item-import.html', 'num_files' => 1, - #'fields' => [ 'format', 'itembatch', 'classnum', ], - 'fields' => [ 'format', 'classnum', ], + #'fields' => [ 'format', 'itembatch', 'classnum', 'agentnum' ], + 'fields' => [ 'format', 'classnum', 'agentnum', ], 'message' => 'Inventory import successful', #XXX redirect via $itembatch? or just back to class browse? #'url' => $p."search/phone_avail.html?availbatch=$availbatch", @@ -24,6 +24,8 @@ Import a file containing <% PL($inventory_class->classname) %>, one per line. %# <INPUT TYPE="hidden" NAME="itembatch" VALUE="<% $itembatch %>"> + <% include('/elements/tr-select-agent.html') %> + <% include( '/elements/file-upload.html', 'field' => 'file', 'label' => 'Filename', diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 0dc417052..636885edc 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -121,6 +121,7 @@ Example: #handling agent virtualization 'agent_virt' => 1, # set true if this search should be # agent-virtualized + 'agent_null' => 1, # set true to view global records always 'agent_null_right' => 'Access Right', # optional right to view global # records 'agent_null_right_link' => 'Access Right' # optional right to link to @@ -235,7 +236,9 @@ if ( $opt{'agent_virt'} ) { || $opt{'agent_null_right'} ); my $agentnums_sql = $curuser->agentnums_sql( - 'null_right' => $opt{'agent_null_right'} + 'null' => $opt{'agent_null'}, + 'null_right' => $opt{'agent_null_right'}, + 'table' => $opt{'query'}{'table'}, ); $opt{'query'}{'extra_sql'} .= diff --git a/httemplate/search/inventory_item.html b/httemplate/search/inventory_item.html index 55fef9432..80810caf9 100644 --- a/httemplate/search/inventory_item.html +++ b/httemplate/search/inventory_item.html @@ -1,8 +1,11 @@ <% include( 'elements/search.html', 'title' => $title, - #less lame to use Lingua:: something to pluralize - 'name' => $inventory_class->classname. 's', + 'menubar' => [ 'View inventory classes' => + $p.'browse/inventory_class.html', + ], + + 'name' => PL($inventory_class->classname), 'query' => { 'table' => 'inventory_item', @@ -19,6 +22,10 @@ 'count_query' => $count_query, + 'agent_virt' => 1, + 'agent_null' => 1, + 'agent_pos' => 2, + 'header' => [ '#', $inventory_class->classname, @@ -74,8 +81,12 @@ %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $curuser->access_right('Edit inventory') + || $curuser->access_right('Edit global inventory') + || $curuser->access_right('Configuration'); my $classnum = $cgi->param('classnum'); $classnum =~ /^(\d+)$/ or errorpage("illegal classnum $classnum"); |