Merge pull request #18114 from eileenmcnaughton/phone
authorcolemanw <coleman@civicrm.org>
Wed, 19 Aug 2020 21:19:31 +0000 (17:19 -0400)
committerGitHub <noreply@github.com>
Wed, 19 Aug 2020 21:19:31 +0000 (17:19 -0400)
Metadata fix - phone_type_id, location_type_id, gender_id

98 files changed:
CRM/Activity/Form/Task.php
CRM/Admin/Form/Preferences/Display.php
CRM/Admin/Form/Setting/Smtp.php
CRM/Batch/Form/Entry.php
CRM/Campaign/Form/Campaign.php
CRM/Case/Form/CaseView.php
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Search.php
CRM/Contact/Form/Task/AddToParentClass.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/DAO/ContributionPage.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/ContributionPage.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Contribute/Form/ContributionPage/Widget.php
CRM/Contribute/Form/ContributionRecur.php
CRM/Contribute/Import/Form/DataSource.php
CRM/Contribute/Page/Tab.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/SchemaHandler.php
CRM/Core/DAO/Phone.php
CRM/Core/Form.php
CRM/Core/Payment.php
CRM/Core/Payment/AuthorizeNet.php
CRM/Core/Payment/Dummy.php
CRM/Core/Payment/Form.php
CRM/Core/Payment/PayJunction.php
CRM/Core/Payment/PayPalImpl.php
CRM/Core/Payment/Realex.php
CRM/Core/Payment/eWAY.php
CRM/Custom/Form/Field.php
CRM/Custom/Form/Group.php
CRM/Custom/Form/Option.php
CRM/Event/DAO/Event.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Financial/Form/BatchTransaction.php
CRM/Financial/Form/Search.php
CRM/Grant/BAO/Query.php
CRM/Member/BAO/Membership.php
CRM/Pledge/BAO/Query.php
CRM/Price/BAO/LineItem.php
CRM/Price/DAO/PriceFieldValue.php
CRM/Price/Form/Field.php
CRM/Profile/Form.php
CRM/Profile/Form/Edit.php
CRM/Report/Form.php
CRM/Report/Form/Contribute/History.php
CRM/SMS/Form/Group.php
CRM/UF/Form/Field.php
CRM/UF/Form/Group.php
CRM/Upgrade/Incremental/php/FiveTwentyNine.php
CRM/Upgrade/Page/Upgrade.php
CRM/Utils/Check/Component/Env.php
CRM/Utils/SQL/TempTable.php
CRM/Utils/System.php
CRM/Utils/System/WordPress.php
CRM/Utils/Token.php
CRM/Utils/VersionCheck.php
css/civicrm.css
css/joomla.css
install/template.html
js/Common.js
js/crm.ajax.js
js/crm.searchForm.js
js/jquery/jquery.dashboard.js
setup/plugins/blocks/advanced.tpl.php
setup/plugins/blocks/install.tpl.php
setup/plugins/blocks/requirements.tpl.php
setup/res/template.css
setup/src/Setup/UI/SetupController.php
templates/CRM/Admin/Form/Preferences/Display.tpl
templates/CRM/Admin/Page/APIExplorer.tpl
templates/CRM/Admin/Page/CKEditorConfig.tpl
templates/CRM/Batch/Form/Entry.tpl
templates/CRM/Block/Add.tpl
templates/CRM/Block/FullTextSearch.tpl
templates/CRM/Contact/Form/Contact.tpl
templates/CRM/Contact/Form/Search/Builder.js
templates/CRM/Contact/Page/View/Print.tpl
templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl
templates/CRM/Core/BillingBlock.tpl
templates/CRM/Event/Form/ManageEvent/Registration.tpl
templates/CRM/Mailing/Page/Event.tpl
templates/CRM/Mailing/Page/Resubscribe.tpl
templates/CRM/Profile/Form/Dynamic.tpl
templates/CRM/Report/Form/Layout/Graph.tpl
templates/CRM/common/TabHeader.js
templates/CRM/common/civicrm.settings.php.template
templates/CRM/common/deferredFinancialType.tpl
templates/CRM/common/formButtons.tpl
templates/CRM/common/navigation.js.tpl
tests/phpunit/CRM/Contribute/BAO/ContributionTest.php
tests/phpunit/CRM/Contribute/Form/ContributionTest.php
tests/phpunit/CRMTraits/Financial/OrderTrait.php
tests/phpunit/api/v3/MembershipTest.php
tests/phpunit/api/v3/MembershipTypeTest.php
tests/phpunit/api/v3/ReportTemplateTest.php

index c16964876815780fea5e2ed74284c25bf87d21ba..462499c38fd338b1bb705f2f9e200413cd1c96e7 100644 (file)
@@ -70,16 +70,6 @@ class CRM_Activity_Form_Task extends CRM_Core_Form_Task {
       // CRM-12675
       $activityClause = NULL;
 
-      $components = CRM_Core_Component::getNames();
-      $componentClause = [];
-      foreach ($components as $componentID => $componentName) {
-        if ($componentName != 'CiviCase' && !CRM_Core_Permission::check("access $componentName")) {
-          $componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) ";
-        }
-      }
-      if (!empty($componentClause)) {
-        $activityClause = implode(' AND ', $componentClause);
-      }
       $result = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, $activityClause);
 
       while ($result->fetch()) {
index 0716cdebd233bd0286546e939b66d674702047af..775fa2c04ec57cd741a37d0f837fc4884a88ce70 100644 (file)
@@ -50,17 +50,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
     $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
     $this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled());
 
-    $this->addElement(
-      'xbutton',
-      'ckeditor_config',
-      CRM_Core_Page::crmIcon('fa-wrench') . ' ' . ts('Configure CKEditor'),
-      [
-        'type' => 'submit',
-        'class' => 'crm-button',
-        'style' => 'display:inline-block;vertical-align:middle;float:none!important;',
-        'value' => 1,
-      ]
-    );
+    $this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor'));
 
     $editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0');
     $this->assign('editOptions', $editOptions);
index 79e0da4f7782a131935ad6b8b2a2f77bdeb49738..da909c7f0877817e205df640f1c17df749179c8e 100644 (file)
@@ -61,12 +61,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting {
     $this->addFormRule(['CRM_Admin_Form_Setting_Smtp', 'formRule']);
     parent::buildQuickForm();
     $buttons = $this->getElement('buttons')->getElements();
-    $buttons[] = $this->createElement(
-      'xbutton',
-      $this->_testButtonName,
-      CRM_Core_Page::crmIcon('fa-envelope-o') . ' ' . ts('Save & Send Test Email'),
-      ['type' => 'submit']
-    );
+    $buttons[] = $this->createElement('submit', $this->_testButtonName, ts('Save & Send Test Email'), ['crm-icon' => 'fa-envelope-o']);
     $this->getElement('buttons')->setElements($buttons);
 
     if (!empty($setStatus)) {
index 35c407a79f267102716643a7d1e62d989d065c35..e60ababdb45cb910fe6a7ee20aa794e54c5e4d70 100644 (file)
@@ -173,14 +173,9 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
     // add the force save button
     $forceSave = $this->getButtonName('upload', 'force');
 
-    $this->addElement('xbutton',
+    $this->addElement('submit',
       $forceSave,
-      ts('Ignore Mismatch & Process the Batch?'),
-      [
-        'type' => 'submit',
-        'value' => 1,
-        'class' => 'crm-button crm-button_qf_Entry_upload_force-save',
-      ]
+      ts('Ignore Mismatch & Process the Batch?')
     );
 
     $this->addButtons([
index 509b1278f45abbcbb61bcbcd487d43a398b8b364..b47cee77e72bb0c2755967c10b519a853ef44c02 100644 (file)
@@ -222,7 +222,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
     $this->add('wysiwyg', 'goal_general', ts('Campaign Goals'), ['rows' => 2, 'cols' => 40]);
     $this->add('text', 'goal_revenue', ts('Revenue Goal'), ['size' => 8, 'maxlength' => 12]);
     $this->addRule('goal_revenue', ts('Please enter a valid money value (e.g. %1).',
-      [1 => CRM_Utils_Money::format('99.99', ' ')]
+      [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency(99.99)]
     ), 'money');
 
     // is this Campaign active
index f2300dadb23e11ae16d1cd37e48ea083b48aa6de..7c9724a53c83671ca4ee97eec12fc5168257bb3c 100644 (file)
@@ -275,10 +275,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
     // This button is hidden but gets clicked by javascript at
     // https://github.com/civicrm/civicrm-core/blob/bd28ecf8121a85bc069cad3ab912a0c3dff8fdc5/templates/CRM/Case/Form/CaseView.js#L194
     // by the onChange handler for the above timeline_id select.
-    $this->addElement('xbutton', $this->getButtonName('next'), ' ', [
-      'class' => 'hiddenElement',
-      'type' => 'submit',
-    ]);
+    $this->addElement('submit', $this->getButtonName('next'), ' ', ['class' => 'hiddenElement']);
 
     $this->buildMergeCaseForm();
 
@@ -526,12 +523,11 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
       // This button is hidden but gets clicked by javascript at
       // https://github.com/civicrm/civicrm-core/blob/bd28ecf8121a85bc069cad3ab912a0c3dff8fdc5/templates/CRM/Case/Form/CaseView.js#L55
       // when the mergeCasesDialog is saved.
-      $this->addElement('xbutton',
+      $this->addElement('submit',
         $this->getButtonName('next', 'merge_case'),
         ts('Merge'),
         [
           'class' => 'hiddenElement',
-          'type' => 'submit',
         ]
       );
     }
index 798050800c35a5800bdfa950e2b5afecadf30513..04e3c8a897e79f52c58a27b38d60bf73bbe1ef31 100644 (file)
@@ -808,31 +808,17 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     $this->addField('image_URL', ['maxlength' => '255', 'label' => ts('Browse/Upload Image')]);
 
     // add the dedupe button
-    $this->addElement('xbutton',
+    $this->addElement('submit',
       $this->_dedupeButtonName,
-      ts('Check for Matching Contact(s)'),
-      [
-        'type' => 'submit',
-        'value' => 1,
-        'class' => "crm-button crm-button{$this->_dedupeButtonName}",
-      ]
+      ts('Check for Matching Contact(s)')
     );
-    $this->addElement('xbutton',
+    $this->addElement('submit',
       $this->_duplicateButtonName,
-      ts('Save Matching Contact'),
-      [
-        'type' => 'submit',
-        'value' => 1,
-        'class' => "crm-button crm-button{$this->_duplicateButtonName}",
-      ]
+      ts('Save Matching Contact')
     );
-    $this->addElement('xbutton',
+    $this->addElement('submit',
       $this->getButtonName('next', 'sharedHouseholdDuplicate'),
-      ts('Save With Duplicate Household'),
-      [
-        'type' => 'submit',
-        'value' => 1,
-      ]
+      ts('Save With Duplicate Household')
     );
 
     $buttons = [
index dcaa084d0e9863fb91813fa8a9f106aef5a08400..322dc47e317bb42c42bd06f7eca146b49ce6b204 100644 (file)
@@ -468,9 +468,8 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
       // also set the group title and freeze the action task with Add Members to Group
       $groupValues = ['id' => $this->_amtgID, 'title' => $this->_group[$this->_amtgID]];
       $this->assign_by_ref('group', $groupValues);
-      $this->add('xbutton', $this->_actionButtonName, ts('Add Contacts to %1', [1 => $this->_group[$this->_amtgID]]),
+      $this->add('submit', $this->_actionButtonName, ts('Add Contacts to %1', [1 => $this->_group[$this->_amtgID]]),
         [
-          'type' => 'submit',
           'class' => 'crm-form-submit',
         ]
       );
index aee54878d4754157a8addbf0f0562c59e53ce435..f98aa34e324ff2c48164eed1f66bf3cf5b09734f 100644 (file)
@@ -65,13 +65,8 @@ class CRM_Contact_Form_Task_AddToParentClass extends CRM_Contact_Form_Task {
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $this->get('searchDone'));
     $this->assign('contact_type_display', $contactType);
-    $buttonAttrs = [
-      'type' => 'submit',
-      'class' => 'crm-form-submit',
-      'value' => 1,
-    ];
-    $this->addElement('xbutton', $this->getButtonName('refresh'), ts('Search'), $buttonAttrs);
-    $this->addElement('xbutton', $this->getButtonName('cancel'), ts('Cancel'), $buttonAttrs);
+    $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), ['class' => 'crm-form-submit']);
+    $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), ['class' => 'crm-form-submit']);
     $this->addButtons([
       [
         'type' => 'next',
index 2925909affaf14afd5ef8c51f6b5735e9bda55eb..f91512a0eaa3131945c6f6ec63456238e380f4fe 100644 (file)
@@ -915,10 +915,10 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
     $form->addFormFieldsFromMetadata();
 
     $form->add('text', 'contribution_amount_low', ts('From'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('9.99', ' ')]), 'money');
+    $form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('9.99')]), 'money');
 
     $form->add('text', 'contribution_amount_high', ts('To'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+    $form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
     // Adding select option for curreny type -- CRM-4711
     $form->add('select', 'contribution_currency_type',
index 91ad8165cf80b5363a0490222d27cb350f95dc6b..80ec08d3acf67e474c303f50f213a8665539c268 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionPage.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f12a7fabc2ed417166aeeefbdd596fb2)
+ * (GenCodeChecksum:902bfa164280b9ba21a7cb5a38aceba8)
  */
 
 /**
index 228e285dfdee18ffeef735d6bf931e6d444bc852..a9a2988d4d9765bc9287b0b0fb3fad20ed2ed925 100644 (file)
@@ -102,7 +102,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd");
       if (!empty($params['start_date'])) {
         $pledgeParams['frequency_day'] = intval(date("d", strtotime($params['start_date'])));
-        $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime(CRM_Utils_Array::value('start_date', $params)));
+        $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime($params['start_date']));
       }
       $pledgeParams['status_id'] = $contribution->contribution_status_id;
       $pledgeParams['max_reminders'] = $form->_values['max_reminders'];
@@ -155,19 +155,19 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $paymentProcessorOutcome, $receiptDate, $recurringContributionID) {
     $contributionParams = [
       'financial_type_id' => $financialTypeID,
-      'receive_date' => (CRM_Utils_Array::value('receive_date', $params)) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'),
+      'receive_date' => !empty($params['receive_date']) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'),
       'tax_amount' => $params['tax_amount'] ?? NULL,
       'amount_level' => $params['amount_level'] ?? NULL,
       'invoice_id' => $params['invoiceID'],
       'currency' => $params['currencyID'],
-      'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0),
+      'is_pay_later' => $params['is_pay_later'] ?? 0,
       //configure cancel reason, cancel date and thankyou date
       //from 'contribution' type profile if included
-      'cancel_reason' => CRM_Utils_Array::value('cancel_reason', $params, 0),
+      'cancel_reason' => $params['cancel_reason'] ?? 0,
       'cancel_date' => isset($params['cancel_date']) ? CRM_Utils_Date::format($params['cancel_date']) : NULL,
       'thankyou_date' => isset($params['thankyou_date']) ? CRM_Utils_Date::format($params['thankyou_date']) : NULL,
       //setting to make available to hook - although seems wrong to set on form for BAO hook availability
-      'skipLineItem' => CRM_Utils_Array::value('skipLineItem', $params, 0),
+      'skipLineItem' => $params['skipLineItem'] ?? 0,
     ];
 
     if ($paymentProcessorOutcome) {
@@ -301,7 +301,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $this->_params['is_pay_later'] = $this->get('is_pay_later');
     $this->assign('is_pay_later', $this->_params['is_pay_later']);
     if ($this->_params['is_pay_later']) {
-      $this->assign('pay_later_receipt', CRM_Utils_Array::value('pay_later_receipt', $this->_values));
+      $this->assign('pay_later_receipt', $this->_values['pay_later_receipt'] ?? NULL);
     }
     // if onbehalf-of-organization
     if (!empty($this->_values['onbehalf_profile_id']) && !empty($this->_params['onbehalf']['organization_name'])) {
@@ -460,7 +460,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     // assign contribution page id to the template so we can add css class for it
     $this->assign('contributionPageID', $this->_id);
-    $this->assign('is_for_organization', CRM_Utils_Array::value('is_for_organization', $this->_params));
+    $this->assign('is_for_organization', $this->_params['is_for_organization'] ?? NULL);
 
     $this->set('params', $this->_params);
   }
@@ -485,7 +485,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $fieldTypes[] = CRM_Core_BAO_UFGroup::getContactType($this->_values['honoree_profile_id']);
       $this->buildCustom($this->_values['honoree_profile_id'], 'honoreeProfileFields', TRUE, 'honor', $fieldTypes);
     }
-    $this->assign('receiptFromEmail', CRM_Utils_Array::value('receipt_from_email', $this->_values));
+    $this->assign('receiptFromEmail', $this->_values['receipt_from_email']);
     $amount_block_is_active = $this->get('amount_block_is_active');
     $this->assign('amount_block_is_active', $amount_block_is_active);
 
@@ -738,7 +738,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $this->assign('product_name', $productDAO->name);
       $this->assign('price', $productDAO->price);
       $this->assign('sku', $productDAO->sku);
-      $this->assign('option', CRM_Utils_Array::value('options_' . $premiumParams['selectProduct'], $premiumParams));
+      $this->assign('option', $premiumParams['options_' . $premiumParams['selectProduct']] ?? NULL);
 
       $periodType = $productDAO->period_type;
 
@@ -887,7 +887,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     $isEmailReceipt = !empty($form->_values['is_email_receipt']);
     $isSeparateMembershipPayment = !empty($params['separate_membership_payment']);
-    $pledgeID = !empty($params['pledge_id']) ? $params['pledge_id'] : CRM_Utils_Array::value('pledge_id', $form->_values);
+    $pledgeID = !empty($params['pledge_id']) ? $params['pledge_id'] : $form->_values['pledge_id'] ?? NULL;
     if (!$isSeparateMembershipPayment && !empty($form->_values['pledge_block_id']) &&
       (!empty($params['is_pledge']) || $pledgeID)) {
       $isPledge = TRUE;
@@ -1089,10 +1089,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $recurParams['is_email_receipt'] = $params['is_email_receipt'] ?? NULL;
     // we need to add a unique trxn_id to avoid a unique key error
     // in paypal IPN we reset this when paypal sends us the real trxn id, CRM-2991
-    $recurParams['trxn_id'] = CRM_Utils_Array::value('trxn_id', $params, $params['invoiceID']);
+    $recurParams['trxn_id'] = $params['trxn_id'] ?? $params['invoiceID'];
     $recurParams['financial_type_id'] = $contributionType->id;
 
-    $campaignId = CRM_Utils_Array::value('campaign_id', $params, CRM_Utils_Array::value('campaign_id', $form->_values));
+    $campaignId = $params['campaign_id'] ?? $form->_values['campaign_id'] ?? NULL;
     $recurParams['campaign_id'] = $campaignId;
     $recurring = CRM_Contribute_BAO_ContributionRecur::add($recurParams);
     if (is_a($recurring, 'CRM_Core_Error')) {
@@ -1343,7 +1343,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs);
     $membershipType = empty($membershipTypes) ? [] : reset($membershipTypes);
 
-    $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType));
+    $this->assign('membership_name', $membershipType['name']);
     $this->_values['membership_name'] = $membershipType['name'] ?? NULL;
 
     $isPaidMembership = FALSE;
@@ -1360,7 +1360,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $financialTypeID = $this->_values['financial_type_id'];
     }
     else {
-      $financialTypeID = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams));
+      $financialTypeID = $membershipType['financial_type_id'] ?? $membershipParams['financial_type_id'] ?? NULL;
     }
 
     if (!empty($this->_params['membership_source'])) {
@@ -1412,10 +1412,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems) {
 
     $membershipContribution = NULL;
-    $isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE);
+    $isTest = $membershipParams['is_test'] ?? FALSE;
     $errors = $paymentResults = [];
     $form->_values['isMembership'] = TRUE;
-    $isRecurForFirstTransaction = CRM_Utils_Array::value('is_recur', $form->_params, CRM_Utils_Array::value('is_recur', $membershipParams));
+    $isRecurForFirstTransaction = $form->_params['is_recur'] ?? $membershipParams['is_recur'] ?? NULL;
 
     $totalAmount = $membershipParams['amount'];
 
@@ -1465,7 +1465,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           unset($membershipParams['is_recur']);
         }
         list($membershipContribution, $secondPaymentResult) = $this->processSecondaryFinancialTransaction($contactID, $form, array_merge($membershipParams, ['skipLineItem' => 1]),
-          $isTest, $unprocessedLineItems, CRM_Utils_Array::value('minimum_fee', $membershipDetails, 0), CRM_Utils_Array::value('financial_type_id', $membershipDetails));
+          $isTest, $unprocessedLineItems, $membershipDetails['minimum_fee'] ?? 0, $membershipDetails['financial_type_id'] ?? NULL);
         $paymentResults[] = ['contribution_id' => $membershipContribution->id, 'result' => $secondPaymentResult];
         $totalAmount = $membershipContribution->total_amount;
       }
@@ -1486,7 +1486,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
     //@todo it should no longer be possible for it to get to this point & membership to not be an array
     if (is_array($membershipTypeIDs) && !empty($membershipContributionID)) {
-      $typesTerms = CRM_Utils_Array::value('types_terms', $membershipParams, []);
+      $typesTerms = $membershipParams['types_terms'] ?? [];
 
       $membershipLines = $nonMembershipLines = [];
       foreach ($unprocessedLineItems as $priceSetID => $lines) {
@@ -1509,7 +1509,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           $membershipLineItems = $unprocessedLineItems;
         }
         $i++;
-        $numTerms = CRM_Utils_Array::value($memType, $typesTerms, 1);
+        $numTerms = $typesTerms[$memType] ?? 1;
         $contributionRecurID = $form->_params['contributionRecurID'] ?? NULL;
 
         $membershipSource = NULL;
@@ -1537,11 +1537,21 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           $pending = $membershipContribution->contribution_status_id == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
         }
         else {
-          $pending = $this->getIsPending();
+          // The concept of contributeMode is deprecated.
+          // the is_monetary concept probably should be too as it can be calculated from
+          // the existence of 'amount' & seems fragile.
+          if (((isset($this->_contributeMode)) || !empty($this->_params['is_pay_later'])
+            ) &&
+            (($this->_values['is_monetary'] && $this->_amount > 0.0))
+          ) {
+            $pending = TRUE;
+          }
+          $pending = FALSE;
         }
+
         list($membership, $renewalMode, $dates) = CRM_Member_BAO_Membership::processMembership(
           $contactID, $memType, $isTest,
-          date('YmdHis'), CRM_Utils_Array::value('cms_contactID', $membershipParams),
+          date('YmdHis'), $membershipParams['cms_contactID'] ?? NULL,
           $customFieldsFormatted,
           $numTerms, $membershipID, $pending,
           $contributionRecurID, $membershipSource, $isPayLater, $campaignId, [], $membershipContribution,
@@ -1648,7 +1658,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       if (!empty($membershipContribution) && !is_a($membershipContribution, 'CRM_Core_Error')) {
         if (empty($form->_paymentProcessor)) {
           // @todo this can maybe go now we are setting payment_processor_id = 0 more reliably.
-          $paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor', $this->_values));
+          $paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_values['payment_processor'] ?? NULL);
           $this->_paymentProcessor['id'] = $paymentProcessorIDs[0];
         }
         $result = ['payment_status_id' => 1, 'contribution' => $membershipContribution];
@@ -1731,10 +1741,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       'contact_id' => $contactID,
       'line_item' => $lineItems,
       'is_test' => $isTest,
-      'campaign_id' => CRM_Utils_Array::value('campaign_id', $tempParams, CRM_Utils_Array::value('campaign_id',
-        $form->_values)),
+      'campaign_id' => $tempParams['campaign_id'] ?? $form->_values['campaign_id'] ?? NULL,
       'contribution_page_id' => $form->_id,
-      'source' => CRM_Utils_Array::value('source', $tempParams, CRM_Utils_Array::value('description', $tempParams)),
+      'source' => $tempParams['source'] ?? $tempParams['description'] ?? NULL,
     ];
     $isMonetary = !empty($form->_values['is_monetary']);
     if ($isMonetary) {
@@ -1787,27 +1796,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     return [$membershipContribution, $result];
   }
 
-  /**
-   * Is the payment a pending payment.
-   *
-   * We are moving towards always creating as pending and updating at the end (based on payment), so this should be
-   * an interim refactoring. It was shared with another unrelated form & some parameters may not apply to this form.
-   *
-   * @return bool
-   */
-  protected function getIsPending() {
-    // The concept of contributeMode is deprecated.
-    // the is_monetary concept probably should be too as it can be calculated from
-    // the existence of 'amount' & seems fragile.
-    if (((isset($this->_contributeMode)) || !empty($this->_params['is_pay_later'])
-      ) &&
-      (($this->_values['is_monetary'] && $this->_amount > 0.0))
-    ) {
-      return TRUE;
-    }
-    return FALSE;
-  }
-
   /**
    * Are we going to do 2 financial transactions.
    *
@@ -1875,7 +1863,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         !empty($this->_membershipBlock['is_separate_payment'])
         && !empty($this->_values['fee'][$priceField->id])
         && ($this->_values['fee'][$priceField->id]['name'] == "other_amount")
-        && CRM_Utils_Array::value("price_{$paramWeDoNotUnderstand}", $this->_params) < 1
+        && ($this->_params["price_{$paramWeDoNotUnderstand}"] ?? NULL) < 1
         && empty($this->_params["price_{$priceField->id}"])
       ) {
         $this->_params['amount'] = NULL;
@@ -1888,8 +1876,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       //@todo - merge with section above
       if (!empty($this->_membershipBlock['is_separate_payment'])
         && !empty($this->_values['fee'][$priceField->id])
-        && CRM_Utils_Array::value('name', $this->_values['fee'][$priceField->id]) == 'contribution_amount'
-        && CRM_Utils_Array::value("price_{$priceField->id}", $this->_params) == '-1'
+        && ($this->_values['fee'][$priceField->id]['name'] ?? NULL) == 'contribution_amount'
+        && ($this->_params["price_{$priceField->id}"] ?? NULL) == '-1'
       ) {
         $this->_params['amount'] = NULL;
       }
@@ -1976,7 +1964,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
     $form->set('memberPriceFieldIDS', $membershipPriceFieldIDs);
     $form->setRecurringMembershipParams();
-    $form->processFormSubmission(CRM_Utils_Array::value('contact_id', $params));
+    $form->processFormSubmission($params['contact_id'] ?? NULL);
   }
 
   /**
@@ -2208,7 +2196,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $this->_contactID = $contactID;
 
     //get email primary first if exist
-    $subscriptionEmail = ['email' => CRM_Utils_Array::value('email-Primary', $params)];
+    $subscriptionEmail = ['email' => $params['email-Primary'] ?? NULL];
     if (!$subscriptionEmail['email']) {
       $subscriptionEmail['email'] = $params["email-{$this->_bltID}"] ?? NULL;
     }
@@ -2305,7 +2293,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         $contactID,
         $this->wrangleFinancialTypeID($this->_values['financial_type_id']),
         ($this->_mode == 'test') ? 1 : 0,
-        CRM_Utils_Array::value('is_recur', $paymentParams)
+        $paymentParams['is_recur'] ?? NULL
       );
 
       if (empty($result['is_payment_failure'])) {
@@ -2471,12 +2459,12 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
    * @throws \Exception
    */
   protected function completeTransaction($result, $contributionID) {
-    if (CRM_Utils_Array::value('payment_status_id', $result) == 1) {
+    if (($result['payment_status_id'] ?? NULL) == 1) {
       try {
         civicrm_api3('contribution', 'completetransaction', [
           'id' => $contributionID,
           'trxn_id' => $result['trxn_id'] ?? NULL,
-          'payment_processor_id' => CRM_Utils_Array::value('payment_processor_id', $result, $this->_paymentProcessor['id']),
+          'payment_processor_id' => $result['payment_processor_id'] ?? $this->_paymentProcessor['id'],
           'is_transactional' => FALSE,
           'fee_amount' => $result['fee_amount'] ?? NULL,
           'receive_date' => $result['receive_date'] ?? NULL,
index 76e245eabdb77d787ffb02798bfb19176abe2f00..ba8bb64ec08706d24b8822fe9dc816d4af568f4b 100644 (file)
@@ -222,10 +222,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
     // views are implemented as frozen form
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $this->addElement('xbutton', 'done', ts('Done'), [
-        'type' => 'button',
-        'onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'",
-      ]);
+      $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"]);
     }
 
     // don't show option for contribution amounts section if membership price set
index 890210353923bae794a3dce2cd6e152172cba3f8..16fdf6324518178d22b942ab83b19d7ed1efbf6a 100644 (file)
@@ -48,10 +48,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
     // do u want to allow a free form text field for amount
     $this->addElement('checkbox', 'is_allow_other_amount', ts('Allow other amounts'), NULL, ['onclick' => "minMax(this);showHideAmountBlock( this, 'is_allow_other_amount' );"]);
     $this->add('text', 'min_amount', ts('Minimum Amount'), ['size' => 8, 'maxlength' => 8]);
-    $this->addRule('min_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('9.99', ' ')]), 'money');
+    $this->addRule('min_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('9.99')]), 'money');
 
     $this->add('text', 'max_amount', ts('Maximum Amount'), ['size' => 8, 'maxlength' => 8]);
-    $this->addRule('max_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+    $this->addRule('max_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
     //CRM-12055
     $this->add('text', 'amount_label', ts('Contribution Amounts Label'));
@@ -67,7 +67,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
 
       // value
       $this->add('text', "value[$i]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'));
-      $this->addRule("value[$i]", ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+      $this->addRule("value[$i]", ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
       // default
       $default[] = $this->createElement('radio', NULL, NULL, NULL, $i);
@@ -262,7 +262,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
 
         // CRM-4038: fix value display
         foreach ($defaults['value'] as & $amount) {
-          $amount = trim(CRM_Utils_Money::format($amount, ' '));
+          $amount = trim(CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($amount));
         }
       }
     }
index dc96867c0aee53f1a74c8d1d3bfd249f106d7770..07e498ae48041ee0a51c38a916c5ac6724540983 100644 (file)
@@ -162,7 +162,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
     // collect goal amount
     $this->add('text', 'goal_amount', ts('Goal Amount'), ['size' => 8, 'maxlength' => 12]);
-    $this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+    $this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
     // is confirmation page enabled?
     $this->addElement('checkbox', 'is_confirm_enabled', ts('Use a confirmation page?'));
index 4b8b5adc3b92706c36ecb7b3b88ac3eb4605dc7b..7c6ee1bb991cdef4b2a58bcf694f71b1c32760fa 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
 
     $this->assign('cpageId', $this->_id);
 
-    $this->assign('widgetExternUrl', CRM_Utils_System::externUrl('extern/widget', "cpageId={$this->_id}&widgetId={$this->_widget->id}&format=3"));
+    $this->assign('widgetExternUrl', CRM_Utils_System::externUrl('extern/widget', "cpageId={$this->_id}&widgetId=" . ($this->_widget->id ?? '') . "&format=3"));
 
     $config = CRM_Core_Config::singleton();
     $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
@@ -188,10 +188,9 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
     $this->assign_by_ref('colorFields', $this->_colorFields);
 
     $this->_refreshButtonName = $this->getButtonName('refresh');
-    $this->addElement('xbutton',
+    $this->addElement('submit',
       $this->_refreshButtonName,
-      ts('Save and Preview'),
-      ['type' => 'submit']
+      ts('Save and Preview')
     );
     parent::buildQuickForm();
     $this->addFormRule(['CRM_Contribute_Form_ContributionPage_Widget', 'formRule'], $this);
index 8378d60599d52861afc4c0f2ffacc04cd456b073..ef6a633f45e6393c1c465255a02245eacb91699b 100644 (file)
@@ -192,21 +192,22 @@ class CRM_Contribute_Form_ContributionRecur extends CRM_Core_Form {
    */
   protected function getSubscriptionContactID() {
     $sub = $this->getSubscriptionDetails();
-    return $sub->contact_id ?? FALSE;
+    return $sub->contact_id ? (int) $sub->contact_id : FALSE;
   }
 
   /**
    * Is this being used by a front end user to update their own recurring.
    *
    * @return bool
+   * @throws \CRM_Core_Exception
    */
   protected function isSelfService() {
-    if (!is_null($this->selfService)) {
+    if ($this->selfService !== NULL) {
       return $this->selfService;
     }
     $this->selfService = FALSE;
     if (!CRM_Core_Permission::check('edit contributions')) {
-      if ($this->_subscriptionDetails->contact_id != $this->getContactID()) {
+      if ($this->getSubscriptionContactID() !== $this->getContactIDIfAccessingOwnRecord()) {
         CRM_Core_Error::statusBounce(ts('You do not have permission to cancel this recurring contribution.'));
       }
       $this->selfService = TRUE;
index 6833eafd0e252eba747ee44b164bd80b4aa7094e..f1c72357c7bf9c41b5158909bff8c4db3262f816 100644 (file)
@@ -38,10 +38,7 @@ class CRM_Contribute_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
     $this->setDefaults(['onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP]);
 
-    $this->addElement('xbutton', 'loadMapping', ts('Load Mapping'), [
-      'type' => 'submit',
-      'onclick' => 'checkSelect()',
-    ]);
+    $this->addElement('submit', 'loadMapping', ts('Load Mapping'), NULL, ['onclick' => 'checkSelect()']);
 
     $this->addContactTypeSelector();
   }
index 0a5a4f67e5050380abb9a9bc2ff4349daa7ae41b..fac5a250bc7bf7907cd5913985a540ca8754268a 100644 (file)
@@ -86,7 +86,11 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
           ];
         }
 
-        if (!$paymentProcessorObj->supports('ChangeSubscriptionAmount') && !$paymentProcessorObj->supports('EditRecurringContribution')) {
+        if (
+        (!CRM_Core_Permission::check('edit contributions') && $context === 'contribution') ||
+        (!$paymentProcessorObj->supports('ChangeSubscriptionAmount')
+          && !$paymentProcessorObj->supports('EditRecurringContribution')
+        )) {
           unset($links[CRM_Core_Action::UPDATE]);
         }
       }
index 3c9bf18beaa7b6e494e17a46a227bbbee9632d08..e2e0e7057a29de51be7091621772fe334e24e630 100644 (file)
@@ -318,12 +318,8 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
     $hasRelationTypes = [];
 
     $columnCount = $columnNo;
-    $form->addElement('xbutton', 'addBlock', ts('Also include contacts where'),
-      [
-        'type' => 'submit',
-        'class' => 'submit-link',
-        'value' => 1,
-      ]
+    $form->addElement('submit', 'addBlock', ts('Also include contacts where'),
+      ['class' => 'submit-link']
     );
 
     $contactTypes = CRM_Contact_BAO_ContactType::basicTypes();
@@ -557,11 +553,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
         $form->add('text', "value[$x][$i]", '');
       }
 
-      $form->addElement('xbutton', "addMore[$x]", ts('Another search field'), [
-        'type' => 'submit',
-        'class' => 'submit-link',
-        'value' => 1,
-      ]);
+      $form->addElement('submit', "addMore[$x]", ts('Another search field'), ['class' => 'submit-link']);
     }
     //end of block for
 
index bbe11ae3af9a33da3b4671d87a8f3c747daaa26a..5523858d6ac9fa69be7ed35e13f216d9b41daa68 100644 (file)
@@ -879,6 +879,23 @@ MODIFY      {$columnName} varchar( $length )
     return CRM_Core_DAO::singleValueQuery('SELECT @@collation_database');
   }
 
+  /**
+   * Get the collation actually being used by the tables in the database.
+   *
+   * The db collation may not match the collation used by the tables, get what is
+   * set on the tables (represented by civicrm_contact).
+   *
+   * @return string
+   */
+  public static function getInUseCollation() {
+    if (!isset(\Civi::$statics[__CLASS__][__FUNCTION__])) {
+      $dao = CRM_Core_DAO::executeQuery('SHOW TABLE STATUS LIKE \'civicrm_contact\'');
+      $dao->fetch();
+      \Civi::$statics[__CLASS__][__FUNCTION__] = $dao->Collation;
+    }
+    return \Civi::$statics[__CLASS__][__FUNCTION__];
+  }
+
   /**
    * Get the database collation.
    *
index 6e7895dda2c61dc8e8113d62892da33e1fd4c5db..5f85ae8736b2d81cd23097059e0c9d5e811e6106 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Phone.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:49f2d961afab0fe5b18a91bd1371cf35)
+ * (GenCodeChecksum:b10c818f0a807eacffe604063455467f)
  */
 
 /**
index 158a6eedbb51adf1329769869710479e33671bc0..98526b5a8198102ab15a687c1b8f98faed0d2a9f 100644 (file)
@@ -668,13 +668,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
       $attrs = ['class' => 'crm-form-submit'] + (array) CRM_Utils_Array::value('js', $button);
 
-      // A lot of forms use the hacky method of looking at
-      // `$params['button name']` (dating back to them being inputs with a
-      // "value" of the button label) rather than looking at
-      // `$this->controller->getButtonName()`. It makes sense to give buttons a
-      // value by default as a precaution.
-      $attrs['value'] = 1;
-
       if (!empty($button['class'])) {
         $attrs['class'] .= ' ' . $button['class'];
       }
@@ -693,8 +686,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       }
 
       if ($button['type'] === 'reset') {
-        $attrs['type'] = 'reset';
-        $prevnext[] = $this->createElement('xbutton', 'reset', $button['name'], $attrs);
+        $prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs);
       }
       else {
         if (!empty($button['subName'])) {
@@ -712,11 +704,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         if (in_array($button['type'], ['next', 'upload', 'done']) && $button['name'] === ts('Save')) {
           $attrs['accesskey'] = 'S';
         }
-        $buttonContents = CRM_Core_Page::crmIcon($button['icon'] ?? $defaultIcon) . ' ' . $button['name'];
+        $icon = CRM_Utils_Array::value('icon', $button, $defaultIcon);
+        if ($icon) {
+          $attrs['crm-icon'] = $icon;
+        }
         $buttonName = $this->getButtonName($button['type'], CRM_Utils_Array::value('subName', $button));
-        $attrs['class'] .= " crm-button crm-button-type-{$button['type']} crm-button{$buttonName}";
-        $attrs['type'] = 'submit';
-        $prevnext[] = $this->createElement('xbutton', $buttonName, $buttonContents, $attrs);
+        $prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs);
       }
       if (!empty($button['isDefault'])) {
         $this->setDefaultAction($button['type']);
@@ -2235,11 +2228,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
   /**
    * Get the contact id of the logged in user.
+   *
+   * @return int|false
    */
   public function getLoggedInUserContactID() {
     // check if the user is logged in and has a contact ID
     $session = CRM_Core_Session::singleton();
-    return $session->get('userID');
+    return $session->get('userID') ? (int) $session->get('userID') : FALSE;
   }
 
   /**
@@ -2263,6 +2258,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   - id_field
    *   - url (for ajax lookup)
    *
+   * @throws \CRM_Core_Exception
    * @todo add data attributes so we can deal with multiple instances on a form
    */
   public function addAutoSelector($profiles = [], $autoCompleteField = []) {
@@ -2452,10 +2448,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         $this->_actionButtonName = $this->getButtonName('next', 'action');
       }
       $this->assign('actionButtonName', $this->_actionButtonName);
-      $this->add('xbutton', $this->_actionButtonName, ts('Go'), [
-        'type' => 'submit',
-        'class' => 'hiddenElement crm-search-go-button',
-      ]);
+      $this->add('submit', $this->_actionButtonName, ts('Go'), ['class' => 'hiddenElement crm-search-go-button']);
 
       // Radio to choose "All items" or "Selected items only"
       $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', ['checked' => 'checked']);
@@ -2656,4 +2649,26 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     }
   }
 
+  /**
+   * Get the contact if from the url, using the checksum or the cid if it is the logged in user.
+   *
+   * This function returns the user being validated. It is not intended to get another user
+   * they have permission to (setContactID does do that) and can be used to check if the user is
+   * accessing their own record.
+   *
+   * @return int|false
+   * @throws \CRM_Core_Exception
+   */
+  protected function getContactIDIfAccessingOwnRecord() {
+    $contactID = (int) CRM_Utils_Request::retrieve('cid', 'Positive', $this);
+    if (!$contactID) {
+      return FALSE;
+    }
+    if ($contactID === $this->getLoggedInUserContactID()) {
+      return $contactID;
+    }
+    $userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this);
+    return CRM_Contact_BAO_Contact_Utils::validChecksum($contactID, $userChecksum) ? $contactID : FALSE;
+  }
+
 }
index 9c998dc66d604dd2dde9ee5c848cd572f2068688..b312c8e8d9318fe1d12426f75638cb074bb8c686 100644 (file)
@@ -831,7 +831,7 @@ abstract class CRM_Core_Payment {
           'size' => 20,
           'maxlength' => 20,
           'autocomplete' => 'off',
-          'class' => 'creditcard',
+          'class' => 'creditcard required',
         ],
         'is_required' => TRUE,
         // 'description' => '16 digit card number', // If you enable a description field it will be shown below the field on the form
@@ -844,6 +844,7 @@ abstract class CRM_Core_Payment {
           'size' => 5,
           'maxlength' => 10,
           'autocomplete' => 'off',
+          'class' => ($isCVVRequired ? 'required' : ''),
         ],
         'is_required' => $isCVVRequired,
         'rules' => [
@@ -867,7 +868,7 @@ abstract class CRM_Core_Payment {
             'rule_parameters' => TRUE,
           ],
         ],
-        'extra' => ['class' => 'crm-form-select'],
+        'extra' => ['class' => 'crm-form-select required'],
       ],
       'credit_card_type' => [
         'htmlType' => 'select',
@@ -884,6 +885,7 @@ abstract class CRM_Core_Payment {
           'size' => 20,
           'maxlength' => 34,
           'autocomplete' => 'on',
+          'class' => 'required',
         ],
         'is_required' => TRUE,
       ],
@@ -896,6 +898,7 @@ abstract class CRM_Core_Payment {
           'size' => 20,
           'maxlength' => 34,
           'autocomplete' => 'off',
+          'class' => 'required',
         ],
         'rules' => [
           [
@@ -915,6 +918,7 @@ abstract class CRM_Core_Payment {
           'size' => 20,
           'maxlength' => 11,
           'autocomplete' => 'off',
+          'class' => 'required',
         ],
         'is_required' => TRUE,
         'rules' => [
@@ -933,6 +937,7 @@ abstract class CRM_Core_Payment {
           'size' => 20,
           'maxlength' => 64,
           'autocomplete' => 'off',
+          'class' => 'required',
         ],
         'is_required' => TRUE,
 
@@ -1034,6 +1039,7 @@ abstract class CRM_Core_Payment {
         'size' => 30,
         'maxlength' => 60,
         'autocomplete' => 'off',
+        'class' => 'required',
       ],
       'is_required' => TRUE,
     ];
@@ -1060,6 +1066,7 @@ abstract class CRM_Core_Payment {
         'size' => 30,
         'maxlength' => 60,
         'autocomplete' => 'off',
+        'class' => 'required',
       ],
       'is_required' => TRUE,
     ];
@@ -1073,6 +1080,7 @@ abstract class CRM_Core_Payment {
         'size' => 30,
         'maxlength' => 60,
         'autocomplete' => 'off',
+        'class' => 'required',
       ],
       'is_required' => TRUE,
     ];
@@ -1086,6 +1094,7 @@ abstract class CRM_Core_Payment {
         'size' => 30,
         'maxlength' => 60,
         'autocomplete' => 'off',
+        'class' => 'required',
       ],
       'is_required' => TRUE,
     ];
@@ -1096,6 +1105,7 @@ abstract class CRM_Core_Payment {
       'name' => "billing_state_province_id-{$billingLocationID}",
       'cc_field' => TRUE,
       'is_required' => TRUE,
+      'extra' => ['class' => 'required'],
     ];
 
     $metadata["billing_postal_code-{$billingLocationID}"] = [
@@ -1107,6 +1117,7 @@ abstract class CRM_Core_Payment {
         'size' => 30,
         'maxlength' => 60,
         'autocomplete' => 'off',
+        'class' => 'required',
       ],
       'is_required' => TRUE,
     ];
@@ -1120,6 +1131,7 @@ abstract class CRM_Core_Payment {
         '' => ts('- select -'),
       ] + CRM_Core_PseudoConstant::country(),
       'is_required' => TRUE,
+      'extra' => ['class' => 'required'],
     ];
     return $metadata;
   }
index 5a9fcbc9924bbdb3b129113459c8f2245b160213..0cbbc2b93984506d9abd5c2bc0708b0911662823 100644 (file)
@@ -193,7 +193,6 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment {
       default:
         // Success
         $params['trxn_id'] = !empty($response_fields[6]) ? $response_fields[6] : $this->getTestTrxnID();
-        $params['gross_amount'] = $response_fields[9];
         break;
     }
 
index 4757fb296c6b0e7dedd5d34d92c388b8867b7312..7961d56e942f8c39424b242aa736e1fbe1d06fe1 100644 (file)
@@ -97,7 +97,6 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment {
 
     $params['trxn_id'] = $this->getTrxnID();;
 
-    $params['gross_amount'] = $propertyBag->getAmount();
     // Add a fee_amount so we can make sure fees are handled properly in underlying classes.
     $params['fee_amount'] = 1.50;
     $params['description'] = $this->getPaymentDescription($params);
index 3779297a08e08327f64fa2519a97ab0e98e319af..1c7263812c522bae496812da1b71964e17012560 100644 (file)
@@ -109,7 +109,7 @@ class CRM_Core_Payment_Form {
           $field['name'],
           $field['title'],
           $field['attributes'],
-          $field['is_required'],
+          FALSE,
           $field['extra']
         );
       }
index 4fc8ec90056328788206450d6acb9863a260e85e..ce1b33442ce6fd0e5190906d9168cc7b96b51b2f 100644 (file)
@@ -151,7 +151,6 @@ class CRM_Core_Payment_PayJunction extends CRM_Core_Payment {
     // Success
     $params['trxn_result_code'] = $pjpgResponse['dc_response_code'];
     $params['trxn_id'] = $pjpgResponse['dc_transaction_id'];
-    $params['gross_amount'] = $params['amount'];
 
     return $params;
   }
index 79c2ecd9de9989c85452670cd816b98e64cd9d70..be3f794b11ef4d2f3b91da398b7bf003006bce62 100644 (file)
@@ -339,7 +339,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
 
     /* Success */
     $params['trxn_id'] = $result['transactionid'];
-    $params['gross_amount'] = $result['amt'];
     $params['fee_amount'] = $result['feeamt'];
     $params['net_amount'] = $result['settleamt'] ?? NULL;
     if ($params['net_amount'] == 0 && $params['fee_amount'] != 0) {
index 6fa22c9ccd867c3dcaebe88fb6aa1c36f7248fc4..03ad040db4e24e7c7d2352a48704b16a36f2ae2f 100644 (file)
@@ -175,7 +175,6 @@ class CRM_Core_Payment_Realex extends CRM_Core_Payment {
     $params['trxn_id'] = $response['PASREF'];
     $params['trxn_result_code'] = serialize($extras);
     $params['currencyID'] = $this->_getParam('currency');
-    $params['gross_amount'] = $this->_getParam('amount');
     $params['fee_amount'] = 0;
 
     return $params;
index 9c37727053fcf94495047848ceae6b7000d38993..e8ec19da0dab8711c3d8b4e8f083cefef9ec1a17 100644 (file)
@@ -340,7 +340,6 @@ class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
       $beaglestatus = ': ' . $beaglestatus;
     }
     $params['trxn_result_code'] = $eWAYResponse->Status() . $beaglestatus;
-    $params['gross_amount'] = $eWAYResponse->Amount();
     $params['trxn_id'] = $eWAYResponse->TransactionNumber();
 
     return $params;
index f214af7026b0556a616b331f65a02d9db6385a87..f5e6096c0e6c687804103b6178a78448dd71c5f4 100644 (file)
@@ -565,13 +565,10 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
       $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid);
-      $this->addElement('xbutton',
+      $this->addElement('button',
         'done',
         ts('Done'),
-        [
-          'type' => 'button',
-          'onclick' => "location.href='$url'",
-        ]
+        ['onclick' => "location.href='$url'"]
       );
     }
   }
index 09cffc753310635b4b1002abeb9c9fa8abba058c..0c37d9037416f3bc3158bc17170bd53eab0d8013 100644 (file)
@@ -351,10 +351,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     // TODO: Is this condition ever true? Can this code be removed?
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $this->addElement('xbutton', 'done', ts('Done'), [
-        'type' => 'button',
-        'onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'",
-      ]);
+      $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"]);
     }
   }
 
index 05f6dcd81e72784dffd4ce024dbd224208efef91..3bb6a5fb6c0430adc52370d250a4143bfe58cf5d 100644 (file)
@@ -201,14 +201,10 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
           'reset=1&action=browse&fid=' . $this->_fid . '&gid=' . $this->_gid,
           TRUE, NULL, FALSE
         );
-        $this->addElement('xbutton',
+        $this->addElement('button',
           'done',
-          CRM_Core_Page::crmIcon('fa-times') . ' ' . ts('Done'),
-          [
-            'type' => 'button',
-            'onclick' => "location.href='$url'",
-            'class' => 'crm-form-submit cancel',
-          ]
+          ts('Done'),
+          ['onclick' => "location.href='$url'", 'class' => 'crm-form-submit cancel', 'crm-icon' => 'fa-times']
         );
       }
     }
index ea27687ddc82c95cc2c56df79d5ccd91ef0f8879..8a7806e8a338e38f0c43f2cea8b02bac97113033 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Event.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ad8debb948e4646b04fb46991c0867db)
+ * (GenCodeChecksum:164ee1a507b9244536114d1569ccff1e)
  */
 
 /**
index e8c5bbe6282e2f43a4db8bed5f1e028cafeda826..40b40fc9126e655739992dda15e0c02448771af1 100644 (file)
@@ -289,7 +289,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
 
       // value
       $this->add('text', "value[$i]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'));
-      $this->addRule("value[$i]", ts('Please enter a valid money value for this field (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+      $this->addRule("value[$i]", ts('Please enter a valid money value for this field (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
       // default
       $default[] = $this->createElement('radio', NULL, NULL, NULL, $i);
@@ -355,12 +355,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
       $this->add('datepicker', 'discount_end_date[' . $i . ']', ts('Discount End Date'), [], FALSE, ['time' => FALSE]);
     }
     $_showHide->addToTemplate();
-    $this->addElement('xbutton', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'),
-      [
-        'type' => 'submit',
-        'class' => 'crm-form-submit cancel',
-        'value' => 1,
-      ]
+    $this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'),
+      ['class' => 'crm-form-submit cancel']
     );
     if (Civi::settings()->get('deferred_revenue_enabled')) {
       $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
@@ -519,7 +515,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
       // value
       for ($j = 1; $j <= self::NUM_DISCOUNT; $j++) {
         $this->add('text', "discounted_value[$i][$j]", ts('Value'), ['size' => 10]);
-        $this->addRule("discounted_value[$i][$j]", ts('Please enter a valid money value for this field (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+        $this->addRule("discounted_value[$i][$j]", ts('Please enter a valid money value for this field (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
       }
 
       // default
@@ -814,7 +810,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
         $params['value'][$index] = CRM_Utils_Rule::cleanMoney(trim($value));
       }
     }
-    foreach ($params['discounted_value'] as $index => $discountedValueSet) {
+    foreach ($params['discounted_value'] ?? [] as $index => $discountedValueSet) {
       foreach ($discountedValueSet as $innerIndex => $value) {
         if (CRM_Utils_System::isNull($value)) {
           unset($params['discounted_value'][$index][$innerIndex]);
index 20848b58ecae0de326618eb1771b00d8ab0b7591..408a84e729118d37b93e14580c91f1a9c0600dc7 100644 (file)
@@ -75,7 +75,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search {
    */
   public function buildQuickForm() {
     if ($this->_batchStatus == 'Closed') {
-      $this->add('xbutton', 'export_batch', ts('Export Batch'), ['type' => 'submit']);
+      $this->add('submit', 'export_batch', ts('Export Batch'));
     }
 
     // do not build rest of form unless it is open/reopened batch
@@ -85,9 +85,9 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search {
 
     parent::buildQuickForm();
     if (CRM_Batch_BAO_Batch::checkBatchPermission('close', $this->_values['created_id'])) {
-      $this->add('xbutton', 'close_batch', ts('Close Batch'), ['type' => 'submit']);
+      $this->add('submit', 'close_batch', ts('Close Batch'));
       if (CRM_Batch_BAO_Batch::checkBatchPermission('export', $this->_values['created_id'])) {
-        $this->add('xbutton', 'export_batch', ts('Close & Export Batch'), ['type' => 'submit']);
+        $this->add('submit', 'export_batch', ts('Close & Export Batch'));
       }
     }
 
@@ -99,9 +99,8 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search {
       ts('Task'),
       ['' => ts('- actions -')] + ['Remove' => ts('Remove from Batch')]);
 
-    $this->add('xbutton', 'rSubmit', ts('Go'),
+    $this->add('submit', 'rSubmit', ts('Go'),
       [
-        'type' => 'submit',
         'class' => 'crm-form-submit',
         'id' => 'GoRemove',
       ]);
@@ -124,9 +123,8 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search {
       ts('Task'),
       ['' => ts('- actions -')] + ['Assign' => ts('Assign to Batch')]);
 
-    $this->add('xbutton', 'submit', ts('Go'),
+    $this->add('submit', 'submit', ts('Go'),
       [
-        'type' => 'submit',
         'class' => 'crm-form-submit',
         'id' => 'Go',
       ]);
index 069c6e0a9abdbf9a21f17a6e1ce0554df208d2c5..985d9ddfbb672383331ddf9247b5c97132193e14 100644 (file)
@@ -93,9 +93,8 @@ class CRM_Financial_Form_Search extends CRM_Core_Form {
       ts('Task'),
       ['' => ts('- actions -')] + $batchAction);
 
-    $this->add('xbutton', 'submit', ts('Go'),
+    $this->add('submit', 'submit', ts('Go'),
       [
-        'type' => 'submit',
         'class' => 'crm-form-submit',
         'id' => 'Go',
       ]);
index d91699ca81b2ea44b91b1e828955cc37235a840d..f34f8946121267aa64be6612e9806c3fdd04ac4b 100644 (file)
@@ -328,10 +328,10 @@ class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query {
     $form->addElement('checkbox', 'grant_decision_date_notset', ts('Date is not set'), NULL);
 
     $form->add('text', 'grant_amount_low', ts('Minimum Amount'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('grant_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('9.99', ' ')]), 'money');
+    $form->addRule('grant_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('9.99')]), 'money');
 
     $form->add('text', 'grant_amount_high', ts('Maximum Amount'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('grant_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+    $form->addRule('grant_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
     self::addCustomFormFields($form, ['Grant']);
 
index 6640b4b113f87e666feef366c63fb971ee2db92f..4f2f491ec6e7b2a77a133cd56e72a58be53c3101 100644 (file)
@@ -121,7 +121,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
 
     $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
     $activityParams = [
-      'status_id' => CRM_Utils_Array::value('membership_activity_status', $params, 'Completed'),
+      'status_id' => $params['membership_activity_status'] ?? 'Completed',
     ];
     if (in_array($allStatus[$membership->status_id], ['Pending', 'Grace'])) {
       $activityParams['status_id'] = 'Scheduled';
@@ -166,15 +166,11 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       }
 
       foreach (['Membership Signup', 'Membership Renewal'] as $activityType) {
-        $activityParams['id'] = CRM_Utils_Array::value('id',
-          civicrm_api3('Activity', 'Get',
-            [
-              'source_record_id' => $membership->id,
-              'activity_type_id' => $activityType,
-              'status_id' => 'Scheduled',
-            ]
-          )
-        );
+        $activityParams['id'] = civicrm_api3('Activity', 'Get', [
+          'source_record_id' => $membership->id,
+          'activity_type_id' => $activityType,
+          'status_id' => 'Scheduled',
+        ])['id'] ?? NULL;
         // 1. Update Schedule Membership Signup/Renwal activity to completed on successful payment of pending membership
         // 2. OR Create renewal activity scheduled if its membership renewal will be paid later
         if (!empty($params['membership_activity_status']) && (!empty($activityParams['id']) || $activityType == 'Membership Renewal')) {
@@ -261,7 +257,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       $params['join_date'] = trim($params['join_date']) ? date('Ymd', strtotime(trim($params['join_date']))) : 'null';
 
       //fix for CRM-3570, during import exclude the statuses those having is_admin = 1
-      $excludeIsAdmin = CRM_Utils_Array::value('exclude_is_admin', $params, FALSE);
+      $excludeIsAdmin = $params['exclude_is_admin'] ?? FALSE;
 
       //CRM-3724 always skip is_admin if is_override != true.
       if (!$excludeIsAdmin && empty($params['is_override'])) {
@@ -269,7 +265,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       }
 
       $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($params['start_date'], $params['end_date'], $params['join_date'],
-        'today', $excludeIsAdmin, CRM_Utils_Array::value('membership_type_id', $params), $params
+        'today', $excludeIsAdmin, $params['membership_type_id'] ?? NULL, $params
       );
       if (empty($calcStatus)) {
         throw new CRM_Core_Exception(ts("The membership cannot be saved because the status cannot be calculated for start_date: {$params['start_date']} end_date {$params['end_date']} join_date {$params['join_date']} as at " . date('Y-m-d H:i:s')));
@@ -295,12 +291,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
 
     $transaction = new CRM_Core_Transaction();
 
-    // @todo remove $ids from here $ids['userId'] is still used
-    $params['id'] = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('membership', $ids));
-    if (empty($params['modified_id']) && !empty($ids['userID'])) {
-      CRM_Core_Error::deprecatedFunctionWarning('$ids["userID"] no longer supported - use $params["modified_id"]');
-      $params['modified_id'] = $ids['userID'];
-    }
+    $params['id'] = $params['id'] ?? $ids['membership'] ?? NULL;
     $membership = self::add($params);
 
     if (is_a($membership, 'CRM_Core_Error')) {
@@ -364,7 +355,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
           if (!empty($params['contribution'])) {
             $params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id;
           }
-          if ($lineMembershipType && $lineMembershipType == CRM_Utils_Array::value('membership_type_id', $params)) {
+          if ($lineMembershipType && $lineMembershipType == ($params['membership_type_id'] ?? NULL)) {
             $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $membership->id;
             $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_membership';
           }
@@ -377,7 +368,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
       CRM_Price_BAO_LineItem::processPriceSet(
         $membership->id,
         $params['line_item'],
-        CRM_Utils_Array::value('contribution', $params)
+        $params['contribution'] ?? NULL
       );
     }
 
@@ -837,7 +828,7 @@ INNER JOIN  civicrm_membership_type type ON ( type.id = membership.membership_ty
             'limit' => 0,
           ],
         ]);
-        $memberTypesSameParentOrgList = implode(',', array_keys(CRM_Utils_Array::value('values', $memberTypesSameParentOrg, [])));
+        $memberTypesSameParentOrgList = implode(',', array_keys($memberTypesSameParentOrg['values'] ?? []));
         $dao->whereAdd('membership_type_id IN (' . $memberTypesSameParentOrgList . ')');
       }
     }
@@ -1148,9 +1139,9 @@ AND civicrm_membership.is_test = %2";
     }
 
     $status = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate(
-      CRM_Utils_Array::value('start_date', $currentMembership),
-      CRM_Utils_Array::value('end_date', $currentMembership),
-      CRM_Utils_Array::value('join_date', $currentMembership),
+      $currentMembership['start_date'] ?? NULL,
+      $currentMembership['end_date'] ?? NULL,
+      $currentMembership['join_date'] ?? NULL,
       $today,
       TRUE,
       $currentMembership['membership_type_id'],
@@ -1199,7 +1190,7 @@ AND civicrm_membership.is_test = %2";
           $format
         ),
         'membership_type_id' => $currentMembership['membership_type_id'],
-        'max_related' => CRM_Utils_Array::value('max_related', $currentMembership, 0),
+        'max_related' => $currentMembership['max_related'] ?? 0,
       ];
 
       $session = CRM_Core_Session::singleton();
@@ -1376,7 +1367,7 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
     $relatedContacts = [];
     $allRelatedContacts = CRM_Member_BAO_Membership::checkMembershipRelationship($membership->membership_type_id,
       $membership->contact_id,
-      CRM_Utils_Array::value('action', $params)
+      $params['action'] ?? NULL
     );
 
     // CRM-4213, CRM-19735 check for loops, using static variable to record contacts already processed.
@@ -1448,7 +1439,7 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
         ) {
           $params['status_id'] = $deceasedStatusId;
         }
-        elseif ((CRM_Utils_Array::value('action', $params) & CRM_Core_Action::UPDATE) &&
+        elseif ((($params['action'] ?? NULL) & CRM_Core_Action::UPDATE) &&
           ($relationshipStatus == CRM_Contact_BAO_Relationship::PAST)
         ) {
           $params['status_id'] = $expiredStatusId;
@@ -1882,7 +1873,7 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id AND
         // Insert renewed dates for CURRENT membership
         $memParams = [];
         $memParams['join_date'] = CRM_Utils_Date::isoToMysql($membership->join_date);
-        $memParams['start_date'] = CRM_Utils_Array::value('start_date', $formDates, CRM_Utils_Date::isoToMysql($membership->start_date));
+        $memParams['start_date'] = $formDates['start_date'] ?? CRM_Utils_Date::isoToMysql($membership->start_date);
         $memParams['end_date'] = $formDates['end_date'] ?? NULL;
         if (empty($memParams['end_date'])) {
           $memParams['end_date'] = $dates['end_date'] ?? NULL;
@@ -2403,7 +2394,7 @@ WHERE {$whereClause}";
     $contributionParams = [];
     $config = CRM_Core_Config::singleton();
     $contributionParams['currency'] = $config->defaultCurrency;
-    $contributionParams['receipt_date'] = (CRM_Utils_Array::value('receipt_date', $params)) ? $params['receipt_date'] : 'null';
+    $contributionParams['receipt_date'] = !empty($params['receipt_date']) ? $params['receipt_date'] : 'null';
     $contributionParams['source'] = $params['contribution_source'] ?? NULL;
     $contributionParams['non_deductible_amount'] = 'null';
     $contributionParams['skipCleanMoney'] = TRUE;
index 4b780c59831e3fe22eec8c6d395cef7fdfbef1e7..45f9b1c37cc807b2eccc448036f47278527a56c1 100644 (file)
@@ -539,10 +539,10 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query {
 
     $form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE);
     $form->add('text', 'pledge_amount_low', ts('From'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('9.99', ' ')]), 'money');
+    $form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('9.99')]), 'money');
 
     $form->add('text', 'pledge_amount_high', ts('To'), ['size' => 8, 'maxlength' => 8]);
-    $form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::format('99.99', ' ')]), 'money');
+    $form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', [1 => CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency('99.99')]), 'money');
 
     $form->addYesNo('pledge_acknowledge_date_is_not_null', ts('Acknowledgement sent?'), TRUE);
 
index f381e971fd6421d03babd9085e67d99f04aba021..b299fc7ad58c312e4000ef600c7c02b72205205c 100644 (file)
@@ -426,18 +426,9 @@ WHERE li.contribution_id = %1";
         }
         if (!empty($contributionDetails->id)) {
           $line['contribution_id'] = $contributionDetails->id;
-          if ($line['entity_table'] == 'civicrm_contribution') {
+          if ($line['entity_table'] === 'civicrm_contribution') {
             $line['entity_id'] = $contributionDetails->id;
           }
-          // CRM-19094: entity_table is set to civicrm_membership then ensure
-          // the entityId is set to membership ID not contribution by default
-          elseif ($line['entity_table'] == 'civicrm_membership' && !empty($line['entity_id']) && $line['entity_id'] == $contributionDetails->id) {
-            $membershipId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $contributionDetails->id, 'membership_id', 'contribution_id');
-            if ($membershipId && (int) $membershipId !== (int) $line['entity_id']) {
-              $line['entity_id'] = $membershipId;
-              Civi::log()->warning('Per https://lab.civicrm.org/dev/core/issues/15 this data fix should not be required. Please log a ticket at https://lab.civicrm.org/dev/core with steps to get this.', ['civi.tag' => 'deprecated']);
-            }
-          }
         }
 
         // if financial type is not set and if price field value is NOT NULL
index 25737ee9fb4b6fcd4bc2cb937b33cfce2e40f296..c7c8e0913e40b12bf692fa82ba8d990383b35068 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4ce556d152a07393048aa1bc0a0e3ed0)
+ * (GenCodeChecksum:a1acc613daec86c6049e545af5fc7fd1)
  */
 
 /**
index aed5e90a8d8ec028d836069cdc1ec5a0301dfba2..571ab77be16ee7158efc542d658b88fa9d98a4c6 100644 (file)
@@ -376,13 +376,10 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
       $url = CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=browse&sid=' . $this->_sid);
-      $this->addElement('xbutton',
+      $this->addElement('button',
         'done',
         ts('Done'),
-        [
-          'type' => 'button',
-          'onclick' => "location.href='$url'",
-        ]
+        ['onclick' => "location.href='$url'"]
       );
     }
   }
index c6594fd4bd97ae2c3ffcb3851f39836f608d1f9f..8d8f46cd881fd97464027f1e7475434d0a3c5e5a 100644 (file)
@@ -904,13 +904,9 @@ class CRM_Profile_Form extends CRM_Core_Form {
 
     if ($this->_context == 'dialog') {
       $this->addElement(
-        'xbutton',
+        'submit',
         $this->_duplicateButtonName,
-        ts('Save Matching Contact'),
-        [
-          'type' => 'submit',
-          'class' => 'crm-button',
-        ]
+        ts('Save Matching Contact')
       );
     }
   }
index b2cfc16bf4477b5cb2ece554fffe62cf017824ab..7564dc37fc280614971c140e895fd706ebbcc6bf 100644 (file)
@@ -209,11 +209,7 @@ SELECT module,is_reserved
 
     if (($this->_multiRecord & CRM_Core_Action::DELETE) && $this->_recordExists) {
       $this->_deleteButtonName = $this->getButtonName('upload', 'delete');
-      $this->addElement('xbutton', $this->_deleteButtonName, ts('Delete'), [
-        'type' => 'submit',
-        'value' => 1,
-        'class' => 'crm-button',
-      ]);
+      $this->addElement('submit', $this->_deleteButtonName, ts('Delete'));
 
       return;
     }
index 07bd815673b4c781e12d9069513b19ee44137aaa..d202b845611e96f7c86c13feee7c0357f8c91fd4 100644 (file)
@@ -1535,7 +1535,7 @@ class CRM_Report_Form extends CRM_Core_Form {
     if (!empty($this->_charts)) {
       $this->addElement('select', "charts", ts('Chart'), $this->_charts);
       $this->assign('charts', $this->_charts);
-      $this->addElement('xbutton', $this->_chartButtonName, ts('View'), ['type' => 'submit']);
+      $this->addElement('submit', $this->_chartButtonName, ts('View'));
     }
   }
 
@@ -1660,10 +1660,7 @@ class CRM_Report_Form extends CRM_Core_Form {
       $this->assign('group', TRUE);
     }
 
-    $this->addElement('xbutton', $this->_groupButtonName, '', [
-      'type' => 'submit',
-      'style' => 'display: none;',
-    ]);
+    $this->addElement('submit', $this->_groupButtonName, '', ['style' => 'display: none;']);
 
     $this->addChartOptions();
     $showResultsLabel = $this->getResultsLabel();
index c7526b39188f8aab26aa41af0d6ff34bdf6d195b..bc1a49fe0214a90167e9f16566a26da12e746507 100644 (file)
@@ -815,7 +815,7 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
           }
 
           if ($last_primary && ($rowNum == "{$last_primary}_total")) {
-            $value = CRM_Utils_Money::format($value, ' ');
+            $value = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($value);
           }
           $row[$key] = '<strong>' . $value . '</strong>';
         }
index 4a53b78852a8bd20957985174364d3f4eef6d1b8..9755626958142e612333687f3f1075af7d85289e 100644 (file)
@@ -102,7 +102,7 @@ class CRM_SMS_Form_Group extends CRM_Contact_Form_Task {
     );
 
     // Get the mailing groups.
-    $groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
+    $groups = CRM_Core_PseudoConstant::nestedGroup(TRUE, 'Mailing');
 
     // Get the sms mailing list.
     $mailings = CRM_Mailing_PseudoConstant::completed('sms');
index 997962cd40b1f77cd35c80b4f1167b66310712b0..4bfcb214af81150eddebdc9b685c6a948d8218f7 100644 (file)
@@ -467,11 +467,8 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
     // if view mode pls freeze it with the done button.
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $this->addElement('xbutton', 'done', ts('Done'),
-        [
-          'type' => 'button',
-          'onclick' => "location.href='civicrm/admin/uf/group/field?reset=1&action=browse&gid=" . $this->_gid . "'",
-        ]
+      $this->addElement('button', 'done', ts('Done'),
+        ['onclick' => "location.href='civicrm/admin/uf/group/field?reset=1&action=browse&gid=" . $this->_gid . "'"]
       );
     }
 
index 5a4d3dd570a5e70c57dcd27212e2bd10ad002db7..a9fef4dc8fef3722bc6db7a0ab440bb258fa02a2 100644 (file)
@@ -231,10 +231,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
     // views are implemented as frozen form
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $this->addElement('xbutton', 'done', ts('Done'), [
-        'type' => 'button',
-        'onclick' => "location.href='civicrm/admin/uf/group?reset=1&action=browse'",
-      ]);
+      $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/uf/group?reset=1&action=browse'"]);
     }
 
     $this->addFormRule(['CRM_UF_Form_Group', 'formRule'], $this);
index 98a18a6b516bfa52e0717a200dcf7c9c0360c9fe..88d392c791374f0813affbf5f63d6ad7218419ad 100644 (file)
@@ -25,10 +25,11 @@ class CRM_Upgrade_Incremental_php_FiveTwentyNine extends CRM_Upgrade_Incremental
    * @param null $currentVer
    */
   public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
-    // Example: Generate a pre-upgrade message.
-    // if ($rev == '5.12.34') {
-    //   $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>';
-    // }
+    if ($rev == '5.29.beta1') {
+      if (CIVICRM_UF === 'Drupal8') {
+        $preUpgradeMessage .= '<p>' . ts('<em>Pre-announcement for upcoming version 5.30</em>: If your composer configuration or composer.json does not enable patching, you MUST do that BEFORE running composer to update your files to version 5.30. Either by using `composer config \'extra.enable-patching\' true`, or updating the top level composer.json\'s extra section with `"enable-patching": true`. See %1 for details.', [1 => '<a href="' . CRM_Utils_System::docURL2('installation/drupal8', TRUE) . '">Drupal 8 installation guide</a>']) . '</p>';
+      }
+    }
   }
 
   /**
index 77b7ad1103161a52bbe00f63278a4e04f819b9ed..06a377924c141abcfc58504a5249f41437250b69 100644 (file)
@@ -78,35 +78,49 @@ class CRM_Upgrade_Page_Upgrade extends CRM_Core_Page {
     $template = CRM_Core_Smarty::singleton();
     list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
 
-    if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
+    // Show success msg if db already upgraded
+    if (version_compare($currentVer, $latestVer) == 0) {
+      $template->assign('upgraded', TRUE);
+      $template->assign('newVersion', $latestVer);
+      CRM_Utils_System::setTitle(ts('Your database has already been upgraded to CiviCRM %1',
+        [1 => $latestVer]
+      ));
+      $template->assign('pageTitle', ts('Your database has already been upgraded to CiviCRM %1',
+        [1 => $latestVer]
+      ));
+    }
+
+    // Throw error if db in unexpected condition
+    elseif ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
       throw new CRM_Core_Exception($error);
     }
 
-    $config = CRM_Core_Config::singleton();
+    else {
+      $config = CRM_Core_Config::singleton();
 
-    // All cached content needs to be cleared because the civi codebase was just replaced
-    CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
+      // All cached content needs to be cleared because the civi codebase was just replaced
+      CRM_Core_Resources::singleton()->flushStrings()->resetCacheCode();
 
-    // cleanup only the templates_c directory
-    $config->cleanup(1, FALSE);
+      // cleanup only the templates_c directory
+      $config->cleanup(1, FALSE);
 
-    $preUpgradeMessage = NULL;
-    $upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
+      $preUpgradeMessage = NULL;
+      $upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
 
-    $template->assign('currentVersion', $currentVer);
-    $template->assign('newVersion', $latestVer);
-    $template->assign('upgradeTitle', ts('Upgrade CiviCRM from v %1 To v %2',
-      [1 => $currentVer, 2 => $latestVer]
-    ));
-    $template->assign('upgraded', FALSE);
+      $template->assign('preUpgradeMessage', $preUpgradeMessage);
+      $template->assign('currentVersion', $currentVer);
+      $template->assign('newVersion', $latestVer);
+      $template->assign('upgradeTitle', ts('Upgrade CiviCRM from v %1 To v %2',
+        [1 => $currentVer, 2 => $latestVer]
+      ));
+      $template->assign('upgraded', FALSE);
+    }
 
     // Render page header
     if (!defined('CIVICRM_UF_HEAD') && $region = CRM_Core_Region::instance('html-header', FALSE)) {
       CRM_Utils_System::addHTMLHead($region->render(''));
     }
 
-    $template->assign('preUpgradeMessage', $preUpgradeMessage);
-
     $content = $template->fetch('CRM/common/success.tpl');
     echo CRM_Utils_System::theme($content, $this->_print, TRUE);
   }
index 26e77d8caedd52249cb00a0ebe8a1707a0d3b6d8..0e4fb090ba9d91fb7d0cfcd7bf6b4d0220fd4e65 100644 (file)
@@ -471,13 +471,15 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
 
   /**
    * Checks if new versions are available
+   * @param bool $force
    * @return CRM_Utils_Check_Message[]
+   * @throws CRM_Core_Exception
    */
-  public function checkVersion() {
+  public function checkVersion($force = FALSE) {
     $messages = [];
     try {
       $vc = new CRM_Utils_VersionCheck();
-      $vc->initialize();
+      $vc->initialize($force);
     }
     catch (Exception $e) {
       $messages[] = new CRM_Utils_Check_Message(
@@ -492,7 +494,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
     }
 
     // Show a notice if the version_check job is disabled
-    if (empty($vc->cronJob['is_active'])) {
+    if (!$force && empty($vc->cronJob['is_active'])) {
       $args = empty($vc->cronJob['id']) ? ['reset' => 1] : ['reset' => 1, 'action' => 'update', 'id' => $vc->cronJob['id']];
       $messages[] = new CRM_Utils_Check_Message(
         'checkVersionDisabled',
index f0024d7ef79a5a15728fa8b35687061d04ca5c3b..89ed932432e7d33f5435263676d62ce2162d9341 100644 (file)
  */
 class CRM_Utils_SQL_TempTable {
 
+  /**
+   * @deprecated
+   * The system will attempt to use the same as your other tables, and
+   * if you really need something else then use createWithColumns and
+   * specify it per-column there.
+   */
   const UTF8 = 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci';
+
   const CATEGORY_LENGTH = 12;
   const CATEGORY_REGEXP = ';^[a-zA-Z0-9]+$;';
   // MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
@@ -135,23 +142,15 @@ class CRM_Utils_SQL_TempTable {
   /**
    * Get the utf8 string for the table.
    *
-   * If the db collation is already utf8 by default (either
-   * utf8 or utf84mb) then rely on that. Otherwise set to utf8.
-   *
-   * Respecting the DB collation supports utf8mb4 adopters, which is currently
-   * not the norm in civi installs.
+   * Our tables are either utf8_unicode_ci OR utf8mb4_unicode_ci - check the contact table
+   * to see which & use the matching one. Or early adopters may have switched
+   * switched to other collations e.g. utf8mb4_0900_ai_ci (the default in mysql
+   * 8).
    *
    * @return string
    */
   public function getUtf8String() {
-    if (!$this->utf8) {
-      return '';
-    }
-    $dbUTF = CRM_Core_BAO_SchemaHandler::getDBCollation();
-    if (strpos($dbUTF, 'utf8') !== FALSE) {
-      return '';
-    }
-    return self::UTF8;
+    return $this->utf8 ? ('COLLATE ' . CRM_Core_BAO_SchemaHandler::getInUseCollation()) : '';
   }
 
   /**
@@ -251,9 +250,11 @@ class CRM_Utils_SQL_TempTable {
   }
 
   /**
+   * @deprecated
    * @return bool
    */
   public function isUtf8() {
+    CRM_Core_Error::deprecatedFunctionWarning('your own charset/collation per column with createWithColumns if you really need latin1');
     return $this->utf8;
   }
 
@@ -332,6 +333,7 @@ class CRM_Utils_SQL_TempTable {
    * @return $this
    */
   public function setUtf8($value = TRUE) {
+    CRM_Core_Error::deprecatedFunctionWarning('your own charset/collation per column with createWithColumns if you really need latin1');
     $this->utf8 = $value;
     return $this;
   }
index b3bdb7fe545801ea63a8b080f1f6373301d84bd3..20b266d68046a5d9f2717b915c71ad54058531a8 100644 (file)
@@ -1416,7 +1416,7 @@ class CRM_Utils_System {
    * @return mixed
    */
   public static function formatDocUrl($url) {
-    return preg_replace('#^(user|sysadmin|dev)/#', '\1/en/latest/', $url);
+    return preg_replace('#^(installation|user|sysadmin|dev)/#', '\1/en/latest/', $url);
   }
 
   /**
index 1e3aaac78e0986a5c044cfb933e8cae5c45ebb9c..f3691eff7c04c085ac6bb9a40fcb921e2a65af6b 100644 (file)
@@ -319,9 +319,9 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     if ($config->userFrameworkFrontend) {
       global $post;
       if (get_option('permalink_structure') != '') {
-        $script = get_permalink($post->ID);
+        $script = $post ? get_permalink($post->ID) : "";
       }
-      if ($config->wpBasePage == $post->post_name) {
+      if ($post && $config->wpBasePage == $post->post_name) {
         $basepage = TRUE;
       }
       // when shortcode is included in page
index d3774f5d68f05d5660e2768c7d21d6478655fc0c..850a2516ac740961965fb3f131888c86b873dee8 100644 (file)
@@ -1806,8 +1806,10 @@ class CRM_Utils_Token {
         break;
 
       case 'receive_date':
+      case 'receipt_date':
         $value = CRM_Utils_Array::retrieveValueRecursive($contribution, $token);
-        $value = CRM_Utils_Date::customFormat($value, NULL, ['j', 'm', 'Y']);
+        $config = CRM_Core_Config::singleton();
+        $value = CRM_Utils_Date::customFormat($value, $config->dateformatDatetime);
         break;
 
       default:
index 0b3b9fa4607c11d8d1f643cbdfc4145ccd99d223..fbb05a1929c9cc1efad57f47d06c2bea49279082 100644 (file)
@@ -74,9 +74,10 @@ class CRM_Utils_VersionCheck {
   /**
    * Self-populates version info
    *
-   * @throws \Exception
+   * @param bool $force
+   * @throws Exception
    */
-  public function initialize() {
+  public function initialize($force = FALSE) {
     $this->getJob();
 
     // Populate remote $versionInfo from cache file
@@ -84,9 +85,9 @@ class CRM_Utils_VersionCheck {
 
     // Fallback if scheduled job is enabled but has failed to run.
     $expiryTime = time() - self::CACHEFILE_EXPIRE;
-    if (!empty($this->cronJob['is_active']) &&
+    if ($force || (!empty($this->cronJob['is_active']) &&
       (!$this->isInfoAvailable || filemtime($this->cacheFile) < $expiryTime)
-    ) {
+    )) {
       // First try updating the files modification time, for 2 reasons:
       //  - if the file is not writeable, this saves the trouble of pinging back
       //  - if the remote server is down, this will prevent an immediate retry
index a2d6695b68f1fcec95dad5298b28baeb1b6dda36..cf61ef5a7d057e2d95fd9235732a21d89f10b2d3 100644 (file)
@@ -1173,7 +1173,7 @@ input.crm-form-entityref {
   cursor: pointer;
 }
 
-#crm-container button.submit-link {
+#crm-container input.submit-link {
   color: #285286;
   background: none transparent;
   border: none;
@@ -1833,6 +1833,17 @@ input.crm-form-entityref {
   margin-left: .5em;
 }
 
+.crm-container .crm-button input {
+  background: none;
+  border: medium none;
+  color: #FFF;
+  cursor: pointer;
+  font-size: 13px;
+  font-weight: normal;
+  margin: 0;
+  padding: 1px 8px 2px 4px;
+}
+
 .crm-container .crm-button-type-cancel,
 .crm-container .crm-button-type-back {
   margin-left: 20px;
@@ -1847,7 +1858,9 @@ input.crm-form-entityref {
 .crm-container a.button,
 .crm-container a.button:link,
 .crm-container a.button:visited,
+.crm-container input.crm-form-submit,
 .crm-container .ui-dialog-buttonset .ui-button,
+.crm-container input[type=button],
 .crm-container .crm-button {
   text-shadow: 0 1px 0 black;
   background: #696969;
@@ -1859,15 +1872,48 @@ input.crm-form-entityref {
   text-decoration: none;
   cursor: pointer;
   border: 1px solid #3e3e3e;
+}
+
+.crm-container a.button,
+.crm-container a.button:link,
+.crm-container a.button:visited,
+.crm-container span.crm-button {
   display: block;
   float: left;
   overflow: hidden;
   line-height: 135%;
-  border-radius: 3px;
+}
+
+/* Preserving the important but not sure why */
+.crm-container span.crm-button {
+  float: left !important;
+}
+
+.crm-container button.crm-button {
+  padding: 3px 6px;
+}
+
+.crm-container button.crm-button .icon {
+  margin-bottom: -4px;
+}
+
+.crm-container input.crm-form-submit,
+.crm-container input[type=button] {
+  padding: 2px 6px;
+}
+
+.crm-container .crm-button input[type=button],
+.crm-container .crm-button input.crm-form-submit {
+  padding: 0;
+  margin: 0;
+  background: none;
+  border: none;
 }
 
 .crm-container .crm-button:hover,
 .crm-container .crm-button:focus,
+.crm-container input[type=submit]:hover,
+.crm-container input[type=button]:hover,
 .crm-container .ui-dialog-buttonset .ui-button:hover,
 .crm-container .ui-dialog-buttonset .ui-button:focus,
 .crm-container a.button:hover,
@@ -1878,24 +1924,28 @@ input.crm-form-entityref {
 .crm-container .crm-button-disabled,
 .crm-container .crm-button.crm-button-disabled,
 .crm-container .ui-dialog-buttonset .ui-button[disabled],
+.crm-container input.crm-form-submit[disabled],
+.crm-container input[type=button][disabled],
 .crm-container .crm-button[disabled] {
   opacity: .6;
   cursor: default;
 }
 
+.crm-container .crm-button-disabled input[disabled] {
+  opacity: 1;
+}
+
 .crm-container .ui-dialog-buttonpane {
   background: linear-gradient(to bottom, #f2f2f2 0%,#ffffff 35%);
 }
 
+.crm-container .ui-dialog-buttonset .ui-button {
+  padding: 0;
+}
 .crm-container .ui-dialog-buttonset .ui-button .ui-icon {
   background-image: url("../i/icons/jquery-ui-FFFFFF.png");
 }
 
-/* Override of a line in crm-i.css that may not be important anymore */
-.crm-container .ui-dialog-buttonset .ui-button .ui-icon[class*=" fa-"] {
-  margin-top: 0;
-}
-
 /* No crm-button styling for PayPal Express buttons */
 .crm-container input#_qf_Register_upload_express,
 .crm-container input#_qf_Payment_upload_express,
@@ -2838,6 +2888,15 @@ tbody.scrollContent tr.alternateRow {
 }
 
 /* rounded corners */
+.crm-container .crm-button,
+.crm-container a.button,
+.crm-container a.button:link,
+.crm-container input.crm-form-submit,
+.crm-container input[type=button] {
+  border-radius: 3px;
+}
+
+
 .crm-container div.status,
 .crm-container #help,
 .crm-container .help,
index 80b9ad96f05343d1ffd645ef1df7724bbb6ac61f..a59b3a047ad519e61792ace10a87973f8d8c2cdd 100644 (file)
@@ -352,7 +352,7 @@ div#toolbar-box, div#toolbar-box div.m{
 .crm-container input {
   height: auto;
 }
-.crm-container button[type=submit] {
+.crm-container input[type=submit] {
   height: auto;
 }
 
@@ -377,7 +377,7 @@ div#toolbar-box, div#toolbar-box div.m{
 }
 
 /* Remove Joomla subhead toolbar & whitespace border */
-
+       
 body.admin.com_civicrm .subhead-collapse {
        display:none;
 }
index eb12944d220edf6b705eb18a9b4fbcd713cc5080..e95165536b2e43f38345a7bf038babac463aa261 100644 (file)
@@ -34,7 +34,7 @@ if ($text_direction == 'rtl') {
   <?php } ?>
 
   <p>
-  <button id="install_button" type="submit" name="go" onclick="document.getElementById('saving_top').style.display = ''; this.innerHTML = '<?php echo ts('Installing CiviCRM...', ['escape' => 'js']); ?>'"><?php echo ts('Check Requirements and Install CiviCRM', ['escape' => 'js']); ?></button>
+  <input id="install_button" type="submit" name="go" value="<?php echo ts('Check Requirements and Install CiviCRM', array('escape' => 'js')); ?>" onclick="document.getElementById('saving_top').style.display = ''; this.value = '<?php echo ts('Installing CiviCRM...', array('escape' => 'js')); ?>'" />
 
   <span id="saving_top" style="display: none">
   &nbsp;
@@ -73,7 +73,7 @@ if ($text_direction == 'rtl') {
   ?>
 </select>
 <noscript>
-  <button type="submit" name="setlanguage"><?php echo ts('Change language', ['escape' => 'js']); ?></button>
+  <input type="submit" name="setlanguage" value="<?php echo ts('Change language', array('escape' => 'js')); ?>" />
 </noscript>
 <span class="testResults">
   <?php
@@ -135,7 +135,7 @@ if ($text_direction == 'rtl') {
     <span class="testResults">Check this box to pre-populate CiviCRM with sample English contact records, online contribution pages, profile forms, etc. These examples can help you learn about CiviCRM features.</span><br />
 </p>
 
-<p style="margin-left: 2em"><button type="submit"><?php echo ts('Re-check requirements', ['escape' => 'js']); ?></button></p>
+<p style="margin-left: 2em"><input type="submit" value="<?php echo ts('Re-check requirements', array('escape' => 'js')); ?>" /></p>
 
 <a name="dbDetails">
 
index 056c11cfe05919fe5c5181c052e0adb470aaaeaf..88acc9ef4d4055e3916a1692940045f5f7a3dd75 100644 (file)
@@ -145,6 +145,32 @@ function showHideByValue(trigger_field_id, trigger_value, target_element_id, tar
 }
 
 var submitcount = 0;
+/**
+ * Old submit-once function. Will be removed soon.
+ * @deprecated
+ */
+function submitOnce(obj, formId, procText) {
+  // if named button clicked, change text
+  if (obj.value != null) {
+    cj('input[name=' + obj.name + ']').val(procText + " ...");
+  }
+  cj(obj).closest('form').attr('data-warn-changes', 'false');
+  if (document.getElementById) { // disable submit button for newer browsers
+    cj('input[name=' + obj.name + ']').attr("disabled", true);
+    document.getElementById(formId).submit();
+    return true;
+  }
+  else { // for older browsers
+    if (submitcount == 0) {
+      submitcount++;
+      return true;
+    }
+    else {
+      alert("Your request is currently being processed ... Please wait.");
+      return false;
+    }
+  }
+}
 
 /**
  * Function to show / hide the row in optionFields
@@ -192,7 +218,7 @@ if (!CRM.vars) CRM.vars = {};
   $.propHooks.disabled = {
     set: function (el, value, name) {
       // Sync button enabled status with wrapper css
-      if ($(el).is('.crm-button.crm-form-submit')) {
+      if ($(el).is('span.crm-button > input.crm-form-submit')) {
         $(el).parent().toggleClass('crm-button-disabled', !!value);
       }
       // Sync button enabled status with dialog button
@@ -971,7 +997,7 @@ if (!CRM.vars) CRM.vars = {};
       $('form[data-submit-once]', e.target)
         .submit(submitOnceForm)
         .on('invalid-form', submitFormInvalid);
-      $('form[data-submit-once] button[type=submit]', e.target).click(function(e) {
+      $('form[data-submit-once] input[type=submit]', e.target).click(function(e) {
         submitButton = e.target;
       });
     })
index 757ebef0633562eefce72b077e916af2d5b9f155..e65bd7b2a22c946265f100899d9b50b24a6b6a5c 100644 (file)
         var buttonContainers = '.crm-submit-buttons, .action-link',
           buttons = [],
           added = [];
-        $(buttonContainers, $el).find('.crm-form-submit, .crm-form-xbutton, a.button, button').each(function() {
+        $(buttonContainers, $el).find('input.crm-form-submit, a.button, button').each(function() {
           var $el = $(this),
             label = $el.is('input') ? $el.attr('value') : $el.text(),
             identifier = $el.attr('name') || $el.attr('href');
         $el.dialog('option', 'buttons', buttons);
       }
       // Allow a button to prevent ajax submit
-      $('input[data-no-ajax-submit=true], button[data-no-ajax-submit=true]').click(function() {
+      $('input[data-no-ajax-submit=true]').click(function() {
         $(this).closest('form').ajaxFormUnbind();
       });
       // For convenience, focus the first field
index c84d0f5ec292a549a3378a97b82a656f801b288f..42a371dcecf42d18e90d97dae3038d2992d098b7 100644 (file)
       // When selecting a task
       .on('change', 'select#task', function(e) {
         var $form = $(this).closest('form'),
-        $go = $('button.crm-search-go-button', $form);
+        $go = $('input.crm-search-go-button', $form);
         var $selectedOption = $(this).find(':selected');
         if (!$selectedOption.val()) {
           // do not blank refresh the empty option.
index 00c65260ec2fea76b26dac96fd512500c35c7316..4191285449bac84b76339fa5c142b87c4a65ae9d 100644 (file)
         html += '<form class="widget-settings">';
         html += '  <div class="widget-settings-inner"></div>';
         html += '  <div class="widget-settings-buttons">';
-        html += '    <button id="' + widget.id + '-settings-save" class="widget-settings-save" type="submit">Save</button>';
-        html += '    <button id="' + widget.id + '-settings-cancel" class="widget-settings-cancel" type="submit">Cancel</button>';
+        html += '    <input id="' + widget.id + '-settings-save" class="widget-settings-save" value="Save" type="submit" />';
+        html += '    <input id="' + widget.id + '-settings-cancel" class="widget-settings-cancel" value="Cancel" type="submit" />';
         html += '  </div>';
         html += '</form>';
         return html;
index abfc0392604922e9ef9663e0eed42870d09358e0..971d22c1fd5a3fcdc59c00878e969ed806ef1831 100644 (file)
@@ -26,7 +26,7 @@ endif; ?>
           <div>
 
           <input type="text" name="civisetup[advanced][db]" value="<?php echo htmlentities($model->extras['advanced']['db']); ?>" data-original="<?php echo htmlentities($model->extras['advanced']['db']); ?>">
-          <button id="db_apply_button" type="submit" name="civisetup[action][Start]"><?php echo htmlentities(ts('Apply')); ?></button>
+          <input id="db_apply_button" type="submit" name="civisetup[action][Start]" value="<?php echo htmlentities(ts('Apply')); ?>" />
           <a href="" onclick="civisetupAdvancedDbCancel(); return false;" title="<?php echo htmlentities(ts('Cancel')) ?>"><i class="fa fa-close"></i></a>
           <script type="text/javascript">
             function civisetupAdvancedDbCancel() {
index 7785ad2aae5edcf593d9ca3ab9d6afab93dd1e98..81e005f1ab7b5ed4a3f3e5a9f1d48a5de119f0db 100644 (file)
@@ -1,8 +1,9 @@
 <?php if (!defined('CIVI_SETUP')): exit("Installation plugins must only be loaded by the installer.\n");
 endif; ?>
 <div class="action-box">
-  <button id="install_button" type="submit" name="civisetup[action][Install]"
-         onclick="document.getElementById('saving_top').style.display = ''; this.innerHTML = '<?php echo ts('Installing CiviCRM...', array('escape' => 'js')); ?>'"><?php echo htmlentities(ts('Install CiviCRM')); ?></button>
+  <input id="install_button" type="submit" name="civisetup[action][Install]"
+         value="<?php echo htmlentities(ts('Install CiviCRM')); ?>"
+         onclick="document.getElementById('saving_top').style.display = ''; this.value = '<?php echo ts('Installing CiviCRM...', array('escape' => 'js')); ?>'"/>
   <div id="saving_top" style="display: none;">
 &nbsp;   <img src="<?php echo htmlentities($installURLPath . "network-save.gif") ?>"/>
     <?php echo ts('(this will take a few minutes)'); ?>
index 844406249be3738a066b0274459a3d093f72a38d..54979fdf3c87564e3a7846f897450c23e0da9f8d 100644 (file)
@@ -46,7 +46,7 @@ uasort($msgs, function($a, $b) {
 </table>
 
 <div class="action-box">
-  <button id="recheck_button" type="submit" name="civisetup[action][Start]"><?php echo htmlentities(ts('Refresh')); ?></button>
+  <input id="recheck_button" type="submit" name="civisetup[action][Start]" value="<?php echo htmlentities(ts('Refresh')); ?>" />
   <div class="advancedTip">
     <?php echo ts('After updating your system, refresh to test the requirements again.'); ?>
   </div>
index a06f97a2b8441da00e16b87bbee719076768517c..5a2b3ea1060896e84c97e6e4337fa3f7852e78b8 100644 (file)
@@ -15,7 +15,7 @@ body {
   float: left;
   margin-left: 10%;
   margin-top: 50px;
-  margin-right: 20%;
+  margin-right: 20%; 
   display: inline-flex;
 }
 
@@ -39,7 +39,7 @@ body {
     100% { left: 0; color: #555;}
 }
 
-
+  
 .civicrm-setup-header hr{
   border-bottom: 2px solid #fff;
   border-top: 2px solid #ddd;
@@ -217,7 +217,7 @@ body {
   text-align: center;
   margin: 2em 0.5em;
 }
-.civicrm-setup-body button[type=submit] {
+.civicrm-setup-body input[type=submit] {
   padding:15px 25px;
   background:#82C459;
   color: white;
@@ -227,10 +227,10 @@ body {
   border-radius: 5px;
   font-size: 20px;
 }
-.civicrm-setup-body button[type=submit]:hover {
+.civicrm-setup-body input[type=submit]:hover {
   background: #60A237;
 }
-.civicrm-setup-body button[type=submit]:disabled {
+.civicrm-setup-body input[type=submit]:disabled {
   background: #888;
   cursor: not-allowed;
 }
@@ -267,3 +267,4 @@ body {
     width: 95%;
   }
 }
+
index 022929552816a5cb5f39bc6f265ee7f456a60916..c7e685f9fff8ffc7720dfcaf122ee5c375c13a66 100644 (file)
@@ -247,7 +247,7 @@ class SetupController implements SetupControllerInterface {
    *
    * @param array $fields
    *   HTTP inputs -- e.g. with a form element like this:
-   *   `<button type="submit" name="civisetup[action][Foo]">Do the foo</button>`
+   *   `<input type="submit" name="civisetup[action][Foo]" value="Do the foo">`
    * @param string $default
    *   The action-name to return if no other action is identified.
    * @return string
index fe070257596b914d2bc76367b9bb8936849f5088..44ff0ba7aabb548929087fe8bd7763ed6f52833f 100644 (file)
       <td>
         {$form.editor_id.html}
         &nbsp;
-        {$form.ckeditor_config.html}
+        <span class="crm-button" style="display:inline-block;vertical-align:middle;float:none!important;">
+          <i class="crm-i fa-wrench" aria-hidden="true"></i>
+          {$form.ckeditor_config.html}
+        </span>
       </td>
     </tr>
     <tr class="crm-preferences-display-form-block-ajaxPopupsEnabled">
index 2be5f1f3c4abce9ce90fbf526556149db4d08d75..9c127fcb6fca890238e62db6f5eae51953bad866 100644 (file)
         </table>
       </div>
       <div class="crm-submit-buttons">
-        <button type="submit" class="crm-button crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}">
-          <i class="crm-i fa-bolt" aria-hidden="true"></i> {ts}Execute{/ts}
-        </button>
+        <span class="crm-button">
+          <i class="crm-i fa-bolt" aria-hidden="true"></i> <input type="submit" value="{ts}Execute{/ts}" class="crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}"/>
+        </span>
       </div>
 
 <pre id="api-result" class="linenums">
index 43ca6d955655c99deb11c4522a3b3cabc87f8df5..ad179df5ab7afbbfb83d2a7fbf01d69c61e41fe7 100644 (file)
     </div>
 
     <div class="crm-submit-buttons">
-      <button type="submit" name="save" class="crm-form-submit crm-button" accesskey="S">
-        <i class="crm-i fa-wrench" aria-hidden="true"></i> {ts}Save{/ts}
-      </button>
-      <button type="submit" name="revert" class="crm-form-submit crm-button" onclick="return confirm('{$revertConfirm}');">
-        <i class="crm-i fa-times" aria-hidden="true"></i> {ts}Revert to Default{/ts}
-      </button>
+      <span class="crm-button">
+        <i class="crm-i fa-wrench" aria-hidden="true"></i> <input type="submit" value="{ts}Save{/ts}" name="save" class="crm-form-submit" accesskey="S"/>
+      </span>
+      <span class="crm-button">
+        <i class="crm-i fa-times" aria-hidden="true"></i> <input type="submit" value="{ts}Revert to Default{/ts}" name="revert" class="crm-form-submit" onclick="return confirm('{$revertConfirm}');"/>
+      </span>
     </div>
     <input type="hidden" value="{$preset}" name="preset" />
   </fieldset>
index 14581e63435925bfbb9896d920435abb20720269..70c0a1c3506996113f34e5d7419882642921be83 100644 (file)
@@ -22,7 +22,9 @@
     <div class="status message status-warning">
       <i class="crm-i fa-exclamation-triangle" aria-hidden="true"></i> {ts}Total for amounts entered below does not match the expected batch total.{/ts}
     </div>
-    {$form._qf_Entry_upload_force.html}
+    <span class="crm-button crm-button_qf_Entry_upload_force-save">
+      {$form._qf_Entry_upload_force.html}
+    </span>
     <div class="clear"></div>
   {/if}
   <table class="form-layout-compressed batch-totals">
index 00bf545715ad9a8661b8d863a0d3612742197607..dd4f36735a8e47ad51ed7f554771fb8af5bb4c59 100644 (file)
@@ -45,7 +45,7 @@
     <input type="hidden" name="qfKey" value="{crmKey name='CRM_Contact_Form_Contact' addSequence=1}" />
 </div>
 
-<div class="form-item"><button type="submit" name="_qf_Contact_next" class="crm-button crm-form-submit">{ts}Save{/ts}</button></div>
+<div class="form-item"><input type="submit" name="_qf_Contact_next" value="{ts}Save{/ts}" class="crm-form-submit" /></div>
 
 </form>
 </div>
index b076bc2f3a1f2d1c6d63a980f9e7c9474194b988..4f85ad1ba25851cd7e47f25331c056127eff04ae 100644 (file)
@@ -24,7 +24,7 @@
 <div class="block-crm crm-container">
     <form method="post" id="id_fulltext_search">
     <div style="margin-bottom: 8px;">
-    <input type="text" name="text" id='text' value="" class="crm-form-text" style="width: 10em;" />&nbsp;<button type="submit" name="submit" id="fulltext_submit" class="crm-button crm-form-submit" onclick='submitForm();'>{ts}Go{/ts}</button>
+    <input type="text" name="text" id='text' value="" class="crm-form-text" style="width: 10em;" />&nbsp;<input type="submit" name="submit" id="fulltext_submit" value="{ts}Go{/ts}" class="crm-form-submit"/ onclick='submitForm();'>
     <input type="hidden" name="qfKey" value="{crmKey name='CRM_Contact_Controller_Search' addSequence=1}" />
   </div>
   <select class="form-select" id="fulltext_table" name="fulltext_table">
index 2844d09e35a4d6fff615ab8af8534c0dd86eb6d5..2acbff7dccbd4e024b3765ba06675a93dff54081 100644 (file)
           </table>
 
           {*add dupe buttons *}
-          {$form._qf_Contact_refresh_dedupe.html}
+          <span class="crm-button crm-button_qf_Contact_refresh_dedupe">
+            {$form._qf_Contact_refresh_dedupe.html}
+          </span>
           {if $isDuplicate}
             &nbsp;&nbsp;
-            {$form._qf_Contact_upload_duplicate.html}
+              <span class="crm-button crm-button_qf_Contact_upload_duplicate">
+                {$form._qf_Contact_upload_duplicate.html}
+              </span>
           {/if}
           <div class="spacer"></div>
         </div>
     loadMultiRecordFields();
 
     {/literal}{if $oldSubtypes}{literal}
-    $('button[name=_qf_Contact_upload_view], button[name=_qf_Contact_upload_new]').click(function() {
+    $('input[name=_qf_Contact_upload_view], input[name=_qf_Contact_upload_new]').click(function() {
       var submittedSubtypes = $('#contact_sub_type').val();
       var oldSubtypes = {/literal}{$oldSubtypes}{literal};
 
index 4dc3523571e949d94e59e099d407dcf72bb3e06f..fd6a984c13947535d125fd947feb8af9d727ed85 100644 (file)
       })
       // Add new field - if there's a hidden one, show it
       // Otherwise allow form to submit and fetch more from the server
-      .on('click', 'button[name^=addMore]', function() {
+      .on('click', 'input[name^=addMore]', function() {
         var table = $(this).closest('table');
         if ($('tr:hidden', table).length) {
           $('tr:hidden', table).first().show();
index 6031bf210b8f9c33b14aba9a91915cd312768b5c..1fb9798cc53f151a7e20d59f9a8f33be5df50c36 100644 (file)
@@ -19,7 +19,7 @@
 {/literal}
 <form action="{crmURL p='civicrm/contact/view' q="cid=`$contactId`&reset=1"}" method="post" id="Print1" >
   <div class="form-item">
-       <span class="element-right"><button onclick="window.print(); return false" class="crm-button crm-form-submit default" name="_qf_Print_next" type="submit">{ts}Print{/ts}</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button class="crm-button crm-form-submit" name="_qf_Print_back" type="submit">{ts}Done{/ts}</button></span>
+       <span class="element-right"><input onclick="window.print(); return false" class="crm-form-submit default" name="_qf_Print_next" value="{ts}Print{/ts}" type="submit" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="crm-form-submit" name="_qf_Print_back" value="{ts}Done{/ts}" type="submit" /></span>
   </div>
 </form>
 <br />
index 5a3bd098639cbdae1bbf529889be7cfb22b0570c..6ca766cc26b31a2dbd8d4009d9d201ecc68647fd 100644 (file)
@@ -62,7 +62,7 @@
               <div class="premium-full-title">{$row.name}</div>
               <div class="premium-full-disabled">
                 {ts 1=$row.min_contribution|crmMoney}You must contribute at least %1 to get this item{/ts}<br/>
-                <button type="button" value="{ts 1=$row.min_contribution|crmMoney}Contribute %1 Instead{/ts}" amount="{$row.min_contribution}" />
+                <input type="button" value="{ts 1=$row.min_contribution|crmMoney}Contribute %1 Instead{/ts}" amount="{$row.min_contribution}" />
               </div>
               <div class="premium-full-description">
                 {$row.description}
         amounts.sort(function(a,b){return a - b});
 
         // make contribution instead buttons work
-        $('.premium-full-disabled button').click(function(){
+        $('.premium-full-disabled input').click(function(){
           var amount = Number($(this).attr('amount'));
           if (price_sets[amount]) {
             if (!$(price_sets[amount]).length) {
     {/literal}
   {/if}
 {/if}
+
index 10a830c1267b43a6c4265a1d74907bd71abb5eb9..f8bb2088f5064eb060a201e25cafe51ce1317bf6 100644 (file)
@@ -20,7 +20,9 @@
         {foreach from=$paymentFields item=paymentField}
           {assign var='name' value=$form.$paymentField.name}
           <div class="crm-section {$form.$paymentField.name}-section">
-            <div class="label">{$form.$paymentField.label}</div>
+            <div class="label">{$form.$paymentField.label}
+              {if $requiredPaymentFields.$name}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>{/if}
+            </div>
             <div class="content">
                 {$form.$paymentField.html}
               {if $paymentFieldsMetadata.$name.description}
@@ -49,7 +51,9 @@
         {foreach from=$billingDetailsFields item=billingField}
           {assign var='name' value=$form.$billingField.name}
           <div class="crm-section {$form.$billingField.name}-section">
-            <div class="label">{$form.$billingField.label}</div>
+            <div class="label">{$form.$billingField.label}
+              {if $requiredPaymentFields.$name}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>{/if}
+            </div>
             {if $form.$billingField.type == 'text'}
               <div class="content">{$form.$billingField.html}</div>
             {else}
index 27c4cdb59b21a20a2da34f076a9fc478639a1a34..4858e9803259849346fd504d596704290e30d18a 100644 (file)
@@ -396,7 +396,7 @@ invert              = 0
 <script type="text/javascript">
 {literal}    (function($, _) { // Generic Closure
 
-    $(".crm-submit-buttons button").click( function() {
+    $(".crm-submit-buttons input").click( function() {
       $(".dedupenotify .ui-notify-close").click();
     });
 
index e54646eaf4cffdb47e7d1c2a344ecdf47202ea78..4636f96d5e1217fa3cbdff9fec5afa6e359c11ea 100644 (file)
@@ -56,7 +56,7 @@
   <script type="text/javascript">
     var totalPages = {/literal}{$pager->_totalPages}{literal};
     CRM.$(function($) {
-      $("#crm-container .crm-pager button.crm-form-submit").click(function () {
+      $("#crm-container .crm-pager input.crm-form-submit").click(function () {
         submitPagerData(this);
       });
     });
index 98c0f9f3be0027be61e50c5380b36bc448508eef..47b413d078af6abc0ca1c9be8b891d9131b45b19 100644 (file)
@@ -18,9 +18,9 @@
 {ts 1=$display_name 2=$email}Are you sure you want to resubscribe: %1 (%2){/ts}
 <br/>
 <center>
-<button type="submit" name="_qf_resubscribe_next" class="crm-button crm-form-submit">{ts}Resubscribe{/ts}</button>
+<input type="submit" name="_qf_resubscribe_next" value="{ts}Resubscribe{/ts}" class="crm-form-submit" />
 &nbsp;&nbsp;&nbsp;
-<button type="submit" name="_qf_resubscribe_cancel" class="crm-button crm-form-submit">{ts}Cancel{/ts}</button>
+<input type="submit" name="_qf_resubscribe_cancel" value="{ts}Cancel{/ts}" class="crm-form-submit" />
 </center>
 </form>
 </div>
index 09ed9986ddd17fa09caafedfecccf6ecf7c949f1..2d0240fb886bb3f1ad93a97671dc7f714daa73a0 100644 (file)
@@ -19,7 +19,7 @@
   </div>
 
   <div class="crm-submit-buttons">
-    {$form._qf_Edit_upload_delete.html}
+    <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
     {if $includeCancelButton}
       <a class="button cancel" href="{$cancelURL}">{$cancelButtonText}</a>
     {/if}
@@ -37,7 +37,7 @@
 
   {if $isDuplicate and ( ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192) ) }
     <div class="crm-submit-buttons">
-      {$form._qf_Edit_upload_duplicate.html}
+      <span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>
     </div>
   {/if}
   {if $mode eq 1 || $activeComponent neq "CiviCRM"}
@@ -53,7 +53,7 @@
     {if $action eq 2 and $multiRecordFieldListing}
       <h1>{ts}Edit Details{/ts}</h1>
       <div class="crm-submit-buttons" style='float:right'>
-      {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
+      {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
       </div>
     {/if}
 
         </div>
       {/if}
       <div class="crm-submit-buttons" style='{$floatStyle}'>
-        {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
+        {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
         {if $includeCancelButton}
           <a class="button cancel" href="{$cancelURL}">
             <span>
index 33eedecb86a40cc9cf2e661392757cc0d1d7d948..508d39ca48f2c28866424d515f99f74a548e9360 100644 (file)
@@ -35,7 +35,6 @@
            createChart( chartID, divName, chartValues.size.xSize, chartValues.size.ySize, allData[chartID].object );
          });
 
-         // FIXME
          $("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){
            // image creator php file path and append image name
            var url = CRM.url('civicrm/report/chart', 'name=' + '{/literal}{$chartId}{literal}' + '.png');
index ba514b81268fb2719b1485a598b685f1240a61c7..e816f0baacd46b33bf5416e39fe6661d2a29a22a 100644 (file)
@@ -23,7 +23,7 @@ CRM.$(function($) {
           params.autoClose = params.openInline = params.cancelButton = params.refreshAction = false;
           ui.panel.on('crmFormLoad', function() {
             // Hack: "Save and done" and "Cancel" buttons submit without ajax
-            $('.cancel.crm-form-submit, button[name$=upload_done]', this).on('click', function(e) {
+            $('.cancel.crm-form-submit, input[name$=upload_done]', this).on('click', function(e) {
               $(this).closest('form').ajaxFormUnbind();
             });
           });
index 40e53f26e16546163fcdcc0d27cdabff9ff25bfa..e36756840f303d7376316605949676bce6223e1f 100644 (file)
@@ -70,10 +70,10 @@ if (!defined('CIVICRM_UF')) {
  * If any of these contain a single quote or backslash, escape those characters with a backslash: \' and \\, respectively.
  *
  * Datasource (DSN) format:
- *      define( 'CIVICRM_UF_DSN', 'mysqli://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
+ *      define( 'CIVICRM_UF_DSN', 'mysql://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
  */
 if (!defined('CIVICRM_UF_DSN') && CIVICRM_UF !== 'UnitTests') {
-  define( 'CIVICRM_UF_DSN'           , 'mysqli://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true');
+  define( 'CIVICRM_UF_DSN'           , 'mysql://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true');
 }
 
 // %%extraSettings%%
@@ -83,19 +83,19 @@ if (!defined('CIVICRM_UF_DSN') && CIVICRM_UF !== 'UnitTests') {
  *
  * Database URL (CIVICRM_DSN) for CiviCRM Data:
  * Database URL format:
- *      define( 'CIVICRM_DSN', 'mysqli://crm_db_username:crm_db_password@db_server/crm_database?new_link=true');
+ *      define( 'CIVICRM_DSN', 'mysql://crm_db_username:crm_db_password@db_server/crm_database?new_link=true');
  *
  * Drupal and CiviCRM can share the same database, or can be installed into separate databases.
  * Backdrop CMS and CiviCRM can also share the same database, or can be installed into separate databases.
  *
  * EXAMPLE: Drupal/Backdrop and CiviCRM running in the same database...
  *      DB Name = cms, DB User = cms
- *      define( 'CIVICRM_DSN'         , 'mysqli://cms:YOUR_PASSWORD@localhost/cms?new_link=true');
+ *      define( 'CIVICRM_DSN'         , 'mysql://cms:YOUR_PASSWORD@localhost/cms?new_link=true');
  *
  * EXAMPLE: Drupal/Backdrop and CiviCRM running in separate databases...
  *      CMS DB Name = cms, DB User = cms
  *      CiviCRM DB Name = civicrm, CiviCRM DB User = civicrm
- *      define( 'CIVICRM_DSN'         , 'mysqli://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true');
+ *      define( 'CIVICRM_DSN'         , 'mysql://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true');
  *
  * If your username, password, server or DB name contain a single quote or backslash, escape those characters
  * with a backslash: \' and \\, respectively.
@@ -106,7 +106,7 @@ if (!defined('CIVICRM_DSN')) {
     define('CIVICRM_DSN', $GLOBALS['_CV']['TEST_DB_DSN']);
   }
   else {
-    define('CIVICRM_DSN', 'mysqli://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
+    define('CIVICRM_DSN', 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
   }
 }
 
index 10c9628b2dbd36daa610a2d3ccbeb3dad50e1489..0b8f6645c1582466ab42b5ab0aed32f79a74afbd 100644 (file)
@@ -12,7 +12,7 @@
 {literal}
 <script type="text/javascript">
 CRM.$(function($) {
-  var more = $('.crm-button.validate').click(function(e) {
+  var more = $('.crm-button input.validate').click(function(e) {
     var message = "{/literal} {if $context eq 'Event'}
         {ts escape='js'}Note: Revenue for this event registration will not be deferred as the financial type does not have a deferred revenue account setup for it. If you want the revenue to be deferred, please select a different Financial Type with a Deferred Revenue account setup for it, or setup a Deferred Revenue account for this Financial Type.{/ts}
       {else if $context eq 'MembershipType'}
index 10b848a154d29647455a041e32a09b9ffefcb170..7af01e646bec483f29db5b938c76eeeea01635b1 100644 (file)
   {/foreach}
 {/if}
 
+{* Loops through $form.buttons.html array and assigns separate spans with classes to allow theming by button and name.
+ * crmBtnType grabs type keyword from button name (e.g. 'upload', 'next', 'back', 'cancel') so types of buttons can be styled differently via css.
+ *}
 {foreach from=$form.buttons item=button key=key name=btns}
   {if $key|substring:0:4 EQ '_qf_'}
     {if $location}
-      {$form.buttons.$key.html|crmReplace:id:"$key-$location"}
+      {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"}
     {else}
-      {$form.buttons.$key.html}
+      {assign var='html' value=$form.buttons.$key.html}
     {/if}
+    {crmGetAttribute html=$html attr='crm-icon' assign='icon'}
+    {capture assign=iconPrefix}{$icon|truncate:3:"":true}{/capture}
+    {if $icon && $iconPrefix eq 'fa-'}
+      {capture assign=iconDisp}<i class="crm-i {$icon}" aria-hidden="true"></i>{/capture}
+    {/if}
+    {crmGetAttribute html=$html attr='disabled' assign='disabled'}
+    <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}{if $disabled} crm-button-disabled{/if}"{if $buttonStyle} style="{$buttonStyle}"{/if}>
+      {$iconDisp}
+      {$html}
+    </span>
   {/if}
 {/foreach}
 {/crmRegion}
index 5ec824a85e46250e75f26587a78cf8def7fabcc7..866769185c51e2d61c862b3577e5ac1490019480 100644 (file)
@@ -17,7 +17,7 @@
             <input type="hidden" name="hidden_location" value="1" />
             <input type="hidden" name="hidden_custom" value="1" />
             <input type="hidden" name="qfKey" value="" />
-            <div style="height:1px; overflow:hidden;"><button type="submit" name="_qf_Advanced_refresh" class="crm-button crm-form-submit default">{ts}Go{/ts}</button></div>
+            <div style="height:1px; overflow:hidden;"><input type="submit" value="{ts}Go{/ts}" name="_qf_Advanced_refresh" class="crm-form-submit default" /></div>
           </div>
         </form>
         <ul>
index 1a06b3df1ff778fa78ce98e4406201c9981d5dd9..b39d8fc15969d4f85c3c497d2d5388050023e5f3 100644 (file)
@@ -1462,7 +1462,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     $this->assertEquals("Contribution Amount: $ 100.00", $contributionDetails[$contactId1]['text'], "The text does not match");
     $this->assertEquals("<p>Contribution Source: ABC</p></br>
       <p>Contribution Invoice ID: 12345</p></br>
-      <p>Contribution Receive Date: May 11th, 2015</p></br>
+      <p>Contribution Receive Date: May 11th, 2015 12:00 AM</p></br>
       <p>Contribution Custom Field: Label2</p></br>", $contributionDetails[$contactId2]['html'], "The html does not match");
   }
 
index bb5e440731bf5b0c9cd2048e7dbbce6b373aa5b0..12647109169d263aa3767d5f76c410197c228f2b 100644 (file)
@@ -1721,4 +1721,32 @@ Price Field - Price Field 1        1   $ 100.00      $ 100.00
     unset($_REQUEST['id']);
   }
 
+  /**
+   * Mostly just check there's no errors opening the Widget tab on contribution
+   * pages.
+   */
+  public function testOpeningWidgetAdminPage() {
+    $page_id = $this->callAPISuccess('ContributionPage', 'create', [
+      'title' => 'my page',
+      'financial_type_id' => $this->_financialTypeId,
+      'payment_processor' => $this->paymentProcessorID,
+    ])['id'];
+
+    $form = new CRM_Contribute_Form_ContributionPage_Widget();
+    $form->controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_ContributionPage_Widget', 'Widget');
+
+    $form->set('reset', '1');
+    $form->set('action', 'update');
+    $form->set('id', $page_id);
+
+    ob_start();
+    $form->controller->_actions['display']->perform($form, 'display');
+    $contents = ob_get_contents();
+    ob_end_clean();
+
+    // The page contents load later by ajax, so there's just the surrounding
+    // html available now, but we can check at least one thing while we're here.
+    $this->assertStringContainsString("selectedTab = 'widget';", $contents);
+  }
+
 }
index ea82bf58ebae43874d3b698f8e926f7af5313b4c..5bd1292a5665c87392ff70f8772f1dec8930f44f 100644 (file)
@@ -45,7 +45,6 @@ trait CRMTraits_Financial_OrderTrait {
     $orderID = $this->callAPISuccess('Order', 'create', [
       'total_amount' => '200',
       'financial_type_id' => 'Donation',
-      'contribution_status_id' => 'Pending',
       'contact_id' => $this->_contactID,
       'contribution_page_id' => $this->_contributionPageID,
       'payment_processor_id' => $this->_paymentProcessorID,
@@ -89,6 +88,80 @@ trait CRMTraits_Financial_OrderTrait {
     $this->ids['Contribution'][0] = $orderID;
   }
 
+  /**
+   * Create an order with more than one membership.
+   *
+   * @throws \CRM_Core_Exception
+   */
+  protected function createMultipleMembershipOrder() {
+    $this->createExtraneousContribution();
+    $this->ids['contact'][0] = $this->individualCreate();
+    $this->ids['contact'][1] = $this->individualCreate();
+    $this->ids['membership_type'][0] = $this->membershipTypeCreate();
+    $this->ids['membership_type'][1] = $this->membershipTypeCreate(['name' => 'Type 2']);
+    $priceFieldID = $this->callAPISuccessGetValue('price_field', [
+      'return' => 'id',
+      'label' => 'Membership Amount',
+      'options' => ['limit' => 1, 'sort' => 'id DESC'],
+    ]);
+    $generalPriceFieldValueID = $this->callAPISuccessGetValue('price_field_value', [
+      'return' => 'id',
+      'label' => 'General',
+      'options' => ['limit' => 1, 'sort' => 'id DESC'],
+    ]);
+
+    $orderID = $this->callAPISuccess('Order', 'create', [
+      'total_amount' => 400,
+      'financial_type_id' => 'Member Dues',
+      'contact_id' => $this->_contactID,
+      'is_test' => 0,
+      'payment_instrument_id' => 'Check',
+      'receive_date' => '2019-07-25 07:34:23',
+      'line_items' => [
+        [
+          'params' => [
+            'contact_id' => $this->ids['contact'][0],
+            'membership_type_id' => $this->ids['membership_type'][0],
+            'source' => 'Payment',
+          ],
+          'line_item' => [
+            [
+              'label' => 'General',
+              'qty' => 1,
+              'unit_price' => 200,
+              'line_total' => 200,
+              'financial_type_id' => 1,
+              'entity_table' => 'civicrm_membership',
+              'price_field_id' => $priceFieldID,
+              'price_field_value_id' => $generalPriceFieldValueID,
+            ],
+          ],
+        ],
+        [
+          'params' => [
+            'contact_id' => $this->ids['contact'][1],
+            'membership_type_id' => $this->ids['membership_type'][0],
+            'source' => 'Payment',
+          ],
+          'line_item' => [
+            [
+              'label' => 'General',
+              'qty' => 1,
+              'unit_price' => 200,
+              'line_total' => 200,
+              'financial_type_id' => 1,
+              'entity_table' => 'civicrm_membership',
+              'price_field_id' => $priceFieldID,
+              'price_field_value_id' => $generalPriceFieldValueID,
+            ],
+          ],
+        ],
+      ],
+    ])['id'];
+
+    $this->ids['Contribution'][0] = $orderID;
+  }
+
   /**
    * Create an extraneous contribution to throw off any 'number one bugs'.
    *
index bd956ebf6dfa554e050149d30f09f2c19139292d..7e03eee9a3e57dce63e529d1f3d84da0df2d2cba 100644 (file)
@@ -21,7 +21,9 @@
  * @group headless
  */
 class api_v3_MembershipTest extends CiviUnitTestCase {
-  protected $_apiversion;
+
+  use CRMTraits_Financial_OrderTrait;
+
   protected $_contactID;
   protected $_membershipID;
   protected $_membershipID2;
@@ -37,7 +39,6 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
    */
   public function setUp() {
     parent::setUp();
-    $this->_apiversion = 3;
     $this->_contactID = $this->individualCreate();
     $this->_membershipTypeID = $this->membershipTypeCreate(['member_of_contact_id' => $this->_contactID]);
     $this->_membershipTypeID2 = $this->membershipTypeCreate([
@@ -1006,7 +1007,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
    * @throws \Exception
    */
   public function hook_civicrm_pre_update_create_membership($op, $objectName, $id, &$params) {
-    if ($objectName == 'Membership' && $op == 'edit') {
+    if ($objectName === 'Membership' && $op === 'edit') {
       $existingMembership = $this->callAPISuccessGetSingle('membership', ['id' => $params['id']]);
       unset($params['id'], $params['membership_id']);
       $params['join_date'] = $params['membership_start_date'] = $params['start_date'] = date('Ymd000000', strtotime($existingMembership['start_date']));
@@ -1528,6 +1529,22 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
 
   }
 
+  /**
+   * Test that a contribution linked to multiple memberships results in all being updated.
+   *
+   * @throws \CRM_Core_Exception
+   */
+  public function testMultipleMembershipContribution() {
+    $this->createMultipleMembershipOrder();
+    $this->callAPISuccess('Payment', 'create', [
+      'contribution_id' => $this->ids['Contribution'][0],
+      'payment_instrument_id' => 'Check',
+      'total_amount' => 400,
+    ]);
+    $memberships = $this->callAPISuccess('membership', 'get')['values'];
+    $this->assertCount(2, $memberships);
+  }
+
   /**
    * Test that all membership types are returned when getoptions is called.
    *
index 775e0982c451d43db05c5355dbec9455b126fef0..d20a639b6f167a1268d1f91f41b0db94ed0a3bf5 100644 (file)
@@ -15,7 +15,6 @@
  */
 class api_v3_MembershipTypeTest extends CiviUnitTestCase {
   protected $_contactID;
-  protected $_contributionTypeID;
   protected $_entity = 'MembershipType';
 
   /**
@@ -31,7 +30,12 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
    * Get the membership without providing an ID.
    *
    * This should return an empty array but not an error.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
+   *
+   * @throws \CRM_Core_Exception
    */
   public function testGetWithoutId($version) {
     $this->_apiversion = $version;
@@ -51,15 +55,15 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   /**
    * Test get works.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
    */
   public function testGet($version) {
     $this->_apiversion = $version;
     $id = $this->membershipTypeCreate(['member_of_contact_id' => $this->_contactID]);
-
-    $params = [
-      'id' => $id,
-    ];
+    $params = ['id' => $id];
     $membershipType = $this->callAPIAndDocument('membership_type', 'get', $params, __FUNCTION__, __FILE__);
     $this->assertEquals($membershipType['values'][$id]['name'], 'General');
     $this->assertEquals($membershipType['values'][$id]['member_of_contact_id'], $this->_contactID);
@@ -72,7 +76,10 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   /**
    * Test create with missing mandatory field.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
    */
   public function testCreateWithoutMemberOfContactId($version) {
     $this->_apiversion = $version;
@@ -94,7 +101,10 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   /**
    * Test successful create.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
    */
   public function testCreate($version) {
     $this->_apiversion = $version;
@@ -119,7 +129,12 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
   /**
    * Domain ID can be intuited..
    * DomainID is now optional on API, check that it gets set correctly and that the domain_id is not overwritten when not specified in create.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
+   *
+   * @throws \CRM_Core_Exception
    */
   public function testCreateWithoutDomainId($version) {
     $this->_apiversion = $version;
@@ -151,24 +166,32 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   /**
    *  CRM-20010 Tests period_type is required for MemberType create
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
    */
   public function testMemberTypePeriodiTypeRequired($version) {
     $this->_apiversion = $version;
     $this->callAPIFailure('MembershipType', 'create', [
-      'domain_id' => "Default Domain Name",
+      'domain_id' => 'Default Domain Name',
       'member_of_contact_id' => 1,
-      'financial_type_id' => "Member Dues",
-      'duration_unit' => "month",
+      'financial_type_id' => 'Member Dues',
+      'duration_unit' => 'month',
       'duration_interval' => 1,
-      'name' => "Standard Member",
+      'name' => 'Standard Member',
       'minimum_fee' => 100,
     ]);
   }
 
   /**
    * Test update.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
+   *
+   * @throws \CRM_Core_Exception
    */
   public function testUpdate($version) {
     $this->_apiversion = $version;
@@ -196,15 +219,15 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   /**
    * Test successful delete.
+   *
    * @dataProvider versionThreeAndFour
+   *
+   * @param bool $version
    */
   public function testDelete($version) {
     $this->_apiversion = $version;
     $membershipTypeID = $this->membershipTypeCreate(['member_of_contact_id' => $this->organizationCreate()]);
-    $params = [
-      'id' => $membershipTypeID,
-    ];
-
+    $params = ['id' => $membershipTypeID];
     $this->callAPIAndDocument('membership_type', 'delete', $params, __FUNCTION__, __FILE__);
   }
 
@@ -269,11 +292,11 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
     $memType = [];
     $memType[1] = $this->membershipTypeCreate(['member_of_contact_id' => $this->_contactID, 'minimum_fee' => 100]);
     $priceSet = $this->callAPISuccess('price_set', 'create', [
-      'title' => "test priceset",
-      'name' => "test_priceset",
-      'extends' => "CiviMember",
+      'title' => 'test priceset',
+      'name' => 'test_priceset',
+      'extends' => 'CiviMember',
       'is_quick_config' => 1,
-      'financial_type_id' => "Member Dues",
+      'financial_type_id' => 'Member Dues',
     ]);
     $priceSet = $priceSet['id'];
     $field = $this->callAPISuccess('price_field', 'create', [
@@ -327,7 +350,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
     ]);
     //Verify if membership type updates are copied to pricefield value.
     foreach ($priceFieldValue['values'] as $key => $value) {
-      $setId = $this->callAPISuccessGetValue('PriceField', ['return' => "price_set_id", 'id' => $value['price_field_id']]);
+      $setId = $this->callAPISuccessGetValue('PriceField', ['return' => 'price_set_id', 'id' => $value['price_field_id']]);
       if ($setId == $priceSet) {
         $this->assertEquals($value['label'], $updateParams['name']);
         $this->assertEquals($value['description'], $updateParams['description']);
index d2fc418cd4894b8b3cd235b2dc72907d27e26ea9..340d7040d53e5479ddd5af147ab8566559b1a36d 100644 (file)
@@ -493,7 +493,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
 
     $this->assertEquals(2, $rows['count'], 'Report failed - the sql used to generate the results was ' . print_r($rows['metadata']['sql'], TRUE));
 
-    $expected = preg_replace('/\s+/', ' ', 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AS
+    $expected = preg_replace('/\s+/', ' ', 'COLLATE utf8_unicode_ci AS
       SELECT SQL_CALC_FOUND_ROWS contact_civireport.id as cid  FROM civicrm_contact contact_civireport    INNER JOIN civicrm_contribution contribution_civireport USE index (received_date) ON contribution_civireport.contact_id = contact_civireport.id
          AND contribution_civireport.is_test = 0
          AND contribution_civireport.receive_date BETWEEN \'20140701000000\' AND \'20150630235959\'