id materio
materieau = fixe famille, identifiant (against computer filed) company = fixe multiple comp. with same names + misc Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
@@ -19,6 +19,9 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
'description'=> t('en-fr description implemented on prepare'),
|
||||
'nature'=> t('en-fr nature implemented on prepare'),
|
||||
'language'=> t('en-fr langauge description, used in prepare'),
|
||||
'family' => '',
|
||||
'localisation' => '',
|
||||
'identifiant' => '',
|
||||
);
|
||||
|
||||
$query = db_select(MIG_MAT_SRC_DB .'.product_id', 'pid');
|
||||
@@ -86,6 +89,10 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
$this->addFieldMapping(null, 'quarity');
|
||||
|
||||
$this->addFieldMapping('field_onthologie')->defaultValue(null);
|
||||
|
||||
$this->addFieldMapping('field_famille', 'family');
|
||||
$this->addFieldMapping('field_localisation', 'localisation');
|
||||
$this->addFieldMapping('field_identifiant', 'identifiant');
|
||||
|
||||
|
||||
}
|
||||
@@ -103,7 +110,8 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
foreach ($infos_fr as $record)
|
||||
$infos['fr'] = $record;
|
||||
|
||||
$infos['fr']->description .= "<br />technical : ".$infos['fr']->technical; // . "<br />usage".$infos['fr']->usage
|
||||
if($infos['fr']->technical != '')
|
||||
$infos['fr']->description .= "<br />technical : ".$infos['fr']->technical; // . "<br />usage".$infos['fr']->usage
|
||||
|
||||
$infos_en = db_select(MIG_MAT_SRC_DB .'.product_info', 'pif_en')
|
||||
->condition('pif_en.id_locale', 1)
|
||||
@@ -114,7 +122,8 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
foreach ($infos_en as $record)
|
||||
$infos['en'] = $record;
|
||||
|
||||
$infos['en']->description .= "<br />technical : ".$infos['en']->technical; // . "<br />usage".$infos['en']->usage
|
||||
if($infos['en']->technical != '')
|
||||
$infos['en']->description .= "<br />technical : ".$infos['en']->technical; // . "<br />usage".$infos['en']->usage
|
||||
|
||||
$cr->title = $infos['fr']->name;
|
||||
$cr->name = array($infos['en']->name, $infos['fr']->name);
|
||||
@@ -126,7 +135,6 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
$cr->memo .= ($cr->memo != '' ? "\n\n" : '') . $infos['fr']->keywords;
|
||||
|
||||
|
||||
|
||||
# parse companies
|
||||
// dsm($cr->list_industrial, '-- $cr->list_industrial');
|
||||
// dsm($cr->list_quarity, '$cr->list_quarity');
|
||||
@@ -139,13 +147,16 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
$l = count($industrials);
|
||||
for ($i=0; $i < $l; $i++) {
|
||||
$result = db_select(MIG_MAT_SRC_DB .'.industrial_info', 'iif')
|
||||
->fields('iif', array('company'))
|
||||
->fields('iif', array('id_industrial', 'company'))
|
||||
->condition('iif.id_industrial', $industrials[$i])
|
||||
->distinct()->execute();
|
||||
|
||||
foreach ($result as $record) {
|
||||
// dsm($record);
|
||||
$company = trim($record->company);
|
||||
$same_comp = taxonomy_get_term_by_name($company);
|
||||
if(count($same_comp))
|
||||
$company .= '-'.$record->id_industrial;
|
||||
|
||||
if($quarities[$i] == 'M'){
|
||||
$companies_fab[] = $company;
|
||||
@@ -158,28 +169,34 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
$cr->company_fab = implode(',', $companies_fab);
|
||||
$cr->company_distrib = implode(',', $companies_distrib);
|
||||
|
||||
//
|
||||
// preg_match('/^(\w)([^-]+)-(\d+)$/', $cr->id_materio, $matches);
|
||||
|
||||
preg_match('/^(\w)([^-]+)-(\d+)$/', $cr->id_materio, $matches);
|
||||
// dsm($matches);
|
||||
//
|
||||
$cr->family = $matches[1];
|
||||
$cr->localisation = $matches[2];
|
||||
$cr->identifiant = $matches[3];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function prepare($node, stdClass $row) {
|
||||
// dsm('-- prepare --');
|
||||
// dsm($node, '$node');
|
||||
// dsm($row, '$row');
|
||||
|
||||
|
||||
$node->workflow = 4;
|
||||
|
||||
// $node->field_public_email = array('und'=>array($row->email_contact));
|
||||
|
||||
$node->field_identifiant['und'][0]['value'] = $row->identifiant;
|
||||
}
|
||||
|
||||
// public function complete($node, $row) {
|
||||
// // dsm('-- complete --');
|
||||
// // // Do what you need to do to
|
||||
// // dsm($row, '$row');
|
||||
// // dsm($node, '$node');
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user