function pmexpense_migrate in Drupal PM (Project Management) 8
Same name and namespace in other branches
- 7.3 pmexpense/includes/pmexpense.migrate.inc \pmexpense_migrate()
- 7.2 pmexpense/includes/pmexpense.migrate.inc \pmexpense_migrate()
Helper function for migrating between pmexpense to drupal fields.
1 call to pmexpense_migrate()
- pmexpense_update_7200 in pmexpense/
pmexpense.install - Migrate PM Expense nodes to field_api fields.
File
- pmexpense/
includes/ pmexpense.migrate.inc, line 12 - Migration functions for the PM Expense module.
Code
function pmexpense_migrate(&$sandbox) {
pmexpense_migrate_create_fields($sandbox);
// Migrate data from pmexpense node to Drupal user account.
if (empty($sandbox['pmexpense_current_vid_of_field_being_migrated'])) {
$sandbox['pmexpense_current_vid_of_field_being_migrated'] = 0;
}
if (pmexpense_migrate_field_data($sandbox) == FALSE) {
$sandbox['#finished'] = 0.5;
return;
}
// We don't need pmexpense table anymore, so dropping it.
db_drop_table('pmexpense');
variable_del('node_options_pmexpense');
// PM Permissions default configurations.
variable_set('pm_permission_field_parent_reference_for_pmexpense', 'pmexpense_parent');
variable_set('pm_permission_node_pmexpense_enabled', TRUE);
module_load_include('inc', 'pm', 'includes/pm.permission.migrate');
pm_permission_migrate_execute('pmexpense');
$sandbox['#finished'] = 1;
return 'PM Note nodes have been migrated to field_api based fields successfully.';
}