fixed creation of new contacts to use id=null (not longer -1)

This commit is contained in:
Ralf Becker 2006-07-09 23:35:16 +00:00
parent 2b549bcfe8
commit 95d6f36322
2 changed files with 5 additions and 12 deletions

View File

@ -191,9 +191,9 @@ class sifaddressbook extends bocontacts
* *
* @return int contact id * @return int contact id
* @param string $_vcard the vcard * @param string $_vcard the vcard
* @param int $_abID the internal addressbook id * @param int/string $_abID=null the internal addressbook id or !$_abID for a new enty
*/ */
function addSIF($_sifdata, $_abID) function addSIF($_sifdata, $_abID=null)
{ {
#error_log('ABID: '.$_abID); #error_log('ABID: '.$_abID);
#error_log(base64_decode($_sifdata)); #error_log(base64_decode($_sifdata));
@ -202,10 +202,7 @@ class sifaddressbook extends bocontacts
return false; return false;
} }
// ToDo Lars: This will not work on LDAP if($_abID) {
// either we use "if ($_abID)" and false, null, 0 as $_abID for new entries (prefered, as this works in all other apps)
// or we use something like "if ($_abID && $_abID != -1)" ...
if($_abID > 0) {
// update entry // update entry
$contact['id'] = $_abID; $contact['id'] = $_abID;
} }

View File

@ -19,8 +19,7 @@ class vcaladdressbook extends bocontacts
* import a vard into addressbook * import a vard into addressbook
* *
* @param string $_vcard the vcard * @param string $_vcard the vcard
* @param int $_abID the internal addressbook id * @param int/string $_abID=null the internal addressbook id or !$_abID for a new enty
* @param int $_vcardProfile profile id for mapping from vcard values to egw addressbook
* @return int contact id * @return int contact id
*/ */
function addVCard($_vcard, $_abID) function addVCard($_vcard, $_abID)
@ -29,10 +28,7 @@ class vcaladdressbook extends bocontacts
return false; return false;
} }
// ToDo Lars: This will not work on LDAP if($_abID) {
// either we use "if ($_abID)" and false, null, 0 as $_abID for new entries (prefered, as this works in all other apps)
// or we use something like "if ($_abID && $_abID != -1)" ...
if($_abID > 0) {
// update entry // update entry
$contact['id'] = $_abID; $contact['id'] = $_abID;
} }