/** * Function to create a Volunteer Need * takes an associative array and creates a Need object * * This function is invoked from within the web form layer and also from the api layer * * @param array $params (reference ) an assoc array of name/value pairs * * @return object CRM_Volunteer_BAO_Need object * @access public * @static */ static function &create($params) { if (empty($params)) { return; } $need = new CRM_Volunteer_DAO_Need(); $need->copyValues($params); $need->save(); return $need; }
/** * create a Volunteer Need * takes an associative array and creates a Need object * * This function is invoked from within the web form layer and also from the api layer * * @param array $params (reference ) an assoc array of name/value pairs * * @return CRM_Volunteer_BAO_Need object * @access public * @static */ static function &create($params) { $projectId = CRM_Utils_Array::value('project_id', $params); $op = CRM_Core_Action::UPDATE; if (!empty($params['check_permissions']) && !CRM_Volunteer_Permission::checkProjectPerms($op, $projectId)) { CRM_Utils_System::permissionDenied(); // FIXME: If we don't return here, the script keeps executing. This is not // what I expect from CRM_Utils_System::permissionDenied(). return FALSE; } if (empty($params)) { return; } $need = new CRM_Volunteer_DAO_Need(); $need->copyValues($params); $need->save(); return $need; }