Freeside:3:Documentation:Developer/FS/part virtual field
From Freeside
NAME
FS::part_virtual_field - Object methods for part_virtual_field records
SYNOPSIS
use FS::part_virtual_field; $record = new FS::part_virtual_field \%hash; $record = new FS::part_virtual_field { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::part_virtual_field object represents the definition of a custom field (see the BACKGROUND section). FS::part_virtual_field contains the name and base table of the field.
FS::part_virtual_field inherits from FS::Record. The following fields are currently supported:
- vfieldpart - primary key (assigned automatically); name - name of the field; dbtable - table for which this virtual field is defined; length - expected length of the value (UI hint); label - descriptive label for the field (UI hint)
METHODS
- new HASHREF
- Create a new record. To add the record to the database, see "insert".
- widget UI_TYPE MODE [ VALUE ]
- Generates UI code for a widget suitable for editing/viewing the field, based on list_source and length.
- The only UI_TYPE currently supported is 'HTML', and possible MODEs are 'view' and 'edit'.
- In HTML, all widgets are assumed to be table rows. View widgets look like <TR><TD ALIGN="right">Label</TD><TD BGCOLOR="#ffffff">Value</TD></TR>
- (Most of the display style stuff, such as the colors, should probably go into a separate module specific to the UI. That can wait, though. The API for this function won't change.)
- VALUE (optional) is the current value of the field.
- insert
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- delete
- Deletes this record from the database. If there is an error, returns the error, otherwise returns false.
- replace OLD_RECORD
- Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
- check
- If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.