Skip to content
Permalink
Browse files

reworked how task/template importing works to minimize the extra quer…

  • Loading branch information
caseysoftware committed Jun 7, 2014
1 parent 8e8054b commit 5437c497c0b974a07a211998d14be5c95f0d3c2d
Showing with 20 additions and 1 deletion.
  1. +20 −1 classes/w2p/Actions/ImportTasks.class.php
@@ -64,6 +64,7 @@ public function importTasks($from_project_id, $to_project_id, $project_start_dat
$orig_task['task_project'] = $to_project_id;
$orig_task['task_sequence'] = 0;
$orig_task['task_path_enumeration'] = '';
$orig_task['task_hours_worked'] = 0;

// This is necessary because we're using bind() and it shifts by timezone
$orig_task['task_start_date'] =
@@ -126,9 +127,27 @@ public function importTasks($from_project_id, $to_project_id, $project_start_dat
foreach($task_list as $key => $data) {
$_task->load($key);
$_task->_updatePathEnumeration();
$_task->updateDynamics();

if (!$_task->task_parent) {
$q->addTable('tasks');
$q->addUpdate('task_parent', $_task->task_id);
$q->addUpdate('task_updated', "'" . $q->dbfnNowWithTZ() . "'", false, true);
$q->addWhere('task_id = ' . (int) $_task->task_id);
$q->exec();
$q->clear();
}
}

$_task->updateDynamics();

$last_task_data = $this->getLastTaskData($to_project_id);
CProject::updateTaskCache(
$to_project_id,
$last_task_data['task_id'],
$last_task_data['last_date'],
$this->getTaskCount($to_project_id)
);

return $errors;
}
}

0 comments on commit 5437c49

Please sign in to comment.
You can’t perform that action at this time.