% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::agent - Object methods for agent records
use FS::agent;
$record = new FS::agent \%hash;
$record = new FS::agent { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
$agent_type = $record->agent_type;
$hashref = $record->pkgpart_hashref;
#may purchase $pkgpart if $hashref->{$pkgpart};
An FS::agent object represents an agent. Every customer has an agent. Agents can be used to track things like resellers or salespeople. FS::agent inherits from FS::Record. The following fields are currently supported:
primary key (assigned automatically for new agents)
Text name of this agent
Agent type (see FS::agent_type)
Ticketing Queue
Invoice template name
Optional agent customer (see FS::cust_main)
Disabled flag, empty or 'Y'
Deprecated (never used)
Deprecated (never used)
(Deprecated) Username for the Agent interface
(Deprecated) Password for the Agent interface
Creates a new agent. To add the agent to the database, see "insert".
Adds this agent to the database. If there is an error, returns the error, otherwise returns false.
Deletes this agent from the database. Only agents with no customers can be deleted. If there is an error, returns the error, otherwise returns false.
Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
Checks all fields to make sure this is a valid agent. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
Returns the FS::agent_type object (see FS::agent_type) for this agent.
Returns the FS::cust_main object (see FS::cust_main), if any, for this agent.
Returns the FS::agent_currency objects (see FS::agent_currency), if any, for this agent.
Returns a hash references of supported additional currencies for this agent.
Returns a hash reference. The keys of the hash are pkgparts. The value is true if this agent may purchase the specified package definition. See FS::part_pkg.
Returns the queue name corresponding with the id from the ticketing_queueid field, or the empty string.
Returns a payment gateway object (see FS::payment_gateway) for this agent.
Currently available options are nofatal, method, thirdparty and conf.
If nofatal is set, and no gateway is available, then the empty string will be returned instead of throwing a fatal exception.
The method option can be used to influence the choice as well. Presently only CHEK/ECHECK and PAYPAL methods are meaningful.
If method is CHEK/ECHECK and the default gateway is being returned, the business-onlinepayment-ach gateway will be returned if available.
If thirdparty is set and the method is PAYPAL, the defined paypal gateway will be returned.
Exisisting $conf may be passed for efficiency.
Returns all FS::invoice_mode objects that are valid for this agent (i.e. those with this agentnum or null agentnum).
Returns the number of prospects (customers with no packages ever ordered) for this agent.
Returns the prospects (customers with no packages ever ordered) for this agent, as cust_main objects.
Returns the number of ordered customers for this agent (customers with packages ordered, but not yet billed).
Returns the ordered customers for this agent (customers with packages ordered, but not yet billed), as cust_main objects.
Returns the number of active customers for this agent (customers with active recurring packages).
Returns the active customers for this agent, as cust_main objects.
Returns the number of inactive customers for this agent (customers with no active recurring packages, but otherwise unsuspended/uncancelled).
Returns the inactive customers for this agent, as cust_main objects.
Returns the number of suspended customers for this agent.
Returns the suspended customers for this agent, as cust_main objects.
Returns the number of cancelled customer for this agent.
Returns the cancelled customers for this agent, as cust_main objects.
Returns the number of active customer packages for this agent.
Returns the number of inactive customer packages (one-time packages otherwise unsuspended/uncancelled) for this agent.
Returns the number of suspended customer packages for this agent.
Returns the number of cancelled customer packages for this agent.
Returns the number of inactive customer packages (one-time packages otherwise unsuspended/uncancelled) for this agent.
Returns the number of inactive customer packages (one-time packages otherwise unsuspended/uncancelled) for this agent.
Generates the specified number of registration codes, allowing purchase of the specified package definitions. Returns an array reference of the newly generated codes, or a scalar error message.
Returns the number of unused registration codes for this agent.
Returns the number of unused prepaid cards for this agent.
Returns the number of non-disabled sales people for this agent.
FS::Record, FS::agent_type, FS::cust_main, FS::part_pkg, schema.html from the base documentation.