function _pmtimetracking_migrate_migrate_single_node in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pmtimetracking/includes/pmtimetracking.migrate.inc \_pmtimetracking_migrate_migrate_single_node()
- 7.2 pmtimetracking/includes/pmtimetracking.migrate.inc \_pmtimetracking_migrate_migrate_single_node()
Helper function to migrate single pmtimetracking.
1 call to _pmtimetracking_migrate_migrate_single_node()
- pmtimetracking_migrate_field_data in pmtimetracking/
includes/ pmtimetracking.migrate.inc - Migrate pmtimetracking node fields data to drupal user bundle.
File
- pmtimetracking/
includes/ pmtimetracking.migrate.inc, line 97 - Migration functions for the PM Timetracking module.
Code
function _pmtimetracking_migrate_migrate_single_node($nid, $vid, $timetracking) {
$node = node_load($nid, $vid);
if (isset($timetracking->datebegin) and !empty($timetracking->datebegin)) {
$node->pm_date[LANGUAGE_NONE][0]['value'] = $timetracking->datebegin;
if (isset($timetracking->dateend) and !empty($timetracking->dateend)) {
$node->pm_date[LANGUAGE_NONE][0]['value2'] = $timetracking->dateend;
}
}
// Ticket >> Task >> Project >> Organization.
if ($timetracking->ticket_nid) {
$node->pmtimetracking_parent[LANGUAGE_NONE][0]['target_id'] = $timetracking->ticket_nid;
}
elseif ($timetracking->task_nid) {
$node->pmtimetracking_parent[LANGUAGE_NONE][0]['target_id'] = $timetracking->task_nid;
}
elseif ($timetracking->project_nid) {
$node->pmtimetracking_parent[LANGUAGE_NONE][0]['target_id'] = $timetracking->project_nid;
}
elseif ($timetracking->organization_nid) {
$node->pmtimetracking_parent[LANGUAGE_NONE][0]['target_id'] = $timetracking->organization_nid;
}
if ($timetracking->duration) {
$node->pm_duration[LANGUAGE_NONE][0]['value'] = $timetracking->duration;
}
$node->pm_durationunit[LANGUAGE_NONE][0]['value'] = 'hour';
if ($timetracking->billing_duration) {
$node->pm_billing_duration[LANGUAGE_NONE][0]['value'] = $timetracking->billing_duration;
}
node_save($node);
return TRUE;
}