Merge pull request #19439 from eileenmcnaughton/act_req
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 27 Jan 2021 20:36:22 +0000 (07:36 +1100)
committerGitHub <noreply@github.com>
Wed, 27 Jan 2021 20:36:22 +0000 (07:36 +1100)
dev/core#2308 do not require fields if activity_id is present

17 files changed:
CONTRIBUTORS.txt
CRM/Case/xml/configuration.sample/adult_day_care_referral.xml
CRM/Case/xml/configuration.sample/housing_support.xml
CRM/Contribute/Form/Contribution/Main.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Extension/Manager.php
CRM/Upgrade/Form.php
CRM/Utils/Check/Component/Case.php
CRM/Utils/Check/Component/Cms.php
CRM/Utils/System/Backdrop.php
CRM/Utils/System/Drupal.php
Civi/Api4/PledgePayment.php [new file with mode: 0644]
api/v3/Payment.php
contributor-key.yml
extension-compatibility.json
templates/CRM/Custom/Form/Field.tpl
tests/phpunit/api/v4/DataSets/ConformanceTest.json

index ed62c0c779ed1638dc13b62291298a4794eac121..4e92eeeca7bdd7d6f658753a589b5cbb514b711a 100644 (file)
@@ -26,7 +26,7 @@ Christian Wach
 Circle Interactive - Dave Jenkins, Kirk Jackson, Martin Castle, Pradeep Nayak,
     Reece Benson
 CiviCoop - Jaap Jansma, Klaas Eikelboom
-CiviDesk - Sunil Pawar, Sushant Paste, Yashodha Chaku
+CiviDesk - Sushant Paste, Yashodha Chaku
 CiviFirst - John Kirk
 CompuCorp - Camilo Rodriguez, Davi Alexandre, Debarshi Bhaumik, Michael Devery,
     Mukesh Ram, Omar Abu Hussein, RenĂ© Olivo, Vinu Varshith Sekar
@@ -93,7 +93,7 @@ Romain Thouvenin
 Samson Alajede
 Selwyn Tang
 Semper IT - Karin Gerritsen
-Skvare - Mark Hanna
+Skvare - Mark Hanna, Sunil Pawar
 Squiffle Consulting - Aidan Saunders
 Stephen Palmstrom
 Steve Ellis
index 8b9a00768407aef388fad1af96deb3ad1807068d..31438b071431bc1a8d867a989c75e3fb8ade4352 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 
 <CaseType>
-  <name>Adult Day Care Referral</name>
+  <name>adult_day_care_referral</name>
   <ActivityTypes>
     <ActivityType>
       <name>Open Case</name>
index 3865c7d0c32ef95c2d31a6076af6c7709fe87888..8e9f522cb475b067e58e2df42bb18c4d0c8b1c9b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 
 <CaseType>
-  <name>Housing Support</name>
+  <name>housing_support</name>
   <ActivityTypes>
     <ActivityType>
       <name>Open Case</name>
index fa76918ee72240cc22257d34cdfa914e070640bd..595508baa7f2a3e04513d9e46af4bbae7f11414f 100644 (file)
@@ -1167,7 +1167,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       $this->assign('pay_later_receipt', CRM_Utils_Array::value('pay_later_receipt', $this->_values));
     }
 
-    if ($this->_membershipBlock['is_separate_payment'] && !empty($params['separate_amount'])) {
+    if ($this->_membershipBlock && $this->_membershipBlock['is_separate_payment'] && !empty($params['separate_amount'])) {
       $this->set('amount', $params['separate_amount']);
     }
     else {
index 6c7fbd7c5c8d83a962976258dbde73eb5e1e9a06..45dc5c2c06729493e94b3d5e3da7d6e3607e88b2 100644 (file)
@@ -396,7 +396,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
         $this->handlePaymentExpress();
         return;
       }
-      $objects = $ids = $input = [];
+      $ids = $input = [];
       $this->_component = $input['component'] = self::getValue('m');
       $input['invoice'] = self::getValue('i', TRUE);
       // get the contribution and contact ids from the GET params
@@ -462,19 +462,6 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
         $ids['contact'] = $contribution->contact_id;
       }
 
-      if (!empty($ids['contributionRecur'])) {
-        $contributionRecur = new CRM_Contribute_BAO_ContributionRecur();
-        $contributionRecur->id = $ids['contributionRecur'];
-        if (!$contributionRecur->find(TRUE)) {
-          CRM_Core_Error::debug_log_message("Could not find contribution recur record: {$ids['ContributionRecur']} in IPN request: " . print_r($input, TRUE));
-          echo "Failure: Could not find contribution recur record: {$ids['ContributionRecur']}<p>";
-          return;
-        }
-      }
-
-      $objects['contact'] = &$contact;
-      $objects['contribution'] = &$contribution;
-
       // CRM-19478: handle oddity when p=null is set in place of contribution page ID,
       if (!empty($ids['contributionPage']) && !is_numeric($ids['contributionPage'])) {
         // We don't need to worry if about removing contribution page id as it will be set later in
@@ -482,21 +469,26 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
         unset($ids['contributionPage']);
       }
 
-      $contribution = &$objects['contribution'];
       $ids['paymentProcessor'] = $paymentProcessorID;
       $contribution->loadRelatedObjects($input, $ids);
-      $objects = array_merge($objects, $contribution->_relatedObjects);
 
       $input['payment_processor_id'] = $paymentProcessorID;
 
       if ($ids['contributionRecur']) {
+        $contributionRecur = new CRM_Contribute_BAO_ContributionRecur();
+        $contributionRecur->id = $ids['contributionRecur'];
+        if (!$contributionRecur->find(TRUE)) {
+          CRM_Core_Error::debug_log_message("Could not find contribution recur record: {$ids['ContributionRecur']} in IPN request: " . print_r($input, TRUE));
+          echo "Failure: Could not find contribution recur record: {$ids['ContributionRecur']}<p>";
+          return;
+        }
         // check if first contribution is completed, else complete first contribution
         $first = TRUE;
         $completedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
-        if ($objects['contribution']->contribution_status_id == $completedStatusId) {
+        if ($contribution->contribution_status_id == $completedStatusId) {
           $first = FALSE;
         }
-        $this->recur($input, $ids, $objects['contributionRecur'], $objects['contribution'], $first);
+        $this->recur($input, $ids, $contributionRecur, $contribution, $first);
         return;
       }
 
@@ -504,7 +496,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
         'related_contact' => $ids['related_contact'] ?? NULL,
         'participant' => $ids['participant'] ?? NULL,
         'contributionRecur' => $ids['contributionRecur'] ?? NULL,
-      ], $objects['contribution'], FALSE, FALSE);
+      ], $contribution, FALSE, FALSE);
     }
     catch (CRM_Core_Exception $e) {
       Civi::log()->debug($e->getMessage());
index ce4bca15509cdc7f2952bb7ac116fe24d99992d5..b1e1bf0ef86d0b074a75f6342b1328ad3579aa7c 100644 (file)
@@ -310,11 +310,12 @@ class CRM_Extension_Manager {
 
     $this->statuses = NULL;
     $this->mapper->refresh();
-    CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);
-
-    $schema = new CRM_Logging_Schema();
-    $schema->fixSchemaDifferences();
+    if (!CRM_Core_Config::isUpgradeMode()) {
+      CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);
 
+      $schema = new CRM_Logging_Schema();
+      $schema->fixSchemaDifferences();
+    }
     foreach ($keys as $key) {
       // throws Exception
       list ($info, $typeManager) = $this->_getInfoTypeHandler($key);
index e204d947f038eb47d0210817af98bf6cac5ce282..9da28740a5abe5a65b50a24f09ff325282d26d38 100644 (file)
@@ -616,6 +616,7 @@ SET    version = '$version'
     $messages = [];
     $manager = CRM_Extension_System::singleton()->getManager();
     foreach ($manager->getStatuses() as $key => $status) {
+      $enableReplacement = CRM_Core_DAO::singleValueQuery('SELECT is_active FROM civicrm_extension WHERE full_name = %1', [1 => [$key, 'String']]);
       $obsolete = $manager->isIncompatible($key);
       if ($obsolete) {
         if (!empty($obsolete['disable']) && in_array($status, [$manager::STATUS_INSTALLED, $manager::STATUS_INSTALLED_MISSING])) {
@@ -647,6 +648,15 @@ SET    version = '$version'
             1 => [$key, 'String'],
           ]);
         }
+        if (!empty($obsolete['replacement']) && $enableReplacement) {
+          try {
+            $manager->enable($manager->install($obsolete['replacement']));
+            $messages[] = ts('A replacement extension %1 has been installed as you had the obsolete extension %2 installed', [1 => $obsolete['replacement'], 2 => $key]);
+          }
+          catch (CRM_Extension_Exception $e) {
+            $messages[] = ts('The replacement extension %1 could not be installed due to an error. It is recommended to enable this extension manually.', [1 => $obsolete['replacement']]);
+          }
+        }
       }
     }
     if ($messages) {
index 1112b72093bb30367da13622bd7b34e84a1904d7..89f623ed73fa7b2cfe8889f2b92a9824900d5ece 100644 (file)
@@ -491,4 +491,32 @@ class CRM_Utils_Check_Component_Case extends CRM_Utils_Check_Component {
     return $messages;
   }
 
+  /**
+   * At some point the valid names changed so that you can't have e.g. spaces.
+   * For systems upgraded that use external xml files it's then not clear why
+   * the other messages about outdated filenames are coming up because when
+   * you then fix it as suggested it then gives a red error just saying it
+   * can't find it.
+   */
+  public function checkCaseTypeNameValidity() {
+    $messages = [];
+    $dao = CRM_Core_DAO::executeQuery("SELECT id, name, title FROM civicrm_case_type");
+    while ($dao->fetch()) {
+      if (!CRM_Case_BAO_CaseType::isValidName($dao->name)) {
+        $messages[] = new CRM_Utils_Check_Message(
+          __FUNCTION__ . "invalidcasetypename",
+          '<p>' . ts('Case Type "<em>%1</em>" has invalid characters in the internal machine name (<em>%2</em>). Only letters, numbers, and underscore are allowed.',
+          [
+            1 => htmlspecialchars(empty($dao->title) ? $dao->id : $dao->title),
+            2 => htmlspecialchars($dao->name),
+          ]) . '</p>',
+          ts('Invalid Case Type Name'),
+          \Psr\Log\LogLevel::ERROR,
+          'fa-exclamation'
+        );
+      }
+    }
+    return $messages;
+  }
+
 }
index a1e8610db44f56c4a407434f921eace792077edf..397d956f21c66119bbac7d57f0ccac50427e29e4 100644 (file)
@@ -41,10 +41,9 @@ class CRM_Utils_Check_Component_Cms extends CRM_Utils_Check_Component {
       case 0:
         $messageText = [
           ts(
-            'CiviCRM relies upon a <a href="%1%2">base page in WordPress</a>, but it is not published.',
+            'CiviCRM relies upon a <a href="%1">base page in WordPress</a>, but it is not published.',
             [
-              1 => $config->userFrameworkBaseURL,
-              2 => $config->wpBasePage,
+              1 => $config->userFrameworkBaseURL . $config->wpBasePage,
             ]
           ),
         ];
@@ -65,10 +64,9 @@ class CRM_Utils_Check_Component_Cms extends CRM_Utils_Check_Component {
         );
         $messageText = [
           ts(
-            'CiviCRM relies upon a base page in WordPress at %1%2, but it is missing.',
+            'CiviCRM relies upon a base page in WordPress at %1, but it is missing.',
             [
-              1 => $config->userFrameworkBaseURL,
-              2 => $config->wpBasePage,
+              1 => $config->userFrameworkBaseURL . $config->wpBasePage,
             ]
           ),
         ];
@@ -93,10 +91,9 @@ class CRM_Utils_Check_Component_Cms extends CRM_Utils_Check_Component {
             if ($exists >= 0) {
               // One of the possible defaults is here, published or not.
               $messageText[] = ts(
-                'The default is %1%2, which <a href="%1%2">does exist on this site</a>.',
+                'The default is %1, which <a href="%1">does exist on this site</a>.',
                 [
-                  1 => $config->userFrameworkBaseURL,
-                  2 => $slug,
+                  1 => $config->userFrameworkBaseURL . $slug,
                 ]
               );
               if ($exists == 0) {
@@ -111,10 +108,9 @@ class CRM_Utils_Check_Component_Cms extends CRM_Utils_Check_Component {
             // We went through the default(s) and couldn't find one.  Defer to
             // the one modified by the filter.
             $messageText[] = ts(
-              'The default is %1%2, but that does not exist on this site either.',
+              'The default is %1, but that does not exist on this site either.',
               [
-                1 => $config->userFrameworkBaseURL,
-                2 => $altSlugs[0],
+                1 => $config->userFrameworkBaseURL . $altSlugs[0],
               ]
             );
           }
index 1284b5956393d4441eab60881065c3ab21113302..3d72779f15692f5b2825f865f65d7edd8cbbd434 100644 (file)
@@ -541,9 +541,6 @@ AND    u.status = 1
     require_once "$cmsPath/core/includes/config.inc";
     backdrop_bootstrap(BACKDROP_BOOTSTRAP_FULL);
 
-    // Explicitly setting error reporting, since we cannot handle Backdrop
-    // related notices.
-    error_reporting(1);
     if (!function_exists('module_exists') || !module_exists('civicrm')) {
       if ($throwError) {
         echo '<br />Sorry, could not load Backdrop bootstrap.';
index 3d7efe9ad2bf75b738ede9fb67c2119ea8f6a9f4..fea28fb6a4f4c469d92541dc22399f9149f12f31 100644 (file)
@@ -493,10 +493,6 @@ AND    u.status = 1
     // @ to suppress notices eg 'DRUPALFOO already defined'.
     @drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
-    // explicitly setting error reporting, since we cannot handle drupal related notices
-    // @todo 1 = E_ERROR, but more to the point setting error reporting deep in code
-    // causes grief with debugging scripts
-    error_reporting(1);
     if (!function_exists('module_exists')) {
       if ($throwError) {
         throw new Exception('Sorry, could not load drupal bootstrap.');
diff --git a/Civi/Api4/PledgePayment.php b/Civi/Api4/PledgePayment.php
new file mode 100644 (file)
index 0000000..0ece2dd
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+
+namespace Civi\Api4;
+
+/**
+ * PledgePayment entity.
+ *
+ * @package Civi\Api4
+ */
+class PledgePayment extends Generic\DAOEntity {
+
+}
index 555c791c2dfd3fe7e6edabb92a889a4d3ef391c0..2e9649aba7d6e96b71c589be13e5b7c330955e44 100644 (file)
@@ -350,6 +350,11 @@ function _civicrm_api3_payment_get_spec(&$params) {
       'description' => ts('Transaction id supplied by external processor. This may not be unique.'),
       'type' => CRM_Utils_Type::T_STRING,
     ],
+    'order_reference' => [
+      'title' => ts('Order Reference'),
+      'description' => ts('Payment Processor external order reference'),
+      'type' => CRM_Utils_Type::T_STRING,
+    ],
     'trxn_date' => [
       'title' => ts('Payment Date'),
       'type' => CRM_Utils_Type::T_TIMESTAMP,
index b36602b40b721e2b71d7b45d2100f87cd4343fd4..4aede45bcf5df051d1386ed56c440c130f2e9de1 100644 (file)
 
 - github      : sunilpawar
   name        : Sunil Pawar
-  organization: CiviDesk
+  organization: Skvare
   jira        : sunil
 
 - github      : swastikpareek
index be6cfe2653665dd92a1994c1c09cbc7f1fff6f45..60252782c83cc56e43c1f91e9edc6285d76023d2 100644 (file)
@@ -1,7 +1,8 @@
 {
   "org.civicrm.afform-gui": {
     "obsolete": "5.35",
-    "force-uninstall": true
+    "force-uninstall": true,
+    "replacement": "org.civicrm.afform_admin"
   },
   "com.civibridge.quickmenu": {
     "obsolete": "5.24",
index 02f4ce7b02368f3e9cde4876920bda1cb1ec0a46..0bca2ed44828539ef3a610623c27aeecc3e1aee4 100644 (file)
@@ -99,6 +99,7 @@
       <td class="label">{$form.weight.label}</td>
       <td>{$form.weight.html|crmAddClass:two}
         {if $action neq 4}
+          <br />
           <span class="description">{ts}Weight controls the order in which fields are displayed in a group. Enter a positive or negative integer - lower numbers are displayed ahead of higher numbers.{/ts}</span>
         {/if}
       </td>
       <td class="label">{$form.help_post.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_custom_field' field='help_post' id=$id}{/if}</td>
       <td class="html-adjust">{$form.help_post.html|crmAddClass:huge}
         {if $action neq 4}
+          <br />
           <span class="description">{ts}Explanatory text displayed on back-end forms. Pre help is displayed inline on the form (above the field). Post help is displayed in a pop-up - users click the help balloon to view help text.{/ts}</span>
         {/if}
       </td>
     <tr class="crm-custom-field-form-block-is_view">
       <td class="label">{$form.is_view.label}</td>
       <td class="html-adjust">{$form.is_view.html}
-        <span class="description">{ts}Is this field set by PHP code (via a custom hook). This field will not be updated by CiviCRM.{/ts}</span>
+        {if $action neq 4}
+          <br />
+          <span class="description">{ts}Is this field set by PHP code (via a custom hook). This field will not be updated by CiviCRM.{/ts}</span>
+        {/if}
       </td>
     </tr>
   </table>
index 3833bb3e5a77934babc7d2becccec06463f3f64b..aa071824af76ac1ae46b3cd1edd014070f488267 100644 (file)
       "financial_type_id:name": "Donation",
       "contact_id": "@ref test_contact_1.id"
     }
+  ],
+  "Pledge" : [
+    {
+      "contact_id": "@ref test_contact_1.id",
+      "original_installment_amount" : 10,
+      "amount" : 10,
+      "start_date" :  "now",
+      "create_date" :  "now",
+      "status_id:name" : "Pending"
+    }
   ]
 }