From f3723634bd6ae547b6b5a895fc3e8e00ec77d098 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 2 Mar 2016 22:41:51 -0600 Subject: RT21463: Option to show disabled package definitions [refactored to use ajax] --- httemplate/misc/xmlhttp-part_pkg.cgi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 httemplate/misc/xmlhttp-part_pkg.cgi (limited to 'httemplate/misc/xmlhttp-part_pkg.cgi') 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); + + -- cgit v1.2.1