/** * Function get the import/export fields for contribution. * * @param bool $checkPermission * * @return array * Associative array of contribution fields */ public static function &getFields($checkPermission = TRUE) { $fields = array(); $fields = array_merge($fields, CRM_Event_DAO_Event::import()); $fields = array_merge($fields, self::getParticipantFields()); $fields = array_merge($fields, CRM_Core_DAO_Discount::export()); return $fields; }
static function &getFields() { $fields = array(); require_once 'CRM/Event/DAO/Event.php'; require_once 'CRM/Core/DAO/Discount.php'; $fields = array_merge($fields, CRM_Event_DAO_Event::import()); $fields = array_merge($fields, self::getParticipantFields()); $fields = array_merge($fields, CRM_Core_DAO_Discount::export()); return $fields; }
/** * Combine all the exportable fields from the lower level objects. * * @param bool $checkPermission * * @return array * array of exportable Fields */ public static function &exportableFields($checkPermission = TRUE) { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } $participantFields = CRM_Event_DAO_Participant::export(); $eventFields = CRM_Event_DAO_Event::export(); $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note', 'type' => CRM_Utils_Type::T_STRING)); $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status', 'type' => CRM_Utils_Type::T_STRING)); $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role', 'type' => CRM_Utils_Type::T_STRING)); $discountFields = CRM_Core_DAO_Discount::export(); $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventFields, $noteField, $discountFields); // add custom data $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant', FALSE, FALSE, FALSE, $checkPermission)); self::$_exportableFields = $fields; } return self::$_exportableFields; }
/** * combine all the exportable fields from the lower levels object * * @return array array of exportable Fields * @access public */ function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } $fields = array(); require_once 'CRM/Core/DAO/Note.php'; $participantFields = CRM_Event_DAO_Participant::export(); $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note')); $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status')); $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role')); require_once 'CRM/Core/DAO/Discount.php'; $discountFields = CRM_Core_DAO_Discount::export(); $fields = array_merge($participantFields, $participantStatus, $participantRole, $noteField, $discountFields); // add custom data $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant')); self::$_exportableFields = $fields; } return self::$_exportableFields; }
/** * Determine in which discount set the registration date falls * * @param integer $entityId entity id to be searched * @param string $entityTable entity table to be searched * * @return integer $dao->id discount id of the set which matches * the date criteria */ static function findSet($entityID, $entityTable) { if (empty($entityID) || empty($entityTable)) { // adding this here, to trap errors if values are not sent CRM_Core_Error::fatal(); return NULL; } $dao = new CRM_Core_DAO_Discount(); $dao->entity_id = $entityID; $dao->entity_table = $entityTable; $dao->find(); while ($dao->fetch()) { $endDate = $dao->end_date; // if end date is not we consider current date as end date if (!$endDate) { $endDate = date('Ymd'); } $falls = CRM_Utils_Date::getRange($dao->start_date, $endDate); if ($falls == TRUE) { return $dao->id; } } return FALSE; }
/** * combine all the exportable fields from the lower levels object * * @return array array of exportable Fields * @access public * @static */ static function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } $fields = array(); $participantFields = CRM_Event_DAO_Participant::export(); $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note')); $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status')); $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role')); //campaign fields. if (isset($participantFields['participant_campaign_id'])) { $participantFields['participant_campaign'] = array('title' => ts('Campaign Title')); } $discountFields = CRM_Core_DAO_Discount::export(); $fields = array_merge($participantFields, $participantStatus, $participantRole, $noteField, $discountFields); // add custom data $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant')); self::$_exportableFields = $fields; } return self::$_exportableFields; }
/** * returns the list of fields that can be exported * * @access public * return array */ function &export($prefix = false) { if (!self::$_export) { self::$_export = array(); $fields =& self::fields(); foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['discount'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * class constructor */ function __construct() { parent::__construct(); }
/** * combine all the exportable fields from the lower levels object * * @return array array of exportable Fields * @access public * @static */ static function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); } $fields = array(); $participantFields = CRM_Event_DAO_Participant::export(); $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note')); $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status')); $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role')); //CRM-13595 add event id to participant export $eventid = array('event_id' => array('title' => 'Event ID', 'name' => 'event_id')); $eventtitle = array('event_title' => array('title' => 'Event Title', 'name' => 'event_title')); $discountFields = CRM_Core_DAO_Discount::export(); $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventid, $eventtitle, $noteField, $discountFields); // add custom data $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant')); self::$_exportableFields = $fields; } return self::$_exportableFields; }
/** * Determine in which discount set the registration date falls * * @param integer $entityId entity id to be searched * @param string $entityTable entity table to be searched * * @return integer $dao->id discount id of the set which matches * the date criteria */ static function findSet($entityID, $entityTable) { if (empty($entityID) || empty($entityTable)) { // adding this here, to trap errors if values are not sent CRM_Core_Error::fatal(); return null; } require_once 'CRM/Core/DAO/Discount.php'; $dao = new CRM_Core_DAO_Discount(); $dao->entity_id = $entityID; $dao->entity_table = $entityTable; $dao->find(); require_once "CRM/Utils/Date.php"; while ($dao->fetch()) { $endDate = $dao->end_date; // if end date is not we consider current date as end date if (!$endDate) { $endDate = date('Ymd'); } $falls = CRM_Utils_Date::getRange($dao->start_date, $endDate); if ($falls == true) { return $dao->id; } } return false; }