From 1e6bd1b847a2754af6dc8c02797b53527d5791cf Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sun, 11 Mar 2001 07:36:43 +0000 Subject: [PATCH] Import now working --- addressbook/conv/Import to Addressbook | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/addressbook/conv/Import to Addressbook b/addressbook/conv/Import to Addressbook index 749f4cac19..c43e558010 100644 --- a/addressbook/conv/Import to Addressbook +++ b/addressbook/conv/Import to Addressbook @@ -121,17 +121,19 @@ function import_end_file($buffer) { global $phpgw,$phpgw_info; - - //$contacts = CreateObject("phpgwapi.contacts"); - echo '
'; - for ($i=0;$i'.$i.': '.$name.' => '.$value; - //$contacts->add($phpgw_info["user"]["account_id"],$entry); - } - } - return "Successfully imported $i records into your addressbook."; + $contacts = CreateObject("phpgwapi.contacts"); + echo '
'; + for ($i=1;$i<=count($buffer);$i++) { + while ( list($name,$value) = @each($buffer[$i]) ) { + //echo '
'.$i.': '.$name.' => '.$value; + $entry[$i][$name] = $value; + } + //echo '
'; + $contacts->add($phpgw_info["user"]["account_id"],$entry[$i]); + } + $num = $i - 1; + return "Successfully imported $num records into your addressbook."; } function import_start_record($buffer) { @@ -143,6 +145,7 @@ function import_end_record($buffer,$private="private") { global $phpgw_info; + $buffer[$this->id]=""; while ( list($name, $value) = each($this->currentrecord)) { $buffer[$this->id][$name] = $value; //echo '
'.$name.' => '.$value;