<?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$
*
*/
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
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']));
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
));