/** * Load an existing TimecardBug object from the database. * @param int Bug ID * @return object TimecardBug object */ static function load($p_bug_id, $p_load_updates = true) { $t_estimate_table = plugin_table('estimate', 'Timecard'); $t_query = "SELECT * FROM {$t_estimate_table} WHERE bug_id=" . db_param(); $t_result = db_query_bound($t_query, array($p_bug_id)); if (db_num_rows($t_result) < 1) { $t_project = TimecardProject::load(bug_get_field($p_bug_id, 'project_id')); return new TimecardBug($p_bug_id, $t_project->timecard, -1); } $t_row = db_fetch_array($t_result); $t_estimate = new TimecardBug($t_row['bug_id'], $t_row['timecard'], $t_row['estimate']); $t_estimate->timestamp = $t_row['timestamp']; $t_estimate->new = false; if ($p_load_updates) { $t_estimate->load_updates(); } return $t_estimate; }