X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fmisc%2Fxmlhttp-part_pkg.cgi;fp=httemplate%2Fmisc%2Fxmlhttp-part_pkg.cgi;h=187833025a98bca2ad246d3e6c5a4f507bd74d69;hb=3d8dcf062ffb2da2aa4969a516c210680dab266d;hp=0000000000000000000000000000000000000000;hpb=48ce4f3863f2cd4a25eb79fecd3ed5b4b98150cf;p=freeside.git 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); + +