summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-table.html
diff options
context:
space:
mode:
authorjeff <jeff>2008-06-28 19:25:24 +0000
committerjeff <jeff>2008-06-28 19:25:24 +0000
commita1871d3d13c1dafa93b956762c0d23728d261da7 (patch)
treeecd799ff28ca27d5e2ef07a615bcac49621dd391 /httemplate/elements/select-table.html
parent7588be4eb948426b972d0238dcdbb1537dc6a72a (diff)
agent virtualize address blocks and routers
Diffstat (limited to 'httemplate/elements/select-table.html')
-rw-r--r--httemplate/elements/select-table.html17
1 files changed, 14 insertions, 3 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html
index 7339f36..d24c9ab 100644
--- a/httemplate/elements/select-table.html
+++ b/httemplate/elements/select-table.html
@@ -92,14 +92,25 @@ my $name_col = $opt{'name_col'};
my $value = $opt{'curr_value'} || $opt{'value'};
$value = [ split(/\s*,\s*/, $value) ] if $opt{'multiple'} && $value =~ /,/;
+my $extra_sql = $opt{'extra_sql'} || '';
+my $hashref = $opt{'hashref'} || {};
+
+if ( $opt{'agent_virt'} ) {
+ $extra_sql .=
+ ( $extra_sql =~ /WHERE/i || scalar(keys %$hashref ) ? ' AND ' : ' WHERE ' ).
+ $FS::CurrentUser::CurrentUser->agentnums_sql(
+ 'null_right' => $opt{'agent_null_right'}
+ );
+}
+
my @records = ();
if ( $opt{'records'} ) {
@records = @{ $opt{'records'} };
} else {
@records = qsearch( {
'table' => $opt{'table'},
- 'hashref' => ( $opt{'hashref'} || {} ),
- 'extra_sql' => ( $opt{'extra_sql'} || '' ),
+ 'hashref' => $hashref,
+ 'extra_sql' => $extra_sql,
'order_by' => ( $opt{'order_by'} || "ORDER BY $name_col" ),
});
}
@@ -113,7 +124,7 @@ unless ( ! $value
$opt{hashref}->{$key} = $value;
my $record = qsearchs( {
'table' => $opt{table},
- 'hashref' => $opt{hashref},
+ 'hashref' => $hashref,
'extra_sql' => ( $opt{extra_sql} || '' ),
});
push @records, $record if $record;