-#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;
+}