Difference between revisions of "Freeside:3:Documentation:Developer/FS/cust attachment"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 1: Line 1:
==NAME==
 
FS::cust_attachment - Object methods for cust_attachment records
 
  
==SYNOPSIS==
 
<code>
 
  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;
 
</code>
 
==DESCRIPTION==
 
An FS::cust_attachment object represents a file attached to a [[Freeside:3:Documentation:Developer/FS/cust main|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 [[Freeside:3:Documentation:Developer/FS/cust main|FS::cust_main]]).
 
; _date
 
:The date the record was last updated.
 
; usernum
 
:Order taker (see [[Freeside:3:Documentation:Developer/FS/access user|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==
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation.
 

Revision as of 06:26, 10 February 2015