예제 #1
0
 /**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  * @static
  */
 static 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['volunteer_project'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }
예제 #2
0
 /**
  * Initialize this object with provided values. This override adds a little
  * data massaging prior to calling its parent.
  *
  * @param mixed $params
  *   An associative array of name/value pairs or a CRM_Core_DAO object
  *
  * @return boolean      did we copy all null values into the object
  * @access public
  */
 public function copyValues(&$params)
 {
     if (is_a($params, 'CRM_Core_DAO')) {
         $params = get_object_vars($params);
     }
     if (array_key_exists('is_active', $params)) {
         /*
          * don't force is_active to have a value if none was set, to allow searches
          * where the is_active state of Projects is irrelevant
          */
         $params['is_active'] = CRM_Volunteer_BAO_Project::isOff($params['is_active']) ? 0 : 1;
     }
     return parent::copyValues($params);
 }
/**
 * This is an implementation of hook_civicrm_fieldOptions
 * It includes `civicrm_volunteer_project` in the whitelist
 * of tables allowed to have UFJoins
 *
 * @param $entity
 * @param $field
 * @param $options
 * @param $params
 */
function volunteer_civicrm_fieldOptions($entity, $field, &$options, $params)
{
    if ($entity == "UFJoin" && $field == "entity_table" && $params['context'] == "validate") {
        $options[CRM_Volunteer_DAO_Project::getTableName()] = CRM_Volunteer_DAO_Project::getTableName();
    }
}