Example #1
0
 /**
  * takes an associative array and adds phone
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object       CRM_Core_BAO_Phone object on success, null otherwise
  * @access public
  * @static
  */
 static function add(&$params)
 {
     // Ensure mysql phone function exists
     CRM_Core_DAO::checkSqlFunctionsExist();
     $hook = empty($params['id']) ? 'create' : 'edit';
     CRM_Utils_Hook::pre($hook, 'Phone', CRM_Utils_Array::value('id', $params), $params);
     $phone = new CRM_Core_DAO_Phone();
     $phone->copyValues($params);
     $phone->save();
     CRM_Utils_Hook::post($hook, 'Phone', $phone->id, $phone);
     return $phone;
 }
 /**
  * takes an associative array and adds phone
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object       CRM_Core_BAO_Phone object on success, null otherwise
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $phone = new CRM_Core_DAO_Phone();
     $phone->copyValues($params);
     // CRM-11006 move calls to pre hook from create function to add function
     if (!empty($params['id'])) {
         CRM_Utils_Hook::pre('edit', 'Phone', $params['id'], $params);
     } else {
         CRM_Utils_Hook::pre('create', 'Phone', NULL, $params);
     }
     $phone->save();
     //CRM-11006 move calls to pre hook from create function to add function
     if (!empty($params['id'])) {
         CRM_Utils_Hook::post('edit', 'Phone', $phone->id, $phone);
     } else {
         CRM_Utils_Hook::post('create', 'Phone', $phone->id, $phone);
     }
     return $phone;
 }
Example #3
0
 /**
  * takes an associative array and adds phone 
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object       CRM_Core_BAO_Phone object on success, null otherwise
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $phone = new CRM_Core_DAO_Phone();
     $phone->copyValues($params);
     return $phone->save();
 }