company migration: departement, description, company infos, workflow; config workflow
This commit is contained in:
@@ -80,16 +80,35 @@ process:
|
||||
# data
|
||||
|
||||
field_note: field_note
|
||||
field_departement: field_departement
|
||||
description:
|
||||
plugin: iterator
|
||||
source: body
|
||||
process:
|
||||
value: value
|
||||
format:
|
||||
plugin: default_value
|
||||
default_value: wysiwyg
|
||||
field_infos_from_company:
|
||||
plugin: iterator
|
||||
source: field_infos_from_company
|
||||
process:
|
||||
value: value
|
||||
format:
|
||||
plugin: default_value
|
||||
default_value: wysiwyg
|
||||
field_workflow:
|
||||
plugin: static_map
|
||||
source: workflow
|
||||
map:
|
||||
1: "workflow_creation"
|
||||
2: "workflow_hidden"
|
||||
3: "workflow_visible"
|
||||
4: "workflow_imported"
|
||||
5: "workflow_edited"
|
||||
|
||||
|
||||
# work in progress
|
||||
|
||||
# not ready
|
||||
field_departement: field_departement
|
||||
field_description: body
|
||||
# 'description/value': description
|
||||
# 'description/format': format
|
||||
field_infos_from_company: field_infos_from_company
|
||||
field_attachments: field_attachments
|
||||
|
||||
# workflow ??
|
||||
# field_attachments: field_attachments
|
||||
|
@@ -151,12 +151,19 @@ class D7TaxonomyTermCompany extends FieldableEntity implements ContainerFactoryP
|
||||
// Ensure we're using the right language if the entity is translatable.
|
||||
$field_language = $field['translatable'] ? $language : NULL;
|
||||
$field_values = $this->getFieldValues('node', $field_name, $tode_nid, null, $field_language);
|
||||
drush_print($field_name.': ');
|
||||
print_r($field_values);
|
||||
|
||||
$row->setSourceProperty($field_name, $field_values);
|
||||
}
|
||||
|
||||
// make sure that feild_website url is absolute
|
||||
// drush_print('body: ');
|
||||
// print_r($row->getSourceProperty('body'));
|
||||
$field_infos = $row->getSourceProperty('field_infos_from_company');
|
||||
if(!empty($field_infos)){
|
||||
drush_print('field_infos_from_company: ');
|
||||
print_r($field_infos);
|
||||
}
|
||||
|
||||
// make sure that field_website url is absolute
|
||||
$field_website = $row->getSourceProperty('field_website');
|
||||
if(isset($field_website[0]['url'])){
|
||||
$url = $field_website[0]['url'];
|
||||
@@ -171,10 +178,35 @@ class D7TaxonomyTermCompany extends FieldableEntity implements ContainerFactoryP
|
||||
if(isset($field_phone[0]['number']) && !empty($field_phone[0]['number'])){
|
||||
$national_number = $field_phone[0]['number'];
|
||||
$region = strtoupper($field_phone[0]['country_codes']);
|
||||
$number = $this->phoneUtils->parse($national_number, $region);
|
||||
$row->setSourceProperty('public_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
|
||||
// isValidRegionCode($regionCode)
|
||||
if($this->phoneUtils->isPossibleNumber($national_number, $region)){
|
||||
$number = $this->phoneUtils->parse($national_number, $region);
|
||||
$row->setSourceProperty('public_phone', $this->phoneUtils->format($number, PhoneNumberFormat::E164));
|
||||
}else{
|
||||
// add bad phone number to memo field
|
||||
$memo .= "invalid phone number: ".$national_number.' region: '.$region."\n";
|
||||
drush_print('WARNING: phone number invalide; number: '.$national_number.' region: '.$region);
|
||||
}
|
||||
}
|
||||
|
||||
// attachment files
|
||||
|
||||
// workflow
|
||||
// get the workflow status
|
||||
$query = $this->select('workflow_node', 'wn');
|
||||
$query->fields('wn', ['sid']);
|
||||
$query->condition('wn.nid', $tode_nid);
|
||||
$results = $query->execute()->fetchField();
|
||||
// drush_print('workflow query results : ', 0, null, false);
|
||||
// drush_print_r($results);
|
||||
$row->setSourceProperty('workflow', $results);
|
||||
|
||||
// record migration errors in field_memo
|
||||
if(isset($memo)){
|
||||
$field_memo = $row->getSourceProperty('field_memo');
|
||||
$field_memo[0]['value'] .= "\n".$memo;
|
||||
$row->setSourceProperty('field_memo', $field_memo);
|
||||
}
|
||||
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
Reference in New Issue
Block a user