<% 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

NAME

FS::saved_search - Object methods for saved_search records

SYNOPSIS

  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;

DESCRIPTION

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:

searchnum

primary key

usernum

usernum of the FS::access_user that created the search. Currently, email reports will only be sent to this user.

searchname

A descriptive name.

path

The path to the page within the Mason document space.

params

The query string for the search.

disabled

'Y' to hide the search from the user's Reports / Saved menu.

freq

A frequency for email delivery of this report: daily, weekly, or monthly, or null to disable it.

last_sent

The timestamp of the last time this report was sent.

format

'html', 'xls', or 'csv'. Not all reports support all of these.

METHODS

new HASHREF

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.

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.

next_send_date

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.

query_string

Returns the CGI query string for the parameters to this report.

render

Returns the report content as an HTML or Excel file.

send

Sends the search by email. If anything fails, logs and returns an error.

SEE ALSO

FS::Record

<% include ('/elements/footer.html' ) %>