<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 5 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
+ | Copyright CiviCRM LLC. All rights reserved. |
| |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
*/
function civicrm_api3_membership_type_create($params) {
// Workaround for fields using nonstandard serialization
- foreach (array('relationship_type_id', 'relationship_direction') as $field) {
+ foreach (['relationship_type_id', 'relationship_direction'] as $field) {
if (isset($params[$field]) && is_array($params[$field])) {
$params[$field] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params[$field]);
}
* Array of parameters determined by getfields.
*/
function _civicrm_api3_membership_type_create_spec(&$params) {
- // todo could set default here probably
- $params['domain_id']['api.required'] = 1;
+ $params['domain_id']['api.default'] = CRM_Core_Config::domainID();
$params['member_of_contact_id']['api.required'] = 1;
$params['financial_type_id']['api.required'] = 1;
$params['name']['api.required'] = 1;
if (!empty($results['values']) && is_array($results['values'])) {
foreach ($results['values'] as &$item) {
// Workaround for fields using nonstandard serialization
- foreach (array('relationship_type_id', 'relationship_direction') as $field) {
+ foreach (['relationship_type_id', 'relationship_direction'] as $field) {
if (isset($item[$field]) && !is_array($item[$field])) {
+ // @todo - this should be handled by the serialization now...
$item[$field] = (array) $item[$field];
}
}
return $results;
}
+/**
+ * Adjust Metadata for Get action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $params
+ * Array of parameters determined by getfields.
+ */
+function _civicrm_api3_membership_type_get_spec(&$params) {
+ $params['domain_id']['api.default'] = CRM_Core_Config::domainID();
+}
+
/**
* Adjust input for getlist action.
*