summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-part_pkg_usageprice.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
committerIvan Kohler <ivan@freeside.biz>2015-10-13 10:10:40 -0700
commit2b2dd969f3c18751afc583ad1e836ab8e6f73b5d (patch)
tree72ad19092f9d3a5118add9a55067b8a97c168f46 /httemplate/misc/xmlhttp-part_pkg_usageprice.html
parentd31d59c63c8f4dfd52ca19a02ffcf32fcf49f497 (diff)
parentcd468ecb9a321ca96254b7204f6dc193b11cd903 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/misc/xmlhttp-part_pkg_usageprice.html')
-rw-r--r--httemplate/misc/xmlhttp-part_pkg_usageprice.html18
1 files changed, 13 insertions, 5 deletions
diff --git a/httemplate/misc/xmlhttp-part_pkg_usageprice.html b/httemplate/misc/xmlhttp-part_pkg_usageprice.html
index d4e2d8469..9decdeff9 100644
--- a/httemplate/misc/xmlhttp-part_pkg_usageprice.html
+++ b/httemplate/misc/xmlhttp-part_pkg_usageprice.html
@@ -1,24 +1,32 @@
<% encode_json( \@return ) %>\
<%init>
-my( $pkgpart ) = $cgi->param('arg');
+my( $pkgpart, $pkgnum ) = $cgi->param('arg');
#could worry about agent-virting this so you can't see the add-on pricing of
# other agents, but not a real-world big worry
my $part_pkg = qsearchs( 'part_pkg', { pkgpart=>$pkgpart } );
+my %curr_quantity;
+if ($pkgnum) {
+ my $cust_pkg = qsearchs( 'cust_pkg', { pkgnum=>$pkgnum } );
+ %curr_quantity = map { $_->usagepricepart, $_->quantity } $cust_pkg->cust_pkg_usageprice;
+}
+
my $num = 0;
-my @return = map {
+# probably don't need to be returning js_only anymore?
+my @return = ($pkgpart, map {
+ my $usagepricepart = $_->usagepricepart;
my @inc = ('/elements/cust_pkg_usageprice.html',
- 'usagepricepart' => $_->usagepricepart,
+ 'usagepricepart' => $usagepricepart,
);
-
+ push(@inc,'curr_quantity',($curr_quantity{$usagepricepart} || 0));
( include(@inc, field=>'usagepricenum'.$num, html_only=>1 ),
include(@inc, field=>'usagepricenum'.$num++, js_only=>1 ),
);
}
- $part_pkg->part_pkg_usageprice;
+ $part_pkg->part_pkg_usageprice);
</%init>