Jump to content

Richzendy

Members
  • Posts

    6
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Richzendy reacted to Abdy in Create support ticket when a Invoice is paid   
    I think it is not necessary to use events for what you are looking for, from the addService() function you can add a condition that if the configurable option exists, a support ticket is created. The addService() function is automatically executed by the cron task when the invoice related to the service has been paid in full.
    Here's a quick example, assuming that the configurable option for the extra service is named "migration_service":
    public function addService( $package, array $vars = null, $parent_package = null, $parent_service = null, $status = 'pending' ) { ... if (isset($vars['configoptions']['migration_service'])) { // Create support ticket Loader::loadModels($this, ['SupportManager.SupportManagerTickets']); $ticket = $this->SupportManagerTickets->add([ 'department_id' => 1, 'staff_id' => 1, 'client_id' => 1, 'summary' => 'Subject', 'priority' => 'critical', 'status' => 'open' ]); // Add reply if (!is_null($ticket)) { $this->SupportManagerTickets->addReply($ticket, [ 'client_id' => 1, 'contact_id' => 1, 'type' => 'reply', 'details' => 'Reply text' ]); } } ... }  
×
×
  • Create New...