bug fixing
ccode homonym companies terms tel to long set to memo instead of phone field Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
9e85e7a105
commit
18982b6700
@ -75,6 +75,8 @@ class MaterioIndustrialAdminUserMigration extends MaterioBasicMigration {
|
||||
return false;
|
||||
|
||||
$cr->company = trim($cr->company);
|
||||
if(count(taxonomy_get_term_by_name($cr->company.'-'.$cr->id_industrial)))
|
||||
$cr->company .= '-'.$cr->id_industrial;
|
||||
|
||||
$cr->memo = "#admin";
|
||||
|
||||
@ -196,11 +198,11 @@ class MaterioIndustrialAdminProfile2Migration extends MaterioBasicMigration {
|
||||
$ccs = cck_phone_countrycodes();
|
||||
$match = 0;
|
||||
foreach ($ccs as $cc => $cc_values) {
|
||||
if('+'.$cr->ccode1_admin == $cc_values['code']){
|
||||
if('+'.preg_replace('/^\+/', '', $cr->ccode1_admin) == $cc_values['code']){
|
||||
$cr->ccode1_admin = $cc;
|
||||
$match++;
|
||||
}
|
||||
if('+'.$cr->ccode2_admin == $cc_values['code']){
|
||||
if('+'.preg_replace('/^\+/', '', $cr->ccode2_admin) == $cc_values['code']){
|
||||
$cr->ccode2_admin = $cc;
|
||||
$match++;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class MaterioCompanyMigration extends MaterioBasicMigration {
|
||||
);
|
||||
|
||||
// Make the mappings
|
||||
$this->addFieldMapping('language')->defaultValue('');
|
||||
$this->addFieldMapping('language')->defaultValue('en');
|
||||
$this->addFieldMapping('is_new')->defaultValue(TRUE);
|
||||
$this->addFieldMapping('created', 'date_creation');
|
||||
$this->addFieldMapping('changed', 'date_modif');
|
||||
@ -95,9 +95,9 @@ class MaterioCompanyMigration extends MaterioBasicMigration {
|
||||
$this->addFieldMapping(NULL, 'zip');
|
||||
$this->addFieldMapping(NULL, 'country_fr');
|
||||
|
||||
$arguments = MigrateLinkFieldHandler::arguments(array('source_field' => 'web_title'));
|
||||
$this->addFieldMapping('field_website', 'web')
|
||||
->arguments($arguments);
|
||||
// $arguments = MigrateLinkFieldHandler::arguments(array('source_field' => 'web_title'));
|
||||
$this->addFieldMapping('field_website', 'web');
|
||||
// ->arguments($arguments);
|
||||
|
||||
$this->addFieldMapping('body')->defaultValue('');
|
||||
$this->addFieldMapping('field_infos_from_company')->defaultValue('');
|
||||
@ -139,6 +139,9 @@ class MaterioCompanyMigration extends MaterioBasicMigration {
|
||||
$cr->premise = substr($adress, 250, 500);
|
||||
$sub = substr($adress, 500, 750);
|
||||
$cr->sub_premise = $sub ? $sub : '';
|
||||
}else{
|
||||
$cr->premise = '';
|
||||
$cr->sub_premise = '';
|
||||
}
|
||||
|
||||
$cr->city = preg_replace('/\\n/', ' ', $cr->city);
|
||||
@ -146,8 +149,7 @@ class MaterioCompanyMigration extends MaterioBasicMigration {
|
||||
$cr->department = array($cr->department_en, $cr->department_fr);
|
||||
$cr->language = array('en', 'fr');
|
||||
|
||||
$cr->web_title = str_replace('http://', '', $cr->web);
|
||||
$cr->web = 'http://' . $cr->web_title;
|
||||
$cr->web = str_replace('http://', '', $cr->web);
|
||||
|
||||
/*
|
||||
TODO multiple company with same name
|
||||
@ -156,8 +158,11 @@ class MaterioCompanyMigration extends MaterioBasicMigration {
|
||||
*/
|
||||
$cr->company = trim($cr->company);
|
||||
$same_comp = taxonomy_get_term_by_name($cr->company);
|
||||
if(count($same_comp))
|
||||
if(count($same_comp)){
|
||||
$cr->company .= '-'.$cr->id_industrial;
|
||||
$cr->memo .= "\n".'#multiple-term';
|
||||
}
|
||||
|
||||
|
||||
$ccs = cck_phone_countrycodes();
|
||||
$match = 0;
|
||||
|
@ -74,7 +74,9 @@ class MaterioIndustrialContactUserMigration extends MaterioBasicMigration {
|
||||
if($cr->email_contact == "")
|
||||
return false;
|
||||
|
||||
$cr->company = trim($cr->company);
|
||||
$cr->company = trim($cr->company);
|
||||
if(count(taxonomy_get_term_by_name($cr->company.'-'.$cr->id_industrial)))
|
||||
$cr->company .= '-'.$cr->id_industrial;
|
||||
|
||||
$cr->memo = "#contact";
|
||||
|
||||
@ -201,11 +203,11 @@ class MaterioIndustrialContactProfile2Migration extends MaterioBasicMigration {
|
||||
$ccs = cck_phone_countrycodes();
|
||||
$match = 0;
|
||||
foreach ($ccs as $cc => $cc_values) {
|
||||
if('+'.$cr->ccode1_contact == $cc_values['code']){
|
||||
if('+'.preg_replace('/^\+/', '', $cr->ccode1_contact) == $cc_values['code']){
|
||||
$cr->ccode1_contact = $cc;
|
||||
$match++;
|
||||
}
|
||||
if('+'.$cr->ccode2_contact == $cc_values['code']){
|
||||
if('+'.preg_replace('/^\+/', '', $cr->ccode2_contact) == $cc_values['code']){
|
||||
$cr->ccode2_contact = $cc;
|
||||
$match++;
|
||||
}
|
||||
@ -213,11 +215,24 @@ class MaterioIndustrialContactProfile2Migration extends MaterioBasicMigration {
|
||||
break;
|
||||
}
|
||||
|
||||
if(strlen($cr->ccode1_contact) > 2 && $cr->tel1_contact != "" ){
|
||||
$cr->memo .= "\n".'tel1 contact : '. $cr->ccode1_contact .' '. $cr->tel1_contact;
|
||||
$cr->tel1_contact = NULL;
|
||||
$cr->ccode1_contact = NULL;
|
||||
}
|
||||
|
||||
if(strlen($cr->tel1_contact) > 15){
|
||||
$cc = cck_phone_countrycodes($cr->ccode1_contact);
|
||||
$cr->memo .= "\n".'tel1 contact : '. $cc['country'] . ' (' . $cc['code'] . ')' .' '. $cr->tel1_contact;
|
||||
$cr->tel1_contact = NULL;
|
||||
$cr->ccode1_contact = NULL;
|
||||
}
|
||||
|
||||
if($cr->tel2_contact != ''){
|
||||
$cc = cck_phone_countrycodes($cr->ccode2_contact);
|
||||
$cr->memo .= "\n".'tel2 contact : '. $cc['country'] . ' (' . $cc['code'] . ')' .' '. $cr->tel2_contact;
|
||||
}
|
||||
|
||||
|
||||
// dsm($cr, '- - - - $cr - - - -');
|
||||
|
||||
return TRUE;
|
||||
|
@ -61,7 +61,7 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
$this->addFieldMapping('status')->defaultValue(1);
|
||||
$this->addFieldMapping('promote')->defaultValue(0);
|
||||
$this->addFieldMapping('sticky')->defaultValue(0);
|
||||
$this->addFieldMapping('language')->defaultValue('fr');
|
||||
$this->addFieldMapping('language')->defaultValue('en');
|
||||
|
||||
$this->addFieldMapping('title', 'title');
|
||||
$this->addFieldMapping('field_memo', 'memo');
|
||||
@ -100,7 +100,7 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
public function prepareRow($cr){
|
||||
// dsm($cr);
|
||||
|
||||
# parse product infos
|
||||
# get product infos FR
|
||||
$infos_fr = db_select(MIG_MAT_SRC_DB .'.product_info', 'pif_fr')
|
||||
->condition('pif_fr.id_locale', 2)
|
||||
->condition('pif_fr.id_product', $cr->id_product)
|
||||
@ -112,7 +112,8 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
|
||||
if($infos['fr']->technical != '')
|
||||
$infos['fr']->description .= "<br />technical : ".$infos['fr']->technical; // . "<br />usage".$infos['fr']->usage
|
||||
|
||||
|
||||
# get product infos EN
|
||||
$infos_en = db_select(MIG_MAT_SRC_DB .'.product_info', 'pif_en')
|
||||
->condition('pif_en.id_locale', 1)
|
||||
->condition('pif_en.id_product', $cr->id_product)
|
||||
@ -124,17 +125,17 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
|
||||
if($infos['en']->technical != '')
|
||||
$infos['en']->description .= "<br />technical : ".$infos['en']->technical; // . "<br />usage".$infos['en']->usage
|
||||
|
||||
|
||||
# set product infos
|
||||
$cr->title = $infos['fr']->name;
|
||||
$cr->name = array($infos['en']->name, $infos['fr']->name);
|
||||
$cr->description = array($infos['en']->description, $infos['fr']->description);
|
||||
$cr->nature = array($infos['en']->nature, $infos['fr']->nature);
|
||||
$cr->language = array('en', 'fr');
|
||||
|
||||
#record keywords on memo
|
||||
# record keywords on memo
|
||||
$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');
|
||||
@ -154,9 +155,8 @@ class MaterioMateriauNodeMigration extends MaterioBasicMigration {
|
||||
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(count(taxonomy_get_term_by_name($company.'-'.$record->id_industrial)))
|
||||
$company .= '-'.$record->id_industrial;
|
||||
|
||||
if($quarities[$i] == 'M'){
|
||||
$companies_fab[] = $company;
|
||||
|
@ -66,7 +66,6 @@ class MaterioIndustrialSampleUserMigration extends MaterioBasicMigration {
|
||||
|
||||
$this->addFieldMapping('field_company', 'company');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function prepareRow($cr) {
|
||||
@ -74,6 +73,8 @@ class MaterioIndustrialSampleUserMigration extends MaterioBasicMigration {
|
||||
return false;
|
||||
|
||||
$cr->company = trim($cr->company);
|
||||
if(count(taxonomy_get_term_by_name($cr->company.'-'.$cr->id_industrial)))
|
||||
$cr->company .= '-'.$cr->id_industrial;
|
||||
|
||||
$cr->memo = "#sample";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user