Blesta Source Documentation

StaffNoticeTask extends AbstractTask

AbstractYes

Base abstract class from which executable automation tasks may extend.

Also provides for logging task output.

Attributes
#[AllowDynamicProperties]
Table of Contents

Properties

$date
$logger
$options
$task

Methods

__construct() Initialize a new task
loadLanguage() Attempts to load a language file for use
log() Logs the given content for this task
logComplete() Marks the log completed
setDate() Sets the date object for date calculations
isCurrentDay() Determines whether today is the day of the month given
isTimeToRun() Determines whether this task can run at the given date
resetErrors() Reset Input errors on a given object
sendServiceCancelError() Sends the service cancellation error notice email to staff
sendServiceCreateError() Sends the service creation error notice email to staff
sendServiceRenewalError() Sends the service renewal error notice email to staff
sendServiceSuspendError() Sends the service suspension error notice email to staff
sendServiceUnsuspendError() Sends the service unsuspension error notice email to staff
getServiceErrorEmailTags() Retrieves the email tags for the service error email templates
sendServiceErrorNotice() Sends an email error notice to staff
setPackageFields() Sets package meta fields as properties to the object
setServiceFields() Sets service fields as properties to the object
Properties

$date

protected Date $date

An instance of Minphp\Date\Date

$options

protected An $options = []

array of options for this task:

  • print_log True to print logged content to stdout, or false otherwise (default false)
  • cli True if this is being run via the Command-Line Interface, or false otherwise (default true)
Methods

__construct()

Initialize a new task

public __construct(AutomationTypeInterface $task[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$task : AutomationTypeInterface

The raw automation task

$options : array<string|int, mixed> = []

An additional options necessary for the task:

  • print_log True to print logged content to stdout, or false otherwise (default false)
  • cli True if this is being run via the Command-Line Interface, or false otherwise (default true)

loadLanguage()

Attempts to load a language file for use

public loadLanguage([string $directory = null ][, string $langCode = null ][, string $filename = null ]) : mixed
Parameters
$directory : string = null

The path to the directory containing the language file (optional, defaults to the default language directory)

$langCode : string = null

The ISO 639-1/2 language to load the $filename for (e.g. en_us) (optional, defaults to the current language)

$filename : string = null

The name of the file (without extension) containing the file (optional, attempts to load based on the current task name)

log()

Logs the given content for this task

public log(string $content) : mixed
Parameters
$content : string

The content to log to cron

logComplete()

Marks the log completed

public logComplete() : mixed

setDate()

Sets the date object for date calculations

public setDate(Date $date) : mixed
Parameters
$date : Date

An instance of Minphp\Date\Date

isCurrentDay()

Determines whether today is the day of the month given

protected isCurrentDay(int $day) : bool
Parameters
$day : int

The day of the month to check (i.e. in range [1,31])

Return values
bool

True if today is the current day given, false otherwise

isTimeToRun()

Determines whether this task can run at the given date

protected abstract isTimeToRun() : bool
Return values
bool

True if it is time for the task to run, or false otherwise

resetErrors()

Reset Input errors on a given object

protected resetErrors(object $object) : mixed
Parameters
$object : object

An instance of an object containing the Input component

sendServiceCancelError()

Sends the service cancellation error notice email to staff

protected sendServiceCancelError(stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$service : stdClass

An object representing the service

$errors : array<string|int, mixed> = []

A list of errors returned by the module

sendServiceCreateError()

Sends the service creation error notice email to staff

protected sendServiceCreateError(stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$service : stdClass

An object representing the service

$errors : array<string|int, mixed> = []

A list of errors returned by the module

sendServiceRenewalError()

Sends the service renewal error notice email to staff

protected sendServiceRenewalError(stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$service : stdClass

An object representing the service

$errors : array<string|int, mixed> = []

A list of errors returned by the module

sendServiceSuspendError()

Sends the service suspension error notice email to staff

protected sendServiceSuspendError(stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$service : stdClass

An object representing the service

$errors : array<string|int, mixed> = []

A list of errors returned by the module

sendServiceUnsuspendError()

Sends the service unsuspension error notice email to staff

protected sendServiceUnsuspendError(stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$service : stdClass

An object representing the service

$errors : array<string|int, mixed> = []

A list of errors returned by the module

getServiceErrorEmailTags()

Retrieves the email tags for the service error email templates

private getServiceErrorEmailTags(stdClass $client, stdClass $service, stdClass $package, array<string|int, mixed> $errors) : array<string|int, mixed>
Parameters
$client : stdClass

The client

$service : stdClass

The service

$package : stdClass

The package

$errors : array<string|int, mixed>

An array of any errors encountered

Return values
array<string|int, mixed>

A key/value array of email tags

sendServiceErrorNotice()

Sends an email error notice to staff

private sendServiceErrorNotice(string $template, stdClass $service[, array<string|int, mixed> $errors = [] ]) : mixed
Parameters
$template : string

The email template to send (e.g. service_cancel_error)

$service : stdClass

The service object

$errors : array<string|int, mixed> = []

A list of errors returned by the module

setPackageFields()

Sets package meta fields as properties to the object

private setPackageFields(stdClass $package) : stdClass
Parameters
$package : stdClass

The package

Return values
stdClass

The package with package meta fields included as properties

setServiceFields()

Sets service fields as properties to the object

private setServiceFields(stdClass $service) : stdClass
Parameters
$service : stdClass

The service

Return values
stdClass

The service with service fields included as properties

Tags
subpackage

core.Automation.Tasks.Common

copyright

Copyright (c) 2018, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results