diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-02 22:41:51 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-02 22:41:51 -0600 |
commit | 3d8dcf062ffb2da2aa4969a516c210680dab266d (patch) | |
tree | cecb0f8cc4be1dacb805f0a5fcca99a7a4a46dc5 /httemplate/misc/xmlhttp-part_pkg.cgi | |
parent | 48ce4f3863f2cd4a25eb79fecd3ed5b4b98150cf (diff) |
RT21463: Option to show disabled package definitions [refactored to use ajax]
Diffstat (limited to 'httemplate/misc/xmlhttp-part_pkg.cgi')
-rw-r--r-- | httemplate/misc/xmlhttp-part_pkg.cgi | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/httemplate/misc/xmlhttp-part_pkg.cgi b/httemplate/misc/xmlhttp-part_pkg.cgi new file mode 100644 index 000000000..187833025 --- /dev/null +++ b/httemplate/misc/xmlhttp-part_pkg.cgi @@ -0,0 +1,31 @@ +<% encode_json( \@return ) %>\ +<%init> + +# default returned records must maintain consistency with /elements/select-part_pkg.html + +my $extra_sql = ' WHERE ' . FS::part_pkg->curuser_pkgs_sql; + +# equivalent to agent_virt=1 and agent_null=1 in /elements/select-table.html +$extra_sql .= ' AND ' . + $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null' => 1, + ); + +my @records = qsearch( { + 'table' => 'part_pkg', + 'hashref' => {}, + 'extra_sql' => $extra_sql, + 'order_by' => "ORDER BY pkg", +}); + +my @return = map { + { + 'pkgpart' => $_->pkgpart, + 'label' => $_->pkg_comment_only, + 'disabled' => $_->disabled, + } +} @records; + +print STDERR Dumper(\@return); + +</%init> |