% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>
FS::saved_search - Object methods for saved_search records
use FS::saved_search;
$record = new FS::saved_search \%hash;
$record = new FS::saved_search { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
An FS::saved_search object represents a search (a page in the backoffice UI, typically under search/ or browse/) which a user has saved for future use or periodic email delivery.
FS::saved_search inherits from FS::Record. The following fields are currently supported:
primary key
usernum of the FS::access_user that created the search. Currently, email reports will only be sent to this user.
A descriptive name.
The path to the page within the Mason document space.
The query string for the search.
'Y' to hide the search from the user's Reports / Saved menu.
A frequency for email delivery of this report: daily, weekly, or monthly, or null to disable it.
The timestamp of the last time this report was sent.
'html', 'xls', or 'csv'. Not all reports support all of these.
Creates a new saved search. To add it 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.
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
Delete this record from the database.
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
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.
Returns the next date this report should be sent next. If it's not set for periodic email sending, returns undef. If it is set up but has never been sent before, returns zero.
Returns the CGI query string for the parameters to this report.
Returns the report content as an HTML or Excel file.
Sends the search by email. If anything fails, logs and returns an error.