X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=c102e7be88b1b5106c6df005cc02dab8d476a7d7;hb=8568f687b70154d27c32fe16b0d018420807ded1;hp=2c06a05766b1d703d0a1d50807202b44277f1031;hpb=7e2ab49f83c119aeeaf7142e369b93bef9fdafd0;p=freeside.git diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 2c06a0576..c102e7be8 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -1,9 +1,9 @@ package FS::agent; -use base qw( FS::m2m_Common FS::m2name_Common FS::Record ); +use base qw( FS::Commission_Mixin FS::m2m_Common FS::m2name_Common FS::Record ); use strict; use vars qw( @ISA ); -use Business::CreditCard 0.28; +use Business::CreditCard 0.35; use FS::Record qw( dbh qsearch qsearchs ); use FS::cust_main; use FS::cust_pkg; @@ -265,24 +265,14 @@ sub payment_gateway { my $conf = new FS::Conf; if ( $options{thirdparty} ) { - # still a kludge, but it gets the job done - # and the 'cardtype' semantics don't really apply to thirdparty - # gateways because we have to choose a gateway without ever - # seeing the card number - my $gatewaynum = - $conf->config('selfservice-payment_gateway', $self->agentnum); - 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 + + # 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({ + my $gateway = qsearchs({ table => 'payment_gateway', addl_from => ' JOIN agent_payment_gateway USING (gatewaynum) ', hashref => { @@ -731,6 +721,16 @@ sub num_sales { $sth->fetchrow_arrayref->[0]; } +sub commission_where { + my $self = shift; + 'cust_credit.commission_agentnum = ' . $self->agentnum; +} + +sub sales_where { + my $self = shift; + 'cust_main.agentnum = ' . $self->agentnum; +} + =back =head1 BUGS