Freeside:3:Documentation:Developer/FS/inventory class
From Freeside
< Freeside:3:Documentation:Developer | FS
Revision as of 20:04, 27 June 2012 by Ivan (talk | contribs) (Edit via perl MediaWiki framework (1.13))
NAME
FS::inventory_class - Object methods for inventory_class records
SYNOPSIS
use FS::inventory_class; $record = new FS::inventory_class \%hash; $record = new FS::inventory_class { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::inventory_class object represents a class of inventory, such as "DID numbers" or "physical equipment serials". FS::inventory_class inherits from FS::Record. The following fields are currently supported:
- classnum - primary key; classname - Name of this class
METHODS
- new HASHREF
- Creates a new inventory class. To add the class 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.
- delete
- Delete this record from the database.
- 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 inventory class. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
- num_avail
- Returns the number of available (unused/unallocated) inventory items of this class (see FS::inventory_item).
- num_used
- Returns the number of used (allocated) inventory items of this class (see FS::inventory_class).
- num_total
- Returns the total number of inventory items of this class (see FS::inventory_class).
CLASS METHODS
- searchcell_factory
BUGS
SEE ALSO
FS::inventory_item, FS::Record, schema.html from the base documentation.