Freeside:4:Documentation:Developer/FS/cust attachment

From Freeside
Jump to: navigation, search

NAME

FS::cust_attachment - Object methods for cust_attachment records

SYNOPSIS

 use FS::cust_attachment;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::cust_attachment object represents a file attached to a FS::cust_main object. FS::cust_attachment inherits from FS::Record. The following fields are currently supported:

attachnum
Primary key (assigned automatically).
custnum
Customer number (see FS::cust_main).
_date
The date the record was last updated.
usernum
Order taker (see FS::access_user)
filename
The file's name.
mime_type
The Content-Type of the file.
body
The contents of the file.
disabled
If the attachment was disabled, this contains the date it was disabled.

METHODS

new HASHREF
Creates a new attachment object.
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 example. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
size
Returns the size of the attachment in bytes.

BUGS

Doesn't work on non-Postgres systems.

SEE ALSO

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