[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: addressbook csv_import.php,1.4,1.5
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: addressbook csv_import.php,1.4,1.5 |
Date: |
Thu, 14 Feb 2002 13:42:23 -0500 |
Update of /cvsroot/phpgroupware/addressbook
In directory subversions:/tmp/cvs-serv24825
Modified Files:
csv_import.php
Log Message:
fix for multiple cats separated by ';' and containing " ' " in the cat-names
Index: csv_import.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/csv_import.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** csv_import.php 5 Dec 2001 16:18:07 -0000 1.4
--- csv_import.php 14 Feb 2002 18:42:19 -0000 1.5
***************
*** 91,95 ****
}
! $cats = explode(',',$cats);
while (list($k,$cat) = each($cats))
--- 91,95 ----
}
! $cats = split('[,;]',$cats);
while (list($k,$cat) = each($cats))
***************
*** 105,109 ****
$GLOBALS['phpgw']->categories =
createobject('phpgwapi.categories');
}
! if ($id =
$GLOBALS['phpgw']->categories->name2id( $cat ))
{ // cat exists
$cat2id[$cat] = $ids[$cat] = $id;
--- 105,109 ----
$GLOBALS['phpgw']->categories =
createobject('phpgwapi.categories');
}
! if ($id =
$GLOBALS['phpgw']->categories->name2id( addslashes($cat) ))
{ // cat exists
$cat2id[$cat] = $ids[$cat] = $id;
***************
*** 111,120 ****
else
{ // create new cat
! $GLOBALS['phpgw']->categories->add(
$cat,0,$cat,'','public',0);
! $cat2id[$cat] = $ids[$cat] =
$GLOBALS['phpgw']->categories->name2id( $cat );
}
}
}
! return implode( ',',$ids );
}
--- 111,126 ----
else
{ // create new cat
! $GLOBALS['phpgw']->categories->add(
array('name' => $cat,'descr' => $cat ));
! $cat2id[$cat] = $ids[$cat] =
$GLOBALS['phpgw']->categories->name2id( addslashes($cat) );
}
}
}
! $id_str = implode( ',',$ids );
!
! if (count($ids) > 1) // multiple cats need to be in
','
! {
! $id_str = ",$id_str,";
! }
! return $id_str;
}
***************
*** 309,318 ****
// echo
"'$val'</p>";
- $quote =
$val[0] == '@' ? "'" : '';
-
$reg =
$CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
while
(ereg($reg,$val,$vars))
{ //
expand all CSV fields
! $val =
str_replace($CPre.$vars[1].$CPos,$quote.$fields[index($vars[1],$csv_fields)].$quote,$val);
}
if ($val[0] ==
'@')
--- 315,322 ----
// echo
"'$val'</p>";
$reg =
$CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
while
(ereg($reg,$val,$vars))
{ //
expand all CSV fields
! $val =
str_replace($CPre.$vars[1].$CPos,$val[0] == '@' ?
"'".addslashes($fields[index($vars[1],$csv_fields)])."'" :
$fields[index($vars[1],$csv_fields)],$val);
}
if ($val[0] ==
'@')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: addressbook csv_import.php,1.4,1.5,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.1.1.1,1.2 phpgw_en.lang,1.1.1.1,1.2
- Next by Date:
[Phpgroupware-cvs] CVS: phpgroupware header.inc.php.template,1.37,1.38
- Previous by thread:
[Phpgroupware-cvs] CVS: etemplate/setup etemplates.inc.php,1.1.1.1,1.2 phpgw_en.lang,1.1.1.1,1.2
- Next by thread:
[Phpgroupware-cvs] CVS: phpgroupware header.inc.php.template,1.37,1.38
- Index(es):