Freeside:3:Documentation:Developer/FS/part pkg link

From Freeside
Jump to: navigation, search

NAME

FS::part_pkg_link - Object methods for part_pkg_link records

SYNOPSIS

 use FS::part_pkg_link;

 $record = new FS::part_pkg_link \%hash;
 $record = new FS::part_pkg_link { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::part_pkg_link object represents an link from one package definition to another. FS::part_pkg_link inherits from FS::Record. The following fields are currently supported:

pkglinknum
primary key
src_pkgpart
Source package (see FS::part_pkg)
dst_pkgpart
Destination package (see FS::part_pkg)
link_type
Link type - currently, "bill" (source package bills a line item from target package), or "svc" (source package includes services from target package), or "supp" (ordering source package creates a target package).
hidden
Flag indicating that this subpackage should be felt, but not seen as an invoice line item when set to 'Y'. Not allowed for "supp" links.

METHODS

new HASHREF
Creates a new link. To add the link to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
If this is a supplemental package link, inserting it will order the supplemental packages for any main packages that already exist.
delete
Delete this record from the database.
If this is a supplemental package link, deleting it will set pkglinknum = null for any related packages, and set those packages to expire on their next bill date.
remove_linked
Removes any supplemental packages that were created by this link, by canceling them and setting their pkglinknum to null. This should be done in preparation for removing the link itself.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid link. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
src_pkg
Returns the source part_pkg object (see FS::part_pkg).
dst_pkg
Returns the source part_pkg object (see FS::part_pkg).

BUGS

SEE ALSO

FS::Record, schema.html from the base documentation.