Enhancement A-Z Ongoing

Triggers

Robert Cerny 14 years ago, updated 4 months ago - Id 2104

Issue description

It should be possible to define triggers (or event handlers?). Code should be held in a directory triggers next to the directories domain and services.
Robert Cerny 14 years ago

Developer comments

Triggers are created on the command line with the new create-trigger command. This creates a topic of type Topincs trigger with id ID writes a file into STORE_DIR/php/triggers/ID.php. The user has to 1) specify when the trigger is run and 2) code what the trigger should do.

1) Specify: edit the trigger topic to specify which events the trigger is triggered by. Currently there is four events: name event, occurrence event, role event, and topic event. For each of those events a respective type has to be specified and at least one event type out of: before insert, before update, before delete, after insert, after update, after delete.

2) Code: the trigger is passed on execution the id of the topic in the variable $topic_id. From there he usually will get the Tobject and do whatever he needs to do, e.g. to calculate the duration of a works session:

$session = Tobject::get($topic_id);
if ($session->has_start() && $session->has_end()) {
  $session->set_duration($session->get_start()->diff($session->get_end());
}
Robert Cerny 13 years ago

Use cases

When a work session in the issue store is finalized (the end date is set), the working time on the corresponding issue should be updated.

Robert Cerny 13 years ago

When an issue in the issues store is resolved (resolving date is set), the corresponding product version should be updated.

Robert Cerny 13 years ago

Reporting date

02/01/2011
Robert Cerny 14 years ago

Reported by

Robert Cerny
Robert Cerny 14 years ago

Resolving date

11/20/2011
Robert Cerny 13 years ago

Resolved by

Robert Cerny
Robert Cerny 13 years ago

Resolved in version

Topincs 5.6.0
Robert Cerny 13 years ago

Work sessions4

Start 11/16/2011 9:42:09 a.m.
End 11/16/2011 10:23:49 a.m.
Participant Robert Cerny
Robert Cerny 13 years ago
Start 11/17/2011 8:15:24 a.m.
End 11/17/2011 4:55:05 p.m.
Participant Robert Cerny
Robert Cerny 13 years ago
Start 11/18/2011 10:08:22 a.m.
End 11/18/2011 11:43:56 a.m.
Participant Robert Cerny
Robert Cerny 13 years ago
Start 11/18/2011 2:36:21 p.m.
End 11/18/2011 2:56:42 p.m.
Participant Robert Cerny
Robert Cerny 13 years ago
Alt+Shift+ReturnEdit
Alt+Shift+I A-Z
Alt+Shift+O Ongoing
Alt+Shift+Page upFocus previous group
Alt+Shift+Page downFocus next group
Alt+Shift+SSearch
Alt+Shift+SpaceFocus jump
Alt+Shift+MFocus jump
Alt+Shift+HHelp on/off

Saving …

   

Before we continue …

No internet connection

Edit
IndexOngoingReleasesOpen issues