milestone_save
Triggered upon adding a new or editing an existing milestone.
Teamwork
Input (passed by reference)
$params['type'] string Executed action from the list: 'add', 'edit'.
$params['milestone'] array Milestone properties as an array with the following keys:
$params['list']['id'] int Milestone ID.
$params['list']['name'] string Milestone name.
$params['list']['description'] string Milestone description.
$params['list']['project_id'] int Project ID.
$params['list']['due_date'] date Deadline date.
$params['list']['closed'] bool Flag denoting whether the milestone is completed.
$params['prev_milestone'] array Milestone properties before changes have been saved. Available only when an existing milestone is bing edited. The array stricture is identical to that described for the
$params['milestone'] array Milestone properties as an array with the following keys:
$params['list']['id'] int Milestone ID.
$params['list']['name'] string Milestone name.
$params['list']['description'] string Milestone description.
$params['list']['project_id'] int Project ID.
$params['list']['due_date'] date Deadline date.
$params['list']['closed'] bool Flag denoting whether the milestone is completed.
$params['prev_milestone'] array Milestone properties before changes have been saved. Available only when an existing milestone is bing edited. The array stricture is identical to that described for the
milestone
key.
… your plugin code …
Output
Teamwork
Plugin code example
PHP
public function milestoneSave($params) { if ($params['type'] == 'edit' && $params['milestone']['name'] != $params['prev_milestone']['name']) { waLog::log( sprintf_wp( 'Milestone “%s” renamed to “%s”.', $params['prev_milestone']['name'], $params['milestone']['name'] ), sprintf('tasks/plugins/%s/milestone_save.log', $this->id) ); } }