From 0b4c7f3ef6afb93e45369da2f88d1fc5813f7d7e Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 29 Oct 2010 07:29:40 +0000 Subject: [PATCH] addressbook: import (import/export integration; if we get countrycodes as countryname, try to translate them -> the rest should be handled by bo classes --- .../inc/class.addressbook_import_contacts_csv.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php index dbbf75d448..ed8b634114 100644 --- a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php @@ -225,7 +225,10 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi case 'update' : // Only update if there are changes $old = $this->bocontacts->read($_data['id']); - + // if we get countrycodes as countryname, try to translate them -> the rest should be handled by bo classes. + foreach(array('adr_one_', 'adr_two_') as $c_prefix) { + if (strlen(trim($_data[$c_prefix.'countryname']))==2) $_data[$c_prefix.'countryname'] = $GLOBALS['egw']->country->get_full_name(trim($_data[$c_prefix.'countryname']),$translated=true); + } // Don't change a user account into a contact if($old['owner'] == 0) { unset($_data['owner']); @@ -239,6 +242,8 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi $changed = $this->tracking->changed_fields($_data, $old); if(count($changed) == 0) { return true; + } else { + //error_log(__METHOD__.__LINE__.array2string($changed).' Old:'.$old['adr_one_countryname'].' ('.$old['adr_one_countrycode'].') New:'.$_data['adr_one_countryname'].' ('.$_data['adr_one_countryname'].')'); } // Make sure n_fn gets updated