diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-02 22:41:51 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-11 19:21:42 -0600 |
commit | f2c029cf7e49a7597d25d17562a054d6e37731b5 (patch) | |
tree | 9f5d06ef9b29a229dc900c2d00fc8d698bee98d9 /httemplate/misc/xmlhttp-part_pkg.cgi | |
parent | 80cbfd9890ba84c49ee40164e1ec27aff05c272a (diff) |
RT#21463: Option to show disabled package definitions [v4 merge of ajax refactor]
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> |