<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$defaults['default_value'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Country', $countryId);
}
- if ($defaults['data_type'] == 'ContactReference' && CRM_Utils_Array::value('filter', $defaults)) {
+ if ($defaults['data_type'] == 'ContactReference' && !empty($defaults['filter'])) {
$contactRefFilter = 'Advance';
if (strpos($defaults['filter'], 'action=lookup') !== FALSE &&
strpos($defaults['filter'], 'group=') !== FALSE
if (isset($dontShowLink)) {
$this->assign('dontShowLink', $dontShowLink);
}
+ if ($this->_action & CRM_Core_Action::ADD &&
+ CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple', 'id')) {
+ $defaults['in_selector'] = 1;
+ }
+
return $defaults;
}
' '
);
$sel->setOptions(array($dt, $it));
+
+ if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'is_multiple')) {
+ $this->add('checkbox', 'in_selector', ts('Display in Table?'));
+ }
+
if ($this->_action == CRM_Core_Action::UPDATE) {
$this->freeze('data_type');
}
/**
* global validation rules for the form
*
- * @param array $fields (referance) posted values of the form
+ * @param array $fields (referance) posted values of the form
+ *
+ * @param $files
+ * @param $self
*
* @return array if errors then list of errors to be posted back to the form,
* true otherwise
break;
case 'ContactReference':
- if ($fields['filter_selected'] == 'Advance' &&
- CRM_Utils_Array::value('filter', $fields)
- ) {
+ if ($fields['filter_selected'] == 'Advance' && !empty($fields['filter'])) {
if (strpos($fields['filter'], 'entity=') !== FALSE) {
$errors['filter'] = ts("Please do not include entity parameter (entity is always 'contact')");
}
- elseif (strpos($fields['filter'], 'action=') === FALSE) {
- $errors['filter'] = ts("Please specify 'action' parameter, it should be 'lookup' or 'get'");
- }
- elseif (strpos($fields['filter'], 'action=get') === FALSE &&
- strpos($fields['filter'], 'action=lookup') === FALSE
- ) {
- $errors['filter'] = ts("Only 'get' and 'lookup' actions are supported.");
+ elseif (strpos($fields['filter'], 'action=get') === FALSE) {
+ $errors['filter'] = ts("Only 'get' action is supported.");
}
}
$self->setDefaults(array('filter_selected', $fields['filter_selected']));
}
// we can not set require and view at the same time.
- if (!empty($fields['is_required']) &&
- CRM_Utils_Array::value('is_view', $fields)
- ) {
+ if (!empty($fields['is_required']) && !empty($fields['is_view'])) {
$errors['is_view'] = ts('Can not set this field Required and View Only at the same time.');
}
}
$filter = 'null';
- if ($dataTypeKey == 11 && CRM_Utils_Array::value('filter_selected', $params)) {
+ if ($dataTypeKey == 11 && !empty($params['filter_selected'])) {
if ($params['filter_selected'] == 'Advance' && trim(CRM_Utils_Array::value('filter', $params))) {
$filter = trim($params['filter']);
}
- elseif ($params['filter_selected'] == 'Group' && CRM_Utils_Array::value('group_id', $params)) {
+ elseif ($params['filter_selected'] == 'Group' && !empty($params['group_id'])) {
$filter = 'action=lookup&group=' . implode(',', $params['group_id']);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
$params['id'] = $this->_id;
}
-
$customField = CRM_Core_BAO_CustomField::create($params);
$this->_id = $customField->id;
$buttonName = $this->controller->getButtonName();
$session = CRM_Core_Session::singleton();
if ($buttonName == $this->getButtonName('next', 'new')) {
- $msg += '<p>' . ts("Ready to add another.") . '</p>';
+ $msg .= '<p>' . ts("Ready to add another.") . '</p>';
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field/add',
'reset=1&action=add&gid=' . $this->_gid
));