Freeside:4:Documentation:Developer/FS/cust main/Packages
From Freeside
< Freeside:4:Documentation:Developer | FS | cust main
Revision as of 07:34, 18 November 2015 by Jeremyd (talk | contribs) (Edit via perl MediaWiki framework (1.13))
Contents
NAME
FS::cust_main::Packages - Packages mixin for cust_main
SYNOPSIS
DESCRIPTION
These methods are available on FS::cust_main objects;
METHODS
- order_pkg HASHREF | OPTION => VALUE ...
- Orders a single package.
- Note that if the package definition has supplemental packages, those will be ordered as well.
- Options may be passed as a list of key/value pairs or as a hash reference. Options are:
- cust_pkg
- FS::cust_pkg object
- cust_location
- Optional FS::cust_location object. If not specified, the customer's ship_location will be used.
- svcs
- Optional arryaref of FS::svc_* service objects.
- depend_jobnum
- If this option is set to a job queue jobnum (see FS::queue), all provisioning jobs will have a dependancy on the supplied job (they will not run until the specific job completes). This can be used to defer provisioning until some action completes (such as running the customer's credit card successfully).
- noexport
- This option is option is deprecated but still works for now (use depend_jobnum instead for new code). If noexport is set true, no provisioning jobs (exports) are scheduled. (You can schedule them later with the reexport method for each cust_pkg object. Using the reexport method on the cust_main object is not recommended, as existing services will also be reexported.)
- ticket_subject
- Optional subject for a ticket created and attached to this customer
- ticket_queue
- Optional queue name for ticket additions
- order_pkgs HASHREF [ , OPTION => VALUE ... ]
- Like the insert method on an existing record, this method orders multiple packages and included services atomicaly. Pass a Tie::RefHash data structure to this method containing FS::cust_pkg and FS::svc_tablename objects. There should be a better explanation of this, but until then, here's an example:
use Tie::RefHash; tie %hash, 'Tie::RefHash'; #this part is important %hash = ( $cust_pkg => [ $svc_acct ], ... ); $cust_main->order_pkgs( \%hash, 'noexport'=>1 );
- Services can be new, in which case they are inserted, or existing unaudited services, in which case they are linked to the newly-created package.
- Currently available options are: depend_jobnum, noexport, seconds_ref, upbytes_ref, downbytes_ref, totalbytes_ref, and allow_pkgpart.
- If depend_jobnum is set, all provisioning jobs will have a dependancy on the supplied jobnum (they will not run until the specific job completes). This can be used to defer provisioning until some action completes (such as running the customer's credit card successfully).
- The noexport option is deprecated but still works for now (use depend_jobnum instead for new code). If noexport is set true, no provisioning jobs (exports) are scheduled. (You can schedule them later with the reexport method for each cust_pkg object. Using the reexport method on the cust_main object is not recommended, as existing services will also be reexported.)
- If seconds_ref, upbytes_ref, downbytes_ref, or totalbytes_ref is provided, the scalars (provided by references) will be incremented by the values of the prepaid card.`
- allow_pkgpart is passed to FS::cust_pkg->insert.
- attach_pkgs
- Merges this customer's package's into the target customer and then cancels them.
- all_pkgs [ OPTION => VALUE... | EXTRA_QSEARCH_PARAMS_HASHREF ]
- Returns all packages (see FS::cust_pkg) for this customer.
- cust_pkg
- Synonym for all_pkgs.
- ncancelled_pkgs [ EXTRA_QSEARCH_PARAMS_HASHREF ]
- Returns all non-cancelled packages (see FS::cust_pkg) for this customer.
- suspended_pkgs
- Returns all suspended packages (see FS::cust_pkg) for this customer.
- unflagged_suspended_pkgs
- Returns all unflagged suspended packages (see FS::cust_pkg) for this customer (thouse packages without the `manual_flag' set).
- unsuspended_pkgs
- Returns all unsuspended (and uncancelled) packages (see FS::cust_pkg) for this customer.
- active_pkgs
- Returns all unsuspended (and uncancelled) packages (see FS::cust_pkg) for this customer that are active (recurring).
- ncancelled_active_pkgs
- Returns all non-cancelled packages (see FS::cust_pkg) for this customer that are active (recurring).
- billing_pkgs
- Returns active packages, and also any suspended packages which are set to continue billing while suspended.
- next_bill_date
- Returns the next date this customer will be billed, as a UNIX timestamp, or undef if no billing package has a next bill date.
- num_cancelled_pkgs
- Returns the number of cancelled packages (see FS::cust_pkg) for this customer.