From 4c6757d5b2f7bd4ed5cee1df9e685f78588b97fc Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@tadpole.cc>
Date: Wed, 26 Sep 2018 15:39:11 -0400
Subject: [PATCH] CiviCRM: 5.5.3 release

---
 assets/templates/civicrm.shortcode.php        |  2 +-
 civicrm.php                                   |  7 ++--
 civicrm/CRM/Contact/BAO/Contact.php           |  6 ++-
 .../Upgrade/Incremental/sql/5.5.3.mysql.tpl   |  7 ++++
 civicrm/civicrm-version.php                   |  2 +-
 civicrm/release-notes/5.5.3.md                | 40 +++++++++++++++++++
 civicrm/sql/civicrm_data.mysql                |  2 +-
 civicrm/sql/civicrm_generated.mysql           |  2 +-
 civicrm/vendor/autoload.php                   |  2 +-
 civicrm/vendor/composer/autoload_real.php     | 14 +++----
 civicrm/vendor/composer/autoload_static.php   | 10 ++---
 civicrm/xml/version.xml                       |  2 +-
 includes/civicrm.basepage.php                 |  2 +-
 includes/civicrm.shortcodes.modal.php         |  2 +-
 includes/civicrm.shortcodes.php               |  2 +-
 includes/civicrm.users.php                    |  2 +-
 languages/civicrm.pot                         |  2 +-
 uninstall.php                                 |  2 +-
 wp-cli/civicrm.php                            |  2 +-
 19 files changed, 79 insertions(+), 31 deletions(-)
 create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.5.3.mysql.tpl
 create mode 100644 civicrm/release-notes/5.5.3.md

diff --git a/assets/templates/civicrm.shortcode.php b/assets/templates/civicrm.shortcode.php
index 02f45e08df..c590390b01 100644
--- a/assets/templates/civicrm.shortcode.php
+++ b/assets/templates/civicrm.shortcode.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/civicrm.php b/civicrm.php
index 91333916ee..ba57f504d4 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -2,11 +2,10 @@
 /*
 Plugin Name: CiviCRM
 Description: CiviCRM - Growing and Sustaining Relationships
-Version: 5.5.2
+Version: 5.5.3
 Author: CiviCRM LLC
 Author URI: https://civicrm.org/
 Plugin URI: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress
-GitLab Plugin URI: https://develop.tadpole.cc/plugins/civicrm
 License: AGPL3
 Text Domain: civicrm
 Domain Path: /languages
@@ -15,7 +14,7 @@ Domain Path: /languages
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -71,7 +70,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
 // set version here: when it changes, will force JS to reload
-define( 'CIVICRM_PLUGIN_VERSION', '5' );
+define( 'CIVICRM_PLUGIN_VERSION', '4.7' );
 
 // store reference to this file
 if (!defined('CIVICRM_PLUGIN_FILE')) {
diff --git a/civicrm/CRM/Contact/BAO/Contact.php b/civicrm/CRM/Contact/BAO/Contact.php
index 9e4488208c..23b3bd4f16 100644
--- a/civicrm/CRM/Contact/BAO/Contact.php
+++ b/civicrm/CRM/Contact/BAO/Contact.php
@@ -2032,8 +2032,10 @@ ORDER BY civicrm_email.is_primary DESC";
       CRM_Contact_BAO_GroupContact::create($params['group'], $contactID, $visibility, $method);
     }
 
-    if (!empty($fields['tag'])) {
-      CRM_Core_BAO_EntityTag::create($params['tag'], 'civicrm_contact', $contactID);
+    if (!empty($fields['tag']) && array_key_exists('tag', $params)) {
+      // Convert comma separated form values from select2 v3
+      $tags = is_array($params['tag']) ? $params['tag'] : array_fill_keys(array_filter(explode(',', $params['tag'])), 1);
+      CRM_Core_BAO_EntityTag::create($tags, 'civicrm_contact', $contactID);
     }
 
     //to add profile in default group
diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.5.3.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.5.3.mysql.tpl
new file mode 100644
index 0000000000..426aad33fd
--- /dev/null
+++ b/civicrm/CRM/Upgrade/Incremental/sql/5.5.3.mysql.tpl
@@ -0,0 +1,7 @@
+#fix typo when setting default in https://github.com/civicrm/civicrm-core/pull/12410
+ALTER TABLE civicrm_option_group MODIFY COLUMN  is_locked TINYINT(4) NOT NULL DEFAULT 0 COMMENT 'A lock to remove the ability to add new options via the UI.';
+
+UPDATE civicrm_option_group
+SET is_locked = 0
+WHERE name REGEXP '.*_2018[0-9]+$'
+AND id IN (SELECT DISTINCT option_group_id FROM civicrm_custom_field);
diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php
index cdb3e16969..8507abe7b1 100644
--- a/civicrm/civicrm-version.php
+++ b/civicrm/civicrm-version.php
@@ -1,7 +1,7 @@
 <?php
 /** @deprecated */
 function civicrmVersion( ) {
-  return array( 'version'  => '5.5.2',
+  return array( 'version'  => '5.5.3',
                 'cms'      => 'Wordpress',
                 'revision' => '' );
 }
diff --git a/civicrm/release-notes/5.5.3.md b/civicrm/release-notes/5.5.3.md
new file mode 100644
index 0000000000..5d321215d5
--- /dev/null
+++ b/civicrm/release-notes/5.5.3.md
@@ -0,0 +1,40 @@
+# CiviCRM 5.5.3
+
+Released 25 Sep 2018
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| **Fix problems installing or upgrading from previous version?** | **yes** |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Fix regression in editing of newly created option-groups ([12862](https://github.com/civicrm/civicrm-core/pull/12862))**
+- **([dev/core#391](https://lab.civicrm.org/dev/core/issues/391))
+  Fix editing of tags via profile ([12870](https://github.com/civicrm/civicrm-core/pull/12870))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors, reviewers, investigators:
+
+Wikimedia Foundation - Eileen McNaughton; MJW Consulting - Matt Wire; Gitlab
+user yalh; CiviCRM - Coleman Watts, Tim Otten; Australian Greens - Seamus
+Lee
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql
index 872b300c89..a63fcb7529 100644
--- a/civicrm/sql/civicrm_data.mysql
+++ b/civicrm/sql/civicrm_data.mysql
@@ -23979,4 +23979,4 @@ INSERT INTO `civicrm_report_instance`
     ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
 VALUES
     (  @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}');
-UPDATE civicrm_domain SET version = '5.5.2';
+UPDATE civicrm_domain SET version = '5.5.3';
diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql
index ed46a0c6e0..7204f4a47f 100644
--- a/civicrm/sql/civicrm_generated.mysql
+++ b/civicrm/sql/civicrm_generated.mysql
@@ -399,7 +399,7 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_domain` WRITE;
 /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.5.2',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.5.3',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
 /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
 UNLOCK TABLES;
 
diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php
index a57dc679d8..d6d5c572bd 100644
--- a/civicrm/vendor/autoload.php
+++ b/civicrm/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632::getLoader();
+return ComposerAutoloaderInit437ca3b0f4619c3058aaa7d4b56b01d9::getLoader();
diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php
index 49b43455c2..232db9fbe4 100644
--- a/civicrm/vendor/composer/autoload_real.php
+++ b/civicrm/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632
+class ComposerAutoloaderInit437ca3b0f4619c3058aaa7d4b56b01d9
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit437ca3b0f4619c3058aaa7d4b56b01d9', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit437ca3b0f4619c3058aaa7d4b56b01d9', 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         $includePaths[] = get_include_path();
@@ -31,7 +31,7 @@ class ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -52,19 +52,19 @@ class ComposerAutoloaderInit283df72d7c58cbc8f7bfdb086ab8a632
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequire283df72d7c58cbc8f7bfdb086ab8a632($fileIdentifier, $file);
+            composerRequire437ca3b0f4619c3058aaa7d4b56b01d9($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequire283df72d7c58cbc8f7bfdb086ab8a632($fileIdentifier, $file)
+function composerRequire437ca3b0f4619c3058aaa7d4b56b01d9($fileIdentifier, $file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;
diff --git a/civicrm/vendor/composer/autoload_static.php b/civicrm/vendor/composer/autoload_static.php
index 0587274509..cf21ad061f 100644
--- a/civicrm/vendor/composer/autoload_static.php
+++ b/civicrm/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632
+class ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9
 {
     public static $files = array (
         'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
@@ -376,10 +376,10 @@ class ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::$prefixDirsPsr4;
-            $loader->prefixesPsr0 = ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::$prefixesPsr0;
-            $loader->classMap = ComposerStaticInit283df72d7c58cbc8f7bfdb086ab8a632::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::$prefixDirsPsr4;
+            $loader->prefixesPsr0 = ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::$prefixesPsr0;
+            $loader->classMap = ComposerStaticInit437ca3b0f4619c3058aaa7d4b56b01d9::$classMap;
 
         }, null, ClassLoader::class);
     }
diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml
index 7ea6e29a8d..1569f03e79 100644
--- a/civicrm/xml/version.xml
+++ b/civicrm/xml/version.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>5.5.2</version_no>
+  <version_no>5.5.3</version_no>
 </version>
diff --git a/includes/civicrm.basepage.php b/includes/civicrm.basepage.php
index a9d0b525de..78762ba068 100644
--- a/includes/civicrm.basepage.php
+++ b/includes/civicrm.basepage.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/includes/civicrm.shortcodes.modal.php b/includes/civicrm.shortcodes.modal.php
index 6f249e1e30..d606a8a0b4 100644
--- a/includes/civicrm.shortcodes.modal.php
+++ b/includes/civicrm.shortcodes.modal.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/includes/civicrm.shortcodes.php b/includes/civicrm.shortcodes.php
index 26e1b163cb..833a6dec48 100644
--- a/includes/civicrm.shortcodes.php
+++ b/includes/civicrm.shortcodes.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/includes/civicrm.users.php b/includes/civicrm.users.php
index 800b8888eb..6c387d7818 100644
--- a/includes/civicrm.users.php
+++ b/includes/civicrm.users.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/languages/civicrm.pot b/languages/civicrm.pot
index 4e28eef654..22349420e7 100644
--- a/languages/civicrm.pot
+++ b/languages/civicrm.pot
@@ -2,7 +2,7 @@
 # This file is distributed under the same license as the CiviCRM package.
 msgid ""
 msgstr ""
-"Project-Id-Version: CiviCRM 5\n"
+"Project-Id-Version: CiviCRM 4.6\n"
 "Report-Msgid-Bugs-To: http://wordpress.org/tag/civicrm\n"
 "POT-Creation-Date: 2014-11-11 09:48:56+00:00\n"
 "MIME-Version: 1.0\n"
diff --git a/uninstall.php b/uninstall.php
index c73696a982..7579c21f70 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/wp-cli/civicrm.php b/wp-cli/civicrm.php
index 3163678470..a3c35c5521 100644
--- a/wp-cli/civicrm.php
+++ b/wp-cli/civicrm.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
-- 
GitLab