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

NAME

FS::report_batch - Object methods for report_batch records

SYNOPSIS

  use FS::report_batch;

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

  $error = $record->insert;

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

  $error = $record->delete;

  $error = $record->check;

DESCRIPTION

An FS::report_batch object represents an order to send a batch of reports to their respective customers or other contacts. FS::report_batch inherits from FS::Record. The following fields are currently supported:

reportbatchnum

primary key

reportname

The name of the report, which will be the same as the file name (minus any directory names). There's an enumerated set of these; you can't use just any report.

send_date

The date the report was sent.

agentnum

The agentnum to limit the report to, if any.

sdate

The start date of the report period.

edate

The end date of the report period.

usernum

The user who ordered the report.

METHODS

new HASHREF

Creates a new report batch. To add the record to the database, see "insert".

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.

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 record. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.

SUBROUTINES

process_send_report JOB, PARAMS

Takes a hash of PARAMS, determines all contacts who need to receive a report, and sends it to them. On completion, creates and stores a report_batch record. JOB is a queue job to receive status messages.

PARAMS can include:

- reportname: the name of the report (listed in the %sendable_reports hash). Required. - msgnum: the FS::msg_template to use for this report. Currently the content of the template is ignored, but the subject line and From/Bcc addresses are still used. Required. - agentnum: the agent to limit the report to. - beginning, ending: the date range to run the report, as human-readable dates (not unix timestamps).

SEE ALSO

FS::Record

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 314:

You forgot a '=back' before '=head1'

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