diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:45:58 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:45:58 -0700 |
commit | a6fe07e49e3fc12169e801b1ed6874c3a5bd8500 (patch) | |
tree | b87a7e6f37da5c8e13eb4d4653cfc8ce9239d8f0 /httemplate/misc/cust-part_pkg.cgi | |
parent | e27244386c346f459d1569db26344407a0372a05 (diff) | |
parent | 005424d0c899aa899f43f583a6c74deb13ea4be1 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts:
httemplate/misc/process/cancel_pkg.html
Diffstat (limited to 'httemplate/misc/cust-part_pkg.cgi')
-rw-r--r-- | httemplate/misc/cust-part_pkg.cgi | 18 |
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', }); |