<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
* note object. the params array could contain additional unused name/value
* pairs
*
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $ids associated array with note id
+ * @param array $params (reference) an assoc array of name/value pairs
+ * @param array $ids (deprecated) associated array with note id - preferably set $params['id']
*
* @return object $note CRM_Core_BAO_Note object
* @access public
* @static
*/
- static function &add(&$params, $ids) {
+ static function &add(&$params, $ids = array()) {
$dataExists = self::dataExists($params);
if (!$dataExists) {
return CRM_Core_DAO::$_nullObject;
$note->contact_id = $params['entity_id'];
}
}
-
- if (CRM_Utils_Array::value('id', $ids)) {
- $note->id = CRM_Utils_Array::value('id', $ids);
+ $id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
+ if ($id) {
+ $note->id = $id;
}
$note->save();
$childNote = new CRM_Core_DAO_Note();
$childNote->id = $childId;
$childNote->delete();
+ $childNote->free();
$recent[] = $childId;
}
$return = $note->delete();
+ $note->free();
if ($showStatus) {
CRM_Core_Session::setStatus($status, ts('Deleted'), 'success');
}