$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_default', ts('Default?'));
- if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) {
- $this->freeze(array('name', 'description', 'is_active'));
+
+ if ($this->_action & CRM_Core_Action::UPDATE) {
+ if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) {
+ $this->freeze(array('name', 'description', 'is_active'));
+ }
+ if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_default')) {
+ $this->freeze(array('is_default'));
+ }
}
}
$this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->addSelect('visibility_id', array('label' => ts('Visibility'), 'required' => TRUE));
+
+ $this->assign('id', $this->_id);
}
/**
$inVal = trim($v[2]);
//checking for format to avoid db errors
if ($type == 'Int') {
- if (!preg_match('/^[(]([A-Za-z0-9\,]+)[)]$/', $inVal)) {
+ if (!preg_match('/^[A-Za-z0-9\,]+$/', $inVal)) {
$errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data (in valid format).");
}
}
else {
- if (!(substr($inVal, 0, 1) == '(' && substr($inVal, -1, 1) == ')') && !preg_match('/^[(]([A-Za-z0-9åäöÅÄÖüÜœŒæÆøØ\,\s]+)[)]$/', $inVal)) {
+ if (!preg_match('/^[A-Za-z0-9åäöÅÄÖüÜœŒæÆøØ()\,\s]+$/', $inVal)) {
$errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data (in valid format).");
}
}
if ($html_type == 'CheckBox') {
$newData = array();
foreach ($checkedData as $v) {
- $newData[$v] = 1;
+ $v = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $v);
+ $newData[] = $v;
}
$checkedData = $newData;
}
// CRM-14563,CRM-16575 : Special handling of multi-select custom fields
if ($isSerialized && !empty($value)) {
if (strstr($op, 'IN')) {
- $value = str_replace(array('(', ')'), '', str_replace(",", "[[:cntrl:]]|[[:cntrl:]]", $value));
+ $value = str_replace(",", "[[:cntrl:]]*|[[:cntrl:]]*", $value);
+ $value = str_replace('(', '[[.left-parenthesis.]]', $value);
+ $value = str_replace(')', '[[.right-parenthesis.]]', $value);
}
$op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE';
- $value = "[[:cntrl:]]" . $value . "[[:cntrl:]]";
+ $value = "[[:cntrl:]]*" . $value . "[[:cntrl:]]*";
if (!$wildcard) {
- $value = str_replace("[[:cntrl:]]|", '', $value);
+ $value = str_replace("[[:cntrl:]]*|", '', $value);
}
}
$value = $params['value'][$key][$k];
if ($fldName == 'group' || $fldName == 'tag') {
$value = trim($value);
- $value = str_replace('(', '', $value);
- $value = str_replace(')', '', $value);
$v = explode(',', $value);
$value = array();
}
// CRM-14983: verify if values are comma separated convert to array
- if (!is_array($value) && (strpos($value, ',') !== FALSE || strstr($value, '(')) && substr($fldName, 0, 7) != 'custom_' && $params['operator'][$key][$k] == 'IN') {
- $value = explode(',', trim($value, "(..)"));
+ if (!is_array($value) && strstr($params['operator'][$key][$k], 'IN')) {
+ $value = explode(',', $value);
$value = array($params['operator'][$key][$k] => $value);
}
);
$form->addSelect('membership_type_id',
- array('entity' => 'membership', 'multiple' => 'multiple', 'label' => ts('Memebership Type(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -'))
+ array('entity' => 'membership', 'multiple' => 'multiple', 'label' => ts('Membership Type(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -'))
);
$form->addElement('text', 'member_source', ts('Source'));
ui-options="{dropdownAutoWidth : true, allowClear: true}"
ng-change="checkTokens(mailing, '*')"
ng-model="mailing.header_id"
- ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Header'}">
+ ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Header'} | orderBy:'name'">
<option value=""></option>
</select>
</div>
ui-options="{dropdownAutoWidth : true, allowClear: true}"
ng-change="checkTokens(mailing, '*')"
ng-model="mailing.footer_id"
- ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Footer'}">
+ ng-options="mc.id as mc.name for mc in crmMailingConst.headerfooterList | filter:{component_type: 'Footer'} | orderBy:'name'">
<option value=""></option>
</select>
</div>
</tr>
<tr class="crm-participant-status-form-block-label">
- <td class="label">{$form.label.label}</td>
+ <td class="label">{$form.label.label}{if $action == 2} {include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_participant_status_type' field='label' id=$id}{/if}</td>
<td>{$form.label.html}<br />
<span class="description">{ts}Display label for this status.{/ts}</span></td>
</tr>
(function($, CRM) {
'use strict';
+ /* jshint validthis: true */
/**
* Handle user input - field or operator selection.
*
$('tr:not(.crm-search-builder-add-row)', block).each(function(rowNo) {
var row = $(this);
if ($('select:first', row).val() === '') {
- if (!skippedRow && (rowNo == 0 || blockNo + 1 == newBlock)) {
+ if (!skippedRow && (rowNo === 0 || blockNo + 1 == newBlock)) {
skippedRow = true;
}
else {
.on('change', '.crm-search-value select', function() {
var value = $(this).val() || '';
if ($(this).attr('multiple') == 'multiple' && value.length) {
- value = '(' + value.join(',') + ')';
+ value = value.join(',');
}
$(this).siblings('input').val(value);
})