You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 39 Next »

Creating an event handler in Blesta consists of merely filling in a stubbed callback method, or returning an array of callbacks from a plugin's getEvents() method. Blesta offers a number of events that are automatically triggered when needed. The default handlers for these events may be found in the /installdir/core/Util/Events/Observers/ directory (/installdir/components/events/default/ in the old system). You can paste your event handler code directly into any of the default handler methods, or more preferably, create a plugin to handle the event.

Events

Create a Plugin to Handle these Events

Any plugin can register an event handler. To see how, check out the Plugin Events section of this manual.


Deprecated Handlers

As of v4.3.0 all of the old event handlers from the Events component (under /installdir/components/events/default/) have been deprecated. It is highly recommended that you update your custom events to use the new namespaced event system.

If your plugin uses any of the events below, you need only be sure that your event handler support the deprecated EventObject event as well as the new \Blesta\Core\Util\Events\Common\EventInterface event.


EventTriggered WhenDefault Event HandlerParametersReturnsSince
Appcontroller.preActionA URI is requested

Deprecated: EventsAppControllerCallback::preAction()

New: \Blesta\Core\Util\Events\Observers\AppController::preAction()

voidvoid3.0
Appcontroller.structureA URI is requested without AJAX

Deprecated: EventsAppControllerCallback::structure()

New: \Blesta\Core\Util\Events\Observers\AppController::structure()

  • controller - The controller being requested
  • action - The action being requested
  • portal - The portal in use ('admin' or 'client')
  • get (since version 4.3) - The GET page arguments
  • plugin (since version 4.3) - The name of the plugin in the request, if any, otherwise null

array

Key/value pairs to be set as variables in the structure view. Special keys include:

  • head - An array of markup to set in the <head> tag
  • body_start - An array of markup to set just after the <body> tag
  • body_end - An array of markup to set just before the </body> tag
3.3
CalendarEvents.addA calendar event is created

Deprecated: EventsCalendarEventsCallback::add()

New: \Blesta\Core\Util\Events\Observers\CalendarEvents::add()

  • calendar_event_id - The ID of the calendar event that was created.
  • vars - An array of input data which may include:
    • company_id - The ID of the company under which this event was added
    • staff_id - The ID of the staff member that created this event
    • shared - Whether or not this event is shared among other staff members of this company
    • title - The title of the event
    • url - The URL this event is linked to
    • start_date - The start date of the event
    • end_date - The end date of the event
    • all_day - Whether or not this event spans the entire day of the start/end dates
void4.1
CalendarEvents.editA calendar event is updated

Deprecated: EventsCalendarEventsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\CalendarEvents::edit()

  • calendar_event_id - The ID of the calendar event that was updated.
  • vars - An array of input data which may include:
    • company_id - The ID of the company under which this event was added
    • staff_id - The ID of the staff member that created this event
    • shared - Whether or not this event is shared among other staff members of this company
    • title - The title of the event
    • url - The URL this event is linked to
    • start_date - The start date of the event
    • end_date - The end date of the event
    • all_day - Whether or not this event spans the entire day of the start/end dates
  • old_calendar_event (since version 4.3) - An object representing the previous state of the calendar object
    • company_id - The ID of the company under which this event was added
    • staff_id - The ID of the staff member that created this event
    • shared - Whether or not this event is shared among other staff members of this company
    • title - The title of the event
    • url - The URL this event is linked to
    • start_date - The start date of the event
    • end_date - The end date of the event
    • all_day - Whether or not this event spans the entire day of the start/end dates
    • staff_first_name - The first name of the staff user that create the calendar event
    • staff_last_name - The last name of the staff user that create the calendar event
void4.1
CalendarEvents.deleteA calendar event is removed

Deprecated: EventsCalendarEventsCallback::delete()

New: \Blesta\Core\Util\Events\Observers\CalendarEvents::delete()

  • calendar_event_id - The ID of the calendar event that was removed.
  • old_calendar_event (since version 4.3) - An object representing the previous state of the calendar object
    • company_id - The ID of the company under which this event was added
    • staff_id - The ID of the staff member that created this event
    • shared - Whether or not this event is shared among other staff members of this company
    • title - The title of the event
    • url - The URL this event is linked to
    • start_date - The start date of the event
    • end_date - The end date of the event
    • all_day - Whether or not this event spans the entire day of the start/end dates
    • staff_first_name - The first name of the staff user that create the calendar event
    • staff_last_name - The last name of the staff user that create the calendar event
void4.1

ClientGroups.add

A client group is created

Deprecated: EventsClientGroupsCallback::add()

New: \Blesta\Core\Util\Events\Observers\ClientGroups::add()

  • client_group_id - The ID of the client group that was created.
  • vars - An array of input data which may include:
    • name - The name of this group
    • description - A description of this group
    • company_id - The company ID this group belongs to
    • color - The HTML color that represents this group
void4.1
ClientGroups.editA client group is updated

Deprecated: EventsClientGroupsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\ClientGroups::edit()

  • client_group_id - The ID of the client group that was updated.
  • vars - An array of input data which may include:
    • name - The name of this group
    • description - A description of this group
    • company_id - The company ID this group belongs to
    • color - The HTML color that represents this group
  • old_client_group (since version 4.3) - An object representing the previous state of the group
    • id - The ID of this group
    • name - The name of this group
    • description - A description of this group
    • company_id - The company ID this group belongs to
    • color- The HTML color that represents this group
void4.1
ClientGroups.deleteA client group is removed

Deprecated: EventsClientGroupsCallback::delete()

New: \Blesta\Core\Util\Events\Observers\ClientGroups::delete()

  • client_group_id - The ID of the client group that was removed.
  • old_client_group (since version 4.3) - An object representing the previous state of the group
    • id - The ID of this group
    • name - The name of this group
    • description - A description of this group
    • company_id - The company ID this group belongs to
    • color- The HTML color that represents this group
void4.1
Clients.addA client is added

Deprecated: EventsClientsCallback::add()

New: \Blesta\Core\Util\Events\Observers\Clients::add()

  • client_id - The ID of the client that was added.
  • vars - An array of input data which may include:
    • id_code - The client's reference ID code
    • user_id - The client's user ID
    • client_group_id - The client group this user belongs to
    • status - The status of this client
void4.1
Clients.addNoteA note is created

Deprecated: EventsClientsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Clients::edit()

  • note_id - The ID of the note that was created.
  • vars - An array of input data which may include:
    • title - The title of the note
    • description - The description of the note
    • stickied - Whether this note is sticked or not
void4.1
Clients.createA client is created

Deprecated: EventsClientsCallback::create()

New: \Blesta\Core\Util\Events\Observers\Clients::create()

  • client - An object representing the client that was created.
void3.1
Clients.editA client is updated

Deprecated: EventsClientsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Clients::edit()

  • client_id - The ID of the client that was updated.
  • vars - An array of input data which may include:
    • id_code - The client's reference ID code
    • user_id - The client's user ID
    • client_group_id - The client group this user belongs to
    • status - The status of this client
  • old_client (since version 4.3) - An object representing the previous state of the client
    • id - Internal ID of the group
    • id_format - The format with which to display the ID
    • id_value - The ID of the client to use for display
    • id_code - The client's reference ID code
    • user_id - The client's user ID
    • client_group_id - The client group this user belongs to
    • status - The status of this client
    • primary_account_id - The ID of the primary payment account for this client
    • primary_account_type - The type pf the primary payment account for this client
    • settings - A list of client settings
void4.1
Clients.editNoteA note is updated

Deprecated: EventsClientsCallback::editNote()

New: \Blesta\Core\Util\Events\Observers\Clients::editNote()

  • note_id - The ID of the note that was updated.
  • vars - An array of input data which may include:
    • title - The title of the note
    • description - The description of the note
  • old_client_note (since version 4.3) - An object representing the previous state of the client note
    • id - The ID of client note
    • client_id - The ID the client to which this note is assign
    • staff_id - The ID of the staff member that created this note
    • title - The title of the note
    • description - The full description of this note
    • stickied - Whether to display this not on the client note
    • date_added - The timestamp in UTC that the note was added
    • date_updated - The timestamp in UTC that the note was last updated
void4.1
Clients.deleteA client is removed

Deprecated: EventsClientsCallback::delete()

New: \Blesta\Core\Util\Events\Observers\Clients::delete()

  • client_id - The ID of the client that was removed.
  • old_client (since version 4.3) - An object representing the previous state of the client
    • id - Internal ID of the group
    • id_format - The format with which to display the ID
    • id_value - The ID of the client to use for display
    • id_code - The client's reference ID code
    • user_id - The client's user ID
    • client_group_id - The client group this user belongs to
    • status - The status of this client
    • primary_account_id - The ID of the primary payment account for this client
    • primary_account_type - The type pf the primary payment account for this client
    • settings - A list of client settings
void4.1
Clients.deleteNoteA note is removed

Deprecated: EventsClientsCallback::deleteNote()

New: \Blesta\Core\Util\Events\Observers\Clients::deleteNote()

  • note_id - The ID of the note that was removed.
  • old_client_note - An object representing the previous state of the client note
    • id - The ID of client note
    • client_id - The ID the client to which this note is assign
    • staff_id - The ID of the staff member that created this note
    • title - The title of the note
    • description - The full description of this note
    • stickied - Whether to display this not on the client note
    • date_added - The timestamp in UTC that the note was added
    • date_updated - The timestamp in UTC that the note was last updated
void4.1

Companies.add

A company is created

Deprecated: EventsCompaniesCallback::add()

New: \Blesta\Core\Util\Events\Observers\Clients::add()

  • company_id - The ID of the company that was created.
  • vars - An array of input data which may include:
    • name - The name of the company
    • hostname - The hostname of the company
    • address - The address of the company
    • phone - The phone number of the company
    • fax - The fax number of the company
void4.1

Companies.edit

A company is updated

Deprecated: EventsCompaniesCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Companies::edit()

  • company_id - The ID of the company that was updated.
  • vars - An array of input data which may include:
    • name - The name of the company
    • hostname - The hostname of the company
    • address - The address of the company
    • phone - The phone number of the company
    • fax - The fax number of the company
  • old_company (since version 4.3) - An object representing the previous state of the company
    • id - The ID of the company
    • name - The name of the company
    • hostname - The hostname of the company
    • address - The address of the company
    • phone - The phone number of the company
    • fax - The fax number of the company
void4.1

Companies.delete

A company is removed

Deprecated: EventsCompaniesCallback::delete()

New: \Blesta\Core\Util\Events\Observers\Companies::delete()

  • company_id - The ID of the company that was removed.
  • old_company (since version 4.3) - An object representing the previous state of the company
    • id - The ID of the company
    • name - The name of the company
    • hostname - The hostname of the company
    • address - The address of the company
    • phone - The phone number of the company
    • fax - The fax number of the company
void4.1

Contacts.add

A contact is added

Deprecated: EventsContactsCallback::add()

New: \Blesta\Core\Util\Events\Observers\Contacts::add()

  • contact_id - The ID of the contact that was created.
  • vars - An array of input data which may include:
    • client_id - The client ID this contact will be associated with
    • user_id - The user ID this contact belongs to if this contact has their own unique user record
    • contact_type - The type of contact
    • contact_type_id - The ID of the contact type if contact_type is 'other'
    • first_name - The first name of this contact
    • last_name - The last name of this contact
    • title - The business title for this contact
    • company - The company/organization this contact belongs to
    • email - This contact's email address
    • address1 - This contact's address
    • address2 - This contact's address line two
    • city - This contact's city
    • state - The 3-character ISO 3166-2 subdivision code, requires country
    • zip - The zip/postal code for this contact
    • country - The 2-character ISO 3166-1 country code, required if state is given
    • numbers An array of phone number data
void4.1

Contacts.edit

A contact is updated

Deprecated: EventsContactsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Contacts::edit()

  • contact_id - The ID of the contact that was updated.
  • vars - An array of input data which may include:
    • user_id - The user ID this contact belongs to if this contact has their own unique user record
    • contact_type - The type of contact
    • contact_type_id - The ID of the contact type if contact_type is 'other'
    • first_name - The first name of this contact
    • last_name - The last name of this contact
    • title - The business title for this contact
    • company - The company/organization this contact belongs to
    • email - This contact's email address
    • address1 - This contact's address
    • address2 - This contact's address line two
    • city - This contact's city
    • state - The 3-character ISO 3166-2 subdivision code, requires country
    • zip - The zip/postal code for this contact
    • country - The 2-character ISO 3166-1 country code, required if state is given
    • numbers An array of phone number data
  • old_contact (since version 4.3) - An object representing the previous state of the contact
    • user_id - The user ID this contact belongs to if this contact has their own unique user record
    • contact_type - The type of contact
    • contact_type_name - The name or the language indentifier of the contact type
    • contact_type_is_lang - Whether the contact type name is a language identifier
    • contact_type_id - The ID of the contact type if contact_type is 'other'
    • first_name - The first name of this contact
    • last_name - The last name of this contact
    • title - The business title for this contact
    • company - The company/organization this contact belongs to
    • email - This contact's email address
    • address1 - This contact's address
    • address2 - This contact's address line two
    • city - This contact's city
    • state - The 3-character ISO 3166-2 subdivision code, requires country
    • zip - The zip/postal code for this contact
    • country - The 2-character ISO 3166-1 country code, required if state is given
    • date_added - The timestamp in UTC that the contact was added
void4.1

Contacts.delete

A contact is removed

Deprecated: EventsContactsCallback::delete()

New: \Blesta\Core\Util\Events\Observers\Contacts::delete()

  • contact_id - The ID of the contact that was removed.
  • old_contact (since version 4.3) - An object representing the previous state of the contact
    • user_id - The user ID this contact belongs to if this contact has their own unique user record
    • contact_type - The type of contact
    • contact_type_name - The name or the language indentifier of the contact type
    • contact_type_is_lang - Whether the contact type name is a language identifier
    • contact_type_id - The ID of the contact type if contact_type is 'other'
    • first_name - The first name of this contact
    • last_name - The last name of this contact
    • title - The business title for this contact
    • company - The company/organization this contact belongs to
    • email - This contact's email address
    • address1 - This contact's address
    • address2 - This contact's address line two
    • city - This contact's city
    • state - The 3-character ISO 3166-2 subdivision code, requires country
    • zip - The zip/postal code for this contact
    • country - The 2-character ISO 3166-1 country code, required if state is given
    • date_added - The timestamp in UTC that the contact was added
void4.1
Emails.sendAn email template is sent

Deprecated: EventsEmailsCallback::send()

New: \Blesta\Core\Util\Events\Observers\Emails::send()

  • action - The action that specifies the email group being sent
  • options - An array of options passed to Emails::send(), which may include:
    • to_client_id - The ID of the client the message was sent to
    • from_staff_id - The ID of the staff member the message was sent from
    • from - The from address override
    • from_name - The from name override
    • reply_to - The reply to address override
  • tags - A key/value pair of replacement tags for the email.

array

Key/value pairs to merge with tags.

3.1
Emails.sendCustomA non-template based email is sent

Deprecated: EventsEmailsCallback::sendCustom()

New: \Blesta\Core\Util\Events\Observers\Emails::sendCustom()

  • options - An array of options passed to Emails::send(), which may include:
    • to_client_id - The ID of the client the message was sent to
    • from_staff_id - The ID of the staff member the message was sent from
    • reply_to - The reply to address override
  • tags - A key/value pair of replacement tags for the email.

array

Key/value pairs to merge with tags.

3.1
GatewayManager.addA gateway is added

Deprecated: EventsGatewayManagerCallback::add()

New: \Blesta\Core\Util\Events\Observers\GatewayManager::add()

  • gateway_id - The ID of the gateway that was added.
  • vars - An array of input data which may include:
    • company_id - The ID of the company the gateway belongs to
    • class - The class name for this gateway
    • type - The type of gateway
void4.1
GatewayManager.editA gateway is updated

Deprecated: EventsGatewayManagerCallback::edit()

New: \Blesta\Core\Util\Events\Observers\GatewayManager::edit()

  • gateway_id - The ID of the gateway that was updated.
  • vars - An array of input data which may include:
    • name - The name of the gateway
    • class - The class name for this gateway
    • type - The type of gateway
    • currencies - A numerically indexed array of accepted currencies codes (ISO 4217)
    • meta - A key/value array of meta data
  • old_gateway (since version 4.3) - An object representing the previous state of the gateway
    • id - The ID of the gateway
    • company_id - The ID of the company this gateway is installed for
    • name - The name of the gateway
    • class - The class name for this gateway
    • version - The version of the gateway
    • type - The type of gateway
    • meta - A list of meta data for the gateway
    • currencies - A list of objects representing currencies supported by this gateway
void4.1
GatewayManager.deleteA gateway is removed

Deprecated: EventsGatewayManagerCallback::delete()

New: \Blesta\Core\Util\Events\Observers\GatewayManager::delete()

  • gateway_id - The ID of the gateway that was removed.
  • old_gateway (since version 4.3) - An object representing the previous state of the gateway
    • id - The ID of the gateway
    • company_id - The ID of the company this gateway is installed for
    • name - The name of the gateway
    • class - The class name for this gateway
    • version - The version of the gateway
    • type - The type of gateway
    • meta - A list of meta data for the gateway
    • currencies - A list of objects representing currencies supported by this gateway
void4.1
Invoices.addAn invoice is created

Deprecated: EventsInvoicesCallback::add()

New: \Blesta\Core\Util\Events\Observers\Invoices::add()

  • invoice_id - The ID of the invoice created
void3.1
Invoices.editAn invoice is updated

Deprecated: EventsInvoicesCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Invoices::Edit()

  • invoice_id - The ID of the invoice updated
  • old_invoice (since version 4.3) - An object representing the previous state of the invoice
    • id - The ID of the invoice
    • id_format - The format that the ID value should be displayed in
    • id_value - The ID for display
    • client_id - The client ID the invoice belongs to
    • date_billed - The date the invoice goes into effect
    • date_due - The date the invoice is due
    • date_closed - The date the invoice was closed
    • date_autodebit - The date the invoice should be autodebited
    • autodebit - Whether the invoice can be autodebited
    • status - The status of the invoice ('active','draft','proforma', or 'void')
    • subtotal - The subtotal of the invoice
    • total - The total of the invoice
    • paid - The amount the user has already paid on this invoice
    • previous_due - The amount that was due on this invoice before the last time it was edited
    • currency - The ISO 4217 3-character currency code of the invoice
    • note_public - Notes visible to the client
    • note_private - Notes visible only to staff members
    • line_items - A list of invoice line items
    • delivery - The delivery type for this invoice
    • meta - A list of meta data for this invoice
    • tax_subtotal - The total of inclusive taxes on this invoice
    • tax_total - The total of all taxes on this invoice
    • taxes - The taxes applied to this invoice
void3.1
Invoices.setClosedAn invoice is closed

Deprecated: EventsInvoicesCallback::setClosed()

New: \Blesta\Core\Util\Events\Observers\Invoices::setClosed()

  • invoice_id - The ID of the invoice closed
  • old_invoice (since version 4.3) - An object representing the previous state of the invoice
    • id - The ID of the invoice
    • id_format - The format that the ID value should be displayed in
    • id_value - The ID for display
    • client_id - The client ID the invoice belongs to
    • date_billed - The date the invoice goes into effect
    • date_due - The date the invoice is due
    • date_closed - The date the invoice was closed
    • date_autodebit - The date the invoice should be autodebited
    • autodebit - Whether the invoice can be autodebited
    • status - The status of the invoice ('active','draft','proforma', or 'void')
    • subtotal - The subtotal of the invoice
    • total - The total of the invoice
    • paid - The amount the user has already paid on this invoice
    • previous_due - The amount that was due on this invoice before the last time it was edited
    • currency - The ISO 4217 3-character currency code of the invoice
    • note_public - Notes visible to the client
    • note_private - Notes visible only to staff members
    • line_items - A list of invoice line items
    • delivery - The delivery type for this invoice
    • meta - A list of meta data for this invoice
    • tax_subtotal - The total of inclusive taxes on this invoice
    • tax_total - The total of all taxes on this invoice
    • taxes - The taxes applied to this invoice
void3.1

ModuleManager.add

A module is installed

Deprecated: EventsModuleManagerCallback::add()

New: \Blesta\Core\Util\Events\Observers\New:ModuleManager::add()

  • module_id - The ID of the module that was added.
  • vars - An array of input data which may include:
    • company_id - The ID of the company the module belongs to
    • class - The class name for this module
void4.1
ModuleManager.deleteA module is uninstalled

Deprecated: EventsModuleManagerCallback::delete()

New: \Blesta\Core\Util\Events\Observers\ModuleManager::delete()

  • module_id - The ID of the module that was removed.
  • old_module (since version 4.3) - An object representing the previous state of the module
    • id - The ID of the module
    • company_id - Company ID to which this module is attached
    • name - The name of the module
    • class - The class name for this module
    • version - The current version of this module
    • meta - The meta data associated with this module
    • rows - The rows belonging to this module
    • groups - The module row groups


void4.1
Navigation.getSearchOptionsStaff search options are displayed

Deprecated: EventsNavigationCallback::getSearchOptions()

New: \Blesta\Core\Util\Events\Observers\Navigation::getSearchOptions()

  • options - A key/value pair of search options where each key is the URI to redirect search queries to and the value is the name of the search option. When implemented, the event handler should modify the options parameter using EventObject::setParams().
  • base_uri - The base URI for the currently logged in user.
void3.0

Packages.add

A package is created

Deprecated: EventsPackagesCallback::add()

New: \Blesta\Core\Util\Events\Observers\Packages::add()

  • package_id - The ID of the package that was created.
  • vars - An array of input data which may include:
    • module_id - The ID of the module this package belongs to
    • name - The name of the package
    • description - The description of the package
    • description_html - The HTML description of the package
    • qty - The maximum quantity available in this package, if any
    • module_row - The module row this package belongs to
    • module_group - The module group this package belongs to
    • taxable - Whether or not this package is taxable
    • single_term - Whether or not services derived from this package should be canceled at the end of term
    • status - The status of this package
    • company_id - The ID of the company this package belongs to
    • prorata_day - The prorated day of the month
    • prorata_cutoff - The day of the month pro rata should cut off
    • email_content - A numerically indexed array of email content
    • pricing - A numerically indexed array of pricing info
    • groups - A numerically indexed array of package group assignments
    • option_groups - A numerically indexed array of package option group assignments
    • (any other package field data passed to the module)
void4.1

Packages.edit

A package is updated

Deprecated: EventsPackagesCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Packages::edit()

  • package_id - The ID of the package that was updated.
  • vars - An array of input data which may include:
    • module_id - The ID of the module this package belongs to
    • name - The name of the package
    • description - The description of the package
    • description_html - The HTML description of the package
    • qty - The maximum quantity available in this package, if any
    • module_row - The module row this package belongs to
    • module_group - The module group this package belongs to
    • taxable - Whether or not this package is taxable
    • single_term - Whether or not services derived from this package should be canceled at the end of term
    • status - The status of this package
    • company_id - The ID of the company this package belongs to
    • prorata_day - The prorated day of the month
    • prorata_cutoff - The day of the month pro rata should cut off
    • email_content - A numerically indexed array of email content
    • pricing - A numerically indexed array of pricing info
    • groups - A numerically indexed array of package group assignments
    • option_groups - A numerically indexed array of package option group assignments
    • (any other package field data passed to the module)
  • old_package (since version 4.3) - An object representing the previous state of the package
    • id - The ID of the package
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • module_id - The ID of the module this package belongs to
    • name - The name of the package
    • description - The description of the package
    • description_html - The HTML description of the package
    • qty - The maximum quantity available in this package, if any
    • module_row - The module row this package belongs to
    • module_group - The module group this package belongs to
    • taxable - Whether or not this package is taxable
    • single_term - Whether or not services derived from this package should be canceled at the end of term
    • status - The status of this package
    • company_id - The ID of the company this package belongs to
    • prorata_day - The prorated day of the month
    • prorata_cutoff - The day of the month pro rata should cut off
    • email_content - A numerically indexed array of email content
    • pricing - A numerically indexed array of pricing info
    • meta - The meta data for this package
    • groups - A numerically indexed array of package group assignments
    • option_groups - A numerically indexed array of package option group assignments
void4.1

Packages.delete

A package is removed

Deprecated: EventsPackagesCallback::delete()

New: \Blesta\Core\Util\Events\Observers\Packages::delete()

  • package_id - The ID of the package that was removed.
  • old_package (since version 4.3) - An object representing the previous state of the package
    • id - The ID of the package
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • module_id - The ID of the module this package belongs to
    • name - The name of the package
    • description - The description of the package
    • description_html - The HTML description of the package
    • qty - The maximum quantity available in this package, if any
    • module_row - The module row this package belongs to
    • module_group - The module group this package belongs to
    • taxable - Whether or not this package is taxable
    • single_term - Whether or not services derived from this package should be canceled at the end of term
    • status - The status of this package
    • company_id - The ID of the company this package belongs to
    • prorata_day - The prorated day of the month
    • prorata_cutoff - The day of the month pro rata should cut off
    • email_content - A numerically indexed array of email content
    • pricing - A numerically indexed array of pricing info
    • meta - The meta data for this package
    • groups - A numerically indexed array of package group assignments
    • option_groups - A numerically indexed array of package option group assignments
void4.1
Report.clientDataThe Client Data Portability report is run

Deprecated: EventsReportCallback::clientData()

New: \Blesta\Core\Util\Events\Observers\Report::clientData()

  • client_id - The ID of the client for which this report is being generated

array

A list of data to add to the report

4.3
Services.addA service is added

Deprecated: EventsServicesCallback::add()

New: \Blesta\Core\Util\Events\Observers\Services::add()

  • service_id - The ID of the service added
  • vars - An array of input data which may include:
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row - The module row to add the service under
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • use_module - Whether or not to use the module for this request
    • prorate - Whether or not to prorate price changes
    • configoptions - An array of key/value pairs of package options where the key is the package option ID and the value is the option value
    • (any other service field data passed to the module)
void3.4
Services.editA service is edited

Deprecated: EventsServicesCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Services::edit()

  • service_id - The ID of the service edited
  • vars - An array of input data which may include:
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row - The module row to add the service under
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • use_module - Whether or not to use the module for this request
    • prorate - Whether or not to prorate price changes
    • configoptions - An array of key/value pairs of package options where the key is the package option ID and the value is the option value
    • (any other service field data passed to the module)
  • old_service (since version 4.3) - An object representing the previous state of the service
    • id - The ID of the service
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row_id - The ID of the module row this service was assigned to
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • suspension_reason - The reason given (if any) for the last time this service was suspended
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • fields - A list of service fields
    • package_pricing - An object representing the pricing scheme applied to this service
    • package - An object representing the package this service was create from
    • options - A list of service options
    • name - The name of the service which is derived either from the package or the module this servie belongs to


void3.4
Services.cancelA service is scheduled to be canceled, or is canceled

Deprecated: EventsServicesCallback::cancel()

New: \Blesta\Core\Util\Events\Observers\Services::cancel()

  • service_id - The ID of the service canceled
  • vars - An array of input data which may include:
    • date_canceled - The date this service is scheduled to be canceled
    • status - The status of the service (i.e. 'canceled')
    • use_module - Whether or not to use the module for this request
  • old_service (since version 4.3) - An object representing the previous state of the service
    • id - The ID of the service
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row_id - The ID of the module row this service was assigned to
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • suspension_reason - The reason given (if any) for the last time this service was suspended
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • fields - A list of service fields
    • package_pricing - An object representing the pricing scheme applied to this service
    • package - An object representing the package this service was create from
    • options - A list of service options
    • name - The name of the service which is derived either from the package or the module this servie belongs to
void3.5
Services.suspendA service is suspended

Deprecated: EventsServicesCallback::suspend()

New: \Blesta\Core\Util\Events\Observers\Services::suspend()

  • service_id - The ID of the service suspended
  • vars - An array of input data which may include:
    • date_suspended The date the service was suspended
    • status - The status of the service (i.e. 'suspended')
    • use_module - Whether or not to use the module for this request
    • staff_id - The ID of the staff member that issued the service suspension
  • old_service (since version 4.3) - An object representing the previous state of the service
    • id - The ID of the service
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row_id - The ID of the module row this service was assigned to
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • suspension_reason - The reason given (if any) for the last time this service was suspended
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • fields - A list of service fields
    • package_pricing - An object representing the pricing scheme applied to this service
    • package - An object representing the package this service was create from
    • options - A list of service options
    • name- The name of the service which is derived either from the package or the module this servie belongs to
void3.5
Services.unsuspendA service is unsuspended

Deprecated: EventsServicesCallback::unsuspend()

New: \Blesta\Core\Util\Events\Observers\Services::unsuspend()

  • service_id - The ID of the service unsuspended
  • vars - An array of input data which may include:
    • date_suspended The date the service was suspended (i.e. null)
    • status - The status of the service (i.e. 'active')
    • use_module - Whether or not to use the module for this request
    • staff_id - The ID of the staff member that issued the service unsuspension
  • old_service (since version 4.3) - An object representing the previous state of the service
    • id - The ID of the service
    • parent_service_id - The ID of the service this service is a child of
    • package_group_id - The ID of the package group this service was added from
    • id_format - The format with which the ID value will be displayed
    • id_value - The ID that will be displayed
    • id_code - The formatted ID value
    • pricing_id - The package pricing schedule ID for this service
    • client_id - The ID of the client this service belongs to
    • module_row_id - The ID of the module row this service was assigned to
    • coupon_id - The ID of the coupon used for this service
    • qty - The quanity consumed by this service
    • override_price - The price to set for this service, overriding the package pricing value for the selected term
    • override_currency - The currency to set for this service, overriding the package pricing value for the selected term
    • status - The status of this service
    • suspension_reason - The reason given (if any) for the last time this service was suspended
    • date_added - The date this service is added
    • date_renews - The date the service renews
    • date_last_renewed - The date the service last renewed
    • date_suspended - The date the service was last suspended
    • date_canceled - The date the service was last canceled
    • fields - A list of service fields
    • package_pricing - An object representing the pricing scheme applied to this service
    • package - An object representing the package this service was create from
    • options - A list of service options
    • name - The name of the service which is derived either from the package or the module this servie belongs to
void3.5
Staff.addA staff is created

Deprecated: EventsStaffCallback::add()

New: \Blesta\Core\Util\Events\Observers\Staff::add()

  • staff_id - The ID of the staff that was created.
  • vars - An array of input data which may include:
    • user_id - The user ID belonging to this staff member
    • first_name - The first name of this staff member
    • last_name - The last name of this staff member
    • email - The email address of this staff member
    • email_mobile - The mobile email address of this staff member
    • status - The status of this staff member
    • groups - An array of staff group IDs this staff member belongs to
void4.1
Staff.editA staff is updated

Deprecated: EventsStaffCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Staff::edit

  • staff_id - The ID of the staff that was updated.
  • vars - An array of input data which may include:
    • user_id - The user ID belonging to this staff member
    • first_name - The first name of this staff member
    • last_name - The last name of this staff member
    • email - The email address of this staff member
    • email_mobile - The mobile email address of this staff member
    • status - The status of this staff member
    • groups - An array of staff group IDs this staff member belongs to
  • old_staff (since version 4.3) - An object representing the previous state of the staff member
    • id - The ID of this staff member
    • user_id - The user ID belonging to this staff member
    • first_name - The first name of this staff member
    • last_name - The last name of this staff member
    • email - The email address of this staff member
    • email_mobile - The mobile email address of this staff member
    • status - The status of this staff member
    • username - The user name of this staff member
    • two_factor_mode - Whether and how two factor authentication is being used for this staff member
    • two_factor_pin - The two factor pin (if any) for this staff member
    • two_factor_key - The two factor key (if any) for this staff member
    • groups - An array of staff groups this staff member belongs to
    • settings - A list of staff settings
    • notices - A list of notices assigned to this staff member
void4.1
Transactions.addA transaction is created

Deprecated: EventsTransactionsCallback::add()

New: \Blesta\Core\Util\Events\Observers\Transactions::add()

  • transaction_id - The ID of the transaction created
void3.1
Transactions.editA transaction is updated

Deprecated: EventsTransactionsCallback::edit()

New: \Blesta\Core\Util\Events\Observers\Transactions::edit()

  • transaction_id - The ID of the transaction updated
  • old_transaction (since version 4.3) - An object representing the previous state of the transaction
    • id - The ID of this transaction
    • client_id - The ID of the client this transaction was applied for
    • amount - The amount this transaction was for
    • currency - The currency of this transaction
    • type - The transaction type (cc, ach, other)
    • transaction_type_id - The transaction type ID (if any)
    • account_id - The ID of the payment account (if any) associated with this transaction
    • gateway_id - The ID of the gateway this transaction was made through
    • gateway_name - The name of the gateway this transaction was made through
    • gateway_type - The type of gateway this transaction was made through (merchant or non-merchant)
    • reference_id - The external ID stored for reference to the gateway records
    • transaction_id - The gateway supplied transaction ID
    • parent_transaction_id - The gateway supplied parent transaction ID
    • status - The status of this transaction
    • date_added - The date this transaction was received
void3.1
Users.deleteA user is deleted

Deprecated: EventsUsersCallback::delete()

New: \Blesta\Core\Util\Events\Observers\Users::delete()

  • user_id - The ID of the user being deleted
  • old_user - An object representing the previous state of the user
    • id - The ID of the user

    • username - The username for this user

    • two_factor_mode - The kind of two factor authentication being used by this user

    • date_added - The date in UTC that this user was added

void4.3
Users.loginA user logs in

Deprecated: EventsUsersCallback::login()

New: \Blesta\Core\Util\Events\Observers\Users::login()

  • user_id - The ID of the user that successfully logged in
void3.1
Users.logoutA user logs out

Deprecated: EventsUsersCallback::logout()

New: \Blesta\Core\Util\Events\Observers\Users::logout()

  • user_id - The ID of the user attempting to log out
void3.1

Working with Events

Each event handler that is invoked when the event is triggered is passed a \Blesta\Core\Util\Events\Common\EventInterface (previously an EventObject). An EventObject will still be passed to plugins for backward compatibility, but this is deprecated behavior.

You can modify the parameters or return value of this event object and the modified event will be passed along to each subsequent handler, and finally returned to the trigger.

To fetch parameters from the \Blesta\Core\Util\Events\Common\EventInterface, or EventObject, invoke the getParams() method. Similarly, to set parameters use the setParams() method.

To set the return value from the \Blesta\Core\Util\Events\Common\EventInterface, or EventObject, invoke the setReturnVal() method. Similarly, to fetch the return value use the getReturnVal() method.


  • No labels