/** * Release to testing. * The release is not yet shipped, but should be feature-complete. * @param boolean $update_now Actualize the database? */ public function test($update_now = true) { if ($this->planned()) { $this->set_state(Testing, $update_now); $this->time_tested->set_now(); $this->time_next_deadline = $this->time_scheduled; } }
protected function _pre_store() { parent::_pre_store(); if (!$this->exists()) { $this->modifier_id = $this->login->id; $this->time_modified->set_now(); $this->creator_id = $this->login->id; $this->time_created->set_now(); } elseif ($this->state != Abandoned) { // Abandoned items should be abandoned "in-place"; the abandoner is retained in the item's history. if ($this->update_modifier_on_change) { $this->modifier_id = $this->login->id; } $this->time_modified->set_now(); } }
protected function _pre_store() { parent::_pre_store(); $this->user_id = $this->login->id; $this->time_created->set_now(); }
/** * Set the new status for the job. * Does not call 'store'. * @param integer */ public function set_status($status) { if ($status != $this->status) { $this->time_status_changed->set_now(); /** @var $display_options PROJECT_APPLICATION_DISPLAY_OPTIONS */ $display_options = $this->app->display_options; $statuses = $display_options->job_statuses(); $new_status = $statuses[$status]; // If the job is now closed in this branch, set the closer and the time. // If it is once again open, then clear the closer and release. if ($new_status->kind == Job_status_kind_closed) { $this->time_closed->set_now(); $this->closer_id = $this->login->id; if (!$this->_entry->assignee_id) { $this->_entry->assignee_id = $this->login->id; } } else { $this->closer_id = 0; // Clear the release only if the release has been shipped (no longer in planning stage). // Otherwise, the association can stand. $rel = $this->release(); if (isset($rel) && $rel->locked()) { $this->release_id = 0; } } $this->status = $status; } }
/** * @param DATABASE $db */ public function load($db) { parent::load($db); $this->location = $db->f('location'); $this->url_root = strtolower($db->f('url_root')); $this->main_picture_id = $db->f('main_picture_id'); $this->show_celsius = $db->f('show_celsius'); $this->show_times = $db->f('show_times'); $this->max_picture_width = $db->f('max_picture_width'); $this->max_picture_height = $db->f('max_picture_height'); $this->first_day_mode = $db->f('first_day_mode'); $this->last_day_mode = $db->f('last_day_mode'); $this->first_day->set_from_iso($db->f('first_day')); if ($this->last_day_mode == Day_mode_today) { $this->last_day->set_now(); } else { $this->last_day->set_from_iso($db->f('last_day')); } }
$tag_validator = $App->make_tag_validator(Tag_validator_multi_line); $tag_validator->validate($newDescription); $errors = array(); if (sizeof($tag_validator->errors)) { $message = 'Input contained errors.'; $message_type = 'error'; foreach ($tag_validator->errors as $error) { $validation_error = new TEXT_VALIDATION_ERROR(); $validation_error->message = sprintf($error->message, $error->token->data()); $validation_error->line_number = $error->line_number; $validation_error->column_start = $error->column; $validation_error->column_end = $error->column + strlen($error->token->data()); $errors[] = $validation_error; } } else { $now = new DATE_TIME(); $now->set_now(); $f = $now->formatter(); $f->type = Date_time_format_date_and_time; $f->clear_flags(); $formatted_text = $munger->transform($newDescription, $obj); $message = 'Preview updated at ' . $now->format($f) . '.'; $message_type = 'info'; } } else { $message = 'Object for that ID was not found.'; $message_type = 'error'; } $message = $App->get_begin_message($message_type) . $message . $App->get_end_message(); $result = array('text' => $formatted_text, 'errors' => $errors, 'message' => $message, 'modified' => $obj->time_modified->as_iso()); echo json_encode($result);
protected function _pre_store() { parent::_pre_store(); if ($this->unpublished()) { $this->time_published->clear(); $this->publisher_id = 0; if ($this->_state_when_loaded != $this->state) { // State changed; check history items and revoke notification for published items $history_item_query = $this->history_item_query(); /** @var HISTORY_ITEM[] $history_items */ $history_items = $history_item_query->objects(); foreach ($history_items as $history_item) { if ($history_item->kind == History_item_published && $history_item->publication_state == History_item_needs_send) { $history_item->publication_state = History_item_silent; $history_item->store(); } } } } elseif (!$this->time_published->is_valid()) { $this->time_published->set_now(); if ($this->update_modifier_on_change) { $this->publisher_id = $this->login->id; } else { $this->publisher_id = $this->modifier_id; } } }
/** * Remove all queued history items. * Also marks the last time messages were sent. */ public function clear_queued_history_items() { $this->queued_history_item_ids = ''; $this->time_messages_sent->set_now(); }