Merge pull request #6450 from civicrm/4.6
authorEileen McNaughton <eileen@mcnaughty.com>
Mon, 10 Aug 2015 01:07:22 +0000 (13:07 +1200)
committerEileen McNaughton <eileen@mcnaughty.com>
Mon, 10 Aug 2015 01:07:22 +0000 (13:07 +1200)
Merge 4.6 to master

CRM/Admin/Form/LocationType.php
CRM/Admin/Form/ParticipantStatusType.php
CRM/Contact/Form/Search/Builder.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/BAO/Mapping.php
CRM/Member/BAO/Query.php
ang/crmMailing/BlockHeaderFooter.html
templates/CRM/Admin/Form/ParticipantStatusType.tpl
templates/CRM/Contact/Form/Search/Builder.js

index 6fd84846d6ac95a794abbb3deee3d1c0af49ad72..7d7f01f0804ba6969c9a4fccbe52d5950931b745 100644 (file)
@@ -76,8 +76,14 @@ class CRM_Admin_Form_LocationType extends CRM_Admin_Form {
 
     $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'));
+      }
     }
   }
 
index 4556232fa01856dced1f2662062ff969180024e0..665a68a4e94a73a71fcc42a1d8750cda2bf4dcea 100644 (file)
@@ -66,6 +66,8 @@ class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form {
     $this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
 
     $this->addSelect('visibility_id', array('label' => ts('Visibility'), 'required' => TRUE));
+
+    $this->assign('id', $this->_id);
   }
 
   /**
index 033114b650909341b59a4b97fa1e837b090b1add..7a702587bec0ac79a45208a0aee42cefc0f28207 100644 (file)
@@ -255,12 +255,12 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
                 $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).");
                   }
                 }
index 93521754b9c414b2ce155a2c7c8ba6bfb8191269..a2c4f2cb6456b3d95d56913237373da16d382762 100644 (file)
@@ -1221,7 +1221,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
           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;
           }
index 37b00ab57c85fb0d88f882253b63b2af5ce60901..34f2df43bd56845b4b31238e16ecd40c121b0304 100644 (file)
@@ -424,12 +424,14 @@ SELECT label, value
               // 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);
                 }
               }
 
index a3d8cd1442caa400101569397a235b2fb6ba3d4c..905eae544e130830dea4bf0a472ac542013aee58 100644 (file)
@@ -1024,8 +1024,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
           $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();
@@ -1043,8 +1041,8 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
           }
 
           // 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);
           }
 
index c695e64bd1a19c835ae36112da73d28913755110..302b3a4d5abb9b263c0a76977fd7ecb45fa6f474 100644 (file)
@@ -396,7 +396,7 @@ class CRM_Member_BAO_Query {
     );
 
     $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'));
index 45c47ee32ab509c86942c38c12fd9073636ecf5f..249560d7856e92bb3b2ce566fda165d6303ae179 100644 (file)
@@ -12,7 +12,7 @@ Required vars: mailing, crmMailingConst
         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>
@@ -24,7 +24,7 @@ Required vars: mailing, crmMailingConst
         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>
index a50cdc535291daf680161f54d7d79ad87611c575..69bde9731dc23e3f04d653a70df29a98ae273606 100644 (file)
@@ -45,7 +45,7 @@
         </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>
index 4a0da51621bafde8f0a448d1086a237cfe661759..7a246032d6b9513c2bab788afb29bfa944c71a06 100644 (file)
@@ -2,6 +2,7 @@
 (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);
       })