function _pmexpense_migrate_migrate_single_node in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pmexpense/includes/pmexpense.migrate.inc \_pmexpense_migrate_migrate_single_node()
- 7.2 pmexpense/includes/pmexpense.migrate.inc \_pmexpense_migrate_migrate_single_node()
Helper function to migrate single pmexpense.
1 call to _pmexpense_migrate_migrate_single_node()
- pmexpense_migrate_field_data in pmexpense/
includes/ pmexpense.migrate.inc - Migrate pmexpense node fields data to drupal user bundle.
File
- pmexpense/
includes/ pmexpense.migrate.inc, line 98 - Migration functions for the PM Expense module.
Code
function _pmexpense_migrate_migrate_single_node($nid, $vid, $expense) {
$node = node_load($nid, $vid);
// Ticket >> Task >> Project >> Organization.
if ($expense->ticket_nid) {
$node->pmexpense_parent[LANGUAGE_NONE][0]['target_id'] = $expense->ticket_nid;
}
elseif ($expense->task_nid) {
$node->pmexpense_parent[LANGUAGE_NONE][0]['target_id'] = $expense->task_nid;
}
elseif ($expense->project_nid) {
$node->pmexpense_parent[LANGUAGE_NONE][0]['target_id'] = $expense->project_nid;
}
elseif ($expense->organization_nid) {
$node->pmexpense_parent[LANGUAGE_NONE][0]['target_id'] = $expense->organization_nid;
}
$node->pm_amount[LANGUAGE_NONE][0]['value'] = $expense->amount;
if ($expense->provider_nid) {
$node->pm_provider[LANGUAGE_NONE][0]['value'] = $expense->provider_nid;
}
node_save($node);
return TRUE;
}