summaryrefslogtreecommitdiff
path: root/httemplate/misc/cust-part_pkg.cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-07-04 18:49:00 -0700
committerIvan Kohler <ivan@freeside.biz>2012-07-04 18:49:00 -0700
commit8f89376bceb710bceb8d2d3b9dd7fe24e7d47cf3 (patch)
tree0bd4bc41720409ceb4dd153acfe5f442508fdb33 /httemplate/misc/cust-part_pkg.cgi
parente185be2238bfd1fb2ca6f36b80c9ad93281fe635 (diff)
quotations, RT#16996
Diffstat (limited to 'httemplate/misc/cust-part_pkg.cgi')
-rw-r--r--httemplate/misc/cust-part_pkg.cgi18
1 files changed, 13 insertions, 5 deletions
diff --git a/httemplate/misc/cust-part_pkg.cgi b/httemplate/misc/cust-part_pkg.cgi
index dcd033ff2..a277ba407 100644
--- a/httemplate/misc/cust-part_pkg.cgi
+++ b/httemplate/misc/cust-part_pkg.cgi
@@ -1,11 +1,19 @@
<% objToJson( \@return ) %>
<%init>
-my( $custnum, $classnum ) = $cgi->param('arg');
+my( $custnum, $prospectnum, $classnum ) = $cgi->param('arg');
-#XXX i guess i should be agent-virtualized. cause "packages a customer can
-#order" is such a huge deal
-my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
+
+my $agent;
+if ( $custnum ) {
+ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
+ or die 'unknown custnum';
+ $agent = $cust_main->agent;
+} else {
+ my $prospect_main = qsearchs('prospect_main', {'prospectnum'=>$prospectnum} )
+ or die 'unknown prospectnum';
+ $agent = $prospect_main->agent;
+}
my %hash = ( 'disabled' => '' );
if ( $classnum > 0 ) {
@@ -19,7 +27,7 @@ my @part_pkg = qsearch({
'hashref' => \%hash,
'extra_sql' =>
' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( 'null'=>1 ).
- ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ),
+ ' AND '. FS::part_pkg->agent_pkgs_sql( $agent ),
'order_by' => 'ORDER BY pkg',
});