use FS::Record qw( dbh qsearch qsearchs );
use FS::cust_main;
use FS::cust_pkg;
-use FS::agent_type;
-use FS::agent_currency;
use FS::reg_code;
+use FS::agent_payment_gateway;
use FS::TicketSystem;
use FS::Conf;
Returns the FS::agent_type object (see L<FS::agent_type>) for this agent.
-=cut
-
-sub agent_type {
- my $self = shift;
- qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
-}
-
=item agent_cust_main
Returns the FS::cust_main object (see L<FS::cust_main>), if any, for this
Returns the FS::agent_currency objects (see L<FS::agent_currency>), if any, for
this agent.
-=cut
-
-sub agent_currency {
- my $self = shift;
- qsearch('agent_currency', { 'agentnum' => $self->agentnum } );
-}
-
=item agent_currency_hashref
Returns a hash references of supported additional currencies for this agent.
$payment_gateway;
}
+=item invoice_modes
+
+Returns all L<FS::invoice_mode> objects that are valid for this agent (i.e.
+those with this agentnum or null agentnum).
+
+=cut
+
+sub invoice_modes {
+ my $self = shift;
+ qsearch( {
+ table => 'invoice_mode',
+ hashref => { agentnum => $self->agentnum },
+ extra_sql => ' OR agentnum IS NULL',
+ order_by => ' ORDER BY modename',
+ } );
+}
+
=item num_prospect_cust_main
Returns the number of prospects (customers with no packages ever ordered) for
);
}
+=item num_ordered_cust_main
+
+Returns the number of ordered customers for this agent (customers with packages
+ordered, but not yet billed).
+
+=cut
+
+sub num_ordered_cust_main {
+ shift->num_sql(FS::cust_main->ordered_sql);
+}
+
+=item ordered_cust_main
+
+Returns the ordered customers for this agent (customers with packages ordered,
+but not yet billed), as cust_main objects.
+
+=cut
+
+sub ordered_cust_main {
+ shift->cust_main_sql(FS::cust_main->ordered_sql);
+}
+
+
=item num_active_cust_main
Returns the number of active customers for this agent (customers with active