From 52c9a867043f727a78cc256d06622d9141fcbcec Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 16 Jun 2014 20:08:17 +0000 Subject: [PATCH] addr_id function moved to importexport_basic_import_csv so it can be used for all apps --- .../class.infolog_import_infologs_csv.inc.php | 41 +------------------ ...infolog_wizard_import_infologs_csv.inc.php | 4 +- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/infolog/inc/class.infolog_import_infologs_csv.inc.php b/infolog/inc/class.infolog_import_infologs_csv.inc.php index 07d7757a83..cf9b0249b0 100644 --- a/infolog/inc/class.infolog_import_infologs_csv.inc.php +++ b/infolog/inc/class.infolog_import_infologs_csv.inc.php @@ -237,7 +237,7 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { if ($record['addressbook'] && !is_numeric($record['addressbook'])) { list($lastname,$firstname,$org_name) = explode(',',$record['addressbook']); - $record['addressbook'] = self::addr_id($lastname,$firstname,$org_name); + $record['addressbook'] = importexport_basic_import_csv::addr_id($lastname,$firstname,$org_name); } if ($record['projectmanager'] && !is_numeric($record['projectmanager'])) { @@ -501,45 +501,6 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { // end of iface_export_plugin // Extra conversion functions - must be static - public static function addr_id( $n_family,$n_given=null,$org_name=null ) { - - // find in Addressbook, at least n_family AND (n_given OR org_name) have to match - static $contacts; - if (is_null($n_given) && is_null($org_name)) - { - // Maybe all in one - list($n_family, $n_given, $org_name) = explode(',', $n_family); - } - $n_family = trim($n_family); - if(!is_null($n_given)) $n_given = trim($n_given); - if (!is_object($contacts)) - { - $contacts =& CreateObject('phpgwapi.contacts'); - } - if (!is_null($org_name)) // org_name given? - { - $org_name = trim($org_name); - $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" ); - if (!count($addrs)) - { - $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name",'','n_family,org_name'); - } - } - if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) // first name given and no result so far - { - $addrs = $contacts->search(array('n_family' => $n_family, 'n_given' => $n_given)); - } - if (is_null($n_given) && is_null($org_name)) // just one name given, check against fn (= full name) - { - $addrs = $contacts->read( 0,0,array('id'),'',"n_fn=$n_family",'','n_fn' ); - } - if (count($addrs)) - { - return $addrs[0]['id']; - } - return False; - } - public static function project_id($num_or_title) { static $boprojects; diff --git a/infolog/inc/class.infolog_wizard_import_infologs_csv.inc.php b/infolog/inc/class.infolog_wizard_import_infologs_csv.inc.php index 4cc8b885f7..4ef48e3112 100644 --- a/infolog/inc/class.infolog_wizard_import_infologs_csv.inc.php +++ b/infolog/inc/class.infolog_wizard_import_infologs_csv.inc.php @@ -3,10 +3,10 @@ * eGroupWare - Wizard for Infolog CSV import * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @package addressbook + * @package infolog * @link http://www.egroupware.org * @author Nathan Gray - * @version $Id: $ + * @version $Id$ */ class infolog_wizard_import_infologs_csv extends importexport_wizard_basic_import_csv