X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=0bb7561da508652ec056c9feafe21a9c84a9add6;hp=0fdc5f54240b0bd4ddce2ef41f11bfbfd639d18e;hb=13f21e01ac9faa50c07f64c20cbceae0ae50790c;hpb=6a38629bcb54a2ad9b8a5de6cac9f478bc4a7e66 diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 0fdc5f542..0bb7561da 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -248,8 +248,27 @@ sub payment_gateway { # seeing the card number my $gatewaynum = $conf->config('selfservice-payment_gateway', $self->agentnum); - my $gateway = FS::payment_gateway->by_key($gatewaynum) - if $gatewaynum; + my $gateway; + $gateway = FS::payment_gateway->by_key($gatewaynum) if $gatewaynum; + return $gateway if $gateway; + + # a little less kludgey than the above, and allows PayPal to coexist + # with credit card gateways + my $is_paypal = { op => '!=', value => 'PayPal' }; + if ( uc($options{method}) eq 'PAYPAL' ) { + $is_paypal = 'PayPal'; + } + + $gateway = qsearchs({ + table => 'payment_gateway', + addl_from => ' JOIN agent_payment_gateway USING (gatewaynum) ', + hashref => { + gateway_namespace => 'Business::OnlineThirdPartyPayment', + gateway_module => $is_paypal, + disabled => '', + }, + extra_sql => ' AND agentnum = '.$self->agentnum, + }); if ( $gateway ) { return $gateway; @@ -430,14 +449,15 @@ sub num_ordered_cust_main { shift->num_sql(FS::cust_main->ordered_sql); } -=item active_cust_main +=item ordered_cust_main -Returns the active customers for this agent, as cust_main objects. +Returns the ordered customers for this agent (customers with packages ordered, +but not yet billed), as cust_main objects. =cut -sub active_cust_main { - shift->cust_main_sql(FS::cust_main->active_sql); +sub ordered_cust_main { + shift->cust_main_sql(FS::cust_main->ordered_sql); }