From ba25d14ddcfee58378aafe5007d6893b0bc29fa9 Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@kcristiano.com>
Date: Thu, 11 Jul 2019 07:26:02 -0400
Subject: [PATCH] civicrm 5.15.1 release

Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com>
---
 civicrm.php                                   |  2 +-
 .../CRM/ACL/Form/WordPress/Permissions.php    |  2 +-
 civicrm/CRM/Contribute/Form/Task/Invoice.php  |  8 +++-
 civicrm/CRM/Report/Form.php                   | 13 +-----
 .../CRM/Report/Form/Contribute/Summary.php    |  2 +
 .../Upgrade/Incremental/sql/5.15.1.mysql.tpl  |  1 +
 civicrm/CRM/Utils/System/Drupal8.php          |  2 +-
 civicrm/CRM/Utils/System/WordPress.php        | 10 ++---
 civicrm/civicrm-version.php                   |  2 +-
 civicrm/release-notes.md                      |  9 ++++
 civicrm/release-notes/5.15.1.md               | 43 +++++++++++++++++++
 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   | 12 +++---
 civicrm/xml/version.xml                       |  2 +-
 17 files changed, 88 insertions(+), 40 deletions(-)
 create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.15.1.mysql.tpl
 create mode 100644 civicrm/release-notes/5.15.1.md

diff --git a/civicrm.php b/civicrm.php
index d9172b01d0..5130aa4b0a 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -2,7 +2,7 @@
 /*
 Plugin Name: CiviCRM
 Description: CiviCRM - Growing and Sustaining Relationships
-Version: 5.15.0
+Version: 5.15.1
 Author: CiviCRM LLC
 Author URI: https://civicrm.org/
 Plugin URI: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress
diff --git a/civicrm/CRM/ACL/Form/WordPress/Permissions.php b/civicrm/CRM/ACL/Form/WordPress/Permissions.php
index bad293c934..65191fb979 100644
--- a/civicrm/CRM/ACL/Form/WordPress/Permissions.php
+++ b/civicrm/CRM/ACL/Form/WordPress/Permissions.php
@@ -54,7 +54,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form {
     }
     foreach ($wp_roles->role_names as $role => $name) {
       // Don't show the permissions options for administrator, as they have all permissions
-      if ( is_multisite() OR $role !== 'administrator') {
+      if ($role !== 'administrator') {
         $roleObj = $wp_roles->get_role($role);
         if (!empty($roleObj->capabilities)) {
           foreach ($roleObj->capabilities as $ckey => $cname) {
diff --git a/civicrm/CRM/Contribute/Form/Task/Invoice.php b/civicrm/CRM/Contribute/Form/Task/Invoice.php
index 55447fd77a..a38c5e9327 100644
--- a/civicrm/CRM/Contribute/Form/Task/Invoice.php
+++ b/civicrm/CRM/Contribute/Form/Task/Invoice.php
@@ -301,7 +301,13 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
       $invoiceDate = date("F j, Y");
       $dueDate = date('F j, Y', strtotime($contributionReceiveDate . "+" . $prefixValue['due_date'] . "" . $prefixValue['due_date_period']));
 
-      $lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contribID);
+      if ($input['component'] == 'contribute') {
+        $lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contribID);
+      }
+      else {
+        $eid = $contribution->_relatedObjects['participant']->id;
+        $lineItem = CRM_Price_BAO_LineItem::getLineItems($eid, 'participant', NULL, TRUE, FALSE, TRUE);
+      }
 
       $resultPayments = civicrm_api3('Payment', 'get', [
         'sequential' => 1,
diff --git a/civicrm/CRM/Report/Form.php b/civicrm/CRM/Report/Form.php
index 75b3a108c4..e73925220f 100644
--- a/civicrm/CRM/Report/Form.php
+++ b/civicrm/CRM/Report/Form.php
@@ -155,9 +155,6 @@ class CRM_Report_Form extends CRM_Core_Form {
    */
   protected $_groupFilter = FALSE;
 
-  // [ML] Required for civiexportexcel
-  public $supportsExportExcel = TRUE;
-
   /**
    * Has the report been optimised for group filtering.
    *
@@ -2827,11 +2824,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
       $this->_absoluteUrl = TRUE;
       $this->addPaging = FALSE;
     }
-    elseif ($this->_outputMode == 'excel2007') {
-      $printOnly = TRUE;
-      $this->_absoluteUrl = TRUE;
-      $this->addPaging = FALSE;
-    }
     elseif ($this->_outputMode == 'group') {
       $this->assign('outputMode', 'group');
     }
@@ -3484,9 +3476,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     elseif ($this->_outputMode == 'csv') {
       CRM_Report_Utils_Report::export2csv($this, $rows);
     }
-    elseif ($this->_outputMode == 'excel2007') {
-      CRM_CiviExportExcel_Utils_Report::export2excel2007($this, $rows);
-    }
     elseif ($this->_outputMode == 'group') {
       $group = $this->_params['groups'];
       $this->add2group($group);
@@ -5939,7 +5928,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
     if ($this->groupConcatTested && (!empty($this->_groupByArray) || $this->isForceGroupBy)) {
       if ((empty($field['statistics']) || in_array('GROUP_CONCAT', $field['statistics']))) {
         $label = CRM_Utils_Array::value('title', $field);
-        $alias = "{$tableName}_{$fieldName}";
+        $alias = $field['tplField'] ?? "{$tableName}_{$fieldName}";
         $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $label;
         $this->_selectAliases[] = $alias;
         if (empty($this->_groupByArray[$tableName . '_' . $fieldName])) {
diff --git a/civicrm/CRM/Report/Form/Contribute/Summary.php b/civicrm/CRM/Report/Form/Contribute/Summary.php
index e6756091e1..e193637490 100644
--- a/civicrm/CRM/Report/Form/Contribute/Summary.php
+++ b/civicrm/CRM/Report/Form/Contribute/Summary.php
@@ -740,7 +740,9 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
    * @param array $rows
    */
   public function buildRows($sql, &$rows) {
+    CRM_Core_DAO::disableFullGroupByMode();
     $dao = CRM_Core_DAO::executeQuery($sql);
+    CRM_Core_DAO::reenableFullGroupByMode();
     $this->addToDeveloperTab($sql);
     if (!is_array($rows)) {
       $rows = array();
diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.15.1.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.15.1.mysql.tpl
new file mode 100644
index 0000000000..68abb9418a
--- /dev/null
+++ b/civicrm/CRM/Upgrade/Incremental/sql/5.15.1.mysql.tpl
@@ -0,0 +1 @@
+{* file to handle db changes in 5.15.1 during upgrade *}
diff --git a/civicrm/CRM/Utils/System/Drupal8.php b/civicrm/CRM/Utils/System/Drupal8.php
index ad834da019..4eb885592a 100644
--- a/civicrm/CRM/Utils/System/Drupal8.php
+++ b/civicrm/CRM/Utils/System/Drupal8.php
@@ -707,7 +707,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
 
     // Drupal might not be bootstrapped if being called by the REST API.
     if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
-      return NULL;
+      return $url;
     }
 
     $language = $this->getCurrentLanguage();
diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php
index c65c3a057b..a74e1e3de0 100644
--- a/civicrm/CRM/Utils/System/WordPress.php
+++ b/civicrm/CRM/Utils/System/WordPress.php
@@ -831,13 +831,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     $contactCreated = 0;
     $contactMatching = 0;
 
-    // previously used $wpdb - which means WordPress *must* be bootstrapped
-    $wpUsers = get_users(array(
-      'blog_id' => get_current_blog_id(),
-      'number' => -1,
-    ));
+    global $wpdb;
+    $wpUserIds = $wpdb->get_col("SELECT $wpdb->users.ID FROM $wpdb->users");
 
-    foreach ($wpUsers as $wpUserData) {
+    foreach ($wpUserIds as $wpUserId) {
+      $wpUserData = get_userdata($wpUserId);
       $contactCount++;
       if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($wpUserData,
         $wpUserData->$id,
diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php
index 5402b2d0d6..0321a7daf1 100644
--- a/civicrm/civicrm-version.php
+++ b/civicrm/civicrm-version.php
@@ -1,7 +1,7 @@
 <?php
 /** @deprecated */
 function civicrmVersion( ) {
-  return array( 'version'  => '5.15.0',
+  return array( 'version'  => '5.15.1',
                 'cms'      => 'Wordpress',
                 'revision' => '' );
 }
diff --git a/civicrm/release-notes.md b/civicrm/release-notes.md
index a6972422b5..af970f78ac 100644
--- a/civicrm/release-notes.md
+++ b/civicrm/release-notes.md
@@ -15,6 +15,15 @@ Other resources for identifying changes are:
     * https://github.com/civicrm/civicrm-joomla
     * https://github.com/civicrm/civicrm-wordpress
 
+## CiviCRM 5.15.1
+
+Released July 10, 2019
+
+- **[Synopsis](release-notes/5.15.1.md#synopsis)**
+- **[Bugs resolved](release-notes/5.15.1.md#bugs)**
+- **[Credits](release-notes/5.15.1.md#credits)**
+- **[Feedback](release-notes/5.15.1.md#feedback)**
+
 ## CiviCRM 5.15.0
 
 Released July 3, 2019
diff --git a/civicrm/release-notes/5.15.1.md b/civicrm/release-notes/5.15.1.md
new file mode 100644
index 0000000000..641fa1ea27
--- /dev/null
+++ b/civicrm/release-notes/5.15.1.md
@@ -0,0 +1,43 @@
+# CiviCRM 5.15.1
+
+Released July 10, 2019
+
+- **[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 to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **CiviContribute: Refund not recorded on additional payment form ([#14739](https://github.com/civicrm/civicrm-core/pull/14739))**
+- **CiviReport: Error sorting contributions on non-displayed column ([dev/core#1081](https://lab.civicrm.org/dev/core/issues/1081):
+  [#14771](https://github.com/civicrm/civicrm-core/pull/14771))**
+- **Drupal 8: `cv` reports "Cannot resolve path using "cms.root.url" ([dev/drupal#75](https://lab.civicrm.org/dev/drupal/issues/75),
+  [cv#48](https://github.com/civicrm/cv/issues/48): [#14776](https://github.com/civicrm/civicrm-core/pull/14776))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Tadpole Collective - Kevin
+Cristiano; Megaphone Technology Consulting - Jon Goldberg; JMA Consulting -
+Monish Deb; César; Coop SymbioTIC - Mathieu Lutfy; CiviCRM - Tim Otten;
+Blackfly Solutions - Alan Dixon
+
+## <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 2138063053..8515bfcbca 100644
--- a/civicrm/sql/civicrm_data.mysql
+++ b/civicrm/sql/civicrm_data.mysql
@@ -24049,4 +24049,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.15.0';
+UPDATE civicrm_domain SET version = '5.15.1';
diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql
index 106bedc668..c58527d2f6 100644
--- a/civicrm/sql/civicrm_generated.mysql
+++ b/civicrm/sql/civicrm_generated.mysql
@@ -398,7 +398,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.15.0',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.15.1',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 646895d7a0..5bffd10583 100644
--- a/civicrm/vendor/autoload.php
+++ b/civicrm/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09::getLoader();
+return ComposerAutoloaderInit2f92d46b907967abf3f3113968032050::getLoader();
diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php
index c25a0046a2..beb6534b1c 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 ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09
+class ComposerAutoloaderInit2f92d46b907967abf3f3113968032050
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit2f92d46b907967abf3f3113968032050', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit2f92d46b907967abf3f3113968032050', 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         $includePaths[] = get_include_path();
@@ -31,7 +31,7 @@ class ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInit2f92d46b907967abf3f3113968032050::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -52,19 +52,19 @@ class ComposerAutoloaderInitcd1781a8dacad44c5937da68edcd9b09
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInit2f92d46b907967abf3f3113968032050::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequirecd1781a8dacad44c5937da68edcd9b09($fileIdentifier, $file);
+            composerRequire2f92d46b907967abf3f3113968032050($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequirecd1781a8dacad44c5937da68edcd9b09($fileIdentifier, $file)
+function composerRequire2f92d46b907967abf3f3113968032050($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 8a3832e6b5..a95cdac0a2 100644
--- a/civicrm/vendor/composer/autoload_static.php
+++ b/civicrm/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09
+class ComposerStaticInit2f92d46b907967abf3f3113968032050
 {
     public static $files = array (
         '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@@ -447,11 +447,11 @@ class ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$prefixDirsPsr4;
-            $loader->prefixesPsr0 = ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$prefixesPsr0;
-            $loader->fallbackDirsPsr0 = ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$fallbackDirsPsr0;
-            $loader->classMap = ComposerStaticInitcd1781a8dacad44c5937da68edcd9b09::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInit2f92d46b907967abf3f3113968032050::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInit2f92d46b907967abf3f3113968032050::$prefixDirsPsr4;
+            $loader->prefixesPsr0 = ComposerStaticInit2f92d46b907967abf3f3113968032050::$prefixesPsr0;
+            $loader->fallbackDirsPsr0 = ComposerStaticInit2f92d46b907967abf3f3113968032050::$fallbackDirsPsr0;
+            $loader->classMap = ComposerStaticInit2f92d46b907967abf3f3113968032050::$classMap;
 
         }, null, ClassLoader::class);
     }
diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml
index 0ec7072130..e97a1beeef 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.15.0</version_no>
+  <version_no>5.15.1</version_no>
 </version>
-- 
GitLab