Merge pull request #14082 from pradpnayak/caseReport
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 25 May 2019 06:05:49 +0000 (18:05 +1200)
committerGitHub <noreply@github.com>
Sat, 25 May 2019 06:05:49 +0000 (18:05 +1200)
dev/core/issues/743, Donot join relationship table when not required

509 files changed:
CRM/ACL/DAO/ACL.php
CRM/ACL/DAO/Cache.php
CRM/ACL/DAO/EntityRole.php
CRM/Activity/BAO/Activity.php
CRM/Activity/BAO/ICalendar.php
CRM/Activity/DAO/Activity.php
CRM/Activity/DAO/ActivityContact.php
CRM/Activity/Form/Activity.php
CRM/Activity/Form/Search.php
CRM/Activity/Form/Task/Delete.php
CRM/Activity/Form/Task/Email.php
CRM/Activity/Form/Task/SMS.php
CRM/Activity/Import/Field.php
CRM/Activity/Import/Parser.php
CRM/Activity/Selector/Activity.php
CRM/Activity/Selector/Search.php
CRM/Admin/Form/RelationshipType.php
CRM/Admin/Form/SettingTrait.php
CRM/Admin/Page/Options.php
CRM/Batch/BAO/Batch.php
CRM/Batch/DAO/Batch.php
CRM/Batch/DAO/EntityBatch.php
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/DAO/Campaign.php
CRM/Campaign/DAO/CampaignGroup.php
CRM/Campaign/DAO/Survey.php
CRM/Campaign/Form/Search.php
CRM/Campaign/Form/Search/Campaign.php
CRM/Campaign/Selector/Search.php
CRM/Case/BAO/Case.php
CRM/Case/DAO/Case.php
CRM/Case/DAO/CaseActivity.php
CRM/Case/DAO/CaseContact.php
CRM/Case/DAO/CaseType.php
CRM/Case/Form/Activity.php
CRM/Case/Form/Activity/ChangeCaseStatus.php
CRM/Case/Form/Activity/OpenCase.php
CRM/Case/Form/Search.php
CRM/Case/Form/Task/Delete.php
CRM/Case/Form/Task/Restore.php
CRM/Case/Selector/Search.php
CRM/Case/XMLProcessor/Report.php
CRM/Case/XMLRepository.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/DAO/ACLContactCache.php
CRM/Contact/DAO/Contact.php
CRM/Contact/DAO/ContactType.php
CRM/Contact/DAO/DashboardContact.php
CRM/Contact/DAO/Group.php
CRM/Contact/DAO/GroupContact.php
CRM/Contact/DAO/GroupContactCache.php
CRM/Contact/DAO/GroupNesting.php
CRM/Contact/DAO/GroupOrganization.php
CRM/Contact/DAO/Relationship.php
CRM/Contact/DAO/RelationshipType.php
CRM/Contact/DAO/SavedSearch.php
CRM/Contact/DAO/SubscriptionHistory.php
CRM/Contact/Form/DedupeRules.php
CRM/Contact/Form/Search.php
CRM/Contact/Form/Search/Custom/FullText.php
CRM/Contact/Form/Search/Custom/Group.php
CRM/Contact/Form/Task.php
CRM/Contact/Form/Task/Delete.php
CRM/Contact/Form/Task/Email.php
CRM/Contact/Form/Task/Map.php
CRM/Contact/Form/Task/SMS.php
CRM/Contact/Form/Task/SaveSearch.php
CRM/Contact/Import/Field.php
CRM/Contact/Import/ImportJob.php
CRM/Contact/Import/Parser.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Page/DedupeException.php
CRM/Contact/Page/DedupeFind.php
CRM/Contact/Page/ImageFile.php
CRM/Contact/Page/View/ContactSmartGroup.php
CRM/Contact/Page/View/Note.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/ContributionRecur.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/BAO/Widget.php
CRM/Contribute/DAO/Contribution.php
CRM/Contribute/DAO/ContributionPage.php
CRM/Contribute/DAO/ContributionProduct.php
CRM/Contribute/DAO/ContributionRecur.php
CRM/Contribute/DAO/ContributionSoft.php
CRM/Contribute/DAO/Premium.php
CRM/Contribute/DAO/PremiumsProduct.php
CRM/Contribute/DAO/Product.php
CRM/Contribute/DAO/Widget.php
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionPage.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionRecur.php
CRM/Contribute/Form/Search.php
CRM/Contribute/Form/Task.php
CRM/Contribute/Form/Task/Delete.php
CRM/Contribute/Form/Task/Email.php
CRM/Contribute/Form/Task/Invoice.php
CRM/Contribute/Form/Task/PDF.php
CRM/Contribute/Form/Task/Status.php
CRM/Contribute/Import/Field.php
CRM/Contribute/Import/Parser.php
CRM/Contribute/Selector/Search.php
CRM/Core/Action.php
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/Address.php
CRM/Core/BAO/Block.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomGroup.php
CRM/Core/BAO/CustomOption.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/BAO/CustomValueTable.php
CRM/Core/BAO/File.php
CRM/Core/BAO/Job.php
CRM/Core/BAO/Location.php
CRM/Core/BAO/Note.php
CRM/Core/BAO/OptionValue.php
CRM/Core/BAO/PrevNextCache.php
CRM/Core/BAO/Tag.php
CRM/Core/BAO/UFField.php
CRM/Core/BAO/UFGroup.php
CRM/Core/ClassLoader.php
CRM/Core/CodeGen/Main.php
CRM/Core/CodeGen/Specification.php
CRM/Core/Component/Info.php
CRM/Core/Controller.php
CRM/Core/DAO.php
CRM/Core/DAO/ActionLog.php
CRM/Core/DAO/ActionMapping.php
CRM/Core/DAO/ActionSchedule.php
CRM/Core/DAO/Address.php
CRM/Core/DAO/AddressFormat.php
CRM/Core/DAO/Cache.php
CRM/Core/DAO/Component.php
CRM/Core/DAO/Country.php
CRM/Core/DAO/County.php
CRM/Core/DAO/CustomField.php
CRM/Core/DAO/CustomGroup.php
CRM/Core/DAO/Dashboard.php
CRM/Core/DAO/Discount.php
CRM/Core/DAO/Domain.php
CRM/Core/DAO/Email.php
CRM/Core/DAO/EntityFile.php
CRM/Core/DAO/EntityTag.php
CRM/Core/DAO/Extension.php
CRM/Core/DAO/File.php
CRM/Core/DAO/IM.php
CRM/Core/DAO/Job.php
CRM/Core/DAO/JobLog.php
CRM/Core/DAO/LocBlock.php
CRM/Core/DAO/LocationType.php
CRM/Core/DAO/Log.php
CRM/Core/DAO/MailSettings.php
CRM/Core/DAO/Managed.php
CRM/Core/DAO/Mapping.php
CRM/Core/DAO/MappingField.php
CRM/Core/DAO/Menu.php
CRM/Core/DAO/MessageTemplate.php
CRM/Core/DAO/Navigation.php
CRM/Core/DAO/Note.php
CRM/Core/DAO/OpenID.php
CRM/Core/DAO/OptionGroup.php
CRM/Core/DAO/OptionValue.php
CRM/Core/DAO/Persistent.php
CRM/Core/DAO/Phone.php
CRM/Core/DAO/PreferencesDate.php
CRM/Core/DAO/PrevNextCache.php
CRM/Core/DAO/PrintLabel.php
CRM/Core/DAO/RecurringEntity.php
CRM/Core/DAO/Setting.php
CRM/Core/DAO/StateProvince.php
CRM/Core/DAO/StatusPreference.php
CRM/Core/DAO/SystemLog.php
CRM/Core/DAO/Tag.php
CRM/Core/DAO/Timezone.php
CRM/Core/DAO/UFField.php
CRM/Core/DAO/UFGroup.php
CRM/Core/DAO/UFJoin.php
CRM/Core/DAO/UFMatch.php
CRM/Core/DAO/Website.php
CRM/Core/DAO/WordReplacement.php
CRM/Core/DAO/Worldregion.php
CRM/Core/Error.php
CRM/Core/Form.php
CRM/Core/Form/EntityFormTrait.php
CRM/Core/Form/Search.php
CRM/Core/IDS.php
CRM/Core/Page.php
CRM/Core/Page/File.php
CRM/Core/Payment.php
CRM/Core/Payment/Dummy.php
CRM/Core/Payment/Elavon.php
CRM/Core/Payment/ProcessorForm.php
CRM/Core/Permission/Backdrop.php
CRM/Core/Permission/Drupal.php
CRM/Core/Permission/Drupal6.php
CRM/Core/Permission/DrupalBase.php
CRM/Core/PseudoConstant.php
CRM/Core/Region.php
CRM/Core/Resources.php
CRM/Custom/Import/Parser.php
CRM/Cxn/DAO/Cxn.php
CRM/Dedupe/DAO/Exception.php
CRM/Dedupe/DAO/Rule.php
CRM/Dedupe/DAO/RuleGroup.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Event.php
CRM/Event/Cart/DAO/Cart.php
CRM/Event/Cart/DAO/EventInCart.php
CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php
CRM/Event/Cart/Form/Checkout/Payment.php
CRM/Event/DAO/Event.php
CRM/Event/DAO/Participant.php
CRM/Event/DAO/ParticipantPayment.php
CRM/Event/DAO/ParticipantStatusType.php
CRM/Event/Form/ManageEvent.php
CRM/Event/Form/ManageEvent/Fee.php
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php
CRM/Event/Form/Search.php
CRM/Event/Form/SelfSvcUpdate.php
CRM/Event/Form/Task/Badge.php
CRM/Event/Form/Task/Delete.php
CRM/Event/Form/Task/Email.php
CRM/Event/Form/Task/PDF.php
CRM/Event/Import/Parser.php
CRM/Event/Page/ManageEvent.php
CRM/Event/Selector/Search.php
CRM/Export/BAO/Export.php
CRM/Financial/BAO/ExportFormat.php
CRM/Financial/BAO/ExportFormat/IIF.php
CRM/Financial/BAO/FinancialAccount.php
CRM/Financial/BAO/Payment.php
CRM/Financial/DAO/Currency.php
CRM/Financial/DAO/EntityFinancialAccount.php
CRM/Financial/DAO/EntityFinancialTrxn.php
CRM/Financial/DAO/FinancialAccount.php
CRM/Financial/DAO/FinancialItem.php
CRM/Financial/DAO/FinancialTrxn.php
CRM/Financial/DAO/FinancialType.php
CRM/Financial/DAO/PaymentProcessor.php
CRM/Financial/DAO/PaymentProcessorType.php
CRM/Financial/DAO/PaymentToken.php
CRM/Financial/Form/FinancialAccount.php
CRM/Financial/Form/FinancialTypeAccount.php
CRM/Financial/Form/Payment.php
CRM/Friend/DAO/Friend.php
CRM/Grant/BAO/Query.php
CRM/Grant/DAO/Grant.php
CRM/Grant/Form/Search.php
CRM/Grant/Form/Task/Delete.php
CRM/Grant/Selector/Search.php
CRM/Group/Form/Edit.php
CRM/Mailing/ActionTokens.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/MailingJob.php
CRM/Mailing/DAO/BouncePattern.php
CRM/Mailing/DAO/BounceType.php
CRM/Mailing/DAO/Mailing.php
CRM/Mailing/DAO/MailingAB.php
CRM/Mailing/DAO/MailingComponent.php
CRM/Mailing/DAO/MailingGroup.php
CRM/Mailing/DAO/MailingJob.php
CRM/Mailing/DAO/Recipients.php
CRM/Mailing/DAO/Spool.php
CRM/Mailing/DAO/TrackableURL.php
CRM/Mailing/Event/DAO/Bounce.php
CRM/Mailing/Event/DAO/Confirm.php
CRM/Mailing/Event/DAO/Delivered.php
CRM/Mailing/Event/DAO/Forward.php
CRM/Mailing/Event/DAO/Opened.php
CRM/Mailing/Event/DAO/Queue.php
CRM/Mailing/Event/DAO/Reply.php
CRM/Mailing/Event/DAO/Subscribe.php
CRM/Mailing/Event/DAO/TrackableURLOpen.php
CRM/Mailing/Event/DAO/Unsubscribe.php
CRM/Mailing/Page/Browse.php
CRM/Mailing/Page/View.php
CRM/Mailing/Selector/Search.php
CRM/Mailing/Tokens.php
CRM/Member/BAO/Membership.php
CRM/Member/DAO/Membership.php
CRM/Member/DAO/MembershipBlock.php
CRM/Member/DAO/MembershipLog.php
CRM/Member/DAO/MembershipPayment.php
CRM/Member/DAO/MembershipStatus.php
CRM/Member/DAO/MembershipType.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Form/MembershipType.php
CRM/Member/Form/Task/Delete.php
CRM/Member/Form/Task/Email.php
CRM/Member/Import/Field.php
CRM/Member/Import/Parser.php
CRM/Member/Selector/Search.php
CRM/PCP/DAO/PCP.php
CRM/PCP/DAO/PCPBlock.php
CRM/PCP/Form/PCPAccount.php
CRM/Pledge/BAO/PledgeBlock.php
CRM/Pledge/DAO/Pledge.php
CRM/Pledge/DAO/PledgeBlock.php
CRM/Pledge/DAO/PledgePayment.php
CRM/Pledge/Form/Search.php
CRM/Pledge/Form/Task/Delete.php
CRM/Pledge/Selector/Search.php
CRM/Price/BAO/PriceSet.php
CRM/Price/DAO/LineItem.php
CRM/Price/DAO/PriceField.php
CRM/Price/DAO/PriceFieldValue.php
CRM/Price/DAO/PriceSet.php
CRM/Price/DAO/PriceSetEntity.php
CRM/Price/Page/Field.php
CRM/Price/Page/Option.php
CRM/Profile/Page/Dynamic.php
CRM/Profile/Selector/Listings.php
CRM/Queue/DAO/QueueItem.php
CRM/Report/DAO/ReportInstance.php
CRM/Report/Form.php
CRM/Report/Form/Campaign/SurveyDetails.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Event/Income.php
CRM/Report/Form/Extended.php [deleted file]
CRM/Report/Utils/Get.php
CRM/SMS/DAO/Provider.php
CRM/SMS/Form/Schedule.php
CRM/SMS/Message.php
CRM/UF/Form/Field.php
CRM/UF/Form/Group.php
CRM/Upgrade/Form.php
CRM/Upgrade/Incremental/Base.php
CRM/Upgrade/Incremental/General.php
CRM/Upgrade/Incremental/php/FiveFifteen.php [new file with mode: 0644]
CRM/Upgrade/Incremental/php/FiveFourteen.php
CRM/Upgrade/Incremental/sql/5.14.beta1.mysql.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl [new file with mode: 0644]
CRM/Utils/AutoClean.php
CRM/Utils/Check/Component/Env.php
CRM/Utils/Check/Component/FinancialTypeAcls.php
CRM/Utils/File.php
CRM/Utils/Hook.php
CRM/Utils/Rule.php
CRM/Utils/SQL/TempTable.php
CRM/Utils/System.php
CRM/Utils/System/Backdrop.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal8.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/WordPress.php
Civi/API/Request.php
Civi/ActionSchedule/Mapping.php
Civi/Angular/AngularLoader.php
Civi/Angular/Manager.php
Civi/Angular/Page/Main.php
Civi/Core/AssetBuilder.php
Civi/Core/Container.php
Civi/Core/SettingsBag.php
Civi/Core/SettingsManager.php
Civi/Core/SettingsMetadata.php
Civi/Core/SqlTriggers.php
Civi/Install/Requirements.php
Civi/Test/CiviEnvBuilder.php
Civi/Test/ContactTestTrait.php
LICENSE [moved from agpl-3.0.txt with 100% similarity]
ang/crmMailingAB/WinnerDialogCtrl.js
ang/crmMailingAB/services.js
ang/crmRouteBinder.js
api/v3/Activity.php
api/v3/Generic.php
api/v3/Mailing.php
api/v3/MailingAB.php
api/v3/Payment.php
api/v3/Setting.php
api/v3/utils.php
bin/cli.class.php
bower.json
composer.json
composer.lock
contributor-key.yml
css/crm-menubar.css
css/joomla.css
css/menubar-backdrop.css
css/menubar-drupal7.css
css/menubar-drupal8.css
css/menubar-joomla.css
css/menubar-wordpress.css
extern/ipn.php
extern/rest.php
install/index.php
js/crm.joomla.js [deleted file]
js/crm.menubar.js
js/crm.wordpress.js
js/model/crm.designer.js
release-notes.md
release-notes/5.12.2.md [new file with mode: 0644]
release-notes/5.12.3.md [new file with mode: 0644]
release-notes/5.12.4.md [new file with mode: 0644]
release-notes/5.13.0.md [new file with mode: 0644]
release-notes/5.13.1.md [new file with mode: 0644]
release-notes/5.13.2.md [new file with mode: 0644]
release-notes/5.13.3.md [new file with mode: 0644]
release-notes/5.13.4.md [new file with mode: 0644]
settings/Core.setting.php
sql/civicrm_generated.mysql
templates/CRM/Activity/Form/Search/Common.tpl
templates/CRM/Admin/Page/Access.tpl
templates/CRM/Campaign/Form/Search/Campaign.tpl
templates/CRM/Contact/Page/DedupeFind.tpl
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Contribute/Form/ContributionPage/Amount.tpl
templates/CRM/Core/DatePickerRangeWrapper.tpl [new file with mode: 0644]
templates/CRM/Event/Cart/Form/Checkout/Payment.tpl
templates/CRM/common/batchCopy.tpl
templates/CRM/common/formButtons.tpl
tests/phpunit/CRM/Activity/BAO/ActivityTest.php
tests/phpunit/CRM/Batch/Form/EntryTest.php
tests/phpunit/CRM/Case/BAO/CaseTest.php
tests/phpunit/CRM/Contact/BAO/QueryTest.php
tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php
tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTestDataProvider.php
tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTest.php
tests/phpunit/CRM/Contact/Form/Search/Custom/SampleTestDataProvider.php
tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
tests/phpunit/CRM/Contact/Page/DedupeExceptionTest.php [new file with mode: 0644]
tests/phpunit/CRM/Contact/Page/View/NoteTest.php [new file with mode: 0644]
tests/phpunit/CRM/Contribute/BAO/ContributionTest.php
tests/phpunit/CRM/Contribute/Form/AdditionalPaymentTest.php
tests/phpunit/CRM/Contribute/Form/SearchTest.php
tests/phpunit/CRM/Core/BAO/IMTest.php
tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php
tests/phpunit/CRM/Core/JobManagerTest.php
tests/phpunit/CRM/Dedupe/MergerTest.php
tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php
tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php
tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php
tests/phpunit/CRM/Group/Page/AjaxTest.php
tests/phpunit/CRM/Mailing/BAO/QueryTest.php
tests/phpunit/CRM/Mailing/BAO/QueryTestDataProvider.php
tests/phpunit/CRM/Mailing/TokensTest.php
tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php
tests/phpunit/CRM/Member/Form/MembershipTest.php
tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php
tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php
tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php
tests/phpunit/CRM/Utils/FileTest.php
tests/phpunit/CRMTraits/Custom/CustomDataTrait.php [new file with mode: 0644]
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/ACLPermissionTest.php
tests/phpunit/api/v3/AddressTest.php
tests/phpunit/api/v3/ContactTest.php
tests/phpunit/api/v3/CustomValueTest.php
tests/phpunit/api/v3/FinancialTypeACLTest.php
tests/phpunit/api/v3/GroupNestingTest.php
tests/phpunit/api/v3/JobTest.php
tests/phpunit/api/v3/MailingABTest.php
tests/phpunit/api/v3/MailingContactTest.php
tests/phpunit/api/v3/MailingTest.php
tests/phpunit/api/v3/PaymentTest.php
tests/phpunit/api/v3/ProfileTest.php
tests/phpunit/api/v3/RelationshipTest.php
tests/phpunit/api/v3/ReportTemplateTest.php
tests/phpunit/api/v3/SettingTest.php
tests/phpunit/api/v3/SyntaxConformanceTest.php
tests/phpunit/api/v3/TagTest.php
tests/phpunit/api/v3/UFFieldTest.php
tests/phpunit/api/v3/UFJoinTest.php
tests/phpunit/api/v3/UFMatchTest.php
tests/phpunit/api/v3/custom_api/MailingProviderData.php
tests/phpunit/api/v3/dataset/email_contact_17.xml [deleted file]
tools/bin/scripts/ImportTags.php
tools/bin/scripts/NormalizePhone.php
tools/bin/scripts/ckeditorConfigScraper.php
tools/bin/scripts/cli.php
tools/bin/scripts/memcache.php
tools/bin/scripts/set-version.php
tools/bin/scripts/testProcess.php
tools/bin/scripts/updateNameCache.php
tools/drupal/modules/civicrm_webtest/civicrm_webtest.install
tools/extensions/org.civicrm.angularex/angularex.civix.php
tools/extensions/org.civicrm.angularex/angularex.php
tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueue.php
tools/extensions/org.civicrm.demoqueue/CRM/Demoqueue/Page/DemoQueueDone.php
tools/extensions/org.civicrm.demoqueue/demoqueue.civix.php
tools/scripts/check-angular.php
tools/scripts/civimail-spooler/civimail-spooler.php
tools/scripts/composer/patches/civicrm-custom-patches-zetacompoents-mail.patch
tools/scripts/solr/createSolrJSON.php
tools/scripts/solr/createSolrXML.php
tools/scripts/solr/createSyncJSON.php
tools/scripts/tpl-lint
xml/schema/Contact/Contact.xml
xml/schema/Contact/Group.xml
xml/schema/Contact/RelationshipType.xml
xml/schema/Contribute/ContributionRecur.xml
xml/schema/Core/Address.xml
xml/schema/Core/Component.xml
xml/schema/Core/MappingField.xml
xml/schema/Core/Tag.xml
xml/schema/Event/Participant.xml
xml/templates/dao.tpl
xml/version.xml

index 2cba8eaaf3cd7fa2320c0f2df4527a28c2da073f..924a9eaf2aad3583fbdb796ee88c584e4f0290a9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/ACL/ACL.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:71681f363debd53627c4c98a9032b0f6)
+ * (GenCodeChecksum:810da5f19a7ead8c949065156674c087)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
   /**
    * Is this ACL entry Allow  (0) or Deny (1) ?
    *
-   * @var boolean
+   * @var bool
    */
   public $deny;
 
@@ -59,7 +59,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
   /**
    * ID of the object possessing this ACL
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -80,7 +80,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
   /**
    * The ID of the object controlled by this ACL entry
    *
-   * @var int unsigned
+   * @var int
    */
   public $object_id;
 
@@ -94,14 +94,14 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
   /**
    * ID of the ACL or ACL group being granted/revoked
    *
-   * @var int unsigned
+   * @var int
    */
   public $acl_id;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -223,7 +223,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_ACL_BAO_ACL::operation',
-          ]
+          ],
         ],
         'object_table' => [
           'name' => 'object_table',
index c59ff67e57094ce65dbbd500684e5ef28a4bfe62..229f6f4c6e407f5aca70cb5648eb87ea45faeea5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/ACL/Cache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7551610e08f73f20ef3e5b9ef6782f80)
+ * (GenCodeChecksum:f993d89f3a44999eed1b4c46b714b736)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign Key to Contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Foreign Key to ACL
    *
-   * @var int unsigned
+   * @var int
    */
   public $acl_id;
 
index 93956fc8b9d876b2d3c6e16f0d03e4fb852f100c..ea001945755651fce5dd55b46f6648b3c2002064 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/ACL/EntityRole.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c53e5bc404fee6d3f005fbaf15abdb4e)
+ * (GenCodeChecksum:65952cc85e04acddbaef65cfcf7fc541)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)
    *
-   * @var int unsigned
+   * @var int
    */
   public $acl_role_id;
 
@@ -52,14 +52,14 @@ class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO {
   /**
    * ID of the group/contact object being joined
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index af4961d5ab5ee4115f7928d79e39f95b73c470d5..56f12e5288fedc56aff4b034db6d47029e44dd54 100644 (file)
@@ -705,7 +705,6 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       'source_contact_id',
       'source_contact_name',
       'assignee_contact_id',
-      'target_contact_id',
       'assignee_contact_name',
       'status_id',
       'subject',
@@ -719,7 +718,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
         $activityParams['return'][] = $attr;
       }
     }
-    $result = civicrm_api3('Activity', 'Get', $activityParams);
+    $result = civicrm_api3('Activity', 'Get', $activityParams)['values'];
 
     $bulkActivityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Bulk Email');
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
@@ -730,44 +729,83 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings'))
     );
 
+    // @todo - get rid of this & just handle in the array declaration like we do with 'subject' etc.
     $mappingParams = [
-      'id' => 'activity_id',
       'source_record_id' => 'source_record_id',
       'activity_type_id' => 'activity_type_id',
-      'activity_date_time' => 'activity_date_time',
       'status_id' => 'status_id',
-      'subject' => 'subject',
       'campaign_id' => 'campaign_id',
-      'assignee_contact_name' => 'assignee_contact_name',
-      'source_contact_id' => 'source_contact_id',
-      'source_contact_name' => 'source_contact_name',
       'case_id' => 'case_id',
     ];
 
-    foreach ($result['values'] as $id => $activity) {
-
-      $activities[$id] = [];
-
-      $isBulkActivity = (!$bulkActivityTypeID || ($bulkActivityTypeID === $activity['activity_type_id']));
-      $activities[$id]['target_contact_counter'] = count($activity['target_contact_id']);
-      if ($activities[$id]['target_contact_counter']) {
-        try {
-          $activities[$id]['target_contact_name'][$activity['target_contact_id'][0]] = civicrm_api3('Contact', 'getvalue', ['id' => $activity['target_contact_id'][0], 'return' => 'sort_name']);
+    if (empty($result)) {
+      $targetCount = [];
+    }
+    else {
+      $targetCount = CRM_Core_DAO::executeQuery('
+      SELECT activity_id, count(*) as target_contact_count
+      FROM civicrm_activity_contact
+      INNER JOIN civicrm_contact c ON contact_id = c.id AND c.is_deleted = 0
+      WHERE activity_id IN (' . implode(',', array_keys($result)) . ')
+      AND record_type_id = %1
+      GROUP BY activity_id', [
+        1 => [
+          CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Targets'),
+          'Integer'
+        ]
+      ])->fetchAll();
+    }
+    foreach ($targetCount as $activityTarget) {
+      $result[$activityTarget['activity_id']]['target_contact_count'] = $activityTarget['target_contact_count'];
+    }
+    // Iterate through & do basic mappings & determine which ones we want to retrieve target count for.
+    foreach ($result as $id => $activity) {
+      $activities[$id] = [
+        'activity_id' => $activity['id'],
+        'activity_date_time' => CRM_Utils_Array::value('activity_date_time', $activity),
+        'subject' => CRM_Utils_Array::value('subject', $activity),
+        'assignee_contact_name' => CRM_Utils_Array::value('assignee_contact_sort_name', $activity, []),
+        'source_contact_id' => CRM_Utils_Array::value('source_contact_id', $activity),
+        'source_contact_name' => CRM_Utils_Array::value('source_contact_sort_name', $activity),
+      ];
+      $activities[$id]['activity_type_name'] = CRM_Core_PseudoConstant::getName('CRM_Activity_BAO_Activity', 'activity_type_id', $activity['activity_type_id']);
+      $activities[$id]['activity_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $activity['activity_type_id']);
+      $activities[$id]['target_contact_count'] = CRM_Utils_Array::value('target_contact_count', $activity, 0);
+      if (!empty($activity['target_contact_count'])) {
+        $displayedTarget = civicrm_api3('ActivityContact', 'get', [
+          'activity_id' => $id,
+          'check_permissions' => TRUE,
+          'options' => ['limit' => 1],
+          'record_type_id' => 'Activity Targets',
+          'return' => ['contact_id.sort_name', 'contact_id'],
+          'sequential' => 1,
+        ])['values'];
+        if (empty($displayedTarget[0])) {
+          $activities[$id]['target_contact_name'] = [];
         }
-        catch (CiviCRM_API3_Exception $e) {
-          // Really they should have names but a fatal here feels wrong.
-          $activities[$id]['target_contact_name'] = '';
+        else {
+          $activities[$id]['target_contact_name'] = [$displayedTarget[0]['contact_id'] => $displayedTarget[0]['contact_id.sort_name']];
         }
       }
+      if ($activities[$id]['activity_type_name'] === 'Bulk Email') {
+        $bulkActivities[] = $id;
+        // Get the total without permissions being passed but only display names after permissioning.
+        $activities[$id]['recipients'] = ts('(%1 recipients)', [1 => $activities[$id]['target_contact_count']]);
+      }
+    }
+
+    // Eventually this second iteration should just handle the target contacts. It's a bit muddled at
+    // the moment as the bulk activity stuff needs unravelling & test coverage.
+    foreach ($result as $id => $activity) {
+      $isBulkActivity = (!$bulkActivityTypeID || ($bulkActivityTypeID === $activity['activity_type_id']));
       foreach ($mappingParams as $apiKey => $expectedName) {
         if (in_array($apiKey, [
-          'assignee_contact_name',
           'target_contact_name',
         ])) {
-          $activities[$id][$expectedName] = CRM_Utils_Array::value($apiKey, $activity, []);
 
           if ($isBulkActivity) {
-            $activities[$id]['recipients'] = ts('(%1 recipients)', [1 => count($activity['target_contact_name'])]);
+            // @todo  - how is this used? Couldn't we use 'is_bulk' or something clearer?
+            // or the calling function could handle
             $activities[$id]['mailingId'] = FALSE;
             if ($accessCiviMail &&
               ($mailingIDs === TRUE || in_array($activity['source_record_id'], $mailingIDs))
@@ -786,11 +824,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
           }
         }
         else {
+          // @todo this generic assign could just be handled in array declaration earlier.
           $activities[$id][$expectedName] = CRM_Utils_Array::value($apiKey, $activity);
-          if ($apiKey == 'activity_type_id') {
-            $activities[$id]['activity_type'] = CRM_Core_PseudoConstant::getName('CRM_Activity_BAO_Activity', 'activity_type_id', $activities[$id][$expectedName]);
-          }
-          elseif ($apiKey == 'campaign_id') {
+          if ($apiKey == 'campaign_id') {
             $activities[$id]['campaign'] = CRM_Utils_Array::value($activities[$id][$expectedName], $allCampaigns);
           }
         }
@@ -2414,7 +2450,7 @@ INNER JOIN  civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
   }
 
   /**
-   * Checks if user has permissions to edit inbound e-mails, either bsic info
+   * Checks if user has permissions to edit inbound e-mails, either basic info
    * or both basic information and content.
    *
    * @return bool
@@ -2525,7 +2561,7 @@ INNER JOIN  civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
         elseif (!empty($values['recipients'])) {
           $activity['target_contact_name'] = $values['recipients'];
         }
-        elseif (isset($values['target_contact_counter']) && $values['target_contact_counter']) {
+        elseif (isset($values['target_contact_count']) && $values['target_contact_count']) {
           $activity['target_contact_name'] = '';
           $firstTargetName = reset($values['target_contact_name']);
           $firstTargetContactID = key($values['target_contact_name']);
@@ -2542,7 +2578,7 @@ INNER JOIN  civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
             $activity['target_contact_name'] .= $targetLink;
           }
 
-          if ($extraCount = $values['target_contact_counter'] - 1) {
+          if ($extraCount = $values['target_contact_count'] - 1) {
             $activity['target_contact_name'] .= ";<br />" . "(" . ts('%1 more', [1 => $extraCount]) . ")";
           }
           if ($showContactOverlay) {
index 4ebc2b0b54bdff0598d3f0243cf7d16061468ef8..cb2cb014eff745ed34526d7214b9f82f2dcf577f 100644 (file)
@@ -67,8 +67,7 @@ class CRM_Activity_BAO_ICalendar {
   public function addAttachment(&$attachments, $contacts) {
     // Check preferences setting
     if (Civi::settings()->get('activity_assignee_notification_ics')) {
-      $config = &CRM_Core_Config::singleton();
-      $this->icsfile = tempnam($config->customFileUploadDir, 'ics');
+      $this->icsfile = tempnam(CRM_Core_Config::singleton()->customFileUploadDir, 'ics');
       if ($this->icsfile !== FALSE) {
         rename($this->icsfile, $this->icsfile . '.ics');
         $this->icsfile .= '.ics';
index d81c1a82a875b6471d79fb0b774863b1c701f4a7..8f4053dfed6b2cbbffc4912e11034e97b2715b29 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Activity/Activity.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ffa557668a214e3683b1692238ad74ae)
+ * (GenCodeChecksum:808e801e250ba56b83f69fe90d8b52c2)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   /**
    * Unique  Other Activity ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.
    *
-   * @var int unsigned
+   * @var int
    */
   public $source_record_id;
 
   /**
    * FK to civicrm_option_value.id, that has to be valid, registered activity type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $activity_type_id;
 
@@ -66,7 +66,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   /**
    * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.
    *
-   * @var int unsigned
+   * @var int
    */
   public $duration;
 
@@ -80,7 +80,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   /**
    * Phone ID of the number called (optional - used if an existing phone number is selected).
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_id;
 
@@ -101,57 +101,57 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   /**
    * ID of the status this activity is currently in. Foreign key to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
    * ID of the priority given to this activity. Foreign key to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $priority_id;
 
   /**
    * Parent meeting ID (if this is a follow-up item). This is not currently implemented
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
    * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.
    *
-   * @var int unsigned
+   * @var int
    */
   public $medium_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_auto;
 
   /**
    * FK to Relationship ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $relationship_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_current_revision;
 
   /**
    * Activity ID of the first activity record in versioning chain.
    *
-   * @var int unsigned
+   * @var int
    */
   public $original_id;
 
@@ -163,21 +163,21 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   public $result;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_deleted;
 
   /**
    * The campaign for which this activity has been triggered.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.
    *
-   * @var int unsigned
+   * @var int
    */
   public $engagement_level;
 
@@ -189,7 +189,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
   /**
    * Activity marked as favorite.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_star;
 
@@ -288,7 +288,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'activity_type',
             'optionEditPath' => 'civicrm/admin/options/activity_type',
-          ]
+          ],
         ],
         'activity_subject' => [
           'name' => 'subject',
@@ -430,7 +430,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'activity_status',
             'optionEditPath' => 'civicrm/admin/options/activity_status',
-          ]
+          ],
         ],
         'priority_id' => [
           'name' => 'priority_id',
@@ -448,7 +448,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'priority',
             'optionEditPath' => 'civicrm/admin/options/priority',
-          ]
+          ],
         ],
         'parent_id' => [
           'name' => 'parent_id',
@@ -496,7 +496,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'encounter_medium',
             'optionEditPath' => 'civicrm/admin/options/encounter_medium',
-          ]
+          ],
         ],
         'is_auto' => [
           'name' => 'is_auto',
@@ -604,7 +604,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'activity_engagement_level' => [
           'name' => 'engagement_level',
@@ -624,7 +624,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'engagement_index',
             'optionEditPath' => 'civicrm/admin/options/engagement_index',
-          ]
+          ],
         ],
         'weight' => [
           'name' => 'weight',
index 1eaa7ca8256d902b98b70ff12e91b97e221e967f..aac6059d38b0ac0ca9b91e9b4a1010331126a2cb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Activity/ActivityContact.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ff5291c3d7067182669807aa125fef72)
+ * (GenCodeChecksum:bb5726fd8dc1e07e19a08982d502a9f1)
  */
 
 /**
@@ -31,28 +31,28 @@ class CRM_Activity_DAO_ActivityContact extends CRM_Core_DAO {
   /**
    * Activity contact id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign key to the activity for this record.
    *
-   * @var int unsigned
+   * @var int
    */
   public $activity_id;
 
   /**
    * Foreign key to the contact for this record.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target.
    *
-   * @var int unsigned
+   * @var int
    */
   public $record_type_id;
 
@@ -144,7 +144,7 @@ class CRM_Activity_DAO_ActivityContact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'activity_contacts',
             'optionEditPath' => 'civicrm/admin/options/activity_contacts',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 680188871e0cc79c8fb6d4df686b587a1e0552a3..c59ef226c1761e3b4350ba78ddfa7fe988792502 100644 (file)
@@ -111,7 +111,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
   /**
    * Survey activity.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isSurveyActivity;
 
@@ -133,7 +133,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
    * Note: This is a class property so that child classes can turn off this
    * behavior (e.g. in CRM_Case_Form_Activity)
    *
-   * @var boolean
+   * @var bool
    *
    */
 
@@ -602,7 +602,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     }
 
     // CRM-15472 - 50 is around the practical limit of how many items a select2 entityRef can handle
-    if ($this->_action == 2 && !empty($defaults['target_contact_id'])) {
+    if ($this->_action == CRM_Core_Action::UPDATE && !empty($defaults['target_contact_id'])) {
       $count = count(is_array($defaults['target_contact_id']) ? $defaults['target_contact_id'] : explode(',', $defaults['target_contact_id']));
       if ($count > 50) {
         $this->freeze(['target_contact_id']);
@@ -627,6 +627,12 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     return $defaults;
   }
 
+  /**
+   * Build Quick form.
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
+   */
   public function buildQuickForm() {
     if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
       //enable form element (ActivityLinks sets this true)
@@ -860,14 +866,12 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       $errors['activity_type_id'] = ts('Activity Type is a required field');
     }
 
-    if (CRM_Utils_Array::value('activity_type_id', $fields) == 3 &&
-      CRM_Utils_Array::value('status_id', $fields) == 1
-    ) {
+    if (CRM_Utils_Array::value('activity_type_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Email')
+      && CRM_Utils_Array::value('status_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled')) {
       $errors['status_id'] = ts('You cannot record scheduled email activity.');
     }
-    elseif (CRM_Utils_Array::value('activity_type_id', $fields) == 4 &&
-      CRM_Utils_Array::value('status_id', $fields) == 1
-    ) {
+    elseif (CRM_Utils_Array::value('activity_type_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'SMS')
+      && CRM_Utils_Array::value('status_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled')) {
       $errors['status_id'] = ts('You cannot record scheduled SMS activity.');
     }
 
@@ -896,7 +900,9 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
    *
    *
    * @param array $params
+   *
    * @return array|null
+   * @throws \CiviCRM_API3_Exception
    */
   public function postProcess($params = NULL) {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 4aa16252d5d6a0d76f154446c2dfa7c502cdf9c0..063fa8001f319fb447a32e503d86dae9fc48e865 100644 (file)
@@ -46,14 +46,14 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 7fa2bef6ca80edfabe2413e7f79f82f2381ba8ae..3bdcfc0916c44baeb5ff9169ab69057b7a744494 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific Activity?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 4f6db5136b1a9baa1f5546953fbb30ac1c6d19f8..e5338f33e51f48ec232411efe42b8ad4c99c7737 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index 42d9f6aa3f23b81a03c140981af381b699887561..d19e1ea543fbb0e4f0da1e5c95fda67064c75df5 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task {
    * Are we operating in "single mode", i.e. sending sms to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index b19a6002de94f49e1743a56b84f2e9cb2a698ca2..4f8471472ca1b3b8f992ddac77a0e3818de4525e 100644 (file)
@@ -52,7 +52,7 @@ class CRM_Activity_Import_Field {
 
   /**
    * Is this field required
-   * @var boolean
+   * @var bool
    */
   public $_required;
 
index fc4aca0c20dcc8d6f03edf2090d690898a1982af..67198fee68745ff950714d8ea08d2bd61357e962 100644 (file)
@@ -55,7 +55,7 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
   /**
    * Whether the file has a column header or not.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_haveColumnHeader;
 
index e03072dbdd175adf0321ad4882139e375a46d92e..6fef52aaff359b1ef55f3e9c4df1444164b8d7d8 100644 (file)
@@ -181,9 +181,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C
         $url = 'civicrm/contact/view/activity';
         $qsView = "atype={$activityTypeId}&action=view&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
 
-        if (CRM_Core_Permission::check('edit inbound email basic information')
-          || CRM_Core_Permission::check('edit inbound email basic information and content')
-        ) {
+        if (CRM_Activity_BAO_Activity::checkEditInboundEmailsPermissions()) {
           $showDelete = $showUpdate = TRUE;
           $qsUpdate = "atype={$activityTypeId}&action=update&reset=1&id=%%id%%&cid=%%cid%%&context=%%cxt%%{$extraParams}";
         }
index 8a21dde81faa892b462c1a9fb25bab91556edd0e..abd0bdfb249f80ca24bb5bbd8e0fdfae048ef2b3 100644 (file)
@@ -79,14 +79,14 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 1b537f90634a305db517969247910842db35e329..b0c604c0103ba659cdc0c1a0b809953b58c221da 100644 (file)
@@ -208,8 +208,8 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
 
       if (empty($params['id'])) {
         // Set name on created but don't update on update as the machine name is not exposed.
-        $params['name_b_a'] = CRM_Utils_String::munge($params['label_b_a']);
-        $params['name_a_b'] = CRM_Utils_String::munge($params['label_a_b']);
+        $params['name_b_a'] = $params['label_b_a'];
+        $params['name_a_b'] = $params['label_a_b'];
       }
 
       $result = civicrm_api3('RelationshipType', 'create', $params);
index f22470803fe66521fcd3ad141c6d8a02bfce1c92..308d409e7ea5b0b69351811740f0dc4a8f7e5a38 100644 (file)
@@ -66,8 +66,7 @@ trait CRM_Admin_Form_SettingTrait {
    */
   protected function getSettingsMetaData() {
     if (empty($this->settingsMetadata)) {
-      $allSettingMetaData = civicrm_api3('setting', 'getfields', []);
-      $this->settingsMetadata = array_intersect_key($allSettingMetaData['values'], $this->_settings);
+      $this->settingsMetadata = \Civi\Core\SettingsMetadata::getMetadata(['name' => array_keys($this->_settings)], NULL, TRUE);
       // This array_merge re-orders to the key order of $this->_settings.
       $this->settingsMetadata = array_merge($this->_settings, $this->settingsMetadata);
     }
@@ -174,10 +173,7 @@ trait CRM_Admin_Form_SettingTrait {
       $quickFormType = $this->getQuickFormType($props);
       if (isset($quickFormType)) {
         $options = CRM_Utils_Array::value('options', $props);
-        if (isset($props['pseudoconstant'])) {
-          $options = civicrm_api3('Setting', 'getoptions', [
-            'field' => $setting,
-          ])['values'];
+        if ($options) {
           if ($props['html_type'] === 'Select' && isset($props['is_required']) && $props['is_required'] === FALSE && !isset($options[''])) {
             // If the spec specifies the field is not required add a null option.
             // Why not if empty($props['is_required']) - basically this has been added to the spec & might not be set to TRUE
index 7ba567c047e8519e01a50efd9d02b4516493a44b..8a54c7426cb06f79020180a41037a63a11d63f52 100644 (file)
@@ -69,7 +69,7 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
   /**
    * A boolean determining if you can add options to this group in the GUI.
    *
-   * @var boolean
+   * @var bool
    */
   public static $_isLocked = FALSE;
 
index aa87f7076f52eca51fbd6a2ce5cc61e2e1785f30..fb2b2a326194d20ab2e40f98ddc18535d189a1a9 100644 (file)
@@ -560,7 +560,6 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
       while ($dao->fetch()) {
         $totals[$dao->batch_id] = (array) $dao;
       }
-      $dao->free();
     }
     return $totals;
   }
index cac1d10f15b44d05108cb98a90c8c86db59cbec6..26340d54ad15b2cb5df9088e82ee3dff2b383dab 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Batch/Batch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5e14654e2df1b813931043edb9d0f828)
+ * (GenCodeChecksum:3e98e0127d48dfc44b2e6db904cd556f)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
   /**
    * Unique Address ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,7 +59,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -73,7 +73,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $modified_id;
 
@@ -87,28 +87,28 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
   /**
    * FK to Saved Search ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $saved_search_id;
 
   /**
    * fk to Batch Status options in civicrm_option_values
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
    * fk to Batch Type options in civicrm_option_values
    *
-   * @var int unsigned
+   * @var int
    */
   public $type_id;
 
   /**
    * fk to Batch mode options in civicrm_option_values
    *
-   * @var int unsigned
+   * @var int
    */
   public $mode_id;
 
@@ -122,14 +122,14 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
   /**
    * Number of items in a batch.
    *
-   * @var int unsigned
+   * @var int
    */
   public $item_count;
 
   /**
    * fk to Payment Instrument options in civicrm_option_values
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
@@ -319,7 +319,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'batch_status',
             'optionEditPath' => 'civicrm/admin/options/batch_status',
-          ]
+          ],
         ],
         'type_id' => [
           'name' => 'type_id',
@@ -337,7 +337,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'batch_type',
             'optionEditPath' => 'civicrm/admin/options/batch_type',
-          ]
+          ],
         ],
         'mode_id' => [
           'name' => 'mode_id',
@@ -355,7 +355,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'batch_mode',
             'optionEditPath' => 'civicrm/admin/options/batch_mode',
-          ]
+          ],
         ],
         'total' => [
           'name' => 'total',
@@ -364,7 +364,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
           'description' => ts('Total amount for this batch.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_batch.total',
           'table_name' => 'civicrm_batch',
@@ -405,7 +405,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
         'exported_date' => [
           'name' => 'exported_date',
index a9ec632af09366b4b0b998a375f0578e91034540..5e0cb9ecb089cc13ae1eeee771235d1a88b7463e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Batch/EntityBatch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ad54978e70be59ea54b414bbb3131f2f)
+ * (GenCodeChecksum:12e2c6e8e3c0890f0531819aebcfc543)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to civicrm_batch
    *
-   * @var int unsigned
+   * @var int
    */
   public $batch_id;
 
@@ -141,7 +141,7 @@ class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO {
             'table' => 'civicrm_batch',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 0d5ebe8cb5ba342b2bd52bec65f273ccb6f3932e..c7a9f25e9d75570dd239c6e597a89838f338d822 100644 (file)
@@ -49,18 +49,18 @@ class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
       return NULL;
     }
 
-    if (!(CRM_Utils_Array::value('id', $params))) {
+    if (empty($params['id'])) {
 
-      if (!(CRM_Utils_Array::value('created_id', $params))) {
+      if (empty($params['created_id'])) {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
       }
 
-      if (!(CRM_Utils_Array::value('created_date', $params))) {
+      if (empty($params['created_date'])) {
         $params['created_date'] = date('YmdHis');
       }
 
-      if (!(CRM_Utils_Array::value('name', $params))) {
+      if (empty($params['name'])) {
         $params['name'] = CRM_Utils_String::titleToVar($params['title'], 64);
       }
 
index dad2b00defec43ddd5e0c0253449ffdba01fb1b5..a3c496b315dbdeefb10a9fe70f7ae928cba0bf11 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/Campaign.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c6ffa4ea926f3a52afc754bf44ef8586)
+ * (GenCodeChecksum:5f32f92aafb04b54f15a47d07a2fe105)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
   /**
    * Unique Campaign ID.
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -73,14 +73,14 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
   /**
    * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_type_id;
 
   /**
    * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -94,21 +94,21 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
   /**
    * Optional parent id for this Campaign.
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Is this Campaign enabled or disabled/cancelled?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * FK to civicrm_contact, who created this Campaign.
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -122,7 +122,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who recently edited this Campaign.
    *
-   * @var int unsigned
+   * @var int
    */
   public $last_modified_id;
 
@@ -300,7 +300,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'campaign_type',
             'optionEditPath' => 'civicrm/admin/options/campaign_type',
-          ]
+          ],
         ],
         'status_id' => [
           'name' => 'status_id',
@@ -321,7 +321,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'campaign_status',
             'optionEditPath' => 'civicrm/admin/options/campaign_status',
-          ]
+          ],
         ],
         'external_identifier' => [
           'name' => 'external_identifier',
@@ -446,7 +446,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
           'description' => ts('The target revenue for this campaign.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_campaign.goal_revenue',
           'table_name' => 'civicrm_campaign',
index 5c8ec894d4be4df252da6163493f52d08563298e..07f34d5fde2953b4bf852b362bdbba4ac5b708a7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9c9ee0c8ea79ddd0f680e8050693e5db)
+ * (GenCodeChecksum:c399857d6182b7d1dcc2f037518ba8c3)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
   /**
    * Campaign Group id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign key to the activity Campaign.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
@@ -59,7 +59,7 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
   /**
    * Entity id of referenced table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -123,7 +123,7 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'group_type' => [
           'name' => 'group_type',
@@ -143,7 +143,7 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
-          ]
+          ],
         ],
         'entity_table' => [
           'name' => 'entity_table',
index 763fd2f71033d248de3b179c661fc01e4c73369f..d013622630e25ed789c72cd006e0314939ab2396 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/Survey.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:bf281972fa5b1efaa8801eb9a47e42ae)
+ * (GenCodeChecksum:ad39991f1177492db1fd47cbaacf676a)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * Survey id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * Foreign key to the Campaign.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Implicit FK to civicrm_option_value where option_group = activity_type
    *
-   * @var int unsigned
+   * @var int
    */
   public $activity_type_id;
 
@@ -73,42 +73,42 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * Number of days for recurrence of release.
    *
-   * @var int unsigned
+   * @var int
    */
   public $release_frequency;
 
   /**
    * Maximum number of contacts to allow for survey.
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_number_of_contacts;
 
   /**
    * Default number of contacts to allow for survey.
    *
-   * @var int unsigned
+   * @var int
    */
   public $default_number_of_contacts;
 
   /**
    * Is this survey enabled or disabled/cancelled?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this default survey?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * FK to civicrm_contact, who created this Survey.
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -122,7 +122,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who recently edited this Survey.
    *
-   * @var int unsigned
+   * @var int
    */
   public $last_modified_id;
 
@@ -136,14 +136,14 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * Used to store option group id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $result_id;
 
   /**
    * Bypass the email verification.
    *
-   * @var boolean
+   * @var bool
    */
   public $bypass_confirm;
 
@@ -164,7 +164,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
   /**
    * Can people share the petition through social media?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_share;
 
@@ -245,7 +245,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'activity_type_id' => [
           'name' => 'activity_type_id',
@@ -266,7 +266,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'activity_type',
             'optionEditPath' => 'civicrm/admin/options/activity_type',
-          ]
+          ],
         ],
         'recontact_interval' => [
           'name' => 'recontact_interval',
index ab7569d01ef91a237bea164cb9023460355b218f..7d380334549a747f55939096953d66b051bd106a 100644 (file)
@@ -46,14 +46,14 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 6fc5d63ab848583b26da230833933e9be33c3ebd..f292272399c593a112c880420adaa3681fe2cc90 100644 (file)
  */
 class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
 
+  /**
+   * Explicitly declare the entity api name.
+   *
+   * @return string
+   */
+  public function getDefaultEntity() {
+    return 'Campaign';
+  }
+
   /**
    * Are we forced to run a search.
    *
@@ -78,11 +87,8 @@ class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
     //campaign description.
     $this->add('text', 'description', ts('Description'), $attributes['description']);
 
-    //campaign start date.
-    $this->addDate('start_date', ts('From'), FALSE, ['formatType' => 'searchDate']);
-
-    //campaign end date.
-    $this->addDate('end_date', ts('To'), FALSE, ['formatType' => 'searchDate']);
+    $this->add('datepicker', 'start_date', ts('Campaign Start Date'), [], FALSE, ['time' => FALSE]);
+    $this->add('datepicker', 'end_date', ts('Campaign End Date'), [], FALSE, ['time' => FALSE]);
 
     //campaign type.
     $campaignTypes = CRM_Campaign_PseudoConstant::campaignType();
index 1dc5c177b37ff3a7602cfb60670203de69e204ea..7c22820e9bd363d2d2b0c498b01336f121edc171 100644 (file)
@@ -76,14 +76,14 @@ class CRM_Campaign_Selector_Search extends CRM_Core_Selector_Base implements CRM
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 091b4e9f046f74b26202acd3c39bd5fac2f95fc2..222860016a0125dbbdd91beeb93e281a0613b555 100644 (file)
@@ -429,121 +429,60 @@ WHERE cc.contact_id = %1 AND civicrm_case_type.name = '{$caseType}'";
       'civicrm_phone.phone as phone',
       'civicrm_contact.contact_type as contact_type',
       'civicrm_contact.contact_sub_type as contact_sub_type',
-      't_act.activity_type_id',
-      'c_type.title as case_type',
+      't_act.activity_type_id as activity_type_id',
       'civicrm_case.case_type_id as case_type_id',
-      'cov_status.label as case_status',
-      'cov_status.label as case_status_name',
-      't_act.status_id',
+      'civicrm_case.status_id as case_status_id',
+      't_act.status_id as status_id',
       'civicrm_case.start_date as case_start_date',
       'case_relation_type.label_b_a as case_role',
+      't_act.activity_date_time as activity_date_time',
+      't_act.id as activity_id',
     );
 
-    if ($type == 'upcoming') {
-      $selectClauses = array_merge($selectClauses, array(
-        't_act.desired_date as case_scheduled_activity_date',
-        't_act.id as case_scheduled_activity_id',
-        't_act.act_type_name as case_scheduled_activity_type_name',
-        't_act.act_type AS case_scheduled_activity_type',
-      ));
-    }
-    elseif ($type == 'recent') {
-      $selectClauses = array_merge($selectClauses, array(
-        't_act.desired_date as case_recent_activity_date',
-        't_act.id as case_recent_activity_id',
-        't_act.act_type_name as case_recent_activity_type_name',
-        't_act.act_type AS case_recent_activity_type',
-      ));
-    }
-    elseif ($type == 'any') {
-      $selectClauses = array_merge($selectClauses, array(
-        't_act.desired_date as case_activity_date',
-        't_act.id as case_activity_id',
-        't_act.act_type_name as case_activity_type_name',
-        't_act.act_type AS case_activity_type',
-      ));
-    }
-
     $query = CRM_Contact_BAO_Query::appendAnyValueToSelect($selectClauses, 'case_id');
 
-    $query .= " FROM civicrm_case
-                  INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id
-                  INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id ";
-
-    if ($type == 'upcoming') {
-      // This gets the earliest activity per case that's scheduled within 14 days from now.
-      // Note we have an inner select to get the min activity id in order to remove duplicates in case there are two with the same datetime.
-      // In this case we don't really care which one, so min(id) works.
-      // optimized in CRM-11837
-      $query .= " INNER JOIN
-(
-  SELECT case_id, act.id, activity_date_time AS desired_date, activity_type_id, status_id, aov.name AS act_type_name, aov.label AS act_type
-  FROM (
-    SELECT *
-    FROM (
-      SELECT *
-      FROM civicrm_view_case_activity_upcoming
-      ORDER BY activity_date_time ASC, id ASC
-      ) AS upcomingOrdered
-    ) AS act
-  LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
-  LEFT JOIN civicrm_option_value aov ON ( aov.option_group_id = aog.id AND aov.value = act.activity_type_id )
-) AS t_act
-";
-    }
-    elseif ($type == 'recent') {
-      // Similarly, the most recent activity in the past 14 days, and exclude scheduled.
-      //improve query performance - CRM-10598
-      $query .= " INNER JOIN
-(
-  SELECT case_id, act.id, activity_date_time AS desired_date, activity_type_id, status_id, aov.name AS act_type_name, aov.label AS act_type
-  FROM (
-    SELECT *
-    FROM (
-      SELECT *
-      FROM civicrm_view_case_activity_recent
-      ORDER BY activity_date_time DESC, id ASC
-      ) AS recentOrdered
-    ) AS act
-LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
-  LEFT JOIN civicrm_option_value aov ON ( aov.option_group_id = aog.id AND aov.value = act.activity_type_id )
-) AS t_act ";
-    }
-    elseif ($type == 'any') {
-      $query .= " LEFT JOIN
-(
-  SELECT ca4.case_id, act4.id AS id, act4.activity_date_time AS desired_date, act4.activity_type_id, act4.status_id, aov.name AS act_type_name, aov.label AS act_type
-  FROM civicrm_activity act4
-  LEFT JOIN civicrm_case_activity ca4
-    ON ca4.activity_id = act4.id
-    AND act4.is_current_revision = 1
-  LEFT JOIN civicrm_option_group aog
-    ON aog.name='activity_type'
-  LEFT JOIN civicrm_option_value aov
-    ON aov.option_group_id = aog.id
-    AND aov.value = act4.activity_type_id
-) AS t_act";
-    }
-
-    $query .= "
-        ON t_act.case_id = civicrm_case.id
- LEFT JOIN civicrm_phone ON (civicrm_phone.contact_id = civicrm_contact.id AND civicrm_phone.is_primary=1)
- LEFT JOIN civicrm_relationship case_relationship
- ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = {$userID} AND case_relationship.is_active AND case_relationship.case_id = civicrm_case.id )
- LEFT JOIN civicrm_relationship_type case_relation_type
- ON ( case_relation_type.id = case_relationship.relationship_type_id
-      AND case_relation_type.id = case_relationship.relationship_type_id )
-
- LEFT JOIN civicrm_case_type c_type
- ON civicrm_case.case_type_id = c_type.id
-
- LEFT JOIN civicrm_option_group cog_status
- ON cog_status.name = 'case_status'
-
- LEFT JOIN civicrm_option_value cov_status
- ON ( civicrm_case.status_id = cov_status.value
-      AND cog_status.id = cov_status.option_group_id )
-";
+    $query .= <<<HERESQL
+      FROM civicrm_case
+        INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id
+        INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id
+HERESQL;
+
+    switch ($type) {
+      case 'upcoming':
+      case 'recent':
+        // civicrm_view_case_activity_upcoming and
+        // civicrm_view_case_activity_recent are views that show the next
+        // scheduled and most recent not-scheduled activity on each case,
+        // respectively.
+        $query .= <<<HERESQL
+        INNER JOIN civicrm_view_case_activity_$type t_act
+          ON t_act.case_id = civicrm_case.id
+HERESQL;
+        break;
+
+      case 'any':
+        $query .= <<<HERESQL
+        LEFT JOIN civicrm_case_activity ca4
+          ON civicrm_case.id = ca4.case_id
+        LEFT JOIN civicrm_activity t_act
+          ON t_act.id = ca4.activity_id
+          AND t_act.is_current_revision = 1
+HERESQL;
+    }
+
+    $query .= <<<HERESQL
+        LEFT JOIN civicrm_phone
+          ON civicrm_phone.contact_id = civicrm_contact.id
+            AND civicrm_phone.is_primary = 1
+        LEFT JOIN civicrm_relationship case_relationship
+          ON case_relationship.contact_id_a = civicrm_case_contact.contact_id
+            AND case_relationship.contact_id_b = {$userID}
+            AND case_relationship.is_active
+            AND case_relationship.case_id = civicrm_case.id
+        LEFT JOIN civicrm_relationship_type case_relation_type
+          ON case_relation_type.id = case_relationship.relationship_type_id
+            AND case_relation_type.id = case_relationship.relationship_type_id
+HERESQL;
 
     if ($condition) {
       // CRM-8749 backwards compatibility - callers of this function expect to start $condition with "AND"
@@ -551,20 +490,7 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
     }
     $query .= " GROUP BY case_id ";
 
-    if ($order) {
-      $query .= $order;
-    }
-    else {
-      if ($type == 'upcoming') {
-        $query .= " ORDER BY case_scheduled_activity_date ASC ";
-      }
-      elseif ($type == 'recent') {
-        $query .= " ORDER BY case_recent_activity_date ASC ";
-      }
-      elseif ($type == 'any') {
-        $query .= " ORDER BY case_activity_date ASC ";
-      }
-    }
+    $query .= ($order) ?: ' ORDER BY activity_date_time ASC';
 
     if ($limit) {
       $query .= $limit;
@@ -601,20 +527,6 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
     $type = CRM_Utils_Array::value('type', $params, 'upcoming');
     $userID = CRM_Core_Session::singleton()->get('userID');
 
-    $caseActivityTypeColumn = 'case_activity_type_name';
-    $caseActivityDateColumn = 'case_activity_date';
-    $caseActivityIDColumn = 'case_activity_id';
-    if ($type == 'upcoming') {
-      $caseActivityDateColumn = 'case_scheduled_activity_date';
-      $caseActivityTypeColumn = 'case_scheduled_activity_type';
-      $caseActivityIDColumn = 'case_scheduled_activity_id';
-    }
-    elseif ($type == 'recent') {
-      $caseActivityDateColumn = 'case_recent_activity_date';
-      $caseActivityTypeColumn = 'case_recent_activity_type';
-      $caseActivityIDColumn = 'case_recent_activity_id';
-    }
-
     // validate access for all cases.
     if ($allCases && !CRM_Core_Permission::check('access all cases and activities')) {
       $allCases = FALSE;
@@ -654,7 +566,7 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
     $order = NULL;
     if (!empty($params['sortBy'])) {
       if (strstr($params['sortBy'], 'date ')) {
-        $params['sortBy'] = str_replace('date', $caseActivityDateColumn, $params['sortBy']);
+        $params['sortBy'] = str_replace('date', 'activity_date_time', $params['sortBy']);
       }
       $order = "ORDER BY " . $params['sortBy'];
     }
@@ -662,8 +574,6 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
     $query = self::getCaseActivityQuery($type, $userID, $condition, $limit, $order);
     $result = CRM_Core_DAO::executeQuery($query);
 
-    $caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, " AND v.name = 'Urgent' ");
-
     // we're going to use the usual actions, so doesn't make sense to duplicate definitions
     $actions = CRM_Case_Selector_Search::links();
 
@@ -679,7 +589,12 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
     }
     $mask = CRM_Core_Action::mask($permissions);
 
+    // Pseudoconstants to populate labels
+    $caseStatuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
     $caseTypes = CRM_Case_PseudoConstant::caseType('name');
+    $caseTypeTitles = CRM_Case_PseudoConstant::caseType('title', FALSE);
+    $activityTypeLabels = CRM_Activity_BAO_Activity::buildOptions('activity_type_id');
+
     foreach ($result->fetchAll() as $case) {
       $key = $case['case_id'];
       $casesList[$key] = array();
@@ -701,30 +616,31 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
         $case['case_id']
       );
       $casesList[$key]['subject'] = $case['case_subject'];
-      $casesList[$key]['case_status'] = in_array($case['case_status'], $caseStatus) ? sprintf('<strong>%s</strong>', strtoupper($case['case_status'])) : $case['case_status'];
-      $casesList[$key]['case_type'] = $case['case_type'];
+      $casesList[$key]['case_status'] = CRM_Utils_Array::value($case['case_status_id'], $caseStatuses);
+      if ($case['case_status_id'] == CRM_Case_PseudoConstant::getKey('CRM_Case_BAO_Case', 'case_status_id', 'Urgent')) {
+        $casesList[$key]['case_status'] = sprintf('<strong>%s</strong>', strtoupper($casesList[$key]['case_status']));
+      }
+      $casesList[$key]['case_type'] = CRM_Utils_Array::value($case['case_type_id'], $caseTypeTitles);
       $casesList[$key]['case_role'] = CRM_Utils_Array::value('case_role', $case, '---');
       $casesList[$key]['manager'] = self::getCaseManagerContact($caseTypes[$case['case_type_id']], $case['case_id']);
 
-      $casesList[$key]['date'] = $case[$caseActivityTypeColumn];
-      if (($actId = CRM_Utils_Array::value('case_scheduled_activity_id', $case)) ||
-        ($actId = CRM_Utils_Array::value('case_recent_activity_id', $case))
-      ) {
+      $casesList[$key]['date'] = CRM_Utils_Array::value($case['activity_type_id'], $activityTypeLabels);
+      if ($actId = CRM_Utils_Array::value('activity_id', $case)) {
         if (self::checkPermission($actId, 'view', $case['activity_type_id'], $userID)) {
           if ($type == 'recent') {
             $casesList[$key]['date'] = sprintf('<a class="action-item crm-hover-button" href="%s" title="%s">%s</a>',
-              CRM_Utils_System::url('civicrm/case/activity/view', array('reset' => 1, 'cid' => $case['contact_id'], 'aid' => $case[$caseActivityIDColumn])),
+              CRM_Utils_System::url('civicrm/case/activity/view', array('reset' => 1, 'cid' => $case['contact_id'], 'aid' => $case['activity_id'])),
               ts('View activity'),
-              $case[$caseActivityTypeColumn]
+              CRM_Utils_Array::value($case['activity_type_id'], $activityTypeLabels)
             );
           }
           else {
-            $status = CRM_Utils_Date::overdue($case[$caseActivityDateColumn]) ? 'status-overdue' : 'status-scheduled';
+            $status = CRM_Utils_Date::overdue($case['activity_date_time']) ? 'status-overdue' : 'status-scheduled';
             $casesList[$key]['date'] = sprintf('<a class="crm-popup %s" href="%s" title="%s">%s</a> &nbsp;&nbsp;',
              $status,
-              CRM_Utils_System::url('civicrm/case/activity/view', array('reset' => 1, 'cid' => $case['contact_id'], 'aid' => $case[$caseActivityIDColumn])),
+              CRM_Utils_System::url('civicrm/case/activity/view', array('reset' => 1, 'cid' => $case['contact_id'], 'aid' => $case['activity_id'])),
               ts('View activity'),
-              $case[$caseActivityTypeColumn]
+              CRM_Utils_Array::value($case['activity_type_id'], $activityTypeLabels)
             );
           }
         }
@@ -735,7 +651,7 @@ LEFT JOIN civicrm_option_group aog ON aog.name='activity_type'
           );
         }
       }
-      $casesList[$key]['date'] .= "<br/>" . CRM_Utils_Date::customFormat($case[$caseActivityDateColumn]);
+      $casesList[$key]['date'] .= "<br/>" . CRM_Utils_Date::customFormat($case['activity_date_time']);
       $casesList[$key]['links'] = CRM_Core_Action::formLink($actions['primaryActions'], $mask,
         array(
           'id' => $case['case_id'],
@@ -1151,9 +1067,18 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
 
       // Activity Status Label for Case activities list
       $caseActivities[$caseActivityId]['status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status);
+      $deleted = '';
+      if ($dao->deleted) {
+        $deleted = '<br /> ' . ts('(deleted)');
+      }
+      $caseActivities[$caseActivityId]['status_id'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_status_id', $dao->status) . $deleted;
+      // if there are file attachments we will return how many
+      if (!empty($dao->attachment_ids)) {
+        $attachmentIDs = array_unique(explode(',', $dao->attachment_ids));
+        $caseActivity['no_attachments'] = count($attachmentIDs);
+      }
 
-      $caseActivities[$caseActivityId]
-        = self::addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao, $caseActivities[$caseActivityId]);
+      $caseActivities[$caseActivityId]['links'] = self::addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao);
     }
 
     $caseActivitiesDT = array();
@@ -1173,11 +1098,11 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
    * @param int $userID
    * @param string $context
    * @param \CRM_Core_DAO $dao
-   * @param array $caseActivity
    *
-   * @return array caseActivity
+   * @return string
+   *   HTML formatted Link
    */
-  public static function addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao, $caseActivity) {
+  private static function addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao) {
     // FIXME: Why are we not using CRM_Core_Action for these links? This is too much manual work and likely to get out-of-sync with core markup.
     $caseActivityId = $dao->id;
     $allowView = self::checkPermission($caseActivityId, 'view', $dao->activity_type_id, $userID);
@@ -1221,7 +1146,6 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
     }
     elseif (!$caseDeleted) {
       $url = ' <a ' . $css . ' href="' . $restoreUrl . $additionalUrl . '">' . ts('Restore') . '</a>';
-      $caseActivity['status_id'] = $caseActivity['status_id'] . '<br /> (deleted)';
     }
 
     //check for operations.
@@ -1233,12 +1157,10 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
     }
     // if there are file attachments we will return how many and, if only one, add a link to it
     if (!empty($dao->attachment_ids)) {
-      $attachmentIDs = array_unique(explode(',', $dao->attachment_ids));
-      $caseActivity['no_attachments'] = count($attachmentIDs);
       $url .= implode(' ', CRM_Core_BAO_File::paperIconAttachment('civicrm_activity', $caseActivityId));
     }
-    $caseActivity['links'] = $url;
-    return $caseActivity;
+
+    return $url;
   }
 
   /**
@@ -1621,18 +1543,19 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
  AND civicrm_case.is_deleted     = {$cases['case_deleted']}";
 
     $query = self::getCaseActivityQuery($type, $userID, $condition);
+    $activityTypes = CRM_Activity_BAO_Activity::buildOptions('activity_type_id');
 
     $res = CRM_Core_DAO::executeQuery($query);
 
     $activityInfo = array();
     while ($res->fetch()) {
       if ($type == 'upcoming') {
-        $activityInfo[$res->case_id]['date'] = $res->case_scheduled_activity_date;
-        $activityInfo[$res->case_id]['type'] = $res->case_scheduled_activity_type;
+        $activityInfo[$res->case_id]['date'] = $res->activity_date_time;
+        $activityInfo[$res->case_id]['type'] = CRM_Utils_Array::value($res->activity_type_id, $activityTypes);
       }
       else {
-        $activityInfo[$res->case_id]['date'] = $res->case_recent_activity_date;
-        $activityInfo[$res->case_id]['type'] = $res->case_recent_activity_type;
+        $activityInfo[$res->case_id]['date'] = $res->activity_date_time;
+        $activityInfo[$res->case_id]['type'] = CRM_Utils_Array::value($res->activity_type_id, $activityTypes);
       }
     }
 
@@ -2750,9 +2673,7 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
       //allow edit operation.
       $allowEditNames = array('Open Case');
 
-      if (CRM_Core_Permission::check('edit inbound email basic information') ||
-        CRM_Core_Permission::check('edit inbound email basic information and content')
-      ) {
+      if (CRM_Activity_BAO_Activity::checkEditInboundEmailsPermissions()) {
         $allowEditNames[] = 'Inbound Email';
       }
 
@@ -3051,8 +2972,8 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
  AS SELECT ca.case_id, a.id, a.activity_date_time, a.status_id, a.activity_type_id
  FROM civicrm_case_activity ca
  INNER JOIN civicrm_activity a ON ca.activity_id=a.id
- WHERE a.activity_date_time =
-(SELECT b.activity_date_time FROM civicrm_case_activity bca
+ WHERE a.id =
+(SELECT b.id FROM civicrm_case_activity bca
  INNER JOIN civicrm_activity b ON bca.activity_id=b.id
  WHERE b.activity_date_time <= DATE_ADD( NOW(), INTERVAL 14 DAY )
  AND b.is_current_revision = 1 AND b.is_deleted=0 AND b.status_id = $scheduled_id
@@ -3064,8 +2985,8 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
  AS SELECT ca.case_id, a.id, a.activity_date_time, a.status_id, a.activity_type_id
  FROM civicrm_case_activity ca
  INNER JOIN civicrm_activity a ON ca.activity_id=a.id
- WHERE a.activity_date_time =
-(SELECT b.activity_date_time FROM civicrm_case_activity bca
+ WHERE a.id =
+(SELECT b.id FROM civicrm_case_activity bca
  INNER JOIN civicrm_activity b ON bca.activity_id=b.id
  WHERE b.activity_date_time >= DATE_SUB( NOW(), INTERVAL 14 DAY )
  AND b.is_current_revision = 1 AND b.is_deleted=0 AND b.status_id <> $scheduled_id
index 2323c780c439bdc4c44478250e2aa4499dbe8f82..717b2b1bf1b91b8158757f9d76a44fbbfef050ec 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Case/Case.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a9960d56bc697d6cbc5347f9bc6a78bc)
+ * (GenCodeChecksum:f7d3f0df9ce94aec00f5eb0e20cedd1e)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO {
   /**
    * Unique Case ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_case_type.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $case_type_id;
 
@@ -73,12 +73,12 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO {
   /**
    * Id of case status.
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_deleted;
 
@@ -162,7 +162,7 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO {
             'table' => 'civicrm_case_type',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'case_subject' => [
           'name' => 'subject',
@@ -251,7 +251,7 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'case_status',
             'optionEditPath' => 'civicrm/admin/options/case_status',
-          ]
+          ],
         ],
         'case_deleted' => [
           'name' => 'is_deleted',
index e6a9999b40b1feef9161d7d30dfd9fd68ce098e4..40b275fbf882c50366f2500ac8e75eeb8b92f240 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Case/CaseActivity.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fd04fd5686de74febc915b1a035a3fb5)
+ * (GenCodeChecksum:cb7a73ba739c93a482d18ef28ed0c589)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Case_DAO_CaseActivity extends CRM_Core_DAO {
   /**
    * Unique case-activity association id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Case ID of case-activity association.
    *
-   * @var int unsigned
+   * @var int
    */
   public $case_id;
 
   /**
    * Activity ID of case-activity association.
    *
-   * @var int unsigned
+   * @var int
    */
   public $activity_id;
 
index 40b3e158cfcdc66799e85495a0678d6080d3fb6f..42a830d70315acc6d67c21c7d8aed67495a23d88 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Case/CaseContact.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ff0a0c29f836177de2ac856be6c5cb15)
+ * (GenCodeChecksum:84dae97091e4a1612c67274f5cb10531)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
   /**
    * Unique case-contact association id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Case ID of case-contact association.
    *
-   * @var int unsigned
+   * @var int
    */
   public $case_id;
 
   /**
    * Contact ID of contact record given case belongs to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
index 3a0b59404e20b7f17b5c2be27388404c76776a42..533f0e03a3356bc91c6b7c72fa2b2e85d7bf84c7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Case/CaseType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9ebd07607858eaf185b2be32744267bb)
+ * (GenCodeChecksum:317907ffe519c3f3eab8af9d8e9e1f7f)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Case_DAO_CaseType extends CRM_Core_DAO {
   /**
    * Autoincremented type id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,14 +59,14 @@ class CRM_Case_DAO_CaseType extends CRM_Core_DAO {
   /**
    * Is this entry active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this case type a predefined system type?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
index 4b9cdbe1dde90a919d5a74e3c82146c8944f2d34..1d225d6b1439d61d92e94d950b482c349bf2391a 100644 (file)
@@ -428,7 +428,10 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
     }
 
     // store the submitted values in an array
-    $params = $this->controller->exportValues($this->_name);
+    // Explanation for why we only check the is_unittest element: Prior to adding that check, there was no check and so any $params passed in would have been overwritten. Just in case somebody is passing in some non-null params and that broken code would have inadvertently been working, we can maintain backwards compatibility by only checking for the is_unittest parameter, and so that broken code will still work. At the same time this allows unit tests to pass in a $params without it getting overwritten. See also PR #2077 for some discussion of when the $params parameter was added as a passed in variable.
+    if (empty($params['is_unittest'])) {
+      $params = $this->controller->exportValues($this->_name);
+    }
 
     //set parent id if its edit mode
     if ($parentId = CRM_Utils_Array::value('parent_id', $this->_defaults)) {
index d0059b0cf23d0ec1dd77513709920f844ea41a86..6316f3a223c58c710faee75ef7e44781113b2481 100644 (file)
@@ -145,7 +145,7 @@ class CRM_Case_Form_Activity_ChangeCaseStatus {
   public static function beginPostProcess(&$form, &$params) {
     $params['id'] = CRM_Utils_Array::value('case_id', $params);
 
-    if ($params['updateLinkedCases'] === '1') {
+    if (CRM_Utils_Array::value('updateLinkedCases', $params) === '1') {
       $caseID = CRM_Utils_Array::first($form->_caseId);
       $cases = CRM_Case_BAO_Case::getRelatedCases($caseID);
 
index 37f794492e22f487e50d0addeeb02dc26d16d522..ed571d76f3ad37edddc1965634af4174d056967b 100644 (file)
@@ -204,7 +204,6 @@ class CRM_Case_Form_Activity_OpenCase {
         'type' => 'upload',
         'name' => ts('Save and New'),
         'subName' => 'new',
-        'submitOnce' => TRUE,
       ],
       [
         'type' => 'cancel',
index 7aabdfe48958360e2eb5f874e41c99fae3f8cff8..1391393294c2b284160a9c5f473d581242a336f4 100644 (file)
@@ -46,20 +46,20 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
   /**
    * Prefix for the controller
-   * @var sting
+   * @var string
    */
   protected $_prefix = 'case_';
 
index d32a9300ea13a65470a9cafe9e434365228e4b6c..b963126ccff1390fdcb7658cffcad287a2ad72fd 100644 (file)
@@ -40,14 +40,14 @@ class CRM_Case_Form_Task_Delete extends CRM_Case_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific case?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we moving case to Trash.
    *
-   * @var boolean
+   * @var bool
    */
   public $_moveToTrash = TRUE;
 
index db78e81b73cc19057cce73f10e124d3e50603c1e..8257943097c9bc838e05767fdc9e679ba7fa829a 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific case?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 55c396e60ee1260aded7a33a1f24b1c853e79f57..5a4ab88c8e03b6ed742912e6969a6d8c254a68d2 100644 (file)
@@ -72,14 +72,14 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base {
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
@@ -322,7 +322,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base {
       $isDeleted = FALSE;
       if ($result->case_deleted) {
         $isDeleted = TRUE;
-        $row['case_status_id'] = empty($row['case_status_id']) ? "" : $row['case_status_id'] . '<br />(deleted)';
+        $row['case_status_id'] = empty($row['case_status_id']) ? "" : $row['case_status_id'] . '<br />' . ts('(deleted)');
       }
 
       $scheduledInfo['case_id'][] = $result->case_id;
index 8224e22c1d6b47fd829eb30e559016b6da744441..98534dc95ec8fe2e6aababc572f8c1334ab6def5 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor {
   /**
    * The default variable defined.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isRedact;
 
index 252babe18a96afb5c663ed304a0036d8d4b4b92f..54011e77e3b91aa0da88799ea7d85d06520febf7 100644 (file)
@@ -43,12 +43,14 @@ class CRM_Case_XMLRepository {
   protected $xml = [];
 
   /**
-   * @var array|NULL
+   * @var array|null
    */
   protected $hookCache = NULL;
 
   /**
-   * @var array|NULL symbolic names of case-types
+   * Symbolic names of case-types.
+   *
+   * @var array|null
    */
   protected $allCaseTypes = NULL;
 
index d2bc999452e7a8a7accd46dd447d549a4053e3ce..5a22a86d7850614dd166ec3e224723876f565e74 100644 (file)
@@ -272,6 +272,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
       return $contact;
     }
 
+    if (!empty($params['contact_id']) && empty($params['contact_type'])) {
+      $params['contact_type'] = self::getContactType($params['contact_id']);
+    }
+
     $isEdit = TRUE;
     if ($invokeHooks) {
       if (!empty($params['contact_id'])) {
@@ -1732,7 +1736,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
    * @return array
    *   Contact details
    */
-  public static function getHierContactDetails($contactId, &$fields) {
+  public static function getHierContactDetails($contactId, $fields) {
     $params = array(array('contact_id', '=', $contactId, 0, 0));
     $options = array();
 
@@ -2069,7 +2073,7 @@ ORDER BY civicrm_email.is_primary DESC";
    */
   public static function formatProfileContactParams(
     &$params,
-    &$fields,
+    $fields,
     $contactID = NULL,
     $ufGroupId = NULL,
     $ctype = NULL,
index 81a93b376c9fd753645f0214df1d99d8f774b351..7c36b4c5ae1b3c9c78384cab7a83f98a7f999df1 100644 (file)
@@ -228,8 +228,9 @@ WHERE  id IN ( $idString )
     $inputLF = CRM_Utils_Array::value(2, $input);
 
     $check = self::generateChecksum($contactID, $inputTS, $inputLF);
-
-    if (!hash_equals($check, $inputCheck)) {
+    // Joomla_11 - If $inputcheck is null without explicitly casting to a string
+    // you get an error.
+    if (!hash_equals($check, (string) $inputCheck)) {
       return FALSE;
     }
 
index e5f9b4c6048bb034e2715314bcacf8551eb933f9..46840be319c430e970e5135e13ee3c89f411f551 100644 (file)
@@ -213,28 +213,28 @@ class CRM_Contact_BAO_Query {
   /**
    * Are we in search mode.
    *
-   * @var boolean
+   * @var bool
    */
   public $_search = TRUE;
 
   /**
    * Should we skip permission checking.
    *
-   * @var boolean
+   * @var bool
    */
   public $_skipPermission = FALSE;
 
   /**
    * Should we skip adding of delete clause.
    *
-   * @var boolean
+   * @var bool
    */
   public $_skipDeleteClause = FALSE;
 
   /**
    * Are we in strict mode (use equality over LIKE)
    *
-   * @var boolean
+   * @var bool
    */
   public $_strict = FALSE;
 
@@ -250,21 +250,21 @@ class CRM_Contact_BAO_Query {
   /**
    * Should we only search on primary location.
    *
-   * @var boolean
+   * @var bool
    */
   public $_primaryLocation = TRUE;
 
   /**
    * Are contact ids part of the query.
    *
-   * @var boolean
+   * @var bool
    */
   public $_includeContactIds = FALSE;
 
   /**
    * Should we use the smart group cache.
    *
-   * @var boolean
+   * @var bool
    */
   public $_smartGroupCache = TRUE;
 
@@ -286,7 +286,7 @@ class CRM_Contact_BAO_Query {
    * Should we enable the distinct clause, used if we are including
    * more than one group
    *
-   * @var boolean
+   * @var bool
    */
   public $_useDistinct = FALSE;
 
@@ -402,14 +402,16 @@ class CRM_Contact_BAO_Query {
    */
   protected $_rangeCache = [];
   /**
-   * Set to true when $this->relationship is run to avoid adding twice
-   * @var Boolean
+   * Set to true when $this->relationship is run to avoid adding twice.
+   *
+   * @var bool
    */
   protected $_relationshipValuesAdded = FALSE;
 
   /**
-   * Set to the name of the temp table if one has been created
-   * @var String
+   * Set to the name of the temp table if one has been created.
+   *
+   * @var string
    */
   public static $_relationshipTempTable = NULL;
 
@@ -541,8 +543,8 @@ class CRM_Contact_BAO_Query {
     if (array_key_exists('civicrm_membership', $this->_whereTables)) {
       $component = 'membership';
     }
-    if (isset($component)) {
-      // @todo should be if (isset($component && !$this->_skipPermission)
+    if (isset($component) && !$this->_skipPermission) {
+      // Unit test coverage in api_v3_FinancialTypeACLTest::testGetACLContribution.
       CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component);
     }
 
@@ -3002,25 +3004,13 @@ class CRM_Contact_BAO_Query {
         $regularGroupIDs[] = trim($id);
       }
     }
+    $hasNonSmartGroups = count($regularGroupIDs);
 
     $isNotOp = ($op == 'NOT IN' || $op == '!=');
 
-    $statii = [];
-    $gcsValues = $this->getWhereValues('group_contact_status', $grouping);
-    if ($gcsValues &&
-      is_array($gcsValues[2])
-    ) {
-      foreach ($gcsValues[2] as $k => $v) {
-        if ($v) {
-          $statii[] = "'" . CRM_Utils_Type::escape($k, 'String') . "'";
-        }
-      }
-    }
-    else {
-      $statii[] = "'Added'";
-    }
+    $statusJoinClause = $this->getGroupStatusClause($grouping);
     $groupClause = [];
-    if (count($regularGroupIDs) || empty($value)) {
+    if ($hasNonSmartGroups || empty($value)) {
       // include child groups IDs if any
       $childGroupIds = (array) CRM_Contact_BAO_Group::getChildGroupIds($regularGroupIDs);
       foreach ($childGroupIds as $key => $id) {
@@ -3063,8 +3053,8 @@ class CRM_Contact_BAO_Query {
       }
       $groupClause[] = "( {$clause} )";
 
-      if ($statii) {
-        $joinClause[] = "{$gcTable}.status IN (" . implode(', ', $statii) . ")";
+      if ($statusJoinClause) {
+        $joinClause[] = "{$gcTable}.$statusJoinClause";
       }
       $this->_tables[$gcTable] = $this->_whereTables[$gcTable] = " LEFT JOIN civicrm_group_contact {$gcTable} ON (" . implode(' AND ', $joinClause) . ")";
     }
@@ -3101,7 +3091,7 @@ class CRM_Contact_BAO_Query {
     list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contact_DAO_Group', 'id', $value, $op);
     $this->_qill[$grouping][] = ts("Group(s) %1 %2", [1 => $qillop, 2 => $qillVal]);
     if (strpos($op, 'NULL') === FALSE) {
-      $this->_qill[$grouping][] = ts("Group Status %1", [1 => implode(' ' . ts('or') . ' ', $statii)]);
+      $this->_qill[$grouping][] = ts("Group Status %1", [1 => implode(' ' . ts('or') . ' ', $this->getSelectedGroupStatuses($grouping))]);
     }
   }
 
@@ -6974,4 +6964,41 @@ AND   displayRelType.is_active = 1
     ];
   }
 
+  /**
+   * Get the clause for group status.
+   *
+   * @param int $grouping
+   *
+   * @return string
+   */
+  protected function getGroupStatusClause($grouping) {
+    $statuses = $this->getSelectedGroupStatuses($grouping);
+    return "status IN (" . implode(', ', $statuses) . ")";
+  }
+
+  /**
+   * Get an array of the statuses that have been selected.
+   *
+   * @param string $grouping
+   *
+   * @return array
+   */
+  protected function getSelectedGroupStatuses($grouping) {
+    $statuses = [];
+    $gcsValues = $this->getWhereValues('group_contact_status', $grouping);
+    if ($gcsValues &&
+      is_array($gcsValues[2])
+    ) {
+      foreach ($gcsValues[2] as $k => $v) {
+        if ($v) {
+          $statuses[] = "'" . CRM_Utils_Type::escape($k, 'String') . "'";
+        }
+      }
+    }
+    else {
+      $statuses[] = "'Added'";
+    }
+    return $statuses;
+  }
+
 }
index e271d16cb1332e6dc4d7b7d60e7c2ba4cdba2f64..2fc3d2629d8f03c7d5496ed25d175809792629f5 100644 (file)
@@ -473,7 +473,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
    */
   public static function getdefaults() {
     return array(
-      'is_active' => 0,
+      'is_active' => 1,
       'is_permission_a_b' => self::NONE,
       'is_permission_b_a' => self::NONE,
       'description' => '',
index 456ca86348653032423cf105c10a301523e67c5f..1134bf2a1c995e8f8b22a638d50bb848ff7e0713 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/ACLContactCache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ab40fa26e037ef4897359d3c288d42b8)
+ * (GenCodeChecksum:8bc987e1284d464f9b475686d9dc32a2)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_contact (could be null for anon user)
    *
-   * @var int unsigned
+   * @var int
    */
   public $user_id;
 
   /**
    * FK to civicrm_contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -141,7 +141,7 @@ class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_ACL_BAO_ACL::operation',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 736dffa2f7e561b904c286330d6b54026e1b4723..139e0e71c02a1a8218e3c0766fc07dc54f9368a5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/Contact.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:653579cbfa509d67ae7a39c78dd27bf2)
+ * (GenCodeChecksum:e2181ea97a3e309b7e74b636757b6aac)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * Unique Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -50,34 +50,34 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   public $contact_sub_type;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $do_not_email;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $do_not_phone;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $do_not_mail;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $do_not_sms;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $do_not_trade;
 
   /**
    * Has the contact opted out from receiving all bulk email from the organization or site domain?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_opt_out;
 
@@ -196,14 +196,14 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * Prefix or Title for name (Ms, Mr...). FK to prefix ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $prefix_id;
 
   /**
    * Suffix for name (Jr, Sr...). FK to suffix ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $suffix_id;
 
@@ -217,14 +217,14 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $communication_style_id;
 
   /**
    * FK to civicrm_option_value.id, that has to be valid registered Email Greeting.
    *
-   * @var int unsigned
+   * @var int
    */
   public $email_greeting_id;
 
@@ -245,7 +245,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.
    *
-   * @var int unsigned
+   * @var int
    */
   public $postal_greeting_id;
 
@@ -266,7 +266,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * FK to civicrm_option_value.id, that has to be valid registered Addressee.
    *
-   * @var int unsigned
+   * @var int
    */
   public $addressee_id;
 
@@ -294,7 +294,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * FK to gender ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $gender_id;
 
@@ -306,7 +306,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   public $birth_date;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_deceased;
 
@@ -327,7 +327,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * Optional FK to Primary Contact for this household.
    *
-   * @var int unsigned
+   * @var int
    */
   public $primary_contact_id;
 
@@ -355,12 +355,12 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
   /**
    * OPTIONAL FK to civicrm_contact record.
    *
-   * @var int unsigned
+   * @var int
    */
   public $employer_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_deleted;
 
@@ -446,7 +446,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NULL',
-          ]
+          ],
         ],
         'contact_sub_type' => [
           'name' => 'contact_sub_type',
@@ -472,7 +472,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NOT NULL',
-          ]
+          ],
         ],
         'do_not_email' => [
           'name' => 'do_not_email',
@@ -586,8 +586,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'name' => 'legal_identifier',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Legal Identifier'),
-          'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
-    '),
+          'description' => ts('May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.'),
           'maxlength' => 32,
           'size' => CRM_Utils_Type::MEDIUM,
           'import' => TRUE,
@@ -735,7 +734,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'preferred_communication_method',
             'optionEditPath' => 'civicrm/admin/options/preferred_communication_method',
-          ]
+          ],
         ],
         'preferred_language' => [
           'name' => 'preferred_language',
@@ -759,7 +758,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
             'optionGroupName' => 'languages',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/languages',
-          ]
+          ],
         ],
         'preferred_mail_format' => [
           'name' => 'preferred_mail_format',
@@ -782,7 +781,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::pmf',
-          ]
+          ],
         ],
         'hash' => [
           'name' => 'hash',
@@ -806,6 +805,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'maxlength' => 32,
           'size' => CRM_Utils_Type::MEDIUM,
           'where' => 'civicrm_contact.api_key',
+          'protected' => 'true',
           'table_name' => 'civicrm_contact',
           'entity' => 'Contact',
           'bao' => 'CRM_Contact_BAO_Contact',
@@ -910,7 +910,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'individual_prefix',
             'optionEditPath' => 'civicrm/admin/options/individual_prefix',
-          ]
+          ],
         ],
         'suffix_id' => [
           'name' => 'suffix_id',
@@ -932,7 +932,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'individual_suffix',
             'optionEditPath' => 'civicrm/admin/options/individual_suffix',
-          ]
+          ],
         ],
         'formal_title' => [
           'name' => 'formal_title',
@@ -970,7 +970,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'communication_style',
             'optionEditPath' => 'civicrm/admin/options/communication_style',
-          ]
+          ],
         ],
         'email_greeting_id' => [
           'name' => 'email_greeting_id',
@@ -986,7 +986,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'email_greeting',
             'optionEditPath' => 'civicrm/admin/options/email_greeting',
-          ]
+          ],
         ],
         'email_greeting_custom' => [
           'name' => 'email_greeting_custom',
@@ -1039,7 +1039,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'postal_greeting',
             'optionEditPath' => 'civicrm/admin/options/postal_greeting',
-          ]
+          ],
         ],
         'postal_greeting_custom' => [
           'name' => 'postal_greeting_custom',
@@ -1089,7 +1089,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'addressee',
             'optionEditPath' => 'civicrm/admin/options/addressee',
-          ]
+          ],
         ],
         'addressee_custom' => [
           'name' => 'addressee_custom',
@@ -1164,7 +1164,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'gender',
             'optionEditPath' => 'civicrm/admin/options/gender',
-          ]
+          ],
         ],
         'birth_date' => [
           'name' => 'birth_date',
index f76bbaab4cf3acbc955f34b0b4c634c8acf92843..a999b9d40292d1ef6aca1d69d848b9eb2a4eca88 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/ContactType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ab123a55d492c003df354c32e8b9863c)
+ * (GenCodeChecksum:adba53a6a4d64ba498d7e36b03c0f968)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
   /**
    * Contact Type ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,21 +66,21 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
   /**
    * Optional FK to parent contact type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Is this entry active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this contact type a predefined system type
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
@@ -198,7 +198,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
             'keyColumn' => 'id',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NULL',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
index 4585ec169af047e4bcf0a2ed649140315aa33aab..edb5b3e3528b701c819442acaeb666c904793fbf 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/DashboardContact.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f9be53bdf3d5151edf77e9b9f9004571)
+ * (GenCodeChecksum:2adb5645722410e9059da0a345a0a30b)
  */
 
 /**
@@ -29,35 +29,35 @@ class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Dashboard ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $dashboard_id;
 
   /**
    * Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * column no for this widget
    *
-   * @var boolean
+   * @var bool
    */
   public $column_no;
 
   /**
    * Is this widget active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index 1174320105e3e1798b5f70751ed592566194e78a..3e2eddaf1f04e8cc1bccceb4bb3c14b9f27dcace 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/Group.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:48373e283a62b36aa59ac812f8cb4134)
+ * (GenCodeChecksum:28c32e7038a2b7aa7ca2c45117660974)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
   /**
    * Group ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,14 +66,14 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
   /**
    * FK to saved search table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $saved_search_id;
 
   /**
    * Is this entry active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -143,26 +143,26 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
   /**
    * Is this group hidden?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_hidden;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * FK to contact table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
   /**
    * FK to contact table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $modified_id;
 
@@ -236,6 +236,9 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
           'entity' => 'Group',
           'bao' => 'CRM_Contact_BAO_Group',
           'localizable' => 1,
+          'html' => [
+            'type' => 'Text',
+          ],
         ],
         'description' => [
           'name' => 'description',
@@ -307,7 +310,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::groupVisibility',
-          ]
+          ],
         ],
         'where_clause' => [
           'name' => 'where_clause',
@@ -360,7 +363,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'group_type',
             'optionEditPath' => 'civicrm/admin/options/group_type',
-          ]
+          ],
         ],
         'cache_date' => [
           'name' => 'cache_date',
@@ -399,7 +402,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO {
           'serialize' => self::SERIALIZE_COMMA,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_PseudoConstant::allGroup',
-          ]
+          ],
         ],
         'children' => [
           'name' => 'children',
index 8980f8c8bf9df2f89e33465d52af6ba5e0c8e14b..ba7352ccf1923c971427e5ebc9fc49489adb51d6 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/GroupContact.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1d229cf09854f6b9a9991a0c0bd86c87)
+ * (GenCodeChecksum:abb2a96c7fd72f93619b605fbb11b4b5)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_group
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
   /**
    * FK to civicrm_contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -59,14 +59,14 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO {
   /**
    * Optional location to associate with this membership
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_id;
 
   /**
    * Optional email to associate with this membership
    *
-   * @var int unsigned
+   * @var int
    */
   public $email_id;
 
@@ -135,7 +135,7 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'contact_id' => [
           'name' => 'contact_id',
@@ -167,7 +167,7 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::groupContactStatus',
-          ]
+          ],
         ],
         'location_id' => [
           'name' => 'location_id',
index 0370dcc98c1931cf936373bd075a372430d81641..c6697590c45e9783378879e9cb1a0fdb8bace286 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/GroupContactCache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:98cff858204d34551eec0b9bee6e24af)
+ * (GenCodeChecksum:217f20fad2d47f50e3a9c43b62df2c17)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupContactCache extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_group
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
   /**
    * FK to civicrm_contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -112,7 +112,7 @@ class CRM_Contact_DAO_GroupContactCache extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'contact_id' => [
           'name' => 'contact_id',
index e2d83582c81d69ec4f92290b37187524f5b65135..bbc3cf99366886d09199cf35c88efecac4d9c9c3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/GroupNesting.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:dcf20d8789668c4542bc0c5d5faa1e8e)
+ * (GenCodeChecksum:2559ff6c3da8f02b147577a6d4e26004)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupNesting extends CRM_Core_DAO {
   /**
    * Relationship ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * ID of the child group
    *
-   * @var int unsigned
+   * @var int
    */
   public $child_group_id;
 
   /**
    * ID of the parent group
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_group_id;
 
index b16db55d397c34a4146cba2309f9a936596a0e12..d35db86708f7015ab4fbe25571213e389badd05f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/GroupOrganization.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4234ea5a60e2a053e2de768a10cb1488)
+ * (GenCodeChecksum:00717d9edb0719d380b5fd7c3e91bc74)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupOrganization extends CRM_Core_DAO {
   /**
    * Relationship ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * ID of the group
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
   /**
    * ID of the Organization Contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $organization_id;
 
@@ -112,7 +112,7 @@ class CRM_Contact_DAO_GroupOrganization extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'organization_id' => [
           'name' => 'organization_id',
index f6dcce482c6edac33aa234a87cbca19d305ffcb6..0eb497e53b380317d41b6944959a7a7b10028a86 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/Relationship.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0722d901c4eac4e462bc7de9887e605a)
+ * (GenCodeChecksum:ebfcea88ae4bd09a0821a942ecdfa4db)
  */
 
 /**
@@ -31,28 +31,28 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
   /**
    * Relationship ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * id of the first contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id_a;
 
   /**
    * id of the second contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id_b;
 
   /**
    * id of the relationship
    *
-   * @var int unsigned
+   * @var int
    */
   public $relationship_type_id;
 
@@ -73,7 +73,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
   /**
    * is the relationship active ?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -87,21 +87,21 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
   /**
    * Permission that Contact A has to view/update Contact B
    *
-   * @var int unsigned
+   * @var int
    */
   public $is_permission_a_b;
 
   /**
    * Permission that Contact B has to view/update Contact A
    *
-   * @var int unsigned
+   * @var int
    */
   public $is_permission_b_a;
 
   /**
    * FK to civicrm_case
    *
-   * @var int unsigned
+   * @var int
    */
   public $case_id;
 
@@ -274,7 +274,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getPermissionedRelationshipOptions',
-          ]
+          ],
         ],
         'is_permission_b_a' => [
           'name' => 'is_permission_b_a',
@@ -293,7 +293,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getPermissionedRelationshipOptions',
-          ]
+          ],
         ],
         'case_id' => [
           'name' => 'case_id',
index 7a3a77e310bfe231a4fdec86ba4343dcb3e662e4..edb59a6b76d131d23bbd0608b2f16d9d982619d2 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/RelationshipType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9fa07d6d85caa27a637694324ea5b740)
+ * (GenCodeChecksum:78a8cea89e73b1a409f7908ad08cf99e)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
   /**
    * Primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -101,14 +101,14 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
   /**
    * Is this relationship type a predefined system type (can not be changed or de-activated)?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -234,7 +234,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NULL',
-          ]
+          ],
         ],
         'contact_type_b' => [
           'name' => 'contact_type_b',
@@ -256,14 +256,13 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NULL',
-          ]
+          ],
         ],
         'contact_sub_type_a' => [
           'name' => 'contact_sub_type_a',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Contact Subtype A'),
-          'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
-    '),
+          'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.'),
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
           'where' => 'civicrm_relationship_type.contact_sub_type_a',
@@ -279,14 +278,13 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NOT NULL',
-          ]
+          ],
         ],
         'contact_sub_type_b' => [
           'name' => 'contact_sub_type_b',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Contact Subtype B'),
-          'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
-    '),
+          'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.'),
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
           'where' => 'civicrm_relationship_type.contact_sub_type_b',
@@ -302,7 +300,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NOT NULL',
-          ]
+          ],
         ],
         'is_reserved' => [
           'name' => 'is_reserved',
@@ -322,8 +320,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
           'name' => 'is_active',
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Relationship Type is Active'),
-          'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
-    '),
+          'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'),
           'where' => 'civicrm_relationship_type.is_active',
           'default' => '1',
           'table_name' => 'civicrm_relationship_type',
index b7fd62c31a36e7f6037962c6e20b202179d9bb13..32eab9829360f3801769d5a691bec173e92e4c34 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/SavedSearch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ff337d9810d6c4d6225f77b6b3007729)
+ * (GenCodeChecksum:556322817dc9b7b9dab015e1f0179fb7)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
   /**
    * Saved Search ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
   /**
    * Foreign key to civicrm_mapping used for saved search-builder searches.
    *
-   * @var int unsigned
+   * @var int
    */
   public $mapping_id;
 
   /**
    * Foreign key to civicrm_option value table used for saved custom searches.
    *
-   * @var int unsigned
+   * @var int
    */
   public $search_custom_id;
 
index 1df68f7f335699ac5f4d743c37bf8c27a75b58c8..dd16bbcd649849b656c0769b7ec1bf8666220062 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/SubscriptionHistory.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8051a666011690a9dfb14d91a013a3e0)
+ * (GenCodeChecksum:af7ac35767e88f1dd090f54ab44c3b35)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO {
   /**
    * Internal Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Contact Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Group Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
@@ -152,7 +152,7 @@ class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'date' => [
           'name' => 'date',
@@ -184,7 +184,7 @@ class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods',
-          ]
+          ],
         ],
         'status' => [
           'name' => 'status',
@@ -200,7 +200,7 @@ class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::groupContactStatus',
-          ]
+          ],
         ],
         'tracking' => [
           'name' => 'tracking',
index c33f4d5010e7d3534ffb4fc6a431ae4e937ecd0d..318138ff760792c1a1ebf924fbb73e4f6d8c1806 100644 (file)
@@ -113,22 +113,16 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
     );
 
     $this->addField('used', ['label' => ts('Usage')], TRUE);
-    $disabled = [];
     $reserved = $this->addField('is_reserved', ['label' => ts('Reserved?')]);
     if (!empty($this->_defaults['is_reserved'])) {
       $reserved->freeze();
     }
 
     $attributes = ['class' => 'two'];
-    if (!empty($disabled)) {
-      $attributes = array_merge($attributes, $disabled);
-    }
 
     for ($count = 0; $count < self::RULES_COUNT; $count++) {
       $this->add('select', "where_$count", ts('Field'),
-        [
-          NULL => ts('- none -'),
-        ] + $this->_fields, FALSE, $disabled
+        $this->_fields, FALSE, ['class' => 'crm-select2', 'placeholder' => ts('Select Field')]
       );
       $this->addField("length_$count", ['entity' => 'Rule', 'name' => 'rule_length'] + $attributes);
       $this->addField("weight_$count", ['entity' => 'Rule', 'name' => 'rule_weight'] + $attributes);
index 297b0f3face60e0724cf8fded3845c83675d72aa..9af7f55b17924d14a026b0e96d2b8efd3a46f52c 100644 (file)
@@ -120,7 +120,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
   /**
    * The profile group id used for display.
    *
-   * @var integer
+   * @var int
    */
   protected $_ufGroupID;
 
@@ -132,13 +132,16 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
   public static $csv = ['contact_type', 'group', 'tag'];
 
   /**
-   * @var string how to display the results. Should we display as
-   *             contributons, members, cases etc
+   * How to display the results. Should we display as contributons, members, cases etc.
+   *
+   * @var string
    */
   protected $_componentMode;
 
   /**
-   * @var string what operator should we use, AND or OR
+   * What operator should we use, AND or OR.
+   *
+   * @var string
    */
   protected $_operator;
 
index e8868722cb9edcf7dbda5a240abd9eda2afecaa7..46050f87819f2b105271642f41eef99a8f601699 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
   const LIMIT = 10;
 
   /**
-   * @var array CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery
+   * @var CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery[]
    */
   protected $_partialQueries = NULL;
 
@@ -54,23 +54,37 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
   protected $_tableFields = NULL;
 
   /**
-   * @var array|null NULL if no limit; or array(0 => $limit, 1 => $offset)
+   * Limit clause.
+   *
+   * NULL if no limit; or array(0 => $limit, 1 => $offset).
+   *
+   * @var array|null
    */
   protected $_limitClause = NULL;
 
   /**
-   * @var array|null NULL if no limit; or array(0 => $limit, 1 => $offset)
+   * Limit row clause.
+   *
+   * NULL if no limit; or array(0 => $limit, 1 => $offset)
+   *
+   * @var array|null
    */
   protected $_limitRowClause = NULL;
 
   /**
-   * @var array|null NULL if no limit; or array(0 => $limit, 1 => $offset)
+   * Limit detail clause.
+   *
+   * NULL if no limit; or array(0 => $limit, 1 => $offset).
+   *
+   * @var array|null
    */
   protected $_limitDetailClause = NULL;
 
   protected $_limitNumber = 10;
+
   /**
-   * this should be one more than self::LIMIT
+   * This should be one more than self::LIMIT.
+   *
    * @var int
    */
   protected $_limitNumberPlus1 = 11;
@@ -151,7 +165,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
   }
 
   public function buildTempTable() {
-    $table = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory()->setUtf8();
+    $table = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory();
     $this->_tableName = $table->getName();
 
     $this->_tableFields = [
@@ -216,7 +230,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
 ";
     $table->createWithColumns($sql);
 
-    $entityIdTable = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory()->setUtf8();
+    $entityIdTable = CRM_Utils_SQL_TempTable::build()->setCategory('custom')->setMemory();
     $this->_entityIDTableName = $entityIdTable->getName();
     $sql = "
   id int unsigned NOT NULL AUTO_INCREMENT,
index 76c7efbc369a031982803f89150eb8a1918d913d..92c4ddd71b9687e4057675e68f65d6a3eceac42f 100644 (file)
@@ -153,11 +153,12 @@ class CRM_Contact_Form_Search_Custom_Group extends CRM_Contact_Form_Search_Custo
   /**
    * @param int $offset
    * @param int $rowcount
-   * @param NULL $sort
+   * @param string $sort
    * @param bool $includeContactIDs
    * @param bool $justIDs
    *
    * @return string
+   * @throws \Exception
    */
   public function all(
     $offset = 0, $rowcount = 0, $sort = NULL,
@@ -587,10 +588,11 @@ WHERE  gcc.group_id = {$ssGroup->id}
   /**
    * @param int $offset
    * @param int $rowcount
-   * @param NULL $sort
+   * @param string $sort
    * @param bool $returnSQL
    *
    * @return string
+   * @throws \Exception
    */
   public function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
     return $this->all($offset, $rowcount, $sort, FALSE, TRUE);
index 8e1c3a3aa14543abacc470e6728522606ad855a2..397a8d50a99fecd3ed45a7bd6b4625fa4cfd5a05 100644 (file)
@@ -154,7 +154,7 @@ class CRM_Contact_Form_Task extends CRM_Core_Form_Task {
     $form->assign('taskName', CRM_Utils_Array::value($form->_task, $crmContactTaskTasks));
 
     if ($useTable) {
-      $tempTable = CRM_Utils_SQL_TempTable::build()->setCategory('tskact')->setDurable()->setId($qfKey)->setUtf8();
+      $tempTable = CRM_Utils_SQL_TempTable::build()->setCategory('tskact')->setDurable()->setId($qfKey);
       $form->_componentTable = $tempTable->getName();
       $tempTable->drop();
       $tempTable->createWithColumns('contact_id int primary key');
index 3411f67d05f0d24d6ab2038c4f1f8342b8b14441..b1f0160902ae2151faa7c95f7e277c5adf1328b6 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index d8dd851e33494c6328d0c98ed61aa74256f4facb..60c38d3e7160e139f02ad9212727dff4aff9fd28 100644 (file)
@@ -41,7 +41,7 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
    *
    * Single mode means sending email to one specific contact.
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
@@ -49,7 +49,7 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_noEmails = FALSE;
 
index 82e1af323efa461375052163465df04411d59440..89c52caf3b33b02ca8f3b05ba394fb1ebd303da2 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task {
    * Are we operating in "single mode", i.e. mapping address to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 113c763cd21817989b6f93d899cd2a0280fccd6d..b6a13f6cbc893ceddaac9a9a639512dacaeb3aa0 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task {
    * Are we operating in "single mode", i.e. sending sms to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index f871162a3433de67a4fb493d2548cb61a9d1cf91..1b888a6b53f8586f133473b5c7a866f9c3c044e9 100644 (file)
@@ -67,7 +67,7 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task {
     }
 
     // Get Task name
-    $modeValue = CRM_Contact_Form_Search::getModeValue($values['component_mode']);
+    $modeValue = CRM_Contact_Form_Search::getModeValue(CRM_Utils_Array::value('component_mode', $values, CRM_Contact_BAO_Query::MODE_CONTACTS));
     $className = $modeValue['taskClassName'];
     $taskList = $className::taskTitles();
     $this->_task = CRM_Utils_Array::value('task', $values);
index a1abc023439e6c8816469abe5f0b4b96b05ed7fb..9d6b2d8fa398a3f40e082254b4ef3af4c8e6e086 100644 (file)
@@ -55,7 +55,7 @@ class CRM_Contact_Import_Field {
 
   /**
    * Is this field required
-   * @var boolean
+   * @var bool
    */
   public $_required;
 
index 1cec44c09e8d921bd0ee454a099645086a9d838f..fff23875c7a71c0f3089d5a335794ce2e6b45dae 100644 (file)
@@ -416,7 +416,7 @@ class CRM_Contact_Import_ImportJob {
     $result = CRM_Core_DAO::executeQuery($query, array($database));
     $incompleteImportTables = array();
     while ($importTable = $result->fetch()) {
-      if (!$this->isComplete($importTable)) {
+      if (!self::isComplete($importTable)) {
         $incompleteImportTables[] = $importTable;
       }
     }
index ec054e8688b8af8438491f1f5ecbee841544641f..827eeff9fa34ea4080df9dd4e6f0d456f02fbaf4 100644 (file)
@@ -37,18 +37,20 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
   /**
    * Total number of lines in file
    *
-   * @var integer
+   * @var int
    */
   protected $_rowCount;
 
   /**
    * Running total number of un-matched Contacts.
+   *
    * @var int
    */
   protected $_unMatchCount;
 
   /**
-   * Array of unmatched lines
+   * Array of unmatched lines.
+   *
    * @var array
    */
   protected $_unMatch;
@@ -69,6 +71,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
   protected $_primaryKeyName;
   protected $_statusFieldName;
 
+  protected $fieldMetadata = [];
   /**
    * On duplicate
    *
@@ -846,7 +849,13 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
           }
 
           if (!$break) {
-            $this->formatContactParameters($value, $formatted);
+            if (!empty($value['location_type_id'])) {
+              $this->formatLocationBlock($value, $formatted);
+            }
+            else {
+              CRM_Core_Error::deprecatedFunctionWarning('this is not expected to be reachable now');
+              $this->formatContactParameters($value, $formatted);
+            }
           }
         }
         if (!$isAddressCustomField) {
@@ -1129,7 +1138,8 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
 
     // get the formatted location blocks into params - w/ 3.0 format, CRM-4605
     if (!empty($values['location_type_id'])) {
-      return $this->formatLocationBlock($values, $params, $fields);
+      CRM_Core_Error::deprecatedFunctionWarning('this is not expected to be reachable now');
+      return $this->formatLocationBlock($values, $params);
     }
 
     if (isset($values['note'])) {
@@ -1188,14 +1198,10 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
    *
    * @param array $values
    * @param array $params
-   * @param array $fields
    *
    * @return bool
    */
-  protected function formatLocationBlock(&$values, &$params, $fields) {
-    if (empty($values['location_type_id'])) {
-      return FALSE;
-    }
+  protected function formatLocationBlock(&$values, &$params) {
     $blockTypes = [
       'phone' => 'Phone',
       'email' => 'Email',
@@ -1213,12 +1219,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
         $params[$blockFieldName] = [];
       }
 
-      if (!array_key_exists($block, $fields)) {
-        $className = "CRM_Core_DAO_$block";
-        $fields[$block] = $className::fields();
-      }
-
-      $blockCnt = count($params[$blockFieldName]);
+      $fields[$block] = $this->getMetadataForEntity($block);
 
       // copy value to dao field name.
       if ($blockFieldName == 'im') {
@@ -1226,25 +1227,13 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       }
 
       _civicrm_api3_store_values($fields[$block], $values,
-        $params[$blockFieldName][++$blockCnt]
+        $params[$blockFieldName][$values['location_type_id']]
       );
 
-      if ($values['location_type_id'] === 'Primary') {
-        if (!empty($params['id'])) {
-          $primary = civicrm_api3($block, 'get', [
-            'return' => 'location_type_id',
-            'contact_id' => $params['id'],
-            'is_primary' => 1,
-            'sequential' => 1
-          ]);
-        }
-        $defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
-        $values['location_type_id'] = (isset($primary) && $primary['count']) ? $primary['values'][0]['location_type_id'] : $defaultLocationType->id;
-        $values['is_primary'] = 1;
-      }
+      $this->fillPrimary($params[$blockFieldName][$values['location_type_id']], $values, $block, CRM_Utils_Array::value('id', $params));
 
-      if (empty($params['id']) && ($blockCnt == 1)) {
-        $params[$blockFieldName][$blockCnt]['is_primary'] = TRUE;
+      if (empty($params['id']) && (count($params[$blockFieldName]) == 1)) {
+        $params[$blockFieldName][$values['location_type_id']]['is_primary'] = TRUE;
       }
 
       // we only process single block at a time.
@@ -1256,10 +1245,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       $params['address'] = [];
     }
 
-    if (!array_key_exists('Address', $fields)) {
-      $fields['Address'] = CRM_Core_DAO_Address::fields();
-    }
-
     // Note: we doing multiple value formatting here for address custom fields, plus putting into right format.
     // The actual formatting (like date, country ..etc) for address custom fields is taken care of while saving
     // the address in CRM_Core_BAO_Address::create method
@@ -1273,8 +1258,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       foreach ($values as $key => $val) {
         $customFieldID = CRM_Core_BAO_CustomField::getKeyID($key);
         if ($customFieldID && array_key_exists($customFieldID, $customFields)) {
-          // mark an entry in fields array since we want the value of custom field to be copied
-          $fields['Address'][$key] = NULL;
 
           $htmlType = CRM_Utils_Array::value('html_type', $customFields[$customFieldID]);
           switch ($htmlType) {
@@ -1307,6 +1290,8 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       $values = $newValues;
     }
 
+    $fields['Address'] = $this->getMetadataForEntity('Address');
+    // @todo this is kinda replicated below....
     _civicrm_api3_store_values($fields['Address'], $values, $params['address'][$values['location_type_id']]);
 
     $addressFields = [
@@ -1318,6 +1303,9 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       'supplemental_address_3',
       'StateProvince.name',
     ];
+    foreach (array_keys($customFields) as $customFieldID) {
+      $addressFields[] = 'custom_' . $customFieldID;
+    }
 
     foreach ($addressFields as $field) {
       if (array_key_exists($field, $values)) {
@@ -1328,21 +1316,53 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
       }
     }
 
+    $this->fillPrimary($params['address'][$values['location_type_id']], $values, 'address', CRM_Utils_Array::value('id', $params));
+    return TRUE;
+  }
+
+  /**
+   * Get the field metadata for the relevant entity.
+   *
+   * @param string $entity
+   *
+   * @return array
+   */
+  protected function getMetadataForEntity($entity) {
+    if (!isset($this->fieldMetadata[$entity])) {
+      $className = "CRM_Core_DAO_$entity";
+      $this->fieldMetadata[$entity] = $className::fields();
+    }
+    return $this->fieldMetadata[$entity];
+  }
+
+  /**
+   * Fill in the primary location.
+   *
+   * If the contact has a primary address we update it. Otherwise
+   * we add an address of the default location type.
+   *
+   * @param array $params
+   *   Address block parameters
+   * @param array $values
+   *   Input values
+   * @param string $entity
+   *  - address, email, phone
+   * @param int|NULL $contactID
+   */
+  protected function fillPrimary(&$params, $values, $entity, $contactID) {
     if ($values['location_type_id'] === 'Primary') {
-      if (!empty($params['id'])) {
-        $primary = civicrm_api3('Address', 'get', [
+      if ($contactID) {
+        $primary = civicrm_api3($entity, 'get', [
           'return' => 'location_type_id',
-          'contact_id' => $params['id'],
+          'contact_id' => $contactID,
           'is_primary' => 1,
-          'sequential' => 1
+          'sequential' => 1,
         ]);
       }
       $defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
-      $params['address'][$values['location_type_id']]['location_type_id'] = (isset($primary) && $primary['count']) ? $primary['values'][0]['location_type_id'] : $defaultLocationType->id;
-      $params['address'][$values['location_type_id']]['is_primary'] = 1;
-
+      $params['location_type_id'] = (int) (isset($primary) && $primary['count']) ? $primary['values'][0]['location_type_id'] : $defaultLocationType->id;
+      $params['is_primary'] = 1;
     }
-    return TRUE;
   }
 
 }
index f354d12bea9d29d3e418f2ed73d3f7b861df8cbf..a0df0b92ddb3c294a09035182b55fe2849f46077 100644 (file)
@@ -938,7 +938,10 @@ LIMIT {$offset}, {$rowCount}
   public static function flipDupePairs($prevNextId = NULL) {
     if (!$prevNextId) {
       // @todo figure out if this is always POST & specify that rather than inexact GET
-      $prevNextId = CRM_Utils_Request::retrieve('pnid', 'Integer');
+
+      // We cannot use CRM_Utils_Request::retrieve() because it might be an array.
+      // It later gets validated in escapeAll below.
+      $prevNextId = $_REQUEST['pnid'];
     }
 
     $onlySelected = FALSE;
index cb73cb3c20395166824722f496ea65ff2e3ca30d..48452d215d6f1df9faff121a704fb21494950e84 100644 (file)
@@ -81,10 +81,9 @@ class CRM_Contact_Page_DedupeException extends CRM_Core_Page {
   /**
    * Function to get the exceptions
    *
-   * @return array $exceptions
-   * @access protected
+   * @return array $exceptionsd
    */
-  protected function getExceptions() {
+  public function getExceptions() {
     list($offset, $limit) = $this->_pager->getOffsetAndRowCount();
     $contactOneQ = CRM_Utils_Request::retrieve('crmContact1Q', 'String');
 
index 56eba2c9846b07d1b264606b903c917820559f66..8b22a7140d9286a084c5a455f079210133b1608a 100644 (file)
@@ -182,7 +182,7 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
         CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
       }
 
-      $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, !$isConflictMode, 0, $this->isSelected(), '', $isConflictMode, $criteria, TRUE, $limit);
+      $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, !$isConflictMode, 0, $this->isSelected(), $isConflictMode, $criteria, TRUE, $limit);
 
       if (empty($this->_mainContacts)) {
         if ($isConflictMode) {
index 9ea30c409b34f6be0084002a6c05e61788a366da..a567356a53cf35afa016939fd710e37a58f9be28 100644 (file)
@@ -32,7 +32,9 @@
  */
 class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
   /**
-   * @var int Time to live (seconds).
+   * Time to live (seconds).
+   *
+   * @var int
    *
    * 12 hours: 12 * 60 * 60 = 43200
    */
index d018f62402ddce7defaed0a8f76fa3904c1ce007..0c323100a45e18da78aa279173bc653dd67587e3 100644 (file)
 class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page {
 
   /**
-   * @var int contact id
+   * Contact id.
+   *
+   * @var int
    */
   public $_contactId;
 
   /**
-   * called when action is browse.
-   *
+   * Called when action is browse.
    */
   public function browse() {
     $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added');
index 2930341be709a478f7985f6821fdda58494fd9bc..9fe30dc03bdf99ba4144791c2fda63deaba0e5cf 100644 (file)
@@ -50,6 +50,12 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
    */
   public static $_commentLinks = NULL;
 
+  /**
+   * Notes found running the browse function
+   * @var array
+   */
+  public $values = [];
+
   /**
    * View details of a note.
    */
@@ -57,14 +63,13 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
     $note = new CRM_Core_DAO_Note();
     $note->id = $this->_id;
     if ($note->find(TRUE)) {
-      $values = [];
 
-      CRM_Core_DAO::storeValues($note, $values);
-      $values['privacy'] = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Note', 'privacy', $values['privacy']);
-      $this->assign('note', $values);
+      CRM_Core_DAO::storeValues($note, $this->values);
+      $this->values['privacy'] = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Note', 'privacy', $this->values['privacy']);
+      $this->assign('note', $this->values);
     }
 
-    $comments = CRM_Core_BAO_Note::getNoteTree($values['id'], 1);
+    $comments = CRM_Core_BAO_Note::getNoteTree($this->values['id'], 1);
     if (!empty($comments)) {
       $this->assign('comments', $comments);
     }
@@ -96,16 +101,15 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
 
     $this->assign('canAddNotes', CRM_Core_Permission::check('add contact notes'));
 
-    $values = [];
     $links = self::links();
     $action = array_sum(array_keys($links)) & $mask;
 
     $note->find();
     while ($note->fetch()) {
       if (!CRM_Core_BAO_Note::getNotePrivacyHidden($note)) {
-        CRM_Core_DAO::storeValues($note, $values[$note->id]);
+        CRM_Core_DAO::storeValues($note, $this->values[$note->id]);
 
-        $values[$note->id]['action'] = CRM_Core_Action::formLink($links,
+        $this->values[$note->id]['action'] = CRM_Core_Action::formLink($links,
           $action,
           [
             'id' => $note->id,
@@ -122,17 +126,16 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
           $contact->id = $note->contact_id;
           $contact->find();
           $contact->fetch();
-          $values[$note->id]['createdBy'] = $contact->display_name;
+          $this->values[$note->id]['createdBy'] = $contact->display_name;
         }
-        $values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
+        $this->values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id);
 
         // paper icon view for attachments part
         $paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id);
-        $values[$note->id]['attachment'] = $paperIconAttachmentInfo;
+        $this->values[$note->id]['attachment'] = $paperIconAttachmentInfo;
       }
     }
-
-    $this->assign('notes', $values);
+    $this->assign('notes', $this->values);
 
     $commentLinks = self::commentLinks();
 
index 48e16a4dbf27fcec5c0434e1df457e5f5a2f5dff..ad3e88caa426b2b2ceabe610b0fe01f10de25cc1 100644 (file)
@@ -55,9 +55,10 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
 
   /**
    * Field for all the objects related to this contribution
+   *
    * @var array of objects (e.g membership object, participant object)
    */
-  public $_relatedObjects = array();
+  public $_relatedObjects = [];
 
   /**
    * Field for the component - either 'event' (participant) or 'contribute'
@@ -99,26 +100,27 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    *
    * @return \CRM_Contribute_BAO_Contribution
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public static function add(&$params, $ids = array()) {
+  public static function add(&$params, $ids = []) {
     if (empty($params)) {
       return NULL;
     }
     //per http://wiki.civicrm.org/confluence/display/CRM/Database+layer we are moving away from $ids array
     $contributionID = CRM_Utils_Array::value('contribution', $ids, CRM_Utils_Array::value('id', $params));
-    $duplicates = array();
+    $duplicates = [];
     if (self::checkDuplicate($params, $duplicates, $contributionID)) {
       $message = ts("Duplicate error - existing contribution record(s) have a matching Transaction ID or Invoice ID. Contribution record ID(s) are: " . implode(', ', $duplicates));
       throw new CRM_Core_Exception($message);
     }
 
     // first clean up all the money fields
-    $moneyFields = array(
+    $moneyFields = [
       'total_amount',
       'net_amount',
       'fee_amount',
       'non_deductible_amount',
-    );
+    ];
 
     //if priceset is used, no need to cleanup money
     if (!empty($params['skipCleanMoney'])) {
@@ -161,12 +163,15 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     else {
       // Since the fee amount is expecting this (later on) ensure it is always set.
       // It would only not be set for an update where it is unchanged.
-      $params['contribution_status_id'] = civicrm_api3('Contribution', 'getvalue', array('id' => $contributionID, 'return' => 'contribution_status_id'));
+      $params['contribution_status_id'] = civicrm_api3('Contribution', 'getvalue', [
+        'id' => $contributionID,
+        'return' => 'contribution_status_id',
+      ]);
     }
 
     if (!$contributionID
       && CRM_Utils_Array::value('membership_id', $params)
-      && self::checkContributeSettings('deferred_revenue_enabled')
+      && Civi::settings()->get('deferred_revenue_enabled')
     ) {
       $memberStartDate = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['membership_id'], 'start_date');
       if ($memberStartDate) {
@@ -287,15 +292,16 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
 
   /**
    * Get defaults for new entity.
+   *
    * @return array
    */
   public static function getDefaults() {
-    return array(
+    return [
       'payment_instrument_id' => key(CRM_Core_OptionGroup::values('payment_instrument',
-          FALSE, FALSE, FALSE, 'AND is_default = 1')
+        FALSE, FALSE, FALSE, 'AND is_default = 1')
       ),
-      'contribution_status_id' => CRM_Core_Pseudoconstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'),
-    );
+      'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'),
+    ];
   }
 
   /**
@@ -348,7 +354,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    * @throws CRM_Core_Exception
    */
   public static function getValuesWithMappings($params) {
-    $values = $ids = array();
+    $values = $ids = [];
     $contribution = self::getValues($params, $values, $ids);
     if (is_null($contribution)) {
       throw new CRM_Core_Exception('No contribution found');
@@ -387,10 +393,10 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
         if (isset($params['fee_amount']) || isset($params['total_amount'])) {
           // We have an existing contribution and fee_amount or total_amount has been passed in but not net_amount.
           // net_amount may need adjusting.
-          $contribution = civicrm_api3('Contribution', 'getsingle', array(
+          $contribution = civicrm_api3('Contribution', 'getsingle', [
             'id' => $contributionID,
-            'return' => array('total_amount', 'net_amount', 'fee_amount'),
-          ));
+            'return' => ['total_amount', 'net_amount', 'fee_amount'],
+          ]);
           $totalAmount = isset($params['total_amount']) ? $params['total_amount'] : CRM_Utils_Array::value('total_amount', $contribution);
           $feeAmount = isset($params['fee_amount']) ? $params['fee_amount'] : CRM_Utils_Array::value('fee_amount', $contribution);
           $params['net_amount'] = $totalAmount - $feeAmount;
@@ -407,16 +413,16 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    */
   protected static function getBillingAddressParams($params, $billingLocationTypeID) {
     $hasBillingField = FALSE;
-    $billingFields = array(
+    $billingFields = [
       'street_address',
       'city',
       'state_province_id',
       'postal_code',
       'country_id',
-    );
+    ];
 
     //build address array
-    $addressParams = array();
+    $addressParams = [];
     $addressParams['location_type_id'] = $billingLocationTypeID;
     $addressParams['is_billing'] = 1;
 
@@ -431,7 +437,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
         $hasBillingField = TRUE;
       }
     }
-    return array($hasBillingField, $addressParams);
+    return [$hasBillingField, $addressParams];
   }
 
   /**
@@ -452,7 +458,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
         $addressParams[substr($name, 9)] = $addressParams[$field];
       }
     }
-    return array($hasBillingField, $addressParams);
+    return [$hasBillingField, $addressParams];
   }
 
   /**
@@ -472,7 +478,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       SELECT membership_num_terms FROM civicrm_line_item li
       LEFT JOIN civicrm_price_field_value v ON li.price_field_value_id = v.id
       WHERE contribution_id = %1 AND membership_type_id = %2",
-      array(1 => array($contributionID, 'Integer'), 2 => array($membershipTypeID, 'Integer'))
+      [1 => [$contributionID, 'Integer'], 2 => [$membershipTypeID, 'Integer']]
     );
     // default of 1 is precautionary
     return empty($numTerms) ? 1 : $numTerms;
@@ -488,8 +494,14 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    *
    * @return CRM_Contribute_BAO_Contribution
    */
-  public static function create(&$params, $ids = array()) {
-    $dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date', 'revenue_recognition_date');
+  public static function create(&$params, $ids = []) {
+    $dateFields = [
+      'receive_date',
+      'cancel_date',
+      'receipt_date',
+      'thankyou_date',
+      'revenue_recognition_date',
+    ];
     foreach ($dateFields as $df) {
       if (isset($params[$df])) {
         $params[$df] = CRM_Utils_Date::isoToMysql($params[$df]);
@@ -517,13 +529,13 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     $session = CRM_Core_Session::singleton();
 
     if (!empty($params['note'])) {
-      $noteParams = array(
+      $noteParams = [
         'entity_table' => 'civicrm_contribution',
         'note' => $params['note'],
         'entity_id' => $contribution->id,
         'contact_id' => $session->get('userID'),
         'modified_date' => date('Ymd'),
-      );
+      ];
       if (!$noteParams['contact_id']) {
         $noteParams['contact_id'] = $params['contact_id'];
       }
@@ -533,12 +545,12 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     // make entry in batch entity batch table
     if (!empty($params['batch_id'])) {
       // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params
-      $titleFields = array(
+      $titleFields = [
         'contact_id',
         'total_amount',
         'currency',
         'financial_type_id',
-      );
+      ];
       $retrieveRequired = 0;
       foreach ($titleFields as $titleField) {
         if (!isset($contribution->$titleField)) {
@@ -555,13 +567,13 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
 
     $transaction->commit();
 
-    $activity = civicrm_api3('Activity', 'get', array(
+    $activity = civicrm_api3('Activity', 'get', [
       'source_record_id' => $contribution->id,
-      'options' => array('limit' => 1),
+      'options' => ['limit' => 1],
       'sequential' => 1,
       'activity_type_id' => 'Contribution',
-      'return' => array('id', 'campaign'),
-    ));
+      'return' => ['id', 'campaign'],
+    ]);
 
     //CRM-18406: Update activity when edit contribution.
     if ($activity['count']) {
@@ -582,12 +594,12 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
         "action=view&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home"
       );
       // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params
-      $titleFields = array(
+      $titleFields = [
         'contact_id',
         'total_amount',
         'currency',
         'financial_type_id',
-      );
+      ];
       $retrieveRequired = 0;
       foreach ($titleFields as $titleField) {
         if (!isset($contribution->$titleField)) {
@@ -601,7 +613,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       $financialType = CRM_Contribute_PseudoConstant::financialType($contribution->financial_type_id);
       $title = CRM_Contact_BAO_Contact::displayName($contribution->contact_id) . ' - (' . CRM_Utils_Money::format($contribution->total_amount, $contribution->currency) . ' ' . ' - ' . $financialType . ')';
 
-      $recentOther = array();
+      $recentOther = [];
       if (CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::UPDATE)) {
         $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/contribution',
           "action=update&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home"
@@ -714,14 +726,14 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
   public static function &importableFields($contactType = 'Individual', $status = TRUE) {
     if (!self::$_importableFields) {
       if (!self::$_importableFields) {
-        self::$_importableFields = array();
+        self::$_importableFields = [];
       }
 
       if (!$status) {
-        $fields = array('' => array('title' => ts('- do not import -')));
+        $fields = ['' => ['title' => ts('- do not import -')]];
       }
       else {
-        $fields = array('' => array('title' => ts('- Contribution Fields -')));
+        $fields = ['' => ['title' => ts('- Contribution Fields -')]];
       }
 
       $note = CRM_Core_DAO_Note::import();
@@ -731,12 +743,12 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       $contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
 
       // Using new Dedupe rule.
-      $ruleParams = array(
+      $ruleParams = [
         'contact_type' => $contactType,
         'used' => 'Unsupervised',
-      );
+      ];
       $fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
-      $tmpContactField = array();
+      $tmpContactField = [];
       if (is_array($fieldsArray)) {
         foreach ($fieldsArray as $value) {
           //skip if there is no dupe rule
@@ -785,7 +797,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
   public static function &exportableFields($checkPermission = TRUE) {
     if (!self::$_exportableFields) {
       if (!self::$_exportableFields) {
-        self::$_exportableFields = array();
+        self::$_exportableFields = [];
       }
 
       $fields = CRM_Contribute_DAO_Contribution::export();
@@ -808,70 +820,70 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
 
       $financialAccount = CRM_Financial_DAO_FinancialAccount::export();
 
-      $contributionPage = array(
-        'contribution_page' => array(
+      $contributionPage = [
+        'contribution_page' => [
           'title' => ts('Contribution Page'),
           'name' => 'contribution_page',
           'where' => 'civicrm_contribution_page.title',
           'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-      );
+        ],
+      ];
 
-      $contributionNote = array(
-        'contribution_note' => array(
+      $contributionNote = [
+        'contribution_note' => [
           'title' => ts('Contribution Note'),
           'name' => 'contribution_note',
           'data_type' => CRM_Utils_Type::T_TEXT,
-        ),
-      );
+        ],
+      ];
 
-      $extraFields = array(
-        'contribution_batch' => array(
+      $extraFields = [
+        'contribution_batch' => [
           'title' => ts('Batch Name'),
-        ),
-      );
+        ],
+      ];
 
       // CRM-17787
-      $campaignTitle = array(
-        'contribution_campaign_title' => array(
+      $campaignTitle = [
+        'contribution_campaign_title' => [
           'title' => ts('Campaign Title'),
           'name' => 'campaign_title',
           'where' => 'civicrm_campaign.title',
           'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-      );
-      $softCreditFields = array(
-        'contribution_soft_credit_name' => array(
+        ],
+      ];
+      $softCreditFields = [
+        'contribution_soft_credit_name' => [
           'name' => 'contribution_soft_credit_name',
           'title' => ts('Soft Credit For'),
           'where' => 'civicrm_contact_d.display_name',
           'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-        'contribution_soft_credit_amount' => array(
+        ],
+        'contribution_soft_credit_amount' => [
           'name' => 'contribution_soft_credit_amount',
           'title' => ts('Soft Credit Amount'),
           'where' => 'civicrm_contribution_soft.amount',
           'data_type' => CRM_Utils_Type::T_MONEY,
-        ),
-        'contribution_soft_credit_type' => array(
+        ],
+        'contribution_soft_credit_type' => [
           'name' => 'contribution_soft_credit_type',
           'title' => ts('Soft Credit Type'),
           'where' => 'contribution_softcredit_type.label',
           'data_type' => CRM_Utils_Type::T_STRING,
-        ),
-        'contribution_soft_credit_contribution_id' => array(
+        ],
+        'contribution_soft_credit_contribution_id' => [
           'name' => 'contribution_soft_credit_contribution_id',
           'title' => ts('Soft Credit For Contribution ID'),
           'where' => 'civicrm_contribution_soft.contribution_id',
           'data_type' => CRM_Utils_Type::T_INT,
-        ),
-        'contribution_soft_credit_contact_id' => array(
+        ],
+        'contribution_soft_credit_contact_id' => [
           'name' => 'contribution_soft_credit_contact_id',
           'title' => ts('Soft Credit For Contact ID'),
           'where' => 'civicrm_contact_d.id',
           'data_type' => CRM_Utils_Type::T_INT,
-        ),
-      );
+        ],
+      ];
 
       $fields = array_merge($fields, $contributionPage,
         $contributionNote, $extraFields, $softCreditFields, $financialAccount, $campaignTitle,
@@ -885,30 +897,40 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
   }
 
   /**
-   * @param $contributionId
-   * @param $participantId
-   * @param array $financialTrxn
+   * Record an activity when a payment is received.
+   *
+   * @todo this is intended to be moved to payment BAO class as a protected function
+   * on that class. Currently being cleaned up. The addActivityForPayment doesn't really
+   * merit it's own function as it makes the code less rather than more readable.
+   *
+   * @param int $contributionId
+   * @param int $participantId
+   * @param string $totalAmount
+   * @param string $currency
+   * @param string $trxnDate
    *
-   * @param $financialTrxn
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  protected static function recordPaymentActivity($contributionId, $participantId, $financialTrxn) {
-    $activityType = ($financialTrxn->total_amount < 0) ? 'Refund' : 'Payment';
+  protected static function recordPaymentActivity($contributionId, $participantId, $totalAmount, $currency, $trxnDate) {
+    $activityType = ($totalAmount < 0) ? 'Refund' : 'Payment';
+
     if ($participantId) {
       $inputParams['id'] = $participantId;
       $values = [];
       $ids = [];
-      $component = 'event';
       $entityObj = CRM_Event_BAO_Participant::getValues($inputParams, $values, $ids);
       $entityObj = $entityObj[$participantId];
+      $title = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Event', $entityObj->event_id, 'title');
     }
     else {
       $entityObj = new CRM_Contribute_BAO_Contribution();
       $entityObj->id = $contributionId;
       $entityObj->find(TRUE);
-      $component = 'contribution';
+      $title = ts('Contribution');
     }
-
-    self::addActivityForPayment($entityObj, $financialTrxn, $activityType, $component, $contributionId);
+    // @todo per block above this is not a logical splitting off of functionality.
+    self::addActivityForPayment($entityObj->contact_id, $activityType, $title, $contributionId, $totalAmount, $currency, $trxnDate);
   }
 
   /**
@@ -970,6 +992,93 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     ])['values'];
   }
 
+  /**
+   * Cancel contribution.
+   *
+   * This function should only be called from transitioncomponents - it is an interim step in refactoring.
+   *
+   * @param $processContributionObject
+   * @param $memberships
+   * @param $contributionId
+   * @param $membershipStatuses
+   * @param $updateResult
+   * @param $participant
+   * @param $oldStatus
+   * @param $pledgePayment
+   * @param $pledgeID
+   * @param $pledgePaymentIDs
+   * @param $contributionStatusId
+   *
+   * @return array
+   */
+  protected static function cancel($processContributionObject, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId) {
+    $processContribution = FALSE;
+    $participantStatuses = CRM_Event_PseudoConstant::participantStatus();
+    if (is_array($memberships)) {
+      foreach ($memberships as $membership) {
+        $update = TRUE;
+        //Update Membership status if there is no other completed contribution associated with the membership.
+        $relatedContributions = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id, TRUE);
+        foreach ($relatedContributions as $contriId) {
+          if ($contriId == $contributionId) {
+            continue;
+          }
+          $statusId = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $contriId, 'contribution_status_id');
+          if (CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $statusId) === 'Completed') {
+            $update = FALSE;
+          }
+        }
+        if ($membership && $update) {
+          $newStatus = array_search('Cancelled', $membershipStatuses);
+
+          // Create activity
+          $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
+          $activityParam = [
+            'subject' => "Status changed from {$allStatus[$membership->status_id]} to {$allStatus[$newStatus]}",
+            'source_contact_id' => CRM_Core_Session::singleton()->get('userID'),
+            'target_contact_id' => $membership->contact_id,
+            'source_record_id' => $membership->id,
+            'activity_type_id' => 'Change Membership Status',
+            'status_id' => 'Completed',
+            'priority_id' => 'Normal',
+            'activity_date_time' => 'now',
+          ];
+
+          $membership->status_id = $newStatus;
+          $membership->is_override = TRUE;
+          $membership->status_override_end_date = 'null';
+          $membership->save();
+          civicrm_api3('activity', 'create', $activityParam);
+
+          $updateResult['updatedComponents']['CiviMember'] = $membership->status_id;
+          if ($processContributionObject) {
+            $processContribution = TRUE;
+          }
+        }
+      }
+    }
+
+    if ($participant) {
+      $updatedStatusId = array_search('Cancelled', $participantStatuses);
+      CRM_Event_BAO_Participant::updateParticipantStatus($participant->id, $oldStatus, $updatedStatusId, TRUE);
+
+      $updateResult['updatedComponents']['CiviEvent'] = $updatedStatusId;
+      if ($processContributionObject) {
+        $processContribution = TRUE;
+      }
+    }
+
+    if ($pledgePayment) {
+      CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, $pledgePaymentIDs, $contributionStatusId);
+
+      $updateResult['updatedComponents']['CiviPledge'] = $contributionStatusId;
+      if ($processContributionObject) {
+        $processContribution = TRUE;
+      }
+    }
+    return [$updateResult, $processContribution];
+  }
+
   /**
    * @inheritDoc
    */
@@ -1005,7 +1114,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    * @return array|null
    */
   public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) {
-    $where = array();
+    $where = [];
     switch ($status) {
       case 'Valid':
         $where[] = 'contribution_status_id = 1';
@@ -1052,17 +1161,17 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
 ";
 
     $dao = CRM_Core_DAO::executeQuery($query);
-    $amount = array();
+    $amount = [];
     $count = 0;
     while ($dao->fetch()) {
       $count += $dao->total_count;
       $amount[] = CRM_Utils_Money::format($dao->total_amount, $dao->currency);
     }
     if ($count) {
-      return array(
+      return [
         'amount' => implode(', ', $amount),
         'count' => $count,
-      );
+      ];
     }
     return NULL;
   }
@@ -1082,11 +1191,11 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
 
     $results = NULL;
     //delete activity record
-    $params = array(
+    $params = [
       'source_record_id' => $id,
       // activity type id for contribution
       'activity_type_id' => 6,
-    );
+    ];
 
     CRM_Activity_BAO_Activity::deleteActivity($params);
 
@@ -1130,10 +1239,10 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
     CRM_Utils_Hook::post('delete', 'Contribution', $dao->id, $dao);
 
     // delete the recently created Contribution
-    $contributionRecent = array(
+    $contributionRecent = [
       'id' => $id,
       'type' => 'Contribution',
-    );
+    ];
     CRM_Utils_Recent::del($contributionRecent);
 
     return $results;
@@ -1152,20 +1261,19 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
    * @throws \CiviCRM_API3_Exception
    */
   public static function failPayment($contributionID, $contactID, $message) {
-    civicrm_api3('activity', 'create', array(
+    civicrm_api3('activity', 'create', [
       'activity_type_id' => 'Failed Payment',
       'details' => $message,
       'subject' => ts('Payment failed at payment processor'),
       'source_record_id' => $contributionID,
-      'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() :
-      $contactID,
-    ));
+      'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() : $contactID,
+    ]);
 
     // CRM-20336 Make sure that the contribution status is Failed, not Pending.
-    civicrm_api3('contribution', 'create', array(
+    civicrm_api3('contribution', 'create', [
       'id' => $contributionID,
       'contribution_status_id' => 'Failed',
-    ));
+    ]);
   }
 
   /**
@@ -1187,17 +1295,17 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
     $trxn_id = CRM_Utils_Array::value('trxn_id', $input);
     $invoice_id = CRM_Utils_Array::value('invoice_id', $input);
 
-    $clause = array();
-    $input = array();
+    $clause = [];
+    $input = [];
 
     if ($trxn_id) {
       $clause[] = "trxn_id = %1";
-      $input[1] = array($trxn_id, 'String');
+      $input[1] = [$trxn_id, 'String'];
     }
 
     if ($invoice_id) {
       $clause[] = "invoice_id = %2";
-      $input[2] = array($invoice_id, 'String');
+      $input[2] = [$invoice_id, 'String'];
     }
 
     if (empty($clause)) {
@@ -1207,7 +1315,7 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
     $clause = implode(' OR ', $clause);
     if ($id) {
       $clause = "( $clause ) AND id != %3";
-      $input[3] = array($id, 'Integer');
+      $input[3] = [$id, 'Integer'];
     }
 
     $query = "SELECT id FROM civicrm_contribution WHERE $clause";
@@ -1279,38 +1387,38 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = c.contact_id )
    * Add extra fields specific to contribution.
    */
   public static function getSpecialContributionFields() {
-    $extraFields = array(
-      'contribution_soft_credit_name' => array(
+    $extraFields = [
+      'contribution_soft_credit_name' => [
         'name' => 'contribution_soft_credit_name',
         'title' => ts('Soft Credit Name'),
         'headerPattern' => '/^soft_credit_name$/i',
         'where' => 'civicrm_contact_d.display_name',
-      ),
-      'contribution_soft_credit_email' => array(
+      ],
+      'contribution_soft_credit_email' => [
         'name' => 'contribution_soft_credit_email',
         'title' => ts('Soft Credit Email'),
         'headerPattern' => '/^soft_credit_email$/i',
         'where' => 'soft_email.email',
-      ),
-      'contribution_soft_credit_phone' => array(
+      ],
+      'contribution_soft_credit_phone' => [
         'name' => 'contribution_soft_credit_phone',
         'title' => ts('Soft Credit Phone'),
         'headerPattern' => '/^soft_credit_phone$/i',
         'where' => 'soft_phone.phone',
-      ),
-      'contribution_soft_credit_contact_id' => array(
+      ],
+      'contribution_soft_credit_contact_id' => [
         'name' => 'contribution_soft_credit_contact_id',
         'title' => ts('Soft Credit Contact ID'),
         'headerPattern' => '/^soft_credit_contact_id$/i',
         'where' => 'civicrm_contribution_soft.contact_id',
-      ),
-      'contribution_pcp_title' => array(
+      ],
+      'contribution_pcp_title' => [
         'name' => 'contribution_pcp_title',
         'title' => ts('Personal Campaign Page Title'),
         'headerPattern' => '/^contribution_pcp_title$/i',
         'where' => 'contribution_pcp.title',
-      ),
-    );
+      ],
+    ];
 
     return $extraFields;
   }
@@ -1332,14 +1440,14 @@ GROUP BY p.id
 ";
 
     $config = CRM_Core_Config::singleton();
-    $params = array(1 => array($pageID, 'Integer'));
+    $params = [1 => [$pageID, 'Integer']];
     $dao = CRM_Core_DAO::executeQuery($query, $params);
 
     if ($dao->fetch()) {
-      return array($dao->goal, $dao->total);
+      return [$dao->goal, $dao->total];
     }
     else {
-      return array(NULL, NULL);
+      return [NULL, NULL];
     }
   }
 
@@ -1348,17 +1456,17 @@ GROUP BY p.id
    *
    * The returned array provides details about the original contribution & donor.
    *
-   * @todo - this is a confusing function called from one place. It has a test. It would be
-   * nice to deprecate it.
-   *
    * @param int $honorId
    *   In Honor of Contact ID.
    *
    * @return array
    *   list of contribution fields
+   * @todo - this is a confusing function called from one place. It has a test. It would be
+   * nice to deprecate it.
+   *
    */
   public static function getHonorContacts($honorId) {
-    $params = array();
+    $params = [];
     $honorDAO = new CRM_Contribute_DAO_ContributionSoft();
     $honorDAO->contact_id = $honorId;
     $honorDAO->find();
@@ -1423,7 +1531,7 @@ WHERE  civicrm_contribution.contact_id = civicrm_contact.id
     $query = self::getAnnualQuery($contactIDs);
     $dao = CRM_Core_DAO::executeQuery($query);
     $count = 0;
-    $amount = $average = array();
+    $amount = $average = [];
     while ($dao->fetch()) {
       if ($dao->count > 0 && $dao->amount > 0) {
         $count += $dao->count;
@@ -1432,13 +1540,13 @@ WHERE  civicrm_contribution.contact_id = civicrm_contact.id
       }
     }
     if ($count > 0) {
-      return array(
+      return [
         $count,
         implode(',&nbsp;', $amount),
         implode(',&nbsp;', $average),
-      );
+      ];
     }
-    return array(0, 0, 0);
+    return [0, 0, 0];
   }
 
   /**
@@ -1455,8 +1563,8 @@ WHERE  civicrm_contribution.contact_id = civicrm_contact.id
   public static function checkDuplicateIds($params) {
     $dao = new CRM_Contribute_DAO_Contribution();
 
-    $clause = array();
-    $input = array();
+    $clause = [];
+    $input = [];
     foreach ($params as $k => $v) {
       if ($v) {
         $clause[] = "$k = '$v'";
@@ -1485,7 +1593,7 @@ WHERE  civicrm_contribution.contact_id = civicrm_contact.id
    *   associated array
    */
   public static function getContributionDetails($exportMode, $componentIds) {
-    $paymentDetails = array();
+    $paymentDetails = [];
     $componentClause = ' IN ( ' . implode(',', $componentIds) . ' ) ';
 
     if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
@@ -1525,13 +1633,13 @@ LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.cont
     $dao = CRM_Core_DAO::executeQuery($query);
 
     while ($dao->fetch()) {
-      $paymentDetails[$dao->id] = array(
+      $paymentDetails[$dao->id] = [
         'total_amount' => $dao->total_amount,
         'contribution_status' => $dao->status,
         'receive_date' => $dao->receive_date,
         'pay_instru' => $dao->payment_instrument,
         'trxn_id' => $dao->trxn_id,
-      );
+      ];
     }
 
     return $paymentDetails;
@@ -1568,7 +1676,7 @@ LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.cont
    * @param int $contactId
    */
   public static function deleteAddress($contributionId = NULL, $contactId = NULL) {
-    $clauses = array();
+    $clauses = [];
     $contactJoin = NULL;
 
     if ($contributionId) {
@@ -1596,7 +1704,7 @@ WHERE      $condition
     $dao = CRM_Core_DAO::executeQuery($query);
 
     while ($dao->fetch()) {
-      $params = array('id' => $dao->id);
+      $params = ['id' => $dao->id];
       CRM_Core_BAO_Block::blockDelete('Address', $params);
     }
   }
@@ -1616,7 +1724,7 @@ WHERE      $condition
   public static function checkOnlinePendingContribution($componentId, $componentName) {
     $contributionId = NULL;
     if (!$componentId ||
-      !in_array($componentName, array('Event', 'Membership'))
+      !in_array($componentName, ['Event', 'Membership'])
     ) {
       return $contributionId;
     }
@@ -1668,16 +1776,16 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
    *
    * This function by-passes hooks - to address this - don't use this function.
    *
-   * @deprecated
-   *
-   * Use api contribute.completetransaction
-   * For failures use failPayment (preferably exposing by api in the process).
-   *
    * @param array $params
    * @param bool $processContributionObject
    *
    * @return array
    * @throws \Exception
+   * @deprecated
+   *
+   * Use api contribute.completetransaction
+   * For failures use failPayment (preferably exposing by api in the process).
+   *
    */
   public static function transitionComponents($params, $processContributionObject = FALSE) {
     // get minimum required values.
@@ -1690,17 +1798,17 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
     // if we already processed contribution object pass previous status id.
     $previousContriStatusId = CRM_Utils_Array::value('previous_contribution_status_id', $params);
 
-    $updateResult = array();
+    $updateResult = [];
 
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
 
     // we process only ( Completed, Cancelled, or Failed ) contributions.
     if (!$contributionId ||
-      !in_array($contributionStatusId, array(
+      !in_array($contributionStatusId, [
         array_search('Completed', $contributionStatuses),
         array_search('Cancelled', $contributionStatuses),
         array_search('Failed', $contributionStatuses),
-      ))
+      ])
     ) {
       return $updateResult;
     }
@@ -1737,7 +1845,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
 
     $baseIPN = new CRM_Core_Payment_BaseIPN();
 
-    $input = $ids = $objects = array();
+    $input = $ids = $objects = [];
 
     $input['component'] = CRM_Utils_Array::value('component', $componentDetails);
     $ids['contribution'] = $contributionId;
@@ -1757,9 +1865,9 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
     $participant = &$objects['participant'];
     $pledgePayment = &$objects['pledge_payment'];
     $contribution = &$objects['contribution'];
-
+    $pledgeID = $oldStatus = NULL;
+    $pledgePaymentIDs = [];
     if ($pledgePayment) {
-      $pledgePaymentIDs = array();
       foreach ($pledgePayment as $key => $object) {
         $pledgePaymentIDs[] = $object->id;
       }
@@ -1778,68 +1886,8 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
     // we might want to process contribution object.
     $processContribution = FALSE;
     if ($contributionStatusId == array_search('Cancelled', $contributionStatuses)) {
-      if (is_array($memberships)) {
-        foreach ($memberships as $membership) {
-          $update = TRUE;
-          //Update Membership status if there is no other completed contribution associated with the membership.
-          $relatedContributions = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id, TRUE);
-          foreach ($relatedContributions as $contriId) {
-            if ($contriId == $contributionId) {
-              continue;
-            }
-            $statusId = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $contriId, 'contribution_status_id');
-            if (CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $statusId) === 'Completed') {
-              $update = FALSE;
-            }
-          }
-          if ($membership && $update) {
-            $newStatus = array_search('Cancelled', $membershipStatuses);
-
-            // Create activity
-            $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
-            $activityParam = array(
-              'subject' => "Status changed from {$allStatus[$membership->status_id]} to {$allStatus[$newStatus]}",
-              'source_contact_id' => CRM_Core_Session::singleton()->get('userID'),
-              'target_contact_id' => $membership->contact_id,
-              'source_record_id' => $membership->id,
-              'activity_type_id' => 'Change Membership Status',
-              'status_id' => 'Completed',
-              'priority_id' => 'Normal',
-              'activity_date_time' => 'now',
-            );
-
-            $membership->status_id = $newStatus;
-            $membership->is_override = TRUE;
-            $membership->status_override_end_date = 'null';
-            $membership->save();
-            civicrm_api3('activity', 'create', $activityParam);
-
-            $updateResult['updatedComponents']['CiviMember'] = $membership->status_id;
-            if ($processContributionObject) {
-              $processContribution = TRUE;
-            }
-          }
-        }
-      }
-
-      if ($participant) {
-        $updatedStatusId = array_search('Cancelled', $participantStatuses);
-        CRM_Event_BAO_Participant::updateParticipantStatus($participant->id, $oldStatus, $updatedStatusId, TRUE);
-
-        $updateResult['updatedComponents']['CiviEvent'] = $updatedStatusId;
-        if ($processContributionObject) {
-          $processContribution = TRUE;
-        }
-      }
-
-      if ($pledgePayment) {
-        CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, $pledgePaymentIDs, $contributionStatusId);
-
-        $updateResult['updatedComponents']['CiviPledge'] = $contributionStatusId;
-        if ($processContributionObject) {
-          $processContribution = TRUE;
-        }
-      }
+      // Call interim cancel function - with a goal to cleaning up the signature on it and switching to a tested api Contribution.cancel function.
+      list($updateResult, $processContribution) = self::cancel($processContributionObject, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId);
     }
     elseif ($contributionStatusId == array_search('Failed', $contributionStatuses)) {
       if (is_array($memberships)) {
@@ -1892,13 +1940,19 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
 
       // only pending contribution related object processed.
       if ($previousContriStatusId &&
-        !in_array($contributionStatuses[$previousContriStatusId], array('Pending', 'Partially paid'))
+        !in_array($contributionStatuses[$previousContriStatusId], [
+          'Pending',
+          'Partially paid',
+        ])
       ) {
         // this is case when we already processed contribution object.
         return $updateResult;
       }
       elseif (!$previousContriStatusId &&
-        !in_array($contributionStatuses[$contribution->contribution_status_id], array('Pending', 'Partially paid'))
+        !in_array($contributionStatuses[$contribution->contribution_status_id], [
+          'Pending',
+          'Partially paid',
+        ])
       ) {
         // this is case when we are going to process contribution object later.
         return $updateResult;
@@ -1981,14 +2035,14 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
               (array) $membership
             );
 
-            $formattedParams = array(
+            $formattedParams = [
               'status_id' => CRM_Utils_Array::value('id', $calcStatus,
                 array_search('Current', $membershipStatuses)
               ),
               'join_date' => CRM_Utils_Date::customFormat($dates['join_date'], $format),
               'start_date' => CRM_Utils_Date::customFormat($dates['start_date'], $format),
               'end_date' => CRM_Utils_Date::customFormat($dates['end_date'], $format),
-            );
+            ];
 
             CRM_Utils_Hook::pre('edit', 'Membership', $membership->id, $formattedParams);
 
@@ -1996,7 +2050,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
             $membership->save();
 
             //updating the membership log
-            $membershipLog = array();
+            $membershipLog = [];
             $membershipLog = $formattedParams;
             $logStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('log_start_date', $dates), $format);
             $logStartDate = ($logStartDate) ? CRM_Utils_Date::isoToMysql($logStartDate) : $formattedParams['start_date'];
@@ -2012,24 +2066,24 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
             //update related Memberships.
             CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formattedParams);
 
-            foreach (array('Membership Signup', 'Membership Renewal') as $activityType) {
+            foreach (['Membership Signup', 'Membership Renewal'] as $activityType) {
               $scheduledActivityID = CRM_Utils_Array::value('id',
                 civicrm_api3('Activity', 'Get',
-                  array(
+                  [
                     'source_record_id' => $membership->id,
                     'activity_type_id' => $activityType,
                     'status_id' => 'Scheduled',
-                    'options' => array(
+                    'options' => [
                       'limit' => 1,
                       'sort' => 'id DESC',
-                    ),
-                  )
+                    ],
+                  ]
                 )
               );
               // 1. Update Schedule Membership Signup/Renewal activity to completed on successful payment of pending membership
               // 2. OR Create renewal activity scheduled if its membership renewal will be paid later
               if ($scheduledActivityID) {
-                CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $membership->contact_id, array('id' => $scheduledActivityID));
+                CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $membership->contact_id, ['id' => $scheduledActivityID]);
                 break;
               }
             }
@@ -2040,11 +2094,11 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
               CRM_Activity_BAO_Activity::addActivity($membership,
                 'Change Membership Status',
                 NULL,
-                array(
+                [
                   'subject' => "Status changed from {$allStatus[$oldStatus]} to {$allStatus[$membership->status_id]}",
                   'source_contact_id' => $membershipLog['modified_id'],
                   'priority_id' => 'Normal',
-                )
+                ]
               );
             }
 
@@ -2080,8 +2134,8 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
 
     // process contribution object.
     if ($processContribution) {
-      $contributionParams = array();
-      $fields = array(
+      $contributionParams = [];
+      $fields = [
         'contact_id',
         'total_amount',
         'receive_date',
@@ -2095,7 +2149,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
         'non_deductible_amount',
         'receipt_date',
         'check_number',
-      );
+      ];
       foreach ($fields as $field) {
         if (empty($params[$field])) {
           continue;
@@ -2103,7 +2157,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
         $contributionParams[$field] = $params[$field];
       }
 
-      $ids = array('contribution' => $contributionId);
+      $ids = ['contribution' => $contributionId];
       $contribution = CRM_Contribute_BAO_Contribution::create($contributionParams, $ids);
     }
 
@@ -2118,7 +2172,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
    * @return array
    */
   public static function getComponentDetails($contributionId) {
-    $componentDetails = $pledgePayment = array();
+    $componentDetails = $pledgePayment = [];
     if (!$contributionId) {
       return $componentDetails;
     }
@@ -2141,7 +2195,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
       WHERE     c.id = $contributionId";
 
     $dao = CRM_Core_DAO::executeQuery($query);
-    $componentDetails = array();
+    $componentDetails = [];
 
     while ($dao->fetch()) {
       $componentDetails['component'] = $dao->participant_id ? 'event' : 'contribute';
@@ -2154,7 +2208,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
       }
       if ($dao->membership_id) {
         if (!isset($componentDetails['membership'])) {
-          $componentDetails['membership'] = $componentDetails['membership_type'] = array();
+          $componentDetails['membership'] = $componentDetails['membership_type'] = [];
         }
         $componentDetails['membership'][] = $dao->membership_id;
         $componentDetails['membership_type'][] = $dao->membership_type_id;
@@ -2245,9 +2299,9 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
       }
 
       if (!empty($contributionParams['contribution_recur_id'])) {
-        $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', array(
+        $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', [
           'id' => $contributionParams['contribution_recur_id'],
-        ));
+        ]);
         if (!empty($recurringContribution['campaign_id'])) {
           // CRM-17718 the campaign id on the contribution recur record should get precedence.
           $contributionParams['campaign_id'] = $recurringContribution['campaign_id'];
@@ -2259,7 +2313,10 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
       }
       $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution(
         $contributionParams['contribution_recur_id'],
-        array_intersect_key($contributionParams, array('total_amount' => TRUE, 'financial_type_id' => TRUE))
+        array_intersect_key($contributionParams, [
+          'total_amount' => TRUE,
+          'financial_type_id' => TRUE,
+        ])
       );
       $input['line_item'] = $contributionParams['line_item'] = $templateContribution['line_item'];
 
@@ -2302,7 +2359,7 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
    */
   public static function getOnbehalfIds($contributionId, $contributorId = NULL) {
 
-    $ids = array();
+    $ids = [];
 
     if (!$contributionId) {
       return $ids;
@@ -2331,11 +2388,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
       $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
 
-      $params = array(
-        1 => array($activityTypeId, 'Integer'),
-        2 => array($contributionId, 'Integer'),
-        3 => array($sourceID, 'Integer'),
-      );
+      $params = [
+        1 => [$activityTypeId, 'Integer'],
+        2 => [$contributionId, 'Integer'],
+        3 => [$sourceID, 'Integer'],
+      ];
 
       $sourceContactId = CRM_Core_DAO::singleValueQuery($activityQuery, $params);
 
@@ -2381,7 +2438,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     else {
       $year = date('Y');
     }
-    $year = array('Y' => $year);
+    $year = ['Y' => $year];
     $yearDate = $config->fiscalYearStart;
     $yearDate = array_merge($year, $yearDate);
     $yearDate = CRM_Utils_Date::format($yearDate);
@@ -2390,17 +2447,18 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
     $now = date('Ymd');
 
-    return array(
+    return [
       'now' => $now,
       'yearDate' => $yearDate,
       'monthDate' => $monthDate,
-    );
+    ];
   }
 
   /**
    * Load objects relations to contribution object.
    * Objects are stored in the $_relatedObjects property
    * In the first instance we are just moving functionality from BASEIpn -
+   *
    * @see http://issues.civicrm.org/jira/browse/CRM-9996
    *
    * Note that the unit test for the BaseIPN class tests this function
@@ -2604,20 +2662,23 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
     // todo remove strtolower - check consistency
     if (strtolower($this->_component) == 'event') {
-      $eventParams = array('id' => $this->_relatedObjects['participant']->event_id);
-      $values['event'] = array();
+      $eventParams = ['id' => $this->_relatedObjects['participant']->event_id];
+      $values['event'] = [];
 
       CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
 
       //get location details
-      $locationParams = array('entity_id' => $this->_relatedObjects['participant']->event_id, 'entity_table' => 'civicrm_event');
+      $locationParams = [
+        'entity_id' => $this->_relatedObjects['participant']->event_id,
+        'entity_table' => 'civicrm_event',
+      ];
       $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
 
-      $ufJoinParams = array(
+      $ufJoinParams = [
         'entity_table' => 'civicrm_event',
         'entity_id' => $ids['event'],
         'module' => 'CiviEvent',
-      );
+      ];
 
       list($custom_pre_id,
         $custom_post_ids
@@ -2653,12 +2714,12 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         if (isset($ids['onbehalf_dupe_alert'])) {
           $values['onbehalf_dupe_alert'] = $ids['onbehalf_dupe_alert'];
         }
-        $entityBlock = array(
+        $entityBlock = [
           'contact_id' => $ids['contact'],
           'location_type_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType',
             'Home', 'id', 'name'
           ),
-        );
+        ];
         $address = CRM_Core_BAO_Address::getValues($entityBlock);
         $template->assign('onBehalfAddress', $address[$entityBlock['location_type_id']]['display']);
       }
@@ -2727,16 +2788,16 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    *
    * @return array
    */
-  public function _gatherMessageValues($input, &$values, $ids = array()) {
+  public function _gatherMessageValues($input, &$values, $ids = []) {
     // set display address of contributor
     if ($this->address_id) {
-      $addressParams = array('id' => $this->address_id);
+      $addressParams = ['id' => $this->address_id];
       $addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id');
       $addressDetails = array_values($addressDetails);
     }
     // Else we assign the billing address of the contribution contact.
     else {
-      $addressParams = array('contact_id' => $this->contact_id, 'is_billing' => 1);
+      $addressParams = ['contact_id' => $this->contact_id, 'is_billing' => 1];
       $addressDetails = (array) CRM_Core_BAO_Address::getValues($addressParams);
       $addressDetails = array_values($addressDetails);
     }
@@ -2758,7 +2819,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
           // This is precautionary as there are some legacy flows, but it should really be
           // loaded by now.
           if (!isset($this->_relatedObjects['contributionPage'])) {
-            $this->loadRelatedEntitiesByID(array('contributionPage' => $this->contribution_page_id));
+            $this->loadRelatedEntitiesByID(['contributionPage' => $this->contribution_page_id]);
           }
           // CRM-8254 - override default currency if applicable
           $config = CRM_Core_Config::singleton();
@@ -2779,15 +2840,18 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->id);
         if (!empty($lineItems)) {
           $firstLineItem = reset($lineItems);
-          $priceSet = array();
+          $priceSet = [];
           if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) {
-            $priceSet = civicrm_api3('PriceSet', 'getsingle', array('id' => $firstLineItem['price_set_id'], 'return' => 'is_quick_config, id'));
+            $priceSet = civicrm_api3('PriceSet', 'getsingle', [
+              'id' => $firstLineItem['price_set_id'],
+              'return' => 'is_quick_config, id',
+            ]);
             $values['priceSetID'] = $priceSet['id'];
           }
           foreach ($lineItems as &$eachItem) {
             if (isset($this->_relatedObjects['membership'])
-             && is_array($this->_relatedObjects['membership'])
-             && array_key_exists($eachItem['membership_type_id'], $this->_relatedObjects['membership'])) {
+              && is_array($this->_relatedObjects['membership'])
+              && array_key_exists($eachItem['membership_type_id'], $this->_relatedObjects['membership'])) {
               $eachItem['join_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->join_date);
               $eachItem['start_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->start_date);
               $eachItem['end_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->end_date);
@@ -2811,16 +2875,16 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
     else {
       // event
-      $eventParams = array(
+      $eventParams = [
         'id' => $this->_relatedObjects['event']->id,
-      );
-      $values['event'] = array();
+      ];
+      $values['event'] = [];
 
       CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
       // add custom fields for event
       $eventGroupTree = CRM_Core_BAO_CustomGroup::getTree('Event', NULL, $this->_relatedObjects['event']->id);
 
-      $eventCustomGroup = array();
+      $eventCustomGroup = [];
       foreach ($eventGroupTree as $key => $group) {
         if ($key === 'info') {
           continue;
@@ -2838,16 +2902,16 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $values['event']['customGroup'] = $eventCustomGroup;
 
       //get participant details
-      $participantParams = array(
+      $participantParams = [
         'id' => $this->_relatedObjects['participant']->id,
-      );
+      ];
 
-      $values['participant'] = array();
+      $values['participant'] = [];
 
       CRM_Event_BAO_Participant::getValues($participantParams, $values['participant'], $participantIds);
       // add custom fields for event
       $participantGroupTree = CRM_Core_BAO_CustomGroup::getTree('Participant', NULL, $this->_relatedObjects['participant']->id);
-      $participantCustomGroup = array();
+      $participantCustomGroup = [];
       foreach ($participantGroupTree as $key => $group) {
         if ($key === 'info') {
           continue;
@@ -2865,17 +2929,17 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $values['participant']['customGroup'] = $participantCustomGroup;
 
       //get location details
-      $locationParams = array(
+      $locationParams = [
         'entity_id' => $this->_relatedObjects['event']->id,
         'entity_table' => 'civicrm_event',
-      );
+      ];
       $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
 
-      $ufJoinParams = array(
+      $ufJoinParams = [
         'entity_table' => 'civicrm_event',
         'entity_id' => $ids['event'],
         'module' => 'CiviEvent',
-      );
+      ];
 
       list($custom_pre_id,
         $custom_post_ids
@@ -2900,7 +2964,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', NULL, $this->id);
 
-    $customGroup = array();
+    $customGroup = [];
     foreach ($groupTree as $key => $group) {
       if ($key === 'info') {
         continue;
@@ -2958,28 +3022,31 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     //assign honor information to receipt message
     $softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);
 
-    $honorParams = ['soft_credit_type' => NULL, 'honor_block_is_active' => NULL];
+    $honorParams = [
+      'soft_credit_type' => NULL,
+      'honor_block_is_active' => NULL,
+    ];
     if (isset($softRecord['soft_credit'])) {
       //if id of contribution page is present
       if (!empty($values['id'])) {
-        $values['honor'] = array(
-          'honor_profile_values' => array(),
+        $values['honor'] = [
+          'honor_profile_values' => [],
           'honor_profile_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'uf_group_id', 'entity_id'),
           'honor_id' => $softRecord['soft_credit'][1]['contact_id'],
-        );
+        ];
 
         $honorParams['soft_credit_type'] = $softRecord['soft_credit'][1]['soft_credit_type_label'];
         $honorParams['honor_block_is_active'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'is_active', 'entity_id');
       }
       else {
         //offline contribution
-        $softCreditTypes = $softCredits = array();
+        $softCreditTypes = $softCredits = [];
         foreach ($softRecord['soft_credit'] as $key => $softCredit) {
           $softCreditTypes[$key] = $softCredit['soft_credit_type_label'];
-          $softCredits[$key] = array(
+          $softCredits[$key] = [
             'Name' => $softCredit['contact_name'],
             'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']),
-          );
+          ];
         }
         $template->assign('softCreditTypes', $softCreditTypes);
         $template->assign('softCredits', $softCredits);
@@ -3006,7 +3073,13 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $values['amount'] = $this->total_amount;
     }
 
-    $pcpParams = ['pcpBlock' => NULL, 'pcp_display_in_roll' => NULL, 'pcp_roll_nickname' => NULL, 'pcp_personal_note' => NULL, 'title' => NULL];
+    $pcpParams = [
+      'pcpBlock' => NULL,
+      'pcp_display_in_roll' => NULL,
+      'pcp_roll_nickname' => NULL,
+      'pcp_personal_note' => NULL,
+      'title' => NULL,
+    ];
 
     if (strtolower($this->_component) == 'contribute') {
       //PCP Info
@@ -3058,7 +3131,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     if ($this->_component == 'event') {
       $template->assign('title', $values['event']['title']);
       $participantRoles = CRM_Event_PseudoConstant::participantRole();
-      $viewRoles = array();
+      $viewRoles = [];
       foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_relatedObjects['participant']->role_id) as $k => $v) {
         $viewRoles[] = $participantRoles[$v];
       }
@@ -3074,13 +3147,13 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $isTest = TRUE;
       }
 
-      $values['params'] = array();
+      $values['params'] = [];
       //to get email of primary participant.
       $primaryEmail = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $this->_relatedObjects['participant']->contact_id, 'email', 'contact_id');
-      $primaryAmount[] = array(
+      $primaryAmount[] = [
         'label' => $this->_relatedObjects['participant']->fee_level . ' - ' . $primaryEmail,
         'amount' => $this->_relatedObjects['participant']->fee_amount,
-      );
+      ];
       //build an array of cId/pId of participants
       $additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($this->_relatedObjects['participant']->id, NULL, $this->_relatedObjects['contact']->id, $isTest, TRUE);
       unset($additionalIDs[$this->_relatedObjects['participant']->id]);
@@ -3091,7 +3164,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         //set additionalParticipant true
         $values['params']['additionalParticipant'] = TRUE;
         foreach ($additionalIDs as $pId => $cId) {
-          $amount = array();
+          $amount = [];
           //to change the status pending to completed
           $additional = new CRM_Event_DAO_Participant();
           $additional->id = $pId;
@@ -3105,11 +3178,14 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
           if (!$additionalParticipantInfo) {
             $additionalParticipantInfo = CRM_Contact_BAO_Contact::displayName($additional->contact_id);
           }
-          $amount[0] = array('label' => $additional->fee_level, 'amount' => $additional->fee_amount);
-          $primaryAmount[] = array(
+          $amount[0] = [
+            'label' => $additional->fee_level,
+            'amount' => $additional->fee_amount,
+          ];
+          $primaryAmount[] = [
             'label' => $additional->fee_level . ' - ' . $additionalParticipantInfo,
             'amount' => $additional->fee_amount,
-          );
+          ];
           $additional->save();
           $template->assign('amount', $amount);
           CRM_Event_BAO_Event::sendMail($cId, $values, $pId, $isTest, $returnMessageText);
@@ -3154,7 +3230,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $cacheKeyString = "$contributionId";
     $cacheKeyString .= $isNotCancelled ? '_1' : '_0';
 
-    static $supportsCancel = array();
+    static $supportsCancel = [];
 
     if (!array_key_exists($cacheKeyString, $supportsCancel)) {
       $supportsCancel[$cacheKeyString] = FALSE;
@@ -3187,7 +3263,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
          FROM civicrm_contribution_recur cr
     LEFT JOIN civicrm_contribution con ON ( cr.id = con.contribution_recur_id )
         WHERE con.id = %1 LIMIT 1";
-    $params = array(1 => array($contributionId, 'Integer'));
+    $params = [1 => [$contributionId, 'Integer']];
     $statusId = CRM_Core_DAO::singleValueQuery($sql, $params);
     $status = CRM_Contribute_PseudoConstant::contributionStatus($statusId);
     if ($status == 'Cancelled') {
@@ -3210,7 +3286,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
   public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
     $skipRecords = $update = $return = $isRelatedId = FALSE;
 
-    $additionalParticipantId = array();
+    $additionalParticipantId = [];
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $contributionStatus = empty($params['contribution_status_id']) ? NULL : $contributionStatuses[$params['contribution_status_id']];
 
@@ -3297,10 +3373,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       !($contributionStatus == 'Pending' && !$params['contribution']->is_pay_later)
     ) {
       $skipRecords = TRUE;
-      $pendingStatus = array(
+      $pendingStatus = [
         'Pending',
         'In Progress',
-      );
+      ];
       if (in_array($contributionStatus, $pendingStatus)) {
         $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship(
           $params['financial_type_id'],
@@ -3309,17 +3385,17 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       }
       elseif (!empty($params['payment_processor'])) {
         $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['payment_processor'], NULL, 'civicrm_payment_processor');
-        $params['payment_instrument_id'] = civicrm_api3('PaymentProcessor', 'getvalue', array(
+        $params['payment_instrument_id'] = civicrm_api3('PaymentProcessor', 'getvalue', [
           'id' => $params['payment_processor'],
           'return' => 'payment_instrument_id',
-        ));
+        ]);
       }
       elseif (!empty($params['payment_instrument_id'])) {
         $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']);
       }
       else {
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' "));
-        $queryParams = array(1 => array($relationTypeId, 'Integer'));
+        $queryParams = [1 => [$relationTypeId, 'Integer']];
         $params['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
       }
 
@@ -3328,7 +3404,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount;
       }
       //build financial transaction params
-      $trxnParams = array(
+      $trxnParams = [
         'contribution_id' => $params['contribution']->id,
         'to_financial_account_id' => $params['to_financial_account_id'],
         'trxn_date' => !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis'),
@@ -3337,12 +3413,15 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         'net_amount' => CRM_Utils_Array::value('net_amount', $params, $totalAmount),
         'currency' => $params['contribution']->currency,
         'trxn_id' => $params['contribution']->trxn_id,
+        // @todo - this is getting the status id from the contribution - that is BAD - ie the contribution could be partially
+        // paid but each payment is completed. The work around is to pass in the status_id in the trxn_params but
+        // this should really default to completed (after discussion).
         'status_id' => $statusId,
         'payment_instrument_id' => CRM_Utils_Array::value('payment_instrument_id', $params, $params['contribution']->payment_instrument_id),
         'check_number' => CRM_Utils_Array::value('check_number', $params),
         'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params),
         'card_type_id' => CRM_Utils_Array::value('card_type_id', $params),
-      );
+      ];
       if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') {
         $trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis');
         if (isset($params['refund_trxn_id'])) {
@@ -3480,7 +3559,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
           if (isset($params['refund_trxn_id'])) {
             $refundIDs = CRM_Core_BAO_FinancialTrxn::getRefundTransactionIDs($params['id']);
             if (!empty($refundIDs['financialTrxnId']) && $refundIDs['trxn_id'] != $params['refund_trxn_id']) {
-              civicrm_api3('FinancialTrxn', 'create', array('id' => $refundIDs['financialTrxnId'], 'trxn_id' => $params['refund_trxn_id']));
+              civicrm_api3('FinancialTrxn', 'create', [
+                'id' => $refundIDs['financialTrxnId'],
+                'trxn_id' => $params['refund_trxn_id'],
+              ]);
             }
           }
           $cardType = CRM_Utils_Array::value('card_type_id', $params);
@@ -3510,11 +3592,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     // create batch entry if batch_id is passed and
     // ensure no batch entry is been made on 'Pending' or 'Failed' contribution, CRM-16611
     if (!empty($params['batch_id']) && !empty($financialTxn)) {
-      $entityParams = array(
+      $entityParams = [
         'batch_id' => $params['batch_id'],
         'entity_table' => 'civicrm_financial_trxn',
         'entity_id' => $financialTxn->id,
-      );
+      ];
       CRM_Batch_BAO_EntityBatch::create($entityParams);
     }
 
@@ -3541,12 +3623,12 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    * @param array $params
    *   Contribution object, line item array and params for trxn.
    *
-   * @todo stop passing $params by reference. It is unclear the purpose of doing this &
-   * adds unpredictability.
-   *
    * @param string $context
    *   Update scenarios.
    *
+   * @todo stop passing $params by reference. It is unclear the purpose of doing this &
+   * adds unpredictability.
+   *
    */
   public static function updateFinancialAccounts(&$params, $context = NULL) {
     $trxnID = NULL;
@@ -3562,10 +3644,14 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     ) {
       return;
     }
-    if ((($previousContributionStatus == 'Partially paid'
-      && $currentContributionStatus == 'Completed')
-      || ($previousContributionStatus == 'Pending' && $params['prevContribution']->is_pay_later == TRUE
-      && $currentContributionStatus == 'Partially paid'))
+    // The 'right' way to add payments or refunds is through the Payment.create api. That api
+    // then updates the contribution but this process shoud not also record another financial trxn.
+    if ((($previousContributionStatus == 'Partially paid' && $currentContributionStatus == 'Completed')
+        || ($previousContributionStatus == 'Pending refund' && $currentContributionStatus == 'Completed')
+        // This concept of pay_later as different to any other sort of pending is deprecated & it's unclear
+        // why it is here or where it is handled instead.
+        || ($previousContributionStatus == 'Pending' && $params['prevContribution']->is_pay_later == TRUE
+          && $currentContributionStatus == 'Partially paid'))
       && $context == 'changedStatus'
     ) {
       return;
@@ -3631,19 +3717,22 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $query = "UPDATE civicrm_financial_item SET status_id = %1 WHERE entity_id = %2 and entity_table = 'civicrm_line_item'";
         $sql = "SELECT id, amount FROM civicrm_financial_item WHERE entity_id = %1 and entity_table = 'civicrm_line_item'";
 
-        $entityParams = array(
+        $entityParams = [
           'entity_table' => 'civicrm_financial_item',
-        );
+        ];
         foreach ($params['line_item'] as $fieldId => $fields) {
           foreach ($fields as $fieldValueId => $lineItemDetails) {
-            $fparams = array(
-              1 => array(CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'), 'Integer'),
-              2 => array($lineItemDetails['id'], 'Integer'),
-            );
+            $fparams = [
+              1 => [
+                CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'),
+                'Integer',
+              ],
+              2 => [$lineItemDetails['id'], 'Integer'],
+            ];
             CRM_Core_DAO::executeQuery($query, $fparams);
-            $fparams = array(
-              1 => array($lineItemDetails['id'], 'Integer'),
-            );
+            $fparams = [
+              1 => [$lineItemDetails['id'], 'Integer'],
+            ];
             $financialItem = CRM_Core_DAO::executeQuery($sql, $fparams);
             while ($financialItem->fetch()) {
               $entityParams['entity_id'] = $financialItem->id;
@@ -3682,7 +3771,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
             $currency = $params['contribution']->currency;
           }
           $previousLineItemTotal = CRM_Utils_Array::value('line_total', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0);
-          $itemParams = array(
+          $itemParams = [
             'transaction_date' => $receiveDate,
             'contact_id' => $params['prevContribution']->contact_id,
             'currency' => $currency,
@@ -3692,7 +3781,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
             'financial_account_id' => $financialAccount,
             'entity_table' => 'civicrm_line_item',
             'entity_id' => $lineItemDetails['id'],
-          );
+          ];
           $financialItem = CRM_Financial_BAO_FinancialItem::create($itemParams, NULL, $trxnIds);
           // @todo we should stop passing $params by reference - splitting this out would be a step towards that.
           $params['line_item'][$fieldId][$fieldValueId]['deferred_line_total'] = $itemParams['amount'];
@@ -3709,15 +3798,17 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
             elseif ($previousLineItemTotal != $lineItemDetails['line_total']) {
               $taxAmount -= CRM_Utils_Array::value('tax_amount', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0);
             }
-            $itemParams['amount'] = self::getMultiplier($params['contribution']->contribution_status_id, $context) * $taxAmount;
-            $itemParams['description'] = $taxTerm;
-            if ($lineItemDetails['financial_type_id']) {
-              $itemParams['financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount(
-                $lineItemDetails['financial_type_id'],
-                'Sales Tax Account is'
-              );
+            if ($taxAmount != 0) {
+              $itemParams['amount'] = self::getMultiplier($params['contribution']->contribution_status_id, $context) * $taxAmount;
+              $itemParams['description'] = $taxTerm;
+              if ($lineItemDetails['financial_type_id']) {
+                $itemParams['financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount(
+                  $lineItemDetails['financial_type_id'],
+                  'Sales Tax Account is'
+                );
+              }
+              CRM_Financial_BAO_FinancialItem::create($itemParams, NULL, $trxnIds);
             }
-            CRM_Financial_BAO_FinancialItem::create($itemParams, NULL, $trxnIds);
           }
         }
       }
@@ -3745,7 +3836,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    * @return bool
    */
   public static function isContributionStatusNegative($status_id) {
-    $reversalStatuses = array('Cancelled', 'Chargeback', 'Refunded');
+    $reversalStatuses = ['Cancelled', 'Chargeback', 'Refunded'];
     return in_array(CRM_Contribute_PseudoConstant::contributionStatus($status_id, 'name'), $reversalStatuses);
   }
 
@@ -3771,22 +3862,22 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       }
     }
     $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
-    $checkStatus = array(
-      'Cancelled' => array('Completed', 'Refunded'),
-      'Completed' => array('Cancelled', 'Refunded', 'Chargeback'),
-      'Pending' => array('Cancelled', 'Completed', 'Failed', 'Partially paid'),
-      'In Progress' => array('Cancelled', 'Completed', 'Failed'),
-      'Refunded' => array('Cancelled', 'Completed'),
-      'Partially paid' => array('Completed'),
-    );
+    $checkStatus = [
+      'Cancelled' => ['Completed', 'Refunded'],
+      'Completed' => ['Cancelled', 'Refunded', 'Chargeback'],
+      'Pending' => ['Cancelled', 'Completed', 'Failed', 'Partially paid'],
+      'In Progress' => ['Cancelled', 'Completed', 'Failed'],
+      'Refunded' => ['Cancelled', 'Completed'],
+      'Partially paid' => ['Completed'],
+    ];
 
     if (!in_array($contributionStatuses[$fields['contribution_status_id']],
-      CRM_Utils_Array::value($contributionStatuses[$values['contribution_status_id']], $checkStatus, array()))
+      CRM_Utils_Array::value($contributionStatuses[$values['contribution_status_id']], $checkStatus, []))
     ) {
-      $errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", array(
+      $errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", [
         1 => $contributionStatuses[$values['contribution_status_id']],
         2 => $contributionStatuses[$fields['contribution_status_id']],
-      ));
+      ]);
     }
   }
 
@@ -3810,17 +3901,18 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
   /**
    * Get options for a given contribution field.
-   * @see CRM_Core_DAO::buildOptions
    *
    * @param string $fieldName
    * @param string $context see CRM_Core_DAO::buildOptionsContext.
-   * @param array $props  whatever is known about this dao object.
+   * @param array $props whatever is known about this dao object.
    *
    * @return array|bool
+   * @see CRM_Core_DAO::buildOptions
+   *
    */
-  public static function buildOptions($fieldName, $context = NULL, $props = array()) {
+  public static function buildOptions($fieldName, $context = NULL, $props = []) {
     $className = __CLASS__;
-    $params = array();
+    $params = [];
     if (isset($props['orderColumn'])) {
       $params['orderColumn'] = $props['orderColumn'];
     }
@@ -3830,10 +3922,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $className = 'CRM_Contribute_BAO_ContributionPage';
         // Filter results by contribution page
         if (!empty($props['contribution_page_id'])) {
-          $page = civicrm_api('contribution_page', 'getsingle', array(
+          $page = civicrm_api('contribution_page', 'getsingle', [
             'version' => 3,
             'id' => ($props['contribution_page_id']),
-          ));
+          ]);
           $types = (array) CRM_Utils_Array::value('payment_processor', $page, 0);
           $params['condition'] = 'id IN (' . implode(',', $types) . ')';
         }
@@ -3890,6 +3982,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $financialTrxn = CRM_Financial_BAO_Payment::recordPayment($contributionId, $trxnsData, $participantId);
     }
     elseif ($paymentType == 'refund') {
+      $trxnsData['total_amount'] = -$trxnsData['total_amount'];
       $financialTrxn = CRM_Financial_BAO_Payment::recordRefundPayment($contributionId, $trxnsData, $updateStatus);
       if ($participantId) {
         // update participant status
@@ -3905,37 +3998,33 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
 
     if (!empty($financialTrxn)) {
-      self::recordPaymentActivity($contributionId, $participantId, $financialTrxn);
+      self::recordPaymentActivity($contributionId, $participantId, $financialTrxn->total_amount, $financialTrxn->currency, $financialTrxn->trxn_date);
       return $financialTrxn;
     }
 
   }
 
   /**
-   * @param $entityObj
-   * @param $trxnObj
+   * @param int $targetCid
    * @param $activityType
-   * @param $component
+   * @param string $title
    * @param int $contributionId
+   * @param string $totalAmount
+   * @param string $currency
+   * @param string $trxn_date
    *
-   * @throws CRM_Core_Exception
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component, $contributionId) {
-    if ($component == 'event') {
-      $title = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Event', $entityObj->event_id, 'title');
-    }
-    else {
-      $title = ts('Contribution');
-    }
-    $paymentAmount = CRM_Utils_Money::format($trxnObj->total_amount, $trxnObj->currency);
+  public static function addActivityForPayment($targetCid, $activityType, $title, $contributionId, $totalAmount, $currency, $trxn_date) {
+    $paymentAmount = CRM_Utils_Money::format($totalAmount, $currency);
     $subject = "{$paymentAmount} - Offline {$activityType} for {$title}";
-    $date = CRM_Utils_Date::isoToMysql($trxnObj->trxn_date);
-    $targetCid = $entityObj->contact_id;
+    $date = CRM_Utils_Date::isoToMysql($trxn_date);
     // source record id would be the contribution id
     $srcRecId = $contributionId;
 
     // activity params
-    $activityParams = array(
+    $activityParams = [
       'source_contact_id' => $targetCid,
       'source_record_id' => $srcRecId,
       'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', $activityType),
@@ -3943,7 +4032,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       'activity_date_time' => $date,
       'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'),
       'skipRecentView' => TRUE,
-    );
+    ];
 
     // create activity with target contacts
     $session = CRM_Core_Session::singleton();
@@ -3952,8 +4041,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $activityParams['source_contact_id'] = $id;
       $activityParams['target_contact_id'][] = $targetCid;
     }
-    // @todo use api.
-    CRM_Activity_BAO_Activity::create($activityParams);
+    civicrm_api3('Activity', 'create', $activityParams);
   }
 
   /**
@@ -4004,7 +4092,15 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
     $paymentBalance = CRM_Contribute_BAO_Contribution::getContributionBalance($contributionId, $total);
 
-    $contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $contributionId, 'return' => array('currency', 'is_pay_later', 'contribution_status_id', 'financial_type_id')));
+    $contribution = civicrm_api3('Contribution', 'getsingle', [
+      'id' => $contributionId,
+      'return' => [
+        'currency',
+        'is_pay_later',
+        'contribution_status_id',
+        'financial_type_id',
+      ],
+    ]);
 
     $info['payLater'] = $contribution['is_pay_later'];
     $info['contribution_status'] = $contribution['contribution_status'];
@@ -4025,7 +4121,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $info['balance'] = $paymentBalance;
     $info['id'] = $id;
     $info['component'] = $component;
-    $rows = array();
+    $rows = [];
     if ($getTrxnInfo && $baseTrxnId) {
       // Need to exclude fee trxn rows so filter out rows where TO FINANCIAL ACCOUNT is expense account
       $sql = "
@@ -4044,10 +4140,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
         WHERE con.id = %1 AND ft.is_payment = 1
         GROUP BY ft.id";
-      $queryParams = array(
-        1 => array($contributionId, 'Integer'),
-        2 => array($feeFinancialAccount, 'Integer'),
-      );
+      $queryParams = [
+        1 => [$contributionId, 'Integer'],
+        2 => [$feeFinancialAccount, 'Integer'],
+      ];
       $resultDAO = CRM_Core_DAO::executeQuery($sql, $queryParams);
       $statuses = CRM_Contribute_PseudoConstant::contributionStatus();
 
@@ -4066,26 +4162,26 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         // show payment edit link only for payments done via backoffice form
         $paymentEditLink = '';
         if (empty($resultDAO->payment_processor_id) && CRM_Core_Permission::check('edit contributions')) {
-          $links = array(
-            CRM_Core_Action::UPDATE => array(
+          $links = [
+            CRM_Core_Action::UPDATE => [
               'name' => "<i class='crm-i fa-pencil'></i>",
               'url' => 'civicrm/payment/edit',
               'class' => 'medium-popup',
               'qs' => "reset=1&id=%%id%%&contribution_id=%%contribution_id%%",
               'title' => ts('Edit Payment'),
-            ),
-          );
+            ],
+          ];
           $paymentEditLink = CRM_Core_Action::formLink(
             $links,
-            CRM_Core_Action::mask(array(CRM_Core_Permission::EDIT)),
-            array(
+            CRM_Core_Action::mask([CRM_Core_Permission::EDIT]),
+            [
               'id' => $resultDAO->id,
               'contribution_id' => $contributionId,
-            )
+            ]
           );
         }
 
-        $val = array(
+        $val = [
           'id' => $resultDAO->id,
           'total_amount' => $resultDAO->total_amount,
           'financial_type' => $resultDAO->financial_account,
@@ -4095,7 +4191,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
           'status' => $statuses[$resultDAO->status_id],
           'currency' => $resultDAO->currency,
           'action' => $paymentEditLink,
-        );
+        ];
         if ($paidByName == 'Check') {
           $val['check_number'] = $resultDAO->check_number;
         }
@@ -4156,7 +4252,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         $params['prevContribution'] = self::getOriginalContribution($params['id']);
       }
 
-      foreach (array('total_amount', 'financial_type_id', 'fee_amount') as $field) {
+      foreach (['total_amount', 'financial_type_id', 'fee_amount'] as $field) {
         if (!isset($params[$field])) {
           if ($field == 'total_amount' && $params['prevContribution']->tax_amount) {
             // Tax amount gets added back on later....
@@ -4176,7 +4272,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
         // Assign tax Amount on update of contribution
         if (!empty($params['prevContribution']->tax_amount)) {
           $params['tax_amount'] = 'null';
-          CRM_Price_BAO_LineItem::getLineItemArray($params, array($params['id']));
+          CRM_Price_BAO_LineItem::getLineItemArray($params, [$params['id']]);
           foreach ($params['line_item'] as $setID => $priceField) {
             foreach ($priceField as $priceFieldID => $priceFieldValue) {
               $params['line_item'][$setID][$priceFieldID]['tax_amount'] = $params['tax_amount'];
@@ -4196,7 +4292,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
       // Get Line Item on update of contribution
       if (isset($params['id'])) {
-        CRM_Price_BAO_LineItem::getLineItemArray($params, array($params['id']));
+        CRM_Price_BAO_LineItem::getLineItemArray($params, [$params['id']]);
       }
       else {
         CRM_Price_BAO_LineItem::getLineItemArray($params);
@@ -4210,7 +4306,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
     elseif (isset($params['api.line_item.create'])) {
       // Update total amount of contribution using lineItem
-      $taxAmountArray = array();
+      $taxAmountArray = [];
       foreach ($params['api.line_item.create'] as $key => $value) {
         if (isset($value['financial_type_id']) && array_key_exists($value['financial_type_id'], $taxRates)) {
           $taxRate = $taxRates[$value['financial_type_id']];
@@ -4223,7 +4319,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
     else {
       // update line item of contrbution
-      if (isset($params['financial_type_id']) && array_key_exists($params['financial_type_id'], $taxRates)  && $isLineItem) {
+      if (isset($params['financial_type_id']) && array_key_exists($params['financial_type_id'], $taxRates) && $isLineItem) {
         $taxRate = $taxRates[$params['financial_type_id']];
         $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($params['line_total'], $taxRate, $unknownIfMoneyIsClean);
         $params['tax_amount'] = round($taxAmount['tax_amount'], 2);
@@ -4254,9 +4350,9 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       }
     }
     $sql = 'SELECT financial_type_id FROM civicrm_line_item WHERE contribution_id = %1 GROUP BY financial_type_id;';
-    $params = array(
-      '1' => array($contributionId, 'Integer'),
-    );
+    $params = [
+      '1' => [$contributionId, 'Integer'],
+    ];
     $result = CRM_Core_DAO::executeQuery($sql, $params);
     if ($result->N > 1) {
       $errors['financial_type_id'] = ts('One or more line items have a different financial type than the contribution. Editing the financial type is not yet supported in this situation.');
@@ -4327,7 +4423,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
     if ($updatePledgePaymentStatus) {
       CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID,
-        array($pledgePaymentID),
+        [$pledgePaymentID],
         $contribution_status_id,
         NULL,
         $total_amount,
@@ -4339,13 +4435,13 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
   /**
    * Compute the stats values
    *
-   * @deprecated
-   *
    * @param string $stat either 'mode' or 'median'
    * @param string $sql
    * @param string $alias of civicrm_contribution
    *
    * @return array|null
+   * @deprecated
+   *
    */
   public static function computeStats($stat, $sql, $alias = NULL) {
     CRM_Core_Error::deprecatedFunctionWarning('computeStats is now deprecated');
@@ -4362,7 +4458,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    * @throws \CiviCRM_API3_Exception
    */
   public static function isSingleLineItem($id) {
-    $lineItemCount = civicrm_api3('LineItem', 'getcount', array('contribution_id' => $id));
+    $lineItemCount = civicrm_api3('LineItem', 'getcount', ['contribution_id' => $id]);
     return ($lineItemCount == 1);
   }
 
@@ -4388,10 +4484,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
     // The previous details are used when calculating line items so keep it before any code that 'does something'
     if (!empty($contribution->id)) {
-      $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(array('id' => $contribution->id),
+      $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(['id' => $contribution->id],
         CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
     }
-    $inputContributionWhiteList = array(
+    $inputContributionWhiteList = [
       'fee_amount',
       'net_amount',
       'trxn_id',
@@ -4404,7 +4500,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       'contribution_status_id',
       'card_type_id',
       'pan_truncation',
-    );
+    ];
     if (self::isSingleLineItem($primaryContributionID)) {
       $inputContributionWhiteList[] = 'financial_type_id';
     }
@@ -4426,10 +4522,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
 
     $completedContributionStatusID = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
 
-    $contributionParams = array_merge(array(
+    $contributionParams = array_merge([
       'contribution_status_id' => $completedContributionStatusID,
       'source' => self::getRecurringContributionDescription($contribution, $event),
-    ), array_intersect_key($input, array_fill_keys($inputContributionWhiteList, 1)
+    ], array_intersect_key($input, array_fill_keys($inputContributionWhiteList, 1)
     ));
 
     // CRM-20678 Ensure that the currency is correct in subseqent transcations.
@@ -4457,7 +4553,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     self::repeatTransaction($contribution, $input, $contributionParams, $paymentProcessorId);
     $contributionParams['financial_type_id'] = $contribution->financial_type_id;
 
-    $values = array();
+    $values = [];
     if (isset($input['is_email_receipt'])) {
       $values['is_email_receipt'] = $input['is_email_receipt'];
     }
@@ -4516,10 +4612,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
     }
 
-    $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+    $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [
       'labelColumn' => 'name',
       'flip' => 1,
-    ));
+    ]);
     if (isset($input['prevContribution']) && (!$input['prevContribution']->is_pay_later && $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
       $input['payment_processor'] = $paymentProcessorId;
     }
@@ -4558,10 +4654,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     if (!array_key_exists('is_email_receipt', $values) ||
       $values['is_email_receipt'] == 1
     ) {
-      civicrm_api3('Contribution', 'sendconfirmation', array(
+      civicrm_api3('Contribution', 'sendconfirmation', [
         'id' => $contribution->id,
         'payment_processor_id' => $paymentProcessorId,
-      ));
+      ]);
       CRM_Core_Error::debug_log_message("Receipt sent");
     }
 
@@ -4608,30 +4704,41 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $values['contribution_status'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id);
     $return = $contribution->composeMessageArray($input, $ids, $values, $returnMessageText);
     if ((!isset($input['receipt_update']) || $input['receipt_update']) && empty($contribution->receipt_date)) {
-      civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id));
+      civicrm_api3('Contribution', 'create', [
+        'receipt_date' => 'now',
+        'id' => $contribution->id,
+      ]);
     }
     return $return;
   }
 
   /**
    * Generate From email and from name in an array values
+   *
    * @param array $input
    * @param \CRM_Contribute_BAO_Contribution $contribution
+   *
    * @return array
    */
   public static function generateFromEmailAndName($input, $contribution) {
     // Use input value if supplied.
     if (!empty($input['receipt_from_email'])) {
-      return array(CRM_Utils_array::value('receipt_from_name', $input, ''), $input['receipt_from_email']);
+      return [
+        CRM_Utils_array::value('receipt_from_name', $input, ''),
+        $input['receipt_from_email'],
+      ];
     }
     // if we are still empty see if we can use anything from a contribution page.
-    $pageValues = array();
+    $pageValues = [];
     if (!empty($contribution->contribution_page_id)) {
-      $pageValues = civicrm_api3('ContributionPage', 'getsingle', array('id' => $contribution->contribution_page_id));
+      $pageValues = civicrm_api3('ContributionPage', 'getsingle', ['id' => $contribution->contribution_page_id]);
     }
     // if we are still empty see if we can use anything from a contribution page.
     if (!empty($pageValues['receipt_from_email'])) {
-      return array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']);
+      return [
+        $pageValues['receipt_from_name'],
+        $pageValues['receipt_from_email'],
+      ];
     }
     // If we are still empty fall back to the domain or logged in user information.
     return CRM_Core_BAO_Domain::getDefaultReceiptFrom();
@@ -4652,10 +4759,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     do {
       $creditNoteNum++;
       $creditNoteId = CRM_Utils_Array::value('credit_notes_prefix', $prefixValue) . "" . $creditNoteNum;
-      $result = civicrm_api3('Contribution', 'getcount', array(
+      $result = civicrm_api3('Contribution', 'getcount', [
         'sequential' => 1,
         'creditnote_id' => $creditNoteId,
-      ));
+      ]);
     } while ($result > 0);
 
     return $creditNoteId;
@@ -4664,6 +4771,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
   /**
    * Load related memberships.
    *
+   * @param array $ids
+   *
+   * @return array $ids
+   *
+   * @throws Exception
    * @deprecated
    *
    * Note that in theory it should be possible to retrieve these from the line_item table
@@ -4674,19 +4786,14 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    *
    * I don't know if it never worked or broke as a result of https://issues.civicrm.org/jira/browse/CRM-14918.
    *
-   * @param array $ids
-   *
-   * @return array $ids
-   *
-   * @throws Exception
    */
   public function loadRelatedMembershipObjects($ids = []) {
     $query = "
       SELECT membership_id
       FROM   civicrm_membership_payment
       WHERE  contribution_id = %1 ";
-    $params = array(1 => array($this->id, 'Integer'));
-    $ids['membership'] = (array) CRM_Utils_Array::value('membership', $ids, array());
+    $params = [1 => [$this->id, 'Integer']];
+    $ids['membership'] = (array) CRM_Utils_Array::value('membership', $ids, []);
 
     $dao = CRM_Core_DAO::executeQuery($query, $params);
     while ($dao->fetch()) {
@@ -4761,10 +4868,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       return $contribution->source;
     }
     elseif (!empty($contribution->contribution_page_id) && is_numeric($contribution->contribution_page_id)) {
-      $contributionPageTitle = civicrm_api3('ContributionPage', 'getvalue', array(
+      $contributionPageTitle = civicrm_api3('ContributionPage', 'getvalue', [
         'id' => $contribution->contribution_page_id,
         'return' => 'title',
-      ));
+      ]);
       return ts('Online Contribution') . ': ' . $contributionPageTitle;
     }
     elseif ($event) {
@@ -4790,23 +4897,28 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       FROM civicrm_financial_trxn ft
       INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution'
       WHERE eft.entity_id = %1 AND ft.is_payment = 1 ORDER BY ft.id DESC LIMIT 1";
-    $contributionStatus = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
+    $contributionStatus = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [
       'labelColumn' => 'name',
-    ));
+    ]);
     foreach ($contributions as $contribution) {
       if (!($contributionStatus[$contribution->contribution_status_id] == 'Partially paid'
         || CRM_Utils_Array::value($contributionStatusId, $contributionStatus) == 'Partially paid')
       ) {
         continue;
       }
-      $ftDao = CRM_Core_DAO::executeQuery($ftSql, array(1 => array($contribution->id, 'Integer')));
+      $ftDao = CRM_Core_DAO::executeQuery($ftSql, [
+        1 => [
+          $contribution->id,
+          'Integer',
+        ],
+      ]);
       $ftDao->fetch();
 
       // store financial item Proportionaly.
-      $trxnParams = array(
+      $trxnParams = [
         'total_amount' => $ftDao->total_amount,
         'contribution_id' => $contribution->id,
-      );
+      ];
       self::assignProportionalLineItems($trxnParams, $ftDao->id, $contribution->total_amount);
     }
   }
@@ -4827,11 +4939,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     if (!empty($lineItems)) {
       // get financial item
       list($ftIds, $taxItems) = self::getLastFinancialItemIds($trxnParams['contribution_id']);
-      $entityParams = array(
+      $entityParams = [
         'contribution_total_amount' => $contributionTotalAmount,
         'trxn_total_amount' => $trxnParams['total_amount'],
         'trxn_id' => $trxnId,
-      );
+      ];
       self::createProportionalFinancialEntries($entityParams, $lineItems, $ftIds, $taxItems);
     }
   }
@@ -4889,10 +5001,10 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     }
 
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus($params['contribution_status_id'], 'name');
-    $preferredAccountsRelationships = array(
+    $preferredAccountsRelationships = [
       'Refunded' => 'Credit/Contra Revenue Account is',
       'Chargeback' => 'Chargeback Account is',
-    );
+    ];
 
     if (in_array($contributionStatus, array_keys($preferredAccountsRelationships))) {
       $financialTypeID = !empty($params['financial_type_id']) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id;
@@ -4921,12 +5033,12 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    * @return array
    */
   protected function addContributionPageValuesToValuesHeavyHandedly(&$values) {
-    $contributionPageValues = array();
+    $contributionPageValues = [];
     CRM_Contribute_BAO_ContributionPage::setValues(
       $this->contribution_page_id,
       $contributionPageValues
     );
-    $valuesToCopy = array(
+    $valuesToCopy = [
       // These are the values that I believe to be useful.
       'id',
       'title',
@@ -4977,7 +5089,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       'thankyou_text',
       'thankyou_title',
 
-    );
+    ];
     foreach ($valuesToCopy as $valueToCopy) {
       if (isset($contributionPageValues[$valueToCopy])) {
         $values[$valueToCopy] = $contributionPageValues[$valueToCopy];
@@ -5031,12 +5143,12 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       return $statusMsg;
     }
 
-    $params = array(
+    $params = [
       'contribution_id' => $contributionId,
       'contribution_status_id' => $statusId,
       'previous_contribution_status_id' => $previousStatusId,
       'receive_date' => $receiveDate,
-    );
+    ];
 
     $updateResult = CRM_Contribute_BAO_Contribution::transitionComponents($params);
 
@@ -5072,7 +5184,10 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
             break;
         }
 
-        $statusMsg .= "<br />" . ts("Membership for %1 has been %2.", array(1 => $userDisplayName, 2 => $statusNameMsgPart));
+        $statusMsg .= "<br />" . ts("Membership for %1 has been %2.", [
+          1 => $userDisplayName,
+          2 => $statusNameMsgPart,
+        ]);
       }
 
       if ($componentName == 'CiviEvent') {
@@ -5080,10 +5195,10 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
           CRM_Event_PseudoConstant::participantStatus()
         );
         if ($updatedStatusName == 'Cancelled') {
-          $statusMsg .= "<br />" . ts("Event Registration for %1 has been Cancelled.", array(1 => $userDisplayName));
+          $statusMsg .= "<br />" . ts("Event Registration for %1 has been Cancelled.", [1 => $userDisplayName]);
         }
         elseif ($updatedStatusName == 'Registered') {
-          $statusMsg .= "<br />" . ts("Event Registration for %1 has been updated.", array(1 => $userDisplayName));
+          $statusMsg .= "<br />" . ts("Event Registration for %1 has been updated.", [1 => $userDisplayName]);
         }
       }
 
@@ -5092,13 +5207,13 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
           CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')
         );
         if ($updatedStatusName == 'Cancelled') {
-          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been Cancelled.", array(1 => $userDisplayName));
+          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been Cancelled.", [1 => $userDisplayName]);
         }
         elseif ($updatedStatusName == 'Failed') {
-          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been Failed.", array(1 => $userDisplayName));
+          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been Failed.", [1 => $userDisplayName]);
         }
         elseif ($updatedStatusName == 'Completed') {
-          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been updated.", array(1 => $userDisplayName));
+          $statusMsg .= "<br />" . ts("Pledge Payment for %1 has been updated.", [1 => $userDisplayName]);
         }
       }
     }
@@ -5114,7 +5229,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
    * @return \CRM_Contribute_BAO_Contribution|null
    */
   private static function getOriginalContribution($contributionID) {
-    return self::getValues(array('id' => $contributionID), CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
+    return self::getValues(['id' => $contributionID], CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
   }
 
   /**
@@ -5128,8 +5243,6 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
    * for historical reasons. Going forwards we can hope to add tests & improve readibility
    * of that function
    *
-   * @todo move recordFinancialAccounts & helper functions to their own class?
-   *
    * @param array $params
    *   Params as passed to contribution.create
    *
@@ -5142,6 +5255,8 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
    * @param int $previousLineItemTotal
    *
    * @return float
+   * @todo move recordFinancialAccounts & helper functions to their own class?
+   *
    */
   protected static function getFinancialItemAmountFromParams($params, $context, $lineItemDetails, $isARefund, $previousLineItemTotal) {
     if ($context == 'changedAmount') {
@@ -5168,7 +5283,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
     elseif (empty($lineItemDetails['line_total'])) {
       // follow legacy code path
       Civi::log()
-        ->warning('Deprecated bit of code, please log a ticket explaining how you got here!', array('civi.tag' => 'deprecated'));
+        ->warning('Deprecated bit of code, please log a ticket explaining how you got here!', ['civi.tag' => 'deprecated']);
       return $params['total_amount'];
     }
     else {
@@ -5253,13 +5368,13 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
   public static function updateMembershipBasedOnCompletionOfContribution($contribution, $primaryContributionID, $changeDate) {
     $memberships = self::getRelatedMemberships($contribution->id);
     foreach ($memberships as $membership) {
-      $membershipParams = array(
+      $membershipParams = [
         'id' => $membership['id'],
         'contact_id' => $membership['contact_id'],
         'is_test' => $membership['is_test'],
         'membership_type_id' => $membership['membership_type_id'],
         'membership_activity_status' => 'Completed',
-      );
+      ];
 
       $currentMembership = CRM_Member_BAO_Membership::getContactMembership($membershipParams['contact_id'],
         $membershipParams['membership_type_id'],
@@ -5290,11 +5405,11 @@ LIMIT 1;";
       );
       // @todo remove all this stuff in favour of letting the api call further down handle in
       // (it is a duplication of what the api does).
-      $dates = array_fill_keys(array(
+      $dates = array_fill_keys([
         'join_date',
         'start_date',
         'end_date',
-      ), NULL);
+      ], NULL);
       if ($currentMembership) {
         /*
          * Fixed FOR CRM-4433
@@ -5357,39 +5472,39 @@ LIMIT 1;";
       // but not for Failed contributions, where we don't accept additional payments at the moment.
       // (in some cases the contribution is 'Pending' and only the payment is failed. In those we
       // do accept more payments agains them.
-      return array();
+      return [];
     }
-    $actionLinks = array();
+    $actionLinks = [];
     if ((int) $balance > 0) {
       if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
-        $actionLinks[] = array(
-          'url' => CRM_Utils_System::url('civicrm/payment', array(
+        $actionLinks[] = [
+          'url' => CRM_Utils_System::url('civicrm/payment', [
             'action' => 'add',
             'reset' => 1,
             'id' => $id,
             'mode' => 'live',
-          )),
+          ]),
           'title' => ts('Submit Credit Card payment'),
-        );
+        ];
       }
-      $actionLinks[] = array(
-        'url' => CRM_Utils_System::url('civicrm/payment', array(
+      $actionLinks[] = [
+        'url' => CRM_Utils_System::url('civicrm/payment', [
           'action' => 'add',
           'reset' => 1,
           'id' => $id,
-        )),
+        ]),
         'title' => ts('Record Payment'),
-      );
+      ];
     }
     elseif ((int) $balance < 0) {
-      $actionLinks[] = array(
-        'url' => CRM_Utils_System::url('civicrm/payment', array(
+      $actionLinks[] = [
+        'url' => CRM_Utils_System::url('civicrm/payment', [
           'action' => 'add',
           'reset' => 1,
           'id' => $id,
-        )),
+        ]),
         'title' => ts('Record Refund'),
-      );
+      ];
     }
     return $actionLinks;
   }
@@ -5535,7 +5650,7 @@ LIMIT 1;";
    * @return null
    */
   public static function recordAlwaysAccountsReceivable(&$trxnParams, $contributionParams) {
-    if (!self::checkContributeSettings('always_post_to_accounts_receivable')) {
+    if (!Civi::settings()->get('always_post_to_accounts_receivable')) {
       return NULL;
     }
     $statusId = $contributionParams['contribution']->contribution_status_id;
@@ -5544,9 +5659,9 @@ LIMIT 1;";
     $previousContributionStatus = empty($contributionParams['prevContribution']) ? NULL : $contributionStatuses[$contributionParams['prevContribution']->contribution_status_id];
     // Return if contribution status is not completed.
     if (!($contributionStatus == 'Completed' && (empty($previousContributionStatus)
-      || (!empty($previousContributionStatus) && $previousContributionStatus == 'Pending'
-        && $contributionParams['prevContribution']->is_pay_later == 0
-      )))
+        || (!empty($previousContributionStatus) && $previousContributionStatus == 'Pending'
+          && $contributionParams['prevContribution']->is_pay_later == 0
+        )))
     ) {
       return NULL;
     }
@@ -5605,9 +5720,9 @@ LIMIT 1;";
  INNER JOIN civicrm_financial_account cfa ON ce.financial_account_id = cfa.id
  WHERE `entity_table` = 'civicrm_financial_type' AND cfa.is_tax = 1 AND ce.account_relationship = %1 GROUP BY cfa.id";
     $accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' "));
-    $queryParams = array(1 => array($accountRel, 'Integer'));
+    $queryParams = [1 => [$accountRel, 'Integer']];
     $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
-    $financialAccount = array();
+    $financialAccount = [];
     while ($dao->fetch()) {
       $financialAccount[$dao->id] = $dao->id;
     }
@@ -5621,6 +5736,7 @@ LIMIT 1;";
    *
    * @param array $eftParams
    *
+   * @throws \CiviCRM_API3_Exception
    */
   public static function createProportionalEntry($entityParams, $eftParams) {
     $paid = 0;
@@ -5644,22 +5760,27 @@ LIMIT 1;";
       FROM civicrm_financial_item fi
       INNER JOIN civicrm_line_item li ON li.id = fi.entity_id and fi.entity_table = 'civicrm_line_item'
       WHERE li.contribution_id = %1";
-    $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contributionId, 'Integer')));
-    $ftIds = $taxItems = array();
+    $dao = CRM_Core_DAO::executeQuery($sql, [
+      1 => [
+        $contributionId,
+        'Integer',
+      ],
+    ]);
+    $ftIds = $taxItems = [];
     $salesTaxFinancialAccount = self::getSalesTaxFinancialAccounts();
     while ($dao->fetch()) {
       /* if sales tax item*/
       if (in_array($dao->financial_account_id, $salesTaxFinancialAccount)) {
-        $taxItems[$dao->price_field_value_id] = array(
+        $taxItems[$dao->price_field_value_id] = [
           'financial_item_id' => $dao->id,
           'amount' => $dao->tax_amount,
-        );
+        ];
       }
       else {
         $ftIds[$dao->price_field_value_id] = $dao->id;
       }
     }
-    return array($ftIds, $taxItems);
+    return [$ftIds, $taxItems];
   }
 
   /**
@@ -5673,12 +5794,13 @@ LIMIT 1;";
    *
    * @param array $taxItems
    *
+   * @throws \CiviCRM_API3_Exception
    */
   public static function createProportionalFinancialEntries($entityParams, $lineItems, $ftIds, $taxItems) {
-    $eftParams = array(
+    $eftParams = [
       'entity_table' => 'civicrm_financial_item',
       'financial_trxn_id' => $entityParams['trxn_id'],
-    );
+    ];
     foreach ($lineItems as $key => $value) {
       if ($value['qty'] == 0) {
         continue;
@@ -5702,13 +5824,13 @@ LIMIT 1;";
    * @throws \CRM_Core_Exception
    */
   protected function loadRelatedEntitiesByID($ids) {
-    $entities = array(
+    $entities = [
       'contact' => 'CRM_Contact_BAO_Contact',
       'contributionRecur' => 'CRM_Contribute_BAO_ContributionRecur',
       'contributionType' => 'CRM_Financial_BAO_FinancialType',
       'financialType' => 'CRM_Financial_BAO_FinancialType',
       'contributionPage' => 'CRM_Contribute_BAO_ContributionPage',
-    );
+    ];
     foreach ($entities as $entity => $bao) {
       if (!empty($ids[$entity])) {
         $this->_relatedObjects[$entity] = new $bao();
@@ -5755,6 +5877,7 @@ LIMIT 1;";
    * @param bool $escapeSmarty
    *
    * @return array
+   * @throws \CiviCRM_API3_Exception
    */
   public static function replaceContributionTokens(
     $contributionIds,
@@ -5766,11 +5889,11 @@ LIMIT 1;";
     $escapeSmarty
   ) {
     if (empty($contributionIds)) {
-      return array();
+      return [];
     }
-    $contributionDetails = array();
+    $contributionDetails = [];
     foreach ($contributionIds as $id) {
-      $result = civicrm_api3('Contribution', 'get', array('id' => $id));
+      $result = civicrm_api3('Contribution', 'get', ['id' => $id]);
       $contributionDetails[$result['values'][$result['id']]['contact_id']]['subject'] = CRM_Utils_Token::replaceContributionTokens($subject, $result, FALSE, $subjectToken, FALSE, $escapeSmarty);
       $contributionDetails[$result['values'][$result['id']]['contact_id']]['text'] = CRM_Utils_Token::replaceContributionTokens($text, $result, FALSE, $messageToken, FALSE, $escapeSmarty);
       $contributionDetails[$result['values'][$result['id']]['contact_id']]['html'] = CRM_Utils_Token::replaceContributionTokens($html, $result, FALSE, $messageToken, FALSE, $escapeSmarty);
index 492afdb67c0bc163bd0ce227482b0fb182e0e437..fa6c55592e32e76087eafd1c25caa7497d46dea4 100644 (file)
@@ -672,33 +672,33 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'title' => ts('Copy of') . ' ',
       ],
     ];
-    $copy = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_ContributionPage', [
+    $copy = CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_ContributionPage', [
       'id' => $id,
     ], NULL, $fieldsFix);
 
     //copying all the blocks pertaining to the contribution page
-    $copyPledgeBlock = &CRM_Core_DAO::copyGeneric('CRM_Pledge_DAO_PledgeBlock', [
+    $copyPledgeBlock = CRM_Core_DAO::copyGeneric('CRM_Pledge_DAO_PledgeBlock', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
       'entity_id' => $copy->id,
     ]);
 
-    $copyMembershipBlock = &CRM_Core_DAO::copyGeneric('CRM_Member_DAO_MembershipBlock', [
+    $copyMembershipBlock = CRM_Core_DAO::copyGeneric('CRM_Member_DAO_MembershipBlock', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
       'entity_id' => $copy->id,
     ]);
 
-    $copyUFJoin = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', [
+    $copyUFJoin = CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
       'entity_id' => $copy->id,
     ]);
 
-    $copyWidget = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Widget', [
+    $copyWidget = CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Widget', [
       'contribution_page_id' => $id,
     ], [
       'contribution_page_id' => $copy->id,
@@ -707,14 +707,14 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
     //copy price sets
     CRM_Price_BAO_PriceSet::copyPriceSet('civicrm_contribution_page', $id, $copy->id);
 
-    $copyTellFriend = &CRM_Core_DAO::copyGeneric('CRM_Friend_DAO_Friend', [
+    $copyTellFriend = CRM_Core_DAO::copyGeneric('CRM_Friend_DAO_Friend', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
       'entity_id' => $copy->id,
     ]);
 
-    $copyPersonalCampaignPages = &CRM_Core_DAO::copyGeneric('CRM_PCP_DAO_PCPBlock', [
+    $copyPersonalCampaignPages = CRM_Core_DAO::copyGeneric('CRM_PCP_DAO_PCPBlock', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
@@ -722,7 +722,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
       'target_entity_id' => $copy->id,
     ]);
 
-    $copyPremium = &CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Premium', [
+    $copyPremium = CRM_Core_DAO::copyGeneric('CRM_Contribute_DAO_Premium', [
       'entity_id' => $id,
       'entity_table' => 'civicrm_contribution_page',
     ], [
index 73a6cdc3e7a845e10fcf2266f718747a9fdb5997..a416a9573f2031f630ffaa4deec4b5f363d66a68 100644 (file)
@@ -263,7 +263,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi
    * @return bool
    */
   public static function cancelRecurContribution($params) {
-    if (is_int($params)) {
+    if (is_numeric($params)) {
       CRM_Core_Error::deprecatedFunctionWarning('You are using a BAO function whose signature has changed. Please use the ContributionRecur.cancel api');
       $params = ['id' => $params];
     }
index 3c51f78c2357ca658d922e1ddc88fcfc8d30c176..56e688cf067c6cac2879732619a69388a36e603b 100644 (file)
@@ -47,8 +47,12 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
    *   Associative array of contribution fields
    */
   public static function getFields($checkPermission = TRUE) {
-    if (!isset(\Civi::$statics[__CLASS__]) || !isset(\Civi::$statics[__CLASS__]['fields']) || !isset(\Civi::$statics[__CLASS__]['contribution'])) {
-      $fields = CRM_Contribute_BAO_Contribution::exportableFields($checkPermission);
+    if (!isset(\Civi::$statics[__CLASS__]) || !isset(\Civi::$statics[__CLASS__]['fields']) || !isset(\Civi::$statics[__CLASS__]['fields']['contribution'])) {
+      // Adding fields with some care as those without unique names could clobber others.
+      // Refer to CRM_Contribute_Form_SearchTest for existing tests ... and to add more!
+      $testedRecurFields = array_fill_keys(['contribution_recur_trxn_id', 'contribution_recur_processor_id', 'contribution_recur_payment_processor_id'], 1);
+      $recurFields = array_intersect_key(CRM_Contribute_DAO_ContributionRecur::fields(), $testedRecurFields);
+      $fields = array_merge($recurFields, CRM_Contribute_BAO_Contribution::exportableFields($checkPermission));
       CRM_Contribute_BAO_Contribution::appendPseudoConstantsToFields($fields);
       unset($fields['contribution_contact_id']);
       \Civi::$statics[__CLASS__]['fields']['contribution'] = $fields;
@@ -382,13 +386,12 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
 
       case 'contribution_recur_processor_id':
       case 'contribution_recur_trxn_id':
-        $fieldName = str_replace('contribution_recur_', '', $name);
-        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.{$fieldName}",
+        $spec = $fields[$name];
+        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($spec['where'],
           $op, $value, "String"
         );
-        $recurFields = CRM_Contribute_DAO_ContributionRecur::fields();
-        $query->_qill[$grouping][] = ts("Recurring Contribution %1 %2 '%3'", [1 => $recurFields[$fieldName]['title'], 2 => $op, 3 => $value]);
-        $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
+        $query->_qill[$grouping][] = ts("Recurring Contribution %1 %2 '%3'", [1 => $fields[$name]['title'], 2 => $op, 3 => $value]);
+        $query->_tables[$spec['table_name']] = $query->_whereTables[$spec['table_name']] = 1;
         return;
 
       case 'contribution_recur_payment_made':
@@ -486,8 +489,6 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
       default:
         //all other elements are handle in this case
         $fldName = substr($name, 13);
-        CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes);
-        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.financial_type_id", 'IN', array_keys($financialTypes), 'String');
         if (!isset($fields[$fldName])) {
           // CRM-12597
           CRM_Core_Session::setStatus(ts(
index 45ecc4116cf8a89024050c2906b22a52a95ffb55..e4bff0b4ffec2548eb01f5e4f8ef87666d900e8b 100644 (file)
@@ -127,6 +127,7 @@ class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget {
         $now = time();
         if ($dao->start_date) {
           $startDate = CRM_Utils_Date::unixTime($dao->start_date);
+          $data['start_date'] = $dao->start_date;
           if ($startDate && $startDate >= $now) {
             $data['is_active'] = FALSE;
             $data['campaign_start'] = ts('Campaign starts on %1', [
@@ -137,6 +138,7 @@ class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget {
 
         if ($dao->end_date) {
           $endDate = CRM_Utils_Date::unixTime($dao->end_date);
+          $data['end_date'] = $dao->end_date;
           if ($endDate &&
             $endDate < $now
           ) {
index c95672ed773ef34f5cdb4dcb6142f912cce7138d..b628edef8cc62bb2e23c8986612da24f01f01951 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Contribution.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:99cdf75ae6e6bf73bc5ff6871a3baf82)
+ * (GenCodeChecksum:7a81b495b5661ae881321938d4ee38c9)
  */
 
 /**
@@ -31,35 +31,35 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
   /**
    * Contribution ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to Financial Type for (total_amount - non_deductible_amount).
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
   /**
    * The Contribution Page which triggered this contribution
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_page_id;
 
   /**
    * FK to Payment Instrument
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
@@ -167,29 +167,29 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
   /**
    * Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_recur_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_pay_later;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $contribution_status_id;
 
   /**
    * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.
    *
-   * @var int unsigned
+   * @var int
    */
   public $address_id;
 
@@ -201,7 +201,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
   /**
    * The campaign for which this contribution has been triggered.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
@@ -315,7 +315,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'contribution_page_id' => [
           'name' => 'contribution_page_id',
@@ -337,7 +337,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
             'table' => 'civicrm_contribution_page',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'payment_instrument_id' => [
           'name' => 'payment_instrument_id',
@@ -357,7 +357,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
         'receive_date' => [
           'name' => 'receive_date',
@@ -385,7 +385,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'description' => ts('Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution.non_deductible_amount',
@@ -409,7 +409,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution.total_amount',
@@ -431,7 +431,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'description' => ts('actual processor fee if known - may be 0.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution.fee_amount',
@@ -453,7 +453,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution.net_amount',
@@ -550,7 +550,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'cancel_date' => [
           'name' => 'cancel_date',
@@ -723,7 +723,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'contribution_status',
             'optionEditPath' => 'civicrm/admin/options/contribution_status',
-          ]
+          ],
         ],
         'contribution_address_id' => [
           'name' => 'address_id',
@@ -776,7 +776,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'creditnote_id' => [
           'name' => 'creditnote_id',
@@ -804,7 +804,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'description' => ts('Total tax amount of this contribution.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution.tax_amount',
index e75fa97d995eff5fbf557ff3a6beb221e4a367b4..e7d37109d37084c79482581a9981215832501733 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionPage.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:923a4b6d8829d7aa6cc24e18d62114ff)
+ * (GenCodeChecksum:c6e11bf69550f2253d2a287e8ebeae3d)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * Contribution Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,7 +52,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * default financial type assigned to contributions submitted via this page, e.g. Contribution, Campaign Contribution
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -66,28 +66,28 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * if true - processing logic must reject transaction at confirmation stage if pay method != credit card
    *
-   * @var boolean
+   * @var bool
    */
   public $is_credit_card_only;
 
   /**
    * if true - allows real-time monetary transactions otherwise non-monetary transactions
    *
-   * @var boolean
+   * @var bool
    */
   public $is_monetary;
 
   /**
    * if true - allows recurring contributions, valid only for PayPal_Standard
    *
-   * @var boolean
+   * @var bool
    */
   public $is_recur;
 
   /**
    * if false, the confirm page in contribution pages gets skipped
    *
-   * @var boolean
+   * @var bool
    */
   public $is_confirm_enabled;
 
@@ -101,28 +101,28 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * if true - supports recurring intervals
    *
-   * @var boolean
+   * @var bool
    */
   public $is_recur_interval;
 
   /**
    * if true - asks user for recurring installments
    *
-   * @var boolean
+   * @var bool
    */
   public $is_recur_installments;
 
   /**
    * if true - user is able to adjust payment start date
    *
-   * @var boolean
+   * @var bool
    */
   public $adjust_recur_start_date;
 
   /**
    * if true - allows the user to send payment directly to the org later
    *
-   * @var boolean
+   * @var bool
    */
   public $is_pay_later;
 
@@ -143,7 +143,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * is partial payment enabled for this online contribution page
    *
-   * @var boolean
+   * @var bool
    */
   public $is_partial_payment;
 
@@ -171,14 +171,14 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * if true, page will include an input text field where user can enter their own amount
    *
-   * @var boolean
+   * @var bool
    */
   public $is_allow_other_amount;
 
   /**
    * FK to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $default_amount_id;
 
@@ -227,7 +227,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * if true, receipt is automatically emailed to contact on success
    *
-   * @var boolean
+   * @var bool
    */
   public $is_email_receipt;
 
@@ -269,7 +269,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -283,7 +283,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $amount_block_is_active;
 
@@ -304,7 +304,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who created this contribution page
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -325,21 +325,21 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
   /**
    * The campaign for which we are collecting contributions with this page.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Can people share the contribution page through social media?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_share;
 
   /**
    * if true - billing block is required for online contribution page
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing_required;
 
@@ -435,7 +435,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'payment_processor' => [
           'name' => 'payment_processor',
@@ -456,7 +456,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
             'table' => 'civicrm_payment_processor',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'is_credit_card_only' => [
           'name' => 'is_credit_card_only',
@@ -526,7 +526,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
             'optionGroupName' => 'recur_frequency_units',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
-          ]
+          ],
         ],
         'is_recur_interval' => [
           'name' => 'is_recur_interval',
@@ -641,7 +641,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'description' => ts('Minimum initial amount for partial payment'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_contribution_page.min_initial_amount',
           'table_name' => 'civicrm_contribution_page',
@@ -679,7 +679,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'description' => ts('if other amounts allowed, user can configure minimum allowed.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_contribution_page.min_amount',
           'table_name' => 'civicrm_contribution_page',
@@ -694,7 +694,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'description' => ts('if other amounts allowed, user can configure maximum allowed.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_contribution_page.max_amount',
           'table_name' => 'civicrm_contribution_page',
@@ -709,7 +709,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'description' => ts('The target goal for this page, allows people to build a goal meter'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_contribution_page.goal_amount',
           'table_name' => 'civicrm_contribution_page',
@@ -949,7 +949,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'campaign_id' => [
           'name' => 'campaign_id',
@@ -966,7 +966,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'is_share' => [
           'name' => 'is_share',
index 8fa970114ce33951e5c86b4301894c01a60a2b3b..5913150b44b50933f08a82d9d1d4c0703339f9c5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b5a1b3fa2819c4dfe99635fef8583a42)
+ * (GenCodeChecksum:565e6473df8dd62f25ba951b18860b5c)
  */
 
 /**
@@ -29,17 +29,17 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $product_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
@@ -84,7 +84,7 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO {
   /**
    * FK to Financial Type(for membership price sets only).
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -245,7 +245,7 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 9eedb5c3079750467909577d6861f2e20d0b5d38..3b5fcb2f66351a0653795d4f90fdc507eb6ebd0e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2ccc42487b9e4e5774fcfcde7db9c5ae)
+ * (GenCodeChecksum:02897f2c575bc43e915d0b7e8ee68fbb)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   /**
    * Contribution Recur ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign key to civicrm_contact.id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -66,14 +66,14 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   /**
    * Number of time units for recurrence of payment.
    *
-   * @var int unsigned
+   * @var int
    */
   public $frequency_interval;
 
   /**
    * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.
    *
-   * @var int unsigned
+   * @var int
    */
   public $installments;
 
@@ -129,7 +129,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   /**
    * Optionally used to store a link to a payment token used for this recurring contribution.
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_token_id;
 
@@ -148,19 +148,19 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   public $invoice_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $contribution_status_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
    * Day in the period when the payment should be charged e.g. 1st of month, 15th etc.
    *
-   * @var int unsigned
+   * @var int
    */
   public $cycle_day;
 
@@ -174,7 +174,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   /**
    * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.
    *
-   * @var int unsigned
+   * @var int
    */
   public $failure_count;
 
@@ -188,42 +188,42 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   /**
    * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.
    *
-   * @var boolean
+   * @var bool
    */
   public $auto_renew;
 
   /**
    * Foreign key to civicrm_payment_processor.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_processor_id;
 
   /**
    * FK to Financial Type
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
   /**
    * FK to Payment Instrument
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
   /**
    * The campaign for which this contribution has been triggered.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * if true, receipt is automatically emailed to contact on each successful payment
    *
-   * @var boolean
+   * @var bool
    */
   public $is_email_receipt;
 
@@ -262,7 +262,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
   public static function &fields() {
     if (!isset(Civi::$statics[__CLASS__]['fields'])) {
       Civi::$statics[__CLASS__]['fields'] = [
-        'id' => [
+        'contribution_recur_id' => [
           'name' => 'id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Recurring Contribution ID'),
@@ -298,7 +298,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_contribution_recur.amount',
           'table_name' => 'civicrm_contribution_recur',
@@ -330,7 +330,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'frequency_unit' => [
           'name' => 'frequency_unit',
@@ -352,7 +352,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'optionGroupName' => 'recur_frequency_units',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
-          ]
+          ],
         ],
         'frequency_interval' => [
           'name' => 'frequency_interval',
@@ -474,7 +474,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'formatType' => 'activityDate',
           ],
         ],
-        'processor_id' => [
+        'contribution_recur_processor_id' => [
           'name' => 'processor_id',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Processor ID'),
@@ -502,7 +502,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
           'localizable' => 0,
           'FKClassName' => 'CRM_Financial_DAO_PaymentToken',
         ],
-        'trxn_id' => [
+        'contribution_recur_trxn_id' => [
           'name' => 'trxn_id',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Transaction ID'),
@@ -534,7 +534,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'type' => 'Text',
           ],
         ],
-        'contribution_status_id' => [
+        'contribution_recur_contribution_status_id' => [
           'name' => 'contribution_status_id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Status'),
@@ -552,7 +552,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'contribution_status',
             'optionEditPath' => 'civicrm/admin/options/contribution_status',
-          ]
+          ],
         ],
         'is_test' => [
           'name' => 'is_test',
@@ -647,7 +647,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'type' => 'CheckBox',
           ],
         ],
-        'payment_processor_id' => [
+        'contribution_recur_payment_processor_id' => [
           'name' => 'payment_processor_id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Payment Processor'),
@@ -665,7 +665,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'table' => 'civicrm_payment_processor',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'financial_type_id' => [
           'name' => 'financial_type_id',
@@ -686,7 +686,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'payment_instrument_id' => [
           'name' => 'payment_instrument_id',
@@ -704,7 +704,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
         'contribution_campaign_id' => [
           'name' => 'campaign_id',
@@ -726,7 +726,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'is_email_receipt' => [
           'name' => 'is_email_receipt',
index 75f2dcd4a76043c65afae47781a8a547a3d3812c..129b3a32ada6b44e37414eeb9bf37f5de3981de9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b9a4bdee130cdaf934a53e456cd0e3e8)
+ * (GenCodeChecksum:12f49d75296e9500e850dd63741372ea)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
   /**
    * Soft Contribution ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to contribution table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -66,12 +66,12 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
   /**
    * FK to civicrm_pcp.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $pcp_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $pcp_display_in_roll;
 
@@ -88,7 +88,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
   /**
    * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $soft_credit_type_id;
 
@@ -177,7 +177,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_contribution_soft.amount',
@@ -210,7 +210,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'pcp_id' => [
           'name' => 'pcp_id',
@@ -228,7 +228,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
             'table' => 'civicrm_pcp',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'pcp_display_in_roll' => [
           'name' => 'pcp_display_in_roll',
@@ -284,7 +284,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'soft_credit_type',
             'optionEditPath' => 'civicrm/admin/options/soft_credit_type',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 8302aef5e581cd4822eecdd108b5d1e3a0021c0f..48a7bfcd2d29bb9036a6ef99a9ac785a7ee415f5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Premium.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:09b04d3dd373d7dc64bc873b56b5e171)
+ * (GenCodeChecksum:5193d923732bb6b983b32e86e9441d72)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -41,14 +41,14 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
   public $entity_table;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * Is the Premiums feature enabled for this page?
    *
-   * @var boolean
+   * @var bool
    */
   public $premiums_active;
 
@@ -83,7 +83,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
   /**
    * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
    *
-   * @var boolean
+   * @var bool
    */
   public $premiums_display_min_contribution;
 
@@ -95,7 +95,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
   public $premiums_nothankyou_label;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $premiums_nothankyou_position;
 
index ff19638fb7570909eba725c7def3f6fa7981b99c..cdc9f3e15430426b107bff49a974ab04496bbb69 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b6944ad257ea16a60d6c1cf79ca391b0)
+ * (GenCodeChecksum:400970a4b33e5fc5af3784b5dbf9f90c)
  */
 
 /**
@@ -31,33 +31,33 @@ class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO {
   /**
    * Contribution ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign key to premiums settings record.
    *
-   * @var int unsigned
+   * @var int
    */
   public $premiums_id;
 
   /**
    * Foreign key to each product object.
    *
-   * @var int unsigned
+   * @var int
    */
   public $product_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $weight;
 
   /**
    * FK to Financial Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -159,7 +159,7 @@ class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index e897a5476606035aae3a2d18a258e0000a85e9a6..ad147b0646de9c74880da19fc9d781618493aa1f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Product.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7db77c58d48112d25da791aba4586080)
+ * (GenCodeChecksum:27002591d220b4bc2498b367bef17367)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -92,7 +92,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
   /**
    * FK to Financial Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -113,13 +113,13 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
   /**
    * Disabling premium removes it from the premiums_premium join table below.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Rolling means we set start/end based on current day, fixed means we set start/end for current year or month
-   (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006)
+   (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006)
    *
    * @var string
    */
@@ -284,7 +284,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           'description' => ts('Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_product.price',
           'table_name' => 'civicrm_product',
@@ -313,7 +313,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'financial_type_id' => [
           'name' => 'financial_type_id',
@@ -331,7 +331,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'min_contribution' => [
           'name' => 'min_contribution',
@@ -340,7 +340,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           'description' => ts('Minimum contribution required to be eligible to select this premium.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_product.min_contribution',
           'table_name' => 'civicrm_product',
@@ -355,7 +355,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           'description' => ts('Actual cost of this product. Useful to determine net return from sale or using this as an incentive.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_product.cost',
           'table_name' => 'civicrm_product',
@@ -394,7 +394,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::periodType',
-          ]
+          ],
         ],
         'fixed_period_start_day' => [
           'name' => 'fixed_period_start_day',
@@ -425,7 +425,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
-          ]
+          ],
         ],
         'duration_interval' => [
           'name' => 'duration_interval',
@@ -456,7 +456,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getPremiumUnits',
-          ]
+          ],
         ],
         'frequency_interval' => [
           'name' => 'frequency_interval',
index 9d77dfb9bfb3522ca7448a0b1140a0d584506e3a..aa2cbc3fab303b95e4f4f5d58b11931cac354189 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Widget.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0605d26592e841a169687b225d891bc8)
+ * (GenCodeChecksum:c958a95fa7e2ff07a891780d343cd308)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
   /**
    * Contribution Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The Contribution Page which triggered this contribution
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_page_id;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index f410a2bf7130f6d5fb9023ae01d05c22c5c78d1f..62f1fe7a0b301cd38b3c3dfc891da40982ff8e48 100644 (file)
@@ -151,7 +151,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task {
    * Is this contribution associated with an online
    * financial transaction
    *
-   * @var boolean
+   * @var bool
    */
   public $_online = FALSE;
 
index ab46198a0b7aaf84a2e5be3730a4790a9cc0dbcc..081c9a031512d2a6a6420c5368f80ad00deefc52 100644 (file)
@@ -75,7 +75,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    * Is this contribution associated with an online.
    * financial transaction
    *
-   * @var boolean
+   * @var bool
    */
   public $_online = FALSE;
 
@@ -132,8 +132,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
   public $_fromEmails;
 
   /**
-   * ID of from email
-   * @var integer
+   * ID of from email.
+   *
+   * @var int
    */
   public $fromEmailId;
 
@@ -171,8 +172,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
   public $userEmail;
 
   /**
-   * Price set ID
-   * @var integer
+   * Price set ID.
+   *
+   * @var int
    */
   public $_priceSetId;
 
@@ -692,7 +694,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     }
 
     // CRM-16189, add Revenue Recognition Date
-    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+    if (Civi::settings()->get('deferred_revenue_enabled')) {
       $revenueDate = $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5));
       if ($this->_id && !CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($this->_id)) {
         $revenueDate->freeze();
index 971479e6332d2b6c896d7208afd96a88fa06ee89..18fcdc93be35905f83303c9fa8bcfb41641d7069 100644 (file)
@@ -118,7 +118,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
   /**
    * Pcp id
    *
-   * @var integer
+   * @var int
    */
   public $_pcpId;
 
@@ -176,7 +176,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
 
   /**
    * Contribution page supports memberships
-   * @var boolean
+   * @var bool
    */
   public $_useForMember;
 
index a7e95aedfe8d551dfa80d96e785f34e67ee0f84d..0c3833443d0d11d7aa54cea2e37339c3b9e8d318 100644 (file)
@@ -53,21 +53,21 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
   /**
    * Are we in single form mode or wizard mode?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single;
 
   /**
    * Is this the first page?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_first = FALSE;
 
   /**
    * Is this the last page?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_last = FALSE;
 
@@ -339,7 +339,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
       // @todo look to change to $defaults['start_date'] = date('Ymd His');
       // main settings form overrides this to implement above but this is left here
       // 'in case' another extending form uses start_date - for now
-      list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults();
+      $defaults['start_date'] = date('Y-m-d H:i:s');
     }
 
     if (!empty($defaults['recur_frequency_unit'])) {
index ed7efb2d82e9738cb5652499fe9e05752d3f2dce..29fdd78efeca3171dfc74b677d2301262b16089d 100644 (file)
@@ -179,7 +179,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         $this->addElement('checkbox', 'adjust_recur_start_date', ts('Adjust Recurring Start Date'), NULL,
           ['onclick' => "showHideByValue('adjust_recur_start_date',true,'recurDefaults','table-row','radio',false);"]
         );
-        $this->addDate('pledge_calendar_date', ts('Specific Calendar Date'));
+        $this->add('datepicker', 'pledge_calendar_date', ts('Specific Calendar Date'), [], FALSE, ['time' => FALSE]);
         $month = CRM_Utils_Date::getCalendarDayOfMonth();
         $this->add('select', 'pledge_calendar_month', ts('Specific day of Month'), $month);
         $pledgeDefaults = [
@@ -512,7 +512,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
         'calendar_month' => 'pledge_calendar_month',
       ];
       if ($params['pledge_default_toggle'] == 'contribution_date') {
-        $fieldValue = json_encode(['contribution_date' => date('m/d/Y')]);
+        $fieldValue = json_encode(['contribution_date' => date('Y-m-d')]);
       }
       else {
         foreach ($pledgeDateFields as $key => $pledgeDateField) {
index 6d3416ff788cc20a2295957d1dda08cb37b1596f..24ad75822273808065cae65e4001a053d9d3aea3 100644 (file)
@@ -36,6 +36,8 @@
  */
 class CRM_Contribute_Form_ContributionRecur extends CRM_Core_Form {
 
+  use CRM_Core_Form_EntityFormTrait;
+
   /**
    * @var int Contribution ID
    */
@@ -76,6 +78,21 @@ class CRM_Contribute_Form_ContributionRecur extends CRM_Core_Form {
    */
   public $_paymentProcessor = [];
 
+  /**
+   * Fields for the entity to be assigned to the template.
+   *
+   * Fields may have keys
+   *  - name (required to show in tpl from the array)
+   *  - description (optional, will appear below the field)
+   *  - not-auto-addable - this class will not attempt to add the field using addField.
+   *    (this will be automatically set if the field does not have html in it's metadata
+   *    or is not a core field on the form's entity).
+   *  - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']]
+   *  - template - use a field specific template to render this field
+   * @var array
+   */
+  protected $entityFields = [];
+
   /**
    * Explicitly declare the entity api name.
    */
@@ -94,6 +111,7 @@ class CRM_Contribute_Form_ContributionRecur extends CRM_Core_Form {
    * Set variables up before form is built.
    */
   public function preProcess() {
+    $this->setAction(CRM_Core_Action::UPDATE);
     $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
     $this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
     $this->contributionRecurID = $this->_crid;
index 8351b6d9ad8bd399b8215354a4e2a53dcfa01087..c4281faffeda9d9fbd4583accc7358b59014b8c0 100644 (file)
@@ -46,14 +46,14 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index fac10e2ac666ff28d362c845163ec9437f7c9d51..bd509799230a3e8a565d4b9ccc003c2cedd4d8bc 100644 (file)
@@ -54,7 +54,7 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task {
   /**
    * The flag to tell if there are soft credits included.
    *
-   * @var boolean
+   * @var bool
    */
   public $_includesSoftCredits = FALSE;
 
index 8601ee564c11fd73a8fbaf4159d980e237a065a1..0722cd9541a679845cc7951babaae2004c8ac2f1 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific contribution?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 1300c85d5e7e2ce5e90ff3540b3ef4bef635f8bf..56cb5d471b49344bfd258ca059dbd23d1d14f028 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index f2742ee109e2dfb00e38dfad622818ce66593646..a38c5e93274c06302f615ff77a7f1893ed4566e4 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
    * Are we operating in "single mode", i.e. updating the task of only
    * one specific contribution?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index c27b4fd176ac0d65fb3ebfced6cd9212d79a04af..96d9985e9ae1e3608d44369575b122b198d238fa 100644 (file)
@@ -41,7 +41,7 @@ class CRM_Contribute_Form_Task_PDF extends CRM_Contribute_Form_Task {
    * Are we operating in "single mode", i.e. updating the task of only
    * one specific contribution?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index 348ed223870d9782034c74e6058f987448fedfd3..bc291dc167b35b69b858d193e7b3f584c14628f9 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Contribute_Form_Task_Status extends CRM_Contribute_Form_Task {
    * Are we operating in "single mode", i.e. updating the task of only
    * one specific contribution?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index 969441ef83e98aa614a594cbe88c32b795740a21..83943e405a39a8dcd13d7ded061eadfc0140d1ab 100644 (file)
@@ -56,8 +56,9 @@ class CRM_Contribute_Import_Field {
   public $_type;
 
   /**
-   * Is this field required
-   * @var boolean
+   * Is this field required.
+   *
+   * @var bool
    */
   public $_required;
 
index 939eef3d8018cb4e131661452f038b37e5ffc3c9..9ceac6a63d6e137dc578b0475dce005a1ad4569e 100644 (file)
@@ -114,7 +114,7 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
   /**
    * Whether the file has a column header or not
    *
-   * @var boolean
+   * @var bool
    */
   protected $_haveColumnHeader;
 
index f2250641c62530a6f4aad5bb3119f8da0e397da3..1c2d23a3bc422c5019bf404320f8c0b8f9f3fa78 100644 (file)
@@ -83,14 +83,14 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 638976ea32831afba220f0b4e638c8bead94f141..7ce505434d166204c961d239c5357a8f7e62d278 100644 (file)
@@ -41,7 +41,7 @@ class CRM_Core_Action {
    * Different possible actions are defined here. Keep in sync with the
    * constant from CRM_Core_Form for various modes.
    *
-   * @var integer const
+   * @var int
    */
   const
     NONE = 0,
@@ -298,6 +298,65 @@ class CRM_Core_Action {
     return $result;
   }
 
+  /**
+   * Given a set of links and a mask, return a filtered (by mask) array containing the final links with parsed values
+   *   and calling hooks as appropriate.
+   * Use this when passing a set of action links to the API or to the form without adding html formatting.
+   *
+   * @param array $links
+   *   The set of link items.
+   * @param int $mask
+   *   The mask to be used. a null mask means all items.
+   * @param array $values
+   *   The array of values for parameter substitution in the link items.
+   * @param null $op
+   * @param null $objectName
+   * @param int $objectId
+   *
+   * @return array|null
+   *   The array describing each link
+   */
+  public static function filterLinks(
+    $links,
+    $mask,
+    $values,
+    $op = NULL,
+    $objectName = NULL,
+    $objectId = NULL
+  ) {
+    if (empty($links)) {
+      return NULL;
+    }
+
+    // make links indexed sequentially instead of by bitmask
+    // otherwise it's next to impossible to reliably add new ones
+    $seqLinks = array();
+    foreach ($links as $bit => $link) {
+      $link['bit'] = $bit;
+      $seqLinks[] = $link;
+    }
+
+    if ($op && $objectName && $objectId) {
+      CRM_Utils_Hook::links($op, $objectName, $objectId, $seqLinks, $mask, $values);
+    }
+
+    foreach ($seqLinks as $i => $link) {
+      if (!$mask || !array_key_exists('bit', $link) || ($mask & $link['bit'])) {
+        $seqLinks[$i]['extra'] = isset($link['extra']) ? self::replace($link['extra'], $values) : NULL;
+
+        if (isset($link['qs']) && !CRM_Utils_System::isNull($link['qs'])) {
+          $seqLinks[$i]['url'] = self::replace($link['url'], $values);
+          $seqLinks[$i]['qs'] = self::replace($link['qs'], $values);
+        }
+      }
+      else {
+        unset($seqLinks[$i]);
+      }
+    }
+
+    return $seqLinks;
+  }
+
   /**
    * Given a string and an array of values, substitute the real values
    * in the placeholder in the str in the CiviCRM format
index af9acb87a39d374a2b766614cbab2ef8f8672f1e..ba2130a493dfad2dbc1c70f8720c9edc2c0b82f0 100644 (file)
@@ -546,6 +546,12 @@ FROM civicrm_action_schedule cas
       return ["sms_phone_missing" => "Couldn't find recipient's phone number."];
     }
 
+    // dev/core#369 If an SMS provider is deleted then the relevant row in the action_schedule_table is set to NULL
+    // So we need to exclude them.
+    if (CRM_Utils_System::isNull($schedule->sms_provider_id)) {
+      return ["sms_provider_missing" => "SMS reminder cannot be sent because the SMS provider has been deleted."];
+    }
+
     $messageSubject = $tokenRow->render('subject');
     $sms_body_text = $tokenRow->render('sms_body_text');
 
index b5ec97d74863f4ae97c01a1364d571eddc120270..cbe0066deca007b27622f88ec14cfc62b5394c10 100644 (file)
@@ -1063,7 +1063,6 @@ SELECT is_primary,
       $addressDAO->copyValues($params);
       $addressDAO->id = $dao->id;
       $addressDAO->save();
-      $addressDAO->free();
     }
   }
 
@@ -1319,6 +1318,9 @@ SELECT is_primary,
           }
         }
         if (!empty($props['country_id'])) {
+          if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', (array) $props['country_id']))) {
+            throw new CRM_Core_Exception(ts('Province limit or default country setting is incorrect'));
+          }
           $params['condition'] = 'country_id IN (' . implode(',', (array) $props['country_id']) . ')';
         }
         break;
@@ -1331,6 +1333,9 @@ SELECT is_primary,
         if ($context != 'get' && $context != 'validate') {
           $config = CRM_Core_Config::singleton();
           if (!empty($config->countryLimit) && is_array($config->countryLimit)) {
+            if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', $config->countryLimit))) {
+              throw new CRM_Core_Exception(ts('Available Country setting is incorrect'));
+            }
             $params['condition'] = 'id IN (' . implode(',', $config->countryLimit) . ')';
           }
         }
@@ -1339,6 +1344,9 @@ SELECT is_primary,
       // Filter county list based on chosen state
       case 'county_id':
         if (!empty($props['state_province_id'])) {
+          if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', (array) $props['state_province_id']))) {
+            throw new CRM_Core_Exception(ts('Can only accept Integers for state_province_id filtering'));
+          }
           $params['condition'] = 'state_province_id IN (' . implode(',', (array) $props['state_province_id']) . ')';
         }
         break;
index a9ffa34e2f4461182c95675d6de1e5b2f9f67675..d37b01d94e5d24e40af664835c94a122a3b7fd66 100644 (file)
@@ -277,7 +277,6 @@ class CRM_Core_BAO_Block {
             $block->is_primary = FALSE;
             $block->save();
           }
-          $block->free();
         }
       }
     }
index 71e597832d062bcb3f17654d6419551eaab1c0b4..5c49f22862c377d692cca10a9a71df7715fa96f8 100644 (file)
@@ -599,7 +599,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         if (!empty($customDataSubType)) {
           $subtypeClause = array();
           foreach ($customDataSubType as $subtype) {
-            $subtype = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR;
+            $subtype = CRM_Core_DAO::VALUE_SEPARATOR . CRM_Utils_Type::escape($subtype, 'String') . CRM_Core_DAO::VALUE_SEPARATOR;
             $subtypeClause[] = "$cgTable.extends_entity_column_value LIKE '%{$subtype}%'";
           }
           if (!$onlySubType) {
@@ -1421,18 +1421,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         }
         break;
 
-      case 'Autocomplete-Select':
-        if ($customField->data_type == 'ContactReference') {
-          if (is_numeric($value)) {
-            $defaults[$elementName . '_id'] = $value;
-            $defaults[$elementName] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $value, 'sort_name');
-          }
-        }
-        else {
-          $defaults[$elementName] = $value;
-        }
-        break;
-
       default:
         $defaults[$elementName] = $value;
     }
@@ -2050,7 +2038,6 @@ AND    cf.id = %1";
       if (!$dao->fetch()) {
         CRM_Core_Error::fatal();
       }
-      $dao->free();
       $fieldValues = array($dao->table_name, $dao->column_name, $dao->id);
       $cache->set($cacheKey, $fieldValues);
     }
index d20a3188d9165365014014b464fcd461a2777752..b74b6637bd080596fc65304a1c61b18214f139a0 100644 (file)
@@ -481,6 +481,7 @@ LEFT JOIN civicrm_custom_field ON (civicrm_custom_field.custom_group_id = civicr
 
     $params = [];
     $sqlParamKey = 1;
+    $subType = '';
     if (!empty($subTypes)) {
       foreach ($subTypes as $key => $subType) {
         $subTypeClauses[] = self::whereListHas("civicrm_custom_group.extends_entity_column_value", self::validateSubTypeByEntity($entityType, $subType));
@@ -562,67 +563,7 @@ ORDER BY civicrm_custom_group.weight,
     }
 
     if (empty($groupTree)) {
-      $groupTree = $multipleFieldGroups = [];
-      $crmDAO = CRM_Core_DAO::executeQuery($queryString, $params);
-      $customValueTables = [];
-
-      // process records
-      while ($crmDAO->fetch()) {
-        // get the id's
-        $groupID = $crmDAO->civicrm_custom_group_id;
-        $fieldId = $crmDAO->civicrm_custom_field_id;
-        if ($crmDAO->civicrm_custom_group_is_multiple) {
-          $multipleFieldGroups[$groupID] = $crmDAO->civicrm_custom_group_table_name;
-        }
-        // create an array for groups if it does not exist
-        if (!array_key_exists($groupID, $groupTree)) {
-          $groupTree[$groupID] = [];
-          $groupTree[$groupID]['id'] = $groupID;
-
-          // populate the group information
-          foreach ($toReturn['custom_group'] as $fieldName) {
-            $fullFieldName = "civicrm_custom_group_$fieldName";
-            if ($fieldName == 'id' ||
-              is_null($crmDAO->$fullFieldName)
-            ) {
-              continue;
-            }
-            // CRM-5507
-            // This is an old bit of code - per the CRM number & probably does not work reliably if
-            // that one contact sub-type exists.
-            if ($fieldName == 'extends_entity_column_value' && !empty($subTypes[0])) {
-              $groupTree[$groupID]['subtype'] = self::validateSubTypeByEntity($entityType, $subType);
-            }
-            $groupTree[$groupID][$fieldName] = $crmDAO->$fullFieldName;
-          }
-          $groupTree[$groupID]['fields'] = [];
-
-          $customValueTables[$crmDAO->civicrm_custom_group_table_name] = [];
-        }
-
-        // add the fields now (note - the query row will always contain a field)
-        // we only reset this once, since multiple values come is as multiple rows
-        if (!array_key_exists($fieldId, $groupTree[$groupID]['fields'])) {
-          $groupTree[$groupID]['fields'][$fieldId] = [];
-        }
-
-        $customValueTables[$crmDAO->civicrm_custom_group_table_name][$crmDAO->civicrm_custom_field_column_name] = 1;
-        $groupTree[$groupID]['fields'][$fieldId]['id'] = $fieldId;
-        // populate information for a custom field
-        foreach ($toReturn['custom_field'] as $fieldName) {
-          $fullFieldName = "civicrm_custom_field_$fieldName";
-          if ($fieldName == 'id' ||
-            is_null($crmDAO->$fullFieldName)
-          ) {
-            continue;
-          }
-          $groupTree[$groupID]['fields'][$fieldId][$fieldName] = $crmDAO->$fullFieldName;
-        }
-      }
-
-      if (!empty($customValueTables)) {
-        $groupTree['info'] = ['tables' => $customValueTables];
-      }
+      list($multipleFieldGroups, $groupTree) = self::buildGroupTree($entityType, $toReturn, $subTypes, $queryString, $params, $subType);
 
       $cache->set($cacheKey, $groupTree);
       $cache->set($multipleFieldGroupCacheKey, $multipleFieldGroups);
@@ -2212,4 +2153,82 @@ SELECT  civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
     return $multipleGroup;
   }
 
+  /**
+   * Build the metadata tree for the custom group.
+   *
+   * @param string $entityType
+   * @param array $toReturn
+   * @param array $subTypes
+   * @param string $queryString
+   * @param array $params
+   * @param string $subType
+   *
+   * @return array
+   * @throws \CRM_Core_Exception
+   */
+  private static function buildGroupTree($entityType, $toReturn, $subTypes, $queryString, $params, $subType) {
+    $groupTree = $multipleFieldGroups = [];
+    $crmDAO = CRM_Core_DAO::executeQuery($queryString, $params);
+    $customValueTables = [];
+
+    // process records
+    while ($crmDAO->fetch()) {
+      // get the id's
+      $groupID = $crmDAO->civicrm_custom_group_id;
+      $fieldId = $crmDAO->civicrm_custom_field_id;
+      if ($crmDAO->civicrm_custom_group_is_multiple) {
+        $multipleFieldGroups[$groupID] = $crmDAO->civicrm_custom_group_table_name;
+      }
+      // create an array for groups if it does not exist
+      if (!array_key_exists($groupID, $groupTree)) {
+        $groupTree[$groupID] = [];
+        $groupTree[$groupID]['id'] = $groupID;
+
+        // populate the group information
+        foreach ($toReturn['custom_group'] as $fieldName) {
+          $fullFieldName = "civicrm_custom_group_$fieldName";
+          if ($fieldName == 'id' ||
+            is_null($crmDAO->$fullFieldName)
+          ) {
+            continue;
+          }
+          // CRM-5507
+          // This is an old bit of code - per the CRM number & probably does not work reliably if
+          // that one contact sub-type exists.
+          if ($fieldName == 'extends_entity_column_value' && !empty($subTypes[0])) {
+            $groupTree[$groupID]['subtype'] = self::validateSubTypeByEntity($entityType, $subType);
+          }
+          $groupTree[$groupID][$fieldName] = $crmDAO->$fullFieldName;
+        }
+        $groupTree[$groupID]['fields'] = [];
+
+        $customValueTables[$crmDAO->civicrm_custom_group_table_name] = [];
+      }
+
+      // add the fields now (note - the query row will always contain a field)
+      // we only reset this once, since multiple values come is as multiple rows
+      if (!array_key_exists($fieldId, $groupTree[$groupID]['fields'])) {
+        $groupTree[$groupID]['fields'][$fieldId] = [];
+      }
+
+      $customValueTables[$crmDAO->civicrm_custom_group_table_name][$crmDAO->civicrm_custom_field_column_name] = 1;
+      $groupTree[$groupID]['fields'][$fieldId]['id'] = $fieldId;
+      // populate information for a custom field
+      foreach ($toReturn['custom_field'] as $fieldName) {
+        $fullFieldName = "civicrm_custom_field_$fieldName";
+        if ($fieldName == 'id' ||
+          is_null($crmDAO->$fullFieldName)
+        ) {
+          continue;
+        }
+        $groupTree[$groupID]['fields'][$fieldId][$fieldName] = $crmDAO->$fullFieldName;
+      }
+    }
+
+    if (!empty($customValueTables)) {
+      $groupTree['info'] = ['tables' => $customValueTables];
+    }
+    return [$multipleFieldGroups, $groupTree];
+  }
+
 }
index 9fa273922bbb6d0e3027af413435b48c1c7bacfd..0eb77b2cfff97317443cae486ef77a05cdf61336 100644 (file)
@@ -348,10 +348,8 @@ SET    {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
         ];
       }
       $sql = "UPDATE `{$customGroup->table_name}` SET `{$customField->column_name}` = REPLACE(`{$customField->column_name}`, %1, %2) WHERE `{$customField->column_name}` LIKE %3";
-      $customGroup->free();
       CRM_Core_DAO::executeQuery($sql, $params);
     }
-    $customField->free();
   }
 
 }
index 790487e43891b62c2bad6ab03afddb2d63310603..610478c603f94a3e269bf32723c436490ecc182a 100644 (file)
@@ -96,7 +96,7 @@ class CRM_Core_BAO_CustomQuery {
   /**
    * Searching for contacts?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_contactSearch;
 
@@ -351,6 +351,12 @@ SELECT f.id, f.label, f.data_type,
                 foreach ($value as $key => $val) {
                   $value[$key] = str_replace(['[', ']', ','], ['\[', '\]', '[:comma:]'], $val);
                   $value[$key] = str_replace('|', '[:separator:]', $value[$key]);
+                  if ($field['data_type'] == 'String') {
+                    $value[$key] = CRM_Utils_Type::escape($value[$key], 'String');
+                  }
+                  elseif ($value) {
+                    $value[$key] = CRM_Utils_Type::escape($value[$key], 'Integer');
+                  }
                 }
                 $value = implode(',', $value);
               }
index dac03b0075093b46732b629d001131085cede8d6..759e83a71954d764bceecafa0e8195dd8a95b45d 100644 (file)
@@ -176,7 +176,6 @@ class CRM_Core_BAO_CustomValueTable {
               $entityFileDAO->entity_id = $field['entity_id'];
               $entityFileDAO->file_id = $field['file_id'];
               $entityFileDAO->save();
-              $entityFileDAO->free();
               $value = $field['file_id'];
               $type = 'String';
               break;
@@ -536,16 +535,17 @@ AND    $cond
    * @return array
    */
   public static function setValues(&$params) {
+    // For legacy reasons, accept this param in either format
+    if (empty($params['entityID']) && !empty($params['entity_id'])) {
+      $params['entityID'] = $params['entity_id'];
+    }
 
-    if (!isset($params['entityID']) ||
-      CRM_Utils_Type::escape($params['entityID'], 'Integer', FALSE) === NULL
-    ) {
-      return CRM_Core_Error::createAPIError(ts('entityID needs to be set and of type Integer'));
+    if (!isset($params['entityID']) || !CRM_Utils_Type::validate($params['entityID'], 'Integer', FALSE)) {
+      return CRM_Core_Error::createAPIError(ts('entity_id needs to be set and of type Integer'));
     }
 
     // first collect all the id/value pairs. The format is:
     // custom_X => value or custom_X_VALUEID => value (for multiple values), VALUEID == -1, -2 etc for new insertions
-    $values = [];
     $fieldValues = [];
     foreach ($params as $n => $v) {
       if ($customFieldInfo = CRM_Core_BAO_CustomField::getKeyID($n, TRUE)) {
index c9a1265d671ed7dec42d0752e4e6e171cd2a8549..c2c06bd279fbc166fe15af0537e3f7c2afe6d840 100644 (file)
@@ -210,7 +210,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $fileDAO = new CRM_Core_DAO_File();
     $fileDAO->id = $fileID;
     if (!$fileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal();
+      throw new CRM_Core_Exception(ts('File not found'));
     }
 
     // lets call a pre hook before the delete, so attachments hooks can get the info before things
@@ -226,7 +226,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $entityFileDAO->entity_table = $tableName;
 
     if (!$entityFileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
+      throw new CRM_Core_Exception(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
     }
 
     $entityFileDAO->delete();
index 0509a0af47b60aaeb5182445c65831af7c3b3850..867a0433754a84742218e980137447d5c3cb7f8a 100644 (file)
@@ -159,7 +159,7 @@ class CRM_Core_BAO_Job extends CRM_Core_DAO_Job {
       ],
       'replace' => $params,
     ];
-    $copy = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_Job', ['id' => $id], NULL, $fieldsFix);
+    $copy = CRM_Core_DAO::copyGeneric('CRM_Core_DAO_Job', ['id' => $id], NULL, $fieldsFix);
     $copy->save();
     CRM_Utils_Hook::copy('Job', $copy);
 
index 72899e00757a09d6550c721cd61084d85859aaaf..b0c68d1b8a932b2f1b9124cb1657af612ae8eae2 100644 (file)
@@ -211,7 +211,6 @@ WHERE e.id = %1";
         $dao->id = $id;
         $dao->find(TRUE);
         $dao->delete();
-        $dao->free();
       }
     }
   }
@@ -314,6 +313,7 @@ WHERE e.id = %1";
    *   newly created/updated location block id.
    */
   public static function copyLocBlock($locBlockId, $updateLocBlockId = NULL) {
+    CRM_Core_Error::deprecatedFunctionWarning('unused function which will be removed');
     //get the location info.
     $defaults = $updateValues = [];
     $locBlock = ['id' => $locBlockId];
@@ -345,7 +345,7 @@ WHERE e.id = %1";
       }
     }
 
-    $copyLocation = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_LocBlock',
+    $copyLocation = CRM_Core_DAO::copyGeneric('CRM_Core_DAO_LocBlock',
       ['id' => $locBlock['id']],
       $copyLocationParams
     );
index d30ae5bfaad89cf8e3fe74518f07b21b2289249c..dabc8123bc2606994f98d045d512dabed5eaeefc 100644 (file)
@@ -315,12 +315,10 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
       $childNote = new CRM_Core_DAO_Note();
       $childNote->id = $childId;
       $childNote->delete();
-      $childNote->free();
       $recent[] = $childId;
     }
 
     $return = $note->delete();
-    $note->free();
     if ($showStatus) {
       CRM_Core_Session::setStatus($status, ts('Deleted'), 'success');
     }
index a681756418c02361e4d8d56d445227fdc35bda9d..072f8cd5c051acd51faed80b05b82698ec2e4eb7 100644 (file)
@@ -480,7 +480,6 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
         $optionValue->weight = $opWeight;
         $optionValue->save();
       }
-      $optionValue->free();
     }
   }
 
index bca6a1824bb2d9c9a21ca48d266446fc9113578d..bdc8e44ba131789db47434a891c315add1098a43 100644 (file)
@@ -138,19 +138,18 @@ WHERE  cacheKey     = %3 AND
   }
 
   /**
-   * Delete from the previous next cache table for a pair of ids.
+   * Delete pair from the previous next cache table to remove it from further merge consideration.
+   *
+   * The pair may have been flipped, so make sure we delete using both orders
    *
    * @param int $id1
    * @param int $id2
    * @param string $cacheKey
-   * @param bool $isViceVersa
-   * @param string $entityTable
    */
-  public static function deletePair($id1, $id2, $cacheKey = NULL, $isViceVersa = FALSE, $entityTable = 'civicrm_contact') {
-    $sql = "DELETE FROM civicrm_prevnext_cache WHERE  entity_table = %1";
-    $params = [1 => [$entityTable, 'String']];
+  public static function deletePair($id1, $id2, $cacheKey = NULL) {
+    $sql = "DELETE FROM civicrm_prevnext_cache WHERE  entity_table = 'civicrm_contact'";
 
-    $pair = !$isViceVersa ? "entity_id1 = %2 AND entity_id2 = %3" : "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
+    $pair = "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
     $sql .= " AND ( {$pair} )";
     $params[2] = [$id1, 'Integer'];
     $params[3] = [$id2, 'Integer'];
index ef8336593152ea2e98e766f5baae152bc981725f..9007864c1c53765de4c4bd14015cf2f6690e5045 100644 (file)
@@ -185,7 +185,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
           $tags[$tag->id]['color'] = !empty($tag->color) ? $tag->color : NULL;
         }
       }
-      $tag->free();
     }
 
     return $tags;
@@ -270,7 +269,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
       }
     }
 
-    $dao->free();
     // While we have nodes left to build, shift the first (alphabetically)
     // node of the list, place it in our tags list and loop through the
     // list of unplaced nodes to find its children. We make a copy to
@@ -514,7 +512,6 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag {
     while ($dao->fetch()) {
       $tagSets[$dao->id] = $dao->name;
     }
-    $dao->free();
     return $tagSets;
   }
 
index 9717f8ff3505e6c4cfdfb324d52b0c35b457a840..4549d78d3b0a1f5963dc5dcffaa611c75ed47f0e 100644 (file)
@@ -52,85 +52,74 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField {
    * @return \CRM_Core_BAO_UFField
    * @throws \API_Exception
    */
-  public static function create(&$params) {
-    // CRM-14756: kind of a hack-ish fix. If the user gives the id, uf_group_id is retrieved and then set.
-    if (isset($params['id'])) {
-      $groupId = civicrm_api3('UFField', 'getvalue', [
-        'return' => 'uf_group_id',
-        'id' => $params['id'],
-      ]);
-    }
-    else {
-      $groupId = CRM_Utils_Array::value('uf_group_id', $params);
-    }
+  public static function create($params) {
+    $id = CRM_Utils_Array::value('id', $params);
 
-    $field_name = CRM_Utils_Array::value('field_name', $params);
+    // Merge in data from existing field
+    if (!empty($id)) {
+      $UFField = new CRM_Core_BAO_UFField();
+      $UFField->id = $params['id'];
+      if ($UFField->find(TRUE)) {
+        $defaults = $UFField->toArray();
+        // This will be calculated based on field name
+        unset($defaults['field_type']);
+        $params += $defaults;
+      }
+      else {
+        throw new API_Exception("UFFIeld id {$params['id']} not found.");
+      }
+    }
 
-    if (strpos($field_name, 'formatting') !== 0 && !CRM_Core_BAO_UFField::isValidFieldName($field_name)) {
+    // Validate field_name
+    if (strpos($params['field_name'], 'formatting') !== 0 && !CRM_Core_BAO_UFField::isValidFieldName($params['field_name'])) {
       throw new API_Exception('The field_name is not valid');
     }
 
-    if (!(CRM_Utils_Array::value('group_id', $params))) {
-      $params['group_id'] = $groupId;
+    // Supply default label if not set
+    if (empty($id) && !isset($params['label'])) {
+      $params['label'] = self::getAvailableFieldTitles()[$params['field_name']];
     }
 
-    $fieldId = CRM_Utils_Array::value('id', $params);
-    if (!empty($fieldId)) {
-      $UFField = new CRM_Core_BAO_UFField();
-      $UFField->id = $fieldId;
-      if ($UFField->find(TRUE)) {
-        if (!(CRM_Utils_Array::value('group_id', $params))) {
-          // this copied here from previous api function - not sure if required
-          $params['group_id'] = $UFField->uf_group_id;
-        }
-      }
-      else {
-        throw new API_Exception("there is no field for this fieldId");
-      }
+    // Supply field_type if not set
+    if (empty($params['field_type']) && strpos($params['field_name'], 'formatting') !== 0) {
+      $params['field_type'] = CRM_Utils_Array::pathGet(self::getAvailableFieldsFlat(), [$params['field_name'], 'field_type']);
+    }
+    elseif (empty($params['field_type'])) {
+      $params['field_type'] = 'Formatting';
+    }
+
+    // Generate unique name for formatting fields
+    if ($params['field_name'] === 'formatting') {
+      $params['field_name'] = 'formatting_' . substr(uniqid(), -4);
     }
-    $params['uf_group_id'] = $params['group_id'];
 
-    if (CRM_Core_BAO_UFField::duplicateField($params)) {
+    if (self::duplicateField($params)) {
       throw new API_Exception("The field was not added. It already exists in this profile.");
     }
 
-    // @todo fix BAO to be less weird.
-    $field_type       = CRM_Utils_Array::value('field_type', $params);
-    $location_type_id = CRM_Utils_Array::value('location_type_id', $params, CRM_Utils_Array::value('website_type_id', $params));
-    $phone_type       = CRM_Utils_Array::value('phone_type_id', $params, CRM_Utils_Array::value('phone_type', $params));
-    $params['field_name'] = [$field_type, $field_name, $location_type_id, $phone_type];
     //@todo why is this even optional? Surely weight should just be 'managed' ??
     if (CRM_Utils_Array::value('option.autoweight', $params, TRUE)) {
       $params['weight'] = CRM_Core_BAO_UFField::autoWeight($params);
     }
-    // set values for uf field properties and save
+
+    // Set values for uf field properties and save
     $ufField = new CRM_Core_DAO_UFField();
     $ufField->copyValues($params);
-    $ufField->field_type = $params['field_name'][0];
-    $ufField->field_name = $params['field_name'][1];
 
-    //should not set location type id for Primary
-    $locationTypeId = NULL;
-    if ($params['field_name'][1] == 'url') {
-      $ufField->website_type_id = CRM_Utils_Array::value(2, $params['field_name']);
+    if ($params['field_name'] == 'url') {
+      $ufField->location_type_id = 'null';
     }
     else {
-      $locationTypeId = CRM_Utils_Array::value(2, $params['field_name']);
-      $ufField->website_type_id = NULL;
-    }
-    if ($locationTypeId) {
-      $ufField->location_type_id = $locationTypeId;
+      $ufField->website_type_id = 'null';
     }
-    else {
-      $ufField->location_type_id = 'null';
+    if (!strstr($params['field_name'], 'phone')) {
+      $ufField->phone_type_id = 'null';
     }
 
-    $ufField->phone_type_id = CRM_Utils_Array::value(3, $params['field_name'], 'NULL');
-
     $ufField->save();
 
-    $fieldsType = CRM_Core_BAO_UFGroup::calculateGroupType($groupId, TRUE);
-    CRM_Core_BAO_UFGroup::updateGroupTypes($groupId, $fieldsType);
+    $fieldsType = CRM_Core_BAO_UFGroup::calculateGroupType($ufField->uf_group_id, TRUE);
+    CRM_Core_BAO_UFGroup::updateGroupTypes($ufField->uf_group_id, $fieldsType);
 
     civicrm_api3('profile', 'getfields', ['cache_clear' => TRUE]);
     return $ufField;
@@ -204,8 +193,8 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField {
   public static function duplicateField($params) {
     $ufField = new CRM_Core_DAO_UFField();
     $ufField->uf_group_id = CRM_Utils_Array::value('uf_group_id', $params);
-    $ufField->field_type = $params['field_type'];
-    $ufField->field_name = $params['field_name'];
+    $ufField->field_type = CRM_Utils_Array::value('field_type', $params);
+    $ufField->field_name = CRM_Utils_Array::value('field_name', $params);
     $ufField->website_type_id = CRM_Utils_Array::value('website_type_id', $params);
     if (is_null(CRM_Utils_Array::value('location_type_id', $params, ''))) {
       // primary location type have NULL value in DB
@@ -220,7 +209,7 @@ class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField {
       $ufField->whereAdd("id <> " . $params['id']);
     }
 
-    return ($ufField->find(TRUE) ? 1 : 0);
+    return (bool) $ufField->find(TRUE);
   }
 
   /**
@@ -280,10 +269,10 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
     // fix for CRM-316
     $oldWeight = NULL;
 
-    if (!empty($params['field_id'])) {
-      $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $params['field_id'], 'weight', 'id');
+    if (!empty($params['field_id']) || !empty($params['id'])) {
+      $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', !empty($params['id']) ? $params['id'] : $params['field_id'], 'weight', 'id');
     }
-    $fieldValues = ['uf_group_id' => $params['group_id']];
+    $fieldValues = ['uf_group_id' => !empty($params['uf_group_id']) ? $params['uf_group_id'] : $params['group_id']];
     return CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_UFField', $oldWeight, CRM_Utils_Array::value('weight', $params, 0), $fieldValues);
   }
 
@@ -1086,6 +1075,7 @@ SELECT  id
    */
   public static function getAvailableFieldTitles() {
     $fields = self::getAvailableFieldsFlat();
+    $fields['formatting'] = ['title' => ts('Formatting')];
     return CRM_Utils_Array::collect('title', $fields);
   }
 
index 5d7f256eb0a4788713c6f61bdeb30a8579d81485..3adba27015c53d0b4b0268721538da21f6fbc0ef 100644 (file)
@@ -2692,7 +2692,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
       ),
     );
 
-    $copy = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFGroup',
+    $copy = CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFGroup',
       array('id' => $id),
       NULL,
       $fieldsFix
@@ -2704,14 +2704,14 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
     $copy->name = CRM_Utils_String::munge($copy->name, '_', 56) . "_{$copy->id}";
     $copy->save();
 
-    $copyUFJoin = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin',
+    $copyUFJoin = CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin',
       array('uf_group_id' => $id),
       array('uf_group_id' => $copy->id),
       NULL,
       'entity_table'
     );
 
-    $copyUFField = &CRM_Core_DAO::copyGeneric('CRM_Core_BAO_UFField',
+    $copyUFField = CRM_Core_DAO::copyGeneric('CRM_Core_BAO_UFField',
       array('uf_group_id' => $id),
       array('uf_group_id' => $copy->id)
     );
index 2a9606d5275a815de35b0ce5f75dd49988a28dac..a87e8ea783b934ef94c75096095a2958a0640fa5 100644 (file)
@@ -190,7 +190,7 @@ class CRM_Core_ClassLoader {
     // we do this to prevent a autoloader errors with joomla / 3rd party packages
     // Use absolute path, since we don't know the content of include_path yet.
     // CRM-11304
-    $file = dirname(__FILE__) . '/../../vendor/ezyang/htmlpurifier/library/HTMLPurifier/Bootstrap.php';
+    $file = dirname(__FILE__) . '/../../packages/IDS/vendors/htmlpurifer/HTMLPurifier/Bootstrap.php';
     if (file_exists($file)) {
       return $file;
     }
index 7729ea81e8e4f51bbbb138d3c6fa5772103e5875..351ef233effa4baad40eb149832cd47f5c168360 100644 (file)
@@ -37,13 +37,18 @@ class CRM_Core_CodeGen_Main {
   public $database;
 
   /**
-   * @var string|NULL path in which to store a marker that indicates the last execution of
-   * GenCode. If a matching marker already exists, GenCode doesn't run.
+   * Path in which to store a marker that indicates the last execution of GenCode.
+   *
+   * If a matching marker already exists, GenCode doesn't run.
+   *
+   * @var string|null
    */
   public $digestPath;
 
   /**
-   * @var string|NULL a digest of the inputs to the code-generator (eg the properties and source files)
+   * Digest of the inputs to the code-generator (eg the properties and source files).
+   *
+   * @var string|null
    */
   public $sourceDigest;
 
index e5da1c609aa271c639cc699eba3008a429f21d43..805cc733c4619e306e8633c691a9993c26204e41 100644 (file)
@@ -318,7 +318,7 @@ class CRM_Core_CodeGen_Specification {
         // need this case since some versions of mysql do not have boolean as a valid column type and hence it
         // is changed to tinyint. hopefully after 2 yrs this case can be removed.
         $field['sqlType'] = 'tinyint';
-        $field['phpType'] = $type;
+        $field['phpType'] = 'bool';
         $field['crmType'] = 'CRM_Utils_Type::T_' . strtoupper($type);
         break;
 
@@ -327,7 +327,7 @@ class CRM_Core_CodeGen_Specification {
         $field['sqlType'] = 'decimal(' . $length . ')';
         $field['phpType'] = 'float';
         $field['crmType'] = 'CRM_Utils_Type::T_MONEY';
-        $field['precision'] = $length;
+        $field['precision'] = $length . ',';
         break;
 
       case 'float':
@@ -340,6 +340,7 @@ class CRM_Core_CodeGen_Specification {
         $field['phpType'] = $this->value('phpType', $fieldXML, $type);
         $field['sqlType'] = $type;
         if ($type == 'int unsigned') {
+          $field['phpType'] = 'int';
           $field['crmType'] = 'CRM_Utils_Type::T_INT';
         }
         else {
@@ -369,6 +370,7 @@ class CRM_Core_CodeGen_Specification {
     $field['uniqueName'] = $this->value('uniqueName', $fieldXML);
     $field['serialize'] = $this->value('serialize', $fieldXML);
     $field['html'] = $this->value('html', $fieldXML);
+    $field['protected'] = $this->value('protected', $fieldXML);
     if (!empty($field['html'])) {
       $validOptions = [
         'type',
index fd4b55c5be330a6e36057aa298aa4159635b37c8..1d2989c52c994eddd5f1b465f68f5990ee3e79c6 100644 (file)
@@ -31,8 +31,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
- * $Id$
- *
  */
 abstract class CRM_Core_Component_Info {
 
@@ -79,14 +77,16 @@ abstract class CRM_Core_Component_Info {
   const COMPONENT_MENU_XML = 'Menu';
 
   /**
-   * Stores component information.
-   * @var array component settings as key/value pairs
+   * Component settings as key/value pairs.
+   *
+   * @var array
    */
   public $info;
 
   /**
-   * Stores component keyword.
-   * @var string name of component keyword
+   * Component keyword.
+   *
+   * @var string
    */
   protected $keyword;
 
index a5141627c7d3cd03a81ede4e3d6a1cb18c8ddb66..51dda46d20e574929a0940e3e944f92847f139fc 100644 (file)
@@ -82,7 +82,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * so the display routine needs to not do any work. (The
    * parent object takes care of the display)
    *
-   * @var boolean
+   * @var bool
    */
   protected $_embedded = FALSE;
 
@@ -94,7 +94,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * Useful when we run form in non civicrm context
    * and we need to transfer control back.(eg. drupal)
    *
-   * @var boolean
+   * @var bool
    */
   protected $_skipRedirection = FALSE;
 
@@ -102,14 +102,14 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * Are we in print mode? if so we need to modify the display
    * functionality to do a minimal display :)
    *
-   * @var boolean
+   * @var bool
    */
   public $_print = 0;
 
   /**
    * Should we generate a qfKey, true by default
    *
-   * @var boolean
+   * @var bool
    */
   public $_generateQFKey = TRUE;
 
index 027dba4a89fd3b0b262541ac9b4ca2980ddc6f5b..09295bf02828f39d5ace0c4490a80144b38212f6 100644 (file)
@@ -936,7 +936,7 @@ class CRM_Core_DAO extends DB_DataObject {
 
     if (!array_key_exists($tableName, $show)) {
       $query = "SHOW CREATE TABLE $tableName";
-      $dao = CRM_Core_DAO::executeQuery($query);
+      $dao = CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
 
       if (!$dao->fetch()) {
         CRM_Core_Error::fatal();
@@ -963,7 +963,7 @@ class CRM_Core_DAO extends DB_DataObject {
     foreach ($tables as $tableName) {
       if (!array_key_exists($tableName, $show)) {
         $query = "SHOW CREATE TABLE $tableName";
-        $dao = CRM_Core_DAO::executeQuery($query);
+        $dao = CRM_Core_DAO::executeQuery($query, [], TRUE, NULL, FALSE, FALSE);
 
         if (!$dao->fetch()) {
           CRM_Core_Error::fatal();
@@ -1600,11 +1600,12 @@ FROM   civicrm_domain
    *   Fields that you want to block from.
    *   getting copied
    *
-   * @return CRM_Core_DAO
-   *   the newly created copy of the object
+   * @return CRM_Core_DAO|bool
+   *   the newly created copy of the object. False if none created.
    */
-  public static function &copyGeneric($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
+  public static function copyGeneric($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
     $object = new $daoName();
+    $newObject = FALSE;
     if (!$newData) {
       $object->id = $criteria['id'];
     }
@@ -1670,15 +1671,71 @@ FROM   civicrm_domain
         }
       }
       $newObject->save();
-      if (!empty($newData['custom'])) {
-        CRM_Core_BAO_CustomValueTable::store($newData['custom'], $newObject::getTableName(), $newObject->id);
-      }
+      $newObject->copyCustomFields($object->id, $newObject->id);
       CRM_Utils_Hook::post('create', CRM_Core_DAO_AllCoreTables::getBriefName($daoName), $newObject->id, $newObject);
     }
 
     return $newObject;
   }
 
+  /**
+   * Method that copies custom fields values from an old entity to a new one.
+   *
+   * Fixes bug CRM-19302,
+   * where if a custom field of File type was present, left both events using the same file,
+   * breaking download URL's for the old event.
+   *
+   * @todo the goal here is to clean this up so that it works for any entity. Copy Generic already DOES some custom field stuff
+   * but it seems to be bypassed & perhaps less good than this (or this just duplicates it...)
+   *
+   * @param int $entityID
+   * @param int $newEntityID
+   */
+  public function copyCustomFields($entityID, $newEntityID) {
+    $entity = CRM_Core_DAO_AllCoreTables::getBriefName(get_class($this));
+    $tableName = CRM_Core_DAO_AllCoreTables::getTableForClass(get_class($this));
+    // Obtain custom values for old event
+    $customParams = $htmlType = [];
+    $customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($entityID, $entity);
+
+    // If custom values present, we copy them
+    if (!empty($customValues)) {
+      // Get Field ID's and identify File type attributes, to handle file copying.
+      $fieldIds = implode(', ', array_keys($customValues));
+      $sql = "SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( {$fieldIds} )";
+      $result = CRM_Core_DAO::executeQuery($sql);
+
+      // Build array of File type fields
+      while ($result->fetch()) {
+        $htmlType[] = $result->id;
+      }
+
+      // Build params array of custom values
+      foreach ($customValues as $field => $value) {
+        if ($value !== NULL) {
+          // Handle File type attributes
+          if (in_array($field, $htmlType)) {
+            $fileValues = CRM_Core_BAO_File::path($value, $entityID);
+            $customParams["custom_{$field}_-1"] = [
+              'name' => CRM_Utils_File::duplicate($fileValues[0]),
+              'type' => $fileValues[1],
+            ];
+          }
+          // Handle other types
+          else {
+            $customParams["custom_{$field}_-1"] = $value;
+          }
+        }
+      }
+
+      // Save Custom Fields for new Event
+      CRM_Core_BAO_CustomValueTable::postProcess($customParams, $tableName, $newEntityID, $entity);
+    }
+
+    // copy activity attachments ( if any )
+    CRM_Core_BAO_File::copyEntityFile($tableName, $entityID, $tableName, $newEntityID);
+  }
+
   /**
    * Cascade update through related entities.
    *
index 3ebd410feccb48078c95cebfb5a256c2c4159491..86a10b240d7d38d35b32f071b55953ae58ee72ff 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/ActionLog.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:38f897676ff054f67ba7188470e41dee)
+ * (GenCodeChecksum:2ccacada384ba37fcf929647dfa3d845)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to id of the entity that the action was performed on. Pseudo - FK.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -57,7 +57,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
   /**
    * FK to the action schedule that this action originated from.
    *
-   * @var int unsigned
+   * @var int
    */
   public $action_schedule_id;
 
@@ -71,7 +71,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
   /**
    * Was there any error sending the reminder?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_error;
 
@@ -85,7 +85,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
   /**
    * Keeps track of the sequence number of this repetition.
    *
-   * @var int unsigned
+   * @var int
    */
   public $repetition_number;
 
index fce373b430dd513dfc23e12f452d1db960291649..841bc7d0e24bf738176f6f082434b5f169eebcef 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/ActionMapping.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:eafaaa48176b2854e6b8a7f19fc1ebe6)
+ * (GenCodeChecksum:c7d2ed31b30490f0a1794fb81b700ac6)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_ActionMapping extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index 25b0376dda16b32d81f32053fd7f561fb3ae374d..d6d17288faae82e6a4b079edafe6e1728267aade 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/ActionSchedule.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4d6dca3786a9d3ab90b492be017b045b)
+ * (GenCodeChecksum:cb2618343c279fbf0baabe1f1ebd9973)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -57,7 +57,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Is this the recipient criteria limited to OR in addition to?
    *
-   * @var boolean
+   * @var bool
    */
   public $limit_to;
 
@@ -78,7 +78,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Reminder Interval.
    *
-   * @var int unsigned
+   * @var int
    */
   public $start_action_offset;
 
@@ -104,7 +104,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   public $start_action_date;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_repeat;
 
@@ -118,7 +118,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Time interval for repeating the reminder.
    *
-   * @var int unsigned
+   * @var int
    */
   public $repetition_frequency_interval;
 
@@ -132,7 +132,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Time interval till repeating the reminder.
    *
-   * @var int unsigned
+   * @var int
    */
   public $end_frequency_interval;
 
@@ -153,7 +153,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Is this option active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -202,7 +202,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * Record Activity for this reminder?
    *
-   * @var boolean
+   * @var bool
    */
   public $record_activity;
 
@@ -216,21 +216,21 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   /**
    * FK to Group
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
   /**
    * FK to the message template.
    *
-   * @var int unsigned
+   * @var int
    */
   public $msg_template_id;
 
   /**
    * FK to the message template.
    *
-   * @var int unsigned
+   * @var int
    */
   public $sms_template_id;
 
@@ -263,7 +263,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
   public $mode;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $sms_provider_id;
 
@@ -438,7 +438,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits',
-          ]
+          ],
         ],
         'start_action_condition' => [
           'name' => 'start_action_condition',
@@ -494,7 +494,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits',
-          ]
+          ],
         ],
         'repetition_frequency_interval' => [
           'name' => 'repetition_frequency_interval',
@@ -525,7 +525,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits',
-          ]
+          ],
         ],
         'end_frequency_interval' => [
           'name' => 'end_frequency_interval',
@@ -692,7 +692,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'msg_template_id' => [
           'name' => 'msg_template_id',
@@ -774,7 +774,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'msg_mode',
             'optionEditPath' => 'civicrm/admin/options/msg_mode',
-          ]
+          ],
         ],
         'sms_provider_id' => [
           'name' => 'sms_provider_id',
index f020412740ff0ee7349db790888fe4cf95e54656..50841dbee55325491e74f2daba06a743aaf50263 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Address.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a81d4789f6650c68145ab9bf1e4481a8)
+ * (GenCodeChecksum:4999e79688aae8d0958e46cbd320ae3a)
  */
 
 /**
@@ -31,42 +31,42 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
   /**
    * Unique Address ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Which Location does this address belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
   /**
    * Is this the primary address.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_primary;
 
   /**
    * Is this the billing address.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing;
 
   /**
    * Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
-   number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
-   delivery, etc.).
+   number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
+   delivery, etc.).
    *
    * @var string
    */
@@ -152,14 +152,14 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
   /**
    * Which County does this address belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $county_id;
 
   /**
    * Which State_Province does this address belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $state_province_id;
 
@@ -187,7 +187,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
   /**
    * Which Country does this address belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $country_id;
 
@@ -208,7 +208,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
   /**
    * Is this a manually entered geo code
    *
-   * @var boolean
+   * @var bool
    */
   public $manual_geo_code;
 
@@ -227,7 +227,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
   /**
    * FK to Address ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $master_id;
 
@@ -307,7 +307,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
             'table' => 'civicrm_location_type',
             'keyColumn' => 'id',
             'labelColumn' => 'display_name',
-          ]
+          ],
         ],
         'is_primary' => [
           'name' => 'is_primary',
@@ -345,8 +345,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
           'title' => ts('Street Address'),
           'description' => ts('Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
       number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
-      delivery, etc.).
-    '),
+      delivery, etc.).'),
           'maxlength' => 96,
           'size' => CRM_Utils_Type::HUGE,
           'import' => TRUE,
@@ -381,8 +380,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
           'name' => 'street_number_suffix',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Street Number Suffix'),
-          'description' => ts('Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A
-    '),
+          'description' => ts('Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A'),
           'maxlength' => 8,
           'size' => CRM_Utils_Type::EIGHT,
           'where' => 'civicrm_address.street_number_suffix',
@@ -575,7 +573,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
             'table' => 'civicrm_county',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'state_province_id' => [
           'name' => 'state_province_id',
@@ -596,7 +594,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
             'table' => 'civicrm_state_province',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'postal_code_suffix' => [
           'name' => 'postal_code_suffix',
@@ -671,7 +669,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO {
             'keyColumn' => 'id',
             'labelColumn' => 'name',
             'nameColumn' => 'iso_code',
-          ]
+          ],
         ],
         'geo_code_1' => [
           'name' => 'geo_code_1',
index 6db05ca4ad455ea9e153cdef318f834324254509..4aebbfb3c9e78c9d6cfdf12108134b25dcefe5aa 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/AddressFormat.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:08e72cd783856c58dbdaeee364102c01)
+ * (GenCodeChecksum:144542b9aa31391600f73d885f819091)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_AddressFormat extends CRM_Core_DAO {
   /**
    * Address Format Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index a92e8ad9777ab5462b020e8e47425e0cb40e4918..b9c0d73da33dac1b7975cf00d44515ad84ec271a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Cache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0683b150dd60e1ec9b53c00957137a27)
+ * (GenCodeChecksum:2ed8c033a46531123b2a0bb158487c30)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -57,7 +57,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO {
   /**
    * Component that this menu item belongs to
    *
-   * @var int unsigned
+   * @var int
    */
   public $component_id;
 
@@ -171,7 +171,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO {
             'table' => 'civicrm_component',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'created_date' => [
           'name' => 'created_date',
index 710c3b15936115cfb40428b6420060cabd843a91..77def7da10836da0e55ccf4bd63dc783c9149d01 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Component.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b9121c01e72b5a9a2772dad9274f4549)
+ * (GenCodeChecksum:3259789de86a7fb333ce0b11d35fe6aa)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Component extends CRM_Core_DAO {
   /**
    * Component ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -43,8 +43,7 @@ class CRM_Core_DAO_Component extends CRM_Core_DAO {
   public $name;
 
   /**
-   * Path to components main directory in a form of a class
-   namespace.
+   * Path to components main directory in a form of a class namespace.
    *
    * @var string
    */
@@ -96,9 +95,7 @@ class CRM_Core_DAO_Component extends CRM_Core_DAO {
           'name' => 'namespace',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Namespace reserved for component.'),
-          'description' => ts('Path to components main directory in a form of a class
-      namespace.
-    '),
+          'description' => ts('Path to components main directory in a form of a class namespace.'),
           'maxlength' => 128,
           'size' => CRM_Utils_Type::HUGE,
           'where' => 'civicrm_component.namespace',
index fa5108bc655c2db6a4ed33a5e125c86e3351aba5..5087ed41384ba39150b4200078997003a990540f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Country.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a7e07335fea6b1eea5894c119eaa1c4e)
+ * (GenCodeChecksum:367384a5604d933a66247bddb06e96bb)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
   /**
    * Country Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
   /**
    * Foreign key to civicrm_address_format.id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $address_format_id;
 
@@ -80,14 +80,14 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
   /**
    * Foreign key to civicrm_worldregion.id.
    *
-   * @var int unsigned
+   * @var int
    */
   public $region_id;
 
   /**
    * Should state/province be displayed as abbreviation for contacts from this country?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_province_abbreviated;
 
@@ -233,7 +233,7 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
             'table' => 'civicrm_worldregion',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'is_province_abbreviated' => [
           'name' => 'is_province_abbreviated',
index f3dedbed8e424374dfceec9cc28614ea556f62a3..853be19f1b431548a7e205a73ea50b9d2525f50a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/County.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:74b37d0061cdff5aa638ff68f3879b6c)
+ * (GenCodeChecksum:3ce3045eed44f727cbca947945315329)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_County extends CRM_Core_DAO {
   /**
    * County ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_County extends CRM_Core_DAO {
   /**
    * ID of State/Province that County belongs
    *
-   * @var int unsigned
+   * @var int
    */
   public $state_province_id;
 
index ee0fb15f20be2545ac1c7085e5d163c635851270..4e873afa0bd2acef56f179df8b592fcec00fb086 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/CustomField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a1a27e2af4724a92f37a959ee359428b)
+ * (GenCodeChecksum:58323f46f5ac021f96591e075b37cca6)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * Unique Custom Field ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_custom_group.
    *
-   * @var int unsigned
+   * @var int
    */
   public $custom_group_id;
 
@@ -80,21 +80,21 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * Is a value required for this property.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_required;
 
   /**
    * Is this property searchable.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_searchable;
 
   /**
    * Is this property range searchable.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_search_range;
 
@@ -143,28 +143,28 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this property set by PHP Code? A code field is viewable but not editable
    *
-   * @var boolean
+   * @var bool
    */
   public $is_view;
 
   /**
    * number of options per line for checkbox and radio
    *
-   * @var int unsigned
+   * @var int
    */
   public $options_per_line;
 
   /**
    * field length if alphanumeric
    *
-   * @var int unsigned
+   * @var int
    */
   public $text_length;
 
@@ -192,21 +192,21 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * time format for custom date
    *
-   * @var int unsigned
+   * @var int
    */
   public $time_format;
 
   /**
    *  Number of columns in Note Field
    *
-   * @var int unsigned
+   * @var int
    */
   public $note_columns;
 
   /**
    *  Number of rows in Note Field
    *
-   * @var int unsigned
+   * @var int
    */
   public $note_rows;
 
@@ -220,7 +220,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * For elements with options, the option group id that is used
    *
-   * @var int unsigned
+   * @var int
    */
   public $option_group_id;
 
@@ -234,7 +234,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
   /**
    * Should the multi-record custom field values be displayed in tab table listing
    *
-   * @var boolean
+   * @var bool
    */
   public $in_selector;
 
@@ -301,7 +301,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
             'table' => 'civicrm_custom_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -348,7 +348,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_BAO_CustomField::dataType',
-          ]
+          ],
         ],
         'html_type' => [
           'name' => 'html_type',
@@ -365,7 +365,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::customHtmlType',
-          ]
+          ],
         ],
         'default_value' => [
           'name' => 'default_value',
@@ -632,7 +632,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO {
             'table' => 'civicrm_option_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'filter' => [
           'name' => 'filter',
index aa7f05551f2c7410288bc3af9e4b67e9c21a9e26..363c13e419c59855e7c463d45ceae76a55b08ca4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/CustomGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9131714b35a45d028cf14456d1e57170)
+ * (GenCodeChecksum:288ec5d75e51339f23a2057dc1a383d2)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * Unique Custom Group ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * FK to civicrm_option_value.id (for option group custom_data_type.)
    *
-   * @var int unsigned
+   * @var int
    */
   public $extends_entity_column_id;
 
@@ -80,7 +80,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * Will this group be in collapsed or expanded mode on initial display ?
    *
-   * @var int unsigned
+   * @var int
    */
   public $collapse_display;
 
@@ -108,7 +108,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -122,35 +122,35 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * Does this group hold multiple values?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_multiple;
 
   /**
    * minimum number of multiple records (typically 0?)
    *
-   * @var int unsigned
+   * @var int
    */
   public $min_multiple;
 
   /**
    * maximum number of multiple records, if 0 - no max
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_multiple;
 
   /**
    * Will this group be in collapsed or expanded mode on advanced search display ?
    *
-   * @var int unsigned
+   * @var int
    */
   public $collapse_adv_display;
 
   /**
    * FK to civicrm_contact, who created this custom group
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -164,14 +164,14 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
    * Is this a reserved Custom Group?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this property public?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_public;
 
@@ -276,7 +276,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'custom_data_type',
             'optionEditPath' => 'civicrm/admin/options/custom_data_type',
-          ]
+          ],
         ],
         'extends_entity_column_value' => [
           'name' => 'extends_entity_column_value',
@@ -309,7 +309,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::customGroupStyle',
-          ]
+          ],
         ],
         'collapse_display' => [
           'name' => 'collapse_display',
index 42aa0ab23a920264a7fcd7ce1defa4ce37d12696..ea13f322039f5bd1acbd9d0291dbb4481901d67e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Dashboard.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:52a635955e779405d2eaa2b403c41092)
+ * (GenCodeChecksum:d1fc3dec2d559acdfedb070a6a5bd107)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Domain for dashboard
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -85,21 +85,21 @@ class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
   /**
    * Is this dashlet active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this dashlet reserved?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Number of minutes to cache dashlet content in browser localStorage.
    *
-   * @var int unsigned
+   * @var int
    */
   public $cache_minutes;
 
@@ -161,7 +161,7 @@ class CRM_Core_DAO_Dashboard extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
index 32dbbb454e4a2dac4e67f5339e860a3a82f5c40e..17250c3cb3bc674801db8df7d0d1ea3d4fdda6b3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Discount.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:74c8162f321ac50b965c1416951fe93a)
+ * (GenCodeChecksum:a414d91af17f5a6cfd69e3a0fc8fb8ca)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Discount extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Core_DAO_Discount extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to civicrm_price_set
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_set_id;
 
index 2f84735d72468027921cb126cbc83ba21c3484d1..e3e5c13014e2d9b921f27a82571acbb101eda80a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Domain.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c5d80d8a9e689b48c5f6373b9229c442)
+ * (GenCodeChecksum:74b35dfcc8ad2ade69e9bcb75e2f407b)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO {
   /**
    * Domain ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,7 +66,7 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO {
   /**
    * FK to Contact ID. This is specifically not an FK to avoid circular constraints
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
index ac48170decacc9b8abde27cd0b4c43e3ea031b9d..1d36308a3081484cc41927c273a918e2c42ce718 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Email.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:198627a1fa129294e4c7be52939883e1)
+ * (GenCodeChecksum:6da9864657d2b5e46956386ab414d8d6)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO {
   /**
    * Unique Email ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Which Location does this email belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
@@ -59,28 +59,28 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO {
   /**
    * Is this the primary?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_primary;
 
   /**
    * Is this the billing?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing;
 
   /**
    * Implicit FK to civicrm_option_value where option_group = email_on_hold.
    *
-   * @var int unsigned
+   * @var int
    */
   public $on_hold;
 
   /**
    * Is this address for bulk mail ?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_bulkmail;
 
@@ -184,7 +184,7 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO {
             'table' => 'civicrm_location_type',
             'keyColumn' => 'id',
             'labelColumn' => 'display_name',
-          ]
+          ],
         ],
         'email' => [
           'name' => 'email',
@@ -249,7 +249,7 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions',
-          ]
+          ],
         ],
         'is_bulkmail' => [
           'name' => 'is_bulkmail',
index 26069113cbefad1604991e12fdf447bcfd8963eb..9ab75998b90f7420b27874c1e0f63d097fba4be4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/EntityFile.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:febc5ccbfb965f8f4ba8477d4db0e5f3)
+ * (GenCodeChecksum:7a5ef1cb4866290ba8edac3fd92f1102)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_EntityFile extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Core_DAO_EntityFile extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to civicrm_file
    *
-   * @var int unsigned
+   * @var int
    */
   public $file_id;
 
index 11bcdfcb5b78f8f92aa473e220c93605a47ccd7b..e3ea7a3fe5ba0c61c66f71f746ca78764494afb7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/EntityTag.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:721b045d10e22535a86c5e927e489477)
+ * (GenCodeChecksum:16302a8c63dcb3978dbc0d089397be50)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to civicrm_tag
    *
-   * @var int unsigned
+   * @var int
    */
   public $tag_id;
 
@@ -115,7 +115,7 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'tag_used_for',
             'optionEditPath' => 'civicrm/admin/options/tag_used_for',
-          ]
+          ],
         ],
         'entity_id' => [
           'name' => 'entity_id',
@@ -148,7 +148,7 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO {
             'table' => 'civicrm_tag',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 9bb233277e46da7b9608386466340a1a86372e0a..67f396493f18d140678e73446bd8e9007c945b78 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Extension.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:02c87fb773b6c1e61e48e0ddfac2bb5a)
+ * (GenCodeChecksum:d7421ef144f074ada5688f6e56ab8418)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Extension extends CRM_Core_DAO {
   /**
    * Local Extension ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -78,7 +78,7 @@ class CRM_Core_DAO_Extension extends CRM_Core_DAO {
   /**
    * Is this extension active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -127,7 +127,7 @@ class CRM_Core_DAO_Extension extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getExtensionTypes',
-          ]
+          ],
         ],
         'full_name' => [
           'name' => 'full_name',
index fe4ae741f492e26e768325ddb91c210fc54b7f79..508a449a0d5092a605d305a253a808fe1a37d9f5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/File.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:994c11201c8b27ec0913d1ce505ef864)
+ * (GenCodeChecksum:0ddebff42aa9d0c2fe3114281ca95e70)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_File extends CRM_Core_DAO {
   /**
    * Unique ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $file_type_id;
 
@@ -80,7 +80,7 @@ class CRM_Core_DAO_File extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who uploaded this file
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
index e53ce78aff364fe9c253b088787e41c1a45c31d0..6d4583a6a1f17ec3b92ca0577ac7900c0fb1d42d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/IM.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c112fd2803d82fb22d2635f7929c391c)
+ * (GenCodeChecksum:5a7b60741331c475603af3bb180d2bd7)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO {
   /**
    * Unique IM ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Which Location does this email belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
@@ -59,21 +59,21 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO {
   /**
    * Which IM Provider does this screen name belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $provider_id;
 
   /**
    * Is this the primary IM for this contact and location.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_primary;
 
   /**
    * Is this the billing?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing;
 
@@ -149,7 +149,7 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO {
             'table' => 'civicrm_location_type',
             'keyColumn' => 'id',
             'labelColumn' => 'display_name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -187,7 +187,7 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'instant_messenger_service',
             'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
-          ]
+          ],
         ],
         'is_primary' => [
           'name' => 'is_primary',
index 3c0961ef24b0c2ae0033b074678c83f84f879805..3f4fe93d7525822ca6f7198469b81b55e4f01f0e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Job.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6a87295b587fb722d7b2026e2f2dbfe7)
+ * (GenCodeChecksum:752f86f1ad35917f008e81c0bc45786e)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO {
   /**
    * Job Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this scheduled job for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -101,7 +101,7 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO {
   /**
    * Is this job active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -164,7 +164,7 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'run_frequency' => [
           'name' => 'run_frequency',
@@ -184,7 +184,7 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getJobFrequency',
-          ]
+          ],
         ],
         'last_run' => [
           'name' => 'last_run',
index 65737e4fffbd3e7a2f0a986f3abbcaa7006ff374..6fd510f4fea30ce70e02d92c1d819e26a00fa10f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/JobLog.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:68e8b90d050e64feef2b1868d83a7923)
+ * (GenCodeChecksum:647390b654065a0cc421975a24ae14f9)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
   /**
    * Job log entry Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this scheduled job for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
   /**
    * Pointer to job id - not a FK though, just for logging purposes
    *
-   * @var int unsigned
+   * @var int
    */
   public $job_id;
 
@@ -143,7 +143,7 @@ class CRM_Core_DAO_JobLog extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'run_time' => [
           'name' => 'run_time',
index c48de8d06d6f37007c6d39933b253264e63075ba..4c281a54c79cd7d872b2e8ef6c3aeed8f38f1936 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/LocBlock.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:cc12c8f1ddd73d6d8b1d056dd04696e9)
+ * (GenCodeChecksum:f2893cf360fe552d5ff1d90e2eb9272c)
  */
 
 /**
@@ -31,47 +31,47 @@ class CRM_Core_DAO_LocBlock extends CRM_Core_DAO {
   /**
    * Unique ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $address_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $email_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $phone_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $im_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $address_2_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $email_2_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $phone_2_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $im_2_id;
 
index fbab7fe2dabeaa0dfce1484407dfda40766e66b1..55f9e0c5fec1307cdafd08360f93782fe3ca411f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/LocationType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a97cc190a4fbeafa8846f48f47dcd63e)
+ * (GenCodeChecksum:aa147acf0dac148b113c33d4ca12876c)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_LocationType extends CRM_Core_DAO {
   /**
    * Location Type ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,21 +66,21 @@ class CRM_Core_DAO_LocationType extends CRM_Core_DAO {
   /**
    * Is this location type a predefined system location?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this location type the default?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
index 61a74d8a3f2cca253624f0aace7f2eb87d190294..9193116deff66f43248f05ebd9db75f9c1232288 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Log.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:38303a678c8e5104d63803ce900dc370)
+ * (GenCodeChecksum:ffaccbd0ebaf86e07a6302fe32e05ea8)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO {
   /**
    * Log ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO {
   /**
    * FK to Contact ID of person under whose credentials this data modification was made.
    *
-   * @var int unsigned
+   * @var int
    */
   public $modified_id;
 
index 7657ad3a7262c4bb57ad2018df640930dd334b17..a3aa181b9f2b9997b559af715314a3dd43d43ac5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/MailSettings.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:419c207b65557941ee6f58e31d1bb6d8)
+ * (GenCodeChecksum:1818e655bde2e2a0ecd15e7d645ba58a)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
   /**
    * primary key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this match entry for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
   /**
    * whether this is the default set of settings for this domain
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
@@ -94,7 +94,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
   /**
    * port to use when polling
    *
-   * @var int unsigned
+   * @var int
    */
   public $port;
 
@@ -115,7 +115,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
   /**
    * whether to use SSL or not
    *
-   * @var boolean
+   * @var bool
    */
   public $is_ssl;
 
@@ -192,7 +192,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -275,7 +275,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'mail_protocol',
             'optionEditPath' => 'civicrm/admin/options/mail_protocol',
-          ]
+          ],
         ],
         'server' => [
           'name' => 'server',
@@ -370,7 +370,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
             'optionGroupName' => 'activity_status',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/activity_status',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 940c62e686388859ba10df3074d69a859f9e125d..68272f34cfdd1135fda6ff3cb02ab3cf70856f3e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Managed.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:47e95661423fb2f97b3fd2069c4e404f)
+ * (GenCodeChecksum:79f57e32601e72d62755569fbf58c801)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Managed extends CRM_Core_DAO {
   /**
    * Surrogate Key
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_Managed extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -168,7 +168,7 @@ class CRM_Core_DAO_Managed extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index a4c2e3556a442c2b93db9e5c55b59ed2256106ba..d3b2da95e608c57e11c32060ebef5ae5d22ffd10 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Mapping.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:26d8aa33c9340571c606aa5b8f085c1a)
+ * (GenCodeChecksum:e0576a33199627f5846830d076b12229)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO {
   /**
    * Mapping ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO {
   /**
    * Mapping Type
    *
-   * @var int unsigned
+   * @var int
    */
   public $mapping_type_id;
 
@@ -126,7 +126,7 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'mapping_type',
             'optionEditPath' => 'civicrm/admin/options/mapping_type',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index eecc8d44bf875320a5bb11c9bd27f4312a0d41e6..afa1179d87f20aada969d7acc95a74358b5c3e0d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/MappingField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4c827f0d31c1d9304836b198b0d93374)
+ * (GenCodeChecksum:e18a4d7c43e3fded3e10bed98437577e)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
   /**
    * Mapping Field ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Mapping to which this field belongs
    *
-   * @var int unsigned
+   * @var int
    */
   public $mapping_id;
 
@@ -59,42 +59,42 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
   /**
    * Column number for mapping set
    *
-   * @var int unsigned
+   * @var int
    */
   public $column_number;
 
   /**
    * Location type of this mapping, if required
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
   /**
    * Which type of phone does this number belongs.
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_type_id;
 
   /**
    * Which type of IM Provider does this name belong.
    *
-   * @var int unsigned
+   * @var int
    */
   public $im_provider_id;
 
   /**
    * Which type of website does this site belong
    *
-   * @var int unsigned
+   * @var int
    */
   public $website_type_id;
 
   /**
    * Relationship type, if required
    *
-   * @var int unsigned
+   * @var int
    */
   public $relationship_type_id;
 
@@ -105,9 +105,9 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
 
   /**
    * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
-   mappings).
+   mappings).
    *
-   * @var int unsigned
+   * @var int
    */
   public $grouping;
 
@@ -263,7 +263,7 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'instant_messenger_service',
             'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
-          ]
+          ],
         ],
         'website_type_id' => [
           'name' => 'website_type_id',
@@ -281,7 +281,7 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'website_type',
             'optionEditPath' => 'civicrm/admin/options/website_type',
-          ]
+          ],
         ],
         'relationship_type_id' => [
           'name' => 'relationship_type_id',
@@ -312,8 +312,7 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Grouping'),
           'description' => ts('Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
-      mappings).
-    '),
+      mappings).'),
           'where' => 'civicrm_mapping_field.grouping',
           'default' => '1',
           'table_name' => 'civicrm_mapping_field',
@@ -338,7 +337,7 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators',
-          ]
+          ],
         ],
         'value' => [
           'name' => 'value',
index 3815647ba270afb98e78438d314c381500300765..1aca8e4b087b5e289d65444f09c47a8f112d78b4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Menu.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ea477a411301cae7e78667099c0f654c)
+ * (GenCodeChecksum:2ba374f38c5906a6338e2c0de34208f6)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this menu item for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -111,35 +111,35 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO {
   /**
    * Component that this menu item belongs to
    *
-   * @var int unsigned
+   * @var int
    */
   public $component_id;
 
   /**
    * Is this menu item active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this menu accessible to the public?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_public;
 
   /**
    * Is this menu exposed to the navigation system?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_exposed;
 
   /**
    * Should this menu be exposed via SSL if enabled?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_ssl;
 
@@ -167,7 +167,7 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO {
   /**
    * skip this url being exposed to breadcrumb
    *
-   * @var boolean
+   * @var bool
    */
   public $skipBreadcrumb;
 
@@ -237,7 +237,7 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'path' => [
           'name' => 'path',
@@ -378,7 +378,7 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO {
             'table' => 'civicrm_component',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
index 7ba12439092b90a1fcd27c6f73414f3e0a783cc4..5b4604881fffdf682715ade889cd1bf74150d64c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/MessageTemplate.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:988d404fbe6cd84e14a175f71b3f8440)
+ * (GenCodeChecksum:334135bbbd8614a2501e1cf56715eb46)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
   /**
    * Message Template ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -64,42 +64,42 @@ class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
   public $msg_html;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * a pseudo-FK to civicrm_option_value
    *
-   * @var int unsigned
+   * @var int
    */
   public $workflow_id;
 
   /**
    * is this the default message template for the workflow referenced by workflow_id?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * is this the reserved message template which we ship for the workflow referenced by workflow_id?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this message template used for sms?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_sms;
 
   /**
    * a pseudo-FK to civicrm_option_value containing PDF Page Format.
    *
-   * @var int unsigned
+   * @var int
    */
   public $pdf_format_id;
 
@@ -254,7 +254,7 @@ class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO {
             'optionGroupName' => 'pdf_format',
             'keyColumn' => 'id',
             'optionEditPath' => 'civicrm/admin/options/pdf_format',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 3e025a452bf61913bad58240597056394556b29a..2aa3fc3d0d21a88c4deac3842258647ceda39609 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Navigation.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f168de98d6c4d46c63abfd789f6fdf24)
+ * (GenCodeChecksum:377bbf9cfce4cb146a9638344c718b11)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this navigation item for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -85,21 +85,21 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
   /**
    * Parent navigation item, used for grouping
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Is this navigation item active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * If separator needs to be added after this menu item
    *
-   * @var boolean
+   * @var bool
    */
   public $has_separator;
 
@@ -169,7 +169,7 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'label' => [
           'name' => 'label',
@@ -267,7 +267,7 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO {
             'keyColumn' => 'id',
             'labelColumn' => 'label',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
index 84ecb5ba800690ed07e9dd4003d620eecfdc5c22..4fe2a823cc530298bdf1ab278fbae964f8c1172e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Note.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:daafebd13390de67d82735263e9fa886)
+ * (GenCodeChecksum:c5b4c2796ae7a974e822e74d9e5b4338)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
   /**
    * Note ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
   /**
    * FK to Contact ID creator
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -143,7 +143,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_BAO_Note::entityTables',
-          ]
+          ],
         ],
         'entity_id' => [
           'name' => 'entity_id',
@@ -234,7 +234,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'note_privacy',
             'optionEditPath' => 'civicrm/admin/options/note_privacy',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 206cb5ba8846b486dc70bde62301f5e0cad57764..542d774e9fa65cec5313f47bcfd0d73107137b09 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/OpenID.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8f43063bba0682c56356dbf7afa64658)
+ * (GenCodeChecksum:d63a37d228f3faa87726f65906737301)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Core_DAO_OpenID extends CRM_Core_DAO {
   /**
    * Unique OpenID ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Which Location does this email belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
@@ -59,14 +59,14 @@ class CRM_Core_DAO_OpenID extends CRM_Core_DAO {
   /**
    * Whether or not this user is allowed to login
    *
-   * @var boolean
+   * @var bool
    */
   public $allowed_to_login;
 
   /**
    * Is this the primary email for this contact and location.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_primary;
 
index fa42e8ebfc46a8f8e38f6d5df05496597764da9c..9908d873aebb9496f38ba0e6cb7e4149e949488a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/OptionGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2437cfeb4ae146ce21397bb38dfa08e1)
+ * (GenCodeChecksum:c9ed24515dcc4ce676fb21518bd90791)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO {
   /**
    * Option Group ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,21 +66,21 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO {
   /**
    * Is this a predefined system option group (i.e. it can not be deleted)?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this option group active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * A lock to remove the ability to add new options via the UI.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_locked;
 
@@ -166,7 +166,7 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Utils_Type::dataTypes',
-          ]
+          ],
         ],
         'is_reserved' => [
           'name' => 'is_reserved',
index 2fb21aa4ea2728a3c608994f873d12663b1271d2..3f62e140d3ea650e68062634495a3d07f27a4810 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/OptionValue.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:356278f04173ed064fa82cacafa7edbe)
+ * (GenCodeChecksum:803748252a3d5c50be80b18ccdb3132c)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
   /**
    * Option ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Group which this option belongs to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $option_group_id;
 
@@ -73,21 +73,21 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
   /**
    * Bitwise logic can be used to create subsets of options within an option_group for different uses.
    *
-   * @var int unsigned
+   * @var int
    */
   public $filter;
 
   /**
    * Is this the default option for the group?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Controls display sort order.
    *
-   * @var int unsigned
+   * @var int
    */
   public $weight;
 
@@ -101,40 +101,40 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
   /**
    * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_optgroup;
 
   /**
    * Is this a predefined system object?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this option active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Component that this option value belongs/caters to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $component_id;
 
   /**
    * Which Domain is this option value for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $visibility_id;
 
@@ -216,7 +216,7 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
             'table' => 'civicrm_option_group',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'label' => [
           'name' => 'label',
@@ -379,7 +379,7 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
             'table' => 'civicrm_component',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'domain_id' => [
           'name' => 'domain_id',
@@ -396,7 +396,7 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'visibility_id' => [
           'name' => 'visibility_id',
@@ -411,7 +411,7 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'visibility',
             'optionEditPath' => 'civicrm/admin/options/visibility',
-          ]
+          ],
         ],
         'icon' => [
           'name' => 'icon',
index 3f56e7c6933ad36f18b17a3b733da54f03742c8b..41ffa70f1b3806638358e949da17c50017826387 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Persistent.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0c52f813dd1e954e1709b819128790f3)
+ * (GenCodeChecksum:4044954800a1201a4e3c376d48342f4c)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Persistent extends CRM_Core_DAO {
   /**
    * Persistent Record Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_Persistent extends CRM_Core_DAO {
   /**
    * Config Settings
    *
-   * @var boolean
+   * @var bool
    */
   public $is_config;
 
index fce47cfc31ec1f0969174fd0f476f274131b9f0a..f85772ce62fa9cb84522bfaaf8199afcf587dd09 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Phone.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a3b4aba6b896154133688f4318ea866b)
+ * (GenCodeChecksum:ac451e083bb4bbf26f53556086b266bf)
  */
 
 /**
@@ -31,42 +31,42 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO {
   /**
    * Unique Phone ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Which Location does this phone belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
   /**
    * Is this the primary phone for this contact and location.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_primary;
 
   /**
    * Is this the billing?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing;
 
   /**
    * Which Mobile Provider does this phone belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $mobile_provider_id;
 
@@ -94,7 +94,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO {
   /**
    * Which type of phone does this number belongs.
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_type_id;
 
@@ -170,7 +170,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO {
             'table' => 'civicrm_location_type',
             'keyColumn' => 'id',
             'labelColumn' => 'display_name',
-          ]
+          ],
         ],
         'is_primary' => [
           'name' => 'is_primary',
@@ -277,7 +277,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'phone_type',
             'optionEditPath' => 'civicrm/admin/options/phone_type',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 45f75c9cc21a7b0738d8de8f506e21f065bca679..2441d6c0327cc313dc1dc7c6fe44f1383efec85c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/PreferencesDate.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:46e5c6a6ea6b21e1966679f41782c340)
+ * (GenCodeChecksum:18663ed2b585f1598a26a5a491c67ea6)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index 9af6dafa8c1d04b96888123800d305a2e455a864..682f6984c40c088ef6c5898cf32beada43893959 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/PrevNextCache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ec5d04442cf8976a3163cabeb3ba433c)
+ * (GenCodeChecksum:dba140c3d2ece863c512ed688df2ebcb)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -43,14 +43,14 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id1;
 
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id2;
 
@@ -69,7 +69,7 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO {
   public $data;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_selected;
 
index 1f20a3825e1f1ac3cef2df1c9d54bae6c178f254..55916812524c153c6f88e66fb1b5c35ac89f1553 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/PrintLabel.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ca56833ea757bf1363d618add294960d)
+ * (GenCodeChecksum:2bf1df61a7093242ac2cde0d4d8ef1e0)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -64,7 +64,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
   /**
    * Implicit FK to civicrm_option_value row in NEW label_type option group
    *
-   * @var int unsigned
+   * @var int
    */
   public $label_type_id;
 
@@ -78,28 +78,28 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
   /**
    * Is this default?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Is this option active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this reserved label?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * FK to civicrm_contact, who created this label layout
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -200,7 +200,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'name_badge',
             'optionEditPath' => 'civicrm/admin/options/name_badge',
-          ]
+          ],
         ],
         'label_type_id' => [
           'name' => 'label_type_id',
@@ -218,7 +218,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'label_type',
             'optionEditPath' => 'civicrm/admin/options/label_type',
-          ]
+          ],
         ],
         'data' => [
           'name' => 'data',
index 9aed7cc925093f763573525b95d5e0ebf312db45..cd514f9b3da5014a00c66c2a48be596cf9afd12d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/RecurringEntity.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:810f5bce8bb650c96703532242f254e8)
+ * (GenCodeChecksum:9e730db130a597de8528532d06f2ad54)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Recurring Entity Parent ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Recurring Entity Child ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -57,7 +57,7 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO {
   /**
    * 1-this entity, 2-this and the following entities, 3-all the entities
    *
-   * @var boolean
+   * @var bool
    */
   public $mode;
 
index 5a16f8c65696c5424aa64888a047b55ce9c89076..bb9401d1a5bfebe549ce1d91fe37b6a40c700ab5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Setting.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1af3984556a05189587658c306d09348)
+ * (GenCodeChecksum:7bbe096eb48d3744aa86453cccb99bfb)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -50,28 +50,28 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO {
   /**
    * Which Domain is this menu item for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
   /**
    * FK to Contact ID if the setting is localized to a contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * Is this setting a contact specific or site wide setting?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_domain;
 
   /**
    * Component that this menu item belongs to
    *
-   * @var int unsigned
+   * @var int
    */
   public $component_id;
 
@@ -85,7 +85,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who created this setting
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -175,7 +175,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'contact_id' => [
           'name' => 'contact_id',
@@ -218,7 +218,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO {
             'table' => 'civicrm_component',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'created_date' => [
           'name' => 'created_date',
index cb0e4b98ed1e185617880f2c3f71271bb895b9aa..bf17bcd93603cdd9a2e8dc11875e44ddedae5c9f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/StateProvince.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:66bbfa3f81cb6baec8d7175f5f32718a)
+ * (GenCodeChecksum:38620d39135bc4e42f0cc688dff9cb5b)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO {
   /**
    * State/Province ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO {
   /**
    * ID of Country that State/Province belong
    *
-   * @var int unsigned
+   * @var int
    */
   public $country_id;
 
index c2cd8d97d982ac4bc45b3dfea8afff8240c48127..94f5d599380225a0b79496ef9b9edd46f8f33ad3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/StatusPreference.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b30c850f5621be00f3a7e828c7fe7c61)
+ * (GenCodeChecksum:777d59b72a077ecb4d4caa60e13bb479)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
   /**
    * Unique Status Preference ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this Status Preference for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
   /**
    * Hush messages up to and including this severity.
    *
-   * @var int unsigned
+   * @var int
    */
   public $ignore_severity;
 
@@ -136,7 +136,7 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -183,7 +183,7 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Utils_Check::getSeverityList',
-          ]
+          ],
         ],
         'prefs' => [
           'name' => 'prefs',
index f3c7e8817f93ea73a4ae54072a5268f0b2796e15..c1587e0bdd68d79e4c92ce7e5ceadb5825e82295 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/SystemLog.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:edcf9c070365c92afa56f7f3fe79acee)
+ * (GenCodeChecksum:a2276bcf3bb39a3947bf54b043fa0a05)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_SystemLog extends CRM_Core_DAO {
   /**
    * Primary key ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -66,7 +66,7 @@ class CRM_Core_DAO_SystemLog extends CRM_Core_DAO {
   /**
    * Optional Contact ID that created the log. Not an FK as we keep this regardless
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
index 0dce7bc38be633f363d6412b3879c6df4f2b4e70..826157f63cca11d665df383873d63fbdbfd73b23 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Tag.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e66cd3973c4f223dd201904b3c59b233)
+ * (GenCodeChecksum:3abd98f177e35fd993b77bf08b115e4a)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO {
   /**
    * Tag ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,24 +52,24 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO {
   /**
    * Optional parent id for this tag.
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Is this tag selectable / displayed
    *
-   * @var boolean
+   * @var bool
    */
   public $is_selectable;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_tagset;
 
@@ -81,7 +81,7 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who created this tag
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -229,13 +229,14 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO {
           'entity' => 'Tag',
           'bao' => 'CRM_Core_BAO_Tag',
           'localizable' => 0,
+          'serialize' => self::SERIALIZE_COMMA,
           'html' => [
             'type' => 'Select',
           ],
           'pseudoconstant' => [
             'optionGroupName' => 'tag_used_for',
             'optionEditPath' => 'civicrm/admin/options/tag_used_for',
-          ]
+          ],
         ],
         'created_id' => [
           'name' => 'created_id',
index 91418a1c74dcea0fa71d23b1e194936d78375f95..0c33a2f11d8d2008f4cc19b30ca482ac7fc0d7d3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Timezone.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e54363ef08090c4dfbed076c842edd03)
+ * (GenCodeChecksum:7a377d04c1e9cfede74c42b155e301f5)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Timezone extends CRM_Core_DAO {
   /**
    * Timezone Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -64,7 +64,7 @@ class CRM_Core_DAO_Timezone extends CRM_Core_DAO {
   /**
    * Country Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $country_id;
 
index 5d6c9183e4e0f078de3c45a5812a11d196ac8083..7f06eb7a50cbc05c61d594d88e0800f0368767cd 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/UFField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3acfd1d2bd5f1e54f8aee7f96328cb58)
+ * (GenCodeChecksum:4e6400ee9a0d081541d8e14366129502)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which form does this field belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $uf_group_id;
 
@@ -52,21 +52,21 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
   /**
    * Is this field currently shareable? If false, hide the field for all sharing contexts.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * the field is view only and not editable in user forms.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_view;
 
   /**
    * Is this field required when included in a user or registration form?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_required;
 
@@ -101,35 +101,35 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
   /**
    * Is this field included as a column in the selector table?
    *
-   * @var boolean
+   * @var bool
    */
   public $in_selector;
 
   /**
    * Is this field included search form of profile?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_searchable;
 
   /**
    * Location type of this mapping, if required
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
   /**
    * Phone Type Id, if required
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_type_id;
 
   /**
    * Website Type Id, if required
    *
-   * @var int unsigned
+   * @var int
    */
   public $website_type_id;
 
@@ -150,14 +150,14 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
   /**
    * Is this field reserved for use by some other CiviCRM functionality?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Include in multi-record listing?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_multi_summary;
 
@@ -224,7 +224,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
             'table' => 'civicrm_uf_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'field_name' => [
           'name' => 'field_name',
@@ -241,7 +241,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
@@ -332,7 +332,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::ufVisibility',
-          ]
+          ],
         ],
         'in_selector' => [
           'name' => 'in_selector',
@@ -383,7 +383,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'phone_type',
             'optionEditPath' => 'civicrm/admin/options/phone_type',
-          ]
+          ],
         ],
         'website_type_id' => [
           'name' => 'website_type_id',
@@ -398,7 +398,7 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'website_type',
             'optionEditPath' => 'civicrm/admin/options/website_type',
-          ]
+          ],
         ],
         'label' => [
           'name' => 'label',
index 290ed5b3b17e654f35e485d7c69f088035e0e58e..792c2abb1f5631f41bd8edbf191ed251403797d0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/UFGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0f78fb49440e1cf5d43fd3db5a43ee7e)
+ * (GenCodeChecksum:2a382dd695bc7d2ad3dca96996c5258b)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Is this form currently active? If false, hide all related fields for all sharing contexts.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -87,7 +87,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Group id, foreign key from civicrm_group
    *
-   * @var int unsigned
+   * @var int
    */
   public $limit_listings_group_id;
 
@@ -101,42 +101,42 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * foreign key to civicrm_group_id
    *
-   * @var int unsigned
+   * @var int
    */
   public $add_to_group_id;
 
   /**
    * Should a CAPTCHA widget be included this Profile form.
    *
-   * @var boolean
+   * @var bool
    */
   public $add_captcha;
 
   /**
    * Do we want to map results from this profile.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_map;
 
   /**
    * Should edit link display in profile selector
    *
-   * @var boolean
+   * @var bool
    */
   public $is_edit_link;
 
   /**
    * Should we display a link to the website profile in profile selector
    *
-   * @var boolean
+   * @var bool
    */
   public $is_uf_link;
 
   /**
    * Should we update the contact record if we find a duplicate
    *
-   * @var boolean
+   * @var bool
    */
   public $is_update_dupe;
 
@@ -150,7 +150,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Should we create a cms user for this profile
    *
-   * @var boolean
+   * @var bool
    */
   public $is_cms_user;
 
@@ -162,7 +162,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Is this group reserved for use by some other CiviCRM functionality?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
@@ -176,7 +176,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who created this UF group
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -190,7 +190,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Should we include proximity search feature in this profile search form?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_proximity_search;
 
@@ -211,7 +211,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO {
   /**
    * Should a Cancel button be included in this Profile form.
    *
-   * @var boolean
+   * @var bool
    */
   public $add_cancel_button;
 
index 2f940a4d74a38c5afe2aff3638789ecb8188276b..05bf4704f9970a9384e77c9e9402b812ea7caabf 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/UFJoin.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:09aaa3fd826c1b3407d39966f0f11aa7)
+ * (GenCodeChecksum:00acc4bbb42aee2a24981b30456458c1)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
   /**
    * Unique table ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Is this join currently active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -73,7 +73,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
   /**
    * Which form does this field belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $uf_group_id;
 
@@ -168,7 +168,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_BAO_UFJoin::entityTables',
-          ]
+          ],
         ],
         'entity_id' => [
           'name' => 'entity_id',
@@ -213,7 +213,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO {
             'table' => 'civicrm_uf_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'module_data' => [
           'name' => 'module_data',
index 0e072cef5d2e80c06c1307231cc65419bf44a4f9..fc1d60dc1aed9c07a5bcd5fad190c812d1fdc1fc 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/UFMatch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3dbbb5d21dec55536826e465629f7174)
+ * (GenCodeChecksum:b7305bf7df97967d214db393a34f740f)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Core_DAO_UFMatch extends CRM_Core_DAO {
   /**
    * System generated ID.
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this match entry for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
   /**
    * UF ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $uf_id;
 
@@ -59,7 +59,7 @@ class CRM_Core_DAO_UFMatch extends CRM_Core_DAO {
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -130,7 +130,7 @@ class CRM_Core_DAO_UFMatch extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'uf_id' => [
           'name' => 'uf_id',
index 6976248baa07b19d66c3e2359f14b01b63e421f2..31b4d03d4ebfa7d575281cd003962524ac115928 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Website.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3c7acea3980658a252658fd11578cfbe)
+ * (GenCodeChecksum:22c11a2bc194d075912df3279acc6a97)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO {
   /**
    * Unique Website ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO {
   /**
    * Which Website type does this website belong to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $website_type_id;
 
@@ -147,7 +147,7 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'website_type',
             'optionEditPath' => 'civicrm/admin/options/website_type',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index dfde25755f6969db42a6df96cb8e3c227c3eab69..637bcceb5b375cf94c3621df985d73138ffbc863 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/WordReplacement.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:df2cde8fb1f65a25db724d35387a1342)
+ * (GenCodeChecksum:1f2d0542e46494b542dce1c0132a1643)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
   /**
    * Word replacement ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,7 +52,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
   /**
    * Is this entry active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -64,7 +64,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
   /**
    * FK to Domain ID. This is for Domain specific word replacement
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -166,7 +166,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType',
-          ]
+          ],
         ],
         'domain_id' => [
           'name' => 'domain_id',
@@ -183,7 +183,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index fc5b2eb2691a382a444150af8686616ebac07221..05665f23037ebbdae162c6bb00388a8b4cd96778 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Worldregion.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f326bc6047454a630b352baf190b0cac)
+ * (GenCodeChecksum:b607c0ba0b25b3f785779384fc6a6887)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Core_DAO_Worldregion extends CRM_Core_DAO {
   /**
    * Country Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index 52ee98d4dc47be9393627998cf81b595b6d5acf7..16ac8caf4dd8f7b518a6026b4ad7e9cd868ecdf1 100644 (file)
@@ -617,7 +617,7 @@ class CRM_Core_Error extends PEAR_ErrorStack {
     if (!empty(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
       // should call $config->userSystem->logger($message) here - but I got a situation where userSystem was not an object - not sure why
       if ($config->userSystem->is_drupal and function_exists('watchdog')) {
-        watchdog('civicrm', '%message', ['%message' => $message], WATCHDOG_DEBUG);
+        watchdog('civicrm', '%message', ['%message' => $message], isset($priority) ? $priority : WATCHDOG_DEBUG);
       }
     }
 
index b396667fe7f4306d153fa680da40dc5e47eacf8c..bc05679de024ddb797cf585e1bd2addcc7940876 100644 (file)
@@ -766,6 +766,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $this->assign('bltID', $this->_bltID);
   }
 
+  /**
+   * @return int
+   */
+  public function getPaymentProcessorID() {
+    return $this->_paymentProcessorID;
+  }
+
   /**
    * This if a front end form function for setting the payment processor.
    *
@@ -878,9 +885,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       else {
         $this->_paymentProcessor = [];
       }
-      CRM_Financial_Form_Payment::addCreditCardJs($this->_paymentProcessorID);
     }
-    $this->assign('paymentProcessorID', $this->_paymentProcessorID);
+
     // We save the fact that the profile 'billing' is required on the payment form.
     // Currently pay-later is the only 'processor' that takes notice of this - but ideally
     // 1) it would be possible to select the minimum_billing_profile_id for the contribution form
@@ -1314,7 +1320,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $label,
       $options,
       $required,
-      NULL
+      ['class' => 'crm-select2']
     );
     $attributes = ['format' => 'searchDate'];
     $extra = ['time' => $isDateTime];
index 38f2548208f0268ee380624dd24b9e13b9f3d5c1..00a5c5b6e0922e7143081f1163669e29914d59aa 100644 (file)
@@ -64,6 +64,20 @@ trait CRM_Core_Form_EntityFormTrait {
     return $this->deleteMessage;
   }
 
+  /**
+   * Set the delete message.
+   *
+   * We do this from the constructor in order to do a translation.
+   */
+  public function setDeleteMessage() {
+  }
+
+  /**
+   * Set entity fields to be assigned to the form.
+   */
+  protected function setEntityFields() {
+  }
+
   /**
    * Get the entity id being edited.
    *
index cb5839bf877e39b010002ff1b51689b343bf8e0a..ede46d09d6fd7f98bb6fd25c97f5ee306a6ad0f4 100644 (file)
@@ -61,7 +61,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
   /**
    * Have we already done this search
    *
-   * @var boolean
+   * @var bool
    */
   protected $_done;
 
@@ -178,6 +178,11 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
    */
   public static function formRule($fields, $files, $form) {
     $errors = [];
+    if (!is_a($form, 'CRM_Core_Form_Search')) {
+      // So this gets hit with a form object when doing an activity date search from
+      // advanced search, but a NULL object when doing a pledge search.
+      return $errors;
+    }
     foreach ($form->getSearchFieldMetadata() as $entity => $spec) {
       foreach ($spec as $fieldName => $fieldSpec) {
         if ($fieldSpec['type'] === CRM_Utils_Type::T_DATE || $fieldSpec['type'] === (CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME)) {
index 92af8f69c282a43881c143bf2ea26a64b8d7bc02..4d0d513e2c01548b8b5bd55b6edf06a06e36c27b 100644 (file)
@@ -126,7 +126,7 @@ class CRM_Core_IDS {
         'filter_type' => 'xml',
         'filter_path' => "{$civicrm_root}/packages/IDS/default_filter.xml",
         'tmp_path' => $tmpDir,
-        'HTML_Purifier_Path' => $civicrm_root . '/vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php',
+        'HTML_Purifier_Path' => $civicrm_root . 'packages/IDS/vendors/htmlpurifer/HTMLPurifier.auto.php',
         'HTML_Purifier_Cache' => $tmpDir,
         'scan_keys' => '',
         'exceptions' => ['__utmz', '__utmc'],
index e8908fea50f1852ed4e70d1ad15e9859db3bc4e4..145c91af53352081c761e203fa89511e411f4e26 100644 (file)
@@ -67,7 +67,7 @@ class CRM_Core_Page {
    * so the display routine needs to not do any work. (The
    * parent object takes care of the display)
    *
-   * @var boolean
+   * @var bool
    */
   protected $_embedded = FALSE;
 
@@ -75,7 +75,7 @@ class CRM_Core_Page {
    * Are we in print mode? if so we need to modify the display
    * functionality to do a minimal display :)
    *
-   * @var boolean
+   * @var bool
    */
   protected $_print = FALSE;
 
index 362e3d1616869af1ea9b9562eb66e4e3ee99fc1a..c1f6cd10bf080df476b3f6ec9ad2d91a63318213 100644 (file)
@@ -68,12 +68,25 @@ class CRM_Core_Page_File extends CRM_Core_Page {
       $mimeType = '';
       $path = CRM_Core_Config::singleton()->customFileUploadDir . $fileName;
     }
-    $mimeType = CRM_Utils_Request::retrieveValue('mime-type', 'String', $mimeType, FALSE);
 
     if (!$path) {
       CRM_Core_Error::statusBounce('Could not retrieve the file');
     }
 
+    if (empty($mimeType)) {
+      $passedInMimeType = self::convertBadMimeAliasTypes(CRM_Utils_Request::retrieveValue('mime-type', 'String', $mimeType, FALSE));
+      if (!in_array($passedInMimeType, explode(',', Civi::settings()->get('requestableMimeTypes')))) {
+        throw new CRM_Core_Exception("Supplied mime-type is not accepted");
+      }
+      $extension = CRM_Utils_File::getExtensionFromPath($path);
+      $candidateExtensions = CRM_Utils_File::getAcceptableExtensionsForMimeType($passedInMimeType);
+      if (!in_array($extension, $candidateExtensions)) {
+        throw new CRM_Core_Exception("Supplied mime-type does not match file extension");
+      }
+      // Now that we have validated mime-type supplied as much as possible lets now set the MimeType variable/
+      $mimeType = $passedInMimeType;
+    }
+
     $buffer = file_get_contents($path);
     if (!$buffer) {
       CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
@@ -101,4 +114,33 @@ class CRM_Core_Page_File extends CRM_Core_Page {
     }
   }
 
+  /**
+   * Translate one mime type to another.
+   *
+   * Certain non-standard/weird MIME types have been common. Unfortunately, because
+   * of the way this controller is used, the weird types may baked-into URLs.
+   * We clean these up for compatibility.
+   *
+   * @param string $type
+   *   Ex: 'image/jpg'
+   * @return string
+   *   Ex: 'image/jpeg'.
+   */
+  protected static function convertBadMimeAliasTypes($type) {
+    $badTypes = [
+      // Before PNG format was ubiquitous, it was image/x-png?
+      'image/x-png' => 'image/png',
+
+      // People see "image/gif" and "image/png" and wrongly guess "image/jpg"?
+      'image/jpg' => 'image/jpeg',
+      'image/tif' => 'image/tiff',
+      'image/svg' => 'image/svg+xml',
+
+      // StackExchange attributes "pjpeg" to some quirk in an old version of IE?
+      'image/pjpeg' => 'image/jpeg',
+
+    ];
+    return isset($badTypes[$type]) ? $badTypes[$type] : $type;
+  }
+
 }
index f7a5067668b064d83673c2ebf195e6772fe14485..1e5f6462231da332699ab5891c477643bbcf96e8 100644 (file)
@@ -1190,7 +1190,7 @@ abstract class CRM_Core_Payment {
 
   /**
    * Calling this from outside the payment subsystem is deprecated - use doPayment.
-   *
+   * @deprecated
    * Does a server to server payment transaction.
    *
    * @param array $params
@@ -1205,33 +1205,25 @@ abstract class CRM_Core_Payment {
 
   /**
    * Process payment - this function wraps around both doTransferCheckout and doDirectPayment.
+   * Any processor that still implements the deprecated doTransferCheckout() or doDirectPayment() should be updated to use doPayment().
    *
-   * The function ensures an exception is thrown & moves some of this logic out of the form layer and makes the forms
-   * more agnostic.
-   *
-   * Payment processors should set payment_status_id. This function adds some historical defaults ie. the
-   * assumption that if a 'doDirectPayment' processors comes back it completed the transaction & in fact
-   * doTransferCheckout would not traditionally come back.
-   *
-   * doDirectPayment does not do an immediate payment for Authorize.net or Paypal so the default is assumed
-   * to be Pending.
+   * This function adds some historical defaults ie. the assumption that if a 'doDirectPayment' processors comes back it completed
+   *   the transaction & in fact doTransferCheckout would not traditionally come back.
+   * Payment processors should throw exceptions and not return Error objects as they may have done with the old functions.
    *
-   * Once this function is fully rolled out then it will be preferred for processors to throw exceptions than to
-   * return Error objects
+   * Payment processors should set payment_status_id (which is really contribution_status_id) in the returned array. The default is assumed to be Pending.
+   *   In some cases the IPN will set the payment to "Completed" some time later.
    *
-   * Usage:
-   * Payment processors should override this function directly instead of using doDirectPayment/doTransferCheckout which are deprecated.
-   * Payment processors should set and return payment_status_id (Pending if the IPN will complete it, Completed if successful).
-   * @fixme For the contribution workflow we have a contributionID, but for the event and membership workflow the contribution has not yet been created
-   *  so we can't update params directly on the contribution.  However if you return trxn_id, fee_amount, net_amount they will be set on the contribution
-   *  by those workflows.  Ideally all workflows would create a pending contribution BEFORE calling doPayment (eg. https://github.com/civicrm/civicrm-core/pull/13763 for events)
+   * @fixme Creating a contribution record is inconsistent! We should always create a contribution BEFORE calling doPayment...
+   *  For the current status see: https://lab.civicrm.org/dev/financial/issues/53
+   * If we DO have a contribution ID, then the payment processor can (and should) update parameters on the contribution record as necessary.
    *
    * @param array $params
    *
    * @param string $component
    *
    * @return array
-   *   Result array
+   *   Result array (containing at least the key payment_status_id)
    *
    * @throws \Civi\Payment\Exception\PaymentProcessorException
    */
index 1fdbd9cda3406526d99bd128824a61becf20faed..d2f8c5c00d444fd97f6bbd447fd2989d85e23698 100644 (file)
@@ -146,6 +146,14 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment {
     return TRUE;
   }
 
+  /**
+   * Supports altering future start dates
+   * @return bool
+   */
+  public function supportsFutureRecurStartDate() {
+    return TRUE;
+  }
+
   /**
    * Submit a refund payment
    *
index 7b91ac425198f3760bca857d89dc59e636106ce1..8d9df671c4dae8634edd2a8aeafe0bdeef0c6f61 100644 (file)
@@ -343,7 +343,13 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
 
     $xml = '<txn>';
     foreach ($requestFields as $key => $value) {
-      $xml .= '<' . $key . '>' . self::tidyStringforXML($value, $xmlFieldLength[$key]) . '</' . $key . '>';
+      //dev/core/966 Don't send email through the urlencode.
+      if ($key == 'ssl_email') {
+        $xml .= '<' . $key . '>' . substr($value, 0, $xmlFieldLength[$key]) . '</' . $key . '>';
+      }
+      else {
+        $xml .= '<' . $key . '>' . self::tidyStringforXML($value, $xmlFieldLength[$key]) . '</' . $key . '>';
+      }
     }
     $xml .= '</txn>';
     return $xml;
index 6afebf6e535dda762faaaab1685180ba304147f6..9b8fc660e6717447ff73fb9e2f03ccd251c9e320 100644 (file)
@@ -73,6 +73,9 @@ class CRM_Core_Payment_ProcessorForm {
 
     $form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons());
 
+    CRM_Financial_Form_Payment::addCreditCardJs($form->getPaymentProcessorID());
+    $form->assign('paymentProcessorID', $form->getPaymentProcessorID());
+
     $form->assign('currency', $form->getCurrency());
 
     // also set cancel subscription url
index e2277df2f173fa80f28a141340edcb6857637dee..915b95f614c7d2fd9079fe3edec926e72ad91257 100644 (file)
@@ -41,14 +41,15 @@ class CRM_Core_Permission_Backdrop extends CRM_Core_Permission_DrupalBase {
   /**
    * Is this user someone with access for the entire system.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_viewAdminUser = FALSE;
   protected $_editAdminUser = FALSE;
 
   /**
    * Am in in view permission or edit permission?
-   * @var boolean
+   *
+   * @var bool
    */
   protected $_viewPermission = FALSE;
   protected $_editPermission = FALSE;
index 9c0bbdee78c9da83c4917da2bfb1efe4964cdb64..f49c0dd52ec502d7149ac6bbfd3a8e4ee827df18 100644 (file)
@@ -41,14 +41,14 @@ class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase {
   /**
    * Is this user someone with access for the entire system.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_viewAdminUser = FALSE;
   protected $_editAdminUser = FALSE;
 
   /**
    * Am in in view permission or edit permission?
-   * @var boolean
+   * @var bool
    */
   protected $_viewPermission = FALSE;
   protected $_editPermission = FALSE;
index d969ed42373fe3a501b2f20ed5889b55f016fdeb..eb1a8801fefee5d00207a614511b3b0a43a05e12 100644 (file)
@@ -41,14 +41,14 @@ class CRM_Core_Permission_Drupal6 extends CRM_Core_Permission_DrupalBase {
   /**
    * Is this user someone with access for the entire system.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_viewAdminUser = FALSE;
   protected $_editAdminUser = FALSE;
 
   /**
    * Am in in view permission or edit permission?
-   * @var boolean
+   * @var bool
    */
   protected $_viewPermission = FALSE;
   protected $_editPermission = FALSE;
index b691211be25a0e5107d5b0ebe72fd1b4f5ba9929..74baeac71cb98684f4dd792ae66da8805c2a1ac8 100644 (file)
@@ -41,14 +41,15 @@ class CRM_Core_Permission_DrupalBase extends CRM_Core_Permission_Base {
   /**
    * Is this user someone with access for the entire system.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_viewAdminUser = FALSE;
   protected $_editAdminUser = FALSE;
 
   /**
    * Am in in view permission or edit permission?
-   * @var boolean
+   *
+   * @var bool
    */
   protected $_viewPermission = FALSE;
   protected $_editPermission = FALSE;
index 0af4bd1e105fa78cb1e19915f544dcdc8468fa14..28984e107d1c2d7571f2c3e47701901e8178e760 100644 (file)
@@ -220,14 +220,12 @@ class CRM_Core_PseudoConstant {
       if ($options && $flip) {
         $options = array_flip($options);
       }
-      $customField->free();
       return $options;
     }
 
     // Core field: load schema
     $dao = new $daoName();
     $fieldSpec = $dao->getFieldSpec($fieldName);
-    $dao->free();
 
     // Ensure we have the canonical name for this field
     $fieldName = CRM_Utils_Array::value('name', $fieldSpec, $fieldName);
@@ -313,7 +311,6 @@ class CRM_Core_PseudoConstant {
           // Get list of fields for the option table
           $dao = new $daoName();
           $availableFields = array_keys($dao->fieldKeys());
-          $dao->free();
 
           $select = "SELECT %1 AS id, %2 AS label";
           $from = "FROM %3";
@@ -375,7 +372,6 @@ class CRM_Core_PseudoConstant {
           while ($dao->fetch()) {
             $output[$dao->id] = $dao->label;
           }
-          $dao->free();
           // Localize results
           if (!empty($params['localize']) || $pseudoconstant['table'] == 'civicrm_country' || $pseudoconstant['table'] == 'civicrm_state_province') {
             $I18nParams = [];
index a9f9e13b71ae571c8a5247a10b637bbedc665767..6ece48f8893d79d04521385c11e522672afefc1b 100644 (file)
@@ -38,7 +38,7 @@ class CRM_Core_Region {
   /**
    * Whether the snippets array has been sorted
    *
-   * @var boolean
+   * @var bool
    */
   public $_isSorted;
 
index 3c88fedb387f36e91bdcc24fcd8b77f4cfb5bc43..69f9e46150897be1f34182783e58665513c253d9 100644 (file)
@@ -767,6 +767,9 @@ class CRM_Core_Resources {
       $items[] = 'js/crm.menubar.js';
       $items[] = Civi::service('asset_builder')->getUrl('crm-menubar.css', [
         'color' => Civi::settings()->get('menubar_color'),
+        'height' => 40,
+        'breakpoint' => 768,
+        'opacity' => .88,
       ]);
       $items[] = [
         'menubar' => [
@@ -852,8 +855,11 @@ class CRM_Core_Resources {
     }
     $vars = [
       'resourceBase' => rtrim($config->resourceBase, '/'),
+      'menubarHeight' => $e->params['height'] . 'px',
+      'breakMin' => $e->params['breakpoint'] . 'px',
+      'breakMax' => ($e->params['breakpoint'] - 1) . 'px',
       'menubarColor' => $color,
-      'semiTransparentMenuColor' => 'rgba(' . implode(', ', CRM_Utils_Color::getRgb($color)) . ', .85)',
+      'menuItemColor' => 'rgba(' . implode(', ', CRM_Utils_Color::getRgb($color)) . ", {$e->params['opacity']})",
       'highlightColor' => CRM_Utils_Color::getHighlight($color),
       'textColor' => CRM_Utils_Color::getContrast($color, '#333', '#ddd'),
     ];
index 0832d00bac6e4322521c5388d3bc608db542d8fb..74e619b7fb5bc9270f6cddcd4dbf091ceb09c33a 100644 (file)
@@ -37,12 +37,8 @@ abstract class CRM_Custom_Import_Parser extends CRM_Contact_Import_Parser {
   protected $_fileName;
 
   /**
-   * #@+
-   * @var integer
-   */
-
-  /**
-   * Imported file size
+   * Imported file size.
+   *
    * @var int
    */
   protected $_fileSize;
@@ -62,7 +58,7 @@ abstract class CRM_Custom_Import_Parser extends CRM_Contact_Import_Parser {
   /**
    * Whether the file has a column header or not
    *
-   * @var boolean
+   * @var bool
    */
   protected $_haveColumnHeader;
 
index 7713ee953ff597274f31df68897f5a667a84c900..c75742e2383bac97fd23968e7476e3d971a7af07 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Cxn/Cxn.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:999790d380fa004a25265a1a0126fb95)
+ * (GenCodeChecksum:bd6f3b0785ec9b05984d8ad32f3b8464)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
   /**
    * Connection ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -80,7 +80,7 @@ class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO {
   /**
    * Is connection currently enabled?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index cfc6bc3b9a0a569eaaf64e29075684e959f943ba..9e0daa833a8b64b5d93ca1c36410c54774a0488d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Dedupe/Exception.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1f39e9ee1f80da1b62c054f6ca4119c5)
+ * (GenCodeChecksum:eec5ad673402f603903d6f35ad1bcd06)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Dedupe_DAO_Exception extends CRM_Core_DAO {
   /**
    * Unique dedupe exception id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id1;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id2;
 
index 806185c260a9dfbc84e230a065a4dadebe4a06a7..5d513b1aaf25183a0c73b0ed2d4a2fd9d01d0aac 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Dedupe/Rule.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:99420d466d2982510873b69c179fd9f5)
+ * (GenCodeChecksum:a7697e9d93641b3240e23f97f4f92329)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO {
   /**
    * Unique dedupe rule id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The id of the rule group this rule belongs to
    *
-   * @var int unsigned
+   * @var int
    */
   public $dedupe_rule_group_id;
 
@@ -59,7 +59,7 @@ class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO {
   /**
    * The length of the matching substring
    *
-   * @var int unsigned
+   * @var int
    */
   public $rule_length;
 
index 505c8044dcdcf3e68be60fc5935961fcb30e50ca..bb54789c0b7a7198a7480244e77b276d9641ab82 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Dedupe/RuleGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:85fc439e89d4d0dfd403efdd1cf67531)
+ * (GenCodeChecksum:a0c7d9e893a3aec240db9ec4b0e8729d)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO {
   /**
    * Unique dedupe rule group id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -73,7 +73,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO {
   /**
    * Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
@@ -125,7 +125,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'label',
             'condition' => 'parent_id IS NULL',
-          ]
+          ],
         ],
         'threshold' => [
           'name' => 'threshold',
@@ -160,7 +160,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
index 869454b0ca23b997f1fa0d538fbff87713fb74c5..0c8bec8f596ae23e65f896391ca99ec58a02c434 100644 (file)
@@ -579,13 +579,10 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     // Allow hook_civicrm_merge() to add SQL statements for the merge operation.
     CRM_Utils_Hook::merge('sqls', $sqls, $mainId, $otherId, $tables);
 
-    // call the SQL queries in one transaction
-    $transaction = new CRM_Core_Transaction();
     foreach ($sqls as $sql) {
       CRM_Core_DAO::executeQuery($sql, [], TRUE, NULL, TRUE);
     }
     CRM_Dedupe_Merger::addMembershipToRealtedContacts($mainId);
-    $transaction->commit();
   }
 
   /**
@@ -696,7 +693,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
       // explicitly set to NULL if not 1 or 0 as part of grandfathering out the mystical '2' value.
       $isSelected = NULL;
     }
-    $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, '', ($mode == 'aggressive'), $criteria, $checkPermissions);
+    $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, ($mode == 'aggressive'), $criteria, $checkPermissions);
 
     $cacheParams = [
       'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions),
@@ -924,92 +921,13 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    *   -  Does a force merge otherwise (aggressive mode).
    *
    * @param array $conflicts
+   *  An empty array to be filed with conflict information.
    *
    * @return bool
    */
   public static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe', &$conflicts = []) {
 
-    $originalMigrationInfo = $migrationInfo;
-    foreach ($migrationInfo as $key => $val) {
-      if ($val === "null") {
-        // Rule: Never overwrite with an empty value (in any mode)
-        unset($migrationInfo[$key]);
-        continue;
-      }
-      elseif ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) or
-          substr($key, 0, 12) == 'move_custom_'
-        ) and $val != NULL
-      ) {
-        // Rule: If both main-contact, and other-contact have a field with a
-        // different value, then let $mode decide if to merge it or not
-        if (
-          (!empty($migrationInfo['rows'][$key]['main'])
-            // For custom fields a 0 (e.g in an int field) could be a true conflict. This
-            // is probably true for other fields too - e.g. 'do_not_email' but
-            // leaving that investigation as a @todo - until tests can be written.
-            // Note the handling of this has test coverage - although the data-typing
-            // of '0' feels flakey we have insurance.
-            || ($migrationInfo['rows'][$key]['main'] === '0' && substr($key, 0, 12) == 'move_custom_')
-          )
-          && $migrationInfo['rows'][$key]['main'] != $migrationInfo['rows'][$key]['other']
-        ) {
-
-          // note it down & lets wait for response from the hook.
-          // For no response $mode will decide if to skip this merge
-          $conflicts[$key] = NULL;
-        }
-      }
-      elseif (substr($key, 0, 14) == 'move_location_' and $val != NULL) {
-        $locField = explode('_', $key);
-        $fieldName = $locField[2];
-        $fieldCount = $locField[3];
-
-        // Rule: Catch address conflicts (same address type on both contacts)
-        if (
-          isset($migrationInfo['main_details']['location_blocks'][$fieldName]) &&
-          !empty($migrationInfo['main_details']['location_blocks'][$fieldName])
-        ) {
-
-          // Load the address we're inspecting from the 'other' contact
-          $addressRecord = $migrationInfo['other_details']['location_blocks'][$fieldName][$fieldCount];
-          $addressRecordLocTypeId = CRM_Utils_Array::value('location_type_id', $addressRecord);
-
-          // If it exists on the 'main' contact already, skip it. Otherwise
-          // if the location type exists already, log a conflict.
-          foreach ($migrationInfo['main_details']['location_blocks'][$fieldName] as $mainAddressKey => $mainAddressRecord) {
-            if (self::locationIsSame($addressRecord, $mainAddressRecord)) {
-              unset($migrationInfo[$key]);
-              break;
-            }
-            elseif ($addressRecordLocTypeId == $mainAddressRecord['location_type_id']) {
-              $conflicts[$key] = NULL;
-              break;
-            }
-          }
-        }
-
-        // For other locations, don't merge/add if the values are the same
-        elseif (CRM_Utils_Array::value('main', $migrationInfo['rows'][$key]) == $migrationInfo['rows'][$key]['other']) {
-          unset($migrationInfo[$key]);
-        }
-      }
-    }
-
-    // A hook to implement other algorithms for choosing which contact to bias to when
-    // there's a conflict (to handle "gotchas"). fields_in_conflict could be modified here
-    // merge happens with new values filled in here. For a particular field / row not to be merged
-    // field should be unset from fields_in_conflict.
-    $migrationData = [
-      'old_migration_info' => $originalMigrationInfo,
-      'mode' => $mode,
-      'fields_in_conflict' => $conflicts,
-      'merge_mode' => $mode,
-      'migration_info' => $migrationInfo,
-    ];
-    CRM_Utils_Hook::merge('batch', $migrationData, $mainId, $otherId);
-    $conflicts = $migrationData['fields_in_conflict'];
-    // allow hook to override / manipulate migrationInfo as well
-    $migrationInfo = $migrationData['migration_info'];
+    $conflicts = self::getConflicts($migrationInfo, $mainId, $otherId, $mode);
 
     if (!empty($conflicts)) {
       foreach ($conflicts as $key => $val) {
@@ -1023,9 +941,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         }
       }
       // if there are conflicts and mode is aggressive, allow hooks to decide if to skip merges
-      if (array_key_exists('skip_merge', $migrationData)) {
-        return (bool) $migrationData['skip_merge'];
-      }
+      return (bool) $migrationInfo['skip_merge'];
     }
     return FALSE;
   }
@@ -1161,8 +1077,6 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
 
     $main = self::getMergeContactDetails($mainId);
     $other = self::getMergeContactDetails($otherId);
-    $specialValues['main'] = self::getSpecialValues($main);
-    $specialValues['other'] = self::getSpecialValues($other);
 
     $compareFields = self::retrieveFields($main, $other);
 
@@ -1173,14 +1087,22 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         // CRM-15681 don't display sub-types in UI
         continue;
       }
-      foreach (['main', 'other'] as $moniker) {
-        $contact = &$$moniker;
-        $value = CRM_Utils_Array::value($field, $contact);
-        if (isset($specialValues[$moniker][$field]) && is_string($specialValues[$moniker][$field])) {
-          $value = CRM_Core_DAO::VALUE_SEPARATOR . trim($specialValues[$moniker][$field], CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
+      foreach (['main' => $main, 'other' => $other] as $moniker => $contact) {
+        $value = $label = CRM_Utils_Array::value($field, $contact);
+        $fieldSpec = $fields[$field];
+        if (!empty($fieldSpec['serialize']) && is_array($value)) {
+          // In practice this only applies to preferred_communication_method as the sub types are skipped above
+          // and no others are serialized.
+          $labels = [];
+          foreach ($value as $individualValue) {
+            $labels[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_BAO_Contact', $field, $individualValue);
+          }
+          $label = implode(', ', $labels);
+          // We serialize this due to historic handling but it's likely that if we just left it as an
+          // array all would be well & we would have less code.
+          $value = CRM_Core_DAO::serializeField($value, $fieldSpec['serialize']);
         }
-        $label = isset($specialValues[$moniker]["{$field}_display"]) ? $specialValues[$moniker]["{$field}_display"] : $value;
-        if (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) {
+        elseif (!empty($fieldSpec['type']) && $fieldSpec['type'] == CRM_Utils_Type::T_DATE) {
           if ($value) {
             $value = str_replace('-', '', $value);
             $label = CRM_Utils_Date::customFormat($label);
@@ -1197,15 +1119,8 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
             $label = ts('[x]');
           }
         }
-        elseif ($field == 'prefix_id') {
-          $label = CRM_Utils_Array::value('individual_prefix', $contact);
-        }
-        elseif ($field == 'suffix_id') {
-          $label = CRM_Utils_Array::value('individual_suffix', $contact);
-        }
-        elseif ($field == 'gender_id' && !empty($value)) {
-          $genderOptions = civicrm_api3('contact', 'getoptions', ['field' => 'gender_id']);
-          $label = $genderOptions['values'][$value];
+        elseif (!empty($fieldSpec['pseudoconstant'])) {
+          $label = CRM_Core_PseudoConstant::getLabel('CRM_Contact_BAO_Contact', $field, $value);
         }
         elseif ($field == 'current_employer_id' && !empty($value)) {
           $label = "$value (" . CRM_Contact_BAO_Contact::displayName($value) . ")";
@@ -1608,15 +1523,15 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     if (empty($migrationInfo)) {
       return FALSE;
     }
+    // Encapsulate in a transaction to avoid half-merges.
+    $transaction = new CRM_Core_Transaction();
 
-    $qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
+    $contactType = $migrationInfo['main_details']['contact_type'];
     $relTables = CRM_Dedupe_Merger::relTables();
-    $submittedCustomFields = $moveTables = $locationMigrationInfo = $tableOperations = $removeTables = [];
+    $submittedCustomFields = $moveTables = $tableOperations = $removeTables = [];
 
+    self::swapOutFieldsAffectedByQFZeroBug($migrationInfo);
     foreach ($migrationInfo as $key => $value) {
-      if ($value == $qfZeroBug) {
-        $value = '0';
-      }
 
       if (substr($key, 0, 12) == 'move_custom_' && $value != NULL) {
         $submitted[substr($key, 5)] = $value;
@@ -1625,10 +1540,6 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
       elseif (in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) && $value != NULL) {
         $submitted[substr($key, 5)] = $value;
       }
-      // Set up initial information for handling migration of location blocks
-      elseif (substr($key, 0, 14) == 'move_location_' and $value != NULL) {
-        $locationMigrationInfo[$key] = $value;
-      }
       elseif (substr($key, 0, 15) == 'move_rel_table_' and $value == '1') {
         $moveTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']);
         if (array_key_exists('operation', $migrationInfo)) {
@@ -1643,7 +1554,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         $removeTables = array_merge($moveTables, $relTables[substr($key, 5)]['tables']);
       }
     }
-    self::mergeLocations($mainId, $otherId, $locationMigrationInfo, $migrationInfo);
+    self::mergeLocations($mainId, $otherId, $migrationInfo);
 
     // **** Do contact related migrations
     $customTablesToCopyValues = self::getAffectedCustomTables($submittedCustomFields);
@@ -1684,180 +1595,18 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
       'groupName' => 'postal_greeting',
     ];
     CRM_Core_OptionGroup::lookupValues($submitted, $names, TRUE);
-
     // fix custom fields so they're edible by createProfileContact()
-    $treeCache = [];
-    if (!array_key_exists($migrationInfo['main_details']['contact_type'], $treeCache)) {
-      $treeCache[$migrationInfo['main_details']['contact_type']] = CRM_Core_BAO_CustomGroup::getTree(
-        $migrationInfo['main_details']['contact_type'],
-        NULL,
-        NULL,
-        -1,
-        [],
-        NULL,
-        TRUE,
-        NULL,
-        FALSE,
-        FALSE
-      );
-    }
-
-    $cFields = [];
-    foreach ($treeCache[$migrationInfo['main_details']['contact_type']] as $key => $group) {
-      if (!isset($group['fields'])) {
-        continue;
-      }
-      foreach ($group['fields'] as $fid => $field) {
-        $cFields[$fid]['attributes'] = $field;
-      }
-    }
+    $cFields = self::getCustomFieldMetadata($contactType);
 
     if (!isset($submitted)) {
       $submitted = [];
     }
+    $customFiles = [];
     foreach ($submitted as $key => $value) {
-      if (substr($key, 0, 7) == 'custom_') {
-        $fid = (int) substr($key, 7);
-        if (empty($cFields[$fid])) {
-          continue;
-        }
-        $htmlType = $cFields[$fid]['attributes']['html_type'];
-        switch ($htmlType) {
-          case 'File':
-            $customFiles[] = $fid;
-            unset($submitted["custom_$fid"]);
-            break;
-
-          case 'Select Country':
-          case 'Select State/Province':
-            $submitted[$key] = CRM_Core_BAO_CustomField::displayValue($value, $fid);
-            break;
-
-          case 'Select Date':
-            if ($cFields[$fid]['attributes']['is_view']) {
-              $submitted[$key] = date('YmdHis', strtotime($submitted[$key]));
-            }
-            break;
-
-          case 'CheckBox':
-          case 'Multi-Select':
-          case 'Multi-Select Country':
-          case 'Multi-Select State/Province':
-            // Merge values from both contacts for multivalue fields, CRM-4385
-            // get the existing custom values from db.
-            $customParams = ['entityID' => $mainId, $key => TRUE];
-            $customfieldValues = CRM_Core_BAO_CustomValueTable::getValues($customParams);
-            if (!empty($customfieldValues[$key])) {
-              $existingValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customfieldValues[$key]);
-              if (is_array($existingValue) && !empty($existingValue)) {
-                $mergeValue = $submittedCustomFields = [];
-                if ($value == 'null') {
-                  // CRM-19074 if someone has deliberately chosen to overwrite with 'null', respect it.
-                  $submitted[$key] = $value;
-                }
-                else {
-                  if ($value) {
-                    $submittedCustomFields = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
-                  }
-
-                  // CRM-19653: overwrite or add the existing custom field value with dupicate contact's
-                  // custom field value stored at $submittedCustomValue.
-                  foreach ($submittedCustomFields as $k => $v) {
-                    if ($v != '' && !in_array($v, $mergeValue)) {
-                      $mergeValue[] = $v;
-                    }
-                  }
-
-                  //keep state and country as array format.
-                  //for checkbox and m-select format w/ VALUE_SEPARATOR
-                  if (in_array($htmlType, [
-                    'CheckBox',
-                    'Multi-Select',
-                  ])) {
-                    $submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
-                        $mergeValue
-                      ) . CRM_Core_DAO::VALUE_SEPARATOR;
-                  }
-                  else {
-                    $submitted[$key] = $mergeValue;
-                  }
-                }
-              }
-            }
-            elseif (in_array($htmlType, [
-              'Multi-Select Country',
-              'Multi-Select State/Province',
-            ])) {
-              //we require submitted values should be in array format
-              if ($value) {
-                $mergeValueArray = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
-                //hack to remove null values from array.
-                $mergeValue = [];
-                foreach ($mergeValueArray as $k => $v) {
-                  if ($v != '') {
-                    $mergeValue[] = $v;
-                  }
-                }
-                $submitted[$key] = $mergeValue;
-              }
-            }
-            break;
-
-          default:
-            break;
-        }
-      }
+      list($cFields, $customFiles, $submitted) = self::processCustomFields($mainId, $key, $cFields, $customFiles, $submitted, $value);
     }
 
-    // **** Do file custom fields related migrations
-    // FIXME: move this someplace else (one of the BAOs) after discussing
-    // where to, and whether CRM_Core_BAO_File::deleteFileReferences() shouldn't actually,
-    // like, delete a file...
-
-    if (!isset($customFiles)) {
-      $customFiles = [];
-    }
-    foreach ($customFiles as $customId) {
-      list($tableName, $columnName, $groupID) = CRM_Core_BAO_CustomField::getTableColumnGroup($customId);
-
-      // get the contact_id -> file_id mapping
-      $fileIds = [];
-      $sql = "SELECT entity_id, {$columnName} AS file_id FROM {$tableName} WHERE entity_id IN ({$mainId}, {$otherId})";
-      $dao = CRM_Core_DAO::executeQuery($sql);
-      while ($dao->fetch()) {
-        $fileIds[$dao->entity_id] = $dao->file_id;
-        if ($dao->entity_id == $mainId) {
-          CRM_Core_BAO_File::deleteFileReferences($fileIds[$mainId], $mainId, $customId);
-        }
-      }
-
-      // move the other contact's file to main contact
-      //NYSS need to INSERT or UPDATE depending on whether main contact has an existing record
-      if (CRM_Core_DAO::singleValueQuery("SELECT id FROM {$tableName} WHERE entity_id = {$mainId}")) {
-        $sql = "UPDATE {$tableName} SET {$columnName} = {$fileIds[$otherId]} WHERE entity_id = {$mainId}";
-      }
-      else {
-        $sql = "INSERT INTO {$tableName} ( entity_id, {$columnName} ) VALUES ( {$mainId}, {$fileIds[$otherId]} )";
-      }
-      CRM_Core_DAO::executeQuery($sql);
-
-      if (CRM_Core_DAO::singleValueQuery("
-        SELECT id
-        FROM civicrm_entity_file
-        WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}")
-      ) {
-        $sql = "
-          UPDATE civicrm_entity_file
-          SET entity_id = {$mainId}
-          WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}";
-      }
-      else {
-        $sql = "
-          INSERT INTO civicrm_entity_file ( entity_table, entity_id, file_id )
-          VALUES ( '{$tableName}', {$mainId}, {$fileIds[$otherId]} )";
-      }
-      CRM_Core_DAO::executeQuery($sql);
-    }
+    self::processCustomFieldFiles($mainId, $otherId, $customFiles);
 
     // move view only custom fields CRM-5362
     $viewOnlyCustomFields = [];
@@ -1920,7 +1669,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
 
       CRM_Contact_BAO_Contact::createProfileContact($submitted, CRM_Core_DAO::$_nullArray, $mainId);
     }
-
+    $transaction->commit();
     CRM_Utils_Hook::post('merge', 'Contact', $mainId);
     self::createMergeActivities($mainId, $otherId);
 
@@ -2067,7 +1816,6 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    * @param int $batchLimit
    * @param bool $isSelected
    *   Limit to selected pairs.
-   * @param array|string $orderByClause
    * @param bool $includeConflicts
    * @param array $criteria
    *   Additional criteria to narrow down the merge group.
@@ -2080,18 +1828,21 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    *
    * @return array
    *   Array of matches meeting the criteria.
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
-  public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $orderByClause = '', $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) {
+  public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) {
     $where = self::getWhereString($isSelected);
     $cacheKeyString = self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions);
     $join = self::getJoinOnDedupeTable();
-    $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], $orderByClause, $includeConflicts);
+    $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], '', $includeConflicts);
     if (empty($dupePairs) && $reloadCacheIfEmpty) {
       // If we haven't found any dupes, probably cache is empty.
       // Try filling cache and give another try. We don't need to specify include conflicts here are there will not be any
       // until we have done some processing.
       CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $cacheKeyString, $criteria, $checkPermissions, $searchLimit);
-      $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], $orderByClause, $includeConflicts);
+      $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], '', $includeConflicts);
       return $dupePairs;
     }
     return $dupePairs;
@@ -2131,38 +1882,6 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     return $cacheKeyString;
   }
 
-  /**
-   * @param array $contact
-   * @return array
-   *   $specialValues
-   */
-  public static function getSpecialValues($contact) {
-    $preferred_communication_method = CRM_Utils_Array::value('preferred_communication_method', $contact);
-    $value = empty($preferred_communication_method) ? [] : $preferred_communication_method;
-    $specialValues = [
-      'preferred_communication_method' => $value,
-      'communication_style_id' => $value,
-    ];
-
-    if (!empty($contact['preferred_communication_method'])) {
-      // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct
-      $prefCommList = is_array($specialValues['preferred_communication_method']) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues['preferred_communication_method']) : $specialValues['preferred_communication_method'];
-      $specialValues['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . $prefCommList . CRM_Core_DAO::VALUE_SEPARATOR;
-    }
-    $names = [
-      'preferred_communication_method' => [
-        'newName' => 'preferred_communication_method_display',
-        'groupName' => 'preferred_communication_method',
-      ],
-    ];
-    CRM_Core_OptionGroup::lookupValues($specialValues, $names);
-
-    if (!empty($contact['communication_style'])) {
-      $specialValues['communication_style_id_display'] = $contact['communication_style'];
-    }
-    return $specialValues;
-  }
-
   /**
    * Get the metadata for the merge fields.
    *
@@ -2234,14 +1953,16 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    *
    * @param int $mainId
    * @param int $otherId
-   * @param array $locationMigrationInfo
-   *   Portion of the migration_info that holds location migration information.
    *
    * @param array $migrationInfo
    *   Migration info for the merge. This is passed to the hook as informational only.
    */
-  public static function mergeLocations($mainId, $otherId, $locationMigrationInfo, $migrationInfo) {
-    foreach ($locationMigrationInfo as $key => $value) {
+  public static function mergeLocations($mainId, $otherId, $migrationInfo) {
+    foreach ($migrationInfo as $key => $value) {
+      $isLocationField = (substr($key, 0, 14) == 'move_location_' and $value != NULL);
+      if (!$isLocationField) {
+        continue;
+      }
       $locField = explode('_', $key);
       $fieldName = $locField[2];
       $fieldCount = $locField[3];
@@ -2402,9 +2123,331 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
       CRM_Core_BAO_PrevNextCache::markConflict($mainId, $otherId, $cacheKeyString, $conflicts);
     }
     else {
-      // delete entry from PrevNextCache table so we don't consider the pair next time
-      // pair may have been flipped, so make sure we delete using both orders
-      CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString, TRUE);
+      CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString);
+    }
+  }
+
+  /**
+   * Replace the pseudo QFKey with zero if it is present.
+   *
+   * @todo - on the slim chance this is still relevant it should be moved to the form layer.
+   *
+   * Details about this bug are somewhat obscured by the move from svn but perhaps JIRA
+   * can still help.
+   *
+   * @param array $migrationInfo
+   */
+  protected static function swapOutFieldsAffectedByQFZeroBug(&$migrationInfo) {
+    $qfZeroBug = 'e8cddb72-a257-11dc-b9cc-0016d3330ee9';
+    foreach ($migrationInfo as $key => &$value) {
+      if ($value == $qfZeroBug) {
+        $value = '0';
+      }
+    }
+  }
+
+  /**
+   * Honestly - what DOES this do - hopefully some refactoring will reveal it's purpose.
+   *
+   * @param $mainId
+   * @param $key
+   * @param $cFields
+   * @param $customFiles
+   * @param $submitted
+   * @param $value
+   *
+   * @return array
+   */
+  protected static function processCustomFields($mainId, $key, $cFields, $customFiles, $submitted, $value) {
+    if (substr($key, 0, 7) == 'custom_') {
+      $fid = (int) substr($key, 7);
+      if (empty($cFields[$fid])) {
+        return [$cFields, $customFiles, $submitted];
+      }
+      $htmlType = $cFields[$fid]['attributes']['html_type'];
+      switch ($htmlType) {
+        case 'File':
+          $customFiles[] = $fid;
+          unset($submitted["custom_$fid"]);
+          break;
+
+        case 'Select Country':
+        case 'Select State/Province':
+          $submitted[$key] = CRM_Core_BAO_CustomField::displayValue($value, $fid);
+          break;
+
+        case 'Select Date':
+          if ($cFields[$fid]['attributes']['is_view']) {
+            $submitted[$key] = date('YmdHis', strtotime($submitted[$key]));
+          }
+          break;
+
+        case 'CheckBox':
+        case 'Multi-Select':
+        case 'Multi-Select Country':
+        case 'Multi-Select State/Province':
+          // Merge values from both contacts for multivalue fields, CRM-4385
+          // get the existing custom values from db.
+          $customParams = ['entityID' => $mainId, $key => TRUE];
+          $customfieldValues = CRM_Core_BAO_CustomValueTable::getValues($customParams);
+          if (!empty($customfieldValues[$key])) {
+            $existingValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customfieldValues[$key]);
+            if (is_array($existingValue) && !empty($existingValue)) {
+              $mergeValue = $submittedCustomFields = [];
+              if ($value == 'null') {
+                // CRM-19074 if someone has deliberately chosen to overwrite with 'null', respect it.
+                $submitted[$key] = $value;
+              }
+              else {
+                if ($value) {
+                  $submittedCustomFields = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+                }
+
+                // CRM-19653: overwrite or add the existing custom field value with dupicate contact's
+                // custom field value stored at $submittedCustomValue.
+                foreach ($submittedCustomFields as $k => $v) {
+                  if ($v != '' && !in_array($v, $mergeValue)) {
+                    $mergeValue[] = $v;
+                  }
+                }
+
+                //keep state and country as array format.
+                //for checkbox and m-select format w/ VALUE_SEPARATOR
+                if (in_array($htmlType, [
+                  'CheckBox',
+                  'Multi-Select',
+                ])) {
+                  $submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
+                      $mergeValue
+                    ) . CRM_Core_DAO::VALUE_SEPARATOR;
+                }
+                else {
+                  $submitted[$key] = $mergeValue;
+                }
+              }
+            }
+          }
+          elseif (in_array($htmlType, [
+            'Multi-Select Country',
+            'Multi-Select State/Province',
+          ])) {
+            //we require submitted values should be in array format
+            if ($value) {
+              $mergeValueArray = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+              //hack to remove null values from array.
+              $mergeValue = [];
+              foreach ($mergeValueArray as $k => $v) {
+                if ($v != '') {
+                  $mergeValue[] = $v;
+                }
+              }
+              $submitted[$key] = $mergeValue;
+            }
+          }
+          break;
+
+        default:
+          break;
+      }
+    }
+    return [$cFields, $customFiles, $submitted];
+  }
+
+  /**
+   * Get metadata for the custom fields for the merge.
+   *
+   * @param string $contactType
+   *
+   * @return array
+   */
+  protected static function getCustomFieldMetadata($contactType) {
+    $treeCache = [];
+    if (!array_key_exists($contactType, $treeCache)) {
+      $treeCache[$contactType] = CRM_Core_BAO_CustomGroup::getTree(
+        $contactType,
+        NULL,
+        NULL,
+        -1,
+        [],
+        NULL,
+        TRUE,
+        NULL,
+        FALSE,
+        FALSE
+      );
+    }
+
+    $cFields = [];
+    foreach ($treeCache[$contactType] as $key => $group) {
+      if (!isset($group['fields'])) {
+        continue;
+      }
+      foreach ($group['fields'] as $fid => $field) {
+        $cFields[$fid]['attributes'] = $field;
+      }
+    }
+    return $cFields;
+  }
+
+  /**
+   * Get conflicts for proposed merge pair.
+   *
+   * @param array $migrationInfo
+   *   This is primarily to inform hooks. The can also modify it which feels
+   *   pretty fragile to do it here - but it is historical.
+   * @param int $mainId
+   *   Main contact with whom merge has to happen.
+   * @param int $otherId
+   *   Duplicate contact which would be deleted after merge operation.
+   * @param string $mode
+   *   Helps decide how to behave when there are conflicts.
+   *   -  A 'safe' value skips the merge if there are any un-resolved conflicts.
+   *   -  Does a force merge otherwise (aggressive mode).
+   *
+   * @return array
+   */
+  public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) {
+    $conflicts = [];
+    $originalMigrationInfo = $migrationInfo;
+    foreach ($migrationInfo as $key => $val) {
+      if ($val === "null") {
+        // Rule: Never overwrite with an empty value (in any mode)
+        unset($migrationInfo[$key]);
+        continue;
+      }
+      elseif ((in_array(substr($key, 5), CRM_Dedupe_Merger::getContactFields()) or
+          substr($key, 0, 12) == 'move_custom_'
+        ) and $val != NULL
+      ) {
+        // Rule: If both main-contact, and other-contact have a field with a
+        // different value, then let $mode decide if to merge it or not
+        if (
+          (!empty($migrationInfo['rows'][$key]['main'])
+            // For custom fields a 0 (e.g in an int field) could be a true conflict. This
+            // is probably true for other fields too - e.g. 'do_not_email' but
+            // leaving that investigation as a @todo - until tests can be written.
+            // Note the handling of this has test coverage - although the data-typing
+            // of '0' feels flakey we have insurance.
+            || ($migrationInfo['rows'][$key]['main'] === '0' && substr($key, 0, 12) == 'move_custom_')
+          )
+          && $migrationInfo['rows'][$key]['main'] != $migrationInfo['rows'][$key]['other']
+        ) {
+
+          // note it down & lets wait for response from the hook.
+          // For no response $mode will decide if to skip this merge
+          $conflicts[$key] = NULL;
+        }
+      }
+      elseif (substr($key, 0, 14) == 'move_location_' and $val != NULL) {
+        $locField = explode('_', $key);
+        $fieldName = $locField[2];
+        $fieldCount = $locField[3];
+
+        // Rule: Catch address conflicts (same address type on both contacts)
+        if (
+          isset($migrationInfo['main_details']['location_blocks'][$fieldName]) &&
+          !empty($migrationInfo['main_details']['location_blocks'][$fieldName])
+        ) {
+
+          // Load the address we're inspecting from the 'other' contact
+          $addressRecord = $migrationInfo['other_details']['location_blocks'][$fieldName][$fieldCount];
+          $addressRecordLocTypeId = CRM_Utils_Array::value('location_type_id', $addressRecord);
+
+          // If it exists on the 'main' contact already, skip it. Otherwise
+          // if the location type exists already, log a conflict.
+          foreach ($migrationInfo['main_details']['location_blocks'][$fieldName] as $mainAddressKey => $mainAddressRecord) {
+            if (self::locationIsSame($addressRecord, $mainAddressRecord)) {
+              unset($migrationInfo[$key]);
+              break;
+            }
+            elseif ($addressRecordLocTypeId == $mainAddressRecord['location_type_id']) {
+              $conflicts[$key] = NULL;
+              break;
+            }
+          }
+        }
+
+        // For other locations, don't merge/add if the values are the same
+        elseif (CRM_Utils_Array::value('main', $migrationInfo['rows'][$key]) == $migrationInfo['rows'][$key]['other']) {
+          unset($migrationInfo[$key]);
+        }
+      }
+    }
+
+    // A hook to implement other algorithms for choosing which contact to bias to when
+    // there's a conflict (to handle "gotchas"). fields_in_conflict could be modified here
+    // merge happens with new values filled in here. For a particular field / row not to be merged
+    // field should be unset from fields_in_conflict.
+    $migrationData = [
+      'old_migration_info' => $originalMigrationInfo,
+      'mode' => $mode,
+      'fields_in_conflict' => $conflicts,
+      'merge_mode' => $mode,
+      'migration_info' => $migrationInfo,
+    ];
+    CRM_Utils_Hook::merge('batch', $migrationData, $mainId, $otherId);
+    $conflicts = $migrationData['fields_in_conflict'];
+    // allow hook to override / manipulate migrationInfo as well
+    $migrationInfo = $migrationData['migration_info'];
+    $migrationInfo['skip_merge'] = CRM_Utils_Array::value('skip_merge', $migrationData);
+    return $conflicts;
+  }
+
+  /**
+   * Do file custom fields related migrations.
+   * FIXME: move this someplace else (one of the BAOs) after discussing
+   * where to, and whether CRM_Core_BAO_File::deleteFileReferences() shouldn't actually,
+   * like, delete a file...
+   *
+   * Note outstanding bug https://lab.civicrm.org/dev/core/issues/723
+   * relates to this code....
+   *
+   * @param $mainId
+   * @param $otherId
+   * @param $customFiles
+   */
+  protected static function processCustomFieldFiles($mainId, $otherId, $customFiles) {
+    foreach ($customFiles as $customId) {
+      list($tableName, $columnName, $groupID) = CRM_Core_BAO_CustomField::getTableColumnGroup($customId);
+
+      // get the contact_id -> file_id mapping
+      $fileIds = [];
+      $sql = "SELECT entity_id, {$columnName} AS file_id FROM {$tableName} WHERE entity_id IN ({$mainId}, {$otherId})";
+      $dao = CRM_Core_DAO::executeQuery($sql);
+      while ($dao->fetch()) {
+        // @todo - this is actually broken - fix & or remove - see testMergeCustomFields
+        $fileIds[$dao->entity_id] = $dao->file_id;
+        if ($dao->entity_id == $mainId) {
+          CRM_Core_BAO_File::deleteFileReferences($fileIds[$mainId], $mainId, $customId);
+        }
+      }
+
+      // move the other contact's file to main contact
+      //NYSS need to INSERT or UPDATE depending on whether main contact has an existing record
+      if (CRM_Core_DAO::singleValueQuery("SELECT id FROM {$tableName} WHERE entity_id = {$mainId}")) {
+        $sql = "UPDATE {$tableName} SET {$columnName} = {$fileIds[$otherId]} WHERE entity_id = {$mainId}";
+      }
+      else {
+        $sql = "INSERT INTO {$tableName} ( entity_id, {$columnName} ) VALUES ( {$mainId}, {$fileIds[$otherId]} )";
+      }
+      CRM_Core_DAO::executeQuery($sql);
+
+      if (CRM_Core_DAO::singleValueQuery("
+        SELECT id
+        FROM civicrm_entity_file
+        WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}")
+      ) {
+        $sql = "
+          UPDATE civicrm_entity_file
+          SET entity_id = {$mainId}
+          WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}";
+      }
+      else {
+        $sql = "
+          INSERT INTO civicrm_entity_file ( entity_table, entity_id, file_id )
+          VALUES ( '{$tableName}', {$mainId}, {$fileIds[$otherId]} )";
+      }
+      CRM_Core_DAO::executeQuery($sql);
     }
   }
 
index 518bc9bd0bb325e78c6398865ef82a0e251f563f..2729d09693898b09922341e1d215caf6ec347bc4 100644 (file)
@@ -330,6 +330,8 @@ WHERE  ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )";
    *
    * @return array
    *   Array of event summary values
+   *
+   * @throws \CiviCRM_API3_Exception
    */
   public static function getEventSummary() {
     $eventSummary = $eventIds = [];
@@ -338,7 +340,7 @@ WHERE  ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )";
     // get permission and include them here
     // does not scale, but rearranging code for now
     // FIXME in a future release
-    $permissions = CRM_Event_BAO_Event::checkPermission();
+    $permissions = self::getAllPermissions();
     $validEventIDs = '';
     if (empty($permissions[CRM_Core_Permission::VIEW])) {
       $eventSummary['total_events'] = 0;
@@ -986,7 +988,6 @@ WHERE civicrm_event.is_active = 1
       ['entity_value' => $id, 'mapping_id' => $oldMapping->getId()],
       ['entity_value' => $copyEvent->id, 'mapping_id' => $copyMapping->getId()]
     );
-    self::copyCustomFields($id, $copyEvent->id);
 
     $copyEvent->save();
 
@@ -996,57 +997,6 @@ WHERE civicrm_event.is_active = 1
     return $copyEvent;
   }
 
-  /**
-   * Method that copies custom fields values from an old event to a new one. Fixes bug CRM-19302,
-   * where if a custom field of File type was present, left both events using the same file,
-   * breaking download URL's for the old event.
-   *
-   * @param int $oldEventID
-   * @param int $newCopyID
-   */
-  public static function copyCustomFields($oldEventID, $newCopyID) {
-    // Obtain custom values for old event
-    $customParams = $htmlType = [];
-    $customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($oldEventID, 'Event');
-
-    // If custom values present, we copy them
-    if (!empty($customValues)) {
-      // Get Field ID's and identify File type attributes, to handle file copying.
-      $fieldIds = implode(', ', array_keys($customValues));
-      $sql = "SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( {$fieldIds} )";
-      $result = CRM_Core_DAO::executeQuery($sql);
-
-      // Build array of File type fields
-      while ($result->fetch()) {
-        $htmlType[] = $result->id;
-      }
-
-      // Build params array of custom values
-      foreach ($customValues as $field => $value) {
-        if ($value !== NULL) {
-          // Handle File type attributes
-          if (in_array($field, $htmlType)) {
-            $fileValues = CRM_Core_BAO_File::path($value, $oldEventID);
-            $customParams["custom_{$field}_-1"] = [
-              'name' => CRM_Utils_File::duplicate($fileValues[0]),
-              'type' => $fileValues[1],
-            ];
-          }
-          // Handle other types
-          else {
-            $customParams["custom_{$field}_-1"] = $value;
-          }
-        }
-      }
-
-      // Save Custom Fields for new Event
-      CRM_Core_BAO_CustomValueTable::postProcess($customParams, 'civicrm_event', $newCopyID, 'Event');
-    }
-
-    // copy activity attachments ( if any )
-    CRM_Core_BAO_File::copyEntityFile('civicrm_event', $oldEventID, 'civicrm_event', $newCopyID);
-  }
-
   /**
    * This is sometimes called in a loop (during event search).
    *
index 893b1ba406dd3ccf4378b1508911d20d5174ff79..92684931dcd1a0a36fd857ffa7b443c3da2e5581 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Cart/Cart.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:480e2fc6225765f7ff4930376c1ed70f)
+ * (GenCodeChecksum:71454cbda07a2fefd75041815b95ed0c)
  */
 
 /**
@@ -31,19 +31,19 @@ class CRM_Event_Cart_DAO_Cart extends CRM_Core_DAO {
   /**
    * Cart Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_contact who created this cart
    *
-   * @var int unsigned
+   * @var int
    */
   public $user_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $completed;
 
index 41654c3d24f5b6b2e0bc165f5f9507a79a124843..c0147b76dc74dbab39b62543224eb02ff8d3ca0b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Cart/EventInCart.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0f1e8db14667dfe6351ce2610d4431bd)
+ * (GenCodeChecksum:b9da5d3acb0b71b79cc3f8d2f7e5ec50)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Event_Cart_DAO_EventInCart extends CRM_Core_DAO {
   /**
    * Event In Cart Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Event ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_id;
 
   /**
    * FK to Event Cart ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_cart_id;
 
index a78d34f0263c3f8f0d8258fb0b8c7840b637793b..45767901189b3f8324c87fd0748b1311160f6861 100644 (file)
@@ -151,6 +151,11 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_
         }
       }
 
+      // Validate if participant is already registered
+      if ($event_in_cart->event->allow_same_participant_emails) {
+        continue;
+      }
+
       foreach ($event_in_cart->participants as $mer_participant) {
         $participant_fields = $fields['event'][$event_in_cart->event_id]['participant'][$mer_participant->id];
         //TODO what to do when profile responses differ for the same contact?
index d6906fd94ce61da937f21bf09938857bb08b26d8..143096e3525826f0ec24af0a33f7bcf5b880c73a 100644 (file)
@@ -175,6 +175,10 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
       );
       $this->assign('pay_later_instructions', $this->pay_later_receipt);
     }
+
+    // Event Cart does not support multiple payment processors
+    // so we cannot call $this->preProcessPaymentOptions();
+    CRM_Financial_Form_Payment::addCreditCardJs($this->_paymentProcessor['id']);
   }
 
   /**
@@ -351,7 +355,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
     $send_template_params = [
       'table' => 'civicrm_msg_template',
       'contactId' => $this->payer_contact_id,
-      'from' => CRM_Core_BAO_Domain::getNameAndEmail(TRUE, TRUE),
+      'from' => current(CRM_Core_BAO_Domain::getNameAndEmail(TRUE, TRUE)),
       'groupName' => 'msg_tpl_workflow_event',
       'isTest' => FALSE,
       'toEmail' => $contact_details[1],
@@ -502,6 +506,8 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
         $ctype,
         TRUE
       );
+
+      $params['contact_id'] = $this->payer_contact_id;
     }
 
     $params['now'] = date('YmdHis');
index f5f563ec182619b6871b54c65ffafc4df3c5c732..e5471649f0ab70f03e9a9a3a120b0ae76a4a222b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Event.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:950e07f412225a94ad11a8220a8f2f19)
+ * (GenCodeChecksum:887208d4102061a0f26eda2a6f84ea09)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * Event
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,21 +59,21 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * Event Type ID.Implicit FK to civicrm_option_value where option_group = event_type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_type_id;
 
   /**
    * Should we expose the participant list? Implicit FK to civicrm_option_value where option_group = participant_listing.
    *
-   * @var int unsigned
+   * @var int
    */
   public $participant_listing_id;
 
   /**
    * Public events will be included in the iCal feeds. Access to private event information may be limited using ACLs.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_public;
 
@@ -94,7 +94,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * If true, include registration link on Event Info page.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_online_registration;
 
@@ -122,7 +122,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * Maximum number of registered participants to allow. After max is reached, a custom Event Full message is displayed. If NULL, allow unlimited number of participants.
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_participants;
 
@@ -136,14 +136,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * If true, one or more fee amounts must be set and a Payment Processor must be configured for Online Event Registration.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_monetary;
 
   /**
    * Financial type assigned to paid event registrations for this event. Required if is_monetary is true.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -157,14 +157,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * Include a map block on the Event Information page when geocode info is available and a mapping provider has been specified?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_map;
 
   /**
    * Is this Event enabled or disabled/cancelled?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -176,21 +176,21 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * If true, show event location.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_show_location;
 
   /**
    * FK to Location Block ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $loc_block_id;
 
   /**
    * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
    *
-   * @var int unsigned
+   * @var int
    */
   public $default_role_id;
 
@@ -232,7 +232,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * If true, confirmation is automatically emailed to contact on successful registration.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_email_confirm;
 
@@ -274,14 +274,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * FK to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $default_fee_id;
 
   /**
    * FK to civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $default_discount_fee_id;
 
@@ -309,7 +309,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * if true - allows the user to send payment directly to the org later
    *
-   * @var boolean
+   * @var bool
    */
   public $is_pay_later;
 
@@ -330,7 +330,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * is partial payment enabled for this event
    *
-   * @var boolean
+   * @var bool
    */
   public $is_partial_payment;
 
@@ -358,56 +358,56 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * if true - allows the user to register multiple participants for event
    *
-   * @var boolean
+   * @var bool
    */
   public $is_multiple_registrations;
 
   /**
    * Maximum number of additional participants that can be registered on a single booking
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_additional_participants;
 
   /**
    * if true - allows the user to register multiple registrations from same email address.
    *
-   * @var boolean
+   * @var bool
    */
   public $allow_same_participant_emails;
 
   /**
    * Whether the event has waitlist support.
    *
-   * @var boolean
+   * @var bool
    */
   public $has_waitlist;
 
   /**
    * Whether participants require approval before they can finish registering.
    *
-   * @var boolean
+   * @var bool
    */
   public $requires_approval;
 
   /**
    * Expire pending but unconfirmed registrations after this many hours.
    *
-   * @var int unsigned
+   * @var int
    */
   public $expiration_time;
 
   /**
    * Allow self service cancellation or transfer for event?
    *
-   * @var boolean
+   * @var bool
    */
   public $allow_selfcancelxfer;
 
   /**
    * Number of hours prior to event start date to allow self-service cancellation or transfer.
    *
-   * @var int unsigned
+   * @var int
    */
   public $selfcancelxfer_time;
 
@@ -428,7 +428,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * whether the event has template
    *
-   * @var boolean
+   * @var bool
    */
   public $is_template;
 
@@ -442,7 +442,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * FK to civicrm_contact, who created this event
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -463,49 +463,49 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
   /**
    * The campaign for which this event has been created.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Can people share the event through social media?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_share;
 
   /**
    * If false, the event booking confirmation screen gets skipped
    *
-   * @var boolean
+   * @var bool
    */
   public $is_confirm_enabled;
 
   /**
    * Implicit FK to civicrm_event: parent event
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_event_id;
 
   /**
    * Subevent slot label. Implicit FK to civicrm_option_value where option_group = conference_slot.
    *
-   * @var int unsigned
+   * @var int
    */
   public $slot_label_id;
 
   /**
    * Rule to use when matching registrations for this event
    *
-   * @var int unsigned
+   * @var int
    */
   public $dedupe_rule_group_id;
 
   /**
    * if true than billing block is required this event
    *
-   * @var boolean
+   * @var bool
    */
   public $is_billing_required;
 
@@ -623,7 +623,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'event_type',
             'optionEditPath' => 'civicrm/admin/options/event_type',
-          ]
+          ],
         ],
         'participant_listing_id' => [
           'name' => 'participant_listing_id',
@@ -642,7 +642,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'participant_listing',
             'optionEditPath' => 'civicrm/admin/options/participant_listing',
-          ]
+          ],
         ],
         'is_public' => [
           'name' => 'is_public',
@@ -820,7 +820,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'payment_processor' => [
           'name' => 'payment_processor',
@@ -841,7 +841,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
             'table' => 'civicrm_payment_processor',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'is_map' => [
           'name' => 'is_map',
@@ -937,7 +937,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'participant_role',
             'optionEditPath' => 'civicrm/admin/options/participant_role',
-          ]
+          ],
         ],
         'intro_text' => [
           'name' => 'intro_text',
@@ -1281,7 +1281,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
           'description' => ts('Minimum initial amount for partial payment'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_event.min_initial_amount',
           'table_name' => 'civicrm_event',
@@ -1520,7 +1520,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'campaign_id' => [
           'name' => 'campaign_id',
@@ -1540,7 +1540,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'is_share' => [
           'name' => 'is_share',
@@ -1622,7 +1622,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
             'keyColumn' => 'id',
             'labelColumn' => 'title',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'is_billing_required' => [
           'name' => 'is_billing_required',
index fc7aaccb3840f4590232b2e6c0c5efe5d43a9b2b..cba5311348d0fe7fdf9d13759b2a898bf785727a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Participant.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:07eafc5db4afa9fe7ca200110727d42f)
+ * (GenCodeChecksum:2c9fa9a933df6d5c4ec745b8031f9297)
  */
 
 /**
@@ -31,28 +31,28 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
   /**
    * Participant Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to Event ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_id;
 
   /**
    * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -79,19 +79,19 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
 
   /**
    * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
-   we store the label value and not the key
+   we store the label value and not the key
    *
    * @var text
    */
   public $fee_level;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_pay_later;
 
@@ -105,14 +105,14 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
   /**
    * FK to Participant ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $registered_by_id;
 
   /**
    * FK to Discount ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $discount_id;
 
@@ -126,21 +126,21 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
   /**
    * The campaign for which this participant has been registered.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Discount Amount
    *
-   * @var int unsigned
+   * @var int
    */
   public $discount_amount;
 
   /**
    * FK to civicrm_event_carts
    *
-   * @var int unsigned
+   * @var int
    */
   public $cart_id;
 
@@ -154,7 +154,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $transferred_to_contact_id;
 
@@ -266,7 +266,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
             'table' => 'civicrm_participant_status_type',
             'keyColumn' => 'id',
             'labelColumn' => 'label',
-          ]
+          ],
         ],
         'participant_role_id' => [
           'name' => 'role_id',
@@ -291,7 +291,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'participant_role',
             'optionEditPath' => 'civicrm/admin/options/participant_role',
-          ]
+          ],
         ],
         'participant_register_date' => [
           'name' => 'register_date',
@@ -335,8 +335,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_TEXT,
           'title' => ts('Fee level'),
           'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
-      we store the label value and not the key
-    '),
+      we store the label value and not the key'),
           'import' => TRUE,
           'where' => 'civicrm_participant.fee_level',
           'headerPattern' => '/^(f(ee\s)?level)$/i',
@@ -381,7 +380,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
           'description' => ts('actual processor fee if known - may be 0.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_participant.fee_amount',
@@ -446,7 +445,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'participant_campaign_id' => [
           'name' => 'campaign_id',
@@ -465,7 +464,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'discount_amount' => [
           'name' => 'discount_amount',
index 39843364b0cba9fc3cf371aa96847c99cc57bfbb..d9b126bb5cd37cf559cd1c446ddc83c0157bb566 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/ParticipantPayment.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:33976e80c23c2f9eeaa844c812004b42)
+ * (GenCodeChecksum:26f5438e86ca3500888b49650bc6d9e8)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Event_DAO_ParticipantPayment extends CRM_Core_DAO {
   /**
    * Participant Payment Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Participant Id (FK)
    *
-   * @var int unsigned
+   * @var int
    */
   public $participant_id;
 
   /**
    * FK to contribution table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
index e04f88ced3fb06d1f1b2ecdfa85c8bf04cd79d01..7a09e16739e1eede3c5d72638fd242d2400ad718 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/ParticipantStatusType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8279655ecdaf4a9ca6a0a3a76e945644)
+ * (GenCodeChecksum:a42abc9dbf891aa6cbb6513ca18067b9)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO {
   /**
    * unique participant status type id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,35 +59,35 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO {
   /**
    * whether this is a status type required by the system
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * whether this status type is active
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * whether this status type is counted against event size limit
    *
-   * @var boolean
+   * @var bool
    */
   public $is_counted;
 
   /**
    * controls sort order
    *
-   * @var int unsigned
+   * @var int
    */
   public $weight;
 
   /**
    * whether the status type is visible to the public, an implicit foreign key to option_value.value related to the `visibility` option_group
    *
-   * @var int unsigned
+   * @var int
    */
   public $visibility_id;
 
@@ -164,7 +164,7 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Event_PseudoConstant::participantStatusClassOptions',
-          ]
+          ],
         ],
         'is_reserved' => [
           'name' => 'is_reserved',
@@ -228,7 +228,7 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'visibility',
             'optionEditPath' => 'civicrm/admin/options/visibility',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index cd013d81cc3aa8b76b8a38ee31ffe7d9608f6a72..9e065f4cc16612d808b96c1912248e58feae6fd9 100644 (file)
@@ -45,14 +45,14 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
   /**
    * Is this the first page?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_first = FALSE;
 
   /**
    * Are we in single form mode or wizard mode?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single;
 
@@ -60,13 +60,14 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
 
   /**
    * Are we actually managing an event template?
-   * @var boolean
+   * @var bool
    */
   protected $_isTemplate = FALSE;
 
   /**
-   * Pre-populate fields based on this template event_id
-   * @var integer
+   * Pre-populate fields based on this template event_id.
+   *
+   * @var int
    */
   protected $_templateId;
 
index 3a02919e228bd67f8a84a0e82dbda266f13686ba..ddc1c2da065fec87d9e8aa72b922785207cd76bc 100644 (file)
@@ -374,7 +374,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
     $this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'),
       ['class' => 'crm-form-submit cancel']
     );
-    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+    if (Civi::settings()->get('deferred_revenue_enabled')) {
       $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
       $this->assign('deferredFinancialType', array_keys($deferredFinancialType));
     }
index 0b0b31e0dcf2ff42c5874882f8d7ae53d5253b41..d0426e4caa2404a37390ad39b5accca79c634251 100644 (file)
@@ -52,7 +52,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
   /**
    * The values for the quickconfig for priceset.
    *
-   * @var boolean
+   * @var bool
    */
   public $_quickConfig = NULL;
 
@@ -106,7 +106,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
    * Are we operating in "single mode", i.e. adding / editing only
    * one participant record, or is this a batch add operation
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
@@ -1002,7 +1002,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
       $contributionParams = ['skipCleanMoney' => TRUE];
       $lineItem = [];
       $additionalParticipantDetails = [];
-      if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+      if (Civi::settings()->get('deferred_revenue_enabled')) {
         $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
         if (strtotime($eventStartDate) > strtotime(date('Ymt'))) {
           $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
index 2e60b956e41a84821cff7ecb83aa2a3c738d4abe..af19e4423678c7e15eeed927f4c16284670f9115 100644 (file)
@@ -67,21 +67,21 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
   /**
    * Is participant able to walk registration wizard.
    *
-   * @var Boolean
+   * @var bool
    */
   public $_allowConfirmation;
 
   /**
    * Is participant requires approval.
    *
-   * @var Boolean
+   * @var bool
    */
   public $_requireApproval;
 
   /**
    * Is event configured for waitlist.
    *
-   * @var Boolean
+   * @var bool
    */
   public $_allowWaitlist;
 
@@ -157,7 +157,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
   /**
    * Is event already full.
    *
-   * @var boolean
+   * @var bool
    *
    */
 
index bc800a62a5d4f61c6389efbfae848c577f0376a4..8bebdb1e6ab47a7e09538c6543aa4c8cc3845872 100644 (file)
@@ -1052,7 +1052,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       );
     }
 
-    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+    if (Civi::settings()->get('deferred_revenue_enabled')) {
       $eventStartDate = CRM_Utils_Array::value(
         'start_date',
         CRM_Utils_Array::value(
index fd5a218f3e8eb809bf1d405c101384859c0c8e90..080ecb98c4d561fde3adbe2e77b36937f5a4963b 100644 (file)
@@ -69,12 +69,14 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
   /**
    * Show fee block or not.
    *
-   * @var boolean determines if fee block should be shown or hidden
+   * @var bool
    */
   public $_noFees;
 
   /**
-   * @var array Fee Block
+   * Fee Block.
+   *
+   * @var array
    */
   public $_feeBlock;
 
index 71e58e1f3fac64417391f98055ade153d66fc8e1..3f7af061181c85fe778bce53d5a03f3d32b20337 100644 (file)
@@ -50,14 +50,14 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
@@ -170,7 +170,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
           $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
         }
         if (!empty($this->_formValues['participant_status_id'])) {
-          $seatClause[] = CRM_Contact_BAO_Query::buildClause("participant.status_id", '=', $this->_formValues['participant_status_id'], 'Int');
+          $seatClause[] = CRM_Contact_BAO_Query::buildClause("participant.status_id", 'IN', $this->_formValues['participant_status_id'], 'Int');
           if ($status = CRM_Utils_Array::value('IN', $this->_formValues['participant_status_id'])) {
             $this->_formValues['participant_status_id'] = $status;
           }
@@ -389,7 +389,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, ['participant_status_id']);
     }
 
-    if (empty($this->_formValues)) {
+    if (empty($formValues)) {
       $formValues = $this->controller->exportValues($this->_name);
     }
 
index de7e8090fc232f0f7756429601998af3a5a1dc8d..f8aafbddb54fe7db7f0da7edf5a4af9f6de10b07 100644 (file)
@@ -283,7 +283,6 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form {
    * return @void
    */
   public function transferParticipant($params) {
-    $isBackOfficeArg = $this->isBackoffice ? '&is_backoffice=1' : '';
     CRM_Utils_System::redirect(CRM_Utils_System::url(
       'civicrm/event/selfsvctransfer',
       [
@@ -291,6 +290,7 @@ class CRM_Event_Form_SelfSvcUpdate extends CRM_Core_Form {
         'action' => 'add',
         'pid' => $this->_participant_id,
         'cs' => $this->_userChecksum,
+        'is_backoffice' => $this->isBackoffice,
       ]
     ));
   }
index 3f7d87586d5ecf63c630d3ea9b5ad96a9ab0ec16..6d21b4d8f62424b91cecb3eae587d93aca1e3a46 100644 (file)
@@ -40,7 +40,7 @@ class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index ad9acdbddb7030c4b718fb1c997ec0e09203fe6c..a784355f5fdb56fe233f7e59cec3bc5dad85f2d4 100644 (file)
@@ -44,7 +44,7 @@ class CRM_Event_Form_Task_Delete extends CRM_Event_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific participation?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index a9f5ccb6c62e20c10f66641de54493dfe6d0d54b..406a3a74ba05e081b83cff2f1dd12ed4fab4aaac 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Event_Form_Task_Email extends CRM_Event_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
@@ -50,7 +50,7 @@ class CRM_Event_Form_Task_Email extends CRM_Event_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_noEmails = FALSE;
 
index a16837041e8064a45e1f67c1c5e7baf0ee5d0986..2aa2028eaf64786196f56da1cd91ce4dee196492 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Event_Form_Task_PDF extends CRM_Event_Form_Task {
    * Are we operating in "single mode", i.e. printing letter to one
    * specific participant?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
index ba14c1bc2d7f206cd120eb0b4b8405674c66c3fb..434f279614108370358d9b181c2b35dcfefcd1ed 100644 (file)
@@ -37,24 +37,22 @@ abstract class CRM_Event_Import_Parser extends CRM_Import_Parser {
   protected $_fileName;
 
   /**
-   * #@+
-   * @var integer
-   */
-
-  /**
-   * Imported file size
+   * Imported file size.
+   *
    * @var int
    */
   protected $_fileSize;
 
   /**
-   * Seperator being used
+   * Separator being used.
+   *
    * @var string
    */
   protected $_seperator;
 
   /**
-   * Total number of lines in file
+   * Total number of lines in file.
+   *
    * @var int
    */
   protected $_lineCount;
@@ -62,7 +60,7 @@ abstract class CRM_Event_Import_Parser extends CRM_Import_Parser {
   /**
    * Whether the file has a column header or not
    *
-   * @var boolean
+   * @var bool
    */
   protected $_haveColumnHeader;
 
index afc523e0347e41242ce1d240ae740f5f52f7a6f5..c2b0a3a55025969a6986d758409adeeb29fb4c4c 100644 (file)
@@ -314,7 +314,10 @@ class CRM_Event_Page_ManageEvent extends CRM_Core_Page {
     $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
 
     $whereClause = $this->whereClause($params, FALSE, $this->_force);
-    $this->pagerAToZ($whereClause, $params);
+
+    if (CRM_Core_Config::singleton()->includeAlphabeticalPager) {
+      $this->pagerAToZ($whereClause, $params);
+    }
 
     $params = [];
     $whereClause = $this->whereClause($params, TRUE, $this->_force);
@@ -517,7 +520,8 @@ ORDER BY start_date desc
       if (is_array($value)) {
         $type = implode(',', $value);
       }
-      $clauses[] = "event_type_id IN ({$type})";
+      $clauses[] = "event_type_id IN (%2)";
+      $params[2] = [$type, 'String'];
     }
 
     $eventsByDates = $this->get('eventsByDates');
index fb79e008db8ede43dde4c4b0d8e13580a68a0e72..b484e7dd06c4af8ed151ac127d88c967ca8c24bc 100644 (file)
@@ -85,14 +85,14 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 778ac58c90b9ed36a247e07bd0a55333e2f4f285..eb1e98a5c8d265856185f71de36c0332715eb238 100644 (file)
@@ -652,7 +652,7 @@ VALUES $sqlValueString
    */
   public static function createTempTable($sqlColumns) {
     //creating a temporary table for the search result that need be exported
-    $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export')->setUtf8();
+    $exportTempTable = CRM_Utils_SQL_TempTable::build()->setDurable()->setCategory('export');
 
     // also create the sql table
     $exportTempTable->drop();
index 1f465383698b40328301cd6d96842fd677a5b5dc..b352f9bb84e092c4d5805e5f35acd695ffeb26dd 100644 (file)
@@ -52,7 +52,7 @@ abstract class CRM_Financial_BAO_ExportFormat {
 
   /**
    * Download Exported file.
-   * @var boolean
+   * @var bool
    */
   public $_isDownloadFile;
 
index 8ff0ef4b9b0d02655adc6559456a87de76a2836a..71c61539489958e6cc78725bccec83378b68c4b5 100644 (file)
@@ -286,7 +286,6 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
               'currency' => $this->format($itemDAO->currency),
             ];
           } // end items loop
-          $itemDAO->free();
         }
         else {
           // In this case, split record just uses the FROM account from the trxn, and there's only one record here
index 02ff4d9de89dd0440b1c3d3afafa92712ea66a26..c8f33573705bddb7a493a7e4964308ccf38ddc01 100644 (file)
@@ -379,7 +379,7 @@ LIMIT 1";
    *
    */
   public static function checkFinancialTypeHasDeferred($params, $contributionID = NULL, $priceSetFields = NULL) {
-    if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+    if (!Civi::settings()->get('deferred_revenue_enabled')) {
       return FALSE;
     }
     $recognitionDate = CRM_Utils_Array::value('revenue_recognition_date', $params);
index fbb3e58de800cf03a6b1db3909c4f987f54b722f..664c193e0cc4f8d7d8533f540730384015f15dad 100644 (file)
@@ -51,6 +51,7 @@ class CRM_Financial_BAO_Payment {
    *
    * @throws \API_Exception
    * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
   public static function create($params) {
     $contribution = civicrm_api3('Contribution', 'getsingle', ['id' => $params['contribution_id']]);
@@ -63,7 +64,7 @@ class CRM_Financial_BAO_Payment {
     // should be handled through Payment.create.
     $isSkipRecordingPaymentHereForLegacyHandlingReasons = ($contributionStatus == 'Pending' && $isPaymentCompletesContribution);
 
-    if (!$isSkipRecordingPaymentHereForLegacyHandlingReasons) {
+    if (!$isSkipRecordingPaymentHereForLegacyHandlingReasons && $params['total_amount'] > 0) {
       $trxn = CRM_Contribute_BAO_Contribution::recordPartialPayment($contribution, $params);
 
       if (CRM_Utils_Array::value('line_item', $params) && !empty($trxn)) {
@@ -99,13 +100,29 @@ class CRM_Financial_BAO_Payment {
         CRM_Contribute_BAO_Contribution::assignProportionalLineItems($params, $trxn->id, $contribution['total_amount']);
       }
     }
+    elseif ($params['total_amount'] < 0) {
+      $trxn = self::recordRefundPayment($params['contribution_id'], $params, FALSE);
+    }
 
     if ($isPaymentCompletesContribution) {
-      civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]);
-      // Get the trxn
-      $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC');
-      $ftParams = ['id' => $trxnId['financialTrxnId']];
-      $trxn = CRM_Core_BAO_FinancialTrxn::retrieve($ftParams, CRM_Core_DAO::$_nullArray);
+      if ($contributionStatus == 'Pending refund') {
+        // Ideally we could still call completetransaction as non-payment related actions should
+        // be outside this class. However, for now we just update the contribution here.
+        // Unit test cover in CRM_Event_BAO_AdditionalPaymentTest::testTransactionInfo.
+        civicrm_api3('Contribution', 'create',
+          [
+            'id' => $contribution['id'],
+            'contribution_status_id' => 'Completed',
+          ]
+        );
+      }
+      else {
+        civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]);
+        // Get the trxn
+        $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC');
+        $ftParams = ['id' => $trxnId['financialTrxnId']];
+        $trxn = CRM_Core_BAO_FinancialTrxn::retrieve($ftParams, CRM_Core_DAO::$_nullArray);
+      }
     }
     elseif ($contributionStatus === 'Pending') {
       civicrm_api3('Contribution', 'create',
@@ -311,7 +328,7 @@ class CRM_Financial_BAO_Payment {
     $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contributionDAO->financial_type_id, 'Accounts Receivable Account is');
     $completedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
 
-    $trxnData['total_amount'] = $trxnData['net_amount'] = -$trxnData['total_amount'];
+    $trxnData['total_amount'] = $trxnData['net_amount'] = $trxnData['total_amount'];
     $trxnData['from_financial_account_id'] = $arAccountId;
     $trxnData['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Refunded');
     // record the entry
index f20e3c2037423860a14fdb6706665c09c1974a26..4192856b86815828ece131cd0d8e51417fad8896 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/Currency.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:19729d25ea5ad98f3fc2551acab9fa7a)
+ * (GenCodeChecksum:5490d115dbd495ebb39ce46a4149cbc2)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_Currency extends CRM_Core_DAO {
   /**
    * Currency Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index 529a8d68a48d712281fa64df1a75442e9e141a45..13b31ce00c27b144433929d02b85d594f6c5548e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f0a99b56fe094d649cc56eb930b4ae23)
+ * (GenCodeChecksum:3e195b6b8f9a99b338219723c2b509a7)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
   /**
    * ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,21 +45,21 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
   /**
    * Links to an id in the entity_table, such as vid in civicrm_financial_type
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to a new civicrm_option_value (account_relationship)
    *
-   * @var int unsigned
+   * @var int
    */
   public $account_relationship;
 
   /**
    * FK to the financial_account_id
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_account_id;
 
@@ -152,7 +152,7 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'account_relationship',
             'optionEditPath' => 'civicrm/admin/options/account_relationship',
-          ]
+          ],
         ],
         'financial_account_id' => [
           'name' => 'financial_account_id',
@@ -173,7 +173,7 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
             'table' => 'civicrm_financial_account',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index ba7d38c4711653ba9624ef93fd83ef9351395f12..5387669dafaccd14bbc7543a4e2768b2093b7b68 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b7687297d632a4658b6686a5b540f974)
+ * (GenCodeChecksum:14582d82c08fe5e2c4242e4bafc146d4)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
   /**
    * ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -43,12 +43,12 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
   public $entity_table;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $financial_trxn_id;
 
@@ -149,7 +149,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_entity_financial_trxn.amount',
index 99c784aa70e6adbdaf9a870755415e168f48448b..5f0f5f1dc4e37a4b89d283ead2ab2f7461ec1e21 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialAccount.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:99e6943d33c4b4081a8d74e611589dd7)
+ * (GenCodeChecksum:be1c13919aa1ff84b28ef61832132842)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
   /**
    * ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
   /**
    * FK to Contact ID that is responsible for the funds in this account
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * pseudo FK into civicrm_option_value.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_account_type_id;
 
@@ -80,28 +80,28 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
   /**
    * Parent ID in account hierarchy
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
   /**
    * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_header_account;
 
   /**
    * Is this account tax-deductible?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_deductible;
 
   /**
    * Is this account for taxes?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_tax;
 
@@ -115,21 +115,21 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
   /**
    * Is this a predefined system object?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this account the default one (or default tax one) for its financial_account_type?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
@@ -221,7 +221,7 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'financial_account_type',
             'optionEditPath' => 'civicrm/admin/options/financial_account_type',
-          ]
+          ],
         ],
         'accounting_code' => [
           'name' => 'accounting_code',
@@ -319,7 +319,7 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
           'description' => ts('The percentage of the total_amount that is due for this tax.'),
           'precision' => [
             10,
-            8
+            8,
           ],
           'where' => 'civicrm_financial_account.tax_rate',
           'table_name' => 'civicrm_financial_account',
index dcbc5b4d4f3146e77d788dd8c83c2099dee1079d..d3fdc69d1d76c76d7168b719ebed4fcd02e681c5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialItem.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8ebea76ed5ae2b3e7fe0ddafa55a4aed)
+ * (GenCodeChecksum:49a455dafedd73005f06e17dcc99c365)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -50,7 +50,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
   /**
    * FK to Contact ID of contact the item is from
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -78,14 +78,14 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
   /**
    * FK to civicrm_financial_account
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_account_id;
 
   /**
    * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -99,7 +99,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
   /**
    * The specific source item that is responsible for the creation of this financial_item
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -207,7 +207,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_financial_item.amount',
           'headerPattern' => '/unit?.?amoun/i',
@@ -239,7 +239,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'financial_account_id' => [
           'name' => 'financial_account_id',
@@ -259,7 +259,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
             'table' => 'civicrm_financial_account',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'status_id' => [
           'name' => 'status_id',
@@ -278,7 +278,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'financial_item_status',
             'optionEditPath' => 'civicrm/admin/options/financial_item_status',
-          ]
+          ],
         ],
         'entity_table' => [
           'name' => 'entity_table',
index 1d262b411dcb0f3f7cd2601115a53b6de7a177aa..fefd72cbdbafff08244eadd7742753531da9d059 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d30cfdb7f54eac46852246cf30654a97)
+ * (GenCodeChecksum:e130935b88e96b99dc58cb9003666e18)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to financial_account table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $from_financial_account_id;
 
   /**
    * FK to financial_financial_account table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $to_financial_account_id;
 
@@ -85,7 +85,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
   /**
    * Is this entry either a payment or a reversal of a payment?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_payment;
 
@@ -106,28 +106,28 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
   /**
    * pseudo FK to civicrm_option_value of contribution_status_id option_group
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
    * Payment Processor for this financial transaction
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_processor_id;
 
   /**
    * FK to payment_instrument option group values
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
   /**
    * FK to accept_creditcard option group values
    *
-   * @var int unsigned
+   * @var int
    */
   public $card_type_id;
 
@@ -207,7 +207,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
             'table' => 'civicrm_financial_account',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'to_financial_account_id' => [
           'name' => 'to_financial_account_id',
@@ -227,7 +227,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
             'table' => 'civicrm_financial_account',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'trxn_date' => [
           'name' => 'trxn_date',
@@ -253,7 +253,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_financial_trxn.total_amount',
           'table_name' => 'civicrm_financial_trxn',
@@ -268,7 +268,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'description' => ts('actual processor fee if known - may be 0.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_financial_trxn.fee_amount',
           'table_name' => 'civicrm_financial_trxn',
@@ -283,7 +283,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'description' => ts('actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_financial_trxn.net_amount',
           'table_name' => 'civicrm_financial_trxn',
@@ -316,7 +316,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'is_payment' => [
           'name' => 'is_payment',
@@ -377,7 +377,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'contribution_status',
             'optionEditPath' => 'civicrm/admin/options/contribution_status',
-          ]
+          ],
         ],
         'payment_processor_id' => [
           'name' => 'payment_processor_id',
@@ -407,7 +407,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
         'financial_trxn_card_type_id' => [
           'name' => 'card_type_id',
@@ -425,7 +425,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'accept_creditcard',
             'optionEditPath' => 'civicrm/admin/options/accept_creditcard',
-          ]
+          ],
         ],
         'financial_trxn_check_number' => [
           'name' => 'check_number',
index 90a916f0750d552eb299bf921e8e067e4c15e081..636069efbefbdd99649341ba430a17b6ba622076 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:760550280aaa0da48232ebdfb11170f9)
+ * (GenCodeChecksum:9395c8fe3d749ad60136065301a5c44f)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
   /**
    * ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -52,21 +52,21 @@ class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
   /**
    * Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_deductible;
 
   /**
    * Is this a predefined system object?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index f3aed47352471e49512c3ac1851242c0f1757fad..4a09521775afaf22c18c3a7d6909654a6c4a7953 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/PaymentProcessor.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:83f0467b531d70e84945e9c55a8824b6)
+ * (GenCodeChecksum:2d3189beedf083b35929eded03907d9f)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
   /**
    * Payment Processor ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this match entry for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -64,28 +64,28 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
   public $description;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $payment_processor_type_id;
 
   /**
    * Is this processor active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this processor the default?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Is this processor for a test site?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
@@ -137,28 +137,28 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
   /**
    * Billing Mode (deprecated)
    *
-   * @var int unsigned
+   * @var int
    */
   public $billing_mode;
 
   /**
    * Can process recurring contributions
    *
-   * @var boolean
+   * @var bool
    */
   public $is_recur;
 
   /**
    * Payment Type: Credit or Debit (deprecated)
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_type;
 
   /**
    * Payment Instrument ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
@@ -229,7 +229,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -290,7 +290,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
             'table' => 'civicrm_payment_processor_type',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
@@ -506,7 +506,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
         'accepted_credit_cards' => [
           'name' => 'accepted_credit_cards',
index 5bad18359df931a966bf2e0a2a70d34640b3173f..3c3a7bb227325a505499468b7cbe2a8ac35028d9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/PaymentProcessorType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b8290611e8abcbd771b1006fd34e3ec5)
+ * (GenCodeChecksum:f412f0beac8a6387450f8fe19279d0ce)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
   /**
    * Payment Processor Type ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -59,14 +59,14 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
   /**
    * Is this processor active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this processor the default?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
@@ -138,28 +138,28 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
   /**
    * Billing Mode (deprecated)
    *
-   * @var int unsigned
+   * @var int
    */
   public $billing_mode;
 
   /**
    * Can process recurring contributions
    *
-   * @var boolean
+   * @var bool
    */
   public $is_recur;
 
   /**
    * Payment Type: Credit or Debit (deprecated)
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_type;
 
   /**
    * Payment Instrument ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $payment_instrument_id;
 
@@ -424,7 +424,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::billingMode',
-          ]
+          ],
         ],
         'is_recur' => [
           'name' => 'is_recur',
@@ -463,7 +463,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'payment_instrument',
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 88206dd264f769e4330994e6e2665262cabe2fec..17aa223d2c316fbef5c8f1b6500f47770fe5b974 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/PaymentToken.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:13e09ccc4d4ae2dade53c251d4345ed2)
+ * (GenCodeChecksum:9ef72f3d1fba1b5b89841d36382c3eb6)
  */
 
 /**
@@ -31,19 +31,19 @@ class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
   /**
    * Payment Token ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID for the owner of the token
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $payment_processor_id;
 
@@ -64,7 +64,7 @@ class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
   /**
    * Contact ID of token creator
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
index 6b38724a81c4d3858e58a76e929b40af44c5747b..f304e7fcfa8d4c5c63739f7e960145032d26cc52 100644 (file)
@@ -39,7 +39,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
   /**
    * Flag if its a AR account type.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isARFlag = FALSE;
 
index e0940a738af171facfe00a9987dfe5de2701394f..3ac1bd169660a77a5bc4bdd9517774386ce2c467 100644 (file)
@@ -60,7 +60,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
   /**
    * Flag if its a AR account type.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isARFlag = FALSE;
 
index a559e5ec9274836888e488e040f2d5aac8449733..f51cc0f2e25f81ce44547708aac0bc73b1982ac4 100644 (file)
@@ -51,7 +51,7 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form {
   public $isBackOffice = FALSE;
 
   /**
-   * @var String
+   * @var string
    */
   public $_formName = '';
 
@@ -79,11 +79,6 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form {
 
     CRM_Core_Payment_ProcessorForm::preProcess($this);
 
-    self::addCreditCardJs($this->_paymentProcessorID);
-
-    $this->assign('paymentProcessorID', $this->_paymentProcessorID);
-    $this->assign('currency', $this->currency);
-
     $this->assign('suppressForm', TRUE);
     $this->controller->_generateQFKey = FALSE;
   }
index 2d568215f02d59410022a276cf85c2d3cf0af0ac..d072051971aa77b343960ac72a1452040d9bcc09 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Friend/Friend.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a0a82714195ed8bafcbb12ef6c829521)
+ * (GenCodeChecksum:a662628e986758095dcbfa2e56597acb)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
   /**
    * Friend ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -90,7 +90,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
   public $thankyou_text;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index 7e2f9d48fa05f88f41d1574300c1e45e5b7c190b..b76fcfd5118e728e677894735017b73ea92268de 100644 (file)
@@ -297,7 +297,7 @@ class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query {
   }
 
   /**
-   * Get the metadata for fields to be included on the activity search form.
+   * Get the metadata for fields to be included on the grant search form.
    */
   public static function getSearchFieldMetadata() {
     $fields = [
index ce4dfe0d4c8e6bf743877f2db5d94ea8a9fff74f..d889f2ad6f48ea67d0e2b0544944335f1905ff82 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Grant/Grant.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ea60d8cd875ca924d3cc34b4282c8a8a)
+ * (GenCodeChecksum:46934eeb5b7cc864460135cbbf1679ca)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
   /**
    * Unique Grant id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Contact ID of contact record given grant belongs to.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -73,14 +73,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
   /**
    * Yes/No field stating whether grant report was received by donor.
    *
-   * @var boolean
+   * @var bool
    */
   public $grant_report_received;
 
   /**
    * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.
    *
-   * @var int unsigned
+   * @var int
    */
   public $grant_type_id;
 
@@ -122,14 +122,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
   /**
    * Id of Grant status.
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
    * FK to Financial Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -298,7 +298,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'grant_type',
             'optionEditPath' => 'civicrm/admin/options/grant_type',
-          ]
+          ],
         ],
         'amount_total' => [
           'name' => 'amount_total',
@@ -308,7 +308,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_grant.amount_total',
@@ -329,7 +329,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'description' => ts('Requested grant amount, in original currency (optional).'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_grant.amount_requested',
           'dataPattern' => '/^\d+(\.\d{2})?$/',
@@ -348,7 +348,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'description' => ts('Granted amount, in default currency.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_grant.amount_granted',
@@ -383,7 +383,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'rationale' => [
           'name' => 'rationale',
@@ -422,7 +422,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'grant_status',
             'optionEditPath' => 'civicrm/admin/options/grant_status',
-          ]
+          ],
         ],
         'financial_type_id' => [
           'name' => 'financial_type_id',
@@ -440,7 +440,7 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 9cb7c8e397cc9cc5a375a0714c28aef3dc23f2c4..588fcceda8235532406e3ce0da57fae397b5dde4 100644 (file)
@@ -46,7 +46,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 925da7565f62e786ad11e9a86f1693c2fc42ffe0..59e8d822f7af2147c796ca7af40d27053d1e1a41 100644 (file)
@@ -44,7 +44,7 @@ class CRM_Grant_Form_Task_Delete extends CRM_Grant_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific participation?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 19ff51cd4fa6bcbc4c22495b8206079ded7ddca9..1eebd8d32b6f994fd866733192468ac77176b934 100644 (file)
@@ -79,14 +79,14 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index 789689886fd8d2543d080254f98fede1429f88a0..3c3e9722fbde2ab91c1b9e614fe0ac7248c946d1 100644 (file)
@@ -36,6 +36,8 @@
  */
 class CRM_Group_Form_Edit extends CRM_Core_Form {
 
+  use CRM_Core_Form_EntityFormTrait;
+
   /**
    * The group id, used when editing a group
    *
@@ -78,6 +80,35 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
    */
   protected $_groupOrganizationID;
 
+  /**
+   * Set entity fields to be assigned to the form.
+   */
+  protected function setEntityFields() {
+    $this->entityFields = [
+      'title' => [
+        'name' => 'title',
+        'required' => TRUE,
+      ],
+      'description' => ['name' => 'description'],
+    ];
+  }
+
+  /**
+   * Set the delete message.
+   *
+   * We do this from the constructor in order to do a translation.
+   */
+  public function setDeleteMessage() {
+    $this->deleteMessage = '';
+  }
+
+  /**
+   * Explicitly declare the entity api name.
+   */
+  public function getDefaultEntity() {
+    return 'Group';
+  }
+
   /**
    * Set up variables to build the form.
    */
@@ -213,18 +244,8 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
    * Build the form object.
    */
   public function buildQuickForm() {
-    if ($this->_action == CRM_Core_Action::DELETE) {
-      $this->addButtons(array(
-        array(
-          'type' => 'next',
-          'name' => ts('Delete Group'),
-          'isDefault' => TRUE,
-        ),
-        array(
-          'type' => 'cancel',
-          'name' => ts('Cancel'),
-        ),
-      ));
+    self::buildQuickEntityForm();
+    if ($this->_action & CRM_Core_Action::DELETE) {
       return;
     }
 
@@ -233,15 +254,6 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
       $this->preventAjaxSubmit();
     }
 
-    $this->applyFilter('__ALL__', 'trim');
-    $this->add('text', 'title', ts('Name') . ' ',
-      CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE
-    );
-
-    $this->add('textarea', 'description', ts('Description') . ' ',
-      CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description')
-    );
-
     $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
 
     if (isset($this->_id) && !empty($this->_groupValues['saved_search_id'])) {
@@ -272,18 +284,6 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
     //build custom data
     CRM_Custom_Form_CustomData::buildQuickForm($this);
 
-    $this->addButtons(array(
-      array(
-        'type' => 'upload',
-        'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
-        'isDefault' => TRUE,
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
-    ));
-
     $doParentCheck = FALSE;
     if (CRM_Core_Permission::isMultisiteEnabled()) {
       $doParentCheck = ($this->_id && CRM_Core_BAO_Domain::isDomainGroup($this->_id)) ? FALSE : TRUE;
index 85e893ca4dfd0c24ff662bdde2d840d5f15645db..8e609c0d1478431e841f991e5014e4cb979ca7cc 100644 (file)
@@ -65,7 +65,8 @@ class CRM_Mailing_ActionTokens extends \Civi\Token\AbstractTokenSubscriber {
    * @inheritDoc
    */
   public function checkActive(\Civi\Token\TokenProcessor $processor) {
-    return !empty($processor->context['mailingId']) || !empty($processor->context['mailing']);
+    return !empty($processor->context['mailingId']) || !empty($processor->context['mailing'])
+      || in_array('mailingId', $processor->context['schema']) || in_array('mailing', $processor->context['schema']);
   }
 
   /**
@@ -85,7 +86,9 @@ class CRM_Mailing_ActionTokens extends \Civi\Token\AbstractTokenSubscriber {
     // replaceSubscribeInviteTokens().
 
     if (empty($row->context['mailingJobId']) || empty($row->context['mailingActionTarget']['hash'])) {
-      throw new \CRM_Core_Exception("Error: Cannot use action tokens unless context defines mailingJobId and mailingActionTarget.");
+      // Strictly speaking, it doesn't make much sense to generate action-tokens when there's no job ID, but traditional CiviMail
+      // does this in v5.6+ for "Preview" functionality. Relaxing this strictness check ensures parity between newer+older styles.
+      // throw new \CRM_Core_Exception("Error: Cannot use action tokens unless context defines mailingJobId and mailingActionTarget.");
     }
 
     if ($field === 'eventQueueId') {
index 7e7d8ef8dd5d6b447172aafe396bda237071d39d..21d10f7c5f77d2aab9ed34ad29bb15daed6f7446 100644 (file)
@@ -1363,6 +1363,10 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       $numSlices = count($embed_data);
       $url = '';
       for ($i = 0; $i < $numSlices; $i++) {
+        $embed_url_data = parse_url($embed_data[$i]);
+        if (!empty($embed_url_data['scheme'])) {
+          $token_a['embed_parts'][$i] = preg_replace("/href=\"(https*:\/\/)/", "href=\"", $token_a['embed_parts'][$i]);
+        }
         $url .= "{$token_a['embed_parts'][$i]}{$embed_data[$i]}";
       }
       if (isset($token_a['embed_parts'][$numSlices])) {
@@ -1775,7 +1779,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    */
   public static function getMailingHash($id) {
     $hash = NULL;
-    if (Civi::settings()->get('hash_mailing_url')) {
+    if (Civi::settings()->get('hash_mailing_url') && !empty($id)) {
       $hash = CRM_Core_DAO::getFieldValue('CRM_Mailing_BAO_Mailing', $id, 'hash', 'id');
     }
     return $hash;
index 8f3dff95e2d4caaea06459272b753192ef046f65..1374f0d1cdb03e905afb7c5e272604e14b589f9b 100644 (file)
@@ -509,7 +509,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
       $config = CRM_Core_Config::singleton();
     }
 
-    if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != 'en_US') {
+    if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != CRM_Core_I18n::getLocale()) {
       $swapLang = CRM_Utils_AutoClean::swap('global://dbLocale?getter', 'call://i18n/setLocale', $mailing->language);
     }
 
index efdaf7d04e58e16661ac8805a71285ab609eb77a..e54fa43aa3049f7797430dff00666cd788e9a051 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/BouncePattern.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4c704cc977e01082612050ebc367ce1a)
+ * (GenCodeChecksum:767f24673857e91d2b76de45fce55649)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_DAO_BouncePattern extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Type of bounce
    *
-   * @var int unsigned
+   * @var int
    */
   public $bounce_type_id;
 
index 6819e18c518a6df63b89e1a6d23577c8ddccef35..db710ffeb948a044d7a8a982bb3c93fc039ce091 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/BounceType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:317021d6e37d4d4d6fd91e15aaef8f93)
+ * (GenCodeChecksum:32b467be869aa9e4539fe7f0824f96b3)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -50,7 +50,7 @@ class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO {
   /**
    * Number of bounces of this type required before the email address is put on bounce hold
    *
-   * @var int unsigned
+   * @var int
    */
   public $hold_threshold;
 
index 4296e1ea7d774dcbdf2217d8e12d7527111635da..d6aef45f9eb81974eb502089006b09fef0cae4c8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Mailing.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5a53b90adc8124a3af37701d7a50b822)
+ * (GenCodeChecksum:c6f26fcb49da86f49a4a1ac885070ed6)
  */
 
 /**
@@ -29,54 +29,54 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which site is this mailing for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
   /**
    * FK to the header component.
    *
-   * @var int unsigned
+   * @var int
    */
   public $header_id;
 
   /**
    * FK to the footer component.
    *
-   * @var int unsigned
+   * @var int
    */
   public $footer_id;
 
   /**
    * FK to the auto-responder component.
    *
-   * @var int unsigned
+   * @var int
    */
   public $reply_id;
 
   /**
    * FK to the unsubscribe component.
    *
-   * @var int unsigned
+   * @var int
    */
   public $unsubscribe_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $resubscribe_id;
 
   /**
    * FK to the opt-out component.
    *
-   * @var int unsigned
+   * @var int
    */
   public $optout_id;
 
@@ -153,56 +153,56 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * Should we track URL click-throughs for this mailing?
    *
-   * @var boolean
+   * @var bool
    */
   public $url_tracking;
 
   /**
    * Should we forward replies back to the author?
    *
-   * @var boolean
+   * @var bool
    */
   public $forward_replies;
 
   /**
    * Should we enable the auto-responder?
    *
-   * @var boolean
+   * @var bool
    */
   public $auto_responder;
 
   /**
    * Should we track when recipients open/read this mailing?
    *
-   * @var boolean
+   * @var bool
    */
   public $open_tracking;
 
   /**
    * Has at least one job associated with this mailing finished?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_completed;
 
   /**
    * FK to the message template.
    *
-   * @var int unsigned
+   * @var int
    */
   public $msg_template_id;
 
   /**
    * Should we overrite VERP address in Reply-To
    *
-   * @var boolean
+   * @var bool
    */
   public $override_verp;
 
   /**
    * FK to Contact ID who first created this mailing
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -223,7 +223,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * FK to Contact ID who scheduled this mailing
    *
-   * @var int unsigned
+   * @var int
    */
   public $scheduled_id;
 
@@ -237,7 +237,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * FK to Contact ID who approved this mailing
    *
-   * @var int unsigned
+   * @var int
    */
   public $approver_id;
 
@@ -251,7 +251,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * The status of this mailing. Values: none, approved, rejected
    *
-   * @var int unsigned
+   * @var int
    */
   public $approval_status_id;
 
@@ -265,7 +265,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * Is this mailing archived?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_archived;
 
@@ -279,19 +279,19 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * The campaign for which this mailing has been initiated.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
   /**
    * Remove duplicate emails?
    *
-   * @var boolean
+   * @var bool
    */
   public $dedupe_email;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $sms_provider_id;
 
@@ -305,7 +305,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
   /**
    * With email_selection_method, determines which email address to use
    *
-   * @var int unsigned
+   * @var int
    */
   public $location_type_id;
 
@@ -392,7 +392,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'header_id' => [
           'name' => 'header_id',
@@ -497,7 +497,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes',
-          ]
+          ],
         ],
         'from_name' => [
           'name' => 'from_name',
@@ -563,7 +563,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames',
-          ]
+          ],
         ],
         'template_options' => [
           'name' => 'template_options',
@@ -825,7 +825,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'mail_approval_status',
             'optionEditPath' => 'civicrm/admin/options/mail_approval_status',
-          ]
+          ],
         ],
         'approval_note' => [
           'name' => 'approval_note',
@@ -874,7 +874,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::groupVisibility',
-          ]
+          ],
         ],
         'campaign_id' => [
           'name' => 'campaign_id',
@@ -894,7 +894,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'dedupe_email' => [
           'name' => 'dedupe_email',
@@ -953,7 +953,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
             'table' => 'civicrm_location_type',
             'keyColumn' => 'id',
             'labelColumn' => 'display_name',
-          ]
+          ],
         ],
         'email_selection_method' => [
           'name' => 'email_selection_method',
@@ -970,7 +970,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::emailSelectMethods',
-          ]
+          ],
         ],
         'language' => [
           'name' => 'language',
@@ -991,7 +991,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
             'optionGroupName' => 'languages',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/languages',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 3e42d261d0e98e35089ad9e7eb0fb3019e6c5fb3..9fb96960e1bc8a249867fc8fe95a173b00062def 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/MailingAB.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:507182363032ab7340b7d1e7383ce1dd)
+ * (GenCodeChecksum:a45895256f23784bb86ae1b4659abbe6)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -50,28 +50,28 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
   /**
    * The first experimental mailing ("A" condition)
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id_a;
 
   /**
    * The second experimental mailing ("B" condition)
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id_b;
 
   /**
    * The final, general mailing (derived from A or B)
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id_c;
 
   /**
    * Which site is this mailing for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -100,14 +100,14 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
   public $declare_winning_time;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $group_percentage;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
@@ -187,7 +187,7 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
-          ]
+          ],
         ],
         'mailing_id_a' => [
           'name' => 'mailing_id_a',
@@ -246,7 +246,7 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
-          ]
+          ],
         ],
         'winner_criteria' => [
           'name' => 'winner_criteria',
@@ -261,7 +261,7 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
-          ]
+          ],
         ],
         'specific_url' => [
           'name' => 'specific_url',
index f4e6b01ac4f79d259ddf8b2127cef64e31b1701c..8a5e52eb204b96f8e7746c18418842dd92c6f529 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/MailingComponent.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:955923daf1ea29949123b9b76bab36da)
+ * (GenCodeChecksum:e3b5498354f50a2badfa4425958511af)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -69,14 +69,14 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {
   /**
    * Is this the default component for this component_type?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Is this property active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -137,7 +137,7 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::mailingComponents',
-          ]
+          ],
         ],
         'subject' => [
           'name' => 'subject',
index dc3dec5d07aab4db9349399934de74000fe3ba92..75bdc7f2b3fd39a063cdb24250a011a5bb066a66 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/MailingGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f39d14e245f10652e2fcea603ebc7610)
+ * (GenCodeChecksum:22f18bdbfea712ba8a6e1f0220ffb016)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The ID of a previous mailing to include/exclude recipients.
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id;
 
@@ -57,7 +57,7 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
   /**
    * Foreign key to the referenced item.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -148,7 +148,7 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes',
-          ]
+          ],
         ],
         'entity_table' => [
           'name' => 'entity_table',
@@ -165,7 +165,7 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
           'localizable' => 0,
           'pseudoconstant' => [
             'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables',
-          ]
+          ],
         ],
         'entity_id' => [
           'name' => 'entity_id',
index cbbce73c406fc3c424dc31b6cae0cb717d281125..ebec9368ab07ad75ee4dec09a19282a1303f8a0b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/MailingJob.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e362d1178fb0ca6293b31660e24ea375)
+ * (GenCodeChecksum:e7dbe1ca234cec93cb54192911b87297)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The ID of the mailing this Job will send.
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id;
 
@@ -71,7 +71,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
   /**
    * Is this job for a test mail?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
@@ -85,7 +85,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
   /**
    * Parent job id
    *
-   * @var int unsigned
+   * @var int
    */
   public $parent_id;
 
@@ -215,7 +215,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
-          ]
+          ],
         ],
         'is_test' => [
           'name' => 'is_test',
index 4f1375686157f23ea563005760fd24510b7d3495..8ca9fe6ec0b22f4da7917d059c62047327bd5ea2 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Recipients.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:321767aa3e7c0ea7aac652b973d9603d)
+ * (GenCodeChecksum:006015b0e117746e7c97d656150badc3)
  */
 
 /**
@@ -29,35 +29,35 @@ class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The ID of the mailing this Job will send.
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id;
 
   /**
    * FK to Contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to Email
    *
-   * @var int unsigned
+   * @var int
    */
   public $email_id;
 
   /**
    * FK to Phone
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_id;
 
index ffde488e26969b704ba7a22530f880153cd927dc..20053007af3d836091df00cb332e60929d4dc9db 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Spool.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:db7871e2d5313c106f01f1516beaf898)
+ * (GenCodeChecksum:55c696d855ff602c9e097bd9ccff0971)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_DAO_Spool extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * The ID of the Job .
    *
-   * @var int unsigned
+   * @var int
    */
   public $job_id;
 
index f87f00a386e77470d0566c78b7d996efb70a9ef5..751d21e744a33d1e0d4b5a2e8d5b850eb708ad5c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/TrackableURL.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e0280e1322178bb6d56a8104589c1415)
+ * (GenCodeChecksum:36f444ad863c1eae8db4e8e1c768eb27)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -43,7 +43,7 @@ class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO {
   /**
    * FK to the mailing
    *
-   * @var int unsigned
+   * @var int
    */
   public $mailing_id;
 
index d60eb55715dfff9d856d22ab61cbe30f064e35c2..8efd8fddb357196597670dd05fee28381ed3095d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Bounce.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5243c65d5b727e60e1fdedb9fa3e84e2)
+ * (GenCodeChecksum:0b39ada8498cdc95e5eab7a4f060686a)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Bounce extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
   /**
    * What type of bounce was it?
    *
-   * @var int unsigned
+   * @var int
    */
   public $bounce_type_id;
 
@@ -133,7 +133,7 @@ class CRM_Mailing_Event_DAO_Bounce extends CRM_Core_DAO {
             'table' => 'civicrm_mailing_bounce_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'bounce_reason' => [
           'name' => 'bounce_reason',
index 61373315e4e695287c7b56899469f68863d47f54..b80f8fc3198a50c1a7e9aef01ef6a66b7cc3db01 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Confirm.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:627a4d86b1b115a52592e04270eadc78)
+ * (GenCodeChecksum:dd5f6d9d5ca3115b92e9f87a1d5bf503)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Confirm extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_mailing_event_subscribe
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_subscribe_id;
 
index fed90da898dd971625dd4c925e679b7378b2dea6..5a3008d751f94318df94a1d56cafef154e52c103 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Delivered.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0bdd626b315c4ad541239662d6c52a82)
+ * (GenCodeChecksum:6327ad9e20e94a06bd9609fd3f56a3b4)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Delivered extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
index 7f9e189d4861bb46eea7a469a559b8c060c84a62..059c6b3a4a1c373c0ba8b863943b4c9e978922bb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Forward.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:73d4b00ff9ea00d604d5e83963ba5597)
+ * (GenCodeChecksum:b178f318b31d833f478b236f268cbcec)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Forward extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
   /**
    * FK to EventQueue for destination
    *
-   * @var int unsigned
+   * @var int
    */
   public $dest_queue_id;
 
index 6147a770ab39071e4a50a2611ea8657ebecaa346..69fb725731031a7efb487d486ff9954f7a8b0d00 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Opened.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:226ec9ccc51c88320e1b4108d5a85bf3)
+ * (GenCodeChecksum:77cca50f0bb75aecfc26f8e62037b93d)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Opened extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
index c229b074ec5fd445bc013b582c5553188eed0b68..efe1d0867d8f46d9cc408df1c4009e1288df272e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Queue.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2b873b4e3dae5279b8b63b6e4de5adc0)
+ * (GenCodeChecksum:6ce46b44932d8dcdbf39af7d91a57a03)
  */
 
 /**
@@ -29,28 +29,28 @@ class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Job
    *
-   * @var int unsigned
+   * @var int
    */
   public $job_id;
 
   /**
    * FK to Email
    *
-   * @var int unsigned
+   * @var int
    */
   public $email_id;
 
   /**
    * FK to Contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -64,7 +64,7 @@ class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO {
   /**
    * FK to Phone
    *
-   * @var int unsigned
+   * @var int
    */
   public $phone_id;
 
index 8ca919a823fe637b269b5fb1ce8c250e4edb8ff3..27ec175e906a1fc6bf3553637ff1cb54afec3466 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Reply.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:651380df4cde36fdfc999b5570cac1f9)
+ * (GenCodeChecksum:0ddff564744f8da4c3d5030ceb692b9c)
  */
 
 /**
@@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Reply extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
index ad711c9d26d5ef6ee69204ec5d1934388fee4266..3162104cfc4bc0962bd4bb908431813e50fcd016 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a18362fb8ab1b7cd9b6f5450fcf367f5)
+ * (GenCodeChecksum:3f9398df2e81f38e0a24330928f85b47)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Group
    *
-   * @var int unsigned
+   * @var int
    */
   public $group_id;
 
   /**
    * FK to Contact
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
@@ -123,7 +123,7 @@ class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO {
             'table' => 'civicrm_group',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
         'contact_id' => [
           'name' => 'contact_id',
index 39c7646d10e88197b98c153ceeeebae23d1f81b4..cce8241d1a3bd3ff41afd0558185730966e596df 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/TrackableURLOpen.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1dd0644af19360b30531b6f23dde78c1)
+ * (GenCodeChecksum:ed0344e6d9483abfca366a5ba9735e56)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_TrackableURLOpen extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
   /**
    * FK to TrackableURL
    *
-   * @var int unsigned
+   * @var int
    */
   public $trackable_url_id;
 
index 7cd86585117cce5fae70658b6de23172bfb5ccd2..8e7d40ddd7e37a1a72cf43d498217a6788fb7352 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e2a14fa1a63bd3f7b4e4fb4864a8560e)
+ * (GenCodeChecksum:f3f2e48cc72b5cacff2aad1e146e70f8)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Unsubscribe extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to EventQueue
    *
-   * @var int unsigned
+   * @var int
    */
   public $event_queue_id;
 
   /**
    * Unsubscribe at org- or group-level
    *
-   * @var boolean
+   * @var bool
    */
   public $org_unsubscribe;
 
index 65bf2de542df4a9cb0ef50650ae783d6afa0ff30..abb1428e2aae2b15a2be9c4f313cb97e2dee6191 100644 (file)
@@ -67,7 +67,7 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page {
   /**
    * Scheduled mailing.
    *
-   * @var boolean
+   * @var bool
    */
   public $_scheduled;
 
index b8282405a3e51edcf65107a0772d19220ee04145..a6f03660f2be884beae482f9fa07989ccfb9215b 100644 (file)
  * A page for mailing preview.
  */
 class CRM_Mailing_Page_View extends CRM_Core_Page {
+
+  /**
+   * Signal to Flexmailer that this version of the class is usable.
+   *
+   * @var bool
+   */
+  const USES_MAILING_PREVIEW_API = 1;
+
   protected $_mailingID;
   protected $_mailing;
   protected $_contactID;
@@ -132,59 +140,27 @@ class CRM_Mailing_Page_View extends CRM_Core_Page {
       return NULL;
     }
 
-    CRM_Mailing_BAO_Mailing::tokenReplace($this->_mailing);
-
-    // get and format attachments
-    $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing',
-      $this->_mailing->id
-    );
-
-    // get contact detail and compose if contact id exists
-    $returnProperties = $this->_mailing->getReturnProperties();
-    if (isset($this->_contactID)) {
-      // get details of contact with token value including Custom Field Token Values.CRM-3734
-      $params = ['contact_id' => $this->_contactID];
-      $details = CRM_Utils_Token::getTokenDetails($params,
-        $returnProperties,
-        FALSE, TRUE, NULL,
-        $this->_mailing->getFlattenedTokens(),
-        get_class($this)
-      );
-      $details = $details[0][$this->_contactID];
-      $contactId = $this->_contactID;
-    }
-    else {
-      // get tokens that are not contact specific resolved
-      $params = ['contact_id' => 0];
-      $details = CRM_Utils_Token::getAnonymousTokenDetails($params,
-        $returnProperties,
-        TRUE, TRUE, NULL,
-        $this->_mailing->getFlattenedTokens(),
-        get_class($this)
-      );
-
-      $details = CRM_Utils_Array::value(0, $details[0]);
-      $contactId = 0;
-    }
-    $mime = $this->_mailing->compose(NULL, NULL, NULL, $contactId,
-      $this->_mailing->from_email,
-      $this->_mailing->from_email,
-      TRUE, $details, $attachments
-    );
+    $contactId = isset($this->_contactID) ? $this->_contactID : 0;
+
+    $result = civicrm_api3('Mailing', 'preview', [
+      'id' => $this->_mailingID,
+      'contact_id' => $contactId,
+    ]);
+    $mailing = \CRM_Utils_Array::value('values', $result);
 
     $title = NULL;
-    if (isset($this->_mailing->body_html) && empty($_GET['text'])) {
+    if (isset($mailing['body_html']) && empty($_GET['text'])) {
       $header = 'text/html; charset=utf-8';
-      $content = $mime->getHTMLBody();
+      $content = $mailing['body_html'];
       if (strpos($content, '<head>') === FALSE && strpos($content, '<title>') === FALSE) {
-        $title = '<head><title>' . $this->_mailing->subject . '</title></head>';
+        $title = '<head><title>' . $mailing['subject'] . '</title></head>';
       }
     }
     else {
       $header = 'text/plain; charset=utf-8';
-      $content = $mime->getTXTBody();
+      $content = $mailing['body_text'];
     }
-    CRM_Utils_System::setTitle($this->_mailing->subject);
+    CRM_Utils_System::setTitle($mailing['subject']);
 
     if (CRM_Utils_Array::value('snippet', $_GET) === 'json') {
       CRM_Core_Page_AJAX::returnJsonResponse($content);
index e50406bd8359b9560cfefa4d5dbf3d78aaedcede..92f19eaffd220371057254ca54ecc0cb50e59952 100644 (file)
@@ -73,14 +73,14 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
@@ -341,8 +341,10 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
    *   the column headers that need to be displayed
    */
   public function &getColumnHeaders($action = NULL, $output = NULL) {
+
     if (!isset(self::$_columnHeaders)) {
-      self::$_columnHeaders = [
+      $isMultiLingual = CRM_Core_I18n::isMultiLingual();
+      $headers = [
         ['desc' => ts('Contact Type')],
         [
           'name' => ts('Name'),
@@ -359,11 +361,17 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
           'sort' => 'mailing_name',
           'direction' => CRM_Utils_Sort::DONTCARE,
         ],
-        [
+      ];
+
+      // Check to see if languages column should be displayed.
+      if ($isMultiLingual) {
+        $headers[] = [
           'name' => ts('Language'),
           'sort' => 'language',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ],
+        ];
+      }
+      self::$_columnHeaders = array_merge($headers, [
         [
           'name' => ts('Mailing Subject'),
           'sort' => 'mailing_subject',
@@ -380,7 +388,7 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_
           'direction' => CRM_Utils_Sort::DONTCARE,
         ],
         ['desc' => ts('Actions')],
-      ];
+      ]);
     }
     return self::$_columnHeaders;
   }
index 74cd6adee41dc14b2e761d96bb0aede1127846ad..efde6376b2e261e0919c6229a9d5327967a9272f 100644 (file)
@@ -61,7 +61,8 @@ class CRM_Mailing_Tokens extends \Civi\Token\AbstractTokenSubscriber {
    * @inheritDoc
    */
   public function checkActive(\Civi\Token\TokenProcessor $processor) {
-    return !empty($processor->context['mailingId']) || !empty($processor->context['mailing']);
+    return !empty($processor->context['mailingId']) || !empty($processor->context['mailing'])
+      || in_array('mailingId', $processor->context['schema']) || in_array('mailing', $processor->context['schema']);
   }
 
   /**
index b359fdd15d0ba945199e0d472f4a80cc6e6b5fc4..49e5181b8be41e3632a807459c1d369e201b7b2f 100644 (file)
@@ -2272,7 +2272,7 @@ WHERE      civicrm_membership.is_test = 0
       self::processOverriddenUntilDateMembership($dao1);
     }
 
-    $query = $baseQuery . " AND civicrm_membership.is_override IS NULL
+    $query = $baseQuery . " AND (civicrm_membership.is_override = 0 OR civicrm_membership.is_override IS NULL) 
      AND civicrm_membership.status_id NOT IN (%1, %2, %3, %4)
      AND civicrm_membership.owner_membership_id IS NULL ";
     $params = array(
index 43b1b5aa60a41b4c146c889ca7bb243f77034b61..696e8ad635db8e5f30ec0c5266abafc952d6113f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/Membership.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f292ac185330c17ffa8c647359ab07b4)
+ * (GenCodeChecksum:458e89b098dbf4f91369a293406c38ba)
  */
 
 /**
@@ -31,21 +31,21 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
   /**
    * Membership Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to Membership Type
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_type_id;
 
@@ -78,14 +78,14 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
   /**
    * FK to Membership Status
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
    * Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_override;
 
@@ -99,7 +99,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
   /**
    * Optional FK to Parent Membership.
    *
-   * @var int unsigned
+   * @var int
    */
   public $owner_membership_id;
 
@@ -111,26 +111,26 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
   public $max_related;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_pay_later;
 
   /**
    * Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_recur_id;
 
   /**
    * The campaign for which this membership is attached.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
@@ -227,7 +227,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
             'table' => 'civicrm_membership_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'join_date' => [
           'name' => 'join_date',
@@ -326,7 +326,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
             'table' => 'civicrm_membership_status',
             'keyColumn' => 'id',
             'labelColumn' => 'label',
-          ]
+          ],
         ],
         'is_override' => [
           'name' => 'is_override',
@@ -455,7 +455,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 275fce3e7a3805c23f4459a8c6d9c1e41c85fdbd..117d8a7cc7c4fdafee70889d71c7b141eb7b49ce 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipBlock.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:00a04451a5cee7da1ae6a4c255f40481)
+ * (GenCodeChecksum:0e7f3965fe1382ec1f850a9489b3f236)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
   /**
    * Membership Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
   /**
    * FK to civicrm_contribution_page.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -59,21 +59,21 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
   /**
    * Optional foreign key to membership_type
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_type_default;
 
   /**
    * Display minimum membership fee
    *
-   * @var boolean
+   * @var bool
    */
   public $display_min_fee;
 
   /**
    * Should membership transactions be processed separately
    *
-   * @var boolean
+   * @var bool
    */
   public $is_separate_payment;
 
@@ -108,14 +108,14 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
   /**
    * Is membership sign up optional
    *
-   * @var boolean
+   * @var bool
    */
   public $is_required;
 
   /**
    * Is this membership_block enabled
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
index 30b1e0bf476817784a48cbcb0a0b62a088e75da7..ef491cc13595f2534bc1b34ce060dc9c7479d241 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipLog.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2ae50fe99b0c911fbe971e12e2bed7ce)
+ * (GenCodeChecksum:82b26091e0c62f81060ae15de5a4a010)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Membership table
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_id;
 
   /**
    * New status assigned to membership by this action. FK to Membership Status
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -64,7 +64,7 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
   /**
    * FK to Contact ID of person under whose credentials this data modification was made.
    *
-   * @var int unsigned
+   * @var int
    */
   public $modified_id;
 
@@ -78,7 +78,7 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
   /**
    * FK to Membership Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_type_id;
 
index 82a01b13e695871f4541afcd6a4ac60d37530301..d6369491b9d69062491e8cee1e8c3ef5907e1624 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipPayment.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1296687b8bc4acb0b1db07fdd131d7ea)
+ * (GenCodeChecksum:63aaccfeac39fe31a88f69693e8b4302)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Membership table
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_id;
 
   /**
    * FK to contribution table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
index 701759ffc0363a4109664703abd3bfd9726eae95..d238e87ac178b339b54510cab64b92cf5e1b8619 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipStatus.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:125e59b6c34bc9ea478a12c18a66af01)
+ * (GenCodeChecksum:0cb23348cde6fff261da37c8cb309da1)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
   /**
    * Membership Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -94,14 +94,14 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
   /**
    * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).
    *
-   * @var boolean
+   * @var bool
    */
   public $is_current_member;
 
   /**
    * Is this status for admin/manual assignment only.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_admin;
 
@@ -113,21 +113,21 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
   /**
    * Assign this status to a membership record if no other status match is found.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Is this membership_status enabled.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this membership_status reserved.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
@@ -207,7 +207,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::eventDate',
-          ]
+          ],
         ],
         'start_event_adjust_unit' => [
           'name' => 'start_event_adjust_unit',
@@ -226,7 +226,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::unitList',
-          ]
+          ],
         ],
         'start_event_adjust_interval' => [
           'name' => 'start_event_adjust_interval',
@@ -256,7 +256,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::eventDate',
-          ]
+          ],
         ],
         'end_event_adjust_unit' => [
           'name' => 'end_event_adjust_unit',
@@ -275,7 +275,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::unitList',
-          ]
+          ],
         ],
         'end_event_adjust_interval' => [
           'name' => 'end_event_adjust_interval',
index c777c9a2e37e3351603e877045171906e7247c6d..fb3cddba56e684927d635cb55b66e114ff629765 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/MembershipType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6652513077f7dc2a13004ef30408a051)
+ * (GenCodeChecksum:371e68c0fca2803c9b273bb25991a060)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
   /**
    * Membership Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this match entry for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -59,14 +59,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
   /**
    * Owner organization for this membership type. FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $member_of_contact_id;
 
   /**
    * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -158,14 +158,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
   /**
    * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
    *
-   * @var boolean
+   * @var bool
    */
   public $auto_renew;
 
   /**
    * Is this membership_type enabled
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -230,7 +230,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'membership_type' => [
           'name' => 'name',
@@ -297,7 +297,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'minimum_fee' => [
           'name' => 'minimum_fee',
@@ -306,7 +306,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
           'precision' => [
             18,
-            9
+            9,
           ],
           'where' => 'civicrm_membership_type.minimum_fee',
           'default' => '0',
@@ -336,7 +336,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
-          ]
+          ],
         ],
         'duration_interval' => [
           'name' => 'duration_interval',
@@ -369,7 +369,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::periodType',
-          ]
+          ],
         ],
         'fixed_period_start_day' => [
           'name' => 'fixed_period_start_day',
@@ -449,7 +449,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::memberVisibility',
-          ]
+          ],
         ],
         'weight' => [
           'name' => 'weight',
@@ -512,7 +512,7 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
index 096e45e65254bc327427cad20afe14df65d3f8c2..a8e9f8504639277c213ac00abec93cf78e6305b2 100644 (file)
@@ -129,6 +129,21 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
    *
    * @throws \Exception
    */
+
+  /**
+   * Set the renewal notification status message.
+   */
+  public function setRenewalMessage() {
+    $statusMsg = ts('%1 membership for %2 has been renewed.', array(1 => $this->membershipTypeName, 2 => $this->_memberDisplayName));
+
+    if ($this->isMailSent) {
+      $statusMsg .= ' ' . ts('A renewal confirmation and receipt has been sent to %1.', array(
+        1 => $this->_contributorEmail,
+      ));
+    }
+    CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
+  }
+
   public function preProcess() {
 
     // This string makes up part of the class names, differentiating them (not sure why) from the membership fields.
@@ -459,21 +474,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
     try {
       $this->submit();
-      $statusMsg = ts('%1 membership for %2 has been renewed.', [1 => $this->membershipTypeName, 2 => $this->_memberDisplayName]);
-
-      if ($this->endDate) {
-        $statusMsg .= ' ' . ts('The new membership End Date is %1.', [
-          1 => CRM_Utils_Date::customFormat(substr($this->endDate, 0, 8)),
-        ]);
-      }
-
-      if ($this->isMailSent) {
-        $statusMsg .= ' ' . ts('A renewal confirmation and receipt has been sent to %1.', [
-          1 => $this->_contributorEmail,
-        ]);
-        return $statusMsg;
-      }
-      return $statusMsg;
+      $this->setRenewalMessage();
     }
     catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
       CRM_Core_Session::singleton()->setStatus($e->getMessage());
@@ -481,8 +482,6 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
         "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership&mode={$this->_mode}"
       ));
     }
-
-    CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
   }
 
   /**
index 3e1c01588ee3462f2092590f7907cdffe2428a4a..1ffafe2a33247fc78714b7d38f5156ac5cea8bfc 100644 (file)
@@ -312,7 +312,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig {
 
     $this->assign('membershipTypeId', $this->_id);
 
-    if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+    if (Civi::settings()->get('deferred_revenue_enabled')) {
       $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType();
       $this->assign('deferredFinancialType', array_keys($deferredFinancialType));
     }
index a6cbf2235b9b72d1b7f03ed6c699b325e0a3560a..a53b2bd34b9cb1dee68511895d424b076476380e 100644 (file)
@@ -44,7 +44,7 @@ class CRM_Member_Form_Task_Delete extends CRM_Member_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific membership?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index be38db71a038f9c4f1a83fa2bfc72a9da8e15cd8..d58985192307ac6aec19721e813f0374f66b665a 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Member_Form_Task_Email extends CRM_Member_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single = FALSE;
 
@@ -51,7 +51,7 @@ class CRM_Member_Form_Task_Email extends CRM_Member_Form_Task {
    * Are we operating in "single mode", i.e. sending email to one
    * specific contact?
    *
-   * @var boolean
+   * @var bool
    */
   public $_noEmails = FALSE;
 
index 93bb374bc82554d324548b15476d17286514402c..68720b2be78ceb007becfe64e569701a35866fb4 100644 (file)
@@ -59,7 +59,7 @@ class CRM_Member_Import_Field {
 
   /**
    * Is this field required
-   * @var boolean
+   * @var bool
    */
   public $_required;
 
index cf7367687609213d7ef981cab13c96ba3285dee9..3edd35bb547186ad97a64f5114aff3220d638e87 100644 (file)
@@ -36,11 +36,6 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser {
 
   protected $_fileName;
 
-  /**
-   * #@+
-   * @var integer
-   */
-
   /**
    * Imported file size
    * @var int
@@ -62,7 +57,7 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser {
   /**
    * Whether the file has a column header or not
    *
-   * @var boolean
+   * @var bool
    */
   protected $_haveColumnHeader;
 
index 850046d865747b5e8f91c2484b4e48cf87cc8c8b..7c94dafc070edad45397e4335390ca87776a8885 100644 (file)
@@ -76,14 +76,14 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index b33921cf73eeedc80fdc2efcf6583d9c0633e940..f6dc90a8d8d6aa87c6522f85ce7c859ad6158a6c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/PCP/PCP.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4585e6f51f50242cba89fe9325c44c44)
+ * (GenCodeChecksum:e130d04d9fad8bcec628fac504ff9da7)
  */
 
 /**
@@ -31,19 +31,19 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
   /**
    * Personal Campaign Page ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Contact ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -70,7 +70,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
   /**
    * The Contribution or Event Page which triggered this pcp
    *
-   * @var int unsigned
+   * @var int
    */
   public $page_id;
 
@@ -84,17 +84,17 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
   /**
    * The pcp block that this pcp page was created from
    *
-   * @var int unsigned
+   * @var int
    */
   public $pcp_block_id;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $is_thermometer;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $is_honor_roll;
 
@@ -115,14 +115,14 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
   /**
    * Is Personal Campaign Page enabled/active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Notify owner via email when someone donates to page?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_notify;
 
@@ -201,7 +201,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'pcp_status',
             'optionEditPath' => 'civicrm/admin/options/pcp_status',
-          ]
+          ],
         ],
         'title' => [
           'name' => 'title',
@@ -339,7 +339,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
           'description' => ts('Goal amount of this Personal Campaign Page.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_pcp.goal_amount',
           'table_name' => 'civicrm_pcp',
@@ -371,7 +371,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'is_active' => [
           'name' => 'is_active',
index 2d93ff55c85f5a4df8152edb7384224c713c3eb5..14e478a5b5f5d9b201bb601e07a6b0d554b0ddfd 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/PCP/PCPBlock.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7cd542a1105ef4cf3ca8596869042754)
+ * (GenCodeChecksum:deacae800c52be5e0de763f8bccf4578)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
   /**
    * PCP block Id
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -43,7 +43,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
   /**
    * FK to civicrm_contribution_page.id OR civicrm_event.id
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -57,42 +57,42 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
   /**
    * The entity that this pcp targets
    *
-   * @var int unsigned
+   * @var int
    */
   public $target_entity_id;
 
   /**
    * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
    *
-   * @var int unsigned
+   * @var int
    */
   public $supporter_profile_id;
 
   /**
    * FK to civicrm_option_group with name = PCP owner notifications
    *
-   * @var int unsigned
+   * @var int
    */
   public $owner_notify_id;
 
   /**
    * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_approval_needed;
 
   /**
    * Does Personal Campaign Page allow using tell a friend?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_tellfriend_enabled;
 
   /**
    * Maximum recipient fields allowed in tell a friend
    *
-   * @var int unsigned
+   * @var int
    */
   public $tellfriend_limit;
 
@@ -106,7 +106,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
   /**
    * Is Personal Campaign Page Block enabled/active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -243,7 +243,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'pcp_owner_notify',
             'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
-          ]
+          ],
         ],
         'is_approval_needed' => [
           'name' => 'is_approval_needed',
index ccac09cf549619e2545ed059ee46e8426cb60742..624b873b4ce582f827fb1b3d0886adb48e09b157 100644 (file)
@@ -49,7 +49,7 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form {
   /**
    * Are we in single form mode or wizard mode?
    *
-   * @var boolean
+   * @var bool
    */
   public $_single;
 
index bbba0e145584f8320fd0babef9e1b812c8084dae..732a61a450e53b1923f7dea4edc7261805cd5c44 100644 (file)
@@ -308,15 +308,15 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
           foreach ($date as $field => $value) {
             switch ($field) {
               case 'contribution_date':
-                $form->addDate('start_date', ts('First installment payment'));
-                $paymentDate = $value = date('m/d/Y');
-                list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(NULL);
+                $form->add('datepicker', 'start_date', ts('First installment payment'), [], FALSE, ['time' => FALSE]);
+                $paymentDate = $value = date('Y-m-d');
+                $defaults['start_date'] = $value;
                 $form->assign('is_date', TRUE);
                 break;
 
               case 'calendar_date':
-                $form->addDate('start_date', ts('First installment payment'));
-                list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($value);
+                $form->add('datepicker', 'start_date', ts('First installment payment'), [], FALSE, ['time' => FALSE]);
+                $defaults['start_date'] = $value;
                 $form->assign('is_date', TRUE);
                 $paymentDate = $value;
                 break;
@@ -325,7 +325,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock {
                 $month = CRM_Utils_Date::getCalendarDayOfMonth();
                 $form->add('select', 'start_date', ts('Day of month installments paid'), $month);
                 $paymentDate = CRM_Pledge_BAO_Pledge::getPaymentDate($value);
-                list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults($paymentDate);
+                $defaults['start_date'] = $paymentDate;
                 break;
 
               default:
index 76e796bfc9a3a403ac2891bfeff8f4bb4d4ae3be..b18050474a2b9f8af77c02f7360da517bfee8185 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Pledge/Pledge.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4c4aab1d03d146815017589777121bbb)
+ * (GenCodeChecksum:877e6098c175e69f385b22f61958b70c)
  */
 
 /**
@@ -31,28 +31,28 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
   /**
    * Pledge ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Foreign key to civicrm_contact.id .
    *
-   * @var int unsigned
+   * @var int
    */
   public $contact_id;
 
   /**
    * FK to Financial Type
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
   /**
    * The Contribution Page which triggered this contribution
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_page_id;
 
@@ -87,21 +87,21 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
   /**
    * Number of time units for recurrence of pledge payments.
    *
-   * @var int unsigned
+   * @var int
    */
   public $frequency_interval;
 
   /**
    * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.
    *
-   * @var int unsigned
+   * @var int
    */
   public $frequency_day;
 
   /**
    * Total number of payments to be made.
    *
-   * @var int unsigned
+   * @var int
    */
   public $installments;
 
@@ -150,40 +150,40 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
   /**
    * The maximum number of payment reminders to send for any given payment.
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_reminders;
 
   /**
    * Send initial reminder this many days prior to the payment due date.
    *
-   * @var int unsigned
+   * @var int
    */
   public $initial_reminder_day;
 
   /**
    * Send additional reminder this many days after last one sent, up to maximum number of reminders.
    *
-   * @var int unsigned
+   * @var int
    */
   public $additional_reminder_day;
 
   /**
    * Implicit foreign key to civicrm_option_values in the pledge_status option group.
    *
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_test;
 
   /**
    * The campaign for which this pledge has been initiated.
    *
-   * @var int unsigned
+   * @var int
    */
   public $campaign_id;
 
@@ -271,7 +271,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'pledge_contribution_page_id' => [
           'name' => 'contribution_page_id',
@@ -293,7 +293,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_pledge.amount',
@@ -314,7 +314,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_pledge.original_installment_amount',
           'export' => TRUE,
@@ -347,7 +347,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'pledge_frequency_unit' => [
           'name' => 'frequency_unit',
@@ -369,7 +369,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'optionGroupName' => 'recur_frequency_units',
             'keyColumn' => 'name',
             'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
-          ]
+          ],
         ],
         'pledge_frequency_interval' => [
           'name' => 'frequency_interval',
@@ -564,7 +564,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'pledge_status',
             'optionEditPath' => 'civicrm/admin/options/pledge_status',
-          ]
+          ],
         ],
         'pledge_is_test' => [
           'name' => 'is_test',
@@ -602,7 +602,7 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
             'table' => 'civicrm_campaign',
             'keyColumn' => 'id',
             'labelColumn' => 'title',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index e319da634e738b34ddd4224596713b526a66458b..77e6525ca7e9d465664c6816661a347e55f497c6 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:cdc529b617a76a84e18455737f4e7a03)
+ * (GenCodeChecksum:0ba3eca2bf0f4b6ebd0f9b3617d5bef0)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
   /**
    * Pledge ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,7 +45,7 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
   /**
    * FK to entity table specified in entity_table column.
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
@@ -59,28 +59,28 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
   /**
    * Is frequency interval exposed on the contribution form.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_pledge_interval;
 
   /**
    * The maximum number of payment reminders to send for any given payment.
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_reminders;
 
   /**
    * Send initial reminder this many days prior to the payment due date.
    *
-   * @var int unsigned
+   * @var int
    */
   public $initial_reminder_day;
 
   /**
    * Send additional reminder this many days after last one sent, up to maximum number of reminders.
    *
-   * @var int unsigned
+   * @var int
    */
   public $additional_reminder_day;
 
@@ -94,14 +94,14 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
   /**
    * If true - recurring start date is shown.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_pledge_start_date_visible;
 
   /**
    * If true - recurring start date is editable.
    *
-   * @var boolean
+   * @var bool
    */
   public $is_pledge_start_date_editable;
 
index f3d80a9327e79e6899c8877191d1477f9aa0b1d4..a43fade0541f57b32d21494e7bab0fa5bedd9451 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:79875dd118415179172c3ac425758b29)
+ * (GenCodeChecksum:afb095a766df0f45f3aed1ff3b24e852)
  */
 
 /**
@@ -29,21 +29,21 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
   public static $_log = TRUE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to Pledge table
    *
-   * @var int unsigned
+   * @var int
    */
   public $pledge_id;
 
   /**
    * FK to contribution table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
@@ -85,12 +85,12 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
   /**
    * The number of payment reminders sent.
    *
-   * @var int unsigned
+   * @var int
    */
   public $reminder_count;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $status_id;
 
@@ -172,7 +172,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_pledge_payment.scheduled_amount',
@@ -189,7 +189,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
           'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_pledge_payment.actual_amount',
@@ -220,7 +220,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
             'keyColumn' => 'name',
             'labelColumn' => 'full_name',
             'nameColumn' => 'name',
-          ]
+          ],
         ],
         'pledge_payment_scheduled_date' => [
           'name' => 'scheduled_date',
@@ -281,7 +281,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'contribution_status',
             'optionEditPath' => 'civicrm/admin/options/contribution_status',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index e4a0354e01473bddc253f09675cef67580f57cdc..c101d33a6d9a0a22c4013492d0d849908113f0da 100644 (file)
@@ -46,14 +46,14 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search {
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index deb28e3e3911996515f47962eef3333ada529de3..ace7d9471736168d6cf67ad0d34acd790f4d0f47 100644 (file)
@@ -42,7 +42,7 @@ class CRM_Pledge_Form_Task_Delete extends CRM_Pledge_Form_Task {
    * Are we operating in "single mode", i.e. deleting one
    * specific pledge?
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
index 94551d9544aed0203cdae29e32cc923df113582d..b2d39ad3b71bcd53bc14f01f986db42b43f0de2a 100644 (file)
@@ -80,14 +80,14 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
index ff2e0c3b7712cac169bfcd3d82309ac2bab4a934..69e1f7fcd69f656bc65f6f51ab5599094c232f0a 100644 (file)
@@ -1559,7 +1559,7 @@ WHERE       ps.id = %1
         CRM_Price_BAO_PriceSet::addTo($baoName, $newId, $copyPriceSet->id);
       }
       else {
-        $copyPriceSet = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSetEntity',
+        $copyPriceSet = CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSetEntity',
           [
             'entity_id' => $id,
             'entity_table' => $baoName,
index 8d7ae16d29616b0a95d2a619f7142a9eebe522c1..ea4e67719a266781169756c5c5b36150da726005 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/LineItem.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:efca4ce3a24803ffca3180f7a81ea6f2)
+ * (GenCodeChecksum:6345c550c1c0605c0c25be1cc0382183)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
   /**
    * Line Item
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,21 +45,21 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
   /**
    * entry in table
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * FK to civicrm_contribution
    *
-   * @var int unsigned
+   * @var int
    */
   public $contribution_id;
 
   /**
    * FK to civicrm_price_field
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_field_id;
 
@@ -94,21 +94,21 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
   /**
    * Participant count for field
    *
-   * @var int unsigned
+   * @var int
    */
   public $participant_count;
 
   /**
    * FK to civicrm_price_field_value
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_field_value_id;
 
   /**
    * FK to Financial Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -248,7 +248,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_line_item.qty',
           'table_name' => 'civicrm_line_item',
@@ -267,7 +267,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_line_item.unit_price',
           'table_name' => 'civicrm_line_item',
@@ -286,7 +286,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_line_item.line_total',
           'table_name' => 'civicrm_line_item',
@@ -341,7 +341,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'non_deductible_amount' => [
           'name' => 'non_deductible_amount',
@@ -351,7 +351,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_line_item.non_deductible_amount',
           'headerPattern' => '/non?.?deduct/i',
@@ -372,7 +372,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
           'description' => ts('tax of each item'),
           'precision' => [
             20,
-            2
+            2,
           ],
           'import' => TRUE,
           'where' => 'civicrm_line_item.tax_amount',
index 8f825a193812b14c0b48c47f5edc3032d4ada05c..e823c87c396037313bc73c4079e65ac6c66514ec 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/PriceField.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e9ff5a22489167a421efd2f415ba4f58)
+ * (GenCodeChecksum:ccea318a7e83c8fd6d03734e20798b15)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
   /**
    * Price Field
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_price_set
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_set_id;
 
@@ -64,7 +64,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
   /**
    * Enter a quantity for this field?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_enter_qty;
 
@@ -92,28 +92,28 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
   /**
    * Should the price be displayed next to the label for each option?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_display_amounts;
 
   /**
    * number of options per line for checkbox and radio
    *
-   * @var int unsigned
+   * @var int
    */
   public $options_per_line;
 
   /**
    * Is this price field active
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Is this price field required (value must be > 1)
    *
-   * @var boolean
+   * @var bool
    */
   public $is_required;
 
@@ -141,7 +141,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
   /**
    * Implicit FK to civicrm_option_group with name = 'visibility'
    *
-   * @var int unsigned
+   * @var int
    */
   public $visibility_id;
 
@@ -252,7 +252,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
           ],
           'pseudoconstant' => [
             'callback' => 'CRM_Price_BAO_PriceField::htmlTypes',
-          ]
+          ],
         ],
         'is_enter_qty' => [
           'name' => 'is_enter_qty',
@@ -441,7 +441,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'visibility',
             'optionEditPath' => 'civicrm/admin/options/visibility',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index bd6f7daa200124a763dca072396cdb0b3eab5f0c..0543497f1f10118d41f38d25721f80d7701e4715 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/PriceFieldValue.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a3de204f039daa85984316fae2c60975)
+ * (GenCodeChecksum:6c2bd575335eeb9915683296952b2c3e)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
   /**
    * Price Field Value
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * FK to civicrm_price_field
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_field_id;
 
@@ -87,14 +87,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
   /**
    * Number of participants per field option
    *
-   * @var int unsigned
+   * @var int
    */
   public $count;
 
   /**
    * Max number of participants per field options
    *
-   * @var int unsigned
+   * @var int
    */
   public $max_value;
 
@@ -108,35 +108,35 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
   /**
    * FK to Membership Type
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_type_id;
 
   /**
    * Number of terms for this membership
    *
-   * @var int unsigned
+   * @var int
    */
   public $membership_num_terms;
 
   /**
    * Is this default price field option
    *
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
    * Is this price field value active
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * FK to Financial Type.
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
@@ -150,7 +150,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
   /**
    * Implicit FK to civicrm_option_group with name = 'visibility'
    *
-   * @var int unsigned
+   * @var int
    */
   public $visibility_id;
 
@@ -303,7 +303,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             18,
-            9
+            9,
           ],
           'where' => 'civicrm_price_field_value.amount',
           'table_name' => 'civicrm_price_field_value',
@@ -436,7 +436,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'non_deductible_amount' => [
           'name' => 'non_deductible_amount',
@@ -446,7 +446,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'required' => TRUE,
           'precision' => [
             20,
-            2
+            2,
           ],
           'where' => 'civicrm_price_field_value.non_deductible_amount',
           'headerPattern' => '/non?.?deduct/i',
@@ -477,7 +477,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
           'pseudoconstant' => [
             'optionGroupName' => 'visibility',
             'optionEditPath' => 'civicrm/admin/options/visibility',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index ae2e04ef8ea421b5b210664887a91d97ffda46e2..1593408b04eefb043bd019c9a16ba756b82b237c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/PriceSet.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a66d639b335e9df4c3133ade2aa16a9b)
+ * (GenCodeChecksum:5dcf30888df8309f20fa347780f16f4d)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
   /**
    * Price Set
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this price-set for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -59,7 +59,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
   /**
    * Is this price set active
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
@@ -94,28 +94,28 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
   /**
    * FK to Financial Type(for membership price sets only).
    *
-   * @var int unsigned
+   * @var int
    */
   public $financial_type_id;
 
   /**
    * Is set if edited on Contribution or Event Page rather than through Manage Price Sets
    *
-   * @var boolean
+   * @var bool
    */
   public $is_quick_config;
 
   /**
    * Is this a predefined system price set  (i.e. it can not be deleted, edited)?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
   /**
    * Minimum Amount required for this set.
    *
-   * @var int unsigned
+   * @var int
    */
   public $min_amount;
 
@@ -181,7 +181,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'name' => [
           'name' => 'name',
@@ -300,7 +300,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
             'table' => 'civicrm_component',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'financial_type_id' => [
           'name' => 'financial_type_id',
@@ -321,7 +321,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
             'table' => 'civicrm_financial_type',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'is_quick_config' => [
           'name' => 'is_quick_config',
index c665acc98a64b2ac112c7f3a03d9d29afb3c0903..0e6750dc84a784562b69346163d8bdaf2d7f186a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Price/PriceSetEntity.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ba2a78bcd5c6c34e2a81d1bcef776ca3)
+ * (GenCodeChecksum:8bd26effd43fe4ee752addf11e6a4769)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO {
   /**
    * Price Set Entity
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -45,14 +45,14 @@ class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO {
   /**
    * Item in table
    *
-   * @var int unsigned
+   * @var int
    */
   public $entity_id;
 
   /**
    * price set being used
    *
-   * @var int unsigned
+   * @var int
    */
   public $price_set_id;
 
index 47e1cb1c93dc542d1d9f5179f1b67062b9f0645b..d32d22d2e4d0d01b53a756fb9080a06dbfb48b1b 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page {
   /**
    * The price set is reserved or not.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isSetReserved = FALSE;
 
index bdf06ffc3631bd81d4930834d79758f7c6fbeb24..fd610f35c9e7d8a2718f51bd02e0b4240e8a0c0a 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page {
   /**
    * The price set is reserved or not.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_isSetReserved = FALSE;
 
index 8f9d42e64cfbe0fced172bd42723b425c35958d2..0ea100a3378cf2e695692c39399a8919fd90cbfb 100644 (file)
@@ -65,7 +65,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page {
   /**
    * Should we bypass permissions.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_skipPermission;
 
index ac36108f2a2bcb8d5caed82a4fdcf4be7ed16a8b..e92eb6641fe41972f18d5c84404c0d0e8802c573 100644 (file)
@@ -98,21 +98,21 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
   /**
    * Do we enable mapping of users.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_map;
 
   /**
    * Do we enable edit link.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_editLink;
 
   /**
    * Should we link to the UF Profile.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_linkToUF;
 
index de2e97635b089e5670415ffa4b7b8e6bf0c6057b..f866a92be52d8834a46ae9eef4769772f5e4dec8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Queue/QueueItem.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c9e273e55020d73d90150ef7d6e04312)
+ * (GenCodeChecksum:375c90f10f805de0cc712cad771cf15e)
  */
 
 /**
@@ -29,7 +29,7 @@ class CRM_Queue_DAO_QueueItem extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
index 1d5eae4979ed48eeb9d09a3ae47797f2b38cd512..45199eff782516dacaa414c8c1ccaa164e4cc4de 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Report/ReportInstance.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:08099952886e51709d4f1ecbd9feefaf)
+ * (GenCodeChecksum:22eeac140cc540874af36a422c548078)
  */
 
 /**
@@ -31,14 +31,14 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
   /**
    * Report Instance ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
   /**
    * Which Domain is this instance for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -101,21 +101,21 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
   /**
    * Is this entry active?
    *
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * FK to contact table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $created_id;
 
   /**
    * FK to contact table.
    *
-   * @var int unsigned
+   * @var int
    */
   public $owner_id;
 
@@ -157,19 +157,19 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
   /**
    * FK to navigation ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $navigation_id;
 
   /**
    * FK to instance ID drilldown to
    *
-   * @var int unsigned
+   * @var int
    */
   public $drilldown_id;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_reserved;
 
@@ -236,7 +236,7 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
         'title' => [
           'name' => 'title',
index e45e516d76032589513bfca85e7de0b93fa25438..f12c915cf7be624d5c9d49144aae7c5606e2809e 100644 (file)
@@ -49,14 +49,14 @@ class CRM_Report_Form extends CRM_Core_Form {
   /**
    * The id of the report instance
    *
-   * @var integer
+   * @var int
    */
   protected $_id;
 
   /**
    * The id of the report template
    *
-   * @var integer;
+   * @var int
    */
   protected $_templateID;
 
@@ -280,14 +280,15 @@ class CRM_Report_Form extends CRM_Core_Form {
    * when $_output mode is not 'html' or 'group' so as not to have to interpret / mess with that part
    * of the code (see limit() fn.
    *
-   * @var integer
+   * @var int
    */
   protected $_limitValue = NULL;
 
   /**
    * This can be set to specify row offset
    * See notes on _limitValue
-   * @var integer
+   *
+   * @var int
    */
   protected $_offsetValue = NULL;
   /**
@@ -300,14 +301,14 @@ class CRM_Report_Form extends CRM_Core_Form {
   /**
    * Flag to indicate if result-set is to be stored in a class variable which could be retrieved using getResultSet() method.
    *
-   * @var boolean
+   * @var bool
    */
   protected $_storeResultSet = FALSE;
 
   /**
    * When _storeResultSet Flag is set use this var to store result set in form of array
    *
-   * @var boolean
+   * @var bool
    */
   protected $_resultSet = [];
 
@@ -325,7 +326,7 @@ class CRM_Report_Form extends CRM_Core_Form {
 
   /**
    * Variables to hold the acl inner join and where clause
-   * @var string|NULL
+   * @var string|null
    */
   protected $_aclFrom = NULL;
   protected $_aclWhere = NULL;
@@ -358,7 +359,7 @@ class CRM_Report_Form extends CRM_Core_Form {
    *
    * (it's unclear if this could be merged with outputMode at this stage)
    *
-   * @var string|NULL
+   * @var string|null
    */
   protected $_format;
 
@@ -380,21 +381,24 @@ class CRM_Report_Form extends CRM_Core_Form {
   public $_havingClauses = [];
 
   /**
-   * DashBoardRowCount Dashboard row count
-   * @var Integer
+   * DashBoardRowCount Dashboard row count.
+   *
+   * @var int
    */
   public $_dashBoardRowCount;
 
   /**
    * Is this being called without a form controller (ie. the report is being render outside the normal form
-   * - e.g the api is retrieving the rows
-   * @var boolean
+   * - e.g the api is retrieving the rows.
+   *
+   * @var bool
    */
   public $noController = FALSE;
 
   /**
-   * Variable to hold the currency alias
-   * @var string|NULL
+   * Variable to hold the currency alias.
+   *
+   * @var string|null
    */
   protected $_currencyColumn = NULL;
 
@@ -419,33 +423,43 @@ class CRM_Report_Form extends CRM_Core_Form {
   public $_section;
 
   /**
-   * @var string Report description.
+   * Report description.
+   *
+   * @var string
    */
   public $_description;
 
   /**
-   * @var bool Is an address field selected.
+   * Is an address field selected.
+   *
+   * @var bool
    *   This was intended to determine if the address table should be joined in
    *   The isTableSelected function is now preferred for this purpose
    */
   protected $_addressField;
 
   /**
-   * @var bool Is an email field selected.
+   * Is an email field selected.
+   *
+   * @var bool
    *   This was intended to determine if the email table should be joined in
    *   The isTableSelected function is now preferred for this purpose
    */
   protected $_emailField;
 
   /**
-   * @var bool Is a phone field selected.
+   * Is a phone field selected.
+   *
+   * @var bool
    *   This was intended to determine if the phone table should be joined in
    *   The isTableSelected function is now preferred for this purpose
    */
   protected $_phoneField;
 
   /**
-   * @var bool Create new report instance? (or update existing) on save.
+   * Create new report instance? (or update existing) on save.
+   *
+   * @var bool
    */
   protected $_createNew;
 
@@ -453,12 +467,15 @@ class CRM_Report_Form extends CRM_Core_Form {
    *  When a grand total row has calculated the status we pop it off to here.
    *
    * This allows us to access it from the stats function and avoid recalculating.
+   *
    * @var array
    */
   protected $rollupRow = [];
 
   /**
-   * @var string Database attributes - character set and collation
+   * Database attributes - character set and collation.
+   *
+   * @var string
    */
   protected $_databaseAttributes = ' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci';
 
@@ -1164,7 +1181,7 @@ class CRM_Report_Form extends CRM_Core_Form {
    * @return string
    */
   public function createTemporaryTable($identifier, $sql, $isColumns = FALSE, $isMemory = FALSE) {
-    $tempTable = CRM_Utils_SQL_TempTable::build()->setUtf8();
+    $tempTable = CRM_Utils_SQL_TempTable::build();
     if ($isMemory) {
       $tempTable->setMemory();
     }
@@ -5631,7 +5648,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
         'type' => CRM_Utils_Type::T_INT,
         'no_display' => TRUE,
         'required' => TRUE,
-        'dbAlias' => '(address_civireport.street_number % 2)',
+        'dbAlias' => "({$tableAlias}_civireport.street_number % 2)",
         'is_fields' => TRUE,
         'is_order_bys' => TRUE,
       ],
index e8b7f84b47d2791dcd037f9feca24acb6e8910dc..e0b7588e36e64585b90b56814cff2841efb8a05e 100644 (file)
@@ -655,7 +655,6 @@ INNER JOIN  civicrm_custom_group cg ON ( cg.id = cf.custom_group_id )
         $fieldValueMap[$responseField->option_group_id][$responseField->value] = $value;
       }
     }
-    $responseField->free();
 
     //actual data formatting.
     $hasData = FALSE;
index 05d72b807f19a6a919f6c4893cbfa66c90d2491c..e6756091e169d3981d5e650b9bd4224d9c84d3a2 100644 (file)
@@ -133,6 +133,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
             'required' => TRUE,
             'no_display' => TRUE,
           ),
+          'contribution_page_id' => array(
+            'title' => ts('Contribution Page'),
+          ),
           'total_amount' => array(
             'title' => ts('Contribution Amount Stats'),
             'default' => TRUE,
@@ -157,6 +160,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
             'default' => array(1),
             'type' => CRM_Utils_Type::T_INT,
           ),
+          'contribution_page_id' => array(
+            'title' => ts('Contribution Page'),
+            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+            'options' => CRM_Contribute_PseudoConstant::contributionPage(),
+            'type' => CRM_Utils_Type::T_INT,
+          ),
           'currency' => array(
             'title' => ts('Currency'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
@@ -215,6 +224,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
             'default' => array(1),
             'type' => CRM_Utils_Type::T_INT,
           ),
+          'contribution_page_id' => array(
+            'title' => ts('Contribution Page'),
+            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+            'options' => CRM_Contribute_PseudoConstant::contributionPage(),
+            'type' => CRM_Utils_Type::T_INT,
+          ),
         ),
       ),
       'civicrm_financial_trxn' => array(
@@ -631,7 +646,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
 
     $contriSQL = "SELECT {$contriQuery} {$group} {$this->_having}";
     $contriDAO = CRM_Core_DAO::executeQuery($contriSQL);
-
+    $this->addToDeveloperTab($contriSQL);
     $totalAmount = $average = $mode = $median = $softTotalAmount = $softAverage = array();
     $count = $softCount = 0;
     while ($contriDAO->fetch()) {
@@ -655,6 +670,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
 
     if ($softCredit) {
       $softDAO = CRM_Core_DAO::executeQuery($softSQL);
+      $this->addToDeveloperTab($softSQL);
       while ($softDAO->fetch()) {
         $softTotalAmount[]
           = CRM_Utils_Money::format($softDAO->civicrm_contribution_soft_soft_amount_sum, $softDAO->currency) .
@@ -725,6 +741,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
    */
   public function buildRows($sql, &$rows) {
     $dao = CRM_Core_DAO::executeQuery($sql);
+    $this->addToDeveloperTab($sql);
     if (!is_array($rows)) {
       $rows = array();
     }
@@ -742,6 +759,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
       $this->customDataFrom();
       $contriSQL = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}";
       $contriDAO = CRM_Core_DAO::executeQuery($contriSQL);
+      $this->addToDeveloperTab($contriSQL);
       $contriFields = array(
         'civicrm_contribution_total_amount_sum',
         'civicrm_contribution_total_amount_avg',
@@ -847,6 +865,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
   public function alterDisplay(&$rows) {
     $entryFound = FALSE;
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
+    $contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
 
     foreach ($rows as $rowNum => $row) {
       // make count columns point to detail report
@@ -936,6 +955,11 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
         $entryFound = TRUE;
       }
 
+      if ($value = CRM_Utils_Array::value('civicrm_contribution_contribution_page_id', $row)) {
+        $rows[$rowNum]['civicrm_contribution_contribution_page_id'] = $contributionPages[$value];
+        $entryFound = TRUE;
+      }
+
       // If using campaigns, convert campaign_id to campaign title
       if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
         if ($value = $row['civicrm_contribution_campaign_id']) {
index 22c337eb8cecf035d9a868ea22da108d143c9535..3a2cb5f47f1b1dfc8c1bb49847ecb16aca3812db 100644 (file)
@@ -446,7 +446,6 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
       while ($dao->fetch()) {
         $contactIds[] = $dao->cid;
       }
-      $dao->free();
       $this->setPager();
     }
 
@@ -497,7 +496,6 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
           $contributionSum = 0;
         }
       }
-      $dao->free();
     }
     // format result set.
     $this->formatDisplay($rows, FALSE);
index bf62cd0f86499af2b2cf1432e8b1c6858aec20ce..81cc215fd663c3739eb7bc6e2fcbab9cefc07ea0 100644 (file)
@@ -78,7 +78,6 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
 
     $eventID = implode(',', $eventIDs);
 
-    $participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
     $participantRole = CRM_Event_PseudoConstant::participantRole();
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
 
@@ -90,15 +89,8 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
     if ($optionGroupDAO->find(TRUE)) {
       $optionGroupId = $optionGroupDAO->id;
     }
-    //show the income of active participant status (Counted = filter = 1)
-    $activeParticipantStatusIDArray = $activeParticipantStatusLabelArray = [];
-    foreach ($participantStatus as $id => $label) {
-      $activeParticipantStatusIDArray[] = $id;
-      $activeParticipantStatusLabelArray[] = $label;
-    }
-    $activeParticipantStatus = implode(',', $activeParticipantStatusIDArray);
-    $activeparticipnatStutusLabel = implode(', ', $activeParticipantStatusLabelArray);
-    $activeParticipantClause = " AND civicrm_participant.status_id IN ( $activeParticipantStatus ) ";
+
+    $activeParticipantClause = " AND civicrm_participant.status_id IN ( " . implode(',', array_keys($this->getActiveParticipantStatuses())) . " ) ";
     $select = [
       "civicrm_event.id as event_id",
       "civicrm_event.title as event_title",
@@ -133,7 +125,7 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
       $eventSummary[$eventDAO->event_id][ts('End Date')] = CRM_Utils_Date::customFormat($eventDAO->end_date);
       $eventSummary[$eventDAO->event_id][ts('Event Type')] = $eventDAO->event_type;
       $eventSummary[$eventDAO->event_id][ts('Event Income')] = CRM_Utils_Money::format($eventDAO->total, $eventDAO->currency);
-      $eventSummary[$eventDAO->event_id][ts('Registered Participant')] = "{$eventDAO->participant} ({$activeparticipnatStutusLabel})";
+      $eventSummary[$eventDAO->event_id][ts('Registered Participant')] = "{$eventDAO->participant} ({" . implode(', ', $this->getActiveParticipantStatuses()) . ")";
       $currency[$eventDAO->event_id] = $eventDAO->currency;
     }
     $this->assign_by_ref('summary', $eventSummary);
@@ -216,6 +208,7 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
 
     $statusDAO = $this->executeReportQuery($status);
 
+    $participantStatus = $this->getActiveParticipantStatuses();
     while ($statusDAO->fetch()) {
       $statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['total'] = $statusDAO->participant;
       $statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['round'] = round(($statusDAO->participant / $count[$statusDAO->event_id]) * 100, 2);
@@ -382,4 +375,13 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form {
     parent::endPostProcess();
   }
 
+  /**
+   * Get statuses with the counted filter set to TRUE.
+   *
+   * @return array
+   */
+  protected function getActiveParticipantStatuses() {
+    return CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
+  }
+
 }
diff --git a/CRM/Report/Form/Extended.php b/CRM/Report/Form/Extended.php
deleted file mode 100644 (file)
index 873665e..0000000
+++ /dev/null
@@ -1,1420 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
- * $Id$
- *
- */
-class CRM_Report_Form_Extended extends CRM_Report_Form {
-  protected $_addressField = FALSE;
-
-  protected $_emailField = FALSE;
-
-  protected $_summary = NULL;
-
-  protected $_customGroupExtends = [];
-  protected $_baseTable = 'civicrm_contact';
-
-  /**
-   *
-   */
-  public function __construct() {
-    parent::__construct();
-  }
-
-  /**
-   *
-   */
-  public function preProcess() {
-    parent::preProcess();
-  }
-
-  /**
-   *
-   */
-  public function select() {
-    parent::select();
-  }
-
-  /**
-   * From clause build where baseTable & fromClauses are defined
-   */
-  public function from() {
-    if (!empty($this->_baseTable)) {
-      $this->buildACLClause($this->_aliases['civicrm_contact']);
-      $this->_from = "FROM {$this->_baseTable}   {$this->_aliases[$this->_baseTable]}";
-      $availableClauses = $this->getAvailableJoins();
-      foreach ($this->fromClauses() as $fromClause) {
-        $fn = $availableClauses[$fromClause]['callback'];
-        $this->$fn();
-      }
-      if (strstr($this->_from, 'civicrm_contact')) {
-        $this->_from .= $this->_aclFrom;
-      }
-    }
-  }
-
-  /**
-   * Define any from clauses in use (child classes to override)
-   *
-   * @return array
-   */
-  public function fromClauses() {
-    return [];
-  }
-
-  public function groupBy() {
-    parent::groupBy();
-    //@todo - need to re-visit this - bad behaviour from pa
-    if ($this->_groupBy == 'GROUP BY') {
-      $this->_groupBY = NULL;
-    }
-    // if a stat field has been selected the do a group by
-    if (!empty($this->_statFields) && empty($this->_groupBy)) {
-      $this->_groupBy[] = $this->_aliases[$this->_baseTable] . ".id";
-    }
-    //@todo - this should be in the parent function or at parent level - perhaps build query should do this?
-    if (!empty($this->_groupBy) && is_array($this->_groupBy)) {
-      $this->_groupBy = 'GROUP BY ' . implode(',', $this->_groupBy);
-    }
-  }
-
-  public function orderBy() {
-    parent::orderBy();
-  }
-
-  /**
-   * @param array $rows
-   *
-   * @return array
-   */
-  public function statistics(&$rows) {
-    return parent::statistics($rows);
-  }
-
-  public function postProcess() {
-    if (!empty($this->_aclTable) && !empty($this->_aliases[$this->_aclTable])) {
-      $this->buildACLClause($this->_aliases[$this->_aclTable]);
-    }
-    parent::postProcess();
-  }
-
-  /**
-   * Alter display of rows.
-   *
-   * Iterate through the rows retrieved via SQL and make changes for display purposes,
-   * such as rendering contacts as links.
-   *
-   * @param array $rows
-   *   Rows generated by SQL, with an array for each row.
-   */
-  public function alterDisplay(&$rows) {
-    parent::alterDisplay($rows);
-
-    //THis is all generic functionality which can hopefully go into the parent class
-    // it introduces the option of defining an alter display function as part of the column definition
-    // @tod tidy up the iteration so it happens in this function
-    list($firstRow) = $rows;
-    // no result to alter
-    if (empty($firstRow)) {
-      return;
-    }
-    $selectedFields = array_keys($firstRow);
-
-    $alterfunctions = $altermap = [];
-    foreach ($this->_columns as $tablename => $table) {
-      if (array_key_exists('fields', $table)) {
-        foreach ($table['fields'] as $field => $specs) {
-          if (in_array($tablename . '_' . $field, $selectedFields) &&
-            array_key_exists('alter_display', $specs)
-          ) {
-            $alterfunctions[$tablename . '_' .
-            $field] = $specs['alter_display'];
-            $altermap[$tablename . '_' . $field] = $field;
-          }
-        }
-      }
-    }
-    if (empty($alterfunctions)) {
-      // - no manipulation to be done
-      return;
-    }
-
-    foreach ($rows as $index => & $row) {
-      foreach ($row as $selectedfield => $value) {
-        if (array_key_exists($selectedfield, $alterfunctions)) {
-          $rows[$index][$selectedfield] = $this->{$alterfunctions[$selectedfield]}($value, $row, $selectedfield, $altermap[$selectedfield]);
-        }
-      }
-    }
-  }
-
-  /**
-   * @return array
-   */
-  public function getLineItemColumns() {
-    return [
-      'civicrm_line_item' => [
-        'dao' => 'CRM_Price_BAO_LineItem',
-        'fields' => [
-          'qty' => [
-            'title' => ts('Quantity'),
-            'type' => CRM_Utils_Type::T_INT,
-            'statistics' => ['sum' => ts('Total Quantity Selected')],
-          ],
-          'unit_price' => [
-            'title' => ts('Unit Price'),
-          ],
-          'line_total' => [
-            'title' => ts('Line Total'),
-            'type' => CRM_Utils_Type::T_MONEY,
-            'statistics' => ['sum' => ts('Total of Line Items')],
-          ],
-        ],
-        'participant_count' => [
-          'title' => ts('Participant Count'),
-          'statistics' => ['sum' => ts('Total Participants')],
-        ],
-        'filters' => [
-          'qty' => [
-            'title' => ts('Quantity'),
-            'type' => CRM_Utils_Type::T_INT,
-            'operator' => CRM_Report_Form::OP_INT,
-          ],
-        ],
-        'group_bys' => [
-          'price_field_id' => [
-            'title' => ts('Price Field'),
-          ],
-          'price_field_value_id' => [
-            'title' => ts('Price Field Option'),
-          ],
-          'line_item_id' => [
-            'title' => ts('Individual Line Item'),
-            'name' => 'id',
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getPriceFieldValueColumns() {
-    return [
-      'civicrm_price_field_value' => [
-        'dao' => 'CRM_Price_BAO_PriceFieldValue',
-        'fields' => [
-          'price_field_value_label' => [
-            'title' => ts('Price Field Value Label'),
-            'name' => 'label',
-          ],
-        ],
-        'filters' => [
-          'price_field_value_label' => [
-            'title' => ts('Price Fields Value Label'),
-            'type' => CRM_Utils_Type::T_STRING,
-            'operator' => 'like',
-            'name' => 'label',
-          ],
-        ],
-        'order_bys' => [
-          'label' => [
-            'title' => ts('Price Field Value Label'),
-          ],
-        ],
-        //note that we have a requirement to group by label such that all 'Promo book' lines
-        'group_bys' =>
-        // are grouped together across price sets but there may be a separate need to group
-        // by id so that entries in one price set are distinct from others. Not quite sure what
-        // to call the distinction for end users benefit
-        [
-          'price_field_value_label' => [
-            'title' => ts('Price Field Value Label'),
-            'name' => 'label',
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getPriceFieldColumns() {
-    return [
-      'civicrm_price_field' => [
-        'dao' => 'CRM_Price_BAO_PriceField',
-        'fields' => [
-          'price_field_label' => [
-            'title' => ts('Price Field Label'),
-            'name' => 'label',
-          ],
-        ],
-        'filters' => [
-          'price_field_label' => [
-            'title' => ts('Price Field Label'),
-            'type' => CRM_Utils_Type::T_STRING,
-            'operator' => 'like',
-            'name' => 'label',
-          ],
-        ],
-        'order_bys' => [
-          'price_field_label' => [
-            'title' => ts('Price Field Label'),
-            'name' => 'label',
-          ],
-        ],
-        'group_bys' => [
-          'price_field_label' => [
-            'title' => ts('Price Field Label'),
-            'name' => 'label',
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getParticipantColumns() {
-    static $_events = [];
-    if (!isset($_events['all'])) {
-      CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
-    }
-    return [
-      'civicrm_participant' => [
-        'dao' => 'CRM_Event_DAO_Participant',
-        'fields' => [
-          'participant_id' => ['title' => ts('Participant ID')],
-          'participant_record' => [
-            'name' => 'id',
-            'title' => ts('Participant ID'),
-          ],
-          'event_id' => [
-            'title' => ts('Event ID'),
-            'type' => CRM_Utils_Type::T_STRING,
-            'alter_display' => 'alterEventID',
-          ],
-          'status_id' => [
-            'title' => ts('Status'),
-            'alter_display' => 'alterParticipantStatus',
-          ],
-          'role_id' => [
-            'title' => ts('Role'),
-            'alter_display' => 'alterParticipantRole',
-          ],
-          'participant_fee_level' => NULL,
-          'participant_fee_amount' => NULL,
-          'participant_register_date' => ['title' => ts('Registration Date')],
-        ],
-        'grouping' => 'event-fields',
-        'filters' => [
-          'event_id' => [
-            'name' => 'event_id',
-            'title' => ts('Event'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $_events['all'],
-          ],
-          'sid' => [
-            'name' => 'status_id',
-            'title' => ts('Participant Status'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'),
-          ],
-          'rid' => [
-            'name' => 'role_id',
-            'title' => ts('Participant Role'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Event_PseudoConstant::participantRole(),
-          ],
-          'participant_register_date' => [
-            'title' => ts('Registration Date'),
-            'operatorType' => CRM_Report_Form::OP_DATE,
-          ],
-        ],
-        'order_bys' => [
-          'event_id' => [
-            'title' => ts('Event'),
-            'default_weight' => '1',
-            'default_order' => 'ASC',
-          ],
-        ],
-        'group_bys' => [
-          'event_id' => ['title' => ts('Event')],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getMembershipColumns() {
-    return [
-      'civicrm_membership' => [
-        'dao' => 'CRM_Member_DAO_Membership',
-        'grouping' => 'member-fields',
-        'fields' => [
-          'membership_type_id' => [
-            'title' => ts('Membership Type'),
-            'required' => TRUE,
-            'alter_display' => 'alterMembershipTypeID',
-          ],
-          'status_id' => [
-            'title' => ts('Membership Status'),
-            'required' => TRUE,
-            'alter_display' => 'alterMembershipStatusID',
-          ],
-          'join_date' => NULL,
-          'start_date' => [
-            'title' => ts('Current Cycle Start Date'),
-          ],
-          'end_date' => [
-            'title' => ts('Current Membership Cycle End Date'),
-          ],
-        ],
-        'group_bys' => [
-          'membership_type_id' => [
-            'title' => ts('Membership Type'),
-          ],
-        ],
-        'filters' => [
-          'join_date' => [
-            'type' => CRM_Utils_Type::T_DATE,
-            'operatorType' => CRM_Report_Form::OP_DATE,
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getMembershipTypeColumns() {
-    return [
-      'civicrm_membership_type' => [
-        'dao' => 'CRM_Member_DAO_MembershipType',
-        'grouping' => 'member-fields',
-        'filters' => [
-          'gid' => [
-            'name' => 'id',
-            'title' => ts('Membership Types'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'type' => CRM_Utils_Type::T_INT + CRM_Utils_Type::T_ENUM,
-            'options' => CRM_Member_PseudoConstant::membershipType(),
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getEventColumns() {
-    return [
-      'civicrm_event' => [
-        'dao' => 'CRM_Event_DAO_Event',
-        'fields' => [
-          'id' => [
-            'no_display' => TRUE,
-            'required' => TRUE,
-          ],
-          'title' => [
-            'title' => ts('Event Title'),
-            'required' => TRUE,
-          ],
-          'event_type_id' => [
-            'title' => ts('Event Type'),
-            'required' => TRUE,
-            'alter_display' => 'alterEventType',
-          ],
-          'fee_label' => ['title' => ts('Fee Label')],
-          'event_start_date' => [
-            'title' => ts('Event Start Date'),
-          ],
-          'event_end_date' => ['title' => ts('Event End Date')],
-          'max_participants' => [
-            'title' => ts('Capacity'),
-            'type' => CRM_Utils_Type::T_INT,
-          ],
-        ],
-        'grouping' => 'event-fields',
-        'filters' => [
-          'event_type_id' => [
-            'name' => 'event_type_id',
-            'title' => ts('Event Type'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Core_OptionGroup::values('event_type'),
-          ],
-          'event_title' => [
-            'name' => 'title',
-            'title' => ts('Event Title'),
-            'operatorType' => CRM_Report_Form::OP_STRING,
-          ],
-        ],
-        'order_bys' => [
-          'event_type_id' => [
-            'title' => ts('Event Type'),
-            'default_weight' => '2',
-            'default_order' => 'ASC',
-          ],
-        ],
-        'group_bys' => [
-          'event_type_id' => [
-            'title' => ts('Event Type'),
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getContributionColumns() {
-    return [
-      'civicrm_contribution' => [
-        'dao' => 'CRM_Contribute_DAO_Contribution',
-        'fields' => [
-          'contribution_id' => [
-            'name' => 'id',
-          ],
-          'financial_type_id' => [
-            'title' => ts('Financial Type'),
-            'default' => TRUE,
-            'alter_display' => 'alterContributionType',
-          ],
-          'payment_instrument_id' => [
-            'title' => ts('Payment Method'),
-            'alter_display' => 'alterPaymentType',
-          ],
-          'source' => ['title' => ts('Contribution Source')],
-          'trxn_id' => NULL,
-          'receive_date' => ['default' => TRUE],
-          'receipt_date' => NULL,
-          'fee_amount' => NULL,
-          'net_amount' => NULL,
-          'total_amount' => [
-            'title' => ts('Amount'),
-            'statistics' => ['sum' => ts('Total Amount')],
-            'type' => CRM_Utils_Type::T_MONEY,
-          ],
-        ],
-        'filters' => [
-          'receive_date' => ['operatorType' => CRM_Report_Form::OP_DATE],
-          'financial_type_id' => [
-            'title' => ts('Financial Type'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Contribute_PseudoConstant::financialType(),
-          ],
-          'payment_instrument_id' => [
-            'title' => ts('Payment Type'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
-          ],
-          'contribution_status_id' => [
-            'title' => ts('Contribution Status'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
-          ],
-          'total_amount' => ['title' => ts('Contribution Amount')],
-        ],
-        'order_bys' => [
-          'payment_instrument_id' => [
-            'title' => ts('Payment Method'),
-          ],
-          'financial_type_id' => [
-            'title' => ts('Financial Type'),
-          ],
-        ],
-        'group_bys' => [
-          'financial_type_id' => ['title' => ts('Financial Type')],
-          'payment_instrument_id' => ['title' => ts('Payment Method')],
-          'contribution_id' => [
-            'title' => ts('Individual Contribution'),
-            'name' => 'id',
-          ],
-          'source' => ['title' => ts('Contribution Source')],
-        ],
-        'grouping' => 'contribution-fields',
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getContactColumns() {
-    return [
-      'civicrm_contact' => [
-        'dao' => 'CRM_Contact_DAO_Contact',
-        'fields' => [
-          'display_name' => [
-            'title' => ts('Contact Name'),
-          ],
-          'id' => [
-            'title' => ts('Contact ID'),
-            'alter_display' => 'alterContactID',
-          ],
-          'first_name' => [
-            'title' => ts('First Name'),
-          ],
-          'last_name' => [
-            'title' => ts('Last Name'),
-          ],
-          'nick_name' => [
-            'title' => ts('Nickname'),
-            'alter_display' => 'alterNickname',
-          ],
-        ],
-        'filters' => [
-          'id' => [
-            'title' => ts('Contact ID'),
-          ],
-          'sort_name' => [
-            'title' => ts('Contact Name'),
-          ],
-        ],
-        'grouping' => 'contact-fields',
-        'order_bys' => [
-          'sort_name' => [
-            'title' => ts('Last Name, First Name'),
-            'default' => '1',
-            'default_weight' => '0',
-            'default_order' => 'ASC',
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * @return array
-   */
-  public function getCaseColumns() {
-    return [
-      'civicrm_case' => [
-        'dao' => 'CRM_Case_DAO_Case',
-        'fields' => [
-          'id' => [
-            'title' => ts('Case ID'),
-            'required' => FALSE,
-          ],
-          'subject' => [
-            'title' => ts('Case Subject'),
-            'default' => TRUE,
-          ],
-          'status_id' => [
-            'title' => ts('Status'),
-            'default' => TRUE,
-          ],
-          'case_type_id' => [
-            'title' => ts('Case Type'),
-            'default' => TRUE,
-          ],
-          'case_start_date' => [
-            'title' => ts('Case Start Date'),
-            'name' => 'start_date',
-            'default' => TRUE,
-          ],
-          'case_end_date' => [
-            'title' => ts('Case End Date'),
-            'name' => 'end_date',
-            'default' => TRUE,
-          ],
-          'case_duration' => [
-            'name' => 'duration',
-            'title' => ts('Duration (Days)'),
-            'default' => FALSE,
-          ],
-          'case_is_deleted' => [
-            'name' => 'is_deleted',
-            'title' => ts('Case Deleted?'),
-            'default' => FALSE,
-            'type' => CRM_Utils_Type::T_INT,
-          ],
-        ],
-        'filters' => [
-          'case_start_date' => [
-            'title' => ts('Case Start Date'),
-            'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_DATE,
-            'name' => 'start_date',
-          ],
-          'case_end_date' => [
-            'title' => ts('Case End Date'),
-            'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_DATE,
-            'name' => 'end_date',
-          ],
-          'case_type_id' => [
-            'title' => ts('Case Type'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $this->case_types,
-          ],
-          'case_status_id' => [
-            'title' => ts('Case Status'),
-            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $this->case_statuses,
-            'name' => 'status_id',
-          ],
-          'case_is_deleted' => [
-            'title' => ts('Case Deleted?'),
-            'type' => CRM_Report_Form::OP_INT,
-            'operatorType' => CRM_Report_Form::OP_SELECT,
-            'options' => $this->deleted_labels,
-            'default' => 0,
-            'name' => 'is_deleted',
-          ],
-        ],
-      ],
-    ];
-  }
-
-  /**
-   * Get address columns to add to array.
-   *
-   * @param array $options
-   *   Options for the report.
-   *   - prefix prefix to add (e.g. 'honor' when getting address details for honor contact
-   *   - prefix_label optional prefix lable eg. "Honoree " for front end
-   *   - group_by enable these fields for group by - default false
-   *   - order_by enable these fields for order by
-   *   - filters enable these fields for filtering
-   *   - defaults - (is this working?) values to pre-populate
-   *
-   * @return array
-   *   address columns definition
-   */
-  public function getAddressColumns($options = []) {
-    $defaultOptions = [
-      'prefix' => '',
-      'prefix_label' => '',
-      'group_by' => FALSE,
-      'order_by' => TRUE,
-      'filters' => TRUE,
-      'defaults' => [
-        'country_id' => TRUE,
-      ],
-    ];
-
-    $options = array_merge($defaultOptions, $options);
-
-    $addressFields = [
-      $options['prefix'] . 'civicrm_address' => [
-        'dao' => 'CRM_Core_DAO_Address',
-        'name' => 'civicrm_address',
-        'alias' => $options['prefix'] . 'civicrm_address',
-        'fields' => [
-          $options['prefix'] . 'name' => [
-            'title' => ts($options['prefix_label'] . 'Address Name'),
-            'default' => CRM_Utils_Array::value('name', $options['defaults'], FALSE),
-            'name' => 'name',
-          ],
-          $options['prefix'] . 'street_address' => [
-            'title' => ts($options['prefix_label'] . 'Street Address'),
-            'default' => CRM_Utils_Array::value('street_address', $options['defaults'], FALSE),
-            'name' => 'street_address',
-          ],
-          $options['prefix'] . 'supplemental_address_1' => [
-            'title' => ts($options['prefix_label'] .
-              'Supplementary Address Field 1'),
-            'default' => CRM_Utils_Array::value('supplemental_address_1', $options['defaults'], FALSE),
-            'name' => 'supplemental_address_1',
-          ],
-          $options['prefix'] . 'supplemental_address_2' => [
-            'title' => ts($options['prefix_label'] .
-              'Supplementary Address Field 2'),
-            'default' => CRM_Utils_Array::value('supplemental_address_2', $options['defaults'], FALSE),
-            'name' => 'supplemental_address_2',
-          ],
-          $options['prefix'] . 'supplemental_address_3' => [
-            'title' => ts($options['prefix_label'] .
-              'Supplementary Address Field 3'),
-            'default' => CRM_Utils_Array::value('supplemental_address_3', $options['defaults'], FALSE),
-            'name' => 'supplemental_address_3',
-          ],
-          $options['prefix'] . 'street_number' => [
-            'name' => 'street_number',
-            'title' => ts($options['prefix_label'] . 'Street Number'),
-            'type' => 1,
-            'default' => CRM_Utils_Array::value('street_number', $options['defaults'], FALSE),
-          ],
-          $options['prefix'] . 'street_name' => [
-            'name' => 'street_name',
-            'title' => ts($options['prefix_label'] . 'Street Name'),
-            'type' => 1,
-            'default' => CRM_Utils_Array::value('street_name', $options['defaults'], FALSE),
-          ],
-          $options['prefix'] . 'street_unit' => [
-            'name' => 'street_unit',
-            'title' => ts($options['prefix_label'] . 'Street Unit'),
-            'type' => 1,
-            'default' => CRM_Utils_Array::value('street_unit', $options['defaults'], FALSE),
-          ],
-          $options['prefix'] . 'city' => [
-            'title' => ts($options['prefix_label'] . 'City'),
-            'default' => CRM_Utils_Array::value('city', $options['defaults'], FALSE),
-            'name' => 'city',
-          ],
-          $options['prefix'] . 'postal_code' => [
-            'title' => ts($options['prefix_label'] . 'Postal Code'),
-            'default' => CRM_Utils_Array::value('postal_code', $options['defaults'], FALSE),
-            'name' => 'postal_code',
-          ],
-          $options['prefix'] . 'county_id' => [
-            'title' => ts($options['prefix_label'] . 'County'),
-            'default' => CRM_Utils_Array::value('county_id', $options['defaults'], FALSE),
-            'alter_display' => 'alterCountyID',
-            'name' => 'county_id',
-          ],
-          $options['prefix'] . 'state_province_id' => [
-            'title' => ts($options['prefix_label'] . 'State/Province'),
-            'default' => CRM_Utils_Array::value('state_province_id', $options['defaults'], FALSE),
-            'alter_display' => 'alterStateProvinceID',
-            'name' => 'state_province_id',
-          ],
-          $options['prefix'] . 'country_id' => [
-            'title' => ts($options['prefix_label'] . 'Country'),
-            'default' => CRM_Utils_Array::value('country_id', $options['defaults'], FALSE),
-            'alter_display' => 'alterCountryID',
-            'name' => 'country_id',
-          ],
-        ],
-        'grouping' => 'location-fields',
-      ],
-    ];
-
-    if ($options['filters']) {
-      $addressFields[$options['prefix'] . 'civicrm_address']['filters'] = [
-        $options['prefix'] . 'street_number' => [
-          'title' => ts($options['prefix_label'] . 'Street Number'),
-          'type' => 1,
-          'name' => 'street_number',
-        ],
-        $options['prefix'] . 'street_name' => [
-          'title' => ts($options['prefix_label'] . 'Street Name'),
-          'name' => $options['prefix'] . 'street_name',
-          'operator' => 'like',
-        ],
-        $options['prefix'] . 'postal_code' => [
-          'title' => ts($options['prefix_label'] . 'Postal Code'),
-          'type' => 1,
-          'name' => 'postal_code',
-        ],
-        $options['prefix'] . 'city' => [
-          'title' => ts($options['prefix_label'] . 'City'),
-          'operator' => 'like',
-          'name' => 'city',
-        ],
-        $options['prefix'] . 'county_id' => [
-          'name' => 'county_id',
-          'title' => ts($options['prefix_label'] . 'County'),
-          'type' => CRM_Utils_Type::T_INT,
-          'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-          'options' => CRM_Core_PseudoConstant::county(),
-        ],
-        $options['prefix'] . 'state_province_id' => [
-          'name' => 'state_province_id',
-          'title' => ts($options['prefix_label'] . 'State/Province'),
-          'type' => CRM_Utils_Type::T_INT,
-          'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-          'options' => CRM_Core_PseudoConstant::stateProvince(),
-        ],
-        $options['prefix'] . 'country_id' => [
-          'name' => 'country_id',
-          'title' => ts($options['prefix_label'] . 'Country'),
-          'type' => CRM_Utils_Type::T_INT,
-          'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-          'options' => CRM_Core_PseudoConstant::country(),
-        ],
-      ];
-    }
-
-    if ($options['order_by']) {
-      $addressFields[$options['prefix'] .
-      'civicrm_address']['order_bys'] = [
-        $options['prefix'] . 'street_name' => [
-          'title' => ts($options['prefix_label'] . 'Street Name'),
-          'name' => 'street_name',
-        ],
-        $options['prefix'] . 'street_number' => [
-          'title' => ts($options['prefix_label'] . 'Odd / Even Street Number'),
-          'name' => 'street_number',
-        ],
-        $options['prefix'] . 'street_address' => [
-          'title' => ts($options['prefix_label'] . 'Street Address'),
-          'name' => 'street_address',
-        ],
-        $options['prefix'] . 'city' => [
-          'title' => ts($options['prefix_label'] . 'City'),
-          'name' => 'city',
-        ],
-        $options['prefix'] . 'postal_code' => [
-          'title' => ts($options['prefix_label'] . 'Post Code'),
-          'name' => 'postal_code',
-        ],
-      ];
-    }
-
-    if ($options['group_by']) {
-      $addressFields['civicrm_address']['group_bys'] = [
-        $options['prefix'] . 'street_address' => [
-          'title' => ts($options['prefix_label'] . 'Street Address'),
-          'name' => 'street_address',
-        ],
-        $options['prefix'] . 'city' => [
-          'title' => ts($options['prefix_label'] . 'City'),
-          'name' => 'city',
-        ],
-        $options['prefix'] . 'postal_code' => [
-          'title' => ts($options['prefix_label'] . 'Post Code'),
-          'name' => 'postal_code',
-        ],
-        $options['prefix'] . 'state_province_id' => [
-          'title' => ts($options['prefix_label'] . 'State/Province'),
-          'name' => 'state_province_id',
-        ],
-        $options['prefix'] . 'country_id' => [
-          'title' => ts($options['prefix_label'] . 'Country'),
-          'name' => 'country_id',
-        ],
-        $options['prefix'] . 'county_id' => [
-          'title' => ts($options['prefix_label'] . 'County'),
-          'name' => 'county_id',
-        ],
-      ];
-    }
-    return $addressFields;
-  }
-
-  /**
-   * Get Information about advertised Joins.
-   *
-   * @return array
-   */
-  public function getAvailableJoins() {
-    return [
-      'priceFieldValue_from_lineItem' => [
-        'leftTable' => 'civicrm_line_item',
-        'rightTable' => 'civicrm_price_field_value',
-        'callback' => 'joinPriceFieldValueFromLineItem',
-      ],
-      'priceField_from_lineItem' => [
-        'leftTable' => 'civicrm_line_item',
-        'rightTable' => 'civicrm_price_field',
-        'callback' => 'joinPriceFieldFromLineItem',
-      ],
-      'participant_from_lineItem' => [
-        'leftTable' => 'civicrm_line_item',
-        'rightTable' => 'civicrm_participant',
-        'callback' => 'joinParticipantFromLineItem',
-      ],
-      'contribution_from_lineItem' => [
-        'leftTable' => 'civicrm_line_item',
-        'rightTable' => 'civicrm_contribution',
-        'callback' => 'joinContributionFromLineItem',
-      ],
-      'membership_from_lineItem' => [
-        'leftTable' => 'civicrm_line_item',
-        'rightTable' => 'civicrm_membership',
-        'callback' => 'joinMembershipFromLineItem',
-      ],
-      'contribution_from_participant' => [
-        'leftTable' => 'civicrm_participant',
-        'rightTable' => 'civicrm_contribution',
-        'callback' => 'joinContributionFromParticipant',
-      ],
-      'contribution_from_membership' => [
-        'leftTable' => 'civicrm_membership',
-        'rightTable' => 'civicrm_contribution',
-        'callback' => 'joinContributionFromMembership',
-      ],
-      'membership_from_contribution' => [
-        'leftTable' => 'civicrm_contribution',
-        'rightTable' => 'civicrm_membership',
-        'callback' => 'joinMembershipFromContribution',
-      ],
-      'membershipType_from_membership' => [
-        'leftTable' => 'civicrm_membership',
-        'rightTable' => 'civicrm_membership_type',
-        'callback' => 'joinMembershipTypeFromMembership',
-      ],
-      'lineItem_from_contribution' => [
-        'leftTable' => 'civicrm_contribution',
-        'rightTable' => 'civicrm_line_item',
-        'callback' => 'joinLineItemFromContribution',
-      ],
-      'lineItem_from_membership' => [
-        'leftTable' => 'civicrm_membership',
-        'rightTable' => 'civicrm_line_item',
-        'callback' => 'joinLineItemFromMembership',
-      ],
-      'contact_from_participant' => [
-        'leftTable' => 'civicrm_participant',
-        'rightTable' => 'civicrm_contact',
-        'callback' => 'joinContactFromParticipant',
-      ],
-      'contact_from_membership' => [
-        'leftTable' => 'civicrm_membership',
-        'rightTable' => 'civicrm_contact',
-        'callback' => 'joinContactFromMembership',
-      ],
-      'contact_from_contribution' => [
-        'leftTable' => 'civicrm_contribution',
-        'rightTable' => 'civicrm_contact',
-        'callback' => 'joinContactFromContribution',
-      ],
-      'event_from_participant' => [
-        'leftTable' => 'civicrm_participant',
-        'rightTable' => 'civicrm_event',
-        'callback' => 'joinEventFromParticipant',
-      ],
-      'address_from_contact' => [
-        'leftTable' => 'civicrm_contact',
-        'rightTable' => 'civicrm_address',
-        'callback' => 'joinAddressFromContact',
-      ],
-    ];
-  }
-
-  /**
-   * Add join from contact table to address. Prefix will be added to both tables
-   * as it's assumed you are using it to get address of a secondary contact
-   *
-   * @param string $prefix
-   */
-  public function joinAddressFromContact($prefix = '') {
-    $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix .
-    'civicrm_address']}
-      ON {$this->_aliases[$prefix .
-    'civicrm_address']}.contact_id = {$this->_aliases[$prefix .
-    'civicrm_contact']}.id";
-  }
-
-  public function joinPriceFieldValueFromLineItem() {
-    $this->_from .= " LEFT JOIN civicrm_price_field_value {$this->_aliases['civicrm_price_field_value']}
-                          ON {$this->_aliases['civicrm_line_item']}.price_field_value_id = {$this->_aliases['civicrm_price_field_value']}.id";
-  }
-
-  public function joinPriceFieldFromLineItem() {
-    $this->_from .= "
-       LEFT JOIN civicrm_price_field {$this->_aliases['civicrm_price_field']}
-      ON {$this->_aliases['civicrm_line_item']}.price_field_id = {$this->_aliases['civicrm_price_field']}.id
-     ";
-  }
-
-  /**
-   * Define join from line item table to participant table.
-   */
-  public function joinParticipantFromLineItem() {
-    $this->_from .= " LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
-      ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_participant']}.id
-      AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant')
-    ";
-  }
-
-  /**
-   * Define join from line item table to Membership table. Seems to be still via contribution
-   * as the entity. Have made 'inner' to restrict does that make sense?
-   */
-  public function joinMembershipFromLineItem() {
-    $this->_from .= " INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
-      ON ( {$this->_aliases['civicrm_line_item']}.entity_id = {$this->_aliases['civicrm_contribution']}.id
-      AND {$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_contribution')
-      LEFT JOIN civicrm_membership_payment pp
-      ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
-      LEFT JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
-      ON pp.membership_id = {$this->_aliases['civicrm_membership']}.id
-    ";
-  }
-
-  /**
-   * Define join from Participant to Contribution table.
-   */
-  public function joinContributionFromParticipant() {
-    $this->_from .= " LEFT JOIN civicrm_participant_payment pp
-        ON {$this->_aliases['civicrm_participant']}.id = pp.participant_id
-        LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
-        ON pp.contribution_id = {$this->_aliases['civicrm_contribution']}.id
-      ";
-  }
-
-  /**
-   * Define join from Membership to Contribution table.
-   */
-  public function joinContributionFromMembership() {
-    $this->_from .= " LEFT JOIN civicrm_membership_payment pp
-        ON {$this->_aliases['civicrm_membership']}.id = pp.membership_id
-        LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
-        ON pp.contribution_id = {$this->_aliases['civicrm_contribution']}.id
-      ";
-  }
-
-  public function joinParticipantFromContribution() {
-    $this->_from .= " LEFT JOIN civicrm_participant_payment pp
-                          ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
-        LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
-                          ON pp.participant_id = {$this->_aliases['civicrm_participant']}.id";
-  }
-
-  public function joinMembershipFromContribution() {
-    $this->_from .= "
-       LEFT JOIN civicrm_membership_payment pp
-      ON {$this->_aliases['civicrm_contribution']}.id = pp.contribution_id
-      LEFT JOIN civicrm_membership {$this->_aliases['civicrm_membership']}
-      ON pp.membership_id = {$this->_aliases['civicrm_membership']}.id";
-  }
-
-  public function joinMembershipTypeFromMembership() {
-    $this->_from .= "
-       LEFT JOIN civicrm_membership_type {$this->_aliases['civicrm_membership_type']}
-      ON {$this->_aliases['civicrm_membership']}.membership_type_id = {$this->_aliases['civicrm_membership_type']}.id
-      ";
-  }
-
-  public function joinContributionFromLineItem() {
-
-    // this can be stored as a temp table & indexed for more speed. Not done at this state.
-    // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
-    $this->_from .= "  LEFT JOIN (SELECT line_item_civireport.id as lid, contribution_civireport_direct.*
-FROM civicrm_line_item line_item_civireport
-LEFT JOIN civicrm_contribution contribution_civireport_direct
-                       ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = contribution_civireport_direct.id AND line_item_civireport.entity_table = 'civicrm_contribution')
-
-
-WHERE  contribution_civireport_direct.id IS NOT NULL
-
-UNION SELECT line_item_civireport.id as lid, contribution_civireport.*
-  FROM civicrm_line_item line_item_civireport
-  LEFT JOIN civicrm_participant participant_civireport
-                          ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = participant_civireport.id AND line_item_civireport.entity_table = 'civicrm_participant')
-
-LEFT JOIN civicrm_participant_payment pp
-                          ON participant_civireport.id = pp.participant_id
-        LEFT JOIN civicrm_contribution contribution_civireport
-                          ON pp.contribution_id = contribution_civireport.id
-
-UNION SELECT line_item_civireport.id as lid,contribution_civireport.*
-  FROM civicrm_line_item line_item_civireport
-  LEFT JOIN civicrm_membership membership_civireport
-                          ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id =membership_civireport.id AND line_item_civireport.entity_table = 'civicrm_membership')
-
-LEFT JOIN civicrm_membership_payment pp
-                          ON membership_civireport.id = pp.membership_id
-        LEFT JOIN civicrm_contribution contribution_civireport
-                          ON pp.contribution_id = contribution_civireport.id
-) as {$this->_aliases['civicrm_contribution']}
-  ON {$this->_aliases['civicrm_contribution']}.lid = {$this->_aliases['civicrm_line_item']}.id
- ";
-  }
-
-  public function joinLineItemFromContribution() {
-
-    // this can be stored as a temp table & indexed for more speed. Not done at this stage.
-    // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
-    $this->_from .= "
-       LEFT JOIN (
-SELECT contribution_civireport_direct.id AS contid, line_item_civireport.*
-FROM civicrm_contribution contribution_civireport_direct
-LEFT JOIN civicrm_line_item line_item_civireport ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = contribution_civireport_direct.id AND line_item_civireport.entity_table = 'civicrm_contribution')
-WHERE line_item_civireport.id IS NOT NULL
-
-UNION
-SELECT contribution_civireport_direct.id AS contid, line_item_civireport.*
-FROM civicrm_contribution contribution_civireport_direct
-LEFT JOIN civicrm_participant_payment pp ON contribution_civireport_direct.id = pp.contribution_id
-LEFT JOIN civicrm_participant p ON pp.participant_id = p.id
-LEFT JOIN civicrm_line_item line_item_civireport ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = p.id AND line_item_civireport.entity_table = 'civicrm_participant')
-WHERE line_item_civireport.id IS NOT NULL
-
-UNION
-
-SELECT contribution_civireport_direct.id AS contid, line_item_civireport.*
-FROM civicrm_contribution contribution_civireport_direct
-LEFT JOIN civicrm_membership_payment pp ON contribution_civireport_direct.id = pp.contribution_id
-LEFT JOIN civicrm_membership p ON pp.membership_id = p.id
-LEFT JOIN civicrm_line_item line_item_civireport ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = p.id AND line_item_civireport.entity_table = 'civicrm_membership')
-WHERE   line_item_civireport.id IS NOT NULL
-) as {$this->_aliases['civicrm_line_item']}
-  ON {$this->_aliases['civicrm_line_item']}.contid = {$this->_aliases['civicrm_contribution']}.id
-
-
-  ";
-  }
-
-  public function joinLineItemFromMembership() {
-
-    // this can be stored as a temp table & indexed for more speed. Not done at this stage.
-    // another option is to cache it but I haven't tried to put that code in yet (have used it before for one hour caching
-    $this->_from .= "
-       LEFT JOIN (
-SELECT contribution_civireport_direct.id AS contid, line_item_civireport.*
-FROM civicrm_contribution contribution_civireport_direct
-LEFT JOIN civicrm_line_item line_item_civireport
-ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = contribution_civireport_direct.id AND line_item_civireport.entity_table = 'civicrm_contribution')
-
-WHERE   line_item_civireport.id IS NOT NULL
-
-UNION
-
-SELECT contribution_civireport_direct.id AS contid, line_item_civireport.*
-FROM civicrm_contribution contribution_civireport_direct
-LEFT JOIN civicrm_membership_payment pp ON contribution_civireport_direct.id = pp.contribution_id
-LEFT JOIN civicrm_membership p ON pp.membership_id = p.id
-LEFT JOIN civicrm_line_item line_item_civireport ON (line_item_civireport.line_total > 0 AND line_item_civireport.entity_id = p.id AND line_item_civireport.entity_table = 'civicrm_membership')
-WHERE   line_item_civireport.id IS NOT NULL
-) as {$this->_aliases['civicrm_line_item']}
-  ON {$this->_aliases['civicrm_line_item']}.contid = {$this->_aliases['civicrm_contribution']}.id
-  ";
-  }
-
-  public function joinContactFromParticipant() {
-    $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
-                          ON {$this->_aliases['civicrm_participant']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
-  }
-
-  public function joinContactFromMembership() {
-    $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
-                          ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
-  }
-
-  public function joinContactFromContribution() {
-    $this->_from .= " LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
-                          ON {$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
-  }
-
-  public function joinEventFromParticipant() {
-    $this->_from .= "  LEFT JOIN civicrm_event {$this->_aliases['civicrm_event']}
-                    ON ({$this->_aliases['civicrm_event']}.id = {$this->_aliases['civicrm_participant']}.event_id ) AND
-                       ({$this->_aliases['civicrm_event']}.is_template IS NULL OR
-                        {$this->_aliases['civicrm_event']}.is_template = 0)";
-  }
-
-  /**
-   * Retrieve text for financial type from pseudoconstant.
-   *
-   * @param $value
-   * @param array $row
-   *
-   * @return string
-   */
-  public function alterNickName($value, &$row) {
-    if (empty($row['civicrm_contact_id'])) {
-      return NULL;
-    }
-    $contactID = $row['civicrm_contact_id'];
-    return "<div id=contact-{$contactID} class='crm-entity'>
-           <span class='crm-editable crmf-nick_name crm-editable-enabled'>
-           " . $value . "</span></div>";
-  }
-
-  /**
-   * Retrieve text for contribution type from pseudoconstant.
-   *
-   * @param $value
-   * @param array $row
-   *
-   * @return array|string
-   */
-  public function alterContributionType($value, &$row) {
-    return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
-  }
-
-  /**
-   * Retrieve text for contribution status from pseudoconstant.
-   *
-   * @param $value
-   * @param array $row
-   *
-   * @return array
-   */
-  public function alterContributionStatus($value, &$row) {
-    return CRM_Contribute_PseudoConstant::contributionStatus($value);
-  }
-
-  /**
-   * Retrieve text for payment instrument from pseudoconstant.
-   *
-   * @param $value
-   * @param array $row
-   *
-   * @return array
-   */
-  public function alterEventType($value, &$row) {
-    return CRM_Event_PseudoConstant::eventType($value);
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   *
-   * @return array|string
-   */
-  public function alterEventID($value, &$row) {
-    return is_string(CRM_Event_PseudoConstant::event($value, FALSE)) ? CRM_Event_PseudoConstant::event($value, FALSE) : '';
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   *
-   * @return array|string
-   */
-  public function alterMembershipTypeID($value, &$row) {
-    return is_string(CRM_Member_PseudoConstant::membershipType($value, FALSE)) ? CRM_Member_PseudoConstant::membershipType($value, FALSE) : '';
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   *
-   * @return array|string
-   */
-  public function alterMembershipStatusID($value, &$row) {
-    return is_string(CRM_Member_PseudoConstant::membershipStatus($value, FALSE)) ? CRM_Member_PseudoConstant::membershipStatus($value, FALSE) : '';
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   * @param $selectedfield
-   * @param string $criteriaFieldName
-   *
-   * @return array
-   */
-  public function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
-    $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
-    $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield .
-    '_hover'] = ts("%1 for this country.", [1 => $value]);
-    $countries = CRM_Core_PseudoConstant::country($value, FALSE);
-    if (!is_array($countries)) {
-      return $countries;
-    }
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   * @param $selectedfield
-   * @param string $criteriaFieldName
-   *
-   * @return array
-   */
-  public function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
-    $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
-    $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield .
-    '_hover'] = ts("%1 for this county.", [1 => $value]);
-    $counties = CRM_Core_PseudoConstant::county($value, FALSE);
-    if (!is_array($counties)) {
-      return $counties;
-    }
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   * @param $selectedfield
-   * @param string $criteriaFieldName
-   *
-   * @return array
-   */
-  public function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
-    $url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
-    $row[$selectedfield . '_link'] = $url;
-    $row[$selectedfield .
-    '_hover'] = ts("%1 for this state.", [1 => $value]);
-
-    $states = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
-    if (!is_array($states)) {
-      return $states;
-    }
-  }
-
-  /**
-   * @param $value
-   * @param array $row
-   * @param string $fieldname
-   *
-   * @return mixed
-   */
-  public function alterContactID($value, &$row, $fieldname) {
-    $row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view",
-      'reset=1&cid=' . $value, $this->_absoluteUrl);
-    return $value;
-  }
-
-  /**
-   * @param $value
-   *
-   * @return array
-   */
-  public function alterParticipantStatus($value) {
-    if (empty($value)) {
-      return NULL;
-    }
-    return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
-  }
-
-  /**
-   * @param $value
-   *
-   * @return string|void
-   */
-  public function alterParticipantRole($value) {
-    if (empty($value)) {
-      return NULL;
-    }
-    $roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
-    $value = [];
-    foreach ($roles as $role) {
-      $value[$role] = CRM_Event_PseudoConstant::participantRole($role, FALSE);
-    }
-    return implode(', ', $value);
-  }
-
-  /**
-   * @param $value
-   *
-   * @return mixed
-   */
-  public function alterPaymentType($value) {
-    $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
-    return $paymentInstruments[$value];
-  }
-
-}
index 02d9b57309619b52a4eb924da9483d88a9398614..992ff2c082a95c8ddc66a411bef17e46cfd23c05 100644 (file)
@@ -178,6 +178,11 @@ class CRM_Report_Utils_Get {
         }
         break;
 
+      case 'nll':
+      case 'nnll':
+        $defaults["{$fieldName}_op"] = $fieldOP;
+        break;
+
       case 'in':
       case 'notin':
         // send the type as string so that multiple values can also be retrieved from url.
index 36da579b4f1c4f0abfa5a4952dba08ada39571e2..81a2b07603b8e2582f5e59ade15d5b9f92cf9f4b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/SMS/Provider.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a24ea48b652eba8827a5275a127df61e)
+ * (GenCodeChecksum:73f7f33374bc59a6251529cd2ba704cf)
  */
 
 /**
@@ -31,7 +31,7 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
   /**
    * SMS Provider ID
    *
-   * @var int unsigned
+   * @var int
    */
   public $id;
 
@@ -62,7 +62,7 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
   /**
    * points to value in civicrm_option_value for group sms_api_type
    *
-   * @var int unsigned
+   * @var int
    */
   public $api_type;
 
@@ -79,19 +79,19 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
   public $api_params;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_default;
 
   /**
-   * @var boolean
+   * @var bool
    */
   public $is_active;
 
   /**
    * Which Domain is this sms provider for
    *
-   * @var int unsigned
+   * @var int
    */
   public $domain_id;
 
@@ -284,7 +284,7 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO {
             'table' => 'civicrm_domain',
             'keyColumn' => 'id',
             'labelColumn' => 'name',
-          ]
+          ],
         ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
index 82c3e594ff900539cbd30368802f184e72e23ce2..4a1fdefb4fe56b7b30b1d575ccbb333cbdc3de1a 100644 (file)
@@ -67,8 +67,8 @@ class CRM_SMS_Form_Schedule extends CRM_Core_Form {
     $this->setAttribute('autocomplete', 'off');
 
     $sendOptions = [
-      $this->createElement('radio', NULL, NULL, 'Send immediately', 'send_immediate', ['id' => 'send_immediate', 'style' => 'margin-bottom: 10px;']),
-      $this->createElement('radio', NULL, NULL, 'Send at:', 'send_later', ['id' => 'send_later']),
+      $this->createElement('radio', NULL, NULL, ts('Send immediately'), 'send_immediate', ['id' => 'send_immediate', 'style' => 'margin-bottom: 10px;']),
+      $this->createElement('radio', NULL, NULL, ts('Send at:'), 'send_later', ['id' => 'send_later']),
     ];
     $this->addGroup($sendOptions, 'send_option', '', '<br>');
 
index c6b1557ca1d4d769010633c78722b08bdcf80e77..d6188fc8f0e19114386bfded29b8d3cc16903e87 100644 (file)
 class CRM_SMS_Message {
 
   /**
-   * @var String
    * What address is this SMS message coming from.
+   *
+   * @var string
    */
   public $from = '';
 
 
   /**
-   * @var String
    * What address is this SMS message going to.
+   *
+   * @var string
    */
   public $to = '';
 
   /**
-   * @var Integer
-   * Contact ID that is matched to the From address
+   * Contact ID that is matched to the From address.
+   *
+   * @var int
    */
   public $fromContactID = NULL;
 
   /**
-   * @var Integer
-   * Contact ID that is matched to the To address
+   * Contact ID that is matched to the To address.
+   *
+   * @var int
    */
   public $toContactID = NULL;
 
   /**
-   * @var String
-   * Body content of the message
+   * Body content of the message.
+   *
+   * @var string
    */
   public $body = '';
 
   /**
-   * @var Integer
-   * Trackable ID in the system to match to
+   * Trackable ID in the system to match to.
+   *
+   * @var int
    */
   public $trackID = NULL;
 
index 9086dfc0b17fd18b31fc925a853082886cc89f17..0f0eb5ecde4ca899bb752eb6bfea8cccaad2ad9e 100644 (file)
@@ -82,7 +82,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
    * Is this profile has searchable field.
    * or is any field having in selector true.
    *
-   * @var boolean.
+   * @var bool
    */
   protected $_hasSearchableORInSelector;
 
@@ -531,13 +531,8 @@ class CRM_UF_Form_Field extends CRM_Core_Form {
       $name = $this->_selectFields[$params['field_name'][1]];
     }
 
-    //Hack for Formatting Field Name
-    if ($params['field_name'][0] == 'Formatting') {
-      $fieldName = 'formatting_' . rand(1000, 9999);
-    }
-    else {
-      $fieldName = $params['field_name'][1];
-    }
+    // If field_name is missing, it's formatting
+    $fieldName = CRM_Utils_Array::value(1, $params['field_name'], 'formatting');
 
     //check for duplicate fields
     $apiFormattedParams = $params;
index 9a5dfbec8ab874c66cc66f32bf0994b15b0a3ee8..e9bf93e0f6732f6dd69abdc9bb8692d2f15e0da7 100644 (file)
@@ -449,8 +449,8 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
    */
   protected function getOtherModuleString() {
     $otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE, TRUE);
+    $otherModuleString = NULL;
     if (!empty($otherModules)) {
-      $otherModuleString = NULL;
       foreach ($otherModules as $key) {
         $otherModuleString .= " [ x ] <label>" . $key . "</label>";
       }
index 483125451f1d7e7e6117121bd174a753297f77c6..a8f62440b39b221dfd7077074518326d6a06e1ad 100644 (file)
@@ -60,7 +60,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
   /**
    * Upgrade for multilingual.
    *
-   * @var boolean
+   * @var bool
    */
   public $multilingual = FALSE;
 
index 1ee17e37e8568bc7c8df863d7f0e2708831aa0e6..48d8ed49ffbfea2b88c359512c3fceb15cf14d54 100644 (file)
@@ -149,19 +149,20 @@ class CRM_Upgrade_Incremental_Base {
    * @param string $column
    * @param string $properties
    * @param bool $localizable is this a field that should be localized
-   * @param string|NULL $version CiviCRM version to use if rebuilding multilingual schema
+   * @param string|null $version CiviCRM version to use if rebuilding multilingual schema
+   *
    * @return bool
    */
   public static function addColumn($ctx, $table, $column, $properties, $localizable = FALSE, $version = NULL) {
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     $queries = [];
-    if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, $column)) {
+    if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, $column, FALSE)) {
       if ($domain->locales) {
         if ($localizable) {
           $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
           foreach ($locales as $locale) {
-            if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, "{$column}_{$locale}")) {
+            if (!CRM_Core_BAO_SchemaHandler::checkIfFieldExists($table, "{$column}_{$locale}", FALSE)) {
               $queries[] = "ALTER TABLE `$table` ADD COLUMN `{$column}_{$locale}` $properties";
             }
           }
@@ -196,6 +197,29 @@ class CRM_Upgrade_Incremental_Base {
 
   }
 
+  /**
+   * Re-save any valid values from contribute settings into the normal setting
+   * format.
+   *
+   * We render the array of contribution_invoice_settings and any that have
+   * metadata defined we add to the correct key. This is safe to run even if no
+   * settings are to be converted, per the test in
+   * testConvertUpgradeContributeSettings.
+   *
+   * @param $ctx
+   *
+   * @return bool
+   */
+  public static function updateContributeSettings($ctx) {
+    $settings = Civi::settings()->get('contribution_invoice_settings');
+    $metadata = \Civi\Core\SettingsMetadata::getMetadata();
+    $conversions = array_intersect_key((array) $settings, $metadata);
+    foreach ($conversions as $key => $conversion) {
+      Civi::settings()->set($key, $conversion);
+    }
+    return TRUE;
+  }
+
   /**
    * Do any relevant smart group updates.
    *
@@ -258,7 +282,8 @@ class CRM_Upgrade_Incremental_Base {
   /**
    * Rebuild Multilingual Schema.
    * @param CRM_Queue_TaskContext $ctx
-   * @param string|NULL $version CiviCRM version to use if rebuilding multilingual schema
+   * @param string|null $version CiviCRM version to use if rebuilding multilingual schema
+   *
    * @return bool
    */
   public static function rebuildMultilingalSchema($ctx, $version = NULL) {
index 6bad3517082a500d747bf96107c7a376f0cc1f6e..b9179301f13096ceb10126d269461d132891c66d 100644 (file)
@@ -104,7 +104,7 @@ class CRM_Upgrade_Incremental_General {
       // ignore the matter and simply run CRM_Core_InnoDBIndexer::fixSchemaDifferences
       // after the upgrade.  But that's speculative.  For now, we'll leave this
       // advanced feature in the hands of the sysadmin.
-      $preUpgradeMessage .= '<br />' . ts('This database uses InnoDB Full Text Search for optimized searching. The upgrade procedure has not been tested with this feature. You should disable (and later re-enable) the feature by navigating to "Administer => System Settings => Miscellaneous".');
+      $preUpgradeMessage .= '<br />' . ts('This database uses InnoDB Full Text Search for optimized searching. The upgrade procedure has not been tested with this feature. You should disable (and later re-enable) the feature by navigating to "Administer => Customize Data and Screens => Search Preferences".');
     }
 
     $ftAclSetting = Civi::settings()->get('acl_financial_type');
diff --git a/CRM/Upgrade/Incremental/php/FiveFifteen.php b/CRM/Upgrade/Incremental/php/FiveFifteen.php
new file mode 100644 (file)
index 0000000..2cfb6a2
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 5                                                  |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007.                                       |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License along with this program; if not, contact CiviCRM LLC       |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Upgrade logic for FiveFifteen */
+class CRM_Upgrade_Incremental_php_FiveFifteen extends CRM_Upgrade_Incremental_Base {
+
+  /**
+   * Compute any messages which should be displayed beforeupgrade.
+   *
+   * Note: This function is called iteratively for each upcoming
+   * revision to the database.
+   *
+   * @param string $preUpgradeMessage
+   * @param string $rev
+   *   a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
+   * @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>';
+    // }
+  }
+
+  /**
+   * Compute any messages which should be displayed after upgrade.
+   *
+   * @param string $postUpgradeMessage
+   *   alterable.
+   * @param string $rev
+   *   an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
+   */
+  public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+    // Example: Generate a post-upgrade message.
+    // if ($rev == '5.12.34') {
+    //   $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
+    // }
+  }
+
+  /*
+   * Important! All upgrade functions MUST add a 'runSql' task.
+   * Uncomment and use the following template for a new upgrade version
+   * (change the x in the function name):
+   */
+
+  /**
+   * Upgrade function.
+   *
+   * @param string $rev
+   */
+  public function upgrade_5_15_alpha1($rev) {
+    $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+    $this->addTask('Fix errant deferred revenue settings', 'updateContributeSettings');
+  }
+
+}
index ad58a8a853ced0039ad7942ef70acc4ceca65230..97bca1d3700aec8132c7f742f793d529e6ac5135 100644 (file)
@@ -67,21 +67,40 @@ class CRM_Upgrade_Incremental_php_FiveFourteen extends CRM_Upgrade_Incremental_B
    * (change the x in the function name):
    */
 
-  //  /**
-  //   * Upgrade function.
-  //   *
-  //   * @param string $rev
-  //   */
-  //  public function upgrade_5_0_x($rev) {
-  //    $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
-  //    $this->addTask('Do the foo change', 'taskFoo', ...);
-  //    // Additional tasks here...
-  //    // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
-  //    // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
-  //  }
+  /**
+   * Upgrade function.
+   *
+   * @param string $rev
+   */
+  public function upgrade_5_14_alpha1($rev) {
+    $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
+
+    // Only need to rebuild view if CiviCase is enabled: otherwise will be
+    // rebuilt when component is enabled
+    $config = CRM_Core_Config::singleton();
+    if (in_array('CiviCase', $config->enableComponents)) {
+      $this->addTask('Rebuild case activity views', 'rebuildCaseActivityView', $rev);
+    }
+    // Additional tasks here...
+    // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
+    // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
+  }
 
-  // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
-  //   return TRUE;
-  // }
+  /**
+   * Rebuild the view of recent and upcoming case activities
+   *
+   * See https://github.com/civicrm/civicrm-core/pull/14086 and
+   * https://lab.civicrm.org/dev/core/issues/832
+   *
+   * @param CRM_Queue_TaskContext $ctx
+   * @return bool
+   */
+  public static function rebuildCaseActivityView($ctx) {
+    if (!CRM_Case_BAO_Case::createCaseViews()) {
+      CRM_Core_Error::debug_log_message(ts("Could not create the MySQL views for CiviCase. Your mysql user needs to have the 'CREATE VIEW' permission"));
+      return FALSE;
+    }
+    return TRUE;
+  }
 
 }
diff --git a/CRM/Upgrade/Incremental/sql/5.14.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.14.beta1.mysql.tpl
new file mode 100644 (file)
index 0000000..2e796c9
--- /dev/null
@@ -0,0 +1 @@
+{* file to handle db changes in 5.14.beta1 during upgrade *}
diff --git a/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl
new file mode 100644 (file)
index 0000000..8832251
--- /dev/null
@@ -0,0 +1 @@
+{* file to handle db changes in 5.15.alpha1 during upgrade *}
index 558ca34adb7ff157ca04ad43b869c070335432e0..c2c21dc1849a2222fced03049b4d99de5f7a1afa 100644 (file)
@@ -102,4 +102,24 @@ class CRM_Utils_AutoClean {
     \Civi\Core\Resolver::singleton()->call($this->callback, $this->args);
   }
 
+  /**
+   * Prohibit (de)serialization of CRM_Utils_AutoClean.
+   *
+   * The generic nature of AutoClean makes it a potential target for escalating
+   * serialization vulnerabilities, and there's no good reason for serializing it.
+   */
+  public function __sleep() {
+    throw new \RuntimeException("CRM_Utils_AutoClean is a runtime helper. It is not intended for serialization.");
+  }
+
+  /**
+   * Prohibit (de)serialization of CRM_Utils_AutoClean.
+   *
+   * The generic nature of AutoClean makes it a potential target for escalating
+   * serialization vulnerabilities, and there's no good reason for deserializing it.
+   */
+  public function __wakeup() {
+    throw new \RuntimeException("CRM_Utils_AutoClean is a runtime helper. It is not intended for deserialization.");
+  }
+
 }
index cbc58df44c1c91166aaf7ad0a84d6c1136ad823f..4ecc374275cf072277e5ff2a97b8c3115cc6427b 100644 (file)
@@ -303,6 +303,10 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
       );
     }
     else {
+      $cronLink = 'target="_blank" href="' . htmlentities(CRM_Utils_System::docURL2('sysadmin/setup/jobs/', TRUE)) . '""';
+      $msg .= '<p>' . ts('To enable scheduling support, please <a %1>set up the cron job</a>.', [
+        1 => $cronLink,
+      ]) . '</p>';
       $message = new CRM_Utils_Check_Message(
         __FUNCTION__,
         $msg,
@@ -310,11 +314,6 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
         ($lastCron > gmdate('U') - 86400) ? \Psr\Log\LogLevel::WARNING : \Psr\Log\LogLevel::ERROR,
         'fa-clock-o'
       );
-      $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(['resource' => 'wiki', 'page' => 'Managing Scheduled Jobs', 'URLonly' => TRUE]) . '""';
-      $message->addHelp(
-        ts('Configuring cron on your server is necessary for running scheduled jobs such as sending mail and scheduled reminders.') . '<br />' .
-        ts("Learn more in the <a %1>online documentation</a>.", [1 => $docUrl])
-      );
       $messages[] = $message;
     }
 
index b641a6b8849022d3494a660462e0c4404fd514ea..d8a435d004ab51c476bedf692a323a2e321fc8fa 100644 (file)
@@ -35,8 +35,8 @@ class CRM_Utils_Check_Component_FinancialTypeAcls extends CRM_Utils_Check_Compon
   public static function checkFinancialAclReport() {
     $messages = [];
     $ftAclSetting = Civi::settings()->get('acl_financial_type');
-    $financialAclExtension = civicrm_api3('extension', 'get', ['key' => 'biz.jmaconsulting.financialaclreport']);
-    if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['status'] != 'Installed') || $financialAclExtension['count'] !== 1)) {
+    $financialAclExtension = civicrm_api3('extension', 'get', ['key' => 'biz.jmaconsulting.financialaclreport', 'sequential' => 1]);
+    if ($ftAclSetting && (($financialAclExtension['count'] == 1 && $financialAclExtension['values'][0]['status'] != 'Installed') || $financialAclExtension['count'] !== 1)) {
       $messages[] = new CRM_Utils_Check_Message(
         __FUNCTION__,
         ts('CiviCRM will in the future require the extension %1 for CiviCRM Reports to work correctly with the Financial Type ACLs. The extension can be downloaded <a href="%2">here</a>', [
index b51905f71496dfb2ae0e9d56a922130476bd2322..efd0b79c6141a4e279011617bbc0ebcbf1840949 100644 (file)
@@ -1066,4 +1066,29 @@ HTACCESS;
     return FALSE;
   }
 
+  /**
+   * Get the extensions that this MimeTpe is for
+   * @param string $mimeType the mime-type we want extensions for
+   * @return array
+   */
+  public static function getAcceptableExtensionsForMimeType($mimeType = NULL) {
+    $mapping = \MimeType\Mapping::$types;
+    $extensions = [];
+    foreach ($mapping as $extension => $type) {
+      if ($mimeType == $type) {
+        $extensions[] = $extension;
+      }
+    }
+    return $extensions;
+  }
+
+  /**
+   * Get the extension of a file based on its path
+   * @param string $path path of the file to query
+   * @return string
+   */
+  public static function getExtensionFromPath($path) {
+    return pathinfo($path, PATHINFO_EXTENSION);
+  }
+
 }
index a47f3076d7f7fb8b10009033570498125f853c82..9a48148b9f1b81f42013f887814da337e4e1c893 100644 (file)
@@ -2217,6 +2217,24 @@ abstract class CRM_Utils_Hook {
     Civi::dispatcher()->dispatch('hook_civicrm_alterAngular', $event);
   }
 
+  /**
+   * This hook is called when building a link to a semi-static asset.
+   *
+   * @param string $asset
+   *   The name of the asset.
+   *   Ex: 'angular.json'
+   * @param array $params
+   *   List of optional arguments which influence the content.
+   * @return null
+   *   the return value is ignored
+   */
+  public static function getAssetUrl(&$asset, &$params) {
+    return self::singleton()->invoke(['asset', 'params'],
+      $asset, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_getAssetUrl'
+    );
+  }
+
   /**
    * This hook is called whenever the system builds a new copy of
    * semi-static asset.
@@ -2386,9 +2404,6 @@ abstract class CRM_Utils_Hook {
    * @param string $region
    */
   public static function coreResourceList(&$list, $region) {
-    // First allow the cms integration to add to the list
-    CRM_Core_Config::singleton()->userSystem->appendCoreResources($list);
-
     self::singleton()->invoke(['list', 'region'], $list, $region,
       self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
       'civicrm_coreResourceList'
index 50d72d38352e74e4d484241548f7464638a20c15..940128d7156c9487cd53d365c2b60faa2cc62a36 100644 (file)
@@ -488,6 +488,8 @@ class CRM_Utils_Rule {
    */
   public static function commaSeparatedIntegers($value) {
     foreach (explode(',', $value) as $val) {
+      // Remove any Whitespace around the key.
+      $val = trim($val);
       if (!self::positiveInteger($val)) {
         return FALSE;
       }
index 5433b17c416b14be12196782cd561306d6efb6a9..ad4cc452542ff3a811a37603ebcf41e5dbd15c04 100644 (file)
@@ -54,7 +54,7 @@
  *
  * Example 3: Create an empty temp table with list of columns.
  *
- * $tmpTbl = CRM_Utils_SQL_TempTable::build()->setDurable()->setUtf8()->createWithColumns('id int(10, name varchar(64)');
+ * $tmpTbl = CRM_Utils_SQL_TempTable::build()->setDurable()->createWithColumns('id int(10, name varchar(64)');
  *
  * Example 4: Drop a table that you previously created.
  *
@@ -105,8 +105,7 @@ class CRM_Utils_SQL_TempTable {
     $t->id = md5(uniqid('', TRUE));
     // The constant CIVICRM_TEMP_FORCE_DURABLE is for local debugging.
     $t->durable = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_DURABLE', FALSE);
-    // @deprecated This constant is deprecated and will be removed.
-    $t->utf8 = CRM_Utils_Constant::value('CIVICRM_TEMP_FORCE_UTF8', TRUE);
+    $t->utf8 = TRUE;
     $t->autodrop = FALSE;
     $t->memory = FALSE;
     return $t;
@@ -319,7 +318,9 @@ class CRM_Utils_SQL_TempTable {
   /**
    * Set table collation to UTF8.
    *
-   * This would make sense as a default but cautiousness during phasing in has made it opt-in.
+   * @deprecated This method is deprecated as tables should be assumed to have
+   * UTF-8 as the default character set and collation; some other character set
+   * or collation may be specified in the column definition.
    *
    * @param bool $value
    *
index 1ac8d03d0be294cc14ffbf11bf05597ab8051e4e..cdb29038368502df0ef4b20601d1cbae6ef3e136 100644 (file)
@@ -51,6 +51,8 @@
  * @method static int getLoggedInUfID() Get current logged in user id.
  * @method static setHttpHeader(string $name, string $value) Set http header.
  * @method static array synchronizeUsers() Create CRM contacts for all existing CMS users.
+ * @method static appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_coreResourceList.
+ * @method static alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_getAssetUrl.
  */
 class CRM_Utils_System {
 
@@ -214,8 +216,7 @@ class CRM_Utils_System {
     $print = FALSE,
     $maintenance = FALSE
   ) {
-    $config = &CRM_Core_Config::singleton();
-    return $config->userSystem->theme($content, $print, $maintenance);
+    return CRM_Core_Config::singleton()->userSystem->theme($content, $print, $maintenance);
   }
 
   /**
@@ -1385,7 +1386,7 @@ class CRM_Utils_System {
    * @return mixed
    */
   public static function formatDocUrl($url) {
-    return preg_replace('#^user/#', 'user/en/stable/', $url);
+    return preg_replace('#^(user|sysadmin|dev)/#', '\1/en/stable/', $url);
   }
 
   /**
@@ -1612,8 +1613,7 @@ class CRM_Utils_System {
     $addLanguagePart = TRUE,
     $removeLanguagePart = FALSE
   ) {
-    $config = &CRM_Core_Config::singleton();
-    return $config->userSystem->languageNegotiationURL($url, $addLanguagePart, $removeLanguagePart);
+    return CRM_Core_Config::singleton()->userSystem->languageNegotiationURL($url, $addLanguagePart, $removeLanguagePart);
   }
 
   /**
index 7a3589a250a6ed37f5e4fba32a78f17adf0263b4..9c22b6b86b332ba3e7008d38b945df1f89dadddd 100644 (file)
@@ -1042,11 +1042,11 @@ AND    u.status = 1
   /**
    * Append Backdrop CSS and JS to coreResourcesList.
    *
-   * @param array $list
+   * @param \Civi\Core\Event\GenericHookEvent $e
    */
-  public function appendCoreResources(&$list) {
-    $list[] = 'css/backdrop.css';
-    $list[] = 'js/crm.backdrop.js';
+  public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
+    $e->list[] = 'css/backdrop.css';
+    $e->list[] = 'js/crm.backdrop.js';
   }
 
 }
index bf6830d8e49f4c77c7a18e7e675adcc3afec0e20..2d8a81ca66f2a555d2b5ee74bade14d37a102e10 100644 (file)
@@ -254,10 +254,9 @@ abstract class CRM_Utils_System_Base {
     }
     $out = $content;
 
-    $config = &CRM_Core_Config::singleton();
     if (
       !$print &&
-      $config->userFramework == 'WordPress'
+      CRM_Core_Config::singleton()->userFramework == 'WordPress'
     ) {
       if (!function_exists('is_admin')) {
         throw new \Exception('Function "is_admin()" is missing, even though WordPress is the user framework.');
@@ -914,9 +913,17 @@ abstract class CRM_Utils_System_Base {
   /**
    * Append to coreResourcesList.
    *
-   * @param array $list
+   * @param \Civi\Core\Event\GenericHookEvent $e
    */
-  public function appendCoreResources(&$list) {
+  public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
+  }
+
+  /**
+   * Modify dynamic assets.
+   *
+   * @param \Civi\Core\Event\GenericHookEvent $e
+   */
+  public function alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) {
   }
 
   /**
index d34007e5478a70174d8439b8bbf5fec9c003b55c..b832eee6825c683b00b93aa53ce91dca7b3807d8 100644 (file)
@@ -300,19 +300,21 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
   ) {
     $query = html_entity_decode($query);
 
+    $config = CRM_Core_Config::singleton();
+    $base = $absolute ? $config->userFrameworkBaseURL : 'internal:/';
+
     $url = \Drupal\civicrm\CivicrmHelper::parseURL("{$path}?{$query}");
 
     // Not all links that CiviCRM generates are Drupal routes, so we use the weaker ::fromUri method.
     try {
-      $url = \Drupal\Core\Url::fromUri("base:{$url['path']}", [
+      $url = \Drupal\Core\Url::fromUri("{$base}{$url['path']}", array(
         'query' => $url['query'],
         'fragment' => $fragment,
         'absolute' => $absolute,
-      ])->toString();
+      ))->toString();
     }
     catch (Exception $e) {
-      // @Todo: log to watchdog
-      $url = '';
+      \Drupal::logger('civicrm')->error($e->getMessage());
     }
 
     // Special case: CiviCRM passes us "*path*?*query*" as a skeleton, but asterisks
@@ -657,7 +659,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
    */
   public function getCurrentLanguage() {
     // Drupal might not be bootstrapped if being called by the REST API.
-    if (!class_exists('Drupal')) {
+    if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
       return NULL;
     }
 
@@ -667,10 +669,94 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
   /**
    * Append Drupal8 js to coreResourcesList.
    *
-   * @param array $list
+   * @param \Civi\Core\Event\GenericHookEvent $e
+   */
+  public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
+    $e->list[] = 'js/crm.drupal8.js';
+  }
+
+  /**
+   * @inheritDoc
    */
-  public function appendCoreResources(&$list) {
-    $list[] = 'js/crm.drupal8.js';
+  public function setUFLocale($civicrm_language) {
+    $langcode = substr(str_replace('_', '', $civicrm_language), 0, 2);
+    $languageManager = \Drupal::languageManager();
+    $languages = $languageManager->getLanguages();
+
+    if (isset($languages[$langcode])) {
+      $languageManager->setConfigOverrideLanguage($languages[$langcode]);
+
+      // Config must be re-initialized to reset the base URL
+      // otherwise links will have the wrong language prefix/domain.
+      $config = CRM_Core_Config::singleton();
+      $config->free();
+
+      return TRUE;
+    }
+
+    return FALSE;
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
+    if (empty($url)) {
+      return $url;
+    }
+
+    // Drupal might not be bootstrapped if being called by the REST API.
+    if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
+      return NULL;
+    }
+
+    $language = $this->getCurrentLanguage();
+    if (\Drupal::service('module_handler')->moduleExists('language')) {
+      $config = \Drupal::config('language.negotiation')->get('url');
+
+      //does user configuration allow language
+      //support from the URL (Path prefix or domain)
+      $enabledLanguageMethods = \Drupal::config('language.types')->get('negotiation.language_interface.enabled') ?: [];
+      if (array_key_exists(\Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::METHOD_ID, $enabledLanguageMethods)) {
+        $urlType = $config['source'];
+
+        //url prefix
+        if ($urlType == \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::CONFIG_PATH_PREFIX) {
+          if (!empty($language)) {
+            if ($addLanguagePart && !empty($config['prefixes'][$language])) {
+              $url .= $config['prefixes'][$language] . '/';
+            }
+            if ($removeLanguagePart) {
+              $url = str_replace("/" . $config['prefixes'][$language] . "/", '/', $url);
+            }
+          }
+        }
+        //domain
+        if ($urlType == \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::CONFIG_DOMAIN) {
+          if (isset($language->domain) && $language->domain) {
+            if ($addLanguagePart) {
+              $url = (CRM_Utils_System::isSSL() ? 'https' : 'http') . '://' . $config['domains'][$language] . base_path();
+            }
+            if ($removeLanguagePart && defined('CIVICRM_UF_BASEURL')) {
+              $url = str_replace('\\', '/', $url);
+              $parseUrl = parse_url($url);
+
+              //kinda hackish but not sure how to do it right
+              //hope http_build_url() will help at some point.
+              if (is_array($parseUrl) && !empty($parseUrl)) {
+                $urlParts = explode('/', $url);
+                $hostKey = array_search($parseUrl['host'], $urlParts);
+                $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
+                $urlParts[$hostKey] = $ufUrlParts['host'];
+                $url = implode('/', $urlParts);
+              }
+            }
+          }
+        }
+      }
+    }
+
+    return $url;
   }
 
 }
index f98c794adfeb67ba1da04d1f9d80a16366fc2eb0..fa5b4e5b68c1833edb43122c42ec2dd9748876e0 100644 (file)
@@ -455,6 +455,12 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
       $instance->login($params);
     }
 
+    // Save details in Joomla session
+    $user = JFactory::getUser($uid);
+    $jsession = JFactory::getSession();
+    $jsession->set('user', $user);
+
+    // Save details in Civi session
     $session = CRM_Core_Session::singleton();
     $session->set('ufID', $uid);
     $session->set('userID', $contactID);
@@ -844,15 +850,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     }
   }
 
-  /**
-   * Append Joomla js to coreResourcesList.
-   *
-   * @param array $list
-   */
-  public function appendCoreResources(&$list) {
-    $list[] = 'js/crm.joomla.js';
-  }
-
   /**
    * @inheritDoc
    */
index a188cff50138da129756af4b7224843a06893aa3..a1a9c64fd3442faa8604b7f8f3f29e993cf585eb 100644 (file)
@@ -472,9 +472,6 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
 
     $name = CRM_Utils_Array::value('name', $params);
     $pass = CRM_Utils_Array::value('pass', $params);
-    if (isset($params['uid'])) {
-      throw new \RuntimeException("Not implemented WordPress::loadBootStrap([uid=>\$num]))");
-    }
 
     if (!defined('WP_USE_THEMES')) {
       define('WP_USE_THEMES', FALSE);
@@ -500,7 +497,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
       CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
     }
     require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-includes/pluggable.php';
-    $uid = CRM_Utils_Array::value('uid', $name);
+    $uid = CRM_Utils_Array::value('uid', $params);
     if (!$uid) {
       $name = $name ? $name : trim(CRM_Utils_Array::value('name', $_REQUEST));
       $pass = $pass ? $pass : trim(CRM_Utils_Array::value('pass', $_REQUEST));
@@ -801,10 +798,20 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
   /**
    * Append WP js to coreResourcesList.
    *
-   * @param array $list
+   * @param \Civi\Core\Event\GenericHookEvent $e
    */
-  public function appendCoreResources(&$list) {
-    $list[] = 'js/crm.wordpress.js';
+  public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
+    $e->list[] = 'js/crm.wordpress.js';
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) {
+    // Set menubar breakpoint to match WP admin theme
+    if ($e->asset == 'crm-menubar.css') {
+      $e->params['breakpoint'] = 783;
+    }
   }
 
   /**
index b40ece71e73d6efdf67948fd1862523870cecbaa..9a101002a50f6a2947d96001c525b8c0403dfaed 100644 (file)
@@ -115,4 +115,8 @@ class Request {
     return strtolower(\CRM_Utils_String::munge($action));
   }
 
+  public static function getNextId() {
+    return self::$nextId++;
+  }
+
 }
index 9e6dcbf91972951e223d38730e0b3e6729227879..b0666b03ba7901dbab094085f36f912e8830c2ab 100644 (file)
@@ -149,14 +149,14 @@ abstract class Mapping implements MappingInterface {
 
   /**
    * Date filter -- the field name.
-   * @var string|NULL
+   * @var string|null
    *   Ex: 'event_start_date'
    */
   private $entity_date_start;
 
   /**
    * Date filter -- the field name.
-   * @var string|NULL
+   * @var string|null
    *   Ex: 'event_end_date'.
    */
   private $entity_date_end;
index 181c8d2c9347323bce982b0ec4423dc4d94f8deb..f74479fb4685360be0be01adbb36a036f309f88f 100644 (file)
@@ -62,7 +62,7 @@ class AngularLoader {
   protected $modules;
 
   /**
-   * @var array|NULL
+   * @var array|null
    */
   protected $crmApp = NULL;
 
index f822d481d5c61cc938e43cea61dee36e5031ee42..5d019a0318e4c9e1869aab82d15c3ae9bfb4e2a8 100644 (file)
@@ -14,7 +14,9 @@ class Manager {
   protected $res = NULL;
 
   /**
-   * @var array|NULL
+   * Modules.
+   *
+   * @var array|null
    *   Each item has some combination of these keys:
    *   - ext: string
    *     The Civi extension which defines the Angular module.
index 1c2a447a58fe8592befebc8ad759a4f9fd31cc25..c844fd3cc04b2b9a31b7d13e5fd0233c0a0d6dbd 100644 (file)
@@ -37,7 +37,7 @@ class Main extends \CRM_Core_Page {
   /**
    * The region of the page into which JavaScript will be loaded.
    *
-   * @var String
+   * @var string
    * @deprecated
    */
   public $region;
index b60f41e20bcc10c58c531b4d4b42767106618c9a..a53be59402aacd8783be82c73e45c79f1e3f3453 100644 (file)
@@ -125,6 +125,8 @@ class AssetBuilder {
    *   Ex: 'http://example.org/files/civicrm/dyn/angular.abcd1234abcd1234.json'.
    */
   public function getUrl($name, $params = []) {
+    \CRM_Utils_Hook::getAssetUrl($name, $params);
+
     if (!$this->isValidName($name)) {
       throw new \RuntimeException("Invalid dynamic asset name");
     }
index 201111773ad0fa6a036d7e7c91bb37fad6c5814e..9ce531d1bb776fc3ad3994afe6e9c98a2435afdf 100644 (file)
@@ -321,6 +321,8 @@ class Container {
     $dispatcher->addListener('hook_civicrm_buildAsset', ['\CRM_Utils_VisualBundle', 'buildAssetJs']);
     $dispatcher->addListener('hook_civicrm_buildAsset', ['\CRM_Utils_VisualBundle', 'buildAssetCss']);
     $dispatcher->addListener('hook_civicrm_buildAsset', ['\CRM_Core_Resources', 'renderMenubarStylesheet']);
+    $dispatcher->addListener('hook_civicrm_coreResourceList', ['\CRM_Utils_System', 'appendCoreResources']);
+    $dispatcher->addListener('hook_civicrm_getAssetUrl', ['\CRM_Utils_System', 'alterAssetUrl']);
     $dispatcher->addListener('civi.dao.postInsert', ['\CRM_Core_BAO_RecurringEntity', 'triggerInsert']);
     $dispatcher->addListener('civi.dao.postUpdate', ['\CRM_Core_BAO_RecurringEntity', 'triggerUpdate']);
     $dispatcher->addListener('civi.dao.postDelete', ['\CRM_Core_BAO_RecurringEntity', 'triggerDelete']);
index 86d48bbb791e713400f320fc7fb0791a055127dd..d2f742ad405323748c1440d9042499210d56244b 100644 (file)
@@ -70,7 +70,7 @@ class SettingsBag {
    * The result of combining default values, mandatory
    * values, and user values.
    *
-   * @var array|NULL
+   * @var array|null
    *   Array(string $settingName => mixed $value).
    */
   protected $combined;
index 1954404ca3812cc1ee8cd2009a721826392a639a..f8873174679783908acf4e143a5b18517a075420 100644 (file)
@@ -80,7 +80,7 @@ class SettingsManager {
   protected $bagsByContact = [];
 
   /**
-   * @var array|NULL
+   * @var array|null
    *   Array(string $entity => array(string $settingName => mixed $value)).
    *   Ex: $mandatory['domain']['uploadDir'].
    *   NULL means "autoload from $civicrm_setting".
index 00d04d34215c39bde99cb5a66a0990faafc9440e..5ff1bf3bf82772bd5405389cc0e1fe4b5f0b7916 100644 (file)
@@ -33,8 +33,6 @@ namespace Civi\Core;
  */
 class SettingsMetadata {
 
-  const ALL = 'all';
-
   /**
    * WARNING: This interface may change.
    *
@@ -53,6 +51,7 @@ class SettingsMetadata {
    *
    * @param array $filters
    * @param int $domainID
+   * @param bool $loadOptions
    *
    * @return array
    *   the following information as appropriate for each setting
@@ -64,37 +63,31 @@ class SettingsMetadata {
    *   - is_contact
    *   - description
    *   - help_text
+   *   - options
+   *   - pseudoconstant
    */
-  public static function getMetadata($filters = [], $domainID = NULL) {
+  public static function getMetadata($filters = [], $domainID = NULL, $loadOptions = FALSE) {
     if ($domainID === NULL) {
       $domainID = \CRM_Core_Config::domainID();
     }
 
     $cache = \Civi::cache('settings');
     $cacheString = 'settingsMetadata_' . $domainID . '_';
-    // the caching into 'All' seems to be a duplicate of caching to
-    // settingsMetadata__ - I think the reason was to cache all settings as defined & then those altered by a hook
     $settingsMetadata = $cache->get($cacheString);
-    $cached = is_array($settingsMetadata);
-
-    if (!$cached) {
-      $settingsMetadata = $cache->get(self::ALL);
-      if (empty($settingsMetadata)) {
-        global $civicrm_root;
-        $metaDataFolders = [$civicrm_root . '/settings'];
-        \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
-        $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
-        $cache->set(self::ALL, $settingsMetadata);
-      }
-    }
-
-    \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL);
 
-    if (!$cached) {
+    if (!is_array($settingsMetadata)) {
+      global $civicrm_root;
+      $metaDataFolders = [$civicrm_root . '/settings'];
+      \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
+      $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
+      \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL);
       $cache->set($cacheString, $settingsMetadata);
     }
 
     self::_filterSettingsSpecification($filters, $settingsMetadata);
+    if ($loadOptions) {
+      self::loadOptions($settingsMetadata);
+    }
 
     return $settingsMetadata;
   }
@@ -145,20 +138,41 @@ class SettingsMetadata {
    *   Metadata to filter.
    */
   protected static function _filterSettingsSpecification($filters, &$settingSpec) {
-    if (empty($filters)) {
-      return;
-    }
-    elseif (array_keys($filters) == ['name']) {
-      $settingSpec = [$filters['name'] => \CRM_Utils_Array::value($filters['name'], $settingSpec, '')];
-      return;
+    if (!empty($filters['name'])) {
+      $settingSpec = array_intersect_key($settingSpec, array_flip((array) $filters['name']));
+      // FIXME: This is a workaround for settingsBag::setDb() called by unit tests with settings names that don't exist
+      $settingSpec += array_fill_keys((array) $filters['name'], []);
+      unset($filters['name']);
     }
-    else {
+    if (!empty($filters)) {
       foreach ($settingSpec as $field => $fieldValues) {
         if (array_intersect_assoc($fieldValues, $filters) != $filters) {
           unset($settingSpec[$field]);
         }
       }
-      return;
+    }
+  }
+
+  /**
+   * Retrieve options from settings metadata
+   *
+   * @param array $settingSpec
+   */
+  protected static function loadOptions(&$settingSpec) {
+    foreach ($settingSpec as &$spec) {
+      if (empty($spec['pseudoconstant'])) {
+        continue;
+      }
+      // It would be nice if we could leverage CRM_Core_PseudoConstant::get() somehow,
+      // but it's tightly coupled to DAO/field. However, if you really need to support
+      // more pseudoconstant types, then probably best to refactor it. For now, KISS.
+      if (!empty($spec['pseudoconstant']['callback'])) {
+        $spec['options'] = Resolver::singleton()->call($spec['pseudoconstant']['callback'], []);
+      }
+      elseif (!empty($spec['pseudoconstant']['optionGroupName'])) {
+        $keyColumn = \CRM_Utils_Array::value('keyColumn', $spec['pseudoconstant'], 'value');
+        $spec['options'] = \CRM_Core_OptionGroup::values($spec['pseudoconstant']['optionGroupName'], FALSE, FALSE, TRUE, NULL, 'label', TRUE, FALSE, $keyColumn);
+      }
     }
   }
 
index ce54d184489930bde232f96f77aae3cd98c8f1f0..809b2dd960e23c25e41f03b8d837dde323b55ece 100644 (file)
@@ -38,7 +38,7 @@ class SqlTriggers {
   /**
    * The name of the output file.
    *
-   * @var string|NULL
+   * @var string|null
    */
   private $file = NULL;
 
index 7d8fd3821c4ecacaa2595cb6be6eb027b10b39bb..e7c9581106cbbe902167211a8b4d886d4c28ea43 100644 (file)
@@ -613,6 +613,7 @@ class Requirements {
       return $results;
     }
 
+    mysqli_query($conn, 'DROP TABLE IF EXISTS civicrm_utf8mb4_test');
     $r = mysqli_query($conn, 'CREATE TABLE civicrm_utf8mb4_test (id VARCHAR(255), PRIMARY KEY(id(255))) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC ENGINE=INNODB');
     if (!$r) {
       $results['severity'] = $this::REQUIREMENT_WARNING;
@@ -620,7 +621,7 @@ class Requirements {
       mysqli_close($conn);
       return $results;
     }
-    mysqli_query('DROP TABLE civicrm_utf8mb4_test');
+    mysqli_query($conn, 'DROP TABLE civicrm_utf8mb4_test');
 
     // Ensure that the MySQL driver supports utf8mb4 encoding.
     $version = mysqli_get_client_info($conn);
index 91fc4b767885ffca337ad7891292ab438d5c582a..767d34033a814f3de3072fabb884d91bb149f9d8 100644 (file)
@@ -22,7 +22,7 @@ class CiviEnvBuilder {
   private $steps = [];
 
   /**
-   * @var string|NULL
+   * @var string|null
    *   A digest of the values in $steps.
    */
   private $targetSignature = NULL;
index 448231bb197312cd3cea3bb6ada85c8a758c6625..7bc10624ce860dfbc19e856ba743add9d05095ba 100644 (file)
@@ -89,6 +89,7 @@ trait ContactTestTrait {
    *
    * @return int
    *   id of Household created
+   * @throws \Exception
    */
   public function householdCreate($params = array(), $seq = 0) {
     $params = array_merge($this->sampleContact('Household', $seq), $params);
similarity index 100%
rename from agpl-3.0.txt
rename to LICENSE
index aac6f77a391b7bef32c9b9bd2e9ffb38b2d851e7..f378f641c7f49a5c20401d69d581ded98f07dfd2 100644 (file)
           text: ts('Submit final mailing'),
           icons: {primary: 'fa-paper-plane'},
           click: function() {
-            crmMailingMgr.mergeInto(abtest.mailings.c, abtest.mailings[mailingName], [
-              'name',
-              'recipients',
-              'scheduled_date'
-            ]);
-            crmStatus({start: ts('Saving...'), success: ''}, abtest.save())
-              .then(function() {
-                return crmStatus({start: ts('Submitting...'), success: ts('Submitted')},
-                  abtest.submitFinal().then(function(r) {
-                    delete abtest.$CrmMailingABReportCnt;
-                    return r;
-                  }));
-              })
-              .then(function() {
+            crmStatus({start: ts('Submitting...'), success: ts('Submitted')},
+              abtest.submitFinal(abtest.mailings[mailingName].id).then(function (r) {
+                delete abtest.$CrmMailingABReportCnt;
+              }))
+              .then(function () {
                 dialogService.close('selectWinnerDialog', abtest);
               });
           }
index 447909c4a30d9956c6bb10c9dffd0dfe30bd767c..2e9fa9260bd0233ee78dcfe40aef114c00e51f3d 100644 (file)
       // Schedule the final mailing
       // @return Promise CrmMailingAB
       // Note: Submission may cause the server state to change. Consider abtest.submit().then(...abtest.load()...)
-      submitFinal: function submitFinal() {
+      submitFinal: function submitFinal(winner_id) {
         var crmMailingAB = this;
         var params = {
           id: this.ab.id,
           status: 'Final',
+          winner_id: winner_id,
           approval_date: 'now',
           scheduled_date: this.mailings.c.scheduled_date ? this.mailings.c.scheduled_date : 'now'
         };
index 0dd232dd637c5a56f2060f80b4b9eb5ce19e99f0..a8563fd0c1deaf17e41c8357eecc4b8cfbce051d 100644 (file)
         registerGlobalListener($injector);
 
         options.format = options.format || 'json';
-        var fmt = formats[options.format];
+        var fmt = _.clone(formats[options.format]);
         if (options.deep) {
           fmt.watcher = '$watch';
         }
         if (options.default === undefined) {
           options.default = fmt.default;
         }
-        var _scope = this;
+        var value,
+          _scope = this,
+          $route = $injector.get('$route'),
+          $timeout = $injector.get('$timeout');
 
-        var $route = $injector.get('$route'), $timeout = $injector.get('$timeout');
-
-        var value;
         if (options.param in $route.current.params) {
           value = fmt.decode($route.current.params[options.param]);
         }
         // Keep the URL bar up-to-date.
         _scope[fmt.watcher](options.expr, function (newValue) {
           var encValue = fmt.encode(newValue);
-          if ($route.current.params[options.param] === encValue) return;
+          if (!_.isEqual(newValue, options.default) && $route.current.params[options.param] === encValue) {
+            return;
+          }
 
           pendingUpdates = pendingUpdates || {};
           pendingUpdates[options.param] = encValue;
           var p = angular.extend({}, $route.current.params, pendingUpdates);
-          angular.forEach(ignorable, function(v,k){ if (p[k] === v) delete p[k]; });
+
+          angular.forEach(ignorable, function(v, k) {
+            if (p[k] === v) {
+              delete p[k];
+            }
+          });
+
+          // Remove params from url if they equal their defaults
+          if (_.isEqual(newValue, options.default)) {
+            p[options.param] = null;
+          }
+
           $route.updateParams(p);
 
           if (activeTimer) $timeout.cancel(activeTimer);
index ff9ac1258c5bdb18d4644c059a356f9bd612988c..4aa31a9da1baaa80b73205193ca0855023052516 100644 (file)
@@ -300,6 +300,7 @@ function _civicrm_api3_activity_get_spec(&$params) {
 function civicrm_api3_activity_get($params) {
   $options = _civicrm_api3_get_options_from_params($params, FALSE, 'Activity', 'get');
   $sql = CRM_Utils_SQL_Select::fragment();
+  _civicrm_activity_get_handleSourceContactNameOrderBy($params, $options, $sql);
 
   _civicrm_api3_activity_get_extraFilters($params, $sql);
 
@@ -336,6 +337,41 @@ function civicrm_api3_activity_get($params) {
   return civicrm_api3_create_success($activities, $params, 'Activity', 'get');
 }
 
+/**
+ * Handle source_contact_name as a sort parameter.
+ *
+ * This is passed from the activity selector - e.g search results or contact tab.
+ *
+ * It's a non-standard handling but this api already handles variations on handling source_contact
+ * as a filter & as a field so it's in keeping with that. Source contact has a one-one relationship
+ * with activity table.
+ *
+ * Test coverage in CRM_Activity_BAO_ActivtiyTest::testGetActivitiesforContactSummaryWithSortOptions
+ *
+ * @param array $params
+ * @param array $options
+ * @param CRM_Utils_SQL_Select $sql
+ */
+function _civicrm_activity_get_handleSourceContactNameOrderBy(&$params, &$options, $sql) {
+  $sourceContactID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source');
+  if (!empty($options['sort']) && in_array($options['sort'], [
+      'source_contact_name',
+      'source_contact_name desc',
+      'source_contact_name asc'
+    ])) {
+    $order = substr($options['sort'], -4) === 'desc' ? 'desc' : 'asc';
+    $sql->join(
+      'source_contact',
+      "LEFT JOIN
+      civicrm_activity_contact ac ON (ac.activity_id = a.id AND record_type_id = #sourceContactID)
+       LEFT JOIN civicrm_contact c ON c.id = ac.contact_id",
+      ['sourceContactID' => $sourceContactID]
+    );
+    $sql->orderBy("c.display_name $order");
+    unset($options['sort'], $params['options']['sort']);
+  }
+}
+
 /**
  * Support filters beyond what basic_get can do.
  *
@@ -608,8 +644,10 @@ function _civicrm_api3_activity_fill_activity_contact_names(&$activities, $param
       'activity_id',
       'record_type_id',
       'contact_id.display_name',
+      'contact_id.sort_name',
       'contact_id',
     ],
+    'options' => ['limit' => 0],
     'check_permissions' => !empty($params['check_permissions']),
   ];
   if (count($activityContactTypes) < 3) {
@@ -622,10 +660,12 @@ function _civicrm_api3_activity_fill_activity_contact_names(&$activities, $param
     if (in_array($recordType, ['target', 'assignee'])) {
       $activities[$activityContact['activity_id']][$recordType . '_contact_id'][] = $contactID;
       $activities[$activityContact['activity_id']][$recordType . '_contact_name'][$contactID] = isset($activityContact['contact_id.display_name']) ? $activityContact['contact_id.display_name'] : '';
+      $activities[$activityContact['activity_id']][$recordType . '_contact_sort_name'][$contactID] = isset($activityContact['contact_id.sort_name']) ? $activityContact['contact_id.sort_name'] : '';
     }
     else {
       $activities[$activityContact['activity_id']]['source_contact_id'] = $contactID;
       $activities[$activityContact['activity_id']]['source_contact_name'] = isset($activityContact['contact_id.display_name']) ? $activityContact['contact_id.display_name'] : '';
+      $activities[$activityContact['activity_id']]['source_contact_sort_name'] = isset($activityContact['contact_id.sort_name']) ? $activityContact['contact_id.sort_name'] : '';
     }
   }
 }
index c88419ccb40b0ebd3226d3867079b0bc2795674c..6dfb1c81383a37cc8b2930a345fe11b7279c8ff8 100644 (file)
@@ -432,7 +432,7 @@ function civicrm_api3_generic_getoptions($apiRequest) {
   // Validate 'context' from params
   $context = CRM_Utils_Array::value('context', $apiRequest['params']);
   CRM_Core_DAO::buildOptionsContext($context);
-  unset($apiRequest['params']['context'], $apiRequest['params']['field']);
+  unset($apiRequest['params']['context'], $apiRequest['params']['field'], $apiRequest['params']['condition']);
 
   $baoName = _civicrm_api3_get_BAO($apiRequest['entity']);
   $options = $baoName::buildOptions($fieldName, $context, $apiRequest['params']);
index 86139b2d2fee7f0531dba33a4ef695fac5acda6d..aec00c43d0cd076583867ea5f1645d554d42c9ec 100644 (file)
@@ -573,18 +573,26 @@ function civicrm_api3_mailing_preview($params) {
   $returnProperties = $mailing->getReturnProperties();
   $contactID = CRM_Utils_Array::value('contact_id', $params);
   if (!$contactID) {
-    $contactID = $session->get('userID');
+    // If we still don't have a userID in a session because we are annon then set contactID to be 0
+    $contactID = empty($session->get('userID')) ? 0 : $session->get('userID');
   }
   $mailingParams = ['contact_id' => $contactID];
 
-  $details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
+  if (!$contactID) {
+    $details = CRM_Utils_Token::getAnonymousTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
+    $details = CRM_Utils_Array::value(0, $details[0]);
+  }
+  else {
+    $details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());
+    $details = $details[0][$contactID];
+  }
 
-  $mime = $mailing->compose(NULL, NULL, NULL, $session->get('userID'), $fromEmail, $fromEmail,
-    TRUE, $details[0][$contactID], $attachments
+  $mime = $mailing->compose(NULL, NULL, NULL, $contactID, $fromEmail, $fromEmail,
+    TRUE, $details, $attachments
   );
 
   return civicrm_api3_create_success([
-    'id' => $params['id'],
+    'id' => $mailingID,
     'contact_id' => $contactID,
     'subject' => $mime->headers()['Subject'],
     'body_html' => $mime->getHTMLBody(),
index 077b8bf2d44a1aa987c35e7cf327e7920aab3101..ab3bafe58456f105ddd3c96ebc9ff2ed009290e5 100644 (file)
@@ -93,6 +93,13 @@ function _civicrm_api3_mailing_a_b_submit_spec(&$spec) {
   $spec['approval_date'] = $mailingFields['approval_date'];
   $spec['approval_status_id'] = $mailingFields['approval_status_id'];
   $spec['approval_note'] = $mailingFields['approval_note'];
+  $spec['winner_id'] = [
+    'name' => 'winner_id',
+    'type' => 1,
+    'title' => 'Winner ID',
+    'description' => 'The experimental mailing with the best results. If specified, values are copied to the final mailing.',
+    'localizable' => 0,
+  ];
   // Note: we'll pass through approval_* fields to the underlying mailing, but they may be ignored
   // if the user doesn't have suitable permission. If separate approvals are required, they must be provided
   // outside the A/B Test UI.
@@ -149,6 +156,9 @@ function civicrm_api3_mailing_a_b_submit($params) {
       if ($dao->status != 'Testing') {
         throw new API_Exception("Cannot transition to state 'Final'");
       }
+      if (!empty($params['winner_id'])) {
+        _civicrm_api3_mailing_a_b_fill_winner($params['winner_id'], $dao->mailing_id_c);
+      }
       civicrm_api3('Mailing', 'submit', $submitParams + [
         'id' => $dao->mailing_id_c,
         '_skip_evil_bao_auto_recipients_' => 1,
@@ -168,6 +178,56 @@ function civicrm_api3_mailing_a_b_submit($params) {
   ]);
 }
 
+/**
+ * @param int $winner_id
+ *   The experimental mailing chosen as the "winner".
+ * @param int $final_id
+ *   The final mailing which should imitate the "winner".
+ * @throws \API_Exception
+ */
+function _civicrm_api3_mailing_a_b_fill_winner($winner_id, $final_id) {
+  $copyFields = [
+    // 'id',
+    // 'name',
+    'campaign_id',
+    'from_name',
+    'from_email',
+    'replyto_email',
+    'subject',
+    'dedupe_email',
+    // 'recipients',
+    'body_html',
+    'body_text',
+    'footer_id',
+    'header_id',
+    'visibility',
+    'url_tracking',
+    'dedupe_email',
+    'forward_replies',
+    'auto_responder',
+    'open_tracking',
+    'override_verp',
+    'optout_id',
+    'reply_id',
+    'resubscribe_id',
+    'unsubscribe_id'
+  ];
+  $f = CRM_Utils_SQL_Select::from('civicrm_mailing')
+    ->where('id = #id', ['id' => $winner_id])
+    ->select($copyFields)
+    ->execute()
+    ->fetchAll();
+  if (count($f) !== 1) {
+    throw new API_Exception('Invalid winner_id');
+  }
+  foreach ($f as $winner) {
+    civicrm_api3('Mailing', 'create', $winner + [
+      'id' => $final_id,
+      '_skip_evil_bao_auto_recipients_' => 1,
+    ]);
+  }
+}
+
 /**
  * Adjust Metadata for graph_stats action.
  *
index 69367bf6f0878c6ee49e1b4d0c5a53c80e15c6bd..bab232ab49453c767b99a2feb32fbc62c648f395 100644 (file)
@@ -104,15 +104,20 @@ function civicrm_api3_payment_cancel(&$params) {
     'financial_trxn_id' => $params['id'],
   ];
   $entity = civicrm_api3('EntityFinancialTrxn', 'getsingle', $eftParams);
-  $contributionId = $entity['entity_id'];
-  $params['total_amount'] = $entity['amount'];
-  unset($params['id']);
 
-  $trxn = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionId, $params, 'refund', NULL, FALSE);
+  $paymentParams = [
+    'total_amount' => -$entity['amount'],
+    'contribution_id' => $entity['entity_id'],
+    'trxn_date' => CRM_Utils_Array::value('trxn_date', $params, 'now'),
+  ];
 
-  $values = [];
-  _civicrm_api3_object_to_array_unique_fields($trxn, $values[$trxn->id]);
-  return civicrm_api3_create_success($values, $params, 'Payment', 'cancel', $trxn);
+  foreach (['trxn_id', 'payment_instrument_id'] as $permittedParam) {
+    if (isset($params[$permittedParam])) {
+      $paymentParams[$permittedParam] = $params[$permittedParam];
+    }
+  }
+  $result = civicrm_api3('Payment', 'create', $paymentParams);
+  return civicrm_api3_create_success($result['values'], $params, 'Payment', 'cancel');
 }
 
 /**
@@ -169,6 +174,10 @@ function _civicrm_api3_payment_create_spec(&$params) {
       'type' => CRM_Utils_Type::T_INT,
       'api.aliases' => ['payment_id'],
     ],
+    'trxn_date' => [
+      'title' => 'Cancel Date',
+      'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
+    ],
   ];
 }
 
@@ -233,6 +242,10 @@ function _civicrm_api3_payment_cancel_spec(&$params) {
       'type' => CRM_Utils_Type::T_INT,
       'api.aliases' => ['payment_id'],
     ],
+    'trxn_date' => [
+      'title' => 'Cancel Date',
+      'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
+    ],
   ];
 }
 
index e7d2338c254f9859b9130045d5d3a37f1d67b9ee..a7ce04b76fcd4356bdd4268096e20674851b1897 100644 (file)
@@ -148,33 +148,14 @@ function _civicrm_api3_setting_getdefaults_spec(&$params) {
  * @throws \API_Exception
  */
 function civicrm_api3_setting_getoptions($params) {
-  $specs = CRM_Core_BAO_Setting::getSettingSpecification();
+  $domainId = CRM_Utils_Array::value('domain_id', $params);
+  $specs = \Civi\Core\SettingsMetadata::getMetadata(['name' => $params['field']], $domainId, TRUE);
 
-  if (empty($specs[$params['field']]) || empty($specs[$params['field']]['pseudoconstant'])) {
+  if (empty($specs[$params['field']]) || !is_array(CRM_Utils_Array::value('options', $specs[$params['field']]))) {
     throw new API_Exception("The field '" . $params['field'] . "' has no associated option list.");
   }
 
-  $pseudoconstant = $specs[$params['field']]['pseudoconstant'];
-
-  // It would be nice if we could leverage CRM_Core_PseudoConstant::get() somehow,
-  // but it's tightly coupled to DAO/field. However, if you really need to support
-  // more pseudoconstant types, then probably best to refactor it. For now, KISS.
-  if (!empty($pseudoconstant['callback'])) {
-    $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], []);
-    return civicrm_api3_create_success($values, $params, 'Setting', 'getoptions');
-  }
-  elseif (!empty($pseudoconstant['optionGroupName'])) {
-    $keyColumn = 'value';
-    if (!empty($pseudoconstant['keyColumn'])) {
-      $keyColumn = $pseudoconstant['keyColumn'];
-    }
-    return civicrm_api3_create_success(
-      CRM_Core_OptionGroup::values($pseudoconstant['optionGroupName'], FALSE, FALSE, TRUE, NULL, 'label', TRUE, FALSE, $keyColumn),
-      $params, 'Setting', 'getoptions'
-    );
-  }
-
-  throw new API_Exception("The field '" . $params['field'] . "' uses an unsupported option list.");
+  return civicrm_api3_create_success($specs[$params['field']]['options'], $params, 'Setting', 'getoptions');
 }
 
 /**
index bac0826f5cd3db9dc791b891cd3aa6e3ce642b78..1e5d3836401b77ab01d0542f76d143cd3dda0e5b 100644 (file)
@@ -2338,6 +2338,11 @@ function _civicrm_api3_api_match_pseudoconstant_value(&$value, $options, $fieldN
     return;
   }
 
+  // Hack for Profile formatting fields
+  if ($fieldName === 'field_name' && (strpos($value, 'formatting') === 0)) {
+    return;
+  }
+
   // Translate value into key
   // Cast $value to string to avoid a bug in array_search
   $newValue = array_search((string) $value, $options);
index aa609d30807205321e430b329d4f2fd56a87a7e2..8cdcc9e8e7c101e1b0fe151881a0b3e7ebaf2f01 100644 (file)
@@ -146,7 +146,7 @@ class civicrm_cli {
     // of this script
     array_shift($args);
 
-    while (list($k, $arg) = each($args)) {
+    foreach ($args as $k => $arg) {
       // sanitize all user input
       $arg = $this->_sanitize($arg);
 
index b970b3e9ada7cdee86e1684673f56d0332942401..c4aaaa21526f2fdbdf86aca5ca65d78e68520987 100644 (file)
@@ -18,7 +18,7 @@
     "d3-3.5.x": "d3#~3.5.17",
     "dc-2.1.x": "dc.js#~2.1.8",
     "crossfilter-1.3.x": "crossfilter2#~1.3.11",
-    "jquery": "~1.12",
+    "jquery": "civicrm/jquery#1.12.4-civicrm-1.1",
     "jquery-ui": "~1.12",
     "lodash-compat": "~3.0",
     "google-code-prettify": "~1.0",
@@ -35,6 +35,7 @@
     "es6-promise": "^4.2.4"
   },
   "resolutions": {
-    "angular": "~1.5.11"
+    "angular": "~1.5.11",
+    "jquery": "1.12.4-civicrm-1.1"
   }
 }
index fb0a9154945ff3c3c0388a21c8235ce3b9b5dede..3a3f0bbae495a893ad3e0b76e0342c38c5b2210d 100644 (file)
@@ -61,7 +61,7 @@
     "psr/simple-cache": "~1.0.1",
     "cweagans/composer-patches": "~1.0",
     "pear/log": "1.13.1",
-    "ezyang/htmlpurifier": "4.10"
+    "katzien/php-mime-type": "2.1.0"
   },
   "scripts": {
     "post-install-cmd": [
index 4e2fd42aa8fef4683b1ede4a4b3d0acbefb22ff2..86281bc7f02a7a2e9eae97d9eea82b09bdbaed25 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "93a9f686f7eb00fb9d766d262eedb09b",
+    "content-hash": "a786aecfcc51b68f1ebafb0f43f99d08",
     "packages": [
         {
             "name": "civicrm/civicrm-cxn-rpc",
             "homepage": "http://code.google.com/p/phpquery/",
             "time": "2013-03-21T12:39:33+00:00"
         },
-        {
-            "name": "ezyang/htmlpurifier",
-            "version": "v4.10.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/ezyang/htmlpurifier.git",
-                "reference": "d85d39da4576a6934b72480be6978fb10c860021"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021",
-                "reference": "d85d39da4576a6934b72480be6978fb10c860021",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.2"
-            },
-            "require-dev": {
-                "simpletest/simpletest": "^1.1"
-            },
-            "type": "library",
-            "autoload": {
-                "psr-0": {
-                    "HTMLPurifier": "library/"
-                },
-                "files": [
-                    "library/HTMLPurifier.composer.php"
-                ]
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "LGPL"
-            ],
-            "authors": [
-                {
-                    "name": "Edward Z. Yang",
-                    "email": "admin@htmlpurifier.org",
-                    "homepage": "http://ezyang.com"
-                }
-            ],
-            "description": "Standards compliant HTML filter written in PHP",
-            "homepage": "http://htmlpurifier.org/",
-            "keywords": [
-                "html"
-            ],
-            "time": "2018-02-23T01:58:20+00:00"
-        },
         {
             "name": "guzzlehttp/guzzle",
             "version": "6.3.0",
             ],
             "time": "2017-03-20T17:10:46+00:00"
         },
+        {
+            "name": "katzien/php-mime-type",
+            "version": "2.1.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/katzien/PhpMimeType.git",
+                "reference": "159dfbdcd5906442f3dad89951127f0b9dfa3b78"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/katzien/PhpMimeType/zipball/159dfbdcd5906442f3dad89951127f0b9dfa3b78",
+                "reference": "159dfbdcd5906442f3dad89951127f0b9dfa3b78",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "5.*",
+                "satooshi/php-coveralls": "1.*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "MimeType\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Kat Zien"
+                }
+            ],
+            "description": "A PHP library to detect the mime type of files.",
+            "homepage": "https://github.com/katzien/PhpMimeType",
+            "keywords": [
+                "mimetype",
+                "php"
+            ],
+            "time": "2017-03-23T02:05:33+00:00"
+        },
         {
             "name": "marcj/topsort",
             "version": "1.1.0",
         },
         {
             "name": "tecnickcom/tcpdf",
-            "version": "6.2.13",
+            "version": "6.2.26",
             "source": {
                 "type": "git",
                 "url": "https://github.com/tecnickcom/TCPDF.git",
-                "reference": "95c5938aafe4b20df1454dbddb3e5005c0b26f64"
+                "reference": "367241059ca166e3a76490f4448c284e0a161f15"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/95c5938aafe4b20df1454dbddb3e5005c0b26f64",
-                "reference": "95c5938aafe4b20df1454dbddb3e5005c0b26f64",
+                "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/367241059ca166e3a76490f4448c284e0a161f15",
+                "reference": "367241059ca166e3a76490f4448c284e0a161f15",
                 "shasum": ""
             },
             "require": {
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
-                "LGPLv3"
+                "LGPL-3.0"
             ],
             "authors": [
                 {
                     "name": "Nicola Asuni",
                     "email": "info@tecnick.com",
-                    "homepage": "http://nicolaasuni.tecnick.com"
+                    "role": "lead"
                 }
             ],
             "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
                 "pdf417",
                 "qrcode"
             ],
-            "time": "2017-04-26T08:14:48+00:00"
+            "time": "2018-10-16T17:24:05+00:00"
         },
         {
             "name": "totten/ca-config",
index 04f67c359e1d9791d4b19f4a9c9e95363c77a60c..53ff04dbb41e3bfcf2af7e37543573cd44e8d2a0 100644 (file)
 
 - github      : demeritcowboy
   name        : Dave D
-  jira        : demeritcowboy
+  jira        : Dave D
 
 - github      : dereklewis123
   name        : Derek Lewis
   organization: Greenleaf Advancement
   jira        : guyiac
 
+- github      : GValFr35
+
+- github      : kewljuice
+  name        : Wouter Hechtermans
+  organization: Calibrate
+
+- github      : khorporative
+  name        : Aivars
+
 - github      : h-c-c
   name        : Peter Hartmann
   organization: Hartmann Computer Consulting
 
 - github      : pfigel
   name        : Patrick Figel
-  organization: GreenPeace Central and Eastern Europe
+  organization: Greenpeace CEE
 
 - github      : philmck
   name        : Phil McKerracher
   organization: Web Access
   jira        : pratiksha
 
+- github      : prondubuisi
+  name        : Onyemenam Ndubuisi
+
 - name        : Richard Edgar
   jira        : redgar
 
index 89b486963e872b54b53d406649d14ae1d1dad6ea..dc2a4e7937116fb9734a60a776eb21d90d2a9a0c 100644 (file)
@@ -131,7 +131,7 @@ input#crm-qsearch-input {
   border: 1px solid #ccc;
   margin: 4px 4px 0;
   padding: 2px 8px;
-  height: 30px;
+  height: calc($menubarHeight - 10px);
   width: 30px;
   transition: width .5s .05s, background-color .3s .05s;
   color: black;
@@ -183,7 +183,7 @@ body.crm-menubar-over-cms-menu #crm-menubar-toggle-position a i {
   transform: rotate(180deg);
 }
 
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
   /* Switch to desktop layout
   -----------------------------------------------
@@ -219,12 +219,25 @@ body.crm-menubar-over-cms-menu #crm-menubar-toggle-position a i {
   }
 
   #civicrm-menu li a {
-    background-color: $semiTransparentMenuColor;
+    background-color: $menuItemColor;
     color: $textColor;
   }
 
   #civicrm-menu > li > a {
-    height: 40px;
+    height: $menubarHeight;
+    padding: 0 8px;
+  }
+
+  #civicrm-menu > li > a > * {
+    vertical-align: middle;
+  }
+
+  /* Pseudo-element to ensure vertical alignment */
+  #civicrm-menu > li > a:after {
+    content: '';
+    display: inline-block;
+    height: 100%;
+    vertical-align: middle;
   }
 
   #civicrm-menu > li > a.highlighted {
@@ -250,7 +263,7 @@ body.crm-menubar-over-cms-menu #crm-menubar-toggle-position a i {
   }
 }
 
-@media (max-width: 768px) {
+@media (max-width: $breakMax) {
   /* hide the menu in mobile view */
   #crm-menubar-state:not(:checked) ~ #civicrm-menu {
     display: none;
index d49a764898243566d1713debc017d32c8fae5e83..3f417d79160049a8b21ec4610d871d82767fa201 100644 (file)
@@ -392,3 +392,8 @@ body.admin.com_civicrm #crm-nav-menu-container {
 body.admin.com_civicrm #content-right {
        padding: 12px;
 }
+
+/* Make footer admin bar hide behind popup windows (CRM-15723) */
+body.ui-dialog-open #status {
+  z-index: 100 !important;
+}
index b238c51f40e1a51cc0628aa0be3eee90b93cdaa0..ef980b240b1624ef4c15eec0546cb217d3b9ff33 100644 (file)
@@ -1,11 +1,11 @@
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu {
     border-top: 0 none !important;
-    margin-top: 40px;
+    margin-top: $menubarHeight;
   }
   body.crm-menubar-visible.crm-menubar-over-cms-menu.crm-menubar-wrapped {
-    margin-top: 80px;
+    margin-top: calc($menubarHeight * 2);
   }
   body.crm-menubar-visible.crm-menubar-over-cms-menu #admin-bar {
     visibility: hidden;
@@ -28,7 +28,7 @@
   }
 
 }
-@media (max-width: 768px) {
+@media (max-width: $breakMax) {
 
   body.backdrop-admin-bar-position-absolute #civicrm-menu-nav {
     position: absolute;
index 8317feb0220533e7d15fd924855786d17e251cb5..f5c663160b8e5ea679f4fdd21c13bd1c213ec395 100644 (file)
@@ -1,14 +1,14 @@
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu #toolbar {
     display: none;
   }
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu {
-    padding-top: 40px !important;
+    padding-top: $menubarHeight !important;
   }
   body.crm-menubar-visible.crm-menubar-over-cms-menu.crm-menubar-wrapped {
-    padding-top: 80px !important;
+    padding-top: calc($menubarHeight * 2) !important;
   }
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu #toolbar .toolbar-drawer {
     min-height: 30px;
   }
   body.crm-menubar-visible.crm-menubar-below-cms-menu.admin-menu {
-    padding-top: 40px !important;
+    padding-top: $menubarHeight !important;
   }
   body.crm-menubar-visible.crm-menubar-below-cms-menu.crm-menubar-wrapped.admin-menu {
-    padding-top: 80px !important;
+    padding-top: calc($menubarHeight * 2) !important;
   }
   body.crm-menubar-visible.crm-menubar-over-cms-menu #admin-menu {
     display: none;
@@ -67,7 +67,7 @@
 }
 
 /* For adminimal_admin_menu */
-@media (min-width: 768px) and (max-width: 1024px) {
+@media (min-width: $breakMin) and (max-width: 1024px) {
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu.admin-menu.adminimal-menu > .slicknav_menu {
     display: none;
@@ -80,7 +80,7 @@
   }
 }
 
-@media (max-width: 768px) {
+@media (max-width: $breakMax) {
 
   body.toolbar.crm-menubar-visible #toolbar-home {
     visibility: hidden;
index 868a7864dad005731fadb6116131b286f7bf90c3..c143dc967f130e30c4501f7c61df07c73bcd4dfc 100644 (file)
@@ -24,21 +24,24 @@ nav#civicrm-menu-nav .crm-menubar-toggle-btn-icon {
   left: 44px;
 }
 
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
-  body.crm-menubar-visible.crm-menubar-over-cms-menu #toolbar-administration  {
+  body.crm-menubar-visible.crm-menubar-over-cms-menu #toolbar-administration {
     display: none;
   }
 
   body.crm-menubar-visible.crm-menubar-over-cms-menu {
-    padding-top: 40px !important;
+    padding-top: $menubarHeight !important;
   }
-  body.crm-menubar-visible.crm-menubar-over-cms-menu.crm-menubar-wrapped,
+  body.crm-menubar-visible.crm-menubar-over-cms-menu.crm-menubar-wrapped {
+    padding-top: calc($menubarHeight * 2) !important;
+  }
+  /* The Drupal menu is 40px tall so we add that to our menubar height */
   body.crm-menubar-visible.crm-menubar-below-cms-menu {
-    padding-top: 80px !important;
+    padding-top: calc($menubarHeight + 40px) !important;
   }
   body.crm-menubar-visible.crm-menubar-below-cms-menu.crm-menubar-wrapped {
-    padding-top: 120px !important;
+    padding-top: calc($menubarHeight * 2 + 40px) !important;
   }
 
   body.crm-menubar-below-cms-menu > #civicrm-menu-nav ul#civicrm-menu {
index 482f8c2ac643b9f7324a2add0e65bfded763d848..48422b5e38d52b0beff4a0ebe7cbf39305f2cc38 100644 (file)
@@ -1,21 +1,21 @@
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
   body.crm-menubar-over-cms-menu.crm-menubar-visible {
-    padding-top: 40px;
+    padding-top: $menubarHeight;
   }
   body.crm-menubar-over-cms-menu.crm-menubar-visible.crm-menubar-wrapped {
-    padding-top: 80px;
+    padding-top: calc($menubarHeight * 2);
   }
 
   body.crm-menubar-below-cms-menu.crm-menubar-visible {
-    margin-top: 40px;
+    margin-top: $menubarHeight;
   }
   body.crm-menubar-below-cms-menu.crm-menubar-visible.crm-menubar-wrapped {
-    margin-top: 80px;
+    margin-top: calc($menubarHeight * 2);
   }
 
 }
-@media (max-width: 768px) {
+@media (max-width: $breakMax) {
 
   body #civicrm-menu-nav {
     position: absolute;
index 33d227418da89293fd0d5f871bf4013c21ad265d..e87fc6e5271735458f8a40d85d76cc4a43930139 100644 (file)
@@ -1,4 +1,4 @@
-@media (min-width: 768px) {
+@media (min-width: $breakMin) {
 
   body.crm-menubar-over-cms-menu.crm-menubar-visible #wpbody {
     padding-top: 8px;
   }
 
   body.crm-menubar-below-cms-menu.crm-menubar-visible #wpbody {
-    padding-top: 40px;
+    padding-top: $menubarHeight;
   }
   body.crm-menubar-below-cms-menu.crm-menubar-visible.crm-menubar-wrapped #wpbody {
-    padding-top: 80px;
+    padding-top: calc($menubarHeight * 2);
   }
   body.crm-menubar-over-cms-menu.crm-menubar-visible.crm-menubar-wrapped #adminmenuwrap {
-    margin-top: 40px;
+    margin-top: $menubarHeight;
   }
 
 }
-@media (min-width: 768px) and (max-width: 960px) {
+@media (min-width: $breakMin) and (max-width: 960px) {
 
   /* For the auto-fold toolbar */
   .wp-toolbar body.crm-menubar-below-cms-menu.auto-fold > #civicrm-menu-nav #civicrm-menu {
@@ -42,7 +42,7 @@
   }
 
 }
-@media (max-width: 768px) {
+@media (max-width: $breakMax) {
 
   body #civicrm-menu-nav .crm-menubar-toggle-btn {
     position: absolute;
@@ -57,3 +57,8 @@
   }
 
 }
+
+/* Make admin bar hide behind popup windows */
+body.ui-dialog-open #adminmenuwrap {
+  z-index: 100 !important;
+}
index 6a673fb066c7614b6f5bd630c4f1ead34f3eacc9..4882336cf3d7a33e0c7753c65604d9742d569726 100644 (file)
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2019
  * $Id$
+ *
+ * This script processes "Instant Payment Notifications" (IPNs).  Modern
+ * Payment Processors use the /civicrm/payment/ipn/123 endpoint instead (where
+ * 123 is the payment processor ID), however a quirk in the way PayPal works
+ * means that we need to maintain this script.
+ *
+ * Note on PayPal.
+ *
+ * Using PayPal Website Standard (which uses the old PayPal button API) the IPN
+ * endpoint is passed to PayPal with every transaction, and it is then stored
+ * by PayPal who unhelpfully do not give you any way to retrieve or change
+ * this.
+ *
+ * This means that if you provide URL1 when setting up a recurring
+ * contribution, then you will always need to maintain URL1 because all
+ * recurring payments against that will be sent to URL1.
+ *
+ * Note that this also affects you if you were to move your CiviCRM instance to
+ * another domain (if you do, get the webserver at the original domain to emit
+ * a 307 redirect to the new one, PayPal will re-send).
+ *
+ * Therefore, for the sake of these old recurring contributions, CiviCRM should
+ * maintain this script as part of core.
  */
 
 if (defined('PANTHEON_ENVIRONMENT')) {
@@ -52,9 +75,18 @@ else {
   // @todo upgrade standard per Pro
 }
 try {
-  //CRM-18245
-  if ($config->userFramework == 'Joomla') {
-    CRM_Utils_System::loadBootStrap();
+  switch ($config->userFramework) {
+    case 'Joomla':
+      // CRM-18245
+      CRM_Utils_System::loadBootStrap();
+      break;
+
+    case 'Drupal':
+    case 'Backdrop':
+      // Gitlab issue: #973
+      CRM_Utils_System::loadBootStrap([], FALSE);
+      break;
+
   }
   $paypalIPN->main();
 }
index 6e1c581f178c6fedef836a4921cd187da971e4da..503de82ce77c83d33da77c8b73fe199564ab61dc 100644 (file)
@@ -31,7 +31,6 @@ $config = CRM_Core_Config::singleton();
 if (defined('PANTHEON_ENVIRONMENT')) {
   ini_set('session.save_handler', 'files');
 }
-session_start();
 $rest = new CRM_Utils_REST();
 
 // Json-appropriate header will be set by CRM_Utils_Rest
index c6cd5c63ba15c28607f5dbd5ad346e69d914e93a..6eaf8a50302199acda493b587ebfe779ff650ca4 100644 (file)
@@ -63,14 +63,16 @@ global $installURLPath;
 // Set the install type
 // this is sent as a query string when the page is first loaded
 // and subsequently posted to the page as a hidden field
-if (isset($_POST['civicrm_install_type'])) {
+// only permit acceptable installation types to prevent issues;
+$acceptableInstallTypes = ['drupal', 'wordpress', 'backdrop'];
+if (isset($_POST['civicrm_install_type']) && in_array($_POST['civicrm_install_type'], $acceptableInstallTypes)) {
   $installType = $_POST['civicrm_install_type'];
 }
-elseif (isset($_GET['civicrm_install_type'])) {
+elseif (isset($_GET['civicrm_install_type']) && in_array(strtolower($_GET['civicrm_install_type']), $acceptableInstallTypes)) {
   $installType = strtolower($_GET['civicrm_install_type']);
 }
 else {
-  // default value if not set
+  // default value if not set and not an acceptable install type.
   $installType = "drupal";
 }
 
diff --git a/js/crm.joomla.js b/js/crm.joomla.js
deleted file mode 100644 (file)
index 4d98804..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// http://civicrm.org/licensing
-CRM.$(function($) {
-  $(document)
-    .on('dialogopen', function(e) {
-      // J3 - Make footer admin bar hide behind popup windows (CRM-15723)
-      $('#status').css('z-index', '100');
-    })
-    .on('dialogclose', function(e) {
-      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
-        // J3 - restore footer admin bar position (CRM-15723)
-        $('#status').css('z-index', '');
-      }
-    });
-});
index ad91a49e1b8a458d877f3f5f1bcc46787f0eface..f3b98afc7267d426c29c2783e9e8ea5a1fedbb3c 100644 (file)
@@ -78,7 +78,7 @@
             })
             .on('show.smapi', function(e, menu) {
               // Focus menu when opened with an accesskey
-              $(menu).siblings('a[accesskey]:not(:hover)').focus();
+              $(menu).siblings('a[accesskey]').focus();
             })
             .smartmenus(CRM.menubar.settings);
           initialized = true;
index 740b2246500cbf68979d4dad16a13103383678c0..81b433e65f19169439085017bfd25846d5e71ca3 100644 (file)
@@ -1,16 +1,6 @@
 // http://civicrm.org/licensing
 CRM.$(function($) {
   $(document)
-    .on('dialogopen', function(e) {
-      // Make admin bar hide behind popup windows
-      $('#adminmenuwrap').css('z-index', '100');
-    })
-    .on('dialogclose', function(e) {
-      if ($('.ui-dialog-content:visible').not(e.target).length < 1) {
-        // Restore admin bar position
-        $('#adminmenuwrap').css('z-index', '');
-      }
-    })
     .on('crmWysiwygCreate', function(e, type, editor) {
       if (type === 'ckeditor') {
         editor.on('maximize', function(e) {
@@ -20,12 +10,12 @@ CRM.$(function($) {
     });
   // Prevent screen reader shortcuts from changing the document hash and breaking angular routes
   $('a.screen-reader-shortcut').click(function() {
-    var href = $(this).attr('href');
+    var target = $(this).attr('href');
     // Show toolbar if hidden
-    if (href === '#wp-toolbar' && CRM.menubar.position === 'over-cms-menu') {
+    if (target === '#wp-toolbar' && CRM.menubar.position === 'over-cms-menu') {
       CRM.menubar.togglePosition(false);
     }
-    $(href).focus();
+    $(target).focus();
     return false;
   });
   $('<a href="#crm-qsearch-input" class="screen-reader-shortcut">' + ts("Open CiviCRM Menu") + '</a>')
index 752cf86415c8fb75292ce486a7400b7ccc2341c7..8ca76604eb683e3fcfde5510ffa952dbcfebcf8e 100644 (file)
@@ -70,9 +70,7 @@
         label: this.getLabel(),
         entity_name: this.get('entityName'),
         field_type: this.getFieldSchema().civiFieldType,
-        // For some reason the 'formatting' field gets a random number appended in core so we mimic that here.
-        // TODO: Why?
-        field_name: this.get('fieldName') == 'formatting' ? 'formatting_' + (Math.floor(Math.random() * 8999) + 1000) : this.get('fieldName')
+        field_name: this.get('fieldName')
       });
       return model;
     }
index 9d85e58ec898e2777786df37d8f41e8e663e1194..81a3ef845a9361e7f9f34519404b9740e409520d 100644 (file)
@@ -1,10 +1,11 @@
 # Release Notes
 
-These release notes are manually compiled from pull requests and Jira issues
+These release notes are manually compiled from pull requests, GitLab and Jira issues
 starting with CiviCRM 4.7.14.
 
 Other resources for identifying changes are:
 
+* The CiviCRM GitLab project management system at https://lab.civicrm.org/groups/dev/-/issues
 * The Jira project management system at https://issues.civicrm.org
 * The following GitHub projects:
     * https://github.com/civicrm/civicrm-core
@@ -14,6 +15,92 @@ Other resources for identifying changes are:
     * https://github.com/civicrm/civicrm-joomla
     * https://github.com/civicrm/civicrm-wordpress
 
+## CiviCRM 5.13.4
+
+Released May 15, 2019
+
+- **[Security advisories](release-notes/5.3.4.md#security)**
+
+## CiviCRM 5.13.3
+
+Released May 14, 2019
+
+- **[Synopsis](release-notes/5.13.3.md#synopsis)**
+- **[Features](release-notes/5.13.3.md#features)**
+- **[Bugs resolved](release-notes/5.13.3.md#bugs)**
+- **[Miscellany](release-notes/5.13.3.md#misc)**
+- **[Credits](release-notes/5.13.3.md#credits)**
+- **[Feedback](release-notes/5.13.3.md#feedback)**
+
+## CiviCRM 5.13.2
+
+Released May 6, 2019
+
+- **[Synopsis](release-notes/5.13.2.md#synopsis)**
+- **[Features](release-notes/5.13.2.md#features)**
+- **[Bugs resolved](release-notes/5.13.2.md#bugs)**
+- **[Miscellany](release-notes/5.13.2.md#misc)**
+- **[Credits](release-notes/5.13.2.md#credits)**
+- **[Feedback](release-notes/5.13.2.md#feedback)**
+
+## CiviCRM 5.13.1
+
+Released May 2, 2019
+
+- **[Synopsis](release-notes/5.13.1.md#synopsis)**
+- **[Features](release-notes/5.13.1.md#features)**
+- **[Bugs resolved](release-notes/5.13.1.md#bugs)**
+- **[Miscellany](release-notes/5.13.1.md#misc)**
+- **[Credits](release-notes/5.13.1.md#credits)**
+- **[Feedback](release-notes/5.13.1.md#feedback)**
+
+## CiviCRM 5.13.0
+
+Released May 1, 2019
+
+- **[Synopsis](release-notes/5.13.0.md#synopsis)**
+- **[Features](release-notes/5.13.0.md#features)**
+- **[Bugs resolved](release-notes/5.13.0.md#bugs)**
+- **[Miscellany](release-notes/5.13.0.md#misc)**
+- **[Credits](release-notes/5.13.0.md#credits)**
+- **[Feedback](release-notes/5.13.0.md#feedback)**
+
+## CiviCRM 5.12.4
+
+Released April 25, 2019
+
+- **[Synopsis](release-notes/5.12.4.md#synopsis)**
+- **[Bugs resolved](release-notes/5.12.4.md#bugs)**
+- **[Credits](release-notes/5.12.4.md#credits)**
+- **[Feedback](release-notes/5.12.4.md#feedback)**
+
+## CiviCRM 5.12.3
+
+Released April 20, 2019
+
+- **[Synopsis](release-notes/5.12.3.md#synopsis)**
+- **[Bugs resolved](release-notes/5.12.3.md#bugs)**
+- **[Credits](release-notes/5.12.3.md#credits)**
+- **[Feedback](release-notes/5.12.3.md#feedback)**
+
+## CiviCRM 5.12.2
+
+Released April 19, 2019
+
+- **[Synopsis](release-notes/5.12.2.md#synopsis)**
+- **[Bugs resolved](release-notes/5.12.2.md#bugs)**
+- **[Credits](release-notes/5.12.2.md#credits)**
+- **[Feedback](release-notes/5.12.2.md#feedback)**
+
+## CiviCRM 5.12.1
+
+Released April 15, 2019
+
+- **[Synopsis](release-notes/5.12.1.md#synopsis)**
+- **[Bugs resolved](release-notes/5.12.1.md#bugs)**
+- **[Credits](release-notes/5.12.1.md#credits)**
+- **[Feedback](release-notes/5.12.1.md#feedback)**
+
 ## CiviCRM 5.12.0
 
 Released April 3, 2019
diff --git a/release-notes/5.12.2.md b/release-notes/5.12.2.md
new file mode 100644 (file)
index 0000000..4593f65
--- /dev/null
@@ -0,0 +1,43 @@
+# CiviCRM 5.12.2
+
+Released April 19, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Menu - Fix a visual issue where the menu obscures modal dialogs ([14066](https://github.com/civicrm/civicrm-core/pull/14066))**
+- **CiviMail - Fix an error in "Preview as HTML" ([dev/mail#41](https://lab.civicrm.org/dev/mail/issues/41): [14081](https://github.com/civicrm/civicrm-core/pull/14081))**
+- **Contact Dashboard - Restore missing buttons ("Pay Now", "Print Invoice") ([dev/core#534](https://lab.civicrm.org/dev/core/issues/534): [14051](https://github.com/civicrm/civicrm-core/pull/14051))**
+- **Drupal 8 - Restore coloring ([dev/drupal#56](https://lab.civicrm.org/dev/drupal/issues/56): [8b7b2f58](https://github.com/civicrm/civicrm-core/commit/8b7b2f58fb441a2ea4780ba5dafc32903282e7aa))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Tadpole Collective - Kevin
+Cristiano; Richard van Oosterhout; Megaphone Technology Consulting - Jon
+Goldberg; Lighthouse Design and Consulting - Brian Shaughnessy; JMA
+Consulting - Monish Deb; CiviFirst - John Kirk; CiviCRM - Tim Otten, Coleman
+Watts; Caltha - Tomasz Pietrzkowski; Australian Greens - Seamus Lee
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.12.3.md b/release-notes/5.12.3.md
new file mode 100644 (file)
index 0000000..f0ba19c
--- /dev/null
@@ -0,0 +1,37 @@
+# CiviCRM 5.12.3
+
+Released April 20, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Fix regression in "Find Pledges" ([dev/core#887](https://lab.civicrm.org/dev/core/issues/887): [14092](https://github.com/civicrm/civicrm-core/pull/14092))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Tadpole Collective - Kevin
+Cristiano; Korlon - Stuart Gaston; Australian Greens - Seamus Lee
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.12.4.md b/release-notes/5.12.4.md
new file mode 100644 (file)
index 0000000..dfc9c2a
--- /dev/null
@@ -0,0 +1,39 @@
+# CiviCRM 5.12.4
+
+Released April 25, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **CiviMail - Fix "Preview" action when using `viewUrl` tokens and mailing hashes. ([dev/core#891](https://lab.civicrm.org/dev/core/issues/891): [14124](https://github.com/civicrm/civicrm-core/pull/14124))**
+
+- **Installer - Fix diagnostic for MySQL `utf8mb4` support. ([dev/core#880](https://lab.civicrm.org/dev/core/issues/880): [14129](https://github.com/civicrm/civicrm-core/pull/14129))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Australian Greens - Seamus Lee;
+Lighthouse Design and Consulting - Brian Shaughnessy; Electronic Frontier Foundation - Mark Burdett
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.13.0.md b/release-notes/5.13.0.md
new file mode 100644 (file)
index 0000000..38172b6
--- /dev/null
@@ -0,0 +1,1095 @@
+# CiviCRM 5.13.0
+
+Released May 1, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Features](#features)**
+- **[Bugs resolved](#bugs)**
+- **[Miscellany](#misc)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| **Change the database schema?**                                 | **yes** |
+| **Alter the API?**                                              | **yes** |
+| **Require attention to configuration options?**                 | **yes** |
+| **Fix problems installing or upgrading to a previous version?** | **yes** |
+| **Introduce features?**                                         | **yes** |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="features"></a>Features
+
+### Core CiviCRM
+
+- **Configurable menubar color
+  ([13996](https://github.com/civicrm/civicrm-core/pull/13996))**
+
+  v5.12 introduced a new menu bar. The change also revised the default color
+  scheme (applying a more contemporary palette), but this created stress for
+  some users who were trained to recognize the old menu color. This exposes a
+  new setting for customizing the color scheme, and it changes the default to
+  match previous scheme (be black instead of beige).
+
+- **Menu config screen improvements
+  ([14002](https://github.com/civicrm/civicrm-core/pull/14002))**
+
+  Improves the Menu configuration screen by: making changes to the menu (adding
+  or editing menu items) on the admin screen be reflected immediately, adding
+  links to the related settings pages to reduce confusion about how to configure
+  various aspects of the menu bar and fixing the broken icon picker and missing
+  CiviCRM icon.
+
+- **What to do with the merge screen
+  ([dev/core#824](https://lab.civicrm.org/dev/core/issues/824):
+  [13898](https://github.com/civicrm/civicrm-core/pull/13898) and
+  [13895](https://github.com/civicrm/civicrm-core/pull/13895)) CONTINUES WORK**
+
+  Continues work to clean up the Merge screen by moving toward
+  using contact type icons in a standard way instead of the contact type names
+  and cleaning up alignment.
+
+- **Mutliple activity type filters on activity tab on contact records
+  ([13873](https://github.com/civicrm/civicrm-core/pull/13873))**
+
+  Change include/exclude activity type filters to be multiple select2 widgets so
+  that users can filter my multiple activity types rather than only permitting
+  users to select one activity type with a traditional select field.
+
+- **Added a DB check to prevent deleting exisiting CiviCRM data from database.
+  ([13944](https://github.com/civicrm/civicrm-core/pull/13944))**
+
+  When installing CiviCRM this change adds a check to see if there are existing
+  CiviCRM tables and requires users to manually remove any CiviCRM tables
+  before continuing to prevent users from accidentally deleting tables.
+
+- **Encourage developers to use .then instead of .done
+  ([13982](https://github.com/civicrm/civicrm-core/pull/13982))**
+
+  This change makes it so the Api Explorer generates js code using `.then()`
+  (instead of `.done`) and demonstrates proper errQor handling to encourage
+  developers to use `.then()`.
+
+- **Replace jcalendar instances with datepicker
+  ([dev/core#561](https://lab.civicrm.org/dev/core/issues/561):
+  [13919](https://github.com/civicrm/civicrm-core/pull/13919),
+  [13855](https://github.com/civicrm/civicrm-core/pull/13855),
+  [13965](https://github.com/civicrm/civicrm-core/pull/13965),
+  [13950](https://github.com/civicrm/civicrm-core/pull/13950) and
+  [13918](https://github.com/civicrm/civicrm-core/pull/13918)) CONTINUES WORK**
+
+  Moves from jcalendar to datepicker in the following places: the fulfilled date
+  on the premium tab on back end contribution add/edit screens, the activity
+  tab, the receive_date and the renewal_date fields in Membership forms and the
+  transaction date field on the update pending status task. And updates tests to
+  reflect progress getting rid of jcalendar.
+
+- **Expose sort_name as a dedupe-matchable field
+  ([13864](https://github.com/civicrm/civicrm-core/pull/13864))**
+
+  Allow sort_name to be used in dedupe rules.
+
+- **Standardise setTitle method on forms
+  ([13781](https://github.com/civicrm/civicrm-core/pull/13781))**
+
+  Makes the title of a form available in the buildForm hook.
+
+- **Send action links on any page that extends CRM_Core_Page_Basic thru
+  hook_civicrm_links
+  ([13068](https://github.com/civicrm/civicrm-core/pull/13068))**
+
+  Makes it so extension developers can use hook_civicrm_links to add or remove
+  links from the Relationship Types Administration Page (CiviCRM Navigation
+  Menu->Administer->Customize Data and Screens->Relationship Types) and any
+  other page that extends CRM_Core_Page_Basic.
+
+- **Improve lock handling for mysql 5.7.5+
+  ([CRM-18011](https://issues.civicrm.org/jira/browse/CRM-18011):
+  [13854](https://github.com/civicrm/civicrm-core/pull/13854))**
+
+  Ensures mysql locks are supported on mysql 5.7.5+ and MariaDB '10.0.2'+.
+
+- **Deploy PEAR Log package and upgrade to latest version in the process
+  ([13835](https://github.com/civicrm/civicrm-core/pull/13835))**
+
+  Upgrades the PEAR Log package version and deploys it via
+  composer.
+
+- **Make cacheCode optional in CRM.loadScript
+  ([13824](https://github.com/civicrm/civicrm-core/pull/13824))**
+
+  A cacheCode was recently added to script urls fetched by CRM.getScript(). This
+  is not always desirable e.g. for scripts fetched from an external source, this
+  change makes it so the cacheCode is added by default but can be disabled.
+
+- **Load hooks during upgrade mode
+  ([13551](https://github.com/civicrm/civicrm-core/pull/13551))**
+
+  Allow extensions to load hooks during an upgrade.
+
+- **Checkbox to explicitly change employer when sharing address
+  ([CRM-21008](https://issues.civicrm.org/jira/browse/CRM-21008):
+  [13700](https://github.com/civicrm/civicrm-core/pull/13700))**
+
+  Before this change when an individual was set to share an address with an
+  organization, that organization was set as its current employer. This change
+  adds a checkbox that allows users to explicitly tell civicrm whether the
+  organization is the current employer or not when sharing an address.
+
+- **Report improvements
+  ([CRM-21677](https://issues.civicrm.org/jira/browse/CRM-21677):
+  [13792](https://github.com/civicrm/civicrm-core/pull/13792),
+  [13790](https://github.com/civicrm/civicrm-core/pull/13790) and
+  [13780](https://github.com/civicrm/civicrm-core/pull/13780))**
+
+  These changes improve reports by removing redundant birth date and gender
+  evaluation code.
+
+- **Contact Subtype field at Reports does not support contacts with multiple
+  subtypes ([dev/core/544](https://lab.civicrm.org/dev/core/issues/544):
+  [13158](https://github.com/civicrm/civicrm-core/pull/13158) and
+  [13908](https://github.com/civicrm/civicrm-core/pull/13908))**
+
+  Makes reports support filtering on multiple contact subtypes.
+
+- **Replace all instances of CRM_Core_Fatal with throw new CRM_Core_Exception
+  ([dev/core#560](https://lab.civicrm.org/dev/core/issues/560):
+  [13850](https://github.com/civicrm/civicrm-core/pull/13850)) CONTINUES WORK**
+
+  Updates Cancel Billing & Update Billing screens to use status bounce rather
+  than throw a fatal error.
+
+- **Activity tab performance fix - switch to faster getActivities &
+  getActivitiesCount
+  ([13768](https://github.com/civicrm/civicrm-core/pull/13768))**
+
+  Performance improvement when loading the activity tab for a contact.
+
+- **Add hook findDuplicates
+  ([13234](https://github.com/civicrm/civicrm-core/pull/13234))**
+
+  Adds the hook findDuplicates which provides the ability for extensions to
+  intercept and/or override core duplicate checking when
+  registering/contributing.
+
+- **Deadlocks and performance issues when using smartgroups / ACLs extensively
+  ([dev/core#748](https://lab.civicrm.org/dev/core/issues/748):
+  [13772](https://github.com/civicrm/civicrm-core/pull/13772)) CONTINUES WORK**
+
+  Improves performance by switching the alphabetQuery to use new
+  getSearchSQLParts() function.
+
+- **Improve data when known time-dependent-failing test fails
+  ([13964](https://github.com/civicrm/civicrm-core/pull/13964))**
+
+  Improves output data when time dependent tests fail.
+
+- **Use TempTable methods.
+  ([13880](https://github.com/civicrm/civicrm-core/pull/13880),
+  [13865](https://github.com/civicrm/civicrm-core/pull/13865),
+  [13819](https://github.com/civicrm/civicrm-core/pull/13819),
+  [13848](https://github.com/civicrm/civicrm-core/pull/13848),
+  [13847](https://github.com/civicrm/civicrm-core/pull/13847) and
+  [13703](https://github.com/civicrm/civicrm-core/pull/13703))**
+
+  These changes move towards using the TempTable class to improve
+  naming standards, including but not limited to the following places: when
+  creating the dedupe table, on the contribution detail report, on the
+  bookkeeping report and when debugging.
+
+- **Allow extensions to enable validate.tpl
+  ([13961](https://github.com/civicrm/civicrm-core/pull/13961))**
+
+  This change makes it possible for extensions to add a validate.tpl which
+  provides front end javascript validation, which improves user experience by
+  making it so users do not have to refresh the page to see validation issues.
+
+- **Promise polyfill for older browsers
+  ([13955](https://github.com/civicrm/civicrm-core/pull/13955))**
+
+  Loads a polyfill for IE aQnd other outdated browsers so developers can use
+  native js Promises in our code.
+
+### CiviCase
+
+- **Case Activity Assignment Restriction
+  ([dev/core#641](https://lab.civicrm.org/dev/core/issues/641):
+  [13541](https://github.com/civicrm/civicrm-core/pull/13541))**
+
+  Makes it possible to restrict the assignment of case activities to
+  a group or to contacts having user accounts.
+
+### CiviContribute
+
+- **Add cancel_reason field to civicrm_contribution_recur table
+  ([dev/core#830](https://lab.civicrm.org/dev/core/issues/830):
+  [13930](https://github.com/civicrm/civicrm-core/pull/13930),
+  [13999](https://github.com/civicrm/civicrm-core/pull/13999), and
+  [14164](https://github.com/civicrm/civicrm-core/pull/14164))**
+
+  Adds a recur cancel reason field `civicrm_contribution_recur.cancel_reason
+  field`.
+
+- **Add ID / Test ID for payment processors to list - makes setup of IPNs much
+  easier! ([13869](https://github.com/civicrm/civicrm-core/pull/13869))**
+
+  Adds a column for payment processor id and test payment processor id to the
+  table of "Settings - Payment Processors" page so that users can more easily
+  access these ids.
+
+- **Add payment_processor column/filter to recurring contribution report
+  ([13699](https://github.com/civicrm/civicrm-core/pull/13699))**
+
+  On the "Recurring Contribution" report, this adds "Payment Processor" as an
+  option to the Column and Filter tabs enabling users to filter this report by
+  "Payment Processor" and/or include a column for "Payment Processor".
+
+- **Payment processor names: separate internal and external usage
+  ([dev/financial#2](https://lab.civicrm.org/dev/financial/issues/2):
+  [13995](https://github.com/civicrm/civicrm-core/pull/13995) and
+  [13954](https://github.com/civicrm/civicrm-core/pull/13954))**
+
+  Adds the field `payment_processor.title` to the schema and makes it
+  translatable.
+
+- **Support paying refunds
+  ([dev/financial#38](https://lab.civicrm.org/dev/financial/issues/38):
+  [13952](https://github.com/civicrm/civicrm-core/pull/13952)) BEGINS WORK**
+
+  Adds a PaymentProcessor.refund API which makes it possible for payment
+  processor extension authors to have their extensions issue refund payments.
+
+- **Add minimal PaymentProcessor.pay api
+  ([13953](https://github.com/civicrm/civicrm-core/pull/13953))**
+
+  Adds a new api PaymentProcessor.pay.
+
+- **Include lower level data when throwing an exception on payment processor.pay
+  ([14006](https://github.com/civicrm/civicrm-core/pull/14006))**
+
+  Improves error processing when using the PaymentProcessor.pay api.
+
+- **Add billingblock region to event registration thankyou to match contribution
+  thankyou ([13762](https://github.com/civicrm/civicrm-core/pull/13762))**
+
+  This change makes it so one can use the same method to
+  replace billingblock for both event and contribution thankyou workflows.
+
+- **CQ: Refactor Recurring Contribution Forms
+  ([dev/core#846](https://lab.civicrm.org/dev/core/issues/846):
+  [13940](https://github.com/civicrm/civicrm-core/pull/13940)) BEGINS WORK**
+
+  Begins work to refactor recurring contribution forms specifically by
+  rationalizing url variables into shared parent for recurring contribution
+  forms.
+
+- **Use label not name for payment processor type
+  ([13885](https://github.com/civicrm/civicrm-core/pull/13885))**
+
+  On the "Settings - Payment Processor" page changes the "Processor Type" column
+  to use the label instead of the name.
+
+- **Improve ContributionPage.validate api
+  ([13798](https://github.com/civicrm/civicrm-core/pull/13798))**
+
+  Makes it so that one can use the ContributionPage validate api on POST, for
+  example when using Paypal Checkout which calls a Promise, the
+  ContributionPage.validate api could be called to determine whether to proceed
+  after the button is pushed.
+
+- **Add pseudoconstant support for payment_processor_id on ContributionRecur
+  ([13698](https://github.com/civicrm/civicrm-core/pull/13698))**
+
+- **Allow payment processor to determine the text around 'continue'
+  ([13787](https://github.com/civicrm/civicrm-core/pull/13787))**
+
+
+### CiviEvent
+
+- **Expose Registered by Participant Name field to participant report
+  ([dev/core#835](https://lab.civicrm.org/dev/core/issues/835):
+  [13936](https://github.com/civicrm/civicrm-core/pull/13936))**
+
+  Exposes "Registered by Participant Name" field to participant reports.
+
+### CiviMail
+
+- **Report results don't show inactive campaigns
+  ([dev/core#491](https://lab.civicrm.org/dev/core/issues/491):
+  [13383](https://github.com/civicrm/civicrm-core/pull/13383))**
+
+  Standardizes the way campaign fields are added to the "Mailing Summary"
+  report.
+
+- **Use Mailing.preview API to display mailing in browser
+  ([14163](https://github.com/civicrm/civicrm-core/pull/14163))**
+
+  This resolves an error on sites with Flexmailer when an anonymous visitor
+  views a mailing in the browser.
+
+### CiviMember
+
+- **Membership form address fields for payment processors
+  ([13802](https://github.com/civicrm/civicrm-core/pull/13802))**
+
+  Standardizes processing and validating address parameters on the
+  Membership form.
+
+### Wordpress Integration
+
+- **Cleaner front-end URLs
+  ([144](https://github.com/civicrm/civicrm-wordpress/pull/144))**
+
+  Makes Wordpress URLs have the same structure as Drupal URLs ex:
+  `https://domain.tld/civicrm/contribute/transact/?reset=1&id=1 as opposed to
+  old` Wordpress URLs that looked like
+  `https://domain.tld/civicrm/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1`
+
+## <a name="bugs"></a>Bugs resolved
+
+### Core CiviCRM
+
+- **Add a test matrix for E2E tests on each CMS
+  ([infra/ops#878](https://lab.civicrm.org/infra/ops/issues/878):
+  [13810](https://github.com/civicrm/civicrm-core/pull/13810),
+  [13826](https://github.com/civicrm/civicrm-core/pull/13826) and
+  [13811](https://github.com/civicrm/civicrm-core/pull/13811)) CONTINUES WORK**
+
+  These changes resolve bugs when running E2E tests on WordPress moving the
+  project towards the goal of having a test matrix for E2E tests for each CMS
+  that CiviCRM is compatible with.
+
+- **Use the correct membership date for the notification that appear after
+  completing the membership payment in case pre hook is used
+  ([dev/core#288](https://lab.civicrm.org/dev/core/issues/288):
+  [12583](https://github.com/civicrm/civicrm-core/pull/12583))**
+
+  This change ensures that any changes made to the membership dates using
+  hook_civicrm_pre are taken into account when generating the membership payment
+  notification.
+
+- **Custom Field checkbox value renders empty if the values are randomly sorted
+  ([dev/core#499](https://lab.civicrm.org/dev/core/issues/499):
+  [13051](https://github.com/civicrm/civicrm-core/pull/13051))**
+
+  This change ensures that the values selected by a user for alphanumeric
+  checkbox custom fields render properly in view mode.
+
+- **New Organisation: "Check For Matching Contact (S)" button does not find
+  matching records ([dev/core#570](https://lab.civicrm.org/dev/core/issues/570):
+  [13398](https://github.com/civicrm/civicrm-core/pull/13398))**
+
+  This change ensures that "Check For Matching Contact(s)" retrieves
+  contacts for users with limited permissions.
+
+- **Soft Credits Multiply GIft Amount in Contribution Detail Report
+  ([dev/core#655](https://lab.civicrm.org/dev/core/issues/655):
+  [13906](https://github.com/civicrm/civicrm-core/pull/13906))**
+
+  This change updates the Contribution Detail report so that the "Total Amount"
+  field is not summed because the summing of the "Total Amount" field was
+  leading to the "Total Amount" field for contributions with multiple soft
+  credits to be multiplied by the number of soft credits.
+
+- **Add new indexes when updating log table schema regardless of engine change
+  ([dev/core#664](https://lab.civicrm.org/dev/core/issues/664):
+  [13462](https://github.com/civicrm/civicrm-core/pull/13462))**
+
+  This change makes it so that when the alterLogTables hook defines a new index
+  it is applied regardless of the engine.
+
+- **Contacts -> New Email give Unknown Error in Smarty when Allow Mail to be
+  sent from logged in contact's email address disabled
+  ([dev/core#688](https://lab.civicrm.org/dev/core/issues/688):
+  [13508](https://github.com/civicrm/civicrm-core/pull/13508))**
+
+  This change fixes an error "Warning: Smarty error" when attempting to send an
+  email from Contacts -> New Email for sites with "Allow Mail to be sent from
+  logged in user" disabled.
+
+- **Edit contribution : wrong decimal separator on total_amount for
+  participant(s) ([dev/core#706](https://lab.civicrm.org/dev/core/issues/706):
+  [13554](https://github.com/civicrm/civicrm-core/pull/13554))**
+
+  This change ensures that the decimal separator on total_amount field for
+  participant(s) is displayed as it is configured on the site.
+
+- **Contact Report: The filter by the custom datetime field with "Today" option
+  doesn't find matching contacts
+  ([dev/core#709](https://lab.civicrm.org/dev/core/issues/709):
+  [13567](https://github.com/civicrm/civicrm-core/pull/13567))**
+
+  This change ensures that on the Contact Report, when using a filter for a
+  custom datetime field the "Today" option properly filters results.
+
+- **Address API incorrectly sets state_province_id if multiple countries have
+  same state name / abbreviation
+  ([dev/core#725](https://lab.civicrm.org/dev/core/issues/725):
+  [13938](https://github.com/civicrm/civicrm-core/pull/13938))**
+
+  This change fixes a regression so that the Address API country_id parameter
+  works with an abbreviation or numeric id.
+
+- **Advanced Search: There is an Internal Server Error (500) when the user tries
+  to search by the "Mailing List" group type
+  ([dev/core#726](https://lab.civicrm.org/dev/core/issues/726):
+  [13603](https://github.com/civicrm/civicrm-core/pull/13603) and
+  [13888](https://github.com/civicrm/civicrm-core/pull/13888))**
+
+  Fixes a bug where searching by a group type (ex: Mailing List) on the Advanced
+  Search form would result in a fatal error so that this search runs as
+  expected.
+
+- **Notes: It isn't possible to edit note if the user uploaded an image larger
+  than 3 MByte(s) ([dev/core#740](https://lab.civicrm.org/dev/core/issues/740):
+  [13640](https://github.com/civicrm/civicrm-core/pull/13640))**
+
+  This change makes it so that it is possible to edit a note field
+  that includes images larger than  3 MByte(s).
+
+- **Custom field caching is not group-specific
+  ([dev/core#755](https://lab.civicrm.org/dev/core/issues/755):
+  [13900](https://github.com/civicrm/civicrm-core/pull/13900))**
+
+  Adds the $groupTitle parameter to the cache key for custom fields, so field
+  names that exist in multiple groups will be cached separately.
+
+- **Warning: A non-numeric value encountered in ...
+  ([dev/core#788](https://lab.civicrm.org/dev/core/issues/788):
+  [13795](https://github.com/civicrm/civicrm-core/pull/13795))**
+
+  This change fixes several warnings "Warning: A non-numeric value encountered
+  in ..." on contribution pages & event registrations forms.
+
+- **PHP Warning "explode() expects parameter 2 to be string, array given" for
+  multi-value country fields
+  ([dev/core#795](https://lab.civicrm.org/dev/core/issues/795):
+  [13858](https://github.com/civicrm/civicrm-core/pull/13858))**
+
+  Fixes a PHP warning when updating a multiselect country field.
+
+- **Prefix/suffix select2 renders oddly on public-facing pages
+  ([dev/core#798](https://lab.civicrm.org/dev/core/issues/798):
+  [13816](https://github.com/civicrm/civicrm-core/pull/13816))**
+
+  This change makes the Prefix/suffix select2's render full height (as opposed
+  to squished) in contribution/event profiles.
+
+- **DB Error:: Already exists during renewing membership automatically
+  ([dev/core#806](https://lab.civicrm.org/dev/core/issues/806):
+  [13852](https://github.com/civicrm/civicrm-core/pull/13852))**
+
+  Fixes a DB error "already exists" when recording recurring payments with taxes
+  enabled.
+
+- **Autocomplete select list disabled options
+  ([dev/core#811](https://lab.civicrm.org/dev/core/issues/811):
+  [13859](https://github.com/civicrm/civicrm-core/pull/13859))**
+
+  This change ensures that for select fields with autocomplete, only enabled
+  options autocomplete.
+
+- **Search results: Actions: Export contacts: DB Error: Syntax error occurs when
+  not all necessary fields are selected
+  ([dev/core#819](https://lab.civicrm.org/dev/core/issues/819):
+  [13889](https://github.com/civicrm/civicrm-core/pull/13889))**
+
+  Resolves a fatal database error when attempting to export contacts without
+  selecting any fields to be exported.
+
+- **Value in the "Contact Type" field disappears when the user tries to edit
+  Contact Details ([dev/core#823](https://lab.civicrm.org/dev/core/issues/823):
+  [13945](https://github.com/civicrm/civicrm-core/pull/13945))**
+
+  Ensures that when a user uses a profile with a contact sub type field to
+  update a contact that the contact sub type field pre-populates as expected.
+
+- **Notice error while creating smart group using Contribution Aggregate custom
+  search ([dev/core#837](https://lab.civicrm.org/dev/core/issues/837):
+  [13921](https://github.com/civicrm/civicrm-core/pull/13921))**
+
+  Resolves "Notice: Undefined index:" errors when creating a smart group using
+  Contribution Aggregate custom search.
+
+- **Notice error when deleting profile
+  ([dev/core#840](https://lab.civicrm.org/dev/core/issues/840):
+  [13926](https://github.com/civicrm/civicrm-core/pull/13926))**
+
+  Resolves a "Undefined property" notice when deleting a profile.
+
+- **CQ: Use Guzzle as our preferred way to retrieve via http
+  ([dev/core#849](https://lab.civicrm.org/dev/core/issues/849):
+  [13946](https://github.com/civicrm/civicrm-core/pull/13946))**
+
+  Replaces get_headers functions call with Guzzle HTTP request to prevent timing
+  out.
+
+- **Queries combining multiple text labels using REGEXP do not escape regular
+  expression metacharacters
+  ([dev/core#433](https://lab.civicrm.org/dev/core/issues/433):
+  [12998](https://github.com/civicrm/civicrm-core/pull/12998))**
+
+  Ensures that querying for fee levels that contain regex metacharacters will
+  match.
+
+- **Fix status type (error, not fail) for CRM_Core_Session::setStatus
+  ([13943](https://github.com/civicrm/civicrm-core/pull/13943))**
+
+  Fixes an incorrect status for setMessage which was using 'fail' (which is not
+  a valid status) instead of 'error'.
+
+- **Covert the CRM_Core_Error::fatal calls to exceptions when trying to access
+  Contact Photos ([13917](https://github.com/civicrm/civicrm-core/pull/13917))**
+
+  Cleaner errors when attempting to access contact photos fails.
+
+- **CiviCRM API, lookup state_province_id options based on country parameter if
+  present, or default country
+  ([13596](https://github.com/civicrm/civicrm-core/pull/13596))**
+
+  Ensures the CiviCRM Address API correctly sets state_province_id for states
+  whose name/abbreviation exist in multiple countries.
+
+- **Fix php 7.2 count notice
+  ([13877](https://github.com/civicrm/civicrm-core/pull/13877))**
+
+  Fixes a "Warning: count()" error on the "Import Contacts" Summary step screen.
+
+- **New Organisation: "Contact Type" dropdown disappears when fields validation
+  occurs ([dev/core#699](https://lab.civicrm.org/dev/core/issues/699):
+  [13545](https://github.com/civicrm/civicrm-core/pull/13545))**
+
+  Fixes a bug where when creating a new organization, if the form fails
+  validation the "Contact Sub Type" dropdown disappears.
+
+- **Fix contact.merge api to pass check_permissions parameter through to the
+  deeper layer ([13807](https://github.com/civicrm/civicrm-core/pull/13807))**
+
+  Fixes a bug where calling Contact.merge from php will leave the merged contact
+  unmerged if the logged in user does not have the delete contacts permission
+
+- **checkEditInboundEmailsPermissions should be a static function
+  ([13805](https://github.com/civicrm/civicrm-core/pull/13805))**
+
+- **DB error "no such field" when executing actions on a sorted contact search
+  result with search profile
+  ([dev/core#502](https://lab.civicrm.org/dev/core/issues/502):
+  [13884](https://github.com/civicrm/civicrm-core/pull/13884))**
+
+- **Transfer picks up the deleted contact ID basically transferring to the wrong
+  contact ([dev/core#314](https://lab.civicrm.org/dev/core/issues/314):
+  [12639](https://github.com/civicrm/civicrm-core/pull/12639))**
+
+- **Fix bug whereby sorting by state province gives an error in search builder
+  ([13748](https://github.com/civicrm/civicrm-core/pull/13748))**
+
+- **Fix Contact.create calls to respect passed in variables & variables set via
+  hook for sort_name & display_name
+  ([13863](https://github.com/civicrm/civicrm-core/pull/13863))**
+
+- **Do not cause a fatal error if no contact_id field for a note is filled in
+  when viewing contact notes
+  ([13910](https://github.com/civicrm/civicrm-core/pull/13910))**
+
+- **Disable phpcs checking in the Crypt files where mcrypt functions are
+  ([14031](https://github.com/civicrm/civicrm-core/pull/14031))**
+
+- **Fix 4.7.31 Upgrade in multilingual mode
+  ([14003](https://github.com/civicrm/civicrm-core/pull/14003))**
+
+- **Optimise the loading of the CiviCRM Deduplication Exception page
+  ([13435](https://github.com/civicrm/civicrm-core/pull/13435))**
+
+- **Unfork Zetacomponents mail and use patch to apply differences
+  ([13934](https://github.com/civicrm/civicrm-core/pull/13934))**
+
+- **Update lockfile to take into account of civicrm/zetacomponents-mail#4 being
+  merged ([13822](https://github.com/civicrm/civicrm-core/pull/13822))**
+
+- **Upgrade zetacomponents/base and zetacomponents/mail
+  ([13799](https://github.com/civicrm/civicrm-core/pull/13799))**
+
+- **Smart group with uf_group_id does not load contacts with same search profile
+  ([dev/core#771](https://lab.civicrm.org/dev/core/issues/771):
+  [13742](https://github.com/civicrm/civicrm-core/pull/13742))**
+
+- **Fix Deprecation notice for use of `while` in PHP7.2 in bin/cli.class.php
+  ([dev/core#907](https://lab.civicrm.org/dev/core/issues/907):
+  [14155](https://github.com/civicrm/civicrm-core/pull/14155))**
+
+### CiviCase
+
+- **PR 13333 breaks the Save and New button on a new case
+  ([dev/core#904](https://lab.civicrm.org/dev/core/issues/904):
+  [14145](https://github.com/civicrm/civicrm-core/pull/14145))**
+
+  This reverts a change making the Save and New button `submitOnce`, as that
+  prevented the button from opening a new case form after saving.
+
+- **Creating a new relationship type while editing case type definition adds a
+  blank row in the roles section
+  ([dev/core#784](https://lab.civicrm.org/dev/core/issues/784):
+  [13785](https://github.com/civicrm/civicrm-core/pull/13785))**
+
+- **PHP warnings on Case Dashboard and Find Cases
+  ([13998](https://github.com/civicrm/civicrm-core/pull/13998))**
+
+### CiviContribute
+
+- **Can't self-service cancel a recurring contribution made while you're logged
+  in ([dev/core#571](https://lab.civicrm.org/dev/core/issues/571):
+  [13237](https://github.com/civicrm/civicrm-core/pull/13237))**
+
+  This change makes it so that users without "edit contributions" permission can
+  edit their own recurring contribution subscriptions if they are logged in,
+  before this change they could only edit their own contribution subscriptions
+  thru a checksum link.
+
+- **Possible paypal fix to avoid sending 500 errors from ipn triggerred by
+  one-off payment
+  ([13867](https://github.com/civicrm/civicrm-core/pull/13867))**
+
+  Fixes paypal system sending a warning email when there is a failed IPN call
+  (500 errors from ipn triggered by non-recurring payment).
+
+- **Missing links to cancel recurring payments (regression .. sorta)
+  ([dev/core#704](https://lab.civicrm.org/dev/core/issues/704):
+  [13935](https://github.com/civicrm/civicrm-core/pull/13935))**
+
+  Fixes a 5.8 regression where the cancel link became unavailable on recurring
+  contributions with no attached payment processor id.
+
+- **Improve flushing after creating a processor so it can be used for a
+  recurring in the same run
+  ([14009](https://github.com/civicrm/civicrm-core/pull/14009))**
+
+  This change ensures tests run properly by flushing caches when creating a
+  payment processor.
+
+- **Flush ContributionRecur static cache when flushing processors
+  ([13962](https://github.com/civicrm/civicrm-core/pull/13962))**
+
+  Ensures a (new) static cache is flushed when creating a processor, mostly
+  useful for unit testing.
+
+- **Display test contributions when viewing contributions related to a test
+  recurring contribution
+  ([13779](https://github.com/civicrm/civicrm-core/pull/13779))**
+
+### CiviEvent
+
+- **Cancelling or An Error during event registration payment should cancel all
+  additional participates
+  ([dev/core#253](https://lab.civicrm.org/dev/core/issues/253):
+  [12457](https://github.com/civicrm/civicrm-core/pull/12457))**
+
+  This fixes a bug where if a user was registering for an event with additional
+  participants, and for some reason the payment failed or the user decided to
+  cancel the payment, only the main user participant record was set to
+  "canceled", the rest of the additional participants would have the status
+  "pending incomplete transaction" so that all participant statuses are changed
+  to "canceled".
+
+- **Event Cart: Fix PHP 7.2 fatal error (pass by ref)
+  ([13927](https://github.com/civicrm/civicrm-core/pull/13927))**
+
+  Fixes a Fatal error when using Event cart and PHP 7.2, specifically when
+  checking out.
+
+- **CRM/Event - Fix participant note search parameter being ignored
+  ([13697](https://github.com/civicrm/civicrm-core/pull/13697))**
+
+  This change ensures that when searching by "Participant Note" on the "Search
+  Builder form the filter is applied.
+
+- **BAO_Participant - Use default status if not specified for create
+  ([13875](https://github.com/civicrm/civicrm-core/pull/13875))**
+
+  This change fixes a api4 test failure by ensuring that the default value of
+  'status_id' is respected by the Participant BAO. Before this change the
+  'status_id' had a default value and thus was not required but the BAO would
+  not work correctly if a 'status_id' was not supplied. After this change the
+  'status_id' default is respected and the BAO works regardless of whether the
+  'status_id' is supplied.
+
+### CiviGrant
+
+- **PHP Error on Grant Detail Report
+  ([13883](https://github.com/civicrm/civicrm-core/pull/13883))**
+
+  Fixes a PHP error when viewing the "Grant Detail Report" for sites running PHP
+  7.2.
+
+### CiviMail
+
+- **Do not track CSS URLs
+  ([dev/core#836](https://lab.civicrm.org/dev/core/issues/836):
+  [13920](https://github.com/civicrm/civicrm-core/pull/13920))**
+
+  Ensures CiviMail does not convert css URLs into trackable URLs.
+
+- **Restore support for preview of "mailing"/"action" tokens via
+  TokenProcessor/Flexmailer
+  ([14156](https://github.com/civicrm/civicrm-core/pull/14156))**
+
+### CiviMember
+
+- **Disabling or deleting Expired status breaks membership status update
+  ([13259](https://github.com/civicrm/civicrm-core/pull/13259))**
+
+  This change ensures that deleting, disabling or renaming the "Expired"
+  membership status does not cause issues when running the "Membership status
+  processor" scheduled job. Before this change deleting, disabling or renaming
+  the "Expired" membership status would result in the  "Membership status
+  processor" scheduled job failing with the message `Finished execution of
+  Membership status processor with result: Failure, Error message: A fatal error
+  was triggered: One of parameters (value: ) is not of the type Integer`.
+
+- **Fatal error to exception on Membership BAO
+  ([13774](https://github.com/civicrm/civicrm-core/pull/13774))**
+
+  This change improves experience by throwing an exception instead of a fatal
+  error.
+
+### Backdrop Integration
+
+- **civicrm/admin/setting/uf - Fix advice about Backdrop Views
+  ($database_prefix)
+  ([13803](https://github.com/civicrm/civicrm-core/pull/13803))**
+
+  This change updates the advice for configuring views on the
+  `civicrm/admin/setting/uf` form so that it works for Backdrop sites.
+
+### Drupal Integration
+
+- **Drupal8: Can't upload images via CKEditor/kcfinder
+  ([dev/drupal#42](https://lab.civicrm.org/dev/drupal/issues/42):
+  [242](https://github.com/civicrm/civicrm-packages/pull/242))**
+
+   Makes it so on Drupal 8 sites users can upload and browse images in KCFinder.
+
+## <a name="misc"></a>Miscellany
+
+- **Fix e-notice in IDS
+  ([247](https://github.com/civicrm/civicrm-packages/pull/247))**
+
+- **Update 7.x Drupal code to be that of the new coder style
+  ([571](https://github.com/civicrm/civicrm-drupal/pull/571))**
+
+- **Fix up to newer coder style
+  ([69](https://github.com/civicrm/civicrm-backdrop/pull/69))**
+
+- **Remove now-obsolete additionalFromClause parameter from prepareOrderBy
+  ([13874](https://github.com/civicrm/civicrm-core/pull/13874))**
+
+- **Remove switch statement that no longer switches
+  ([13886](https://github.com/civicrm/civicrm-core/pull/13886))**
+
+- **Add unit test for exporting with incomplete data
+  ([13904](https://github.com/civicrm/civicrm-core/pull/13904))**
+
+- **Delete webtests
+  ([13861](https://github.com/civicrm/civicrm-core/pull/13861))**
+
+- **Add a class to handle test entities consistently
+  ([13814](https://github.com/civicrm/civicrm-core/pull/13814))**
+
+- **Fix up composer for composer 2.0 compatibility
+  ([13872](https://github.com/civicrm/civicrm-core/pull/13872))**
+
+- **Remove log files as now supplied by composer
+  ([244](https://github.com/civicrm/civicrm-packages/pull/244), [245](https://github.com/civicrm/civicrm-packages/pull/245))**
+
+- **Remove htmlpurifier from within the IDS to facilitate it being provided by
+  composer ([246](https://github.com/civicrm/civicrm-packages/pull/246))**
+
+- **Remove Log.php require_once statements
+  ([13842](https://github.com/civicrm/civicrm-core/pull/13842))**
+  
+- **Remove amavisd now that it is removed from the packages repository
+  ([243](https://github.com/civicrm/civicrm-packages/pull/243), [13841](https://github.com/civicrm/civicrm-core/pull/13841))**
+
+- **Upgrade htmlpurifier to 4.10 to support PHP7.2 and install via composer
+  ([13840](https://github.com/civicrm/civicrm-core/pull/13840))**
+
+- **Refactor CRM_Contact_Form_Task_PDFLetterCommon
+  ([13892](https://github.com/civicrm/civicrm-core/pull/13892))**
+
+- **Reformat test files for array format
+  ([13862](https://github.com/civicrm/civicrm-core/pull/13862))**
+
+- **Logging - attempt to fix tests
+  ([13832](https://github.com/civicrm/civicrm-core/pull/13832))**
+
+- **Try Reverting commit removing require once to see if it fixes the problem
+  for api4 ([13870](https://github.com/civicrm/civicrm-core/pull/13870))**
+
+- **Import date test
+  ([13823](https://github.com/civicrm/civicrm-core/pull/13823))**
+
+- **Add shared parent for ContributionRecur forms
+  ([13931](https://github.com/civicrm/civicrm-core/pull/13931))**
+
+- **Update PHPWord Patches to match the latest versions of their code
+  ([13923](https://github.com/civicrm/civicrm-core/pull/13923))**
+
+- **Extract assignPaymentFields
+  ([13957](https://github.com/civicrm/civicrm-core/pull/13957))**
+
+- **Move code to assign tax information into shared parent
+  ([13899](https://github.com/civicrm/civicrm-core/pull/13899))**
+
+- **Update test to reflect recently merged PR lower permission to access
+  dedupecheck ([13866](https://github.com/civicrm/civicrm-core/pull/13866))**
+
+- **Test fix ([13856](https://github.com/civicrm/civicrm-core/pull/13856))**
+
+- **Add unit testing for activity creation when cancelling a recurring, related
+  cleanup ([14000](https://github.com/civicrm/civicrm-core/pull/14000))**
+
+- **Improve test coverage for CRM_Utils_Color::getRgb()
+  ([14007](https://github.com/civicrm/civicrm-core/pull/14007))**
+
+- **Add in tests of purifying HTML output
+  ([13845](https://github.com/civicrm/civicrm-core/pull/13845))**
+
+- **Remove more instances of ->free()
+  ([dev/core#562](https://lab.civicrm.org/dev/core/issues/562):
+  [13786](https://github.com/civicrm/civicrm-core/pull/13786)) CONTINUES WORK**
+
+- **(NFC) Ensure phpcs ignores eval notice in these files as it is required
+  ([14032](https://github.com/civicrm/civicrm-core/pull/14032))**
+
+- **(NFC) Lint additional php files up to the new coder standard
+  ([14025](https://github.com/civicrm/civicrm-core/pull/14025))**
+
+- **Port code style fixes to 5.13 from master
+  ([14026](https://github.com/civicrm/civicrm-core/pull/14026))**
+
+- **(NFC) Update CRM/Core CRM/Custom CRM/Dedupe to match the new coder style
+  ([14023](https://github.com/civicrm/civicrm-core/pull/14023))**
+
+- **(NFC) Update CRM/Event folder for the new coder style
+  ([14019](https://github.com/civicrm/civicrm-core/pull/14019))**
+
+- **(NFC) update CRM/Contribute to be the new coder standard
+  ([14021](https://github.com/civicrm/civicrm-core/pull/14021))**
+
+- **(NFC) Update CRM/Friend CRM/Grant CRM/Group CRM/Mailing to be up to d…
+  ([14016](https://github.com/civicrm/civicrm-core/pull/14016))**
+
+- **(NFC) Update CRM/Badge CRM/Campaign CRM/Case to be up to date with a â€¦
+  ([14017](https://github.com/civicrm/civicrm-core/pull/14017))**
+
+- **(NFC) Update CRM/Cxn CRM/Dashlet CRM/Export CRM/Extension and CRM/Fin…
+  ([14018](https://github.com/civicrm/civicrm-core/pull/14018))**
+
+- **[NFC] Short array syntax - auto convert settings dir
+  ([14005](https://github.com/civicrm/civicrm-core/pull/14005))**
+
+- **(NFC) SchemaStructure.php - Fix up mismatch between stored+generated code
+  ([14046](https://github.com/civicrm/civicrm-core/pull/14046))**
+
+- **Arg I put these fixes in 5.12 & master while trying for 5.13
+  ([14036](https://github.com/civicrm/civicrm-core/pull/14036))**
+
+- **(NFC) Update CRM/Member CRM/Note CRM/Logging CRM/Import and CRM/Price…
+  ([13992](https://github.com/civicrm/civicrm-core/pull/13992))**
+
+- **(REF) CRM_Core_Resources - Move hook declaration from addCoreResources() to
+  Container.php ([14008](https://github.com/civicrm/civicrm-core/pull/14008))**
+
+- **(NFC) Update CRM/Activity CRM/Admin and CRM/Batch folders to be the f…
+  ([13990](https://github.com/civicrm/civicrm-core/pull/13990))**
+
+- **(NFC) Update coding style in PCP, Pledge, Profile, Queue, Report folders
+  ([13987](https://github.com/civicrm/civicrm-core/pull/13987))**
+
+- **(NFC) Update CRM/SMS/ CRM/UF/ CRM/Upgrade/ CRM/Tag/ to be up to speed…
+  ([13986](https://github.com/civicrm/civicrm-core/pull/13986))**
+
+- **(NFC) Bring CRM/Utils folder up to future coder standards
+  ([13985](https://github.com/civicrm/civicrm-core/pull/13985))**
+
+- **(NFC) Set _log and _tableName variables to be public
+  ([13988](https://github.com/civicrm/civicrm-core/pull/13988))**
+
+- **Grammar fixes
+  ([13960](https://github.com/civicrm/civicrm-core/pull/13960))**
+
+- **Update Unit test styling to cover the future coder version
+  ([13983](https://github.com/civicrm/civicrm-core/pull/13983))**
+
+- **(NFC) Fix location of comment to match future coder version
+  ([13984](https://github.com/civicrm/civicrm-core/pull/13984))**
+
+- **(NFC) Bring up API folder to style of future coder checker
+  ([13980](https://github.com/civicrm/civicrm-core/pull/13980))**
+
+- **(NFC) Upgrade Civi Folder to the new coder version
+  ([13981](https://github.com/civicrm/civicrm-core/pull/13981))**
+
+- **(NFC) Update various files to pass future civicrm/coder ruleset
+  ([13979](https://github.com/civicrm/civicrm-core/pull/13979))**
+
+- **(NFC) Update various files to pass current phpcs
+  ([13978](https://github.com/civicrm/civicrm-core/pull/13978))**
+
+- **[NFC] Reformat tricksy file CRM_Mailing_BAO_Mailing
+  ([13973](https://github.com/civicrm/civicrm-core/pull/13973))**
+
+- **[NFC] Reformat tricksy file CRM/Contribute/Import/Form/MapField
+  ([13974](https://github.com/civicrm/civicrm-core/pull/13974))**
+
+- **[NFC] short array syntax Autoformat - just  the tricksy bits of CRM/Activity
+  ([13969](https://github.com/civicrm/civicrm-core/pull/13969))**
+
+- **[NFC] array format tricksie file  CRM/Admin/Form/MessageTemplates
+  ([13970](https://github.com/civicrm/civicrm-core/pull/13970))**
+
+- **[NFC] array format tricksie file CRM_Utils_Rest
+  ([13971](https://github.com/civicrm/civicrm-core/pull/13971))**
+
+- **[NFC] array formatting tricksy tricksie file (another CRM/UF/Form/Group.php)
+  ([13972](https://github.com/civicrm/civicrm-core/pull/13972))**
+
+- **[NFC] short array syntax Autoformat - just CRM/ACL dir
+  ([13968](https://github.com/civicrm/civicrm-core/pull/13968))**
+
+- **[NFC] Short array syntax - auto-format CRM directory
+  ([13915](https://github.com/civicrm/civicrm-core/pull/13915))**
+
+- **[REF] extract token functions
+  ([13967](https://github.com/civicrm/civicrm-core/pull/13967))**
+
+- **Test fix ([13949](https://github.com/civicrm/civicrm-core/pull/13949))**
+
+- **Payment test cleanup
+  ([13924](https://github.com/civicrm/civicrm-core/pull/13924))**
+
+- **(NFC) Fix mode on files
+  ([13933](https://github.com/civicrm/civicrm-core/pull/13933))**
+
+- **[NFC] Cleanup DAO factory classes for code standards
+  ([13922](https://github.com/civicrm/civicrm-core/pull/13922))**
+
+- **NFC - Short array syntax - auto-convert ang dir
+  ([13912](https://github.com/civicrm/civicrm-core/pull/13912))**
+
+- **NFC - Short array syntax - auto-convert Civi dir
+  ([13911](https://github.com/civicrm/civicrm-core/pull/13911))**
+
+- **[NFC] Short array syntax - auto-convert api dir
+  ([13909](https://github.com/civicrm/civicrm-core/pull/13909))**
+
+- **Minor code cleanup
+  ([13839](https://github.com/civicrm/civicrm-core/pull/13839))**
+
+- **Minor code cleanup - remove unnecessary ids declaration
+  ([13838](https://github.com/civicrm/civicrm-core/pull/13838))**
+
+- **Code cleanup on membership block loop
+  ([13851](https://github.com/civicrm/civicrm-core/pull/13851))**
+
+- **[NFC] IDE formatting only
+  ([13896](https://github.com/civicrm/civicrm-core/pull/13896))**
+
+- **Minor code cleanups around invoicing assignment
+  ([13857](https://github.com/civicrm/civicrm-core/pull/13857))**
+
+- **[nfc] Reset entire session object between tests
+  ([13878](https://github.com/civicrm/civicrm-core/pull/13878))**
+
+- **Fixing formatting of contributors section
+  ([13860](https://github.com/civicrm/civicrm-core/pull/13860))**
+
+- **[NFC] code formatting only
+  ([13846](https://github.com/civicrm/civicrm-core/pull/13846))**
+
+- **[NFC] Code reformatting
+  ([13849](https://github.com/civicrm/civicrm-core/pull/13849))**
+
+- **Add comments about usage for doPayment() function
+  ([13812](https://github.com/civicrm/civicrm-core/pull/13812))**
+
+- **[nfc] Attempt to improve false negatives on Logging test
+  ([13829](https://github.com/civicrm/civicrm-core/pull/13829))**
+
+- **[NFC] remove unnecessary variable
+  ([13836](https://github.com/civicrm/civicrm-core/pull/13836))**
+
+- **REF Extract case action links into a separate function to facilitate
+  refactoring ([13793](https://github.com/civicrm/civicrm-core/pull/13793))**
+
+- **NFC Whitespace cleanup MembershipBlock.tpl
+  ([13830](https://github.com/civicrm/civicrm-core/pull/13830))**
+
+- **Further cleanup on getRelatedMemberships - just get them with the api
+  ([13797](https://github.com/civicrm/civicrm-core/pull/13797))**
+
+- **[REF] small cleanups on payment.create flow.
+  ([13778](https://github.com/civicrm/civicrm-core/pull/13778))**
+
+- **[NFC] reformat Contact api file to switch to new array formatting
+  ([13806](https://github.com/civicrm/civicrm-core/pull/13806))**
+
+- **[REF] minor code simplification - remove over-handling of amount comp with
+  zero ([13783](https://github.com/civicrm/civicrm-core/pull/13783))**
+
+- **Attempted test fix
+  ([13791](https://github.com/civicrm/civicrm-core/pull/13791))**
+
+- **Remove reference to google checkout
+  ([13784](https://github.com/civicrm/civicrm-core/pull/13784))**
+
+- **[NFC] template whitespace cleanup
+  ([13782](https://github.com/civicrm/civicrm-core/pull/13782))**
+
+- **(NFC) Update for compliance with next phpcs standard
+  ([577](https://github.com/civicrm/civicrm-drupal/pull/577))**
+
+- **Lint .inc files in Drupal module folder to match newer coder standard
+  ([574](https://github.com/civicrm/civicrm-drupal/pull/574))**
+
+- **(NFC) Get phpcs to ignore the use of eval in this file as it is required
+  ([575](https://github.com/civicrm/civicrm-drupal/pull/575))**
+
+- **(NFC) Update for compliance with next phpcs standard
+  ([72](https://github.com/civicrm/civicrm-backdrop/pull/72))**
+
+- **(NFC) Lint .inc files and ensure that the eval usage in tests/phpunit…
+  ([71](https://github.com/civicrm/civicrm-backdrop/pull/71))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following code authors:
+
+AGH Strategies - Alice Frumin, Andrew Hunt, Eli Lisseck; Agileware - Alok Patel,
+Francis Whittle; Australian Greens - Seamus Lee; calibrate - Wouter Hechtermans;
+Christian Wach; CiviCRM - Coleman Watts, Tim Otten; CiviDesk - Yashodha Chaku;
+CompuCorp - Omar Abu Hussein; Coop SymbioTIC - Mathieu Lutfy; Dave D; Electronic
+Frontier Foundation - Mark Burdett; Freeform Solutions - Herb van den Dool;
+Fuzion - Jitendra Purohit; GreenPeace Central and Eastern Europe - Patrick
+Figel; JMA Consulting - Monish Deb; Megaphone Technology Consulting - Jon
+Goldberg; MJW Consulting - Matthew Wire; Pradeep Nayak; Skvare - Mark Hanna;
+Squiffle Consulting - Aidan Saunders; Stephen Palmstrom; Timbsoft Technologies -
+Tunbola Ogunwande; Wikimedia Foundation - Eileen McNaughton
+
+Most authors also reviewed code for this release; in addition, the following
+reviewers contributed their comments:
+
+Agileware - Justin Freeman; Aniessh Sethh; Artful Robot - Rich Lott; British
+Humanist Association - Andrew West; Circle Interactive - Dave Jenkins; Shitij
+Gugnani; Coop SymbioTIC - Samuel Vanhove; GValFr35; JMA Consulting - Joe Murray;
+Joinery - Allen Shaw; Aivars; Korlon - Stuart Gaston; Lighthouse Design and
+Consulting - Brian Shaughnessy; mcuradoc; Onyemenam Ndubuisi; Tadpole
+Collective - Kevin Cristiano
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Alice Frumin and Andrew Hunt.  If you'd like
+to provide feedback on them, please log in to https://chat.civicrm.org/civicrm
+and contact `@agh1`.
diff --git a/release-notes/5.13.1.md b/release-notes/5.13.1.md
new file mode 100644 (file)
index 0000000..1dca67e
--- /dev/null
@@ -0,0 +1,39 @@
+# CiviCRM 5.13.1
+
+Released May 2, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Fix upgrade failure on multilingual sites ([dev/core#931](https://lab.civicrm.org/dev/core/issues/931): [14187](https://github.com/civicrm/civicrm-core/pull/14187))**
+
+- **Fix regression in REST endpoint on WordPress ([dev/wordpress#26](https://lab.civicrm.org/dev/wordpress/issues/26): [14186](https://github.com/civicrm/civicrm-core/pull/14186))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Australian Greens - Seamus Lee; Megaphone Technology Consulting - Jon Goldberg;
+Tadpole Collective - Kevin Cristiano;
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.13.2.md b/release-notes/5.13.2.md
new file mode 100644 (file)
index 0000000..487b778
--- /dev/null
@@ -0,0 +1,41 @@
+# CiviCRM 5.13.2
+
+Released May 6, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Fix regression in sorting "Activities" tab by "source_name" ([dev/core#934](https://lab.civicrm.org/dev/core/issues/934):
+  [14194](https://github.com/civicrm/civicrm-core/pull/14194), [14204](https://github.com/civicrm/civicrm-core/pull/14204))**
+
+- **Fix regression in which inbound email attachments were saved as `.unknown`" ([dev/core#940](https://lab.civicrm.org/dev/core/issues/940):
+  [14207](https://github.com/civicrm/civicrm-core/pull/14207)**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; CiviCRM - Tim Otten; Australian Greens - Seamus Lee;
+Dave D;
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.13.3.md b/release-notes/5.13.3.md
new file mode 100644 (file)
index 0000000..c9e5162
--- /dev/null
@@ -0,0 +1,50 @@
+# CiviCRM 5.13.3
+
+Released May 14, 2019
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Activity Tab - Fix regression in outputting names with > 25 activities recorded" ([dev/core#942](https://lab.civicrm.org/dev/core/issues/942):
+  [14231](https://github.com/civicrm/civicrm-core/pull/14231))**
+
+- **Activity Search - Fix regression in displaying the "Activity Date" filter
+  ([14230](https://github.com/civicrm/civicrm-core/pull/14230))**
+
+- **Profile - Fix e-notice when creating or editing a profile ([dev/core#923](https://lab.civicrm.org/dev/core/issues/923):
+  [14229](https://github.com/civicrm/civicrm-core/pull/14229))**
+
+- **Menu - Fix Javascript error involving ":hover" selector ([dev/core#950](https://lab.civicrm.org/dev/core/issues/950):
+  [14228](https://github.com/civicrm/civicrm-core/pull/14228))**
+
+- **Event Search - Fix error when filtering participants by 1 event and multiple statuses ([dev/core#956](https://lab.civicrm.org/dev/core/issues/956):
+  [14234](https://github.com/civicrm/civicrm-core/pull/14234))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Wikimedia Foundation - Eileen McNaughton; Pradeep Nayak; Greenpeace CEE - Patrick Figel;
+Dave D; CiviCRM - Coleman Watts; Australian Greens - Seamus Lee
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/release-notes/5.13.4.md b/release-notes/5.13.4.md
new file mode 100644 (file)
index 0000000..bc5c34d
--- /dev/null
@@ -0,0 +1,23 @@
+# CiviCRM 5.13.4
+
+Released May 15, 2019
+
+- **[Security advisories](#security)**
+- **[Features](#features)**
+- **[Bugs resolved](#bugs)**
+- **[Miscellany](#misc)**
+- **[Credits](#credits)**
+
+## <a name="security"></a>Security advisories
+
+- **[CIVI-SA-2019-09](https://civicrm.org/advisory/civi-sa-2019-09-xxe-in-phpword)**: XXE in PHPWord
+- **[CIVI-SA-2019-10](https://civicrm.org/advisory/civi-sa-2019-10-tcpdf-xss-and-rce-vulerabilities)**: TCPDF XSS and RCE vulnerabilities
+- **[CIVI-SA-2019-11](https://civicrm.org/advisory/civi-sa-2019-11-jquery-objectprototype-pollution)**: jQuery Object.prototype pollution
+- **[CIVI-SA-2019-12](https://civicrm.org/advisory/civi-sa-2019-12-sqli-in-country-et-al)**: SQLI in "Country", et al
+- **[CIVI-SA-2019-13](https://civicrm.org/advisory/civi-sa-2019-13-harden-against-unserialize-vulnerabilities)**: Harden against unserialize vulnerabilities
+- **[CIVI-SA-2019-14](https://civicrm.org/advisory/civi-sa-2019-14-sqli-in-apiv3-getoptions)**: SQLI in APIv3 GetOptions
+- **[CIVI-SA-2019-15](https://civicrm.org/advisory/civi-sa-2019-15-xss-via-forged-mime-type)**: XSS via forged MIME type
+- **[CIVI-SA-2019-16](https://civicrm.org/advisory/civi-sa-2019-16-sqli-in-certain-checkboxes)**: SQLI in certain checkboxes
+- **[CIVI-SA-2019-17](https://civicrm.org/advisory/civi-sa-2019-17-sqli-in-manage-events)**: SQLI in "Manage Events"
+- **[CIVI-SA-2019-18](https://civicrm.org/advisory/civi-sa-2019-18-xss-in-civicrm-installer)**: XSS in CiviCRM installer
+- **[CIVIEXT-SA-2019-01](https://civicrm.org/advisory/civiext-sa-2019-01-multiple-security-issues-in-apiv4)**: Multiple security issues in APIv4
index 27af8a8f5b4f1618f3c17f03248827ad6c64ecfa..cc69e3f982d74b048f47882b5170dfc3efda1522 100644 (file)
@@ -1052,4 +1052,18 @@ return [
     'help_text' => NULL,
     'validate_callback' => 'CRM_Utils_Rule::color',
   ],
+  'requestableMimeTypes' => [
+    'group_name' => 'CiviCRM Preferences',
+    'group' => 'core',
+    'name' => 'requestableMimeTypes',
+    'type' => 'String',
+    'html_type' => 'Text',
+    'default' => 'image/jpeg,image/pjpeg,image/gif,image/x-png,image/png,image/jpg,text/html,application/pdf',
+    'add' => '5.13',
+    'title' => ts('Mime Types that can be passed as URL params'),
+    'is_domain' => 1,
+    'is_contact' => 0,
+    'description' => ts('Acceptable Mime Types that can be used as part of file urls'),
+    'help_text' => NULL,
+  ],
 ];
index 3305a0d4efc773e571d085e1c8f3ed89e9e5b54a..54141a87d5b45b6d366e32e4519db2bfda1daccd 100644 (file)
@@ -399,7 +399,7 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_domain` WRITE;
 /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.14.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.15.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
 /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
 UNLOCK TABLES;
 
index 315f6cd34e153105bd63956f84365213d5e741e4..e9ac9139fa3ef882b4d372eb6faf2d3c6e931239 100644 (file)
@@ -89,9 +89,8 @@
 </tr>
 
 <tr>
-  <td>
-    {include file="CRM/Core/DatePickerRange.tpl" fieldName="activity_date_time"}
-  </td>
+  {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="activity_date_time" colspan="2"}
+  <td>&nbsp;</td>
 </tr>
 <tr>
   <td>
index 8d4e4445a90b042af2b653a29fde9619e7503df5..275978ccf1b488f628ee37f0c5c96be9c276fef9 100644 (file)
     <p>{ts 1=$docLink}ACLs (Access Control Lists) allow you control access to CiviCRM data. An ACL consists of an <strong>Operation</strong> (e.g. 'View' or 'Edit'), a <strong>set of Data</strong> that the operation can be performed on (e.g. a group of contacts), and a <strong>Role</strong> that has permission to do this operation. Refer to the %1 for more info.{/ts}
     {if $config->userSystem->is_drupal EQ '1'}{ts}Note that a CiviCRM ACL Role is not related to the Drupal Role.{/ts}{/if}</p>
     <p>{ts}<strong>EXAMPLE:</strong> 'Team Leaders' (<em>ACL Role</em>) can 'Edit' (<em>Operation</em>) all contacts in the 'Active Volunteers Group' (<em>Data</em>).{/ts}</p>
-    {if $config->userSystem->is_drupal EQ '1'}
-        <p>{ts 1=$ufAccessURL}Use <a href='%1'>Drupal Access Control</a> to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events Profiles, and/or Custom Data Fields.{/ts}</p>
-    {elseif $config->userFramework EQ 'Joomla'}
-        <p>{ts 1=$ufAccessURL 2=$jAccessParams}Use <a href='%1' %2>Joomla Access Control</a> to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}</p>
-   {elseif $config->userFramework EQ 'WordPress'}
-        <p>{ts 1=$ufAccessURL}Use <a href='%1'>WordPress Access Control</a> to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}</p>
-   {/if}
+    <p>{ts 1=$ufAccessURL 2=$jAccessParams 3=$config->userFramework}Use <a href='%1' %2>%3 Access Control</a> to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}</p>
    <p>{ts 1=$config->userFramework}Note that %1 Access Control permissions take precedence over CiviCRM ACLs. If you wish to use CiviCRM ACLs, first disable the related permission in %1 Access control for a user role, and then gradually add ACLs to replace that permission for certain groups of contacts.{/ts}
 </div>
 
     <table class="report">
         <tr>
-    {if $config->userSystem->is_drupal EQ '1'}
-            <td class="nowrap"><a href="{$ufAccessURL}" id="adminAccess">&raquo; {ts}Drupal Access Control{/ts}</a></td>
+            <td class="nowrap"><a href="{$ufAccessURL}" {$jAccessParams} id="adminAccess">&raquo; {ts 1=$config->userFramework}%1 Access Control{/ts}</a></td>
             <td>{ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}</td>
-    {elseif $config->userFramework EQ 'Joomla'}
-            <td class="nowrap"><a href="{$ufAccessURL}" {$jAccessParams} id="adminAccess">&raquo; {ts}Joomla Access Control{/ts}</a></td>
-            <td>{ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}</td>
-    {elseif $config->userFramework EQ 'WordPress'}
-            <td class="nowrap"><a href="{$ufAccessURL}" id="adminAccess">&raquo; {ts}WordPress Access Control{/ts}</a></td>
-            <td>{ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}</td>
-    {/if}
         </tr>
         <tr><td colspan="2" class="separator"><strong>{ts}Use following steps if you need to control View and/or Edit permissions for specific contact groups, specific profiles or specific custom data fields.{/ts}</strong></td></tr>
     <tr>
index 7a88582f2990be715f1eff28ec73428d2fd3b20e..d16b96871497b7f4367d6ac3ecaf242227300273 100644 (file)
 
             <tr>
               <td>{$form.start_date.label}<br/>
-                {include file="CRM/common/jcalendar.tpl" elementName=start_date}
+                {$form.start_date.html}
               </td>
               <td>{$form.end_date.label}<br/>
-                {include file="CRM/common/jcalendar.tpl" elementName=end_date}
+                {$form.end_date.html}
               </td>
             </tr>
 
index a4b54c3f89511339102663a1a4c7d3c6df2b29eb..b7a411ad393666d92ce8f90091ad4c5d9c5a6174 100644 (file)
       });
 
       $(".crm-dedupe-flip-selections").on('click', function(e) {
+        e.preventDefault();
         var ids = [];
         $('.crm-row-selected').each(function() {
           var ele = CRM.$('input.crm-dedupe-select', this);
         });
         if (ids.length > 0) {
           var dataUrl = {/literal}"{crmURL p='civicrm/ajax/flipDupePairs' h=0 q='snippet=4'}"{literal};
-          CRM.$.post(dataUrl, {pnid: ids}, function (response) {
+          var request = $.post(dataUrl, {pnid: ids});
+          request.done(function(dt) {
             var mapper = {1:3, 2:4, 5:6, 7:8, 9:10}
             $('.crm-row-selected').each(function() {
               var idx = $('table#dupePairs').DataTable().row(this).index();
               // keep the checkbox checked if needed
               $('input.crm-dedupe-select', this).prop('checked', $(this).hasClass('crm-row-selected'));
             });
-          }, 'json');
+          });
         }
       });
     });
index 838743a21760858683cfac21932358bcd302ee2d..898c4e028b6dc80e88715bc4d6c796457918fe0c 100644 (file)
           <div class="clear"></div>
           {if $start_date_editable}
             {if $is_date}
-              <div class="label">{$form.start_date.label}</div><div class="content">{include file="CRM/common/jcalendar.tpl" elementName=start_date}</div>
+              <div class="label">{$form.start_date.label}</div><div class="content">{$form.start_date.html}</div>
             {else}
               <div class="label">{$form.start_date.label}</div><div class="content">{$form.start_date.html}</div>
             {/if}
index 494ebba8eb936a7b3fbc1fcb7caf37f3ce65ebc0..3a5213dd85849a718e5e09391102d4cf37d6fff3 100644 (file)
         </table>
     </div>
 {if $futurePaymentProcessor}
-    <span id="pledge_calendar_date_field">&nbsp;&nbsp;{include file="CRM/common/jcalendar.tpl" elementName=pledge_calendar_date}</span>
+    <span id="pledge_calendar_date_field">&nbsp;&nbsp;{$form.pledge_calendar_date.html}</span>
     <span id="pledge_calendar_month_field">&nbsp;&nbsp;{$form.pledge_calendar_month.html}<br/><span class="description">{ts}Recurring payment will be processed this day of the month following submission of this contribution page.{/ts}</span></span>
 {/if}
 
diff --git a/templates/CRM/Core/DatePickerRangeWrapper.tpl b/templates/CRM/Core/DatePickerRangeWrapper.tpl
new file mode 100644 (file)
index 0000000..9396375
--- /dev/null
@@ -0,0 +1,29 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 5                                                  |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+{* Wrapper around DatePickerRange TPL file *}
+<td {if $colspan} colspan="{$colspan}" {else} colspan="2" {/if} {if $class} class="{$class}" {/if}>
+    {include file="CRM/Core/DatePickerRange.tpl" fieldName=$fieldName}
+</td>
index fb0a114c630c190b80be82f4bacde1baaf2d6873..1c9555bd4605f502f2de7b3866665d7d0444a411 100644 (file)
@@ -21,7 +21,7 @@
     {foreach from=$line_items item=line_item}
       <tr class="event-line-item {$line_item.class}">
   <td class="event-title">
-    {$line_item.event->title} ({$line_item.event->start_date})
+    {$line_item.event->title} ({$line_item.event->start_date|crmDate})
   </td>
   <td class="participants-column">
     {$line_item.num_participants}<br/>
index bb7bb1d17911ab2f02c889e887dace7d3313d63d..1febb52fc654f6f316710834b4c18dd3db4d1a06 100644 (file)
@@ -98,7 +98,7 @@
         });
       }
       else {
-        if (elementId.is('select') === true && firstElement.parent().find(':input').select().index() >= 1 && firstElement.parent().find('select').select().index < 1) {
+        if (elementId.is('select') === true && firstElement.parent().find(':input').select().index() >= 1 && firstElement.parent().find('select').select().length > 1) {
           // its a multiselect case
           firstElement.parent().find(':input').select().each( function(count) {
             var firstElementValue = $(this).val();
index 9f869f94d2084cf1eff84003b98b9eafd2433e2b..a264de1eae563d75a53aa8780836d7f900d40083 100644 (file)
    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. *}
 {crmRegion name='form-buttons'}
-  {foreach from=$form.buttons item=button key=key name=btns}
-    {if $key|substring:0:4 EQ '_qf_'}
-        {if $location}
-          {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"}
-        {else}
-          {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-'}
-          {assign var='buttonClass' value=' crm-i-button'}
-          {capture assign=iconDisp}<i class="crm-i {$icon}"></i>{/capture}
-        {elseif $icon}
-          {assign var='buttonClass' value=' crm-icon-button'}
-          {capture assign=iconDisp}<span class="crm-button-icon ui-icon-{$icon}"> </span>{/capture}
-        {/if}
-        {crmGetAttribute html=$html attr='disabled' assign='disabled'}
-        <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}{$buttonClass}{if $disabled} crm-button-disabled{/if}"{if $buttonStyle} style="{$buttonStyle}"{/if}>
-          {$iconDisp}
-          {$html}
-        </span>
+{foreach from=$form.buttons item=button key=key name=btns}
+  {if $key|substring:0:4 EQ '_qf_'}
+    {if $location}
+      {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"}
+    {else}
+      {assign var='html' value=$form.buttons.$key.html}
     {/if}
-  {/foreach}
+    {crmGetAttribute html=$html attr='crm-icon' assign='icon'}
+    {capture assign=iconPrefix}{$icon|truncate:3:"":true}{/capture}
+    {if $icon && $iconPrefix eq 'fa-'}
+      {assign var='buttonClass' value=' crm-i-button'}
+      {capture assign=iconDisp}<i class="crm-i {$icon}"></i>{/capture}
+    {elseif $icon}
+      {assign var='buttonClass' value=' crm-icon-button'}
+      {capture assign=iconDisp}<span class="crm-button-icon ui-icon-{$icon}"> </span>{/capture}
+    {/if}
+    {crmGetAttribute html=$html attr='disabled' assign='disabled'}
+    <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}{$buttonClass}{if $disabled} crm-button-disabled{/if}"{if $buttonStyle} style="{$buttonStyle}"{/if}>
+      {$iconDisp}
+      {$html}
+    </span>
+  {/if}
+{/foreach}
 {/crmRegion}
index 1f49256bb887c08bbec5813a9105500fed453206..e540f1f760f86b37e24703d33e2aa4e2a79bda87 100644 (file)
@@ -30,39 +30,6 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
     parent::tearDown();
   }
 
-  /**
-   * Setup or clean up SMS tests
-   * @param bool $teardown
-   *
-   * @throws \CiviCRM_API3_Exception
-   */
-  public function setupForSmsTests($teardown = FALSE) {
-    require_once 'CiviTest/CiviTestSMSProvider.php';
-
-    // Option value params for CiviTestSMSProvider
-    $groupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'sms_provider_name', 'id', 'name');
-    $params = array(
-      'option_group_id' => $groupID,
-      'label' => 'unittestSMS',
-      'value' => 'unit.test.sms',
-      'name'  => 'CiviTestSMSProvider',
-      'is_default' => 1,
-      'is_active'  => 1,
-      'version'    => 3,
-    );
-
-    if ($teardown) {
-      // Test completed, delete provider
-      $providerOptionValueResult = civicrm_api3('option_value', 'get', $params);
-      civicrm_api3('option_value', 'delete', array('id' => $providerOptionValueResult['id']));
-      return;
-    }
-
-    // Create an SMS provider "CiviTestSMSProvider". Civi handles "CiviTestSMSProvider" as a special case and allows it to be instantiated
-    //  in CRM/Sms/Provider.php even though it is not an extension.
-    civicrm_api3('option_value', 'create', $params);
-  }
-
   /**
    * Test case for create() method.
    */
@@ -331,12 +298,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Test getActivities BAO method for getting count
    */
   public function testGetActivitiesCountforNonAdminDashboard() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     $params = array(
       'contact_id' => 9,
@@ -360,12 +322,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Test getActivities BAO method for getting count
    */
   public function testGetActivitiesCountforContactSummary() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     $params = array(
       'contact_id' => 9,
@@ -387,12 +344,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * CRM-18706 - Test Include/Exclude Activity Filters
    */
   public function testActivityFilters() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
     Civi::settings()->set('preserve_activity_tab_filter', 1);
     $this->createLoggedInUser();
 
@@ -429,12 +381,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Test getActivities BAO method for getting count
    */
   public function testGetActivitiesCountforContactSummaryWithNoActivities() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     $params = array(
       'contact_id' => 17,
@@ -501,12 +448,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Test getActivities BAO method.
    */
   public function testGetActivitiesforNonAdminDashboard() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     $contactID = 9;
     $params = array(
@@ -564,10 +506,34 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
       'contact_id' => $contactId,
       'context' => 'activity',
     );
-    foreach (array(CRM_Activity_BAO_Activity::getActivities($params)) as $activities) {
-      //verify target count
-      $this->assertEquals($targetCount, $activities[1]['target_contact_counter']);
-      $this->assertEquals([$targetContactIDs[0] => 'Anderson, Anthony'], $activities[1]['target_contact_name']);
+    $activities = CRM_Activity_BAO_Activity::getActivities($params);
+    //verify target count
+    $this->assertEquals($targetCount, $activities[1]['target_contact_count']);
+    $this->assertEquals([$targetContactIDs[0] => 'Anderson, Anthony'], $activities[1]['target_contact_name']);
+    $this->assertEquals('Anderson, Anthony', $activities[1]['source_contact_name']);
+    $this->assertEquals('Anderson, Anthony', $activities[1]['assignee_contact_name'][4]);
+  }
+
+  /**
+   * Test getActivities BAO method.
+   */
+  public function testGetActivitiesforContactSummaryWithSortOptions() {
+    $this->createTestActivities();
+    $params = [
+      'contact_id' => 9,
+      'admin' => FALSE,
+      'caseId' => NULL,
+      'context' => 'activity',
+      'activity_type_id' => NULL,
+      'offset' => 0,
+      'rowCount' => 0,
+      'sort' => 'source_contact_name desc',
+    ];
+
+    $activities = CRM_Activity_BAO_Activity::getActivities($params);
+    $alphaOrder = ['Test Contact 11', 'Test Contact 12', 'Test Contact 3', 'Test Contact 4', 'Test Contact 9'];
+    foreach ($activities as $activity) {
+      $this->assertEquals(array_pop($alphaOrder), $activity['source_contact_name']);
     }
 
   }
@@ -575,13 +541,8 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
   /**
    * Test getActivities BAO method.
    */
-  public function testGetActivitiesforContactSummary() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+  public function testGetActivitiesForContactSummary() {
+    $this->createTestActivities();
 
     $contactID = 9;
     $params = array(
@@ -592,39 +553,42 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
       'activity_type_id' => NULL,
       'offset' => 0,
       'rowCount' => 0,
-      'sort' => NULL,
     );
 
     //since we are loading activities from dataset, we know total number of activities for this contact
     // 5 activities, Contact Summary should show all activities
     $count = 5;
-    foreach (array(CRM_Activity_BAO_Activity::getActivities($params)) as $activities) {
-
-      $this->assertEquals($count, count($activities));
+    $activities = CRM_Activity_BAO_Activity::getActivities($params);
+    $this->assertEquals($count, count($activities));
+    foreach ($activities as $key => $value) {
+      $this->assertEquals($value['subject'], "subject {$key}", 'Verify activity subject is correct.');
 
-      foreach ($activities as $key => $value) {
-        $this->assertEquals($value['subject'], "subject {$key}", 'Verify activity subject is correct.');
-
-        if ($key > 8) {
-          $this->assertEquals($value['status_id'], 2, 'Verify all activities are scheduled.');
-        }
-        else {
-          $this->assertEquals($value['status_id'], 1, 'Verify all activities are scheduled.');
-        }
+      if ($key > 8) {
+        $this->assertEquals($value['status_id'], 2, 'Verify all activities are scheduled.');
+      }
+      else {
+        $this->assertEquals($value['status_id'], 1, 'Verify all activities are scheduled.');
+      }
 
-        if ($key > 8) {
-          $this->assertEquals($value['activity_type_id'], 1, 'Verify activity type is correct.');
-        }
-        else {
-          $this->assertEquals($value['activity_type_id'], 2, 'Verify activity type is correct.');
-        }
+      if ($key === 12) {
+        $this->assertEquals($value['activity_type'], 'Bulk Email', 'Verify activity type is correct.');
+        $this->assertEquals('(2 recipients)', $value['recipients']);
+        $targetContactID = key($value['target_contact_name']);
+        // The 2 targets have ids 10 & 11. Since they are not sorted it could be either on some systems.
+        $this->assertTrue(in_array($targetContactID, [10, 11]));
+      }
+      elseif ($key > 8) {
+        $this->assertEquals($value['activity_type_id'], 1, 'Verify activity type is correct.');
+      }
+      else {
+        $this->assertEquals($value['activity_type_id'], 2, 'Verify activity type is correct.');
+      }
 
-        if ($key == 3) {
-          $this->assertArrayHasKey($contactID, $value['target_contact_name']);
-        }
-        elseif ($key == 4) {
-          $this->assertArrayHasKey($contactID, $value['assignee_contact_name']);
-        }
+      if ($key == 3) {
+        $this->assertEquals([$contactID => 'Test Contact ' . $contactID], $value['target_contact_name']);
+      }
+      elseif ($key == 4) {
+        $this->assertArrayHasKey($contactID, $value['assignee_contact_name']);
       }
     }
   }
@@ -633,12 +597,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Test getActivities BAO method.
    */
   public function testGetActivitiesforContactSummaryWithActivities() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     // parameters for different test cases, check each array key for the specific test-case
     $testCases = array(
@@ -763,12 +722,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    */
   public function testByActivityDateAndStatus() {
     CRM_Core_Config::singleton()->userPermissionClass->permissions = ['view all contacts', 'access CiviCRM'];
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     // activity IDs catagorised by date
     $lastWeekActivities = array(1, 2, 3);
@@ -1030,12 +984,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
    * Set up for testing activity queries.
    */
   protected function setUpForActivityDashboardTests() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/activities_for_dashboard_count.xml'
-      )
-    );
+    $this->createTestActivities();
 
     $this->_params = array(
       'contact_id' => NULL,
@@ -1163,8 +1112,7 @@ $text
   public function testSendSMSWithoutPermission() {
     $dummy = NULL;
     $session = CRM_Core_Session::singleton();
-    $config = &CRM_Core_Config::singleton();
-    $config->userPermissionClass->permissions = array('access CiviCRM');
+    CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM');
 
     CRM_Activity_BAO_Activity::sendSMS(
       $dummy,
@@ -1335,4 +1283,10 @@ $text
     return array($sent, $activityId, $success);
   }
 
+  protected function createTestActivities() {
+    $this->loadXMLDataSet(dirname(__FILE__) . '/activities_for_dashboard_count.xml');
+    // Make changes to improve variation in php since the xml method is brittle & relies on option values being unchanged.
+    $this->callAPISuccess('Activity', 'create', ['id' => 12, 'activity_type_id' => 'Bulk Email']);
+  }
+
 }
index 726975dd695a159d2525447ab3514243a4cf3876..1bd225198d72bfe39da7405958f8f5fbd1328fb0 100644 (file)
@@ -34,36 +34,42 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
 
   /**
    * Membership type name used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_membershipTypeName = NULL;
 
   /**
    * Membership type id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_membershipTypeID = NULL;
 
   /**
    * Contact id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_contactID = NULL;
   /**
    * Contact id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_contactID2 = NULL;
 
   /**
    * Contact id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_contactID3 = NULL;
 
   /**
    * Contact id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_contactID4 = NULL;
 
index 7c8f1ed47f8ba97b734e660d07bef8e30c7a9662..fae0799d69994e8b9642c9ed261db7c142623d77 100644 (file)
@@ -31,6 +31,28 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
     CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
   }
 
+  /**
+   * Make sure that the latest case activity works accurately.
+   */
+  public function testCaseActivity() {
+    $userID = $this->createLoggedInUser();
+
+    $addTimeline = civicrm_api3('Case', 'addtimeline', [
+      'case_id' => 1,
+      'timeline' => "standard_timeline",
+    ]);
+
+    $query = CRM_Case_BAO_Case::getCaseActivityQuery('recent', $userID, ' civicrm_case.id IN( 1 )');
+    $res = CRM_Core_DAO::executeQuery($query);
+    $openCaseType = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Open Case');
+    while ($res->fetch()) {
+      $message = 'Failed asserting that the case activity query has a activity_type_id property:';
+      $this->assertObjectHasAttribute('activity_type_id', $res, $message . PHP_EOL . print_r($res, TRUE));
+      $message = 'Failed asserting that the latest activity from Case ID 1 was "Open Case":';
+      $this->assertEquals($openCaseType, $res->activity_type_id, $message . PHP_EOL . print_r($res, TRUE));
+    }
+  }
+
   protected function tearDown() {
     parent::tearDown();
     $this->quickCleanup($this->tablesToTruncate, TRUE);
@@ -50,9 +72,14 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
   /**
    * Create and return case object of given Client ID.
    * @param $clientId
+   * @param $loggedInUser
    * @return CRM_Case_BAO_Case
    */
-  private function createCase($clientId) {
+  private function createCase($clientId, $loggedInUser = NULL) {
+    if (empty($loggedInUser)) {
+      // backwards compatibility - but it's more typical that the creator is a different person than the client
+      $loggedInUser = $clientId;
+    }
     $caseParams = array(
       'activity_subject' => 'Case Subject',
       'client_id'        => $clientId,
@@ -66,7 +93,7 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
       'activity_details' => '',
     );
     $form = new CRM_Case_Form_Case();
-    $caseObj = $form->testSubmit($caseParams, "OpenCase", $clientId, "standalone");
+    $caseObj = $form->testSubmit($caseParams, "OpenCase", $loggedInUser, "standalone");
     return $caseObj;
   }
 
@@ -161,4 +188,119 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {
    * }
    */
 
+  /**
+   * Test various things after a case is closed.
+   *
+   * This annotation is not ideal, but without it there is some kind of
+   * messup that happens to quickform that persists between tests, e.g.
+   * it can't add maxfilesize validation rules.
+   * @runInSeparateProcess
+   * @preserveGlobalState disabled
+   */
+  public function testCaseClosure() {
+    $loggedInUser = $this->createLoggedInUser();
+    $client_id = $this->individualCreate();
+    $caseObj = $this->createCase($client_id, $loggedInUser);
+    $case_id = $caseObj->id;
+
+    // Get the case status option value for "Resolved" (name="Closed").
+    $closed_status = $this->callAPISuccess('OptionValue', 'getValue', [
+      'return' => 'value',
+      'option_group_id' => 'case_status',
+      'name' => 'Closed',
+    ]);
+    $this->assertNotEmpty($closed_status);
+
+    // Get the activity status option value for "Completed"
+    $completed_status = $this->callAPISuccess('OptionValue', 'getValue', [
+      'return' => 'value',
+      'option_group_id' => 'activity_status',
+      'name' => 'Completed',
+    ]);
+    $this->assertNotEmpty($completed_status);
+
+    // Get the value for the activity type id we need to create
+    $atype = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Change Case Status');
+
+    // Now it gets weird. There doesn't seem to be a good way to test this, so we simulate a form and the various bits that go with it.
+
+    // HTTP vars needed because that's how the form determines stuff
+    $oldMETHOD = empty($_SERVER['REQUEST_METHOD']) ? NULL : $_SERVER['REQUEST_METHOD'];
+    $oldGET = empty($_GET) ? [] : $_GET;
+    $oldREQUEST = empty($_REQUEST) ? [] : $_REQUEST;
+    $_SERVER['REQUEST_METHOD'] = 'GET';
+    $_GET['caseid'] = $case_id;
+    $_REQUEST['caseid'] = $case_id;
+    $_GET['cid'] = $client_id;
+    $_REQUEST['cid'] = $client_id;
+    $_GET['action'] = 'add';
+    $_REQUEST['action'] = 'add';
+    $_GET['reset'] = 1;
+    $_REQUEST['reset'] = 1;
+    $_GET['atype'] = $atype;
+    $_REQUEST['atype'] = $atype;
+
+    $form = new CRM_Case_Form_Activity();
+    $form->controller = new CRM_Core_Controller_Simple('CRM_Case_Form_Activity', 'Case Activity');
+    $form->_activityTypeId  = $atype;
+    $form->_activityTypeName = 'Change Case Status';
+    $form->_activityTypeFile = 'ChangeCaseStatus';
+
+    $form->preProcess();
+    $form->buildQuickForm();
+    $form->setDefaultValues();
+
+    // Now submit the form. Store the date used so we can check it later.
+
+    $t = time();
+    $now_date = date('Y-m-d H:i:s', $t);
+    $now_date_date_only = date('Y-m-d', $t);
+    $actParams = [
+      'is_unittest' => TRUE,
+      'case_status_id' => $closed_status,
+      'activity_date_time' => $now_date,
+      'target_contact_id' => $client_id,
+      'source_contact_id' => $loggedInUser,
+      'subject' => 'null', // yeah this is extra weird, but without it you get the wrong subject
+    ];
+
+    $form->postProcess($actParams);
+
+    // Ok now let's check some things
+
+    $result = $this->callAPISuccess('Case', 'get', [
+      'sequential' => 1,
+      'id' => $case_id,
+    ]);
+    $caseData = array_shift($result['values']);
+
+    $this->assertEquals($caseData['end_date'], $now_date_date_only);
+    $this->assertEquals($caseData['status_id'], $closed_status);
+
+    // now get the latest activity and check some things for it
+
+    $actId = max($caseData['activities']);
+    $this->assertNotEmpty($actId);
+
+    $result = $this->callAPISuccess('Activity', 'get', [
+      'sequential' => 1,
+      'id' => $actId,
+    ]);
+    $activity = array_shift($result['values']);
+
+    $this->assertEquals($activity['subject'], 'Case status changed from Ongoing to Resolved');
+    $this->assertEquals($activity['activity_date_time'], $now_date);
+    $this->assertEquals($activity['status_id'], $completed_status);
+
+    // Now replace old globals
+    if (is_null($oldMETHOD)) {
+      unset($_SERVER['REQUEST_METHOD']);
+    }
+    else {
+      $_SERVER['REQUEST_METHOD'] = $oldMETHOD;
+    }
+    $_GET = $oldGET;
+    $_REQUEST = $oldREQUEST;
+  }
+
 }
index 95ea92894a18a15867a03bb46c30e3ea0dcc2000..c82fd495a5e96b257f05ec49f4b94d5882aee6b8 100644 (file)
@@ -19,9 +19,14 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
     parent::setUp();
   }
 
+  /**
+   * Clean up after test.
+   *
+   * @throws \Exception
+   */
   public function tearDown() {
     $this->quickCleanUpFinancialEntities();
-    $tablesToTruncate = array(
+    $tablesToTruncate = [
       'civicrm_group_contact',
       'civicrm_group',
       'civicrm_saved_search',
@@ -29,7 +34,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
       'civicrm_tag',
       'civicrm_contact',
       'civicrm_address',
-    );
+    ];
     $this->quickCleanup($tablesToTruncate);
   }
 
@@ -44,12 +49,89 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
    * @param $full
    */
   public function testSearch($fv, $count, $ids, $full) {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/queryDataset.xml'
-      )
-    );
+    $this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']);
+    $this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']);
+
+    $tag7 = $this->ids['Tag'][7] = $this->tagCreate(['name' => 'Test Tag 7', 'description' => 'Test Tag 7'])['id'];
+    $tag9 = $this->ids['Tag'][9] = $this->tagCreate(['name' => 'Test Tag 9', 'description' => 'Test Tag 9'])['id'];
+    $this->tagCreate(['name' => 'Test Tag 10']);
+    $groups = [
+      3 => ['name' => 'Test Group 3'],
+      4 => ['name' => 'Test Smart Group 4', 'saved_search_id' => 1],
+      5 => ['name' => 'Test Group 5'],
+      6 => ['name' => 'Test Smart Group 6', 'saved_search_id' => 2],
+    ];
+
+    foreach ($groups as $id => $group) {
+      $this->ids['Group'][$id] = $this->groupCreate(array_merge($group, ['title' => $group['name']]));
+    }
+    $individuals = [
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 9', 'gender_id' => 1, 'prefix_id' => 1, 'suffix_id' => 1],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 10', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 11', 'gender_id' => 3, 'prefix_id' => 3, 'suffix_id' => 3, 'api.entity_tag.create' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 12', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 13', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 14', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 15', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 5, 'api.entity_tag.create' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 16', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 17', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 7],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 18', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 19', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 20', 'gender_id' => 1, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 21', 'gender_id' => 3, 'prefix_id' => 1, 'suffix_id' => 6],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 22', 'gender_id' => 1, 'prefix_id' => 1, 'suffix_id' => 1, 'api.entity_tag.create' => ['tag_id' => $tag9]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 23', 'gender_id' => 3, 'prefix_id' => 1, 'suffix_id' => 1, 'api.entity_tag.create' => ['tag_id' => $tag7]],
+      ['first_name' => 'Test', 'last_name' => 'Test Contact 24', 'gender_id' => 3, 'prefix_id' => 3, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
+    ];
+    foreach ($individuals as $individual) {
+      $this->ids['Contact'][$individual['last_name']] = $this->individualCreate($individual);
+    }
+    $groupContacts = [
+      [5 => 13],
+      [5 => 14],
+      [5 => 15],
+      [5 => 16],
+      [5 => 21],
+      [5 => 22],
+      [5 => 23],
+      [5 => 24],
+      [3 => 17],
+      [3 => 18],
+      [3 => 19],
+      [3 => 20],
+      [3 => 21],
+      [3 => 22],
+      [3 => 23],
+      [3 => 24],
+    ];
+    foreach ($groupContacts as $group) {
+      $groupID = $this->ids['Group'][key($group)];
+      $contactID = $this->ids['Contact']['Test Contact ' . reset($group)];
+      $this->callAPISuccess('GroupContact', 'create', ['group_id' => $groupID, 'contact_id' => $contactID, 'status' => 'Added']);
+    }
+
+    // We have migrated from a hard-coded dataset to a dynamic one but are still working with the same
+    // dataprovider at this stage -> wrangle.
+    foreach ($fv as $key => $value) {
+      $entity = ucfirst($key);
+      if (!array_key_exists($entity, $this->ids)) {
+        continue;
+      }
+      if (is_numeric($value)) {
+        $fv[$key] = $this->ids[$entity][$value];
+      }
+      elseif (!empty($value[0])) {
+        foreach ($value as $index => $oldGroup) {
+          $fv[$key][$index] = $this->ids[$entity][$oldGroup];
+        }
+      }
+      else {
+        foreach (array_keys($value) as $index) {
+          unset($fv[$key][$index]);
+          $fv[$key][$this->ids[$entity][$index]] = 1;
+        }
+      }
+    }
 
     $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     $obj = new CRM_Contact_BAO_Query($params);
@@ -60,14 +142,18 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase {
 
     $dao = $obj->searchQuery();
 
-    $contacts = array();
+    $contacts = [];
     while ($dao->fetch()) {
       $contacts[] = $dao->contact_id;
     }
 
     sort($contacts, SORT_NUMERIC);
 
-    $this->assertEquals($ids, $contacts);
+    $expectedIDs = [];
+    foreach ($ids as $id) {
+      $expectedIDs[] = $this->ids['Contact']['Test Contact ' . $id];
+    }
+    $this->assertEquals($expectedIDs, $contacts);
   }
 
   /**
@@ -624,6 +710,27 @@ civicrm_relationship.is_active = 1 AND
     $this->assertEquals($where2, $sql5[2]);
   }
 
+  /**
+   * Test we can narrow a group get by status.
+   */
+  public function testGetByGroupWithStatus() {
+    $groupID = $this->groupCreate();
+    $this->groupContactCreate($groupID, 3);
+    $groupContactID = $this->callAPISuccessGetSingle('GroupContact', ['group_id' => $groupID, 'options' => ['limit' => 1]])['id'];
+    $this->callAPISuccess('GroupContact', 'create', ['id' => $groupContactID, 'status' => 'Removed']);
+    $queryObj = new CRM_Contact_BAO_Query([['group', '=', $groupID, 0, 0], ['group_contact_status', 'IN', ['Removed' => 1], 0, 0]]);
+    $resultDAO = $queryObj->searchQuery();
+    $this->assertEquals(1, $resultDAO->N);
+
+    $queryObj = new CRM_Contact_BAO_Query([['group', '=', $groupID, 0, 0], ['group_contact_status', 'IN', ['Added' => 1], 0, 0]]);
+    $resultDAO = $queryObj->searchQuery();
+    $this->assertEquals(2, $resultDAO->N);
+
+    $queryObj = new CRM_Contact_BAO_Query([['group', '=', $groupID, 0, 0]]);
+    $resultDAO = $queryObj->searchQuery();
+    $this->assertEquals(2, $resultDAO->N);
+  }
+
   /**
    * Test the group contact clause does not contain an OR.
    *
index 1d6104dd967377ac25697bc2efae0b673e67d9ec..a25441ffbaee1c0c141d2b9765467f705153b8e6 100644 (file)
@@ -38,7 +38,9 @@
 class CRM_Contact_BAO_QueryTestDataProvider implements Iterator {
 
   /**
-   * @var integer
+   * Current count.
+   *
+   * @var int
    */
   private $i = 0;
 
index 943847df99168963119cad91a7b4364aa45b892d..bd10b66d8a4e804bbde4e6f0f9330c26f224501b 100644 (file)
@@ -92,13 +92,7 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
   public function testCount($fv, $count, $ids, $full) {
     $this->quickCleanup($this->_tablesToTruncate);
 
-    // echo "testCount\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/group-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/group-dataset.xml');
 
     $obj = new CRM_Contact_Form_Search_Custom_Group($fv);
 
@@ -111,9 +105,7 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
      * echo "{$dao->contact_id}, {$dao->contact_type}, {$dao->sort_name}, {$dao->group_names}\n";
      * }
      **/
-    $this->assertEquals($count, $obj->count(),
-      'In line ' . __LINE__
-    );
+    $this->assertEquals($count, $obj->count());
   }
 
   /**
@@ -128,14 +120,8 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
   public function testAll($fv, $count, $ids, $full) {
     // Truncate affected tables
     $this->quickCleanup($this->_tablesToTruncate);
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/group-dataset.xml');
 
-    // echo "testAll\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/group-dataset.xml'
-      )
-    );
     $obj = new CRM_Contact_Form_Search_Custom_Group($fv);
     $sql = $obj->all();
     $this->assertTrue(is_string($sql));
@@ -165,13 +151,8 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase {
     // Truncate affected tables
     $this->quickCleanup($this->_tablesToTruncate);
 
-    // echo "testContactIDs\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/group-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/group-dataset.xml');
+
     $obj = new CRM_Contact_Form_Search_Custom_Group($fv);
     $sql = $obj->contactIDs();
     $this->assertTrue(is_string($sql));
index 2c8234d22d671b87ac29708f7f99ff59e92e4189..8ce25c7a5cf56e4759b6006bda4c0178f4b3b35b 100644 (file)
@@ -37,7 +37,9 @@
 class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator {
 
   /**
-   * @var integer
+   * Current count.
+   *
+   * @var int
    */
   private $i = 0;
 
index 8f49152e888358d7adcc7ce31f57095e0b078899..cedcff81e57347d08b888474208ddf9f5914c82c 100644 (file)
@@ -86,19 +86,11 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
   public function testCount($fv, $count, $ids, $full) {
     $this->quickCleanup($this->_tablesToTruncate);
 
-    // echo "testCount\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/sample-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/sample-dataset.xml');
 
     $obj = new CRM_Contact_Form_Search_Custom_Sample($fv);
 
-    $this->assertEquals($count, $obj->count(),
-      'In line ' . __LINE__
-    );
+    $this->assertEquals($count, $obj->count());
   }
 
   /**
@@ -114,13 +106,8 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
     // Truncate affected tables
     $this->quickCleanup($this->_tablesToTruncate);
 
-    // echo "testAll\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/sample-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/sample-dataset.xml');
+
     $obj = new CRM_Contact_Form_Search_Custom_Sample($fv);
     $sql = $obj->all(0, 0, 'contact_id');
     $this->assertTrue(is_string($sql));
@@ -150,13 +137,7 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
     // Truncate affected tables
     $this->quickCleanup($this->_tablesToTruncate);
 
-    // echo "testContactIDs\n";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/sample-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/sample-dataset.xml');
     $obj = new CRM_Contact_Form_Search_Custom_Sample($fv);
     $sql = $obj->contactIDs();
     $this->assertTrue(is_string($sql));
@@ -222,12 +203,7 @@ class CRM_Contact_Form_Search_Custom_SampleTest extends CiviUnitTestCase {
   public function testSavedSearch() {
     $this->quickCleanup($this->_tablesToTruncate);
 
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/datasets/sample-dataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/datasets/sample-dataset.xml');
 
     $dataset[1] = array('id' => array(12));
     $dataset[2] = array('id' => array(10, 11));
index d9249d5fe5a67b1d0ffe1080544983385905342d..d3fa7eeceedf5aa0b980fbe95f0ef907d3393f24 100644 (file)
@@ -33,7 +33,9 @@
 class CRM_Contact_Form_Search_Custom_SampleTestDataProvider implements Iterator {
 
   /**
-   * @var integer
+   * Current count.
+   *
+   * @var int
    */
   private $i = 0;
 
index f6a4598d3205929f75972639dce82c7a0984f471..2ab4aaf85cb3df66bf50f4524c2f6724244a8fc0 100644 (file)
@@ -37,7 +37,7 @@
  * @group headless
  */
 class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
-  protected $_tablesToTruncate = ['civicrm_address', 'civicrm_phone'];
+  protected $_tablesToTruncate = ['civicrm_address', 'civicrm_phone', 'civicrm_email'];
 
   /**
    * Setup function.
@@ -241,19 +241,35 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
     $contactValues['external_identifier'] = 'android';
     $contactValues['street_address'] = 'Big Mansion';
     $contactValues['phone'] = 12334;
-    $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
+    $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, array(0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
     $address = $this->callAPISuccessGetSingle('Address', array('street_address' => 'Big Mansion'));
     $this->assertEquals(1, $address['location_type_id']);
     $this->assertEquals(1, $address['is_primary']);
 
-    $this->markTestIncomplete('phone actually doesn\'t work');
     $phone = $this->callAPISuccessGetSingle('Phone', array('phone' => '12334'));
     $this->assertEquals(1, $phone['location_type_id']);
 
+    $this->callAPISuccessGetSingle('Email', array('email' => 'bill.gates@microsoft.com'));
+
     $contact = $this->callAPISuccessGetSingle('Contact', $contactValues);
     $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id']));
   }
 
+  /**
+   * Test that address custom fields can be imported
+   */
+  public function testAddressWithCustomData() {
+    $ids = $this->entityCustomGroupWithSingleFieldCreate('Address', 'AddressTest.php');
+    list($contactValues) = $this->setUpBaseContact();
+    $contactValues['nick_name'] = 'Old Bill';
+    $contactValues['external_identifier'] = 'android';
+    $contactValues['street_address'] = 'Big Mansion';
+    $contactValues['custom_' . $ids['custom_field_id']] = 'Update';
+    $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
+    $address = $this->callAPISuccessGetSingle('Address', ['street_address' => 'Big Mansion', 'return' => 'custom_' . $ids['custom_field_id']]);
+    $this->assertEquals('Update', $address['custom_' . $ids['custom_field_id']]);
+  }
+
   /**
    * Test that the import parser adds the address to the primary location.
    *
@@ -300,7 +316,6 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
     $this->assertEquals(1, $address['values'][1]['is_primary']);
     $this->assertEquals('Big Mansion', $address['values'][1]['street_address']);
 
-    $this->markTestIncomplete('phone import primary actually IS broken');
     $phone = $this->callAPISuccess('Phone', 'get', array('contact_id' => $contact['id'], 'sequential' => 1));
     $this->assertEquals(1, $phone['values'][0]['location_type_id']);
     $this->assertEquals(1, $phone['values'][0]['is_primary']);
@@ -340,8 +355,7 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
     $this->assertEquals(0, $address[0]['is_primary']);
     $this->assertEquals('Big Mansion', $address[0]['street_address']);
 
-    $this->markTestIncomplete('phone import primary actually IS broken');
-    $phone = $this->callAPISuccess('Phone', 'get', array('contact_id' => $contact['id'], 'sequential' => 1))['values'];
+    $phone = $this->callAPISuccess('Phone', 'get', ['contact_id' => $contact['id'], 'sequential' => 1, 'options' => ['sort' => 'is_primary DESC']])['values'];
     $this->assertEquals(3, $phone[1]['location_type_id']);
     $this->assertEquals(0, $phone[1]['is_primary']);
     $this->assertEquals(12334, $phone[1]['phone']);
@@ -359,13 +373,19 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
    */
   public function testImportPrimaryAddressUpdate() {
     list($contactValues) = $this->setUpBaseContact(array('external_identifier' => 'android'));
-    $contactValues['nick_name'] = 'Old Bill';
+    $contactValues['email'] = 'melinda.gates@microsoft.com';
+    $contactValues['phone'] = '98765';
     $contactValues['external_identifier'] = 'android';
     $contactValues['street_address'] = 'Big Mansion';
     $contactValues['city'] = 'Big City';
     $contactID = $this->callAPISuccessGetValue('Contact', array('external_identifier' => 'android', 'return' => 'id'));
     $originalAddress = $this->callAPISuccess('Address', 'create', array('location_type_id' => 2, 'street_address' => 'small house', 'contact_id' => $contactID));
-    $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, array(0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary'));
+    $originalPhone = $this->callAPISuccess('phone', 'create', array('location_type_id' => 2, 'phone' => '1234', 'contact_id' => $contactID));
+    $this->runImport($contactValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID, array(0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL, 4 => NULL, 5 => 'Primary', 6 => 'Primary', 7 => 'Primary'));
+    $phone = $this->callAPISuccessGetSingle('Phone', ['phone' => '98765']);
+    $this->assertEquals(2, $phone['location_type_id']);
+    $this->assertEquals($originalPhone['id'], $phone['id']);
+    $email = $this->callAPISuccess('Email', 'getsingle', ['contact_id' => $contactID]);
     $address = $this->callAPISuccessGetSingle('Address', array('street_address' => 'Big Mansion'));
     $this->assertEquals(2, $address['location_type_id']);
     $this->assertEquals($originalAddress['id'], $address['id']);
diff --git a/tests/phpunit/CRM/Contact/Page/DedupeExceptionTest.php b/tests/phpunit/CRM/Contact/Page/DedupeExceptionTest.php
new file mode 100644 (file)
index 0000000..c67b49b
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 5                                                  |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Test class for CRM_Contact_Page_DedupeException BAO
+ *
+ * @package   CiviCRM
+ * @group headless
+ */
+class CRM_Contact_Page_DedupeExceptionTest extends CiviUnitTestCase {
+
+  /**
+   * Sets up the fixture, for example, opens a network connection.
+   * This method is called before a test is executed.
+   */
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  /**
+   * Tears down the fixture, for example, closes a network connection.
+   *
+   * This method is called after a test is executed.
+   */
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  public function testGetDedupeExceptions() {
+    $contact1      = $this->individualCreate();
+    $contact2      = $this->individualCreate();
+    $exception     = $this->callAPISuccess('Exception', 'create', [
+      'contact_id1' => $contact1,
+      'contact_id2' => $contact2,
+    ]);
+    $page          = new CRM_Contact_Page_DedupeException();
+    $totalitems    = civicrm_api3('Exception', "getcount", []);
+    $params        = array(
+      'total' => $totalitems,
+      'rowCount' => CRM_Utils_Pager::ROWCOUNT,
+      'status' => ts('Dedupe Exceptions %%StatusMessage%%'),
+      'buttonBottom' => 'PagerBottomButton',
+      'buttonTop' => 'PagerTopButton',
+      'pageID' => $page->get(CRM_Utils_Pager::PAGE_ID),
+    );
+    $page->_pager  = new CRM_Utils_Pager($params);
+    $exceptions    = $page->getExceptions();
+    $expectedArray = [
+      $exception['id'] => [
+        'id' => $exception['id'],
+        'contact_id1.display_name' => 'Mr. Anthony Anderson II',
+        'contact_id2.display_name' => 'Mr. Anthony Anderson II',
+        'contact_id1' => $contact1,
+        'contact_id2' => $contact2,
+      ],
+    ];
+    $this->assertEquals($expectedArray, $exceptions);
+  }
+
+}
diff --git a/tests/phpunit/CRM/Contact/Page/View/NoteTest.php b/tests/phpunit/CRM/Contact/Page/View/NoteTest.php
new file mode 100644 (file)
index 0000000..4a39436
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 5                                                  |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Test class for CRM_Contact_Page_View_Note BAO
+ *
+ * @package   CiviCRM
+ * @group headless
+ */
+class CRM_Contact_Page_View_NoteTest extends CiviUnitTestCase {
+
+  /**
+   * Sets up the fixture, for example, opens a network connection.
+   * This method is called before a test is executed.
+   */
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  /**
+   * Tears down the fixture, for example, closes a network connection.
+   *
+   * This method is called after a test is executed.
+   */
+  protected function tearDown() {
+    parent::tearDown();
+  }
+
+  public function testNoContactIdNote() {
+    $contactId = $this->individualCreate();
+    foreach ([1, 2, 3, 4, 5] as $noteID) {
+      $note = new CRM_Core_DAO_Note();
+      $note->entity_id = $contactId;
+      $note->subject = 'Test Note ' . $noteID;
+      $note->note = 'Test Note from Tests';
+      $note->entity_table = 'civicrm_contact';
+      if ($noteID == 5) {
+        $note->contact_id = $contactId;
+      }
+      $note->save();
+    }
+    $page = new CRM_Contact_Page_View_Note();
+    $page->_contactId = $contactId;
+    $page->_permission = CRM_Core_PERMISSION::EDIT;
+    $page->browse();
+    $this->assertEquals(count($page->values), 5);
+    foreach ($page->values as $note) {
+      $this->assertEquals($note['entity_id'], $contactId);
+      if ($note['id'] == 5) {
+        $this->assertEquals($note['createdBy'], 'Mr. Anthony Anderson II');
+      }
+    }
+  }
+
+}
index 44505f9f462cfedca3b41617321f30815f4231d3..03dbdb236924f2bb6cc5591e004d974af8b35548 100644 (file)
@@ -999,22 +999,6 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     $this->assertEquals("$ 200.00 - STUDENT", $activity->subject, 'Check for total amount in activity.');
   }
 
-  /**
-   * Test checkContributeSettings.
-   */
-  public function testCheckContributeSettings() {
-    $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
-    $this->assertNull($settings);
-    $params = array(
-      'contribution_invoice_settings' => array(
-        'deferred_revenue_enabled' => '1',
-      ),
-    );
-    $this->callAPISuccess('Setting', 'create', $params);
-    $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled');
-    $this->assertEquals($settings, 1, 'Check for settings has failed');
-  }
-
   /**
    * Test allowUpdateRevenueRecognitionDate.
    */
@@ -1589,6 +1573,104 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     ), $checkAgainst);
   }
 
+  /**
+   *  https://lab.civicrm.org/dev/financial/issues/56
+   * Changing financial type on a contribution records correct financial items
+   */
+  public function testChangingFinancialTypeWithoutTax() {
+    $ids = $values = [];
+    $contactId = $this->individualCreate();
+    $params = array(
+      'contact_id' => $contactId,
+      'receive_date' => date('YmdHis'),
+      'total_amount' => 100.00,
+      'financial_type_id' => 'Donation',
+      'contribution_status_id' => 'Completed',
+    );
+    /* first test the scenario when sending an email */
+    $contributionId = $this->callAPISuccess(
+      'contribution',
+      'create',
+      $params
+    )['id'];
+
+    // Update Financial Type.
+    $this->callAPISuccess('contribution', 'create', [
+      'id' => $contributionId,
+      'financial_type_id' => 'Event Fee',
+    ]);
+
+    // Get line item
+    $lineItem = $this->callAPISuccessGetSingle('LineItem', [
+      'contribution_id' => $contributionId,
+      'return' => ["financial_type_id.name", "line_total"],
+    ]);
+
+    $this->assertEquals(
+      $lineItem['line_total'],
+      100.00,
+      'Invalid line amount.'
+    );
+
+    $this->assertEquals(
+      $lineItem['financial_type_id.name'],
+      'Event Fee',
+      'Invalid Financial Type stored.'
+    );
+
+    // Get Financial Items.
+    $financialItems = $this->callAPISuccess('FinancialItem', 'get', [
+      'entity_id' => $lineItem['id'],
+      'sequential' => 1,
+      'entity_table' => 'civicrm_line_item',
+      'options' => ['sort' => "id"],
+      'return' => ["financial_account_id.name", "amount", "description"],
+    ]);
+
+    $this->assertEquals($financialItems['count'], 3, 'Count mismatch.');
+
+    $toCheck = [
+      ['Donation', 100.00],
+      ['Donation', -100.00],
+      ['Event Fee', 100.00],
+    ];
+
+    foreach ($financialItems['values'] as $key => $values) {
+      $this->assertEquals(
+        $values['financial_account_id.name'],
+        $toCheck[$key][0],
+        'Invalid Financial Account stored.'
+      );
+      $this->assertEquals(
+        $values['amount'],
+        $toCheck[$key][1],
+        'Amount mismatch.'
+      );
+      $this->assertEquals(
+        $values['description'],
+        'Contribution Amount',
+        'Description mismatch.'
+      );
+    }
+
+    // Check transactions.
+    $financialTransactions = $this->callAPISuccess('EntityFinancialTrxn', 'get', [
+      'return' => ["financial_trxn_id"],
+      'entity_table' => "civicrm_contribution",
+      'entity_id' => $contributionId,
+      'sequential' => 1,
+    ]);
+    $this->assertEquals($financialTransactions['count'], 3, 'Count mismatch.');
+
+    foreach ($financialTransactions['values'] as $key => $values) {
+      $this->callAPISuccessGetCount('EntityFinancialTrxn', [
+        'financial_trxn_id' => $values['financial_trxn_id'],
+        'amount' => $toCheck[$key][1],
+        'financial_trxn_id.total_amount' => $toCheck[$key][1],
+      ], 2);
+    }
+  }
+
   /**
    *  CRM-21424 Check if the receipt update is set after composing the receipt message
    */
index 362dc43875de297db32011cffb01995f988c4887..efedd30dfd75fcb36e1d15177d4d41c7c27b3b6e 100644 (file)
@@ -168,7 +168,7 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase {
   /**
    * Test the submit function that completes the partially paid Contribution with multiple payments.
    */
-  public function testMultiplePaymentForPartialyPaidContribution() {
+  public function testMultiplePaymentForPartiallyPaidContribution() {
     $this->createContribution('Partially paid');
 
     // pay additional amount
@@ -179,6 +179,19 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase {
     // pay additional amount
     $this->submitPayment(20);
     $this->checkResults(array(30, 50, 20), 3);
+    $activities = $this->callAPISuccess('Activity', 'get', [
+      'source_record_id' => $this->_contributionId,
+      'activity_type_id' => 'Payment',
+      'options' => ['sort' => 'id'],
+      'sequential' => 1,
+      'return' => ['target_contact_id', 'assignee_contact_id', 'subject'],
+    ])['values'];
+    $this->assertEquals(2, count($activities));
+    $this->assertEquals('$ 50.00 - Offline Payment for Contribution', $activities[0]['subject']);
+    $this->assertEquals('$ 20.00 - Offline Payment for Contribution', $activities[1]['subject']);
+    $this->assertEquals(CRM_Core_Session::singleton()->getLoggedInContactID(), $activities[0]['source_contact_id']);
+    $this->assertEquals([$this->_individualId], $activities[0]['target_contact_id']);
+    $this->assertEquals([], $activities[0]['assignee_contact_id']);
   }
 
   /**
index 89d65f22eb96b61901abf7545454796e0b637174..f773d1dd5ba16c73779a8ee7e18aab0c4c599ef5 100644 (file)
@@ -409,7 +409,7 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase {
    *
    * @dataProvider getSearchData
    */
-  public function testContributionRecurStatusFilter($formValues, $expectedCount, $expectedContact, $expectedQill) {
+  public function testContributionRecurSearchFilters($formValues, $expectedCount, $expectedContact, $expectedQill) {
     $this->setUpRecurringContributions();
 
     $query = new CRM_Contact_BAO_Query(CRM_Contact_BAO_Query::convertFormValues($formValues));
@@ -553,12 +553,14 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase {
       'sequential' => 1,
       'contact_id' => $this->ids['Contact']['contactID2'],
       'frequency_interval' => 1,
-      'frequency_unit' => "month",
+      'frequency_unit' => 'month',
       'amount' => 22,
       'currency' => "CAD",
       'payment_instrument_id' => 1,
       'contribution_status_id' => 1,
-      'financial_type_id' => "Donation",
+      'financial_type_id' => 'Donation',
+      'trxn_id' => 'a transaction',
+      'processor_id' => 'a processor',
     ]);
     $Contribution2 = $this->callAPISuccess('Contribution', 'create', [
       'financial_type_id' => 'Donation',
@@ -607,6 +609,18 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase {
         'expected_contact' => [],
         'expected_qill' => "Recurring Contribution Status = 'Cancelled'",
       ],
+      'trxn_id_search' => [
+        'form_value' => ['contribution_recur_trxn_id' => 'a transaction'],
+        'expected_count' => 1,
+        'expected_contact' => ['Mr. Terrence Smith II'],
+        'expected_qill' => "Recurring Contribution Transaction ID = 'a transaction'",
+      ],
+      'processor_id_search' => [
+        'form_value' => ['contribution_recur_processor_id' => 'a processor'],
+        'expected_count' => 1,
+        'expected_contact' => ['Mr. Terrence Smith II'],
+        'expected_qill' => "Recurring Contribution Processor ID = 'a processor'",
+      ],
     ];
     return $useCases;
   }
index c5700282ae1fbebce64b703ea352b46ad81a466b..6c766ceeedc26c1544a0c6a46d60b8cf5e738c20 100644 (file)
@@ -55,11 +55,7 @@ class CRM_Core_BAO_IMTest extends CiviUnitTestCase {
    * AllIMs() method - get all IMs for our contact, with primary IM first
    */
   public function testAllIMs() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute(
-      $this->_dbconn,
-      $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml')
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml');
 
     $contactId = 69;
     $IMs = CRM_Core_BAO_IM::allIMs($contactId);
index 7452e2cab1f5a74ed5a4a6786da609adb30b6511..73943396a39da974a8d20f7f312c6c6b136ff2bc 100644 (file)
@@ -318,4 +318,84 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase {
     $this->assertDBCompareValues('CRM_Friend_DAO_Friend', $searchActParams, $compareActParams);
   }
 
+  /**
+   * Testing Activity Generation through Entity Recursion with Custom Data and Tags.
+   */
+  public function testRecurringEntityGenerationWithCustomDataAndTags() {
+
+    // Create custom group and field
+    $customGroup = $this->customGroupCreate([
+      'extends' => 'Activity',
+    ]);
+    $customField = $this->customFieldCreate([
+        'custom_group_id' => $customGroup['id'],
+        'default_value' => '',
+      ]
+    );
+
+    // Create activity Tag
+    $tag = $this->tagCreate([
+      'used_for' => 'Activities',
+    ]);
+
+    // Create original activity
+    $customFieldValue = 'Custom Value';
+    $activityDateTime = date('YmdHis');
+    $activityId = $this->activityCreate([
+      'activity_date_time' => $activityDateTime,
+      'custom_' . $customField['id'] => $customFieldValue,
+    ]);
+
+    $activityId = $activityId['id'];
+
+    // Assign tag to a activity.
+    $this->callAPISuccess('EntityTag', 'create', [
+      'entity_table' => 'civicrm_activity',
+      'entity_id' => $activityId,
+      'tag_id' => $tag['id'],
+    ]);
+
+    // Create recurring activities.
+    $recursion = new CRM_Core_BAO_RecurringEntity();
+    $recursion->entity_id = $activityId;
+    $recursion->entity_table = 'civicrm_activity';
+    $recursion->dateColumns = ['activity_date_time'];
+    $recursion->schedule = [
+      'entity_value' => $activityId,
+      'start_action_date' => $activityDateTime,
+      'entity_status' => 'fourth saturday',
+      'repetition_frequency_unit' => 'month',
+      'repetition_frequency_interval' => 3,
+      'start_action_offset' => 3,
+      'used_for' => 'activity',
+    ];
+
+    $generatedEntities = $recursion->generate();
+    $generatedActivities = $generatedEntities['civicrm_activity'];
+
+    $this->assertEquals(3, count($generatedActivities), "Check if number of iterations are 3");
+
+    foreach ($generatedActivities as $generatedActivityId) {
+
+      /* Validate tag in recurring activity
+      // @todo - refer https://github.com/civicrm/civicrm-core/pull/13470
+      $this->callAPISuccess('EntityTag', 'getsingle', [
+      'entity_table' => 'civicrm_activity',
+      'entity_id' => $generatedActivityId,
+      ]);
+       */
+
+      // Validate custom data in recurring activity
+      $activity = $this->callAPISuccess('activity', 'getsingle', [
+        'return' => [
+          'custom_' . $customField['id'],
+        ],
+        'id' => $generatedActivityId,
+      ]);
+
+      $this->assertEquals($customFieldValue, $activity['custom_' . $customField['id']], 'Custom field value should be ' . $customFieldValue);
+
+    }
+  }
+
 }
index 939247aa6e40b994b67618e4f86b7fb900daa781..3c7913f92c68255f05d65ce498f5f691640a8dbc 100644 (file)
@@ -37,7 +37,9 @@ class CRM_Core_JobManagerTest extends CiviUnitTestCase {
 
   public function testHookCron() {
     $mockFunction = $this->mockMethod;
-    $hook = $this->$mockFunction('stdClass', array('civicrm_cron'));
+    $hook = $this->getMockBuilder(stdClass::class)
+      ->setMethods(['civicrm_cron'])
+      ->getMock();
     $hook->expects($this->once())
       ->method('civicrm_cron')
       ->with($this->isInstanceOf('CRM_Core_JobManager'));
index 96f440873f980496c62fc6eaf0cdf8823f637c15..78dffbff2925d6c728c07f9dae144c1bf315921b 100644 (file)
@@ -2,27 +2,38 @@
 
 /**
  * Class CRM_Dedupe_DedupeMergerTest
+ *
  * @group headless
  */
 class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
 
   protected $_groupId;
-  protected $_contactIds = array();
 
+  protected $_contactIds = [];
+
+  /**
+   * Tear down.
+   *
+   * @throws \Exception
+   */
   public function tearDown() {
-    $this->quickCleanup(array('civicrm_contact', 'civicrm_group_contact', 'civicrm_group'));
+    $this->quickCleanup([
+      'civicrm_contact',
+      'civicrm_group_contact',
+      'civicrm_group',
+    ]);
     parent::tearDown();
   }
 
   public function createDupeContacts() {
     // create a group to hold contacts, so that dupe checks don't consider any other contacts in the DB
-    $params = array(
-      'name'       => 'Test Dupe Merger Group',
-      'title'      => 'Test Dupe Merger Group',
-      'domain_id'  => 1,
-      'is_active'  => 1,
+    $params = [
+      'name' => 'Test Dupe Merger Group',
+      'title' => 'Test Dupe Merger Group',
+      'domain_id' => 1,
+      'is_active' => 1,
       'visibility' => 'Public Pages',
-    );
+    ];
 
     $result = $this->callAPISuccess('group', 'create', $params);
     $this->_groupId = $result['id'];
@@ -41,62 +52,62 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     // will   - dale - dale@example.com
     // will   - dale - will@example.com
     // will   - dale - will@example.com
-    $params = array(
-      array(
+    $params = [
+      [
         'first_name' => 'robin',
         'last_name' => 'hood',
         'email' => 'robin@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'robin',
         'last_name' => 'hood',
         'email' => 'robin@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'robin',
         'last_name' => 'hood',
         'email' => 'hood@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'robin',
         'last_name' => 'dale',
         'email' => 'robin@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'little',
         'last_name' => 'dale',
         'email' => 'dale@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'little',
         'last_name' => 'dale',
         'email' => 'dale@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'will',
         'last_name' => 'dale',
         'email' => 'dale@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'will',
         'last_name' => 'dale',
         'email' => 'will@example.com',
         'contact_type' => 'Individual',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'will',
         'last_name' => 'dale',
         'email' => 'will@example.com',
         'contact_type' => 'Individual',
-      ),
-    );
+      ],
+    ];
 
     $count = 1;
     foreach ($params as $param) {
@@ -104,11 +115,11 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       $contact = civicrm_api('contact', 'create', $param);
       $this->_contactIds[$count++] = $contact['id'];
 
-      $grpParams = array(
+      $grpParams = [
         'contact_id' => $contact['id'],
-        'group_id'   => $this->_groupId,
-        'version'    => 3,
-      );
+        'group_id' => $this->_groupId,
+        'version' => 3,
+      ];
       $this->callAPISuccess('group_contact', 'create', $grpParams);
     }
   }
@@ -163,7 +174,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     @$object->run();
 
     // Retrieve pairs from prev next cache table
-    $select = array('pn.is_selected' => 'is_selected');
+    $select = ['pn.is_selected' => 'is_selected'];
     $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($dao->id, $this->_groupId);
     $pnDupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, NULL, NULL, 0, 0, $select);
 
@@ -227,7 +238,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     @$object->run();
 
     // Retrieve pairs from prev next cache table
-    $select = array('pn.is_selected' => 'is_selected');
+    $select = ['pn.is_selected' => 'is_selected'];
     $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($dao->id, $this->_groupId);
     $pnDupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, NULL, NULL, 0, 0, $select);
 
@@ -261,18 +272,18 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    * @return array
    */
   public function getHackedInCIDRef() {
-    return array(
-      'civicrm_entity_tag' => array(
+    return [
+      'civicrm_entity_tag' => [
         0 => 'entity_id',
-      ),
-    );
+      ],
+    ];
   }
 
   /**
    * Test function that gets duplicate pairs.
    *
-   * It turns out there are 2 code paths retrieving this data so my initial focus is on ensuring
-   * they match.
+   * It turns out there are 2 code paths retrieving this data so my initial
+   * focus is on ensuring they match.
    */
   public function testGetMatches() {
     $this->setupMatchData();
@@ -284,34 +295,40 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       FALSE
     );
 
-    $this->assertEquals(array(
-      0 => array(
+    $this->assertEquals([
+      0 => [
         'srcID' => $this->contacts[1]['id'],
         'srcName' => 'Mr. Mickey Mouse II',
         'dstID' => $this->contacts[0]['id'],
         'dstName' => 'Mr. Mickey Mouse II',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-      1 => array(
+      ],
+      1 => [
         'srcID' => $this->contacts[3]['id'],
         'srcName' => 'Mr. Minnie Mouse II',
         'dstID' => $this->contacts[2]['id'],
         'dstName' => 'Mr. Minnie Mouse II',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-    ), $pairs);
+      ],
+    ], $pairs);
   }
 
   /**
    * Test function that gets organization pairs.
    *
-   * Note the rule will match on organization_name OR email - hence lots of matches.
+   * Note the rule will match on organization_name OR email - hence lots of
+   * matches.
+   *
+   * @throws \Exception
    */
   public function testGetOrganizationMatches() {
     $this->setupMatchData();
-    $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', array('contact_type' => 'Organization', 'used' => 'Supervised'));
+    $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', [
+      'contact_type' => 'Organization',
+      'used' => 'Supervised',
+    ]);
 
     $pairs = CRM_Dedupe_Merger::getDuplicatePairs(
       $ruleGroups['id'],
@@ -321,42 +338,42 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       FALSE
     );
 
-    $expectedPairs = array(
-      0 => array(
+    $expectedPairs = [
+      0 => [
         'srcID' => $this->contacts[5]['id'],
         'srcName' => 'Walt Disney Ltd',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-      1 => array(
+      ],
+      1 => [
         'srcID' => $this->contacts[7]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[6]['id'],
         'dstName' => 'Walt Disney',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-      2 => array(
+      ],
+      2 => [
         'srcID' => $this->contacts[6]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-      3 => array(
+      ],
+      3 => [
         'srcID' => $this->contacts[6]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[5]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-    );
-    usort($pairs, array(__CLASS__, 'compareDupes'));
-    usort($expectedPairs, array(__CLASS__, 'compareDupes'));
+      ],
+    ];
+    usort($pairs, [__CLASS__, 'compareDupes']);
+    usort($expectedPairs, [__CLASS__, 'compareDupes']);
     $this->assertEquals($expectedPairs, $pairs);
   }
 
@@ -365,10 +382,11 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    *
    * @param array $a
    * @param array $b
+   *
    * @return int
    */
   public static function compareDupes($a, $b) {
-    foreach (array('srcName', 'dstName', 'srcID', 'dstID') as $field) {
+    foreach (['srcName', 'dstName', 'srcID', 'dstID'] as $field) {
       if ($a[$field] != $b[$field]) {
         return ($a[$field] < $b[$field]) ? 1 : -1;
       }
@@ -378,14 +396,22 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
 
   /**
    *  Test function that gets organization duplicate pairs.
+   *
+   * @throws \Exception
    */
   public function testGetOrganizationMatchesInGroup() {
     $this->setupMatchData();
-    $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', array('contact_type' => 'Organization', 'used' => 'Supervised'));
+    $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', [
+      'contact_type' => 'Organization',
+      'used' => 'Supervised',
+    ]);
 
-    $groupID = $this->groupCreate(array('title' => 'she-mice'));
+    $groupID = $this->groupCreate(['title' => 'she-mice']);
 
-    $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[4]['id']));
+    $this->callAPISuccess('GroupContact', 'create', [
+      'group_id' => $groupID,
+      'contact_id' => $this->contacts[4]['id'],
+    ]);
 
     $pairs = CRM_Dedupe_Merger::getDuplicatePairs(
       $ruleGroups['id'],
@@ -395,26 +421,29 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       FALSE
     );
 
-    $this->assertEquals(array(
-      0 => array(
+    $this->assertEquals([
+      0 => [
         'srcID' => $this->contacts[5]['id'],
         'srcName' => 'Walt Disney Ltd',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-      1 => array(
+      ],
+      1 => [
         'srcID' => $this->contacts[6]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-    ), $pairs);
+      ],
+    ], $pairs);
 
-    $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[5]['id']));
+    $this->callAPISuccess('GroupContact', 'create', [
+      'group_id' => $groupID,
+      'contact_id' => $this->contacts[5]['id'],
+    ]);
     CRM_Core_DAO::executeQuery("DELETE FROM civicrm_prevnext_cache");
     $pairs = CRM_Dedupe_Merger::getDuplicatePairs(
       $ruleGroups['id'],
@@ -424,46 +453,49 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       FALSE
     );
 
-    $this->assertEquals(array(
-      0 => array(
+    $this->assertEquals([
+      0 => [
         'srcID' => $this->contacts[5]['id'],
         'srcName' => 'Walt Disney Ltd',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-      1 => array(
+      ],
+      1 => [
         'srcID' => $this->contacts[6]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[4]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-      2 => array(
+      ],
+      2 => [
         'srcID' => $this->contacts[6]['id'],
         'srcName' => 'Walt Disney',
         'dstID' => $this->contacts[5]['id'],
         'dstName' => 'Walt Disney Ltd',
         'weight' => 10,
         'canMerge' => TRUE,
-      ),
-    ), $pairs);
+      ],
+    ], $pairs);
   }
 
   /**
    * Test function that gets duplicate pairs.
    *
-   * It turns out there are 2 code paths retrieving this data so my initial focus is on ensuring
-   * they match.
+   * It turns out there are 2 code paths retrieving this data so my initial
+   * focus is on ensuring they match.
    */
   public function testGetMatchesInGroup() {
     $this->setupMatchData();
 
-    $groupID = $this->groupCreate(array('title' => 'she-mice'));
+    $groupID = $this->groupCreate(['title' => 'she-mice']);
 
-    $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[3]['id']));
+    $this->callAPISuccess('GroupContact', 'create', [
+      'group_id' => $groupID,
+      'contact_id' => $this->contacts[3]['id'],
+    ]);
 
     $pairs = CRM_Dedupe_Merger::getDuplicatePairs(
       1,
@@ -473,16 +505,68 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
       FALSE
     );
 
-    $this->assertEquals(array(
-      0 => array(
+    $this->assertEquals([
+      0 => [
         'srcID' => $this->contacts[3]['id'],
         'srcName' => 'Mr. Minnie Mouse II',
         'dstID' => $this->contacts[2]['id'],
         'dstName' => 'Mr. Minnie Mouse II',
         'weight' => 20,
         'canMerge' => TRUE,
-      ),
-    ), $pairs);
+      ],
+    ], $pairs);
+  }
+
+  /**
+   * Test the special info handling is unchanged after cleanup.
+   *
+   * Note the handling is silly - we are testing to lock in over short term
+   * changes not to imply any contract on the function.
+   */
+  public function testGetRowsElementsAndInfoSpecialInfo() {
+    $contact1 = $this->individualCreate([
+      'preferred_communication_method' => [],
+      'communication_style_id' => 'Familiar',
+      'prefix_id' => 'Mrs.',
+      'suffix_id' => 'III',
+    ]);
+    $contact2 = $this->individualCreate([
+      'preferred_communication_method' => [
+        'SMS',
+        'Fax',
+      ],
+      'communication_style_id' => 'Formal',
+      'gender_id' => 'Female',
+    ]);
+    $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($contact1, $contact2);
+    $rows = $rowsElementsAndInfo['rows'];
+    $this->assertEquals([
+      'main' => 'Mrs.',
+      'other' => 'Mr.',
+      'title' => 'Individual Prefix',
+    ], $rows['move_prefix_id']);
+    $this->assertEquals([
+      'main' => 'III',
+      'other' => 'II',
+      'title' => 'Individual Suffix',
+    ], $rows['move_suffix_id']);
+    $this->assertEquals([
+      'main' => '',
+      'other' => 'Female',
+      'title' => 'Gender',
+    ], $rows['move_gender_id']);
+    $this->assertEquals([
+      'main' => 'Familiar',
+      'other' => 'Formal',
+      'title' => 'Communication Style',
+    ], $rows['move_communication_style_id']);
+    $this->assertEquals(1, $rowsElementsAndInfo['migration_info']['move_communication_style_id']);
+    $this->assertEquals([
+      'main' => '',
+      'other' => 'SMS, Fax',
+      'title' => 'Preferred Communication Method',
+    ], $rows['move_preferred_communication_method']);
+    $this->assertEquals('\ 14\ 15\ 1', $rowsElementsAndInfo['migration_info']['move_preferred_communication_method']);
   }
 
   /**
@@ -496,7 +580,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
 
     //Add Membership for the duplicate contact.
     $memTypeId = $this->membershipTypeCreate();
-    $membership = $this->callAPISuccess('Membership', 'create', [
+    $this->callAPISuccess('Membership', 'create', [
       'membership_type_id' => $memTypeId,
       'contact_id' => $duplicateContactID,
     ]);
@@ -529,7 +613,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    */
   public function testCustomDataOverwrite() {
     // Create Custom Field
-    $createGroup  = $this->setupCustomGroupForIndividual();
+    $createGroup = $this->setupCustomGroupForIndividual();
     $createField = $this->setupCustomField('Graduation', $createGroup);
     $customFieldName = "custom_" . $createField['id'];
 
@@ -543,41 +627,41 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     $duplicateContactID2 = $this->contacts[2]['id'];
 
     // update the text custom field for original contact with value 'abc'
-    $this->callAPISuccess('Contact', 'create', array(
+    $this->callAPISuccess('Contact', 'create', [
       'id' => $originalContactID,
       "{$customFieldName}" => 'abc',
-    ));
+    ]);
     $this->assertCustomFieldValue($originalContactID, 'abc', $customFieldName);
 
     // update the text custom field for duplicate contact 1 with value 'def'
-    $this->callAPISuccess('Contact', 'create', array(
+    $this->callAPISuccess('Contact', 'create', [
       'id' => $duplicateContactID1,
       "{$customFieldName}" => 'def',
-    ));
+    ]);
     $this->assertCustomFieldValue($duplicateContactID1, 'def', $customFieldName);
 
     // update the text custom field for duplicate contact 2 with value 'ghi'
-    $this->callAPISuccess('Contact', 'create', array(
+    $this->callAPISuccess('Contact', 'create', [
       'id' => $duplicateContactID2,
       "{$customFieldName}" => 'ghi',
-    ));
+    ]);
     $this->assertCustomFieldValue($duplicateContactID2, 'ghi', $customFieldName);
 
     /*** USE-CASE 1: DO NOT OVERWRITE CUSTOM FIELD VALUE **/
-    $this->mergeContacts($originalContactID, $duplicateContactID1, array(
+    $this->mergeContacts($originalContactID, $duplicateContactID1, [
       "move_{$customFieldName}" => NULL,
-    ));
+    ]);
     $this->assertCustomFieldValue($originalContactID, 'abc', $customFieldName);
 
     /*** USE-CASE 2: OVERWRITE CUSTOM FIELD VALUE **/
-    $this->mergeContacts($originalContactID, $duplicateContactID2, array(
+    $this->mergeContacts($originalContactID, $duplicateContactID2, [
       "move_{$customFieldName}" => 'ghi',
-    ));
+    ]);
     $this->assertCustomFieldValue($originalContactID, 'ghi', $customFieldName);
 
     // cleanup created custom set
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $createField['id']));
-    $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id']));
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $createField['id']]);
+    $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]);
   }
 
   /**
@@ -588,16 +672,16 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    */
   public function testMigrationOfUnselectedCustomDataOnEmptyCustomRecord() {
     // Create Custom Fields
-    $createGroup  = $this->setupCustomGroupForIndividual();
+    $createGroup = $this->setupCustomGroupForIndividual();
     $customField1 = $this->setupCustomField('TestField', $createGroup);
 
     // Create multi-value custom field
     $multiGroup = $this->CustomGroupMultipleCreateByParams();
-    $multiField = $this->customFieldCreate(array(
+    $multiField = $this->customFieldCreate([
       'custom_group_id' => $multiGroup['id'],
       'label' => 'field_1' . $multiGroup['id'],
       'in_selector' => 1,
-    ));
+    ]);
 
     // Contacts setup
     $this->setupMatchData();
@@ -605,27 +689,27 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     $duplicateContactID = $this->contacts[1]['id'];
 
     // Update the text custom fields for duplicate contact
-    $this->callAPISuccess('Contact', 'create', array(
+    $this->callAPISuccess('Contact', 'create', [
       'id' => $duplicateContactID,
       "custom_{$customField1['id']}" => 'abc',
       "custom_{$multiField['id']}" => 'def',
-    ));
+    ]);
     $this->assertCustomFieldValue($duplicateContactID, 'abc', "custom_{$customField1['id']}");
     $this->assertCustomFieldValue($duplicateContactID, 'def', "custom_{$multiField['id']}");
 
     // Merge, and ensure that no value was migrated
-    $this->mergeContacts($originalContactID, $duplicateContactID, array(
+    $this->mergeContacts($originalContactID, $duplicateContactID, [
       "move_custom_{$customField1['id']}" => NULL,
       "move_rel_table_custom_{$multiGroup['id']}" => NULL,
-    ));
+    ]);
     $this->assertCustomFieldValue($originalContactID, '', "custom_{$customField1['id']}");
     $this->assertCustomFieldValue($originalContactID, '', "custom_{$multiField['id']}");
 
     // cleanup created custom set
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $customField1['id']));
-    $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id']));
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $multiField['id']));
-    $this->callAPISuccess('CustomGroup', 'delete', array('id' => $multiGroup['id']));
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $customField1['id']]);
+    $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]);
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $multiField['id']]);
+    $this->callAPISuccess('CustomGroup', 'delete', ['id' => $multiGroup['id']]);
   }
 
   /**
@@ -636,17 +720,17 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    */
   public function testMigrationOfSomeCustomDataOnEmptyCustomRecord() {
     // Create Custom Fields
-    $createGroup  = $this->setupCustomGroupForIndividual();
+    $createGroup = $this->setupCustomGroupForIndividual();
     $customField1 = $this->setupCustomField('Test1', $createGroup);
     $customField2 = $this->setupCustomField('Test2', $createGroup);
 
     // Create multi-value custom field
     $multiGroup = $this->CustomGroupMultipleCreateByParams();
-    $multiField = $this->customFieldCreate(array(
+    $multiField = $this->customFieldCreate([
       'custom_group_id' => $multiGroup['id'],
       'label' => 'field_1' . $multiGroup['id'],
       'in_selector' => 1,
-    ));
+    ]);
 
     // Contacts setup
     $this->setupMatchData();
@@ -654,32 +738,32 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     $duplicateContactID = $this->contacts[1]['id'];
 
     // Update the text custom fields for duplicate contact
-    $this->callAPISuccess('Contact', 'create', array(
+    $this->callAPISuccess('Contact', 'create', [
       'id' => $duplicateContactID,
       "custom_{$customField1['id']}" => 'abc',
       "custom_{$customField2['id']}" => 'def',
       "custom_{$multiField['id']}" => 'ghi',
-    ));
+    ]);
     $this->assertCustomFieldValue($duplicateContactID, 'abc', "custom_{$customField1['id']}");
     $this->assertCustomFieldValue($duplicateContactID, 'def', "custom_{$customField2['id']}");
     $this->assertCustomFieldValue($duplicateContactID, 'ghi', "custom_{$multiField['id']}");
 
     // Perform merge
-    $this->mergeContacts($originalContactID, $duplicateContactID, array(
+    $this->mergeContacts($originalContactID, $duplicateContactID, [
       "move_custom_{$customField1['id']}" => NULL,
       "move_custom_{$customField2['id']}" => 'def',
       "move_rel_table_custom_{$multiGroup['id']}" => '1',
-    ));
+    ]);
     $this->assertCustomFieldValue($originalContactID, '', "custom_{$customField1['id']}");
     $this->assertCustomFieldValue($originalContactID, 'def', "custom_{$customField2['id']}");
     $this->assertCustomFieldValue($originalContactID, 'ghi', "custom_{$multiField['id']}");
 
     // cleanup created custom set
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $customField1['id']));
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $customField2['id']));
-    $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id']));
-    $this->callAPISuccess('CustomField', 'delete', array('id' => $multiField['id']));
-    $this->callAPISuccess('CustomGroup', 'delete', array('id' => $multiGroup['id']));
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $customField1['id']]);
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $customField2['id']]);
+    $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]);
+    $this->callAPISuccess('CustomField', 'delete', ['id' => $multiField['id']]);
+    $this->callAPISuccess('CustomGroup', 'delete', ['id' => $multiGroup['id']]);
   }
 
   /**
@@ -692,14 +776,17 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    * @param $params
    *   Array of fields to be merged from source into target contact, of the form
    *   ['move_<fieldName>' => <fieldValue>]
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
   private function mergeContacts($originalContactID, $duplicateContactID, $params) {
     $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($originalContactID, $duplicateContactID);
 
-    $migrationData = array(
+    $migrationData = [
       'main_details' => $rowsElementsAndInfo['main_details'],
       'other_details' => $rowsElementsAndInfo['other_details'],
-    );
+    ];
 
     // Migrate data of duplicate contact
     CRM_Dedupe_Merger::moveAllBelongings($originalContactID, $duplicateContactID, array_merge($migrationData, $params));
@@ -714,10 +801,10 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    * @param $customFieldName
    */
   private function assertCustomFieldValue($contactID, $expectedValue, $customFieldName) {
-    $data = $this->callAPISuccess('Contact', 'getsingle', array(
+    $data = $this->callAPISuccess('Contact', 'getsingle', [
       'id' => $contactID,
-      'return' => array($customFieldName),
-    ));
+      'return' => [$customFieldName],
+    ]);
 
     $this->assertEquals($expectedValue, $data[$customFieldName], "Custom field value was supposed to be '{$expectedValue}', '{$data[$customFieldName]}' found.");
   }
@@ -729,22 +816,22 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    *   Data for the created custom group record
    */
   private function setupCustomGroupForIndividual() {
-    $customGroup = $this->callAPISuccess('custom_group', 'get', array(
+    $customGroup = $this->callAPISuccess('custom_group', 'get', [
       'name' => 'test_group',
-    ));
+    ]);
 
     if ($customGroup['count'] > 0) {
-      $this->callAPISuccess('CustomGroup', 'delete', array('id' => $customGroup['id']));
+      $this->callAPISuccess('CustomGroup', 'delete', ['id' => $customGroup['id']]);
     }
 
-    $customGroup = $this->callAPISuccess('custom_group', 'create', array(
+    $customGroup = $this->callAPISuccess('custom_group', 'create', [
       'title' => 'Test_Group',
       'name' => 'test_group',
-      'extends' => array('Individual'),
+      'extends' => ['Individual'],
       'style' => 'Inline',
       'is_multiple' => FALSE,
       'is_active' => 1,
-    ));
+    ]);
 
     return $customGroup;
   }
@@ -760,65 +847,65 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    *   Data for the created custom field record
    */
   private function setupCustomField($fieldLabel, $createGroup) {
-    return $this->callAPISuccess('custom_field', 'create', array(
+    return $this->callAPISuccess('custom_field', 'create', [
       'label' => $fieldLabel,
       'data_type' => 'Alphanumeric',
       'html_type' => 'Text',
       'custom_group_id' => $createGroup['id'],
-    ));
+    ]);
   }
 
   /**
    * Set up some contacts for our matching.
    */
   public function setupMatchData() {
-    $fixtures = array(
-      array(
+    $fixtures = [
+      [
         'first_name' => 'Mickey',
         'last_name' => 'Mouse',
         'email' => 'mickey@mouse.com',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'Mickey',
         'last_name' => 'Mouse',
         'email' => 'mickey@mouse.com',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'Minnie',
         'last_name' => 'Mouse',
         'email' => 'mickey@mouse.com',
-      ),
-      array(
+      ],
+      [
         'first_name' => 'Minnie',
         'last_name' => 'Mouse',
         'email' => 'mickey@mouse.com',
-      ),
-    );
+      ],
+    ];
     foreach ($fixtures as $fixture) {
       $contactID = $this->individualCreate($fixture);
-      $this->contacts[] = array_merge($fixture, array('id' => $contactID));
+      $this->contacts[] = array_merge($fixture, ['id' => $contactID]);
     }
-    $organizationFixtures = array(
-      array(
+    $organizationFixtures = [
+      [
         'organization_name' => 'Walt Disney Ltd',
         'email' => 'walt@disney.com',
-      ),
-      array(
+      ],
+      [
         'organization_name' => 'Walt Disney Ltd',
         'email' => 'walt@disney.com',
-      ),
-      array(
+      ],
+      [
         'organization_name' => 'Walt Disney',
         'email' => 'walt@disney.com',
-      ),
-      array(
+      ],
+      [
         'organization_name' => 'Walt Disney',
         'email' => 'walter@disney.com',
-      ),
-    );
+      ],
+    ];
     foreach ($organizationFixtures as $fixture) {
       $contactID = $this->organizationCreate($fixture);
-      $this->contacts[] = array_merge($fixture, array('id' => $contactID));
+      $this->contacts[] = array_merge($fixture, ['id' => $contactID]);
     }
   }
 
@@ -827,203 +914,204 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    *
    * This is a statically maintained (in this test list).
    *
-   * There is also a check against an automated list but having both seems to add extra stability to me. They do
-   * not change often.
+   * There is also a check against an automated list but having both seems to
+   * add extra stability to me. They do not change often.
    */
   public function getStaticCIDRefs() {
-    return array(
-      'civicrm_acl_cache' => array(
+    return [
+      'civicrm_acl_cache' => [
         0 => 'contact_id',
-      ),
-      'civicrm_acl_contact_cache' => array(
+      ],
+      'civicrm_acl_contact_cache' => [
         0 => 'contact_id',
-      ),
-      'civicrm_action_log' => array(
+      ],
+      'civicrm_action_log' => [
         0 => 'contact_id',
-      ),
-      'civicrm_activity_contact' => array(
+      ],
+      'civicrm_activity_contact' => [
         0 => 'contact_id',
-      ),
-      'civicrm_address' => array(
+      ],
+      'civicrm_address' => [
         0 => 'contact_id',
-      ),
-      'civicrm_batch' => array(
+      ],
+      'civicrm_batch' => [
         0 => 'created_id',
         1 => 'modified_id',
-      ),
-      'civicrm_campaign' => array(
+      ],
+      'civicrm_campaign' => [
         0 => 'created_id',
         1 => 'last_modified_id',
-      ),
-      'civicrm_case_contact' => array(
+      ],
+      'civicrm_case_contact' => [
         0 => 'contact_id',
-      ),
-      'civicrm_contact' => array(
+      ],
+      'civicrm_contact' => [
         0 => 'primary_contact_id',
         1 => 'employer_id',
-      ),
-      'civicrm_contribution' => array(
+      ],
+      'civicrm_contribution' => [
         0 => 'contact_id',
-      ),
-      'civicrm_contribution_page' => array(
+      ],
+      'civicrm_contribution_page' => [
         0 => 'created_id',
-      ),
-      'civicrm_contribution_recur' => array(
+      ],
+      'civicrm_contribution_recur' => [
         0 => 'contact_id',
-      ),
-      'civicrm_contribution_soft' => array(
+      ],
+      'civicrm_contribution_soft' => [
         0 => 'contact_id',
-      ),
-      'civicrm_custom_group' => array(
+      ],
+      'civicrm_custom_group' => [
         0 => 'created_id',
-      ),
-      'civicrm_dashboard_contact' => array(
+      ],
+      'civicrm_dashboard_contact' => [
         0 => 'contact_id',
-      ),
-      'civicrm_dedupe_exception' => array(
+      ],
+      'civicrm_dedupe_exception' => [
         0 => 'contact_id1',
         1 => 'contact_id2',
-      ),
-      'civicrm_domain' => array(
+      ],
+      'civicrm_domain' => [
         0 => 'contact_id',
-      ),
-      'civicrm_email' => array(
+      ],
+      'civicrm_email' => [
         0 => 'contact_id',
-      ),
-      'civicrm_event' => array(
+      ],
+      'civicrm_event' => [
         0 => 'created_id',
-      ),
-      'civicrm_event_carts' => array(
+      ],
+      'civicrm_event_carts' => [
         0 => 'user_id',
-      ),
-      'civicrm_financial_account' => array(
+      ],
+      'civicrm_financial_account' => [
         0 => 'contact_id',
-      ),
-      'civicrm_financial_item' => array(
+      ],
+      'civicrm_financial_item' => [
         0 => 'contact_id',
-      ),
-      'civicrm_grant' => array(
+      ],
+      'civicrm_grant' => [
         0 => 'contact_id',
-      ),
-      'civicrm_group' => array(
+      ],
+      'civicrm_group' => [
         0 => 'created_id',
         1 => 'modified_id',
-      ),
-      'civicrm_group_contact' => array(
+      ],
+      'civicrm_group_contact' => [
         0 => 'contact_id',
-      ),
-      'civicrm_group_contact_cache' => array(
+      ],
+      'civicrm_group_contact_cache' => [
         0 => 'contact_id',
-      ),
-      'civicrm_group_organization' => array(
+      ],
+      'civicrm_group_organization' => [
         0 => 'organization_id',
-      ),
-      'civicrm_im' => array(
+      ],
+      'civicrm_im' => [
         0 => 'contact_id',
-      ),
-      'civicrm_log' => array(
+      ],
+      'civicrm_log' => [
         0 => 'modified_id',
-      ),
-      'civicrm_mailing' => array(
+      ],
+      'civicrm_mailing' => [
         0 => 'created_id',
         1 => 'scheduled_id',
         2 => 'approver_id',
-      ),
-      'civicrm_file' => array(
+      ],
+      'civicrm_file' => [
         'created_id',
-      ),
-      'civicrm_mailing_abtest' => array(
+      ],
+      'civicrm_mailing_abtest' => [
         0 => 'created_id',
-      ),
-      'civicrm_mailing_event_queue' => array(
+      ],
+      'civicrm_mailing_event_queue' => [
         0 => 'contact_id',
-      ),
-      'civicrm_mailing_event_subscribe' => array(
+      ],
+      'civicrm_mailing_event_subscribe' => [
         0 => 'contact_id',
-      ),
-      'civicrm_mailing_recipients' => array(
+      ],
+      'civicrm_mailing_recipients' => [
         0 => 'contact_id',
-      ),
-      'civicrm_membership' => array(
+      ],
+      'civicrm_membership' => [
         0 => 'contact_id',
-      ),
-      'civicrm_membership_log' => array(
+      ],
+      'civicrm_membership_log' => [
         0 => 'modified_id',
-      ),
-      'civicrm_membership_type' => array(
+      ],
+      'civicrm_membership_type' => [
         0 => 'member_of_contact_id',
-      ),
-      'civicrm_note' => array(
+      ],
+      'civicrm_note' => [
         0 => 'contact_id',
-      ),
-      'civicrm_openid' => array(
+      ],
+      'civicrm_openid' => [
         0 => 'contact_id',
-      ),
-      'civicrm_participant' => array(
+      ],
+      'civicrm_participant' => [
         0 => 'contact_id',
         //CRM-16761
         1 => 'transferred_to_contact_id',
-      ),
-      'civicrm_payment_token' => array(
+      ],
+      'civicrm_payment_token' => [
         0 => 'contact_id',
         1 => 'created_id',
-      ),
-      'civicrm_pcp' => array(
+      ],
+      'civicrm_pcp' => [
         0 => 'contact_id',
-      ),
-      'civicrm_phone' => array(
+      ],
+      'civicrm_phone' => [
         0 => 'contact_id',
-      ),
-      'civicrm_pledge' => array(
+      ],
+      'civicrm_pledge' => [
         0 => 'contact_id',
-      ),
-      'civicrm_print_label' => array(
+      ],
+      'civicrm_print_label' => [
         0 => 'created_id',
-      ),
-      'civicrm_relationship' => array(
+      ],
+      'civicrm_relationship' => [
         0 => 'contact_id_a',
         1 => 'contact_id_b',
-      ),
-      'civicrm_report_instance' => array(
+      ],
+      'civicrm_report_instance' => [
         0 => 'created_id',
         1 => 'owner_id',
-      ),
-      'civicrm_setting' => array(
+      ],
+      'civicrm_setting' => [
         0 => 'contact_id',
         1 => 'created_id',
-      ),
-      'civicrm_subscription_history' => array(
+      ],
+      'civicrm_subscription_history' => [
         0 => 'contact_id',
-      ),
-      'civicrm_survey' => array(
+      ],
+      'civicrm_survey' => [
         0 => 'created_id',
         1 => 'last_modified_id',
-      ),
-      'civicrm_tag' => array(
+      ],
+      'civicrm_tag' => [
         0 => 'created_id',
-      ),
-      'civicrm_uf_group' => array(
+      ],
+      'civicrm_uf_group' => [
         0 => 'created_id',
-      ),
-      'civicrm_uf_match' => array(
+      ],
+      'civicrm_uf_match' => [
         0 => 'contact_id',
-      ),
-      'civicrm_value_testgetcidref_1' => array(
+      ],
+      'civicrm_value_testgetcidref_1' => [
         0 => 'entity_id',
-      ),
-      'civicrm_website' => array(
+      ],
+      'civicrm_website' => [
         0 => 'contact_id',
-      ),
-    );
+      ],
+    ];
   }
 
   /**
    * Get a list of CIDs that is calculated off the schema.
    *
-   * Note this is an expensive and table locking query. Should be safe in tests though.
+   * Note this is an expensive and table locking query. Should be safe in tests
+   * though.
    */
   public function getCalculatedCIDRefs() {
-    $cidRefs = array();
+    $cidRefs = [];
     $sql = "
 SELECT
     table_name,
index aa4cd9e4313a619862cd286eddaa4ee0c2ca7745..9e70d946bfb8c90c0f68df9500540963e6de25f1 100644 (file)
@@ -214,20 +214,23 @@ class CRM_Event_BAO_AdditionalPaymentTest extends CiviUnitTestCase {
     $result = $this->addParticipantWithPayment($feeAmt, $amtPaid);
     $contributionID = $result['contribution']['id'];
 
-    //Complete the partial payment.
-    $submittedValues = array(
+    $this->callAPISuccess('Payment', 'create', [
+      'contribution_id' => $contributionID,
       'total_amount' => 20,
       'payment_instrument_id' => 3,
-    );
-    CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'owed', $result['participant']['id']);
+      'participant_id' => $result['participant']['id'],
+    ]);
 
     //Change selection to a lower amount.
     $params['price_2'] = 50;
     CRM_Price_BAO_LineItem::changeFeeSelections($params, $result['participant']['id'], 'participant', $contributionID, $result['feeBlock'], $result['lineItem']);
 
-    //Record a refund of the remaining amount.
-    $submittedValues['total_amount'] = 50;
-    CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'refund', $result['participant']['id']);
+    $this->callAPISuccess('Payment', 'create', [
+      'total_amount' => -50,
+      'contribution_id' => $contributionID,
+      'participant_id' => $result['participant']['id'],
+      'payment_instrument_id' => 3,
+    ]);
     $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($result['participant']['id'], 'event', TRUE);
     $transaction = $paymentInfo['transaction'];
 
index a2fc34fbbcefbb96a72955bc8b693e852905af32..047fcb652d6ae48131ddee1f95445787de88f23a 100644 (file)
@@ -308,12 +308,12 @@ class CRM_Event_BAO_ChangeFeeSelectionTest extends CiviUnitTestCase {
     $contributionBalance = ($this->_cheapFee - $actualPaidAmount);
     $this->assertEquals($contributionBalance, CRM_Contribute_BAO_Contribution::getContributionBalance($this->_contributionId));
 
-    //Complete the refund payment.
-    $submittedValues = array(
-      'total_amount' => 120,
+    $this->callAPISuccess('Payment', 'create', [
+      'contribution_id' => $this->_contributionId,
+      'total_amount' => -120,
       'payment_instrument_id' => 3,
-    );
-    CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, 'refund', $this->_participantId);
+      'participant_id' => $this->_participantId,
+    ]);
     $contributionBalance += 120;
     $this->assertEquals($contributionBalance, CRM_Contribute_BAO_Contribution::getContributionBalance($this->_contributionId));
 
index 6f2851a98af33ed15ace64f4c4167757cf772a09..1bd7a387e1deb977b2a7400c8c1d57cf515cdf21 100644 (file)
@@ -275,8 +275,8 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
    * Test for validating financial type has deferred revenue account relationship.
    */
   public function testcheckFinancialTypeHasDeferred() {
-    Civi::settings()->set('contribution_invoice_settings', array('deferred_revenue_enabled' => '1'));
-    $params = array();
+    Civi::settings()->set('deferred_revenue_enabled', 1);
+    $params = [];
     $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params);
     $this->assertFalse($valid, "This should have been false");
     $cid = $this->individualCreate();
index fd69fd866e5155bf5deee4f5f902f905bd11d6dd..d05371a6ed498d24efcb59fd2895507750933a4d 100644 (file)
@@ -7,8 +7,9 @@
 class CRM_Group_Page_AjaxTest extends CiviUnitTestCase {
   /**
    * Permissioned group is used both as an active group the contact can see and as a group that allows
-   * logged in user to see contacts
-   * @var integer
+   * logged in user to see contacts.
+   *
+   * @var int
    */
   protected $_permissionedGroup;
   /**
index 72d1edf654ae41367e5f113b35b08fb78a6e8ca9..9dc0ede1f265d091bf570a5da28dd3f6d5f1df49 100644 (file)
@@ -44,12 +44,7 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {
    * @param $full
    */
   public function testSearch($fv, $count, $ids, $full) {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/queryDataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/queryDataset.xml');
 
     $params = CRM_Contact_BAO_Query::convertFormValues($fv);
     $obj = new CRM_Contact_BAO_Query($params);
@@ -73,13 +68,8 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {
    * CRM-20412: Test accurate count for unique open details
    */
   public function testOpenedMailingQuery() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/queryDataset.xml'
-      )
-    );
 
+    $this->loadXMLDataSet(dirname(__FILE__) . '/queryDataset.xml');
     // ensure that total unique opened mail count is same while
     //   fetching rows and row count for mailing_id = 14
     $totalOpenedMailCount = CRM_Mailing_Event_BAO_Opened::getTotalCount(14, NULL, TRUE);
@@ -93,12 +83,7 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {
    * CRM-21194: Test accurate count for unique trackable URLs
    */
   public function testTrackableUrlMailingQuery() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/queryDataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/queryDataset.xml');
 
     // ensure that total unique clicked mail count is same while
     //   fetching rows and row count for mailing_id = 14 and
index 37c47774e51de9e846a7daffa94335cc0fa61caa..5a24b3c4360c1140cc02711d63376345709895f4 100644 (file)
@@ -8,7 +8,7 @@
 class CRM_Mailing_BAO_QueryTestDataProvider implements Iterator {
 
   /**
-   * @var integer
+   * @var int
    */
   private $i = 0;
 
index 721f87f7c087a3466140b6009d569f390d34d1cc..8b31fe906e198da38afe3bbc5a5bbf2d6f5506b5 100644 (file)
@@ -102,16 +102,25 @@ class CRM_Mailing_TokensTest extends \CiviUnitTestCase {
     $this->assertEquals(1, $count);
   }
 
+  public function getExampleTokensForUseWithoutMailingJob() {
+    $cases = [];
+    $cases[] = ['text/plain', 'To opt out: {action.optOutUrl}!', '@To opt out: .*civicrm/mailing/optout.*&jid=&qid=@'];
+    $cases[] = ['text/html', 'To opt out: <a href="{action.optOutUrl}">click here</a>!', '@To opt out: <a href=".*civicrm/mailing/optout.*&amp;jid=&amp;qid=.*">click@'];
+    return $cases;
+  }
+
   /**
-   * Check the behavior in the erroneous situation where someone uses
-   * a mailing-related token without providing a mailing ID.
+   * When previewing a mailing, there is no active mailing job, so one cannot
+   * generate fully formed URLs which reference the job. The current behavior
+   * is to link to a placeholder URL which has blank values for key fields
+   * like `jid` and `qid`.
+   *
+   * This current behavior may be wise or unwise - either way, having ensures
+   * that changes are intentional.
+   *
+   * @dataProvider getExampleTokensForUseWithoutMailingJob
    */
-  public function testTokensWithoutMailing() {
-    // We only need one case to see that the mailing-object works as
-    // an alternative to the mailing-id.
-    $inputTemplateFormat = 'text/plain';
-    $inputTemplate = 'To optout: {action.optOutUrl}!';
-
+  public function testTokensWithoutMailingJob($inputTemplateFormat, $inputTemplateText, $expectRegex) {
     $mailing = CRM_Core_DAO::createTestObject('CRM_Mailing_DAO_Mailing', array(
       'name' => 'Example Name',
     ));
@@ -120,17 +129,23 @@ class CRM_Mailing_TokensTest extends \CiviUnitTestCase {
     $p = new \Civi\Token\TokenProcessor(Civi::service('dispatcher'), array(
       'mailing' => $mailing,
     ));
-    $p->addMessage('example', $inputTemplate, $inputTemplateFormat);
+    $p->addMessage('example', $inputTemplateText, $inputTemplateFormat);
     $p->addRow()->context(array(
       'contactId' => $contact->id,
     ));
-    try {
-      $p->evaluate();
-      $this->fail('TokenProcessor::evaluate() should have thrown an exception');
-    }
-    catch (CRM_Core_Exception $e) {
-      $this->assertRegExp(';Cannot use action tokens unless context defines mailingJobId and mailingActionTarget;', $e->getMessage());
-    }
+    //    try {
+    //      $p->evaluate();
+    //      $this->fail('TokenProcessor::evaluate() should have thrown an exception');
+    //    }
+    //    catch (CRM_Core_Exception $e) {
+    //      $this->assertRegExp(';Cannot use action tokens unless context defines mailingJobId and mailingActionTarget;', $e->getMessage());
+    //    }
+
+    $p->evaluate();
+
+    // FIXME: For compatibility with
+    $actual = $p->getRow(0)->render('example');
+    $this->assertRegExp($expectRegex, $actual);
   }
 
 }
index b4c118daba50c3a810c8eeaeb6b06dd2556bf4b7..d05442136cbd1bdd289edeac07f24bb4392ec381 100644 (file)
@@ -36,10 +36,8 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
   protected $_individualId;
   protected $_contribution;
   protected $_financialTypeId = 1;
-  protected $_apiversion;
   protected $_entity = 'Membership';
   protected $_params;
-  protected $_ids = array();
   protected $_paymentProcessorID;
 
   /**
@@ -54,7 +52,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
    *
    * @var array
    */
-  protected $_processorParams = array();
+  protected $_processorParams = [];
 
   /**
    * ID of created membership.
@@ -68,7 +66,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
    *
    * @var array
    */
-  protected $paymentInstruments = array();
+  protected $paymentInstruments = [];
 
 
   /**
@@ -83,18 +81,12 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
    * and redirect stdin to a temporary file.
    */
   public function setUp() {
-    $this->_apiversion = 3;
     parent::setUp();
 
     $this->_individualId = $this->individualCreate();
     $this->_paymentProcessorID = $this->processorCreate();
-    // Insert test data.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/dataset/data.xml'
-      )
-    );
+
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/data.xml');
     $membershipTypeAnnualFixed = $this->callAPISuccess('membership_type', 'create', array(
       'domain_id' => 1,
       'name' => "AnnualFixed",
@@ -114,7 +106,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
     ));
     $this->_membershipID = $membership['id'];
 
-    $instruments = $this->callAPISuccess('contribution', 'getoptions', array('field' => 'payment_instrument_id'));
+    $instruments = $this->callAPISuccess('contribution', 'getoptions', ['field' => 'payment_instrument_id']);
     $this->paymentInstruments = $instruments['values'];
   }
 
@@ -144,7 +136,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
   public function testSubmit() {
     $form = $this->getForm();
     $this->createLoggedInUser();
-    $params = array(
+    $params = [
       'cid' => $this->_individualId,
       'join_date' => date('m/d/Y', time()),
       'start_date' => '',
@@ -178,10 +170,11 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
       'billing_state_province_id-5' => '1003',
       'billing_postal_code-5' => '90210',
       'billing_country_id-5' => '1228',
-    );
+    ];
     $form->_contactID = $this->_individualId;
 
     $form->testSubmit($params);
+    $form->setRenewalMessage();
     $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
     $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 0);
     $contribution = $this->callAPISuccess('Contribution', 'get', array(
@@ -203,6 +196,14 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
         'return' => 'payment_instrument_id',
       )),
     ), 'online');
+    $this->assertEquals([
+      [
+        'text' => 'AnnualFixed membership for Mr. Anthony Anderson II has been renewed.',
+        'title' => 'Complete',
+        'type' => 'success',
+        'options' => NULL,
+      ],
+    ], CRM_Core_Session::singleton()->getStatus());
   }
 
   /**
index 0ac9a2803e0b445e5675ed6c2c785825669d8526..d9db47e38c7fc667ecacc60a140a9e6dfc6c0592 100644 (file)
@@ -95,13 +95,9 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
 
     $this->_individualId = $this->individualCreate();
     $this->_paymentProcessorID = $this->processorCreate();
-    // Insert test data.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/dataset/data.xml'
-      )
-    );
+
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/data.xml');
+
     $membershipTypeAnnualFixed = $this->callAPISuccess('membership_type', 'create', array(
       'domain_id' => 1,
       'name' => "AnnualFixed",
index c39b1618d561651433fb27b3a39341612e39c12f..17b6ec9ef9463fda4a6bd09ff798e49352cf04c5 100644 (file)
 class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase {
   /**
    * Membership type name used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_membershipTypeName = NULL;
 
   /**
    * Membership type id used in test function.
-   * @var String
+   *
+   * @var string
    */
   protected $_membershipTypeID = NULL;
 
index 74dbaca6ab43ac27ee9f9b850e7a83c018044c4d..a990e124fcedf3b3ec81d83853bfbadc8ec092ce 100644 (file)
@@ -151,6 +151,8 @@ class CRM_Upgrade_Incremental_BaseTest extends CiviUnitTestCase {
 
   /**
    * Test renaming multiple fields.
+   *
+   * @throws Exception
    */
   public function testRenameFields() {
     $this->callAPISuccess('SavedSearch', 'create', [
@@ -169,4 +171,15 @@ class CRM_Upgrade_Incremental_BaseTest extends CiviUnitTestCase {
     $this->assertEquals('activity_date_time_relative', $savedSearch['form_values'][1][0]);
   }
 
+  /**
+   * Test that a mis-saved variable in 'contribute settings' can be converted to a
+   * 'proper' setting.
+   */
+  public function testConvertUpgradeContributeSettings() {
+    Civi::settings()->set('contribution_invoice_settings', ['foo' => 'bar', 'deferred_revenue_enabled' => 1]);
+    $this->assertEquals(0, Civi::settings()->get('deferred_revenue_enabled'));
+    CRM_Upgrade_Incremental_Base::updateContributeSettings(NULL, 5.1);
+    $this->assertEquals(1, Civi::settings()->get('deferred_revenue_enabled'));
+  }
+
 }
index 9c7277504c360aa2896c7b3c3ac5f1998cf26745..e202473a214b5eed1258aa55f6a729dc54dfcf61 100644 (file)
@@ -38,28 +38,17 @@ class CRM_Utils_DeprecatedUtilsTest extends CiviUnitTestCase {
    *  and request the error in array format
    */
   public function testCheckParamsWithDuplicateContact2() {
-    //  Insert a row in civicrm_contact creating individual contact
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/../../api/v3/dataset/contact_17.xml'
-      )
-    );
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/../../api/v3/dataset/email_contact_17.xml'
-      )
-    );
+    $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com']);
 
-    $params = array(
+    $params = [
       'first_name' => 'Test',
       'last_name' => 'Contact',
       'email' => 'TestContact@example.com',
       'contact_type' => 'Individual',
-    );
+    ];
     $contact = _civicrm_api3_deprecated_contact_check_params($params, TRUE);
     $this->assertEquals(1, $contact['is_error']);
-    $this->assertRegexp("/matching contacts.*17/s",
+    $this->assertRegexp("/matching contacts.*1/s",
       $contact['error_message']['message']
     );
   }
index f52784ae4fb226c7591ac287c6018b33c7be91c6..692bbee80380ba4610019b0a5f48e0f54c2a2ae6 100644 (file)
@@ -95,4 +95,39 @@ class CRM_Utils_FileTest extends CiviUnitTestCase {
     $this->assertEquals($expectedResult, CRM_Utils_File::isValidFileName($fileName));
   }
 
+  public function pathToFileExtension() {
+    $cases = [];
+    $cases[] = ['/evil.pdf', 'pdf'];
+    $cases[] = ['/helloworld.jpg', 'jpg'];
+    $cases[] = ['/smartwatch_1736683_1280_9af3657015e8660cc234eb1601da871.jpg', 'jpg'];
+    return $cases;
+  }
+
+  /**
+   * Test returning appropriate file extension
+   * @dataProvider pathToFileExtension
+   * @param string $path
+   * @param string $expectedExtension
+   */
+  public function testPathToExtension($path, $expectedExtension) {
+    $this->assertEquals($expectedExtension, CRM_Utils_File::getExtensionFromPath($path));
+  }
+
+  public function mimeTypeToExtension() {
+    $cases = [];
+    $cases[] = ['text/plain', ['txt', 'text', 'conf', 'def', 'list', 'log', 'in']];
+    $cases[] = ['image/jpeg', ['jpeg', 'jpg', 'jpe']];
+    $cases[] = ['image/png', ['png']];
+    return $cases;
+  }
+
+  /**
+   * @dataProvider mimeTypeToExtension
+   * @param stirng $mimeType
+   * @param array $expectedExtensions
+   */
+  public function testMimeTypeToExtension($mimeType, $expectedExtensions) {
+    $this->assertEquals($expectedExtensions, CRM_Utils_File::getAcceptableExtensionsForMimeType($mimeType));
+  }
+
 }
diff --git a/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php b/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php
new file mode 100644 (file)
index 0000000..3b5d9a1
--- /dev/null
@@ -0,0 +1,183 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 5                                                  |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Trait Custom Data trait.
+ *
+ * Trait for setting up custom data in tests.
+ */
+trait CRMTraits_Custom_CustomDataTrait {
+
+  /**
+   * Create a custom group with fields of multiple types.
+   *
+   * @param array $groupParams
+   */
+  public function createCustomGroupWithFieldsOfAllTypes($groupParams = []) {
+    $this->createCustomGroup($groupParams);
+    $this->ids['CustomField'] = $this->createCustomFieldsOfAllTypes();
+  }
+
+  /**
+   * Create a custom group.
+   *
+   * @param array $params
+   *
+   * @return int
+   */
+  public function createCustomGroup($params = []) {
+    $params = array_merge([
+      'title' => 'Custom Group',
+      'extends' => [$this->entity],
+      'weight' => 5,
+      'style' => 'Inline',
+      'max_multiple' => 0,
+    ], $params);
+    $this->ids['CustomGroup'][$params['title']] = $this->callAPISuccess('CustomGroup', 'create', $params)['id'];
+    return $this->ids['CustomGroup'][$params['title']];
+  }
+
+  /**
+   * @return array
+   */
+  public function createCustomFieldsOfAllTypes() {
+    $customGroupID = $this->ids['CustomGroup']['Custom Group'];
+    $ids = [];
+    $params = [
+      'custom_group_id' => $customGroupID,
+      'label' => 'Enter text here',
+      'html_type' => 'Text',
+      'data_type' => 'String',
+      'default_value' => 'xyz',
+      'weight' => 1,
+      'is_required' => 1,
+    ];
+
+    $customField = $this->callAPISuccess('CustomField', 'create', $params);
+    $ids['text'] = $customField['id'];
+
+    $optionValue[] = [
+      'label' => 'Red',
+      'value' => 'R',
+      'weight' => 1,
+      'is_active' => 1,
+    ];
+    $optionValue[] = [
+      'label' => 'Yellow',
+      'value' => 'Y',
+      'weight' => 2,
+      'is_active' => 1,
+    ];
+    $optionValue[] = [
+      'label' => 'Green',
+      'value' => 'G',
+      'weight' => 3,
+      'is_active' => 1,
+    ];
+
+    $params = [
+      'label' => 'Pick Color',
+      'html_type' => 'Select',
+      'data_type' => 'String',
+      'weight' => 2,
+      'is_required' => 1,
+      'is_searchable' => 0,
+      'is_active' => 1,
+      'option_values' => $optionValue,
+      'custom_group_id' => $customGroupID,
+    ];
+
+    $customField = $this->callAPISuccess('custom_field', 'create', $params);
+    $ids['select_string'] = $customField['id'];
+
+    $params = [
+      'custom_group_id' => $customGroupID,
+      'name' => 'test_date',
+      'label' => 'test_date',
+      'html_type' => 'Select Date',
+      'data_type' => 'Date',
+      'default_value' => '20090711',
+      'weight' => 3,
+      'time_format' => 1,
+    ];
+
+    $customField = $this->callAPISuccess('custom_field', 'create', $params);
+
+    $ids['select_date'] = $customField['id'];
+    $params = [
+      'custom_group_id' => $customGroupID,
+      'name' => 'test_link',
+      'label' => 'test_link',
+      'html_type' => 'Link',
+      'data_type' => 'Link',
+      'default_value' => 'http://civicrm.org',
+      'weight' => 4,
+      'is_required' => 1,
+      'is_searchable' => 0,
+      'is_active' => 1,
+    ];
+
+    $customField = $this->callAPISuccess('custom_field', 'create', $params);
+
+    $ids['link'] = $customField['id'];
+    $fileField = $this->customFieldCreate([
+      'custom_group_id' => $customGroupID,
+      'data_type' => 'File',
+      'html_type' => 'File',
+      'default_value' => '',
+    ]);
+
+    $ids['file'] = $fileField['id'];
+    $ids['country'] = $this->customFieldCreate([
+      'custom_group_id' => $customGroupID,
+      'data_type' => 'Int',
+      'html_type' => 'Select Country',
+      'default_value' => '',
+      'label' => 'Country',
+      'option_type' => 0,
+    ])['id'];
+
+    return $ids;
+  }
+
+  /**
+   * Get the custom field name for the relevant key.
+   *
+   * e.g returns 'custom_5' where 5 is the id of the field using the key.
+   *
+   * Generally keys map to data types.
+   *
+   * @param string $key
+   *
+   * @return string
+   */
+  protected function getCustomFieldName($key) {
+    $linkField = 'custom_' . $this->ids['CustomField'][$key];
+    return $linkField;
+  }
+
+}
index db21ca346ab6b09bfc55b17585f23ba3e64d5861..e973a1ba451adb497088d029f2f265d6d0f02b58 100644 (file)
@@ -62,7 +62,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   /**
    *  Database has been initialized.
    *
-   * @var boolean
+   * @var bool
    */
   private static $dbInit = FALSE;
 
@@ -92,7 +92,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   protected $tempDirs;
 
   /**
-   * @var boolean populateOnce allows to skip db resets in setUp
+   * @var bool populateOnce allows to skip db resets in setUp
    *
    *  WARNING! USE WITH CAUTION - IT'LL RENDER DATA DEPENDENCIES
    *  BETWEEN TESTS WHEN RUN IN SUITE. SUITABLE FOR LOCAL, LIMITED
@@ -105,7 +105,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   public static $populateOnce = FALSE;
 
   /**
-   * @var boolean DBResetRequired allows skipping DB reset
+   * @var bool DBResetRequired allows skipping DB reset
    *               in specific test case. If you still need
    *               to reset single test (method) of such case, call
    *               $this->cleanDB() in the first line of this
@@ -118,6 +118,16 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    */
   private $tx = NULL;
 
+  /**
+   * Array of IDs created to support the test.
+   *
+   * e.g
+   * $this->ids = ['Contact' => ['descriptive_key' => $contactID], 'Group' => [$groupID]];
+   *
+   * @var array
+   */
+  protected $ids = [];
+
   /**
    * Class used for hooks during tests.
    *
@@ -321,6 +331,12 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     // disable any left-over test extensions
     CRM_Core_DAO::executeQuery('DELETE FROM civicrm_extension WHERE full_name LIKE "test.%"');
 
+    $extensions = \CRM_Extension_System::singleton()->getManager();
+    $api4Status = $extensions->getStatus('org.civicrm.api4');
+    if ($api4Status != $extensions::STATUS_INSTALLED && $api4Status != $extensions::STATUS_UNKNOWN) {
+      $extensions->enable(['org.civicrm.api4']);
+    }
+
     // reset all the caches
     CRM_Utils_System::flushCache();
 
@@ -357,14 +373,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
 
     $this->getConnection()->getConnection()->query("SET FOREIGN_KEY_CHECKS = 0;");
 
-    $xmlFiles = glob($fixturesDir . '/*.xml');
-    foreach ($xmlFiles as $xmlFixture) {
-      $op = new PHPUnit_Extensions_Database_Operation_Insert();
-      $dataset = $this->createXMLDataSet($xmlFixture);
-      $this->_tablesToTruncate = array_merge($this->_tablesToTruncate, $dataset->getTableNames());
-      $op->execute($this->_dbconn, $dataset);
-    }
-
     $yamlFiles = glob($fixturesDir . '/*.yaml');
     foreach ($yamlFiles as $yamlFixture) {
       $op = new PHPUnit_Extensions_Database_Operation_Insert();
@@ -376,6 +384,46 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     $this->getConnection()->getConnection()->query("SET FOREIGN_KEY_CHECKS = 1;");
   }
 
+  /**
+   * Load the data that used to be handled by the discontinued dbunit class.
+   *
+   * This could do with further tidy up - the initial priority is simply to get rid of
+   * the dbunity package which is no longer supported.
+   *
+   * @param string $fileName
+   */
+  protected function loadXMLDataSet($fileName) {
+    CRM_Core_DAO::executeQuery('SET FOREIGN_KEY_CHECKS = 0');
+    $xml = json_decode(json_encode(simplexml_load_file($fileName)), TRUE);
+    foreach ($xml as $tableName => $element) {
+      if (!empty($element)) {
+        foreach ($element as $row) {
+          $keys = $values = [];
+          if (isset($row['@attributes'])) {
+            foreach ($row['@attributes'] as $key => $value) {
+              $keys[] = $key;
+              $values[] = is_numeric($value) ? $value : "'{$value}'";
+            }
+          }
+          elseif (!empty($row)) {
+            // cos we copied it & it is inconsistent....
+            foreach ($row as $key => $value) {
+              $keys[] = $key;
+              $values[] = is_numeric($value) ? $value : "'{$value}'";
+            }
+          }
+
+          if (!empty($values)) {
+            CRM_Core_DAO::executeQuery("
+            INSERT INTO $tableName (" . implode(',', $keys) . ') VALUES(' . implode(',', $values) . ')'
+            );
+          }
+        }
+      }
+    }
+    CRM_Core_DAO::executeQuery('SET FOREIGN_KEY_CHECKS = 1');
+  }
+
   /**
    * Create default domain contacts for the two domains added during test class.
    * database population.
@@ -1357,12 +1405,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
 
     $params = array_merge($defaults, $params);
 
-    //have a crack @ deleting it first in the hope this will prevent derailing our tests
-    $this->callAPISuccess('custom_group', 'get', array(
-      'title' => $params['title'],
-      array('api.custom_group.delete' => 1),
-    ));
-
     return $this->callAPISuccess('custom_group', 'create', $params);
   }
 
@@ -1948,13 +1990,13 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
    * @return void
    */
   public function setMockSettingsMetaData($extras) {
-    Civi::service('settings_manager')->flush();
-
     CRM_Utils_Hook::singleton()
       ->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use ($extras) {
         $metadata = array_merge($metadata, $extras);
       });
 
+    Civi::service('settings_manager')->flush();
+
     $fields = $this->callAPISuccess('setting', 'getfields', array());
     foreach ($extras as $key => $spec) {
       $this->assertNotEmpty($spec['title']);
@@ -3156,4 +3198,37 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
     $dbLocale = '_en_US';
   }
 
+  /**
+   * Setup or clean up SMS tests
+   * @param bool $teardown
+   *
+   * @throws \CiviCRM_API3_Exception
+   */
+  public function setupForSmsTests($teardown = FALSE) {
+    require_once 'CiviTest/CiviTestSMSProvider.php';
+
+    // Option value params for CiviTestSMSProvider
+    $groupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'sms_provider_name', 'id', 'name');
+    $params = array(
+      'option_group_id' => $groupID,
+      'label' => 'unittestSMS',
+      'value' => 'unit.test.sms',
+      'name'  => 'CiviTestSMSProvider',
+      'is_default' => 1,
+      'is_active'  => 1,
+      'version'    => 3,
+    );
+
+    if ($teardown) {
+      // Test completed, delete provider
+      $providerOptionValueResult = civicrm_api3('option_value', 'get', $params);
+      civicrm_api3('option_value', 'delete', array('id' => $providerOptionValueResult['id']));
+      return;
+    }
+
+    // Create an SMS provider "CiviTestSMSProvider". Civi handles "CiviTestSMSProvider" as a special case and allows it to be instantiated
+    //  in CRM/Sms/Provider.php even though it is not an extension.
+    return civicrm_api3('option_value', 'create', $params);
+  }
+
 }
index f72b0a8818ffc4086b16d0631b44147465dbdee7..ff7534ff28cca03b375d409e40048220615772a7 100644 (file)
@@ -571,15 +571,19 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
   }
 
   /**
-   * View all activities is required unless id is passed in, in which case ACLs are used.
+   * Check the error message is not a permission error.
    */
-  public function testGetActivityAccessCiviCRMNotEnough() {
+  public function testGetActivityAccessCiviCRMEnough() {
     $activity = $this->activityCreate();
     $this->setPermissions(['access CiviCRM']);
     $this->callAPIFailure('Activity', 'getsingle', [
       'check_permissions' => 1,
       'id' => $activity['id'],
-    ]);
+    ], 'Expected one Activity but found 0');
+    $this->callAPISuccessGetCount('Activity', [
+      'check_permissions' => 1,
+      'id' => $activity['id'],
+    ], 0);
   }
 
   /**
index bbbc21cf9a7d2cac2018d3bc7ddd524e65ad888c..308b012d60e9fb2bba3ecd8b391fa2dee76d4b29 100644 (file)
@@ -479,4 +479,47 @@ class api_v3_AddressTest extends CiviUnitTestCase {
     $this->assertEquals($expectState, $created['state_province_id']);
   }
 
+  public function testBuildStateProvinceOptionsWithDodgyProvinceLimit() {
+    $provinceLimit = [1228, "abcd;ef"];
+    $this->callAPISuccess('setting', 'create', [
+     'provinceLimit' => $provinceLimit,
+    ]);
+    $result = $this->callAPIFailure('address', 'getoptions', ['field' => 'state_province_id']);
+    // confirm that we hit our error not a SQLI.
+    $this->assertEquals('Province limit or default country setting is incorrect', $result['error_message']);
+    $this->callAPISuccess('setting', 'create', [
+     'provinceLimit' => [1228],
+    ]);
+    // Now confirm with a correct province setting it works fine
+    $this->callAPISuccess('address', 'getoptions', ['field' => 'state_province_id']);
+  }
+
+  public function testBuildCountryWithDodgyCountryLimitSetting() {
+    $countryLimit = [1228, "abcd;ef"];
+    $this->callAPISuccess('setting', 'create', [
+     'countryLimit' => $countryLimit,
+    ]);
+    $result = $this->callAPIFailure('address', 'getoptions', ['field' => 'country_id']);
+    // confirm that we hit our error not a SQLI.
+    $this->assertEquals('Available Country setting is incorrect', $result['error_message']);
+    $this->callAPISuccess('setting', 'create', [
+     'countryLimit' => [1228],
+    ]);
+    // Now confirm with a correct province setting it works fine
+    $this->callAPISuccess('address', 'getoptions', ['field' => 'country_id']);
+  }
+
+  public function testBuildCountyWithDodgeStateProvinceFiltering() {
+    $result = $this->callAPIFailure('Address', 'getoptions', [
+      'field' => 'county_id',
+      'state_province_id' => "abcd;ef",
+    ]);
+    $this->assertEquals('Can only accept Integers for state_province_id filtering', $result['error_message']);
+    $goodResult = $this->callAPISuccess('Address', 'getoptions', [
+      'field' => 'county_id',
+      'state_province_id' => 1004,
+    ]);
+    $this->assertEquals('San Francisco', $goodResult['values'][4]);
+  }
+
 }
index 818068d0363ab29d6678c56c0528a47a09e6b43d..4cab52bddcc779107d2b3b282f5ac8c6678b83dd 100644 (file)
@@ -37,6 +37,8 @@
  * @group headless
  */
 class api_v3_ContactTest extends CiviUnitTestCase {
+  use CRMTraits_Custom_CustomDataTrait;
+
   public $DBResetRequired = FALSE;
   protected $_apiversion;
   protected $_entity;
@@ -45,6 +47,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   protected $_contactID;
   protected $_financialTypeId = 1;
 
+
+  /**
+   * Entity to be extended.
+   *
+   * @var string
+   */
+  protected $entity = 'Contact';
+
   /**
    * Test setup for every test.
    *
@@ -1479,16 +1489,10 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Verify successful update of individual contact.
    */
   public function testUpdateIndividualWithAll() {
-    // Insert a row in civicrm_contact creating individual contact.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_ind.xml'
-      )
-    );
+    $contactID = $this->individualCreate();
 
-    $params = array(
-      'id' => 23,
+    $params = [
+      'id' => $contactID,
       'first_name' => 'abcd',
       'contact_type' => 'Individual',
       'nick_name' => 'This is nickname first',
@@ -1500,8 +1504,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
       'external_identifier' => '1928837465',
       'image_URL' => 'http://some.url.com/image.jpg',
       'home_url' => 'http://www.example.org',
-
-    );
+    ];
 
     $this->callAPISuccess('Contact', 'Update', $params);
     $getResult = $this->callAPISuccess('Contact', 'Get', $params);
@@ -1510,50 +1513,28 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     //reducing this test partially back to api v2 level to get it through
     unset($params['home_url']);
     foreach ($params as $key => $value) {
-      $this->assertEquals($value, $getResult['values'][23][$key]);
+      $this->assertEquals($value, $getResult['values'][$contactID][$key]);
     }
-    // Check updated civicrm_contact against expected.
-    $expected = $this->createXMLDataSet(
-      dirname(__FILE__) . '/dataset/contact_ind_upd.xml'
-    );
-    $actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet(
-      $this->_dbconn
-    );
-    $actual->addTable('civicrm_contact');
-    $expected->matches($actual);
   }
 
   /**
    * Verify successful update of organization contact.
+   *
+   * @throws \Exception
    */
   public function testUpdateOrganizationWithAll() {
-    // Insert a row in civicrm_contact creating organization contact
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_org.xml'
-      )
-    );
+    $contactID = $this->organizationCreate();
 
-    $params = array(
-      'id' => 24,
+    $params = [
+      'id' => $contactID,
       'organization_name' => 'WebAccess India Pvt Ltd',
       'legal_name' => 'WebAccess',
       'sic_code' => 'ABC12DEF',
       'contact_type' => 'Organization',
-    );
+    ];
 
     $this->callAPISuccess('Contact', 'Update', $params);
-
-    // Check updated civicrm_contact against expected.
-    $expected = $this->createXMLDataSet(
-      dirname(__FILE__) . '/dataset/contact_org_upd.xml'
-    );
-    $actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet(
-      $this->_dbconn
-    );
-    $actual->addTable('civicrm_contact');
-    $expected->matches($actual);
+    $this->getAndCheck($params, $contactID, 'Contact');
   }
 
   /**
@@ -1629,30 +1610,24 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Verify successful update of household contact.
    */
   public function testUpdateHouseholdWithAll() {
-    // Insert a row in civicrm_contact creating household contact
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_hld.xml'
-      )
-    );
+    $contactID = $this->householdCreate();
 
-    $params = array(
-      'id' => 25,
+    $params = [
+      'id' => $contactID ,
       'household_name' => 'ABC household',
       'nick_name' => 'ABC House',
       'contact_type' => 'Household',
-    );
+    ];
 
     $result = $this->callAPISuccess('Contact', 'Update', $params);
 
-    $expected = array(
+    $expected = [
       'contact_type' => 'Household',
       'is_opt_out' => 0,
       'sort_name' => 'ABC household',
       'display_name' => 'ABC household',
       'nick_name' => 'ABC House',
-    );
+    ];
     $this->getAndCheck($expected, $result['id'], 'contact');
   }
 
@@ -1664,20 +1639,12 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * CRM-7645.
    */
   public function testUpdateCreateWithID() {
-    // Insert a row in civicrm_contact creating individual contact.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_ind.xml'
-      )
-    );
-
-    $params = array(
-      'id' => 23,
+    $contactID = $this->individualCreate();
+    $this->callAPISuccess('Contact', 'Update', [
+      'id' => $contactID,
       'first_name' => 'abcd',
       'last_name' => 'wxyz',
-    );
-    $this->callAPISuccess('Contact', 'Update', $params);
+    ]);
   }
 
   /**
@@ -1788,55 +1755,31 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test civicrm_contact_getquick() with empty name param.
    */
   public function testContactGetQuick() {
-    // Insert a row in civicrm_contact creating individual contact.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_17.xml'
-      )
-    );
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/email_contact_17.xml'
-      )
-    );
-    $params = array(
-      'name' => "T",
-    );
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com']);
 
-    $result = $this->callAPISuccess('contact', 'getquick', $params);
-    $this->assertEquals(17, $result['values'][0]['id']);
-    $params = array(
+    $result = $this->callAPISuccess('contact', 'getquick', ['name' => 'T']);
+    $this->assertEquals($contactID, $result['values'][0]['id']);
+    $params = [
       'name' => "TestContact@example.com",
       'field_name' => 'sort_name',
-    );
+    ];
     $result = $this->callAPISuccess('contact', 'getquick', $params);
-    $this->assertEquals(17, $result['values'][0]['id']);
+    $this->assertEquals($contactID, $result['values'][0]['id']);
   }
 
   /**
    * Test civicrm_contact_get) with empty params.
    */
   public function testContactGetEmptyParams() {
-    $this->callAPISuccess('contact', 'get', array());
+    $this->callAPISuccess('contact', 'get', []);
   }
 
   /**
    * Test civicrm_contact_get(,true) with no matches.
    */
   public function testContactGetOldParamsNoMatches() {
-    // Insert a row in civicrm_contact creating contact 17.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_17.xml'
-      )
-    );
-
-    $params = array(
-      'first_name' => 'Fred',
-    );
-    $result = $this->callAPISuccess('contact', 'get', $params);
+    $this->individualCreate();
+    $result = $this->callAPISuccess('contact', 'get', ['first_name' => 'Fred']);
     $this->assertEquals(0, $result['count']);
   }
 
@@ -1844,19 +1787,11 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test civicrm_contact_get(,true) with one match.
    */
   public function testContactGetOldParamsOneMatch() {
-    // Insert a row in civicrm_contact creating contact 17
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml'
-      )
-    );
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
 
-    $params = array(
-      'first_name' => 'Test',
-    );
-    $result = $this->callAPISuccess('contact', 'get', $params);
-    $this->assertEquals(17, $result['values'][17]['contact_id']);
-    $this->assertEquals(17, $result['id']);
+    $result = $this->callAPISuccess('contact', 'get', ['first_name' => 'Test']);
+    $this->assertEquals($contactID, $result['values'][$contactID]['contact_id']);
+    $this->assertEquals($contactID, $result['id']);
   }
 
   /**
@@ -2488,11 +2423,11 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test TrueFalse format - I couldn't come up with an easy way to get an error on Get.
    */
   public function testContactGetFormatIsSuccessTrue() {
-    $this->createContactFromXML();
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
     $description = "This demonstrates use of the 'format.is_success' param.
     This param causes only the success or otherwise of the function to be returned as BOOLEAN";
     $subfile = "FormatIsSuccess_True";
-    $params = array('id' => 17, 'format.is_success' => 1);
+    $params = ['id' => $contactID, 'format.is_success' => 1];
     $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
     $this->assertEquals(1, $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
@@ -2562,25 +2497,24 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test Single Entity format.
    */
   public function testContactGetSingleEntityArray() {
-    $this->createContactFromXML();
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
     $description = "This demonstrates use of the 'format.single_entity_array' param.
       This param causes the only contact to be returned as an array without the other levels.
       It will be ignored if there is not exactly 1 result";
     $subfile = "GetSingleContact";
-    $params = array('id' => 17);
-    $result = $this->callAPIAndDocument('Contact', 'GetSingle', $params, __FUNCTION__, __FILE__, $description, $subfile);
-    $this->assertEquals('Test Contact', $result['display_name']);
-    $this->callAPISuccess('Contact', 'Delete', $params);
+    $result = $this->callAPIAndDocument('Contact', 'GetSingle', ['id' => $contactID], __FUNCTION__, __FILE__, $description, $subfile);
+    $this->assertEquals('Mr. Test Contact II', $result['display_name']);
+    $this->callAPISuccess('Contact', 'Delete', ['id' => $contactID]);
   }
 
   /**
    * Test Single Entity format.
    */
   public function testContactGetFormatCountOnly() {
-    $this->createContactFromXML();
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
     $description = "This demonstrates use of the 'getCount' action.
       This param causes the count of the only function to be returned as an integer.";
-    $params = array('id' => 17);
+    $params = ['id' => $contactID];
     $result = $this->callAPIAndDocument('Contact', 'GetCount', $params, __FUNCTION__, __FILE__, $description,
       'GetCountContact');
     $this->assertEquals('1', $result);
@@ -2591,14 +2525,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test id only format.
    */
   public function testContactGetFormatIDOnly() {
-    $this->createContactFromXML();
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
     $description = "This demonstrates use of the 'format.id_only' param.
       This param causes the id of the only entity to be returned as an integer.
       It will be ignored if there is not exactly 1 result";
     $subfile = "FormatOnlyID";
-    $params = array('id' => 17, 'format.only_id' => 1);
+    $params = ['id' => $contactID, 'format.only_id' => 1];
     $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
-    $this->assertEquals('17', $result);
+    $this->assertEquals($contactID, $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
 
@@ -2606,14 +2540,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
    * Test id only format.
    */
   public function testContactGetFormatSingleValue() {
-    $this->createContactFromXML();
+    $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']);
     $description = "This demonstrates use of the 'format.single_value' param.
       This param causes only a single value of the only entity to be returned as an string.
       It will be ignored if there is not exactly 1 result";
     $subFile = "FormatSingleValue";
-    $params = array('id' => 17, 'return' => 'display_name');
+    $params = ['id' => $contactID, 'return' => 'display_name'];
     $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile);
-    $this->assertEquals('Test Contact', $result);
+    $this->assertEquals('Mr. Test Contact II', $result);
     $this->callAPISuccess('Contact', 'Delete', $params);
   }
 
@@ -2687,19 +2621,6 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->callAPISuccess('contact', 'update', $params);
   }
 
-  /**
-   * Set up helper to create a contact.
-   */
-  public function createContactFromXML() {
-    // Insert a row in civicrm_contact creating contact 17.
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/contact_17.xml'
-      )
-    );
-  }
-
   /**
    * Test contact proximity api.
    */
@@ -3458,6 +3379,57 @@ class api_v3_ContactTest extends CiviUnitTestCase {
 
   }
 
+  /**
+   * Test merging 2 contacts with custom fields.
+   *
+   * @throws \Exception
+   */
+  public function testMergeCustomFields() {
+    $contact1 = $this->individualCreate();
+    /* Not sure this is quite right but it does get it into the file table
+    $file = $this->callAPISuccess('Attachment', 'create', [
+    'name' => 'header.txt',
+    'mime_type' => 'text/plain',
+    'description' => 'My test description',
+    'content' => 'My test content',
+    'entity_table' => 'civicrm_contact',
+    'entity_id' => $contact1,
+    ]);
+     */
+
+    $this->createCustomGroupWithFieldsOfAllTypes();
+    $fileField = $this->getCustomFieldName('file');
+    $linkField = $this->getCustomFieldName('link');
+    $dateField = $this->getCustomFieldName('select_date');
+    $selectField = $this->getCustomFieldName('select_string');
+    $countryField = $this->getCustomFieldName('country');
+
+    $countriesByName = array_flip(CRM_Core_PseudoConstant::country(FALSE, FALSE));
+    $customFieldValues = [
+      // @todo fix the fatal bug on this & uncomment - see dev/core#723
+      // $fileField => $file['id'],
+      $linkField => 'http://example.org',
+      $dateField => '2018-01-01 17:10:56',
+      $selectField => 'G',
+      // Currently broken.
+      //$countryField => $countriesByName['New Zealand'],
+    ];
+    $this->callAPISuccess('Contact', 'create', array_merge([
+      'id' => $contact1,
+    ], $customFieldValues));
+
+    $contact2 = $this->individualCreate();
+    $this->callAPISuccess('contact', 'merge', [
+      'to_keep_id' => $contact2,
+      'to_remove_id' => $contact1,
+      'auto_flip' => FALSE,
+    ]);
+    $contact = $this->callAPISuccessGetSingle('Contact', ['id' => $contact2, 'return' => array_keys($customFieldValues)]);
+    foreach ($customFieldValues as $key => $value) {
+      $this->assertEquals($value, $contact[$key]);
+    }
+  }
+
   /**
    * Test retrieving merged contacts.
    *
index 6b29420744fe9617ebda9ee74db9ac98c1271aaa..c99b72debb03e8ba75d5996a2b08689caac9d3ce 100644 (file)
@@ -31,7 +31,7 @@
  */
 class api_v3_CustomValueTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
-  protected $ids;
+
   protected $optionGroup;
 
   public $DBResetRequired = FALSE;
index ccccba6bc29fd7df653eef372322a8f0545fab19..5c25bf0f77b03c30dd2828301a1752a98ba876f6 100644 (file)
@@ -197,7 +197,6 @@ class api_v3_FinancialTypeACLTest extends CiviUnitTestCase {
     $this->addFinancialAclPermissions([['view', 'Donation']]);
     $this->callAPISuccessGetSingle('contribution', $params);
     $this->callAPISuccessGetCount('contribution', ['financial_type_id' => 'Member Dues', 'check_permissions' => 1], 0);
-    $this->markTestIncomplete('check_permissions = 0 should be respected but is not - I have added a todo at the right place but not changed it as yet');
     $this->callAPISuccessGetCount('contribution', ['financial_type_id' => 'Member Dues'], 1);
   }
 
index 30820f4862835813a0674b7a6ac864ba0878d7ce..5b00f456290c247a86ff2072bcc55a8d83fe7e89 100644 (file)
  * @group headless
  */
 class api_v3_GroupNestingTest extends CiviUnitTestCase {
-  protected $_apiversion;
 
   /**
    * Sets up the fixture, for example, opens a network connection.
+   *
    * This method is called before a test is executed.
    */
   protected function setUp() {
-    $this->_apiversion = 3;
     parent::setUp();
 
-    //  Insert a row in civicrm_group creating option group
-    //  from_email_address group
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/group_admins.xml'
-      )
-    );
-
-    //  Insert a row in civicrm_group creating option group
-    //  from_email_address group
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/group_subscribers.xml'
-      )
-    );
+    $this->ids['Group'] = [];
+    $this->ids['Group']['parent'] = $this->callAPISuccess('Group', 'create', [
+      'name' => 'Administrators',
+      'title' => 'Administrators',
+    ])['id'];
+    $this->ids['Group']['child'] = $this->callAPISuccess('Group', 'create', [
+      'name' => 'Newsletter Subscribers',
+      'title' => 'Newsletter Subscribers',
+      'parents' => $this->ids['Group']['parent'],
+    ])['id'];
+    $this->ids['Group']['child2'] = $this->callAPISuccess('Group', 'create', [
+      'name' => 'Another Newsletter Subscribers',
+      'title' => 'Another Newsletter Subscribers',
+      'parents' => $this->ids['Group']['parent'],
+    ])['id'];
+    $this->ids['Group']['child3'] = $this->callAPISuccess('Group', 'create', [
+      'name' => 'Super Special Newsletter Subscribers',
+      'title' => 'Super Special Newsletter Subscribers',
+      'parents' => [$this->ids['Group']['parent'], $this->ids['Group']['child']],
+    ])['id'];
 
-    //  Insert a row in civicrm_group creating option group
-    //  from_email_address group
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/group_nesting.xml'
-      )
-    );
   }
 
   /**
-   * Tears down the fixture, for example, closes a network connection.
+   * Tears down the fixture.
+   *
    * This method is called after a test is executed.
+   *
+   * @throws \Exception
    */
   protected function tearDown() {
-    //  Truncate the tables
     $this->quickCleanup(
-      array(
+      [
         'civicrm_group',
         'civicrm_group_nesting',
         'civicrm_contact',
         'civicrm_uf_group',
         'civicrm_uf_join',
         'civicrm_uf_match',
-      )
+      ]
     );
   }
 
-  ///////////////// civicrm_group_nesting_get methods
-
   /**
    * Test civicrm_group_nesting_get.
    */
   public function testGet() {
-    $params = array(
-      'parent_group_id' => 1,
-      'child_group_id' => 2,
-    );
+    $params = [
+      'parent_group_id' => $this->ids['Group']['parent'],
+      'child_group_id' => $this->ids['Group']['child'],
+    ];
 
     $result = $this->callAPIAndDocument('group_nesting', 'get', $params, __FUNCTION__, __FILE__);
-    // expected data loaded in setUp
-    $expected = array(
-      1 => array(
+    $expected = [
+      1 => [
         'id' => 1,
-        'child_group_id' => 2,
-        'parent_group_id' => 1,
-      ),
-    );
+        'child_group_id' => $this->ids['Group']['child'],
+        'parent_group_id' => $this->ids['Group']['parent'],
+      ],
+    ];
 
     $this->assertEquals($expected, $result['values']);
   }
 
   /**
-   * Test civicrm_group_nesting_get with just one
-   * param (child_group_id).
+   * Test civicrm_group_nesting_get with just one param (child_group_id).
    */
   public function testGetWithChildGroupId() {
-    $params = array(
-      'child_group_id' => 4,
-    );
+    $params = [
+      'child_group_id' => $this->ids['Group']['child3'],
+    ];
 
     $result = $this->callAPISuccess('group_nesting', 'get', $params);
 
     // expected data loaded in setUp
-    $expected = array(
-      3 => array(
+    $expected = [
+      3 => [
         'id' => 3,
-        'child_group_id' => 4,
-        'parent_group_id' => 1,
-      ),
-      4 => array(
+        'child_group_id' => $this->ids['Group']['child3'],
+        'parent_group_id' => $this->ids['Group']['parent'],
+      ],
+      4 => [
         'id' => 4,
-        'child_group_id' => 4,
-        'parent_group_id' => 2,
-      ),
-    );
+        'child_group_id' => $this->ids['Group']['child3'],
+        'parent_group_id' => $this->ids['Group']['child'],
+      ],
+    ];
 
     $this->assertEquals($expected, $result['values']);
   }
 
   /**
-   * Test civicrm_group_nesting_get with just one
-   * param (parent_group_id).
+   * Test civicrm_group_nesting_get with just one param (parent_group_id).
    */
   public function testGetWithParentGroupId() {
-    $params = array(
-      'parent_group_id' => 1,
-    );
+    $params = [
+      'parent_group_id' => $this->ids['Group']['parent'],
+    ];
 
     $result = $this->callAPISuccess('group_nesting', 'get', $params);
 
     // expected data loaded in setUp
-    $expected = array(
-      1 => array(
+    $expected = [
+      1 => [
         'id' => 1,
-        'child_group_id' => 2,
-        'parent_group_id' => 1,
-      ),
-      2 => array(
+        'child_group_id' => $this->ids['Group']['child'],
+        'parent_group_id' => $this->ids['Group']['parent'],
+      ],
+      2 => [
         'id' => 2,
-        'child_group_id' => 3,
-        'parent_group_id' => 1,
-      ),
-      3 => array(
+        'child_group_id' => $this->ids['Group']['child2'],
+        'parent_group_id' => $this->ids['Group']['parent'],
+      ],
+      3 => [
         'id' => 3,
-        'child_group_id' => 4,
-        'parent_group_id' => 1,
-      ),
-    );
+        'child_group_id' => $this->ids['Group']['child3'],
+        'parent_group_id' => $this->ids['Group']['parent'],
+      ],
+    ];
 
     $this->assertEquals($expected, $result['values']);
   }
 
   /**
    * Test civicrm_group_nesting_get for no records results.
+   *
    * Success expected. (these tests are of marginal value as are in syntax conformance,
    * don't copy & paste
    */
   public function testGetEmptyResults() {
-    $params = array(
-      'parent_group_id' => 1,
+    $params = [
+      'parent_group_id' => $this->ids['Group']['parent'],
       'child_group_id' => 700,
-    );
+    ];
     $this->callAPISuccess('group_nesting', 'get', $params);
   }
 
-  ///////////////// civicrm_group_nesting_create methods
-
   /**
    * Test civicrm_group_nesting_create.
+   *
+   * @throws \Exception
    */
   public function testCreate() {
-    // groups id=1 and id=2 loaded in setUp
-    $params = array(
-      'parent_group_id' => 1,
-      'child_group_id' => 3,
-    );
+    $params = [
+      'parent_group_id' => $this->ids['Group']['parent'],
+      'child_group_id' => $this->ids['Group']['child2'],
+    ];
 
     $this->callAPIAndDocument('group_nesting', 'create', $params, __FUNCTION__, __FILE__);
     $this->callAPISuccessGetCount('GroupNesting', $params, 1);
@@ -206,16 +197,15 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase {
    * Test civicrm_group_nesting_remove.
    */
   public function testDelete() {
-    // groups id=1 and id=2 loaded in setUp
-    $getparams = array(
-      'parent_group_id' => 1,
-      'child_group_id' => 2,
-    );
+    $params = [
+      'parent_group_id' => $this->ids['Group']['parent'],
+      'child_group_id' => $this->ids['Group']['child'],
+    ];
 
-    $result = $this->callAPISuccess('group_nesting', 'get', $getparams);
-    $params = array('id' => $result['id']);
+    $result = $this->callAPISuccess('group_nesting', 'get', $params);
+    $params = ['id' => $result['id']];
     $this->callAPIAndDocument('group_nesting', 'delete', $params, __FUNCTION__, __FILE__);
-    $this->assertEquals(0, $this->callAPISuccess('group_nesting', 'getcount', $getparams));
+    $this->assertEquals(0, $this->callAPISuccess('group_nesting', 'getcount', $params));
   }
 
   /**
@@ -224,7 +214,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase {
    * Error expected.
    */
   public function testDeleteWithEmptyParams() {
-    $this->callAPIFailure('group_nesting', 'delete', array());
+    $this->callAPIFailure('group_nesting', 'delete', []);
   }
 
 }
index a9308ef6395b655da5764dd0dcec0e1f0b882f85..8e3f32b5e9e8647b59d666cd1590e066e9beceff 100644 (file)
@@ -245,13 +245,19 @@ class api_v3_JobTest extends CiviUnitTestCase {
    * We create 3 contacts - 1 is in our group, 1 has our membership & the chosen one has both
    * & check that only the chosen one got the reminder
    */
-  public function testCallSendReminderLimitTo() {
+  public function testCallSendReminderLimitToSMS() {
     $membershipTypeID = $this->membershipTypeCreate();
     $this->membershipStatusCreate();
     $createTotal = 3;
     $groupID = $this->groupCreate(array('name' => 'Texan drawlers', 'title' => 'a...'));
     for ($i = 1; $i <= $createTotal; $i++) {
       $contactID = $this->individualCreate();
+      $this->callAPISuccess('Phone', 'create', [
+        'contact_id' => $contactID,
+        'phone' => '555 123 1234',
+        'phone_type_id' => 'Mobile',
+        'location_type_id' => 'Billing',
+      ]);
       if ($i == 2) {
         $theChosenOneID = $contactID;
       }
@@ -271,6 +277,19 @@ class api_v3_JobTest extends CiviUnitTestCase {
         ));
       }
     }
+    $this->setupForSmsTests();
+    $provider = civicrm_api3('SmsProvider', 'create', array(
+      'name' => "CiviTestSMSProvider",
+      'api_type' => "1",
+      "username" => "1",
+      "password" => "1",
+      "api_type" => "1",
+      "api_url" => "1",
+      "api_params" => "a=1",
+      "is_default" => "1",
+      "is_active" => "1",
+      "domain_id" => "1",
+    ));
     $this->callAPISuccess('action_schedule', 'create', array(
       'title' => " remind all Texans",
       'subject' => "drawling renewal",
@@ -282,12 +301,16 @@ class api_v3_JobTest extends CiviUnitTestCase {
       'start_action_unit' => 'day',
       'group_id' => $groupID,
       'limit_to' => TRUE,
+      'sms_provider_id' => $provider['id'],
+      'mode' => 'User_Preference',
     ));
     $this->callAPISuccess('job', 'send_reminder', array());
     $successfulCronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log");
     $this->assertEquals($successfulCronCount, 1);
     $sentToID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_action_log");
     $this->assertEquals($sentToID, $theChosenOneID);
+    $this->assertEquals(0, CRM_Core_DAO::singleValueQuery("SELECT is_error FROM civicrm_action_log"));
+    $this->setupForSmsTests(TRUE);
   }
 
   public function testCallDisableExpiredRelationships() {
@@ -314,6 +337,85 @@ class api_v3_JobTest extends CiviUnitTestCase {
     $this->contactDelete($orgID);
   }
 
+  /**
+   * Test scheduled reminders respect limit to (since above identified addition_to handling issue).
+   *
+   * We create 3 contacts - 1 is in our group, 1 has our membership & the chosen one has both
+   * & check that only the chosen one got the reminder
+   *
+   * Also check no hard fail on cron job with running a reminder that has a deleted SMS provider
+   */
+  public function testCallSendReminderLimitToSMSWithDeletedProviderr() {
+    $membershipTypeID = $this->membershipTypeCreate();
+    $this->membershipStatusCreate();
+    $createTotal = 3;
+    $groupID = $this->groupCreate(array('name' => 'Texan drawlers', 'title' => 'a...'));
+    for ($i = 1; $i <= $createTotal; $i++) {
+      $contactID = $this->individualCreate();
+      $this->callAPISuccess('Phone', 'create', [
+        'contact_id' => $contactID,
+        'phone' => '555 123 1234',
+        'phone_type_id' => 'Mobile',
+        'location_type_id' => 'Billing',
+      ]);
+      if ($i == 2) {
+        $theChosenOneID = $contactID;
+      }
+      if ($i < 3) {
+        $this->callAPISuccess('group_contact', 'create', array(
+          'contact_id' => $contactID,
+          'status' => 'Added',
+          'group_id' => $groupID,
+        ));
+      }
+      if ($i > 1) {
+        $this->callAPISuccess('membership', 'create', array(
+          'contact_id' => $contactID,
+          'membership_type_id' => $membershipTypeID,
+          'join_date' => 'now',
+          'start_date' => '+ 1 day',
+        ));
+      }
+    }
+    $this->setupForSmsTests();
+    $provider = civicrm_api3('SmsProvider', 'create', array(
+      'name' => "CiviTestSMSProvider",
+      'api_type' => "1",
+      "username" => "1",
+      "password" => "1",
+      "api_type" => "1",
+      "api_url" => "1",
+      "api_params" => "a=1",
+      "is_default" => "1",
+      "is_active" => "1",
+      "domain_id" => "1",
+    ));
+    $this->callAPISuccess('action_schedule', 'create', array(
+      'title' => " remind all Texans",
+      'subject' => "drawling renewal",
+      'entity_value' => $membershipTypeID,
+      'mapping_id' => 4,
+      'start_action_date' => 'membership_start_date',
+      'start_action_offset' => 1,
+      'start_action_condition' => 'before',
+      'start_action_unit' => 'day',
+      'group_id' => $groupID,
+      'limit_to' => TRUE,
+      'sms_provider_id' => $provider['id'],
+      'mode' => 'SMS',
+    ));
+    $this->callAPISuccess('SmsProvider', 'delete', ['id' => $provider['id']]);
+    $this->callAPISuccess('job', 'send_reminder', array());
+    $cronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log");
+    $this->assertEquals($cronCount, 1);
+    $sentToID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_action_log");
+    $this->assertEquals($sentToID, $theChosenOneID);
+    $cronlog = CRM_Core_DAO::executeQuery("SELECT * FROM civicrm_action_log")->fetchAll()[0];
+    $this->assertEquals(1, $cronlog['is_error']);
+    $this->assertEquals('SMS reminder cannot be sent because the SMS provider has been deleted.', $cronlog['message']);
+    $this->setupForSmsTests(TRUE);
+  }
+
   /**
    * Test the batch merge function.
    *
@@ -2010,4 +2112,40 @@ class api_v3_JobTest extends CiviUnitTestCase {
     $this->assertEquals(array_search('Expired', $memStatus), $membership['status_id']);
   }
 
+  /**
+   * Test procesing membership where is_override is set to 0 rather than NULL
+   */
+  public function testProcessMembershipIsOverrideNotNullNot1either() {
+    $membershipTypeId = $this->membershipTypeCreate();
+
+    // Create admin-only membership status and get all statuses.
+    $result = $this->callAPISuccess('membership_status', 'create', ['name' => 'Admin', 'is_admin' => 1, 'sequential' => 1]);
+    $membershipStatusIdAdmin = $result['values'][0]['id'];
+    $memStatus = CRM_Member_PseudoConstant::membershipStatus();
+
+    // Default params, which we'll expand on below.
+    $params = [
+      'membership_type_id' => $membershipTypeId,
+      // Don't calculate status.
+      'skipStatusCal' => 1,
+      'source' => 'Test',
+      'sequential' => 1,
+    ];
+
+    // Create membership with incorrect status but dates implying status Current.
+    $params['contact_id'] = $this->individualCreate();
+    $params['join_date'] = date('Y-m-d', strtotime('now - 6 month'));
+    $params['start_date'] = date('Y-m-d', strtotime('now - 6 month'));
+    $params['end_date'] = date('Y-m-d', strtotime('now + 6 month'));
+    // Intentionally incorrect status.
+    $params['status_id'] = 'New';
+    $resultCurrent = $this->callAPISuccess('Membership', 'create', $params);
+    // Ensure that is_override is set to 0 by doing through DB given API not seem to accept id
+    CRM_Core_DAO::executeQuery("Update civicrm_membership SET is_override = 0 WHERE id = %1", [1 => [$resultCurrent['id'], 'Positive']]);
+    $this->assertEquals(array_search('New', $memStatus), $resultCurrent['values'][0]['status_id']);
+    $jobResult = $this->callAPISuccess('Job', 'process_membership', []);
+    $this->assertEquals('Processed 1 membership records. Updated 1 records.', $jobResult['values']);
+    $this->assertEquals(array_search('Current', $memStatus), $this->callAPISuccess('Membership', 'get', ['id' => $resultCurrent['id']])['values'][$resultCurrent['id']]['status_id']);
+  }
+
 }
index 61f089c35002a8d189f78b79fa85930963d02be5..98e6952ee1a05bc960901426e44d8f5cb3e7837a 100644 (file)
@@ -42,9 +42,18 @@ class api_v3_MailingABTest extends CiviUnitTestCase {
     parent::setUp();
     $this->useTransaction(TRUE);
     $this->createLoggedInUser();
-    $this->_mailingID_A = $this->createMailing();
-    $this->_mailingID_B = $this->createMailing();
-    $this->_mailingID_C = $this->createMailing();
+    $this->_mailingID_A = $this->createMailing([
+      'subject' => 'subject a ' . time(),
+      'body_text' => 'body_text a ' . time(),
+    ]);
+    $this->_mailingID_B = $this->createMailing([
+      'subject' => 'subject b ' . time(),
+      'body_text' => 'body_text b ' . time(),
+    ]);
+    $this->_mailingID_C = $this->createMailing([
+      'subject' => 'not yet ' . time(),
+      'body_text' => 'not yet ' . time(),
+    ]);
     $this->_groupID = $this->groupCreate();
 
     $this->_params = array(
@@ -154,6 +163,65 @@ class api_v3_MailingABTest extends CiviUnitTestCase {
     $this->assertJobCounts(1, 1, 1);
   }
 
+  /**
+   * Create a test. Declare the second mailing a winner. Ensure that key
+   * fields propagate to the final mailing.
+   */
+  public function testSubmitWinnderId() {
+    $checkSyncFields = ['subject', 'body_text'];
+
+    $result = $this->groupContactCreate($this->_groupID, 20, TRUE);
+    $this->assertEquals(20, $result['added'], "in line " . __LINE__);
+
+    $params = $this->_params;
+    $params['group_percentage'] = 10;
+    $result = $this->callAPISuccess($this->_entity, 'create', $params);
+
+    $this->callAPISuccess('Mailing', 'create', [
+      'id' => $this->_mailingID_A,
+      'groups' => ['include' => [$this->_groupID]],
+    ]);
+    $this->assertJobCounts(0, 0, 0);
+
+    $this->callAPISuccess('MailingAB', 'submit', [
+      'id' => $result['id'],
+      'status' => 'Testing',
+      'scheduled_date' => 'now',
+      'approval_date' => 'now',
+    ]);
+    $this->assertJobCounts(1, 1, 0);
+
+    $b = $this->getApiValues('Mailing', ['id' => $this->_mailingID_B], $checkSyncFields);
+    $c = $this->getApiValues('Mailing', ['id' => $this->_mailingID_C], $checkSyncFields);
+    $this->assertNotEquals($b, $c);
+
+    $this->callAPISuccess('MailingAB', 'submit', [
+      'id' => $result['id'],
+      'status' => 'Final',
+      'winner_id' => $this->_mailingID_B,
+      'scheduled_date' => 'now',
+      'approval_date' => 'now',
+    ]);
+    $this->assertJobCounts(1, 1, 1);
+
+    $b = $this->getApiValues('Mailing', ['id' => $this->_mailingID_B], $checkSyncFields);
+    $c = $this->getApiValues('Mailing', ['id' => $this->_mailingID_C], $checkSyncFields);
+    $this->assertEquals($b, $c);
+  }
+
+  /**
+   * Lookup a record via API. Return *only* the expected values.
+   *
+   * @param $entity
+   * @param $filter
+   * @param $return
+   * @return array
+   */
+  protected function getApiValues($entity, $filter, $return) {
+    $rec = $this->callAPISuccess($entity, 'getsingle', $filter + ['return' => $return]);
+    return CRM_Utils_Array::subset($rec, $return);
+  }
+
   /**
    * @param $expectedCountA
    * @param $expectedCountB
index a9e00c9ea33f5230e66262ea2c3cff3cd07b6448..7ec969cac6be14da43e597fd3e7e75a07fae2d60 100644 (file)
  * @group headless
  */
 class api_v3_MailingContactTest extends CiviUnitTestCase {
-  protected $_apiversion = 3;
   protected $_entity = 'mailing';
 
   public function setUp() {
     parent::setUp();
-    $params = array(
+    $params = [
       'first_name' => 'abc1',
       'contact_type' => 'Individual',
       'last_name' => 'xyz1',
-    );
+    ];
     $this->_contact = $this->callAPISuccess("contact", "create", $params);
   }
 
   public function tearDown() {
-    $this->callAPISuccess("contact", "delete", array('id' => $this->_contact['id']));
+    $this->callAPISuccess("contact", "delete", ['id' => $this->_contact['id']]);
     parent::tearDown();
   }
 
@@ -88,10 +87,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase {
    * belongs in the SyntaxConformance class
    */
   public function testMailingNoContactID() {
-    $params = array(
-      'something' => 'This is not a real field',
-    );
-    $this->callAPIFailure('MailingContact', 'get', $params);
+    $this->callAPIFailure('MailingContact', 'get', ['something' => 'This is not a real field']);
   }
 
   /**
@@ -103,8 +99,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase {
    * belongs in the SyntaxConformance class
    */
   public function testMailingContactInvalidContactID() {
-    $params = array('contact_id' => 'This is not a number');
-    $this->callAPIFailure('MailingContact', 'get', $params);
+    $this->callAPIFailure('MailingContact', 'get', ['contact_id' => 'This is not a number']);
   }
 
   /**
@@ -134,24 +129,13 @@ class api_v3_MailingContactTest extends CiviUnitTestCase {
    * Test that the API returns a mailing properly when there is only one.
    */
   public function testMailingContactDelivered() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    //Create the User
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/mailing_contact.xml'
-      )
-    );
-    // Create the Mailing and connections to the user.
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/mailing_delivered.xml'
-      )
-    );
+    list($contactID, $mailingID, $eventQueueID) = $this->setupEventQueue();
+    CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_event_delivered (event_queue_id) VALUES(%1)", [1 => [$eventQueueID, 'Integer']]);
 
-    $params = array(
-      'contact_id' => 23,
+    $params = [
+      'contact_id' => $contactID,
       'type' => 'Delivered',
-    );
+    ];
 
     $result = $this->callAPISuccess('MailingContact', 'get', $params);
     $count = $this->callAPISuccess('MailingContact', 'getcount', $params);
@@ -160,40 +144,54 @@ class api_v3_MailingContactTest extends CiviUnitTestCase {
     $this->assertFalse(empty($result['values']));
     $this->assertEquals($result['values'][1]['mailing_id'], 1);
     $this->assertEquals($result['values'][1]['subject'], "Some Subject");
-    $this->assertEquals($result['values'][1]['creator_id'], 3);
-    $this->assertEquals($result['values'][1]['creator_name'], "xyz1, abc1");
+    $this->assertEquals(CRM_Core_Session::getLoggedInContactID(), $result['values'][1]['creator_id']);
   }
 
   /**
-   * Test that the API returns only the "Bounced" mailings when instructed to do so.
+   * Test that the API returns only the "Bounced" mailings when instructed to
+   * do so.
+   *
+   * @throws \Exception
    */
   public function testMailingContactBounced() {
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    // Create the User.
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/mailing_contact.xml'
-      )
-    );
-    // Create the Mailing and connections to the user.
-    $op->execute($this->_dbconn,
-      $this->createXMLDataSet(
-        dirname(__FILE__) . '/dataset/mailing_bounced.xml'
-      )
-    );
+    list($contactID, $mailingID, $eventQueueID) = $this->setupEventQueue();
+    CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_event_bounce (event_queue_id, bounce_type_id) VALUES(%1, 6)", [1 => [$eventQueueID, 'Integer']]);
 
-    $params = array(
-      'contact_id' => 23,
+    $params = [
+      'contact_id' => $contactID,
       'type' => 'Bounced',
-    );
+    ];
 
-    $result = $this->callAPISuccess('MailingContact', 'get', $params);
-    $this->assertEquals($result['count'], 1);
-    $this->assertFalse(empty($result['values']));
-    $this->assertEquals($result['values'][2]['mailing_id'], 2);
-    $this->assertEquals($result['values'][2]['subject'], "Some Subject");
-    $this->assertEquals($result['values'][2]['creator_id'], 3);
-    $this->assertEquals($result['values'][2]['creator_name'], "xyz1, abc1");
+    $result = $this->callAPISuccess('MailingContact', 'get', $params)['values'];
+    $this->assertEquals(1, count($result));
+    $this->assertEquals($mailingID, $result[$mailingID]['mailing_id']);
+    $this->assertEquals('Some Subject', $result[$mailingID]['subject']);
+    $this->assertEquals(CRM_Core_Session::getLoggedInContactID(), $result[$mailingID]['creator_id'], 3);
+  }
+
+  /**
+   * @return array
+   * @throws \Exception
+   */
+  public function setupEventQueue() {
+    $contactID = $this->individualCreate(['first_name' => 'Test']);
+    $emailID = $this->callAPISuccessGetValue('Email', [
+      'return' => 'id',
+      'contact_id' => $contactID,
+    ]);
+    $this->createLoggedInUser();
+    $mailingID = $this->callAPISuccess('Mailing', 'create', [
+      'name' => 'Test Mailing',
+      'subject' => 'Some Subject',
+    ])['id'];
+    $mailingJobID = $this->callAPISuccess('MailingJob', 'create', ['mailing_id' => $mailingID])['id'];
+    $eventQueueID = $this->callAPISuccess('MailingEventQueue', 'create', [
+      'contact_id' => $contactID,
+      'mailing_id' => $mailingID,
+      'email_id' => $emailID,
+      'job_id' => $mailingJobID,
+    ])['id'];
+    return [$contactID, $mailingID, $eventQueueID];
   }
 
 }
index d543a2919ca0d34adfead88c4734a280ccf09615..e72fc5097e39991fbb02f745b776bd875cf75ee3 100644 (file)
@@ -55,7 +55,7 @@ class api_v3_MailingTest extends CiviUnitTestCase {
     $this->_params = array(
       'subject' => 'Hello {contact.display_name}',
       'body_text' => "This is {contact.display_name}.\nhttps://civicrm.org\n{domain.address}{action.optOutUrl}",
-      'body_html' => "<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700' rel='stylesheet' type='text/css'><p>This is {contact.display_name}.</p><p><a href='https://civicrm.org/'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>",
+      'body_html' => "<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700' rel='stylesheet' type='text/css'><p><a href=\"http://{action.forward}\">Forward this email</a><a href=\"{action.forward}\">Forward this email with no protocol</a></p<p>This is {contact.display_name}.</p><p><a href='https://civicrm.org/'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>",
       'name' => 'mailing name',
       'created_id' => $this->_contactID,
       'header_id' => '',
@@ -269,11 +269,30 @@ class api_v3_MailingTest extends CiviUnitTestCase {
     $this->assertDBQuery($maxIDs['group'], 'SELECT MAX(id) FROM civicrm_mailing_group');
     // 'Preview should not create any mailing_recipient records'
     $this->assertDBQuery($maxIDs['recipient'], 'SELECT MAX(id) FROM civicrm_mailing_recipients');
-
+    $baseurl = CRM_Utils_System::baseCMSURL();
     $previewResult = $result['values'][$result['id']]['api.Mailing.preview'];
     $this->assertEquals("Hello $displayName", $previewResult['values']['subject']);
     $this->assertContains("This is $displayName", $previewResult['values']['body_text']);
     $this->assertContains("<p>This is $displayName.</p>", $previewResult['values']['body_html']);
+    $this->assertContains('<a href="' . $baseurl . 'index.php?q=civicrm/mailing/forward&amp;amp;reset=1&amp;jid=&amp;qid=&amp;h=">Forward this email with no protocol</a>', $previewResult['values']['body_html']);
+    $this->assertNotContains("http://http://", $previewResult['values']['body_html']);
+  }
+
+  public function testMailerPreviewUnknownContact() {
+    $params = $this->_params;
+    $params['api.Mailing.preview'] = array(
+      'id' => '$value.id',
+    );
+
+    $result = $this->callAPISuccess('mailing', 'create', $params);
+
+    // NOTE: It's highly debatable what's best to do with contact-tokens for an
+    // unknown-contact. However, changes should be purposeful, so we'll test
+    // for the current behavior (i.e. returning blanks).
+    $previewResult = $result['values'][$result['id']]['api.Mailing.preview'];
+    $this->assertEquals("Hello ", $previewResult['values']['subject']);
+    $this->assertContains("This is .", $previewResult['values']['body_text']);
+    $this->assertContains("<p>This is .</p>", $previewResult['values']['body_html']);
   }
 
   public function testMailerPreviewRecipients() {
index 129495aa785575400e9300278efd3174bb6947b5..932a9a8ad5e20639949c0edff06aa4783d54a1ff 100644 (file)
@@ -202,7 +202,7 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
       'from_financial_account_id' => 7,
       'to_financial_account_id' => 6,
       'total_amount' => -30,
-      'status_id' => 1,
+      'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_FinancialTrxn', 'status_id', 'Refunded'),
       'is_payment' => 1,
     ];
     foreach ($expected as $key => $value) {
@@ -315,7 +315,7 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
    */
   public function checkPaymentResult($payment, $expectedResult) {
     foreach ($expectedResult[$payment['id']] as $key => $value) {
-      $this->assertEquals($payment['values'][$payment['id']][$key], $value);
+      $this->assertEquals($payment['values'][$payment['id']][$key], $value, 'mismatch on ' . $key);
     }
   }
 
index 6e2e88f7820b0b57b0c283ec5c1b7785d487101f..31e8cbf89b8b7f74264e030919551ac04c3392cc 100644 (file)
  * @group headless
  */
 class api_v3_ProfileTest extends CiviUnitTestCase {
-  protected $_apiversion;
+
   protected $_profileID = 0;
+
   protected $_membershipTypeID;
+
   protected $_contactID;
 
+  /**
+   * Set up for test.
+   */
   public function setUp() {
-    $this->_apiversion = 3;
     parent::setUp();
     $config = CRM_Core_Config::singleton();
     $countryLimit = $config->countryLimit;
@@ -49,26 +53,31 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $this->_membershipTypeID = $this->membershipTypeCreate();
   }
 
+  /**
+   * Cleanup after test.
+   *
+   * @throws \Exception
+   */
   public function tearDown() {
 
-    $this->quickCleanup(array(
+    $this->quickCleanup([
       'civicrm_contact',
       'civicrm_phone',
       'civicrm_address',
       'civicrm_membership',
       'civicrm_contribution',
       'civicrm_uf_match',
-    ), TRUE);
-    $this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID));
-    // ok can't be bothered wring an api to do this & truncating is crazy
-    CRM_Core_DAO::executeQuery(" DELETE FROM civicrm_uf_group WHERE id IN ($this->_profileID, 26)");
+    ], TRUE);
+    $this->callAPISuccess('membership_type', 'delete', ['id' => $this->_membershipTypeID]);
+    CRM_Core_DAO::executeQuery(" DELETE FROM civicrm_uf_group WHERE id = $this->_profileID OR name = 'test_contact_activity_profile'");
+    parent::tearDown();
   }
 
   /**
    * Check Without ProfileId.
    */
   public function testProfileGetWithoutProfileId() {
-    $this->callAPIFailure('profile', 'get', array('contact_id' => 1),
+    $this->callAPIFailure('profile', 'get', ['contact_id' => 1],
       'Mandatory key(s) missing from params array: profile_id'
     );
   }
@@ -77,7 +86,10 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Check with no invalid profile Id.
    */
   public function testProfileGetInvalidProfileId() {
-    $this->callAPIFailure('profile', 'get', array('contact_id' => 1, 'profile_id' => 1000));
+    $this->callAPIFailure('profile', 'get', [
+      'contact_id' => 1,
+      'profile_id' => 1000,
+    ]);
   }
 
   /**
@@ -87,32 +99,35 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $profileFieldValues = $this->_createIndividualContact();
     $expected = reset($profileFieldValues);
     $contactId = key($profileFieldValues);
-    $params = array(
+    $params = [
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
-    );
-    $result = $this->callAPISuccess('profile', 'get', $params);
+    ];
+    $result = $this->callAPISuccess('profile', 'get', $params)['values'];
     foreach ($expected as $profileField => $value) {
-      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values']));
+      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result));
     }
   }
 
+  /**
+   * Test getting multiple profiles.
+   */
   public function testProfileGetMultiple() {
     $profileFieldValues = $this->_createIndividualContact();
     $expected = reset($profileFieldValues);
     $contactId = key($profileFieldValues);
-    $params = array(
-      'profile_id' => array($this->_profileID, 1, 'Billing'),
+    $params = [
+      'profile_id' => [$this->_profileID, 1, 'Billing'],
       'contact_id' => $contactId,
-    );
+    ];
 
-    $result = $this->callAPIAndDocument('profile', 'get', $params, __FUNCTION__, __FILE__);
+    $result = $this->callAPIAndDocument('profile', 'get', $params, __FUNCTION__, __FILE__)['values'];
     foreach ($expected as $profileField => $value) {
-      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values'][$this->_profileID]), " error message: " . "missing/mismatching value for {$profileField}");
+      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result[$this->_profileID]), " error message: " . "missing/mismatching value for {$profileField}");
     }
-    $this->assertEquals('abc1', $result['values'][1]['first_name'], " error message: " . "missing/mismatching value for {$profileField}");
-    $this->assertFalse(array_key_exists('email-Primary', $result['values'][1]), 'profile 1 doesn not include email');
-    $this->assertEquals($result['values']['Billing'], array(
+    $this->assertEquals('abc1', $result[1]['first_name'], " error message: " . "missing/mismatching value for first name");
+    $this->assertFalse(array_key_exists('email-Primary', $result[1]), 'profile 1 does not include email');
+    $this->assertEquals($result['Billing'], [
       'billing_first_name' => 'abc1',
       'billing_middle_name' => 'J.',
       'billing_last_name' => 'xyz1',
@@ -123,27 +138,30 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'billing_postal_code-5' => '90210',
       'billing-email-5' => 'abc1.xyz1@yahoo.com',
       'email-5' => 'abc1.xyz1@yahoo.com',
-    ));
+    ]);
   }
 
+  /**
+   * Test getting billing profile filled using is_billing.
+   */
   public function testProfileGetBillingUseIsBillingLocation() {
     $individual = $this->_createIndividualContact();
     $contactId = key($individual);
-    $this->callAPISuccess('address', 'create', array(
+    $this->callAPISuccess('address', 'create', [
       'is_billing' => 1,
       'street_address' => 'is billing st',
       'location_type_id' => 2,
       'contact_id' => $contactId,
-    ));
+    ]);
 
-    $params = array(
-      'profile_id' => array($this->_profileID, 1, 'Billing'),
+    $params = [
+      'profile_id' => [$this->_profileID, 1, 'Billing'],
       'contact_id' => $contactId,
-    );
+    ];
 
-    $result = $this->callAPISuccess('profile', 'get', $params);
-    $this->assertEquals('abc1', $result['values'][1]['first_name']);
-    $this->assertEquals(array(
+    $result = $this->callAPISuccess('profile', 'get', $params)['values'];
+    $this->assertEquals('abc1', $result[1]['first_name']);
+    $this->assertEquals([
       'billing_first_name' => 'abc1',
       'billing_middle_name' => 'J.',
       'billing_last_name' => 'xyz1',
@@ -154,33 +172,36 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'billing-email-5' => 'abc1.xyz1@yahoo.com',
       'email-5' => 'abc1.xyz1@yahoo.com',
       'billing_postal_code-5' => '',
-    ), $result['values']['Billing']);
+    ], $result['Billing']);
   }
 
+  /**
+   * Test getting multiple profiles, including billing.
+   */
   public function testProfileGetMultipleHasBillingLocation() {
     $individual = $this->_createIndividualContact();
     $contactId = key($individual);
-    $this->callAPISuccess('address', 'create', array(
+    $this->callAPISuccess('address', 'create', [
       'contact_id' => $contactId,
       'street_address' => '25 Big Street',
       'city' => 'big city',
       'location_type_id' => 5,
-    ));
-    $this->callAPISuccess('email', 'create', array(
+    ]);
+    $this->callAPISuccess('email', 'create', [
       'contact_id' => $contactId,
       'email' => 'big@once.com',
       'location_type_id' => 2,
       'is_billing' => 1,
-    ));
+    ]);
 
-    $params = array(
-      'profile_id' => array($this->_profileID, 1, 'Billing'),
+    $params = [
+      'profile_id' => [$this->_profileID, 1, 'Billing'],
       'contact_id' => $contactId,
-    );
+    ];
 
     $result = $this->callAPISuccess('profile', 'get', $params);
     $this->assertEquals('abc1', $result['values'][1]['first_name']);
-    $this->assertEquals($result['values']['Billing'], array(
+    $this->assertEquals($result['values']['Billing'], [
       'billing_first_name' => 'abc1',
       'billing_middle_name' => 'J.',
       'billing_last_name' => 'xyz1',
@@ -191,20 +212,20 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'billing-email-5' => 'big@once.com',
       'email-5' => 'big@once.com',
       'billing_postal_code-5' => '',
-    ));
+    ]);
   }
 
   /**
-   * Get Billing empty contact - this will return generic defaults
+   * Get Billing empty contact - this will return generic defaults.
    */
   public function testProfileGetBillingEmptyContact() {
     $this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => 1228]);
-    $params = array(
-      'profile_id' => array('Billing'),
-    );
+    $params = [
+      'profile_id' => ['Billing'],
+    ];
 
-    $result = $this->callAPISuccess('profile', 'get', $params);
-    $this->assertEquals(array(
+    $result = $this->callAPISuccess('profile', 'get', $params)['values'];
+    $this->assertEquals([
       'billing_first_name' => '',
       'billing_middle_name' => '',
       'billing_last_name' => '',
@@ -215,7 +236,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'billing_email-5' => '',
       'email-5' => '',
       'billing_postal_code-5' => '',
-    ), $result['values']['Billing']);
+    ], $result['Billing']);
   }
 
   /**
@@ -239,28 +260,23 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
   /**
    * Check contact activity profile with wrong activity type.
+   *
+   * @throws \Exception
    */
   public function testContactActivityGetWrongActivityType() {
-    //flush cache by calling with reset
-    $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
-
-    $sourceContactId = $this->householdCreate();
-
-    $activityparams = array(
-      'source_contact_id' => $sourceContactId,
+    $activity = $this->callAPISuccess('activity', 'create', [
+      'source_contact_id' => $this->householdCreate(),
       'activity_type_id' => '2',
       'subject' => 'Test activity',
       'activity_date_time' => '20110316',
       'duration' => '120',
-      'location' => 'Pensulvania',
+      'location' => 'Pennsylvania',
       'details' => 'a test activity',
       'status_id' => '1',
       'priority_id' => '1',
-    );
-
-    $activity = $this->callAPISuccess('activity', 'create', $activityparams);
+    ])['values'];
 
-    $activityValues = array_pop($activity['values']);
+    $activityValues = array_pop($activity);
 
     list($params) = $this->_createContactWithActivity();
 
@@ -288,10 +304,10 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   public function testGetFields() {
     $this->_createIndividualProfile();
     $this->_addCustomFieldToProfile($this->_profileID);
-    $result = $this->callAPIAndDocument('profile', 'getfields', array(
+    $result = $this->callAPIAndDocument('profile', 'getfields', [
       'action' => 'submit',
       'profile_id' => $this->_profileID,
-    ), __FUNCTION__, __FILE__,
+    ], __FUNCTION__, __FILE__,
       'demonstrates retrieving profile fields passing in an id');
     $this->assertArrayKeyExists('first_name', $result['values']);
     $this->assertEquals('2', $result['values']['first_name']['type']);
@@ -302,17 +318,17 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check getfields works & gives us our fields - partipant profile
+   * Check getfields works & gives us our fields - participant profile
    */
   public function testGetFieldsParticipantProfile() {
-    $result = $this->callAPISuccess('profile', 'getfields', array(
+    $result = $this->callAPISuccess('profile', 'getfields', [
       'action' => 'submit',
       'profile_id' => 'participant_status',
       'get_options' => 'all',
-    ));
+    ]);
     $this->assertTrue(array_key_exists('participant_status_id', $result['values']));
     $this->assertEquals('Attended', $result['values']['participant_status_id']['options'][2]);
-    $this->assertEquals(array('participant_status'), $result['values']['participant_status_id']['api.aliases']);
+    $this->assertEquals(['participant_status'], $result['values']['participant_status_id']['api.aliases']);
   }
 
   /**
@@ -320,18 +336,18 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * (getting to the end with no e-notices is pretty good evidence it's working)
    */
   public function testGetFieldsMembershipBatchProfile() {
-    $result = $this->callAPISuccess('profile', 'getfields', array(
+    $result = $this->callAPISuccess('profile', 'getfields', [
       'action' => 'submit',
       'profile_id' => 'membership_batch_entry',
       'get_options' => 'all',
-    ));
+    ]);
     $this->assertTrue(array_key_exists('total_amount', $result['values']));
     $this->assertTrue(array_key_exists('financial_type_id', $result['values']));
-    $this->assertEquals(array(
+    $this->assertEquals([
       'contribution_type_id',
       'contribution_type',
       'financial_type',
-    ), $result['values']['financial_type_id']['api.aliases']);
+    ], $result['values']['financial_type_id']['api.aliases']);
     $this->assertTrue(!array_key_exists('financial_type', $result['values']));
     $this->assertEquals(12, $result['values']['receive_date']['type']);
   }
@@ -341,14 +357,14 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * (getting to the end with no e-notices is pretty good evidence it's working)
    */
   public function testGetFieldsAllProfiles() {
-    $result = $this->callAPISuccess('uf_group', 'get', array('return' => 'id'));
-    $profileIDs = array_keys($result['values']);
+    $result = $this->callAPISuccess('uf_group', 'get', ['return' => 'id'])['values'];
+    $profileIDs = array_keys($result);
     foreach ($profileIDs as $profileID) {
-      $this->callAPISuccess('profile', 'getfields', array(
+      $this->callAPISuccess('profile', 'getfields', [
         'action' => 'submit',
         'profile_id' => $profileID,
         'get_options' => 'all',
-      ));
+      ]);
     }
   }
 
@@ -356,9 +372,9 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Check Without ProfileId.
    */
   public function testProfileSubmitWithoutProfileId() {
-    $params = array(
+    $params = [
       'contact_id' => 1,
-    );
+    ];
     $this->callAPIFailure('profile', 'submit', $params,
       'Mandatory key(s) missing from params array: profile_id'
     );
@@ -368,11 +384,11 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Check with no invalid profile Id.
    */
   public function testProfileSubmitInvalidProfileId() {
-    $params = array(
+    $params = [
       'contact_id' => 1,
       'profile_id' => 1000,
-    );
-    $result = $this->callAPIFailure('profile', 'submit', $params);
+    ];
+    $this->callAPIFailure('profile', 'submit', $params);
   }
 
   /**
@@ -381,15 +397,18 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   public function testProfileSubmitCheckProfileRequired() {
     $profileFieldValues = $this->_createIndividualContact();
     $contactId = key($profileFieldValues);
-    $updateParams = array(
+    $updateParams = [
       'first_name' => 'abc2',
       'last_name' => 'xyz2',
       'phone-1-1' => '022 321 826',
       'country-1' => '1013',
       'state_province-1' => '1000',
-    );
+    ];
 
-    $params = array_merge(array('profile_id' => $this->_profileID, 'contact_id' => $contactId),
+    $params = array_merge([
+      'profile_id' => $this->_profileID,
+      'contact_id' => $contactId,
+    ],
       $updateParams
     );
 
@@ -405,26 +424,26 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $profileFieldValues = $this->_createIndividualContact();
     $contactId = key($profileFieldValues);
 
-    $updateParams = array(
+    $updateParams = [
       'first_name' => 'abc2',
       'last_name' => 'xyz2',
       'email-primary' => 'abc2.xyz2@gmail.com',
       'phone-1-1' => '022 321 826',
       'country-1' => '1013',
       'state_province-1' => '1000',
-    );
+    ];
 
-    $params = array_merge(array(
+    $params = array_merge([
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
-    ), $updateParams);
+    ], $updateParams);
 
     $this->callAPIAndDocument('profile', 'submit', $params, __FUNCTION__, __FILE__);
 
-    $getParams = array(
+    $getParams = [
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
-    );
+    ];
     $profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
 
     foreach ($updateParams as $profileField => $value) {
@@ -440,22 +459,22 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
   /**
    * Ensure caches are being cleared so we don't get into a debugging trap because of cached metadata
-   * First we delete & create to increment the version & then check for caching probs
+   * First we delete & create to increment the version & then check for caching problems.
    */
   public function testProfileSubmitCheckCaching() {
-    $this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID));
+    $this->callAPISuccess('membership_type', 'delete', ['id' => $this->_membershipTypeID]);
     $this->_membershipTypeID = $this->membershipTypeCreate();
 
-    $membershipTypes = $this->callAPISuccess('membership_type', 'get', array());
-    $profileFields = $this->callAPISuccess('profile', 'getfields', array(
+    $membershipTypes = $this->callAPISuccess('membership_type', 'get', []);
+    $profileFields = $this->callAPISuccess('profile', 'getfields', [
       'get_options' => 'all',
       'action' => 'submit',
       'profile_id' => 'membership_batch_entry',
-    ));
-    $getoptions = $this->callAPISuccess('membership', 'getoptions', array(
+    ]);
+    $getoptions = $this->callAPISuccess('membership', 'getoptions', [
       'field' => 'membership_type',
       'context' => 'validate',
-    ));
+    ]);
     $this->assertEquals(array_keys($membershipTypes['values']), array_keys($getoptions['values']));
     $this->assertEquals(array_keys($membershipTypes['values']), array_keys($profileFields['values']['membership_type_id']['options']));
 
@@ -465,12 +484,12 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Test that the fields are returned in the right order despite the faffing around that goes on.
    */
   public function testMembershipGetFieldsOrder() {
-    $result = $this->callAPISuccess('profile', 'getfields', array(
+    $result = $this->callAPISuccess('profile', 'getfields', [
       'action' => 'submit',
       'profile_id' => 'membership_batch_entry',
-    ));
+    ])['values'];
     $weight = 1;
-    foreach ($result['values'] as $fieldName => $field) {
+    foreach ($result as $fieldName => $field) {
       if ($fieldName == 'profile_id') {
         continue;
       }
@@ -484,7 +503,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    */
   public function testProfileSubmitMembershipBatch() {
     $this->_contactID = $this->individualCreate();
-    $this->callAPISuccess('profile', 'submit', array(
+    $this->callAPISuccess('profile', 'submit', [
       'profile_id' => 'membership_batch_entry',
       'financial_type_id' => 1,
       'membership_type' => $this->_membershipTypeID,
@@ -493,7 +512,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'contribution_status_id' => 1,
       'receive_date' => 'now',
       'contact_id' => $this->_contactID,
-    ));
+    ]);
   }
 
   /**
@@ -503,26 +522,26 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $profileFieldValues = $this->_createIndividualContact();
     $contactId = key($profileFieldValues);
 
-    $updateParams = array(
+    $updateParams = [
       'first_name' => 'abc2',
       'last_name' => 'xyz2',
       'email-Primary' => 'abc2.xyz2@gmail.com',
       'phone-1-1' => '022 321 826',
       'country-1' => '1013',
       'state_province-1' => '1000',
-    );
+    ];
 
-    $params = array_merge(array(
+    $params = array_merge([
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
-    ), $updateParams);
+    ], $updateParams);
 
     $result = $this->callAPISuccess('profile', 'set', $params);
     $this->assertArrayKeyExists('values', $result);
-    $getParams = array(
+    $getParams = [
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
-    );
+    ];
     $profileDetails = $this->callAPISuccess('profile', 'get', $getParams);
 
     foreach ($updateParams as $profileField => $value) {
@@ -539,8 +558,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
     $params = array_merge($params, $expected);
     unset($params['activity_id']);
-    $result = $this->callAPIFailure('profile', 'submit', $params);
-    $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: activity_id');
+    $this->callAPIFailure('profile', 'submit', $params, 'Mandatory key(s) missing from params array: activity_id');
   }
 
   /**
@@ -550,32 +568,31 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     list($params, $expected) = $this->_createContactWithActivity();
     $params = array_merge($params, $expected);
     $params['activity_id'] = 100001;
-    $result = $this->callAPIFailure('profile', 'submit', $params);
-    $this->assertEquals($result['error_message'], 'Invalid Activity Id (aid).');
+    $this->callAPIFailure('profile', 'submit', $params, 'Invalid Activity Id (aid).');
   }
 
   /**
    * Check contact activity profile with wrong activity type.
+   *
+   * @throws \Exception
    */
   public function testContactActivitySubmitWrongActivityType() {
-    //flush cache by calling with reset
-    CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
 
     $sourceContactId = $this->householdCreate();
 
-    $activityparams = array(
+    $activityParams = [
       'source_contact_id' => $sourceContactId,
       'activity_type_id' => '2',
       'subject' => 'Test activity',
       'activity_date_time' => '20110316',
       'duration' => '120',
-      'location' => 'Pensulvania',
+      'location' => 'Pennsylvania',
       'details' => 'a test activity',
       'status_id' => '1',
       'priority_id' => '1',
-    );
+    ];
 
-    $activity = $this->callAPISuccess('activity', 'create', $activityparams);
+    $activity = $this->callAPISuccess('activity', 'create', $activityParams);
 
     $activityValues = array_pop($activity['values']);
 
@@ -593,7 +610,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
   public function testContactActivitySubmitSuccess() {
     list($params) = $this->_createContactWithActivity();
 
-    $updateParams = array(
+    $updateParams = [
       'first_name' => 'abc2',
       'last_name' => 'xyz2',
       'email-Primary' => 'abc2.xyz2@yahoo.com',
@@ -602,13 +619,13 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'activity_duration' => '100',
       'activity_date_time' => '2010-03-08 00:00:00',
       'activity_status_id' => '2',
-    );
+    ];
     $profileParams = array_merge($params, $updateParams);
     $this->callAPISuccess('profile', 'submit', $profileParams);
-    $result = $this->callAPISuccess('profile', 'get', $params);
+    $result = $this->callAPISuccess('profile', 'get', $params)['values'];
 
     foreach ($updateParams as $profileField => $value) {
-      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values']), " error message: " . "missing/mismatching value for {$profileField}"
+      $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result), " error message: " . "missing/mismatching value for {$profileField}"
       );
     }
   }
@@ -617,9 +634,9 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Check profile apply Without ProfileId.
    */
   public function testProfileApplyWithoutProfileId() {
-    $params = array(
+    $params = [
       'contact_id' => 1,
-    );
+    ];
     $this->callAPIFailure('profile', 'apply', $params,
       'Mandatory key(s) missing from params array: profile_id');
   }
@@ -628,10 +645,10 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * Check profile apply with no invalid profile Id.
    */
   public function testProfileApplyInvalidProfileId() {
-    $params = array(
+    $params = [
       'contact_id' => 1,
       'profile_id' => 1000,
-    );
+    ];
     $this->callAPIFailure('profile', 'apply', $params);
   }
 
@@ -643,7 +660,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     current($profileFieldValues);
     $contactId = key($profileFieldValues);
 
-    $params = array(
+    $params = [
       'profile_id' => $this->_profileID,
       'contact_id' => $contactId,
       'first_name' => 'abc2',
@@ -652,49 +669,45 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'phone-1-1' => '022 321 826',
       'country-1' => '1013',
       'state_province-1' => '1000',
-    );
+    ];
 
     $result = $this->callAPIAndDocument('profile', 'apply', $params, __FUNCTION__, __FILE__);
 
     // Expected field values
-    $expected['contact'] = array(
+    $expected['contact'] = [
       'contact_id' => $contactId,
       'contact_type' => 'Individual',
       'first_name' => 'abc2',
       'last_name' => 'xyz2',
-    );
-    $expected['email'] = array(
+    ];
+    $expected['email'] = [
       'location_type_id' => 1,
       'is_primary' => 1,
       'email' => 'abc2.xyz2@gmail.com',
-    );
+    ];
 
-    $expected['phone'] = array(
+    $expected['phone'] = [
       'location_type_id' => 1,
       'is_primary' => 1,
       'phone_type_id' => 1,
       'phone' => '022 321 826',
-    );
-    $expected['address'] = array(
+    ];
+    $expected['address'] = [
       'location_type_id' => 1,
       'is_primary' => 1,
       'country_id' => 1013,
       'state_province_id' => 1000,
-    );
+    ];
 
     foreach ($expected['contact'] as $field => $value) {
-      $this->assertEquals($value, CRM_Utils_Array::value($field, $result['values']), "In line " . __LINE__ . " error message: " . "missing/mismatching value for {$field}"
+      $this->assertEquals($value, CRM_Utils_Array::value($field, $result['values']), "missing/mismatching value for {$field}"
       );
     }
 
-    foreach (array(
-      'email',
-      'phone',
-      'address',
-    ) as $fieldType) {
+    foreach (['email', 'phone', 'address'] as $fieldType) {
       $typeValues = array_pop($result['values'][$fieldType]);
       foreach ($expected[$fieldType] as $field => $value) {
-        $this->assertEquals($value, CRM_Utils_Array::value($field, $typeValues), "In line " . __LINE__ . " error message: " . "missing/mismatching value for {$field} ({$fieldType})"
+        $this->assertEquals($value, CRM_Utils_Array::value($field, $typeValues), "missing/mismatching value for {$field} ({$fieldType})"
         );
       }
     }
@@ -710,31 +723,31 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $params['profile_id'] = $this->_profileID;
     $params['contact_id'] = $contactId;
 
-    $this->callAPISuccess('ufField', 'create', array(
+    $this->callAPISuccess('ufField', 'create', [
       'uf_group_id' => $this->_profileID,
       'field_name' => 'tag',
       'visibility' => 'Public Pages and Listings',
       'field_type' => 'Contact',
       'label' => 'Tags',
-    ));
+    ]);
 
     $tag_1 = $this->callAPISuccess('tag', 'create', ['name' => 'abc'])['id'];
     $tag_2 = $this->callAPISuccess('tag', 'create', ['name' => 'def'])['id'];
 
     $params['tag'] = "$tag_1,$tag_2";
-    $result = $this->callAPISuccess('profile', 'submit', $params);
+    $this->callAPISuccess('profile', 'submit', $params);
 
     $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]);
     $this->assertEquals(2, $tags['count']);
 
     $params['tag'] = [$tag_1];
-    $result = $this->callAPISuccess('profile', 'submit', $params);
+    $this->callAPISuccess('profile', 'submit', $params);
 
     $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]);
     $this->assertEquals(1, $tags['count']);
 
     $params['tag'] = '';
-    $result = $this->callAPISuccess('profile', 'submit', $params);
+    $this->callAPISuccess('profile', 'submit', $params);
 
     $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]);
     $this->assertEquals(0, $tags['count']);
@@ -743,6 +756,8 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
   /**
    * Check success with a note.
+   *
+   * @throws \Exception
    */
   public function testSubmitWithNote() {
     $profileFieldValues = $this->_createIndividualContact();
@@ -751,13 +766,13 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $params['profile_id'] = $this->_profileID;
     $params['contact_id'] = $contactId;
 
-    $this->callAPISuccess('ufField', 'create', array(
+    $this->callAPISuccess('ufField', 'create', [
       'uf_group_id' => $this->_profileID,
       'field_name' => 'note',
       'visibility' => 'Public Pages and Listings',
       'field_type' => 'Contact',
       'label' => 'Note',
-    ));
+    ]);
 
     $params['note'] = "Hello 123";
     $this->callAPISuccess('profile', 'submit', $params);
@@ -768,6 +783,8 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
   /**
    * Check handling a custom greeting.
+   *
+   * @throws \CiviCRM_API3_Exception
    */
   public function testSubmitGreetingFields() {
     $profileFieldValues = $this->_createIndividualContact();
@@ -776,13 +793,13 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $params['profile_id'] = $this->_profileID;
     $params['contact_id'] = $contactId;
 
-    $this->callAPISuccess('ufField', 'create', array(
+    $this->callAPISuccess('ufField', 'create', [
       'uf_group_id' => $this->_profileID,
       'field_name' => 'email_greeting',
       'visibility' => 'Public Pages and Listings',
       'field_type' => 'Contact',
       'label' => 'Email Greeting',
-    ));
+    ]);
 
     $emailGreetings = array_column(civicrm_api3('OptionValue', 'get', ['option_group_id' => "email_greeting"])['values'], NULL, 'name');
 
@@ -801,16 +818,17 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
 
   /**
    * Helper function to create an Individual with address/email/phone info. Import UF Group and UF Fields
+   *
    * @param array $params
    *
    * @return mixed
    */
-  public function _createIndividualContact($params = array()) {
-    $contactParams = array_merge(array(
+  public function _createIndividualContact($params = []) {
+    $contactParams = array_merge([
       'first_name' => 'abc1',
       'last_name' => 'xyz1',
       'email' => 'abc1.xyz1@yahoo.com',
-      'api.address.create' => array(
+      'api.address.create' => [
         'location_type_id' => 1,
         'is_primary' => 1,
         'street_address' => '5 Saint Helier St',
@@ -823,26 +841,26 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
         'postal_code' => '90210',
         'city' => 'Gotham City',
         'is_billing' => 0,
-      ),
-      'api.phone.create' => array(
+      ],
+      'api.phone.create' => [
         'location_type_id' => '1',
         'phone' => '021 512 755',
         'phone_type_id' => '1',
         'is_primary' => '1',
-      ),
-    ), $params);
+      ],
+    ], $params);
 
     $this->_contactID = $this->individualCreate($contactParams);
     $this->_createIndividualProfile();
     // expected result of above created profile with contact Id $contactId
-    $profileData[$this->_contactID] = array(
+    $profileData[$this->_contactID] = [
       'first_name' => 'abc1',
       'last_name' => 'xyz1',
       'email-primary' => 'abc1.xyz1@yahoo.com',
       'phone-1-1' => '021 512 755',
       'country-1' => '1228',
       'state_province-1' => '1021',
-    );
+    ];
 
     return $profileData;
   }
@@ -851,23 +869,92 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    * @return array
    */
   public function _createContactWithActivity() {
-    // @TODO: Create profile with custom fields
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/dataset/uf_group_contact_activity_26.xml'
-      )
-    );
-    // hack: xml data set do not accept \ 1 (CRM_Core_DAO::VALUE_SEPARATOR)
-    CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', '26', 'group_type', 'Individual,Contact,Activity' . CRM_Core_DAO::VALUE_SEPARATOR . 'ActivityType:1');
+    $ufGroupID = $this->callAPISuccess('UFGroup', 'create', [
+      'group_type' => 'Individual,Contact,Activity',
+      'title' => 'Test Contact-Activity Profile',
+      'name' => 'test_contact_activity_profile',
+    ])['id'];
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'first_name',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'First Name',
+      'field_type' => 'Individual',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'last_name',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Last Name',
+      'field_type' => 'Individual',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'email',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Email',
+      'field_type' => 'Contact',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'activity_subject',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Activity Subject',
+      'is_searchable' => TRUE,
+      'field_type' => 'Activity',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'activity_details',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Activity Details',
+      'is_searchable' => TRUE,
+      'field_type' => 'Activity',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'activity_duration',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Activity Duration',
+      'is_searchable' => TRUE,
+      'field_type' => 'Activity',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'activity_date_time',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Activity Date',
+      'is_searchable' => TRUE,
+      'field_type' => 'Activity',
+    ]);
+    $this->callAPISuccess('UFField', 'create', [
+      'uf_group_id' => $ufGroupID,
+      'field_name' => 'activity_status_id',
+      'is_required' => TRUE,
+      'visibility' => 'Public Pages and Listings',
+      'label' => 'Activity Status',
+      'is_searchable' => TRUE,
+      'field_type' => 'Activity',
+    ]);
+
+    // hack: xml data set did not accept \ 1 (CRM_Core_DAO::VALUE_SEPARATOR) - should be possible
+    // to unhack now we use the api.
+    CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $ufGroupID, 'group_type', 'Individual,Contact,Activity' . CRM_Core_DAO::VALUE_SEPARATOR . 'ActivityType:1');
 
     $sourceContactId = $this->individualCreate();
-    $contactParams = array(
+    $contactParams = [
       'first_name' => 'abc1',
       'last_name' => 'xyz1',
       'contact_type' => 'Individual',
       'email' => 'abc1.xyz1@yahoo.com',
-      'api.address.create' => array(
+      'api.address.create' => [
         'location_type_id' => 1,
         'is_primary' => 1,
         'name' => 'Saint Helier St',
@@ -877,8 +964,8 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
         'supplemental_address_1' => 'Hallmark Ct',
         'supplemental_address_2' => 'Jersey Village',
         'supplemental_address_3' => 'My Town',
-      ),
-    );
+      ],
+    ];
 
     $contact = $this->callAPISuccess('contact', 'create', $contactParams);
 
@@ -888,31 +975,31 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
     $this->assertEquals(0, $contact['values'][$contactId]['api.address.create']['is_error'], " error message: " . CRM_Utils_Array::value('error_message', $contact['values'][$contactId]['api.address.create'])
     );
 
-    $activityParams = array(
+    $activityParams = [
       'source_contact_id' => $sourceContactId,
       'assignee_contact_id' => $contactId,
       'activity_type_id' => '1',
       'subject' => 'Make-it-Happen Meeting',
       'activity_date_time' => '2011-03-16 00:00:00',
       'duration' => '120',
-      'location' => 'Pensulvania',
+      'location' => 'Pennsylvania',
       'details' => 'a test activity',
       'status_id' => '1',
       'priority_id' => '1',
-    );
+    ];
     $activity = $this->callAPISuccess('activity', 'create', $activityParams);
 
     $activityValues = array_pop($activity['values']);
 
     // valid parameters for above profile
-    $profileParams = array(
-      'profile_id' => 26,
+    $profileParams = [
+      'profile_id' => $ufGroupID,
       'contact_id' => $contactId,
       'activity_id' => $activityValues['id'],
-    );
+    ];
 
     // expected result of above created profile
-    $expected = array(
+    $expected = [
       'first_name' => 'abc1',
       'last_name' => 'xyz1',
       'email-Primary' => 'abc1.xyz1@yahoo.com',
@@ -921,43 +1008,43 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
       'activity_duration' => '120',
       'activity_date_time' => '2011-03-16 00:00:00',
       'activity_status_id' => '1',
-    );
+    ];
 
-    return array($profileParams, $expected);
+    return [$profileParams, $expected];
   }
 
   /**
    * Create a profile.
    */
   public function _createIndividualProfile() {
-    $ufGroupParams = array(
+    $ufGroupParams = [
       'group_type' => 'Individual,Contact',
       // really we should remove this & test the ufField create sets it
       'name' => 'test_individual_contact_profile',
       'title' => 'Flat Coffee',
-      'api.uf_field.create' => array(
-        array(
+      'api.uf_field.create' => [
+        [
           'field_name' => 'first_name',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
           'field_type' => 'Individual',
           'label' => 'First Name',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'last_name',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
           'field_type' => 'Individual',
           'label' => 'Last Name',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'email',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
           'field_type' => 'Contact',
           'label' => 'Email',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'phone',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
@@ -965,32 +1052,32 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
           'location_type_id' => 1,
           'phone_type_id' => 1,
           'label' => 'Phone',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'country',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
           'field_type' => 'Contact',
           'location_type_id' => 1,
           'label' => 'Country',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'state_province',
           'is_required' => 1,
           'visibility' => 'Public Pages and Listings',
           'field_type' => 'Contact',
           'location_type_id' => 1,
           'label' => 'State Province',
-        ),
-        array(
+        ],
+        [
           'field_name' => 'postal_code',
           'is_required' => 0,
           'field_type' => 'Contact',
           'location_type_id' => 1,
           'label' => 'State Province',
-        ),
-      ),
-    );
+        ],
+      ],
+    ];
     $profile = $this->callAPISuccess('uf_group', 'create', $ufGroupParams);
     $this->_profileID = $profile['id'];
   }
@@ -1000,11 +1087,11 @@ class api_v3_ProfileTest extends CiviUnitTestCase {
    */
   public function _addCustomFieldToProfile($profileID) {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, '');
-    $this->uFFieldCreate(array(
+    $this->uFFieldCreate([
       'uf_group_id' => $profileID,
       'field_name' => 'custom_' . $ids['custom_field_id'],
       'contact_type' => 'Contact',
-    ));
+    ]);
   }
 
 }
index 469624da2724759fe839ae45ce55867613b2b382..365b827f80a45580bceb7664d8379524b601bacc 100644 (file)
  * @group headless
  */
 class api_v3_RelationshipTest extends CiviUnitTestCase {
+
+  use CRMTraits_Custom_CustomDataTrait;
+
   protected $_apiversion = 3;
   protected $_cId_a;
   /**
    * Second individual.
-   * @var integer
+   *
+   * @var int
    */
   protected $_cId_a_2;
   protected $_cId_b;
@@ -45,12 +49,11 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    */
   protected $_cId_b2;
   protected $_relTypeID;
-  protected $_ids = array();
-  protected $_customGroupId = NULL;
+  protected $_ids = [];
   protected $_customFieldId = NULL;
   protected $_params;
 
-  protected $_entity;
+  protected $entity;
 
   /**
    * Set up function.
@@ -65,7 +68,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     ));
     $this->_cId_b = $this->organizationCreate();
     $this->_cId_b2 = $this->organizationCreate(array('organization_name' => ' Org 2'));
-    $this->_entity = 'relationship';
+    $this->entity = 'Relationship';
     //Create a relationship type.
     $relTypeParams = array(
       'name_a_b' => 'Relation 1 for delete',
@@ -396,35 +399,32 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * Check relationship creation with custom data.
    */
   public function testRelationshipCreateEditWithCustomData() {
-    $this->createCustomGroup();
-    $this->_ids = $this->createCustomField();
+    $this->createCustomGroupWithFieldsOfAllTypes();
     //few custom Values for comparing
-    $custom_params = array(
-      "custom_{$this->_ids[0]}" => 'Hello! this is custom data for relationship',
-      "custom_{$this->_ids[1]}" => 'Y',
-      "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
-      "custom_{$this->_ids[3]}" => 'http://example.com',
-    );
-
-    $params = array(
+    $custom_params = [
+      $this->getCustomFieldName('text') => 'Hello! this is custom data for relationship',
+      $this->getCustomFieldName('select_string') => 'Y',
+      $this->getCustomFieldName('select_date') => '2009-07-11 00:00:00',
+      $this->getCustomFieldName('link') => 'http://example.com',
+    ];
+
+    $params = [
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
       'relationship_type_id' => $this->_relTypeID,
       'start_date' => '2008-12-20',
       'is_active' => 1,
-    );
+    ];
     $params = array_merge($params, $custom_params);
     $result = $this->callAPISuccess('relationship', 'create', $params);
 
-    $relationParams = array(
-      'id' => $result['id'],
-    );
+    $relationParams = ['id' => $result['id']];
     $this->assertDBState('CRM_Contact_DAO_Relationship', $result['id'], $relationParams);
 
     //Test Edit of custom field from the form.
     $getParams = array('id' => $result['id']);
     $updateParams = array_merge($getParams, array(
-      "custom_{$this->_ids[0]}" => 'Edited Text Value',
+      $this->getCustomFieldName('text') => 'Edited Text Value',
       'relationship_type_id' => $this->_relTypeID . '_b_a',
       'related_contact_id' => $this->_cId_a,
     ));
@@ -434,7 +434,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $reln->submit($updateParams);
 
     $check = $this->callAPISuccess('relationship', 'get', $getParams);
-    $this->assertEquals("Edited Text Value", $check['values'][$check['id']]["custom_{$this->_ids[0]}"]);
+    $this->assertEquals("Edited Text Value", $check['values'][$check['id']][$this->getCustomFieldName('text')]);
 
     $params['id'] = $result['id'];
     $this->callAPISuccess('relationship', 'delete', $params);
@@ -453,122 +453,17 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $params = $this->_params;
     $params['custom_' . $ids['custom_field_id']] = "custom string";
 
-    $result = $this->callAPISuccess($this->_entity, 'create', $params);
+    $result = $this->callAPISuccess($this->entity, 'create', $params);
     $this->assertEquals($result['id'], $result['values'][$result['id']]['id']);
 
     $getParams = array('id' => $result['id']);
-    $check = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__);
+    $check = $this->callAPIAndDocument($this->entity, 'get', $getParams, __FUNCTION__, __FILE__);
     $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
 
     $this->customFieldDelete($ids['custom_field_id']);
     $this->customGroupDelete($ids['custom_group_id']);
   }
 
-  /**
-   * @return mixed
-   */
-  public function createCustomGroup() {
-    $params = array(
-      'title' => 'Custom Group',
-      'extends' => array('Relationship'),
-      'weight' => 5,
-      'style' => 'Inline',
-      'is_active' => 1,
-      'max_multiple' => 0,
-    );
-    $customGroup = $this->callAPISuccess('custom_group', 'create', $params);
-    $this->_customGroupId = $customGroup['id'];
-    return $customGroup['id'];
-  }
-
-  /**
-   * @return array
-   */
-  public function createCustomField() {
-    $ids = array();
-    $params = array(
-      'custom_group_id' => $this->_customGroupId,
-      'label' => 'Enter text about relationship',
-      'html_type' => 'Text',
-      'data_type' => 'String',
-      'default_value' => 'xyz',
-      'weight' => 1,
-      'is_required' => 1,
-      'is_searchable' => 0,
-      'is_active' => 1,
-    );
-
-    $customField = $this->callAPISuccess('CustomField', 'create', $params);
-    $ids[] = $customField['id'];
-
-    $optionValue[] = array(
-      'label' => 'Red',
-      'value' => 'R',
-      'weight' => 1,
-      'is_active' => 1,
-    );
-    $optionValue[] = array(
-      'label' => 'Yellow',
-      'value' => 'Y',
-      'weight' => 2,
-      'is_active' => 1,
-    );
-    $optionValue[] = array(
-      'label' => 'Green',
-      'value' => 'G',
-      'weight' => 3,
-      'is_active' => 1,
-    );
-
-    $params = array(
-      'label' => 'Pick Color',
-      'html_type' => 'Select',
-      'data_type' => 'String',
-      'weight' => 2,
-      'is_required' => 1,
-      'is_searchable' => 0,
-      'is_active' => 1,
-      'option_values' => $optionValue,
-      'custom_group_id' => $this->_customGroupId,
-    );
-
-    $customField = $this->callAPISuccess('custom_field', 'create', $params);
-    $ids[] = $customField['id'];
-
-    $params = array(
-      'custom_group_id' => $this->_customGroupId,
-      'name' => 'test_date',
-      'label' => 'test_date',
-      'html_type' => 'Select Date',
-      'data_type' => 'Date',
-      'default_value' => '20090711',
-      'weight' => 3,
-      'is_required' => 1,
-      'is_searchable' => 0,
-      'is_active' => 1,
-    );
-
-    $customField = $this->callAPISuccess('custom_field', 'create', $params);
-
-    $ids[] = $customField['id'];
-    $params = array(
-      'custom_group_id' => $this->_customGroupId,
-      'name' => 'test_link',
-      'label' => 'test_link',
-      'html_type' => 'Link',
-      'data_type' => 'Link',
-      'default_value' => 'http://civicrm.org',
-      'weight' => 4,
-      'is_required' => 1,
-      'is_searchable' => 0,
-      'is_active' => 1,
-    );
-
-    $customField = $this->callAPISuccess('custom_field', 'create', $params);
-    $ids[] = $customField['id'];
-    return $ids;
-  }
-
   /**
    * Check with empty array.
    */
@@ -674,21 +569,20 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * should be OK if the custom field values differ.
    */
   public function testRelationshipCreateDuplicateWithCustomFields() {
-    $this->createCustomGroup();
-    $this->_ids = $this->createCustomField();
+    $this->createCustomGroupWithFieldsOfAllTypes();
 
     $custom_params_1 = array(
-      "custom_{$this->_ids[0]}" => 'Hello! this is custom data for relationship',
-      "custom_{$this->_ids[1]}" => 'Y',
-      "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
-      "custom_{$this->_ids[3]}" => 'http://example.com',
+      $this->getCustomFieldName('text') => 'Hello! this is custom data for relationship',
+      $this->getCustomFieldName('select_string') => 'Y',
+      $this->getCustomFieldName('select_date') => '2009-07-11 00:00:00',
+      $this->getCustomFieldName('link') => 'http://example.com',
     );
 
     $custom_params_2 = array(
-      "custom_{$this->_ids[0]}" => 'Hello! this is other custom data',
-      "custom_{$this->_ids[1]}" => 'Y',
-      "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
-      "custom_{$this->_ids[3]}" => 'http://example.org',
+      $this->getCustomFieldName('text') => 'Hello! this is other custom data',
+      $this->getCustomFieldName('select_string') => 'Y',
+      $this->getCustomFieldName('select_date') => '2009-07-11 00:00:00',
+      $this->getCustomFieldName('link') => 'http://example.org',
     );
 
     $params = array(
@@ -718,23 +612,22 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * does.
    */
   public function testRelationshipCreateDuplicateWithCustomFields2() {
-    $this->createCustomGroup();
-    $this->_ids = $this->createCustomField();
+    $this->createCustomGroupWithFieldsOfAllTypes();
 
     $custom_params_2 = array(
-      "custom_{$this->_ids[0]}" => 'Hello! this is other custom data',
-      "custom_{$this->_ids[1]}" => 'Y',
-      "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
-      "custom_{$this->_ids[3]}" => 'http://example.org',
+      $this->getCustomFieldName('text') => 'Hello! this is other custom data',
+      $this->getCustomFieldName('select_string') => 'Y',
+      $this->getCustomFieldName('select_date') => '2009-07-11 00:00:00',
+      $this->getCustomFieldName('link') => 'http://example.org',
     );
 
-    $params_1 = array(
+    $params_1 = [
       'contact_id_a' => $this->_cId_a,
       'contact_id_b' => $this->_cId_b,
       'relationship_type_id' => $this->_relTypeID,
       'start_date' => '2008-12-20',
       'is_active' => 1,
-    );
+    ];
 
     $params_2 = array_merge($params_1, $custom_params_2);
 
@@ -754,15 +647,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * does not.
    */
   public function testRelationshipCreateDuplicateWithCustomFields3() {
-    $this->createCustomGroup();
-    $this->_ids = $this->createCustomField();
+    $this->createCustomGroupWithFieldsOfAllTypes();
 
-    $custom_params_1 = array(
-      "custom_{$this->_ids[0]}" => 'Hello! this is other custom data',
-      "custom_{$this->_ids[1]}" => 'Y',
-      "custom_{$this->_ids[2]}" => '2009-07-11 00:00:00',
-      "custom_{$this->_ids[3]}" => 'http://example.org',
-    );
+    $custom_params_1 = [
+      $this->getCustomFieldName('text') => 'Hello! this is other custom data',
+      $this->getCustomFieldName('select_string') => 'Y',
+      $this->getCustomFieldName('select_date') => '2009-07-11 00:00:00',
+      $this->getCustomFieldName('link') => 'http://example.org',
+    ];
 
     $params_2 = array(
       'contact_id_a' => $this->_cId_a,
@@ -1097,18 +989,18 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByTypeReciprocal() {
-    $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $created = $this->callAPISuccess($this->entity, 'create', $this->_params);
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id' => $this->_cId_a,
       'relationship_type_id' => $this->_relTypeID,
     ));
     $this->assertEquals(1, $result['count']);
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id' => $this->_cId_a,
       'relationship_type_id' => $this->_relTypeID + 1,
     ));
     $this->assertEquals(0, $result['count']);
-    $this->callAPISuccess($this->_entity, 'delete', array('id' => $created['id']));
+    $this->callAPISuccess($this->entity, 'delete', array('id' => $created['id']));
   }
 
   /**
@@ -1119,17 +1011,17 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByTypeDAO() {
-    $this->_ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE) +
+    $this->_ids['relationship'] = $this->callAPISuccess($this->entity, 'create', array('format.only_id' => TRUE) +
       $this->_params);
-    $this->callAPISuccess($this->_entity, 'getcount', array(
+    $this->callAPISuccess($this->entity, 'getcount', array(
       'contact_id_a' => $this->_cId_a,
     ), 1);
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id_a' => $this->_cId_a,
       'relationship_type_id' => $this->_relTypeID,
     ));
     $this->assertEquals(1, $result['count']);
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id_a' => $this->_cId_a,
       'relationship_type_id' => $this->_relTypeID + 1,
     ));
@@ -1144,7 +1036,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByTypeArrayDAO() {
-    $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $this->callAPISuccess($this->entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
     // lets just assume built in ones aren't being messed with!
     $relType2 = 5;
@@ -1152,7 +1044,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $relType3 = 6;
 
     // Relationship 2.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
         'contact_id_b' => $this->_cId_b2,
@@ -1160,14 +1052,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 3.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
         'contact_id_b' => $org3,
       ))
     );
 
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id_a' => $this->_cId_a,
       'relationship_type_id' => array('IN' => array($this->_relTypeID, $relType3)),
     ));
@@ -1186,14 +1078,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByTypeArrayReciprocal() {
-    $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $this->callAPISuccess($this->entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
     // lets just assume built in ones aren't being messed with!
     $relType2 = 5;
     $relType3 = 6;
 
     // Relationship 2.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
         'contact_id_b' => $this->_cId_b2,
@@ -1201,14 +1093,14 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 3.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
         'contact_id_b' => $org3,
       ))
     );
 
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id' => $this->_cId_a,
       'relationship_type_id' => array('IN' => array($this->_relTypeID, $relType3)),
     ));
@@ -1229,7 +1121,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByMembershipTypeDAO() {
-    $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $this->callAPISuccess($this->entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
 
     // lets just assume built in ones aren't being messed with!
@@ -1243,7 +1135,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     ));
 
     // Relationship 2.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
         'contact_id_b' => $this->_cId_b2,
@@ -1251,7 +1143,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 3.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
         'contact_id_b' => $org3,
@@ -1259,7 +1151,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 4 with reversal.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType1,
         'contact_id_a' => $this->_cId_a,
@@ -1267,7 +1159,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       ))
     );
 
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id_a' => $this->_cId_a,
       'membership_type_id' => $memberType,
     ));
@@ -1286,7 +1178,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * an incorrect one
    */
   public function testGetRelationshipByMembershipTypeReciprocal() {
-    $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $this->callAPISuccess($this->entity, 'create', $this->_params);
     $org3 = $this->organizationCreate();
 
     // Let's just assume built in ones aren't being messed with!
@@ -1299,7 +1191,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     ));
 
     // Relationship 2.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType2,
         'contact_id_b' => $this->_cId_b2,
@@ -1307,7 +1199,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 4.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType3,
         'contact_id_b' => $org3,
@@ -1315,7 +1207,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     // Relationship 4 with reversal.
-    $this->callAPISuccess($this->_entity, 'create',
+    $this->callAPISuccess($this->entity, 'create',
       array_merge($this->_params, array(
         'relationship_type_id' => $relType1,
         'contact_id_a' => $this->_cId_a,
@@ -1323,7 +1215,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       ))
     );
 
-    $result = $this->callAPISuccess($this->_entity, 'get', array(
+    $result = $this->callAPISuccess($this->entity, 'get', array(
       'contact_id' => $this->_cId_a,
       'membership_type_id' => $memberType,
     ));
@@ -1339,9 +1231,9 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * Check for e-notices on enable & disable as reported in CRM-14350
    */
   public function testSetActive() {
-    $relationship = $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 0));
-    $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 1));
+    $relationship = $this->callAPISuccess($this->entity, 'create', $this->_params);
+    $this->callAPISuccess($this->entity, 'create', array('id' => $relationship['id'], 'is_active' => 0));
+    $this->callAPISuccess($this->entity, 'create', array('id' => $relationship['id'], 'is_active' => 1));
   }
 
   /**
index b2eb935a18781e0b801596b3f46e892dbd236924..d02d7d4b1266492dd031969b18afcf49470018d5 100644 (file)
@@ -37,8 +37,6 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
   use CRMTraits_ACL_PermissionTrait;
   use CRMTraits_PCP_PCPTestTrait;
 
-  protected $_apiversion = 3;
-
   protected $contactIDs = [];
 
   /**
@@ -196,7 +194,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
    */
   public function testReportTemplateGetRowsContactSummary() {
     $description = "Retrieve rows from a report template (optionally providing the instance_id).";
-    $result = $this->callApiSuccess('report_template', 'getrows', array(
+    $result = $this->callAPISuccess('report_template', 'getrows', array(
       'report_id' => 'contact/summary',
       'options' => array('metadata' => array('labels', 'title')),
     ), __FUNCTION__, __FILE__, $description, 'Getrows');
@@ -220,12 +218,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
    */
   public function testReportTemplateGetRowsMailingUniqueOpened() {
     $description = "Retrieve rows from a mailing opened report template.";
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute($this->_dbconn,
-      $this->createFlatXMLDataSet(
-        dirname(__FILE__) . '/../../CRM/Mailing/BAO/queryDataset.xml'
-      )
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/../../CRM/Mailing/BAO/queryDataset.xml');
 
     // Check total rows without distinct
     global $_REQUEST;
@@ -396,6 +389,11 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
     return array(array('member/detail'));
   }
 
+  /**
+   * Get the membership and contribution reports to test.
+   *
+   * @return array
+   */
   public static function getMembershipAndContributionReportTemplatesForGroupTests() {
     $templates = array_merge(self::getContributionReportTemplates(), self::getMembershipReportTemplates());
     foreach ($templates as $key => $value) {
@@ -1202,14 +1200,14 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
     );
     $c3 = $this->contributionCreate($contribution3params);
     // Now the soft contribution.
-    $p = array(
+    $p = [
       'contribution_id' => $c3,
       'pcp_id' => $pcp2->id,
       'contact_id' => $pcpOwnerContact2Id,
       'amount' => 200.00,
       'currency' => 'USD',
       'soft_credit_type_id' => $pcp_soft_credit_type_id,
-    );
+    ];
     $this->callAPISuccess('contribution_soft', 'create', $p);
 
     $template = 'contribute/pcp';
@@ -1226,4 +1224,18 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
     $this->assertEquals(2, $values['civicrm_contribution_soft_soft_id_count'], "Total donors should be 2");
   }
 
+  /**
+   * Test a report that uses getAddressColumns();
+   */
+  public function testGetAddressColumns() {
+    $template = 'event/participantlisting';
+    $this->callAPISuccess('report_template', 'getrows', [
+      'report_id' => $template,
+      'fields' => [
+        'sort_name' => '1',
+        'street_address' => '1',
+      ],
+    ]);
+  }
+
 }
index aa75cf711572617c653ccb5d98c8753c923f53a3..f8d6ed962064d9eee8ed375fdf68cb42688112b0 100644 (file)
@@ -110,7 +110,6 @@ class api_v3_SettingTest extends CiviUnitTestCase {
   public function testGetFieldsCaching() {
     $settingsMetadata = array();
     Civi::cache('settings')->set('settingsMetadata_' . \CRM_Core_Config::domainID() . '_', $settingsMetadata);
-    Civi::cache('settings')->set(\Civi\Core\SettingsMetadata::ALL, $settingsMetadata);
     $result = $this->callAPISuccess('setting', 'getfields', array());
     $this->assertArrayNotHasKey('customCSSURL', $result['values']);
     $this->quickCleanup(array('civicrm_cache'));
index 8880c0c15dbc4620890e66bd862b35c206c15ae8..e22e8eea0c77e7157314bcd9c809e5329dcfc20e 100644 (file)
@@ -498,7 +498,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
       'Profile',
       'CustomValue',
       'UFJoin',
-      'UFField',
       'Relationship',
       'RelationshipType',
       'Note',
@@ -736,6 +735,27 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
           'ignore_severity',
         ),
       ),
+      'UFField' => array(
+        'cant_update' => array(
+          // These fields get auto-adjusted by the BAO prior to saving
+          'weight',
+          'location_type_id',
+          'phone_type_id',
+          'website_type_id',
+          // Not a real field
+          'option.autoweight',
+        ),
+        'break_return' => array(
+          // These fields get auto-adjusted by the BAO prior to saving
+          'weight',
+          'field_type',
+          'location_type_id',
+          'phone_type_id',
+          'website_type_id',
+          // Not a real field
+          'option.autoweight',
+        ),
+      ),
       'JobLog' => array(
         // For better or worse triggers override.
         'break_return' => ['run_time'],
@@ -1496,9 +1516,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
         'id' => $entity['id'],
         $field => isset($entity[$field]) ? $entity[$field] : NULL,
       );
-      if (!empty($specs['serialize'])) {
-        $updateParams[$field] = $entity[$field] = (array) $specs['serialize'];
-      }
       if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
         //api has special handling on these 2 fields for backward compatibility reasons
         $entity['contribution_type_id'] = $updateParams['financial_type_id'];
index c85d7427199fafb8c2e439a030ec96397ce283aa..e5dd292073f7c513bbcdb11ee0efe3dab4ddecc0 100644 (file)
@@ -41,7 +41,8 @@ class api_v3_TagTest extends CiviUnitTestCase {
   protected $ids = array();
   /**
    * Tag id.
-   * @var integer
+   *
+   * @var int
    */
   protected $tag = array();
 
index 945bc52725b86f71d9c9c99553dd802fb9d6183d..68e5610824cbcfea31b44d16ce18d523d1db2a2a 100644 (file)
 
 /**
  * Test class for UFGroup API - civicrm_uf_*
+ *
  * @todo Split UFGroup and UFJoin tests
  *
  * @package   CiviCRM
  * @group headless
  */
 class api_v3_UFFieldTest extends CiviUnitTestCase {
+
   /**
    * ids from the uf_group_test.xml fixture
+   *
    * @var int
    */
   protected $_ufGroupId = 11;
+
   protected $_ufFieldId;
+
   protected $_contactId = 69;
-  protected $_apiversion = 3;
+
   protected $_params;
+
   protected $_entity = 'uf_field';
 
   /**
@@ -52,25 +58,21 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
   protected function setUp() {
     parent::setUp();
     $this->quickCleanup(
-      array(
+      [
         'civicrm_group',
         'civicrm_contact',
         'civicrm_uf_group',
         'civicrm_uf_field',
         'civicrm_uf_join',
         'civicrm_uf_match',
-      )
+      ]
     );
 
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute(
-      $this->_dbconn,
-      $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml')
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml');
 
-    $this->callAPISuccess('uf_field', 'getfields', array('cache_clear' => 1));
+    $this->callAPISuccess('uf_field', 'getfields', ['cache_clear' => 1]);
 
-    $this->_params = array(
+    $this->_params = [
       'field_name' => 'phone',
       'field_type' => 'Contact',
       'visibility' => 'Public Pages and Listings',
@@ -81,7 +83,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
       'location_type_id' => 1,
       'phone_type_id' => 1,
       'uf_group_id' => $this->_ufGroupId,
-    );
+    ];
   }
 
   /**
@@ -91,13 +93,13 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    */
   public function tearDown() {
     $this->quickCleanup(
-      array(
+      [
         'civicrm_group',
         'civicrm_contact',
         'civicrm_uf_group',
         'civicrm_uf_join',
         'civicrm_uf_match',
-      )
+      ]
     );
   }
 
@@ -127,8 +129,8 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    * Failure test for bad parameters.
    */
   public function testCreateUFFieldWithWrongParams() {
-    $this->callAPIFailure('uf_field', 'create', array('field_name' => 'test field'));
-    $this->callAPIFailure('uf_field', 'create', array('label' => 'name-less field'));
+    $this->callAPIFailure('uf_field', 'create', ['field_name' => 'test field']);
+    $this->callAPIFailure('uf_field', 'create', ['label' => 'name-less field']);
   }
 
   /**
@@ -140,21 +142,21 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
     $params1 = $this->_params;
     $ufField1 = $this->callAPISuccess('uf_field', 'create', $params1);
     $this->assertEquals(1, $ufField1['values'][$ufField1['id']]['weight']);
-    $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array(
-      1 => array($ufField1['id'], 'Int'),
-    ));
+    $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [
+      1 => [$ufField1['id'], 'Int'],
+    ]);
 
     $params2 = $this->_params;
     // needs to be a different field
     $params2['location_type_id'] = 2;
     $ufField2 = $this->callAPISuccess('uf_field', 'create', $params2);
     $this->assertEquals(1, $ufField2['values'][$ufField2['id']]['weight']);
-    $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array(
-      1 => array($ufField2['id'], 'Int'),
-    ));
-    $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array(
-      1 => array($ufField1['id'], 'Int'),
-    ));
+    $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [
+      1 => [$ufField2['id'], 'Int'],
+    ]);
+    $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [
+      1 => [$ufField1['id'], 'Int'],
+    ]);
   }
 
   /**
@@ -162,9 +164,9 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    */
   public function testDeleteUFField() {
     $ufField = $this->callAPISuccess('uf_field', 'create', $this->_params);
-    $params = array(
+    $params = [
       'field_id' => $ufField['id'],
-    );
+    ];
     $this->callAPIAndDocument('uf_field', 'delete', $params, __FUNCTION__, __FILE__);
   }
 
@@ -173,7 +175,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    */
   public function testGetUFFieldSuccess() {
     $this->callAPISuccess($this->_entity, 'create', $this->_params);
-    $result = $this->callAPIAndDocument($this->_entity, 'get', array(), __FUNCTION__, __FILE__);
+    $result = $this->callAPIAndDocument($this->_entity, 'get', [], __FUNCTION__, __FILE__);
     $this->getAndCheck($this->_params, $result['id'], $this->_entity);
   }
 
@@ -181,8 +183,8 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    * Create / updating field.
    */
   public function testReplaceUFFields() {
-    $baseFields = array();
-    $baseFields[] = array(
+    $baseFields = [];
+    $baseFields[] = [
       'field_name' => 'first_name',
       'field_type' => 'Contact',
       'visibility' => 'Public Pages and Listings',
@@ -190,8 +192,8 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
       'label' => 'Test First Name',
       'is_searchable' => 1,
       'is_active' => 1,
-    );
-    $baseFields[] = array(
+    ];
+    $baseFields[] = [
       'field_name' => 'country',
       'field_type' => 'Contact',
       'visibility' => 'Public Pages and Listings',
@@ -200,8 +202,8 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
       'is_searchable' => 1,
       'is_active' => 1,
       'location_type_id' => 1,
-    );
-    $baseFields[] = array(
+    ];
+    $baseFields[] = [
       'field_name' => 'phone',
       'field_type' => 'Contact',
       'visibility' => 'Public Pages and Listings',
@@ -211,17 +213,17 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
       'is_active' => 1,
       'location_type_id' => 1,
       'phone_type_id' => 1,
-    );
+    ];
 
-    $params = array(
+    $params = [
       'uf_group_id' => $this->_ufGroupId,
       'option.autoweight' => FALSE,
       'values' => $baseFields,
       'check_permissions' => TRUE,
-    );
+    ];
 
     $result = $this->callAPIAndDocument('uf_field', 'replace', $params, __FUNCTION__, __FILE__);
-    $inputsByName = CRM_Utils_Array::index(array('field_name'), $params['values']);
+    $inputsByName = CRM_Utils_Array::index(['field_name'], $params['values']);
     $this->assertEquals(count($params['values']), count($result['values']));
     foreach ($result['values'] as $outUfField) {
       $this->assertTrue(is_string($outUfField['field_name']));
@@ -244,7 +246,7 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    */
   public function testProfilesWithoutACL() {
     $this->createLoggedInUser();
-    $baseFields[] = array(
+    $baseFields[] = [
       'field_name' => 'first_name',
       'field_type' => 'Contact',
       'visibility' => 'Public Pages and Listings',
@@ -252,14 +254,14 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
       'label' => 'Test First Name',
       'is_searchable' => 1,
       'is_active' => 1,
-    );
-    CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM');
-    $params = array(
+    ];
+    CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM'];
+    $params = [
       'uf_group_id' => $this->_ufGroupId,
       'option.autoweight' => FALSE,
       'values' => $baseFields,
       'check_permissions' => TRUE,
-    );
+    ];
     $this->_loggedInUser = CRM_Core_Session::singleton()->get('userID');
     $this->callAPIFailure('uf_field', 'replace', $params);
   }
@@ -269,11 +271,11 @@ class api_v3_UFFieldTest extends CiviUnitTestCase {
    */
   public function testACLPermissionforProfiles() {
     $this->createLoggedInUser();
-    $this->_permissionedGroup = $this->groupCreate(array(
+    $this->_permissionedGroup = $this->groupCreate([
       'title' => 'Edit Profiles',
       'is_active' => 1,
       'name' => 'edit-profiles',
-    ));
+    ]);
     $this->setupACL(TRUE);
     $this->testReplaceUFFields();
   }
index 381c5e281e1fe4b7ed96da9abf47986405560876..d2e1e4adce9d9f804db04bbf8e8b68bd6d4acbdb 100644 (file)
@@ -40,7 +40,6 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
   protected $_ufGroupId = 11;
   protected $_ufFieldId;
   protected $_contactId = 69;
-  protected $_apiversion;
 
   protected function setUp() {
     parent::setUp();
@@ -54,12 +53,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase {
         'civicrm_uf_match',
       )
     );
-    $this->_apiversion = 3;
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute(
-      $this->_dbconn,
-      $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml')
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml');
   }
 
   public function tearDown() {
index b7c4ee776abc559587d99c69c6351e792c5a4151..d5c8a4e305e66184539631367703e066cae6e8ae 100644 (file)
@@ -40,12 +40,10 @@ class api_v3_UFMatchTest extends CiviUnitTestCase {
   protected $_ufGroupId = 11;
   protected $_ufFieldId;
   protected $_contactId;
-  protected $_apiversion;
   protected $_params = array();
 
   protected function setUp() {
     parent::setUp();
-    $this->_apiversion = 3;
     $this->quickCleanup(
       array(
         'civicrm_group',
@@ -56,11 +54,7 @@ class api_v3_UFMatchTest extends CiviUnitTestCase {
       )
     );
     $this->_contactId = $this->individualCreate();
-    $op = new PHPUnit_Extensions_Database_Operation_Insert();
-    $op->execute(
-      $this->_dbconn,
-      $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml')
-    );
+    $this->loadXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml');
 
     $this->_params = array(
       'contact_id' => $this->_contactId,
index f01bf6ec98097882d5bc551f5b6e448082d10109..8d250cdc672336ae091521bb66710d10cd0cab7c 100644 (file)
@@ -47,7 +47,7 @@ class CRM_Omnimail_DAO_MailingProviderData extends CRM_Core_DAO {
   /**
    * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
-   * @var boolean
+   * @var bool
    */
   protected static $_log = FALSE;
   /**
diff --git a/tests/phpunit/api/v3/dataset/email_contact_17.xml b/tests/phpunit/api/v3/dataset/email_contact_17.xml
deleted file mode 100644 (file)
index 4239ae0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--  $Id: email_contact_17.xml 30511 2010-11-03 11:36:36Z shot $  -->
-<dataset>
-  <table name="civicrm_email">
-    <column>id</column>
-    <column>contact_id</column>
-    <column>location_type_id</column>
-    <column>email</column>
-    <column>is_primary</column>
-    <column>is_billing</column>
-    <column>on_hold</column>
-    <column>is_bulkmail</column>
-    <column>hold_date</column>
-    <column>reset_date</column>
-    <row>
-      <value>100</value>  <!--  id  -->
-      <value>17</value> <!--  contact_id  -->
-      <value>1</value>  <!--  location_type_id  -->
-      <value>TestContact@example.com</value>  <!--  email  -->
-      <value>1</value>  <!--  is_primary  -->
-      <value>1</value>  <!--  is_billing  -->
-      <value>0</value>  <!--  on_hold  -->
-      <value>0</value>  <!--  is_bulkmail  -->
-      <null />          <!--  hold_date  -->
-      <null />          <!--  reset_date  -->
-    </row>
-  </table>
-</dataset>
index 95c0ac018ac31a3d69b891687969b99fbcc88374..df222ccaadecdcf0dad271f35a8d186c1020f072 100644 (file)
@@ -24,8 +24,7 @@
 */
 
 
-
-require_once ('bin/cli.php');
+require_once('bin/cli.php');
 require_once 'CRM/Core/BAO/Tag.php';
 
 /**
@@ -41,7 +40,7 @@ class tagsImporter extends civicrm_cli {
       die("you need to profide a csv file (1st column parent name, 2nd tag name");
     }
     $this->file = $this->args[0];
-    $this->tags = array_flip(CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE)));
+    $this->tags = array_flip(CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE]));
   }
 
   //format expected: parent name, tag
@@ -70,12 +69,17 @@ class tagsImporter extends civicrm_cli {
       echo "\n- exists already: " . $param['name'];
       return;
     }
-    $key = array('tag' => '');
+    $key = ['tag' => ''];
     if ($param['parent']) {
       if (array_key_exists($param['parent'], $this->tags)) {
         $param['parent_id'] = $this->tags[$param['parent']];
       }
-      else $param['parent_id'] = $this->addTag(array(parent => '', name => $param['parent']));
+      else {
+        $param['parent_id'] = $this->addTag([
+          parent => '',
+          name => $param['parent'],
+        ]);
+      }
       $tag = CRM_Core_BAO_Tag::add($param, $key);
       echo "\n" . $tag->id . ": create " . $param['name'] . " below " . $param['parent'];
     }
index 331e3a6bad5c9bc13faaabb6c7bac0a9f661f8be..f4bfaf16f0f16b096b7585735a6cb2af54dde4ec 100644 (file)
@@ -44,7 +44,7 @@ function run() {
 
   require_once 'Console/Getopt.php';
   $shortOptions = "n:p:k:pre";
-  $longOptions = array('name=', 'pass=', 'key=', 'prefix=');
+  $longOptions = ['name=', 'pass=', 'key=', 'prefix='];
 
   $getopt = new Console_Getopt();
   $args = $getopt->readPHPArgv();
@@ -52,12 +52,12 @@ function run() {
   array_shift($args);
   list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
 
-  $vars = array(
+  $vars = [
     'name' => 'n',
     'pass' => 'p',
     'key' => 'k',
     'prefix' => 'pre',
-  );
+  ];
 
   foreach ($vars as $var => $short) {
     $$var = NULL;
@@ -100,9 +100,10 @@ AND        phone NOT REGEXP '^[[:digit:]]{3}-[[:digit:]]{3}-[[:digit:]]{4}$'
   $dao = &CRM_Core_DAO::executeQuery($query);
 
   $updateQuery = "UPDATE civicrm_phone SET phone = %1 where id = %2";
-  $params = array(1 => array('', 'String'),
-    2 => array(0, 'Integer'),
-  );
+  $params = [
+    1 => ['', 'String'],
+    2 => [0, 'Integer'],
+  ];
   $totalPhone = $validPhone = $nonPrefixedPhone = 0;
   while ($dao->fetch()) {
     $newPhone = processPhone($dao->phone, $prefix);
index e95a66552b42b60d308a52cb8b6af09c2b083404..ba95cfb4a152366d879d2079fcb49fb9b2f859b5 100644 (file)
@@ -3,14 +3,14 @@
  * Scrape all config options from the CKEditor documentation site.
  */
 $content = file_get_contents('http://docs.ckeditor.com/?print=/api/CKEDITOR.config');
-$matches = $output = array();
+$matches = $output = [];
 preg_match_all("#name expandable'>([^<]+)</a>\s?:\s?(.*)<span.*'short'>([\s\S]*?)</div>#", $content, $matches);
 foreach ($matches[1] as $i => $name) {
-  $output[] = array(
+  $output[] = [
     'id' => $name,
     'type' => strip_tags($matches[2][$i]),
-    'description' => str_replace(array("\n", '. ...'), array(' ', '.'), $matches[3][$i]),
-  );
+    'description' => str_replace(["\n", '. ...'], [' ', '.'], $matches[3][$i]),
+  ];
 }
 if ($output) {
   $location = str_replace('tools/bin/scripts', '', __DIR__);
index 29b8704da0954d24240033a194e7567af9c6cef6..823e82ee713d8752d5e74cf548bc2b4e2e19fc78 100644 (file)
 
 /**
  * A PHP shell script
-
- On drupal if you have a symlink to your civi module, don't forget to create a new file - settings_location.php
- Enter the following code (substitute the actual location of your <drupal root>/sites directory)
- <?php
- define( 'CIVICRM_CONFDIR', '/var/www/drupal.6/sites' );
- ?>
-
+ *
+ * On drupal if you have a symlink to your civi module, don't forget to create a new file - settings_location.php
+ * Enter the following code (substitute the actual location of your <drupal root>/sites directory)
+ * <?php
+ * define( 'CIVICRM_CONFDIR', '/var/www/drupal.6/sites' );
+ * ?>
  */
 $include_path = "../packages/:" . get_include_path();
 set_include_path($include_path);
@@ -49,19 +48,19 @@ class civicrm_CLI {
     // set_include_path( $include_path );
     require_once 'Console/Getopt.php';
     $shortOptions = "s:u:p:k:";
-    $longOptions = array('site=', 'user', 'pass');
+    $longOptions = ['site=', 'user', 'pass'];
 
     $getopt = new Console_Getopt();
     $args = $getopt->readPHPArgv();
     array_shift($args);
     list($valid, $this->args) = $getopt->getopt2($args, $shortOptions, $longOptions);
 
-    $vars = array(
+    $vars = [
       'user' => 'u',
       'pass' => 'p',
       'key' => 'k',
       'site' => 's',
-    );
+    ];
 
     foreach ($vars as $var => $short) {
       $$var = NULL;
@@ -88,8 +87,8 @@ class civicrm_CLI {
   function authenticate($user, $pass) {
     session_start();
     require_once 'CRM/Core/Config.php';
-
-    $config = &CRM_Core_Config::singleton();
+    // Does calling this do anything here?
+    CRM_Core_Config::singleton();
 
     // this does not return on failure
     // require_once 'CRM/Utils/System.php';
@@ -102,7 +101,7 @@ class civicrm_CLI {
     $_SERVER['PHP_SELF'] = "/index.php";
     $_SERVER['HTTP_HOST'] = $this->site;
     $_REQUEST['key'] = $this->key;
-    require_once ("./civicrm.config.php");
+    require_once("./civicrm.config.php");
   }
 }
 
index c341602256666a4e033c91fc674a29457784118a..a7dff160fde32d2afcbcae5980f31566e18e57ac 100644 (file)
@@ -5,9 +5,9 @@ require_once 'CRM/Utils/Cache.php';
 
 define('CIVICRM_USE_MEMCACHE', 1);
 
-$config = &CRM_Core_Config::singleton();
-$cache = &CRM_Utils_Cache::singleton();
+$config = CRM_Core_Config::singleton();
+$cache = CRM_Utils_Cache::singleton();
 
-$cache->set('CRM_Core_Config' .CRM_Core_Config::domainID(), $config);
+$cache->set('CRM_Core_Config' . CRM_Core_Config::domainID(), $config);
 CRM_Core_Error::debug('get', $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID()));
 
index 711c196483c3f8ba97646c41506223b93f612a40..4b7a6d60713c0ce8675a405e09d6f1115d2ce687 100755 (executable)
@@ -44,7 +44,7 @@ switch (@$argv[2]) {
 echo "Changing version from $oldVersion to $newVersion...\n";
 
 $verName = makeVerName($newVersion);
-$phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function() use ($verName) {
+$phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function () use ($verName) {
   ob_start();
   global $camelNumber;
   $camelNumber = $verName;
@@ -53,7 +53,7 @@ $phpFile = initFile("CRM/Upgrade/Incremental/php/{$verName}.php", function() use
   return ob_get_clean();
 });
 
-$sqlFile = initFile("CRM/Upgrade/Incremental/sql/{$newVersion}.mysql.tpl", function() use ($newVersion) {
+$sqlFile = initFile("CRM/Upgrade/Incremental/sql/{$newVersion}.mysql.tpl", function () use ($newVersion) {
   return "{* file to handle db changes in $newVersion during upgrade *}\n";
 });
 
index ecfc0f9f6ae0a2b2822f3ef59eaa0fe7a219fe7c..077836aa983fb74770fe0211f7e58c2cf6a4601e 100644 (file)
@@ -1,5 +1,6 @@
 <?php
-require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php';
+require_once '../civicrm.config.php';
+require_once 'CRM/Core/Config.php';
 require_once 'CRM/Core/Error.php';
 $config = CRM_Core_Config::singleton();
 
@@ -10,13 +11,14 @@ CRM_Core_Error::debug($report);
 exit();
 
 $xmlProcessor->run(104, 1, 'Substance Abuse', '15 Day Review');
-$params = array('clientID' => 104,
+$params = [
+  'clientID' => 104,
   'creatorID' => 108,
   'standardTimeline' => 1,
   'activityTypeName' => 'Open Case',
   'dueDateTime' => time(),
   'caseID' => 1,
-);
+];
 require_once 'CRM/Case/XMLProcessor/Process.php';
 $xmlProcessor = new CRM_Case_XMLProcessor_Process();
 
index f47685e1d4d2435ac9e88ad62f88ec9c534142d0..6d2f8fc20d3f87270396263cfa106f2af5d4f64a 100644 (file)
@@ -26,7 +26,6 @@
 */
 
 
-
 /*
  * This script recaches the display_name and sort_name values
  *
@@ -42,7 +41,7 @@ class CRM_UpdateNameCache {
   function __construct() {
     // you can run this program either from an apache command, or from the cli
     if (php_sapi_name() == "cli") {
-      require_once ("cli.php");
+      require_once("cli.php");
       $cli = new civicrm_cli();
       //if it doesn't die, it's authenticated
     }
@@ -81,9 +80,9 @@ class CRM_UpdateNameCache {
     $prefixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
     $suffixes = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id');
 
-    $tokens = array();
+    $tokens = [];
     CRM_Utils_Hook::tokens($tokens);
-    $tokenFields = array();
+    $tokenFields = [];
     foreach ($tokens as $category => $catTokens) {
       foreach ($catTokens as $token) {
         $tokenFields[] = $token;
@@ -100,12 +99,13 @@ class CRM_UpdateNameCache {
 
     while ($dao->fetch()) {
       $contactID = $dao->id;
-      $params = array('first_name' => $dao->first_name,
+      $params = [
+        'first_name' => $dao->first_name,
         'middle_name' => $dao->middle_name,
         'last_name' => $dao->last_name,
         'prefix_id' => $dao->prefix_id,
         'suffix_id' => $dao->suffix_id,
-      );
+      ];
       $params['individual_prefix'] = $prefixes[$dao->prefix_id];
       $params['individual_suffix'] = $suffixes[$dao->suffix_id];
 
index cba6b799f2ac1cd26fea2ab948ad5325ad59f458..9e4ae1695e699fcaef50b06a5db9267d6e874fae 100644 (file)
@@ -4,7 +4,7 @@
  * Implementation of hook_enable
  */
 function civicrm_webtest_enable() {
-  user_role_grant_permissions(1, array(
+  user_role_grant_permissions(1, [
     'access CiviMail subscribe/unsubscribe pages',
     'access all custom data',
     'access uploaded files',
@@ -12,7 +12,7 @@ function civicrm_webtest_enable() {
     'profile create',
     'profile view',
     'register for events',
-  ));
+  ]);
 
   $roles = user_roles();
   if (!in_array('civicrm_webtest_user', $roles)) {
@@ -20,87 +20,88 @@ function civicrm_webtest_enable() {
     $role->name = 'civicrm_webtest_user';
     user_role_save($role);
     $rid = $role->rid;
-  } else {
+  }
+  else {
     $rid = array_search('civicrm_webtest_user', $roles);
   }
 
-  user_role_grant_permissions($rid, array(
+  user_role_grant_permissions($rid, [
     // FIXME: whoa, why do we bother with users if both need admin rights?
-   'access AJAX API',
+    'access AJAX API',
     // 'access all cases and activities',
-   'access all custom data',
-   'access CiviContribute',
-   'access CiviCRM',
-   'access CiviEvent',
-   // 'access CiviGrant',
-   'access CiviMail',
-   'access CiviMail subscribe/unsubscribe pages',
-   'access CiviMember',
-   'access CiviPledge',
-   'access CiviReport',
-   'access Contact Dashboard',
-   'access contact reference fields',
-   'access deleted contacts',
-   // 'access my cases and activities',
-   'access Report Criteria',
-   'save Report Criteria',
-   'access uploaded files',
-   // 'add cases',
-   'add contacts',
-   // 'administer CiviCase',
-   'administer CiviCRM',
-   'administer dedupe rules',
-   'administer Reports',
-   'administer reserved groups',
-   'administer reserved reports',
-   'administer reserved tags',
-   'administer Tagsets',
-   'delete activities',
-   'delete contacts',
-   // 'delete in CiviCase',
-   'delete in CiviContribute',
-   'delete in CiviEvent',
-   // 'delete in CiviGrant',
-   'delete in CiviMail',
-   'delete in CiviMember',
-   'delete in CiviPledge',
-   'edit all contacts',
-   'view my contact',
-   'edit my contact',
-   'edit all events',
-   'edit contributions',
-   'edit event participants',
-   'edit message templates',
-   // 'edit grants',
-   'edit groups',
-   'edit memberships',
-   'edit pledges',
-   'import contacts',
-   'make online contributions',
-   'manage tags',
-   'merge duplicate contacts',
-   'profile create',
-   'profile edit',
-   'profile listings',
-   'profile listings and forms',
-   'profile view',
-   'register for events',
-   'translate CiviCRM',
-   'view all activities',
-   'view all contacts',
-   'view all notes',
-   'view event info',
-   'view event participants',
-   'view public CiviMail content',
-   'administer payment processors',
-   'create manual batch',
-   'edit own manual batches',
-   'edit all manual batches',
-   'view own manual batches',
-   'view all manual batches',
-   'delete own manual batches',
-   'delete all manual batches',
-   'export own manual batches',
-   'export all manual batches',
-  ));
+    'access all custom data',
+    'access CiviContribute',
+    'access CiviCRM',
+    'access CiviEvent',
+    // 'access CiviGrant',
+    'access CiviMail',
+    'access CiviMail subscribe/unsubscribe pages',
+    'access CiviMember',
+    'access CiviPledge',
+    'access CiviReport',
+    'access Contact Dashboard',
+    'access contact reference fields',
+    'access deleted contacts',
+    // 'access my cases and activities',
+    'access Report Criteria',
+    'save Report Criteria',
+    'access uploaded files',
+    // 'add cases',
+    'add contacts',
+    // 'administer CiviCase',
+    'administer CiviCRM',
+    'administer dedupe rules',
+    'administer Reports',
+    'administer reserved groups',
+    'administer reserved reports',
+    'administer reserved tags',
+    'administer Tagsets',
+    'delete activities',
+    'delete contacts',
+    // 'delete in CiviCase',
+    'delete in CiviContribute',
+    'delete in CiviEvent',
+    // 'delete in CiviGrant',
+    'delete in CiviMail',
+    'delete in CiviMember',
+    'delete in CiviPledge',
+    'edit all contacts',
+    'view my contact',
+    'edit my contact',
+    'edit all events',
+    'edit contributions',
+    'edit event participants',
+    'edit message templates',
+    // 'edit grants',
+    'edit groups',
+    'edit memberships',
+    'edit pledges',
+    'import contacts',
+    'make online contributions',
+    'manage tags',
+    'merge duplicate contacts',
+    'profile create',
+    'profile edit',
+    'profile listings',
+    'profile listings and forms',
+    'profile view',
+    'register for events',
+    'translate CiviCRM',
+    'view all activities',
+    'view all contacts',
+    'view all notes',
+    'view event info',
+    'view event participants',
+    'view public CiviMail content',
+    'administer payment processors',
+    'create manual batch',
+    'edit own manual batches',
+    'edit all manual batches',
+    'view own manual batches',
+    'view all manual batches',
+    'delete own manual batches',
+    'delete all manual batches',
+    'export own manual batches',
+    'export all manual batches',
+  ]);
 }
index 79958c9e4000dd56f574a62a4caedc94d1feecb0..69dee259d3dc1d6980562ad452e388133fff82af 100644 (file)
  */
 function _angularex_civix_civicrm_config(&$config = NULL) {
   static $configured = FALSE;
-  if ($configured) return;
+  if ($configured) {
+    return;
+  }
   $configured = TRUE;
 
   $template =& CRM_Core_Smarty::singleton();
 
-  $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
+  $extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
   $extDir = $extRoot . 'templates';
 
-  if ( is_array( $template->template_dir ) ) {
-      array_unshift( $template->template_dir, $extDir );
-  } else {
-      $template->template_dir = array( $extDir, $template->template_dir );
+  if (is_array($template->template_dir)) {
+    array_unshift($template->template_dir, $extDir);
+  }
+  else {
+    $template->template_dir = [$extDir, $template->template_dir];
   }
 
-  $include_path = $extRoot . PATH_SEPARATOR . get_include_path( );
-  set_include_path( $include_path );
+  $include_path = $extRoot . PATH_SEPARATOR . get_include_path();
+  set_include_path($include_path);
 }
 
 /**
@@ -72,7 +75,7 @@ function _angularex_civix_civicrm_uninstall() {
 function _angularex_civix_civicrm_enable() {
   _angularex_civix_civicrm_config();
   if ($upgrader = _angularex_civix_upgrader()) {
-    if (is_callable(array($upgrader, 'onEnable'))) {
+    if (is_callable([$upgrader, 'onEnable'])) {
       return $upgrader->onEnable();
     }
   }
@@ -86,7 +89,7 @@ function _angularex_civix_civicrm_enable() {
 function _angularex_civix_civicrm_disable() {
   _angularex_civix_civicrm_config();
   if ($upgrader = _angularex_civix_upgrader()) {
-    if (is_callable(array($upgrader, 'onDisable'))) {
+    if (is_callable([$upgrader, 'onDisable'])) {
       return $upgrader->onDisable();
     }
   }
@@ -113,9 +116,10 @@ function _angularex_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) {
  * @return CRM_Angularex_Upgrader
  */
 function _angularex_civix_upgrader() {
-  if (!file_exists(__DIR__.'/CRM/Angularex/Upgrader.php')) {
+  if (!file_exists(__DIR__ . '/CRM/Angularex/Upgrader.php')) {
     return NULL;
-  } else {
+  }
+  else {
     return CRM_Angularex_Upgrader_Base::instance();
   }
 }
@@ -131,12 +135,12 @@ function _angularex_civix_upgrader() {
  * @return array(string)
  */
 function _angularex_civix_find_files($dir, $pattern) {
-  if (is_callable(array('CRM_Utils_File', 'findFiles'))) {
+  if (is_callable(['CRM_Utils_File', 'findFiles'])) {
     return CRM_Utils_File::findFiles($dir, $pattern);
   }
 
-  $todos = array($dir);
-  $result = array();
+  $todos = [$dir];
+  $result = [];
   while (!empty($todos)) {
     $subdir = array_shift($todos);
     foreach (_angularex_civix_glob("$subdir/$pattern") as $match) {
@@ -148,7 +152,8 @@ function _angularex_civix_find_files($dir, $pattern) {
       while (FALSE !== ($entry = readdir($dh))) {
         $path = $subdir . DIRECTORY_SEPARATOR . $entry;
         if ($entry{0} == '.') {
-        } elseif (is_dir($path)) {
+        }
+        elseif (is_dir($path)) {
           $todos[] = $path;
         }
       }
@@ -202,11 +207,11 @@ function _angularex_civix_civicrm_caseTypes(&$caseTypes) {
       CRM_Core_Error::fatal($errorMessage);
       // throw new CRM_Core_Exception($errorMessage);
     }
-    $caseTypes[$name] = array(
+    $caseTypes[$name] = [
       'module' => 'org.civicrm.angularex',
       'name' => $name,
       'file' => $file,
-    );
+    ];
   }
 }
 
@@ -224,7 +229,7 @@ function _angularex_civix_civicrm_caseTypes(&$caseTypes) {
  */
 function _angularex_civix_glob($pattern) {
   $result = glob($pattern);
-  return is_array($result) ? $result : array();
+  return is_array($result) ? $result : [];
 }
 
 /**
@@ -245,25 +250,30 @@ function _angularex_civix_insert_navigation_menu(&$menu, $path, $item, $parentId
 
   // If we are done going down the path, insert menu
   if (empty($path)) {
-    if (!$navId) $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
-    $navId ++;
-    $menu[$navId] = array (
-      'attributes' => array_merge($item, array(
-        'label'      => CRM_Utils_Array::value('name', $item),
-        'active'     => 1,
-        'parentID'   => $parentId,
-        'navID'      => $navId,
-      ))
-    );
-    return true;
-  } else {
+    if (!$navId) {
+      $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation");
+    }
+    $navId++;
+    $menu[$navId] = [
+      'attributes' => array_merge($item, [
+        'label' => CRM_Utils_Array::value('name', $item),
+        'active' => 1,
+        'parentID' => $parentId,
+        'navID' => $navId,
+      ]),
+    ];
+    return TRUE;
+  }
+  else {
     // Find an recurse into the next level down
-    $found = false;
+    $found = FALSE;
     $path = explode('/', $path);
     $first = array_shift($path);
     foreach ($menu as $key => &$entry) {
       if ($entry['attributes']['name'] == $first) {
-        if (!$entry['child']) $entry['child'] = array();
+        if (!$entry['child']) {
+          $entry['child'] = [];
+        }
         $found = _angularex_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item, $key);
       }
     }
@@ -279,11 +289,13 @@ function _angularex_civix_insert_navigation_menu(&$menu, $path, $item, $parentId
  */
 function _angularex_civix_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
   static $configured = FALSE;
-  if ($configured) return;
+  if ($configured) {
+    return;
+  }
   $configured = TRUE;
 
   $settingsDir = __DIR__ . DIRECTORY_SEPARATOR . 'settings';
-  if(is_dir($settingsDir) && !in_array($settingsDir, $metaDataFolders)) {
+  if (is_dir($settingsDir) && !in_array($settingsDir, $metaDataFolders)) {
     $metaDataFolders[] = $settingsDir;
   }
 }
index 064f725453311ebd296e8522bb6429e9a882b109..225edb358a79145a276dbb72ebe7f6549e58bad6 100644 (file)
@@ -115,9 +115,9 @@ function angularex_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
  * @param $angularModule
  */
 function angularex_civicrm_angularModules(&$angularModule) {
-  $angularModule['example'] = array(
+  $angularModule['example'] = [
     'ext' => 'org.civicrm.angularex',
-    'js' => array('js/*.js'),
-    'partials' => array('partials'),
-  );
+    'js' => ['js/*.js'],
+    'partials' => ['partials'],
+  ];
 }
index df73fb08ba5057042ff34ec549407c3c757cba1d..a63c4eea01d10e16eeaf1a782868e1064ecf54c8 100644 (file)
@@ -9,33 +9,33 @@ class CRM_Demoqueue_Page_DemoQueue extends CRM_Core_Page {
   const QUEUE_NAME = 'demo-queue';
 
   function run() {
-    $queue = CRM_Queue_Service::singleton()->create(array(
+    $queue = CRM_Queue_Service::singleton()->create([
       'type' => 'Sql',
       'name' => self::QUEUE_NAME,
       'reset' => TRUE,
-    ));
+    ]);
 
     for ($i = 0; $i < 5; $i++) {
       $queue->createItem(new CRM_Queue_Task(
-        array('CRM_Demoqueue_Page_DemoQueue', 'doMyWork'), // callback
-        array($i, "Task $i takes $i second(s)"), // arguments
+        ['CRM_Demoqueue_Page_DemoQueue', 'doMyWork'], // callback
+        [$i, "Task $i takes $i second(s)"], // arguments
         "Task $i" // title
       ));
       if ($i == 2) {
         $queue->createItem(new CRM_Queue_Task(
-          array('CRM_Demoqueue_Page_DemoQueue', 'addMoreWork'), // callback
-          array(), // arguments
+          ['CRM_Demoqueue_Page_DemoQueue', 'addMoreWork'], // callback
+          [], // arguments
           "Add More Work" // title
         ));
       }
     }
 
-    $runner = new CRM_Queue_Runner(array(
+    $runner = new CRM_Queue_Runner([
       'title' => ts('Demo Queue Runner'),
       'queue' => $queue,
-      'onEnd' => array('CRM_Demoqueue_Page_DemoQueue', 'onEnd'),
+      'onEnd' => ['CRM_Demoqueue_Page_DemoQueue', 'onEnd'],
       'onEndUrl' => CRM_Utils_System::url('civicrm/demo-queue/done'),
-    ));
+    ]);
     $runner->runAllViaWeb(); // does not return
   }
 
@@ -65,12 +65,12 @@ class CRM_Demoqueue_Page_DemoQueue extends CRM_Core_Page {
     sleep(1);
     for ($i = 0; $i < 5; $i++) {
       $ctx->queue->createItem(new CRM_Queue_Task(
-        array('CRM_Demoqueue_Page_DemoQueue', 'doMyWork'), // callback
-        array($i, "Extra task $i takes $i second(s)"), // arguments
+        ['CRM_Demoqueue_Page_DemoQueue', 'doMyWork'], // callback
+        [$i, "Extra task $i takes $i second(s)"], // arguments
         "Extra Task $i" // title
-      ), array(
+      ), [
         'weight' => -1,
-      ));
+      ]);
     }
     return TRUE; // success
   }
index 6f1eb17782e5abff66f83c69ab85956bf7986297..3f9fd4e427f7b47807ebda31b8d308aaa21a0bc0 100644 (file)
@@ -6,9 +6,9 @@ require_once 'CRM/Core/Page.php';
  * Class CRM_Demoqueue_Page_DemoQueueDone
  */
 class CRM_Demoqueue_Page_DemoQueueDone extends CRM_Core_Page {
-    function run() {
-        // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
-        CRM_Utils_System::setTitle(ts('DemoQueueDone'));
-        parent::run();
-    }
+  function run() {
+    // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
+    CRM_Utils_System::setTitle(ts('DemoQueueDone'));
+    parent::run();
+  }
 }
index cfc2973f96640caf8fd2d8bf61bfb5d9c4fe56b6..2f643279ded3e7b1b0b4e2c96454c96a8543a2c1 100644 (file)
@@ -9,17 +9,18 @@
 function _demoqueue_civix_civicrm_config(&$config) {
   $template =& CRM_Core_Smarty::singleton();
 
-  $extRoot = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
+  $extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
   $extDir = $extRoot . 'templates';
 
-  if ( is_array( $template->template_dir ) ) {
-      array_unshift( $template->template_dir, $extDir );
-  } else {
-      $template->template_dir = array( $extDir, $template->template_dir );
+  if (is_array($template->template_dir)) {
+    array_unshift($template->template_dir, $extDir);
+  }
+  else {
+    $template->template_dir = [$extDir, $template->template_dir];
   }
 
-  $include_path = $extRoot . PATH_SEPARATOR . get_include_path( );
-  set_include_path( $include_path );
+  $include_path = $extRoot . PATH_SEPARATOR . get_include_path();
+  set_include_path($include_path);
 }
 
 /**
index b0d44d3003a9def28aeea923471e8219a3fd2b50..79a97aa097c641f3b7902b82f00f37c1fba404b3 100755 (executable)
@@ -5,7 +5,7 @@ eval(`cv php:boot`);
 global $civicrm_root;
 $realArgs = $argv;
 $diffCmd = FALSE;
-$files = array();
+$files = [];
 
 array_shift($realArgs);
 foreach ($realArgs as $arg) {
@@ -52,7 +52,7 @@ function compareFile($file, $diffCmd) {
     echo "File \"$file\" appears to have consistency issues. Created $newFile.\n";
     file_put_contents($newFile, $newMarkup);
     if ($diffCmd) {
-      passthru($diffCmd . ' '  . escapeshellarg($file) . ' ' . escapeshellarg($newFile));
+      passthru($diffCmd . ' ' . escapeshellarg($file) . ' ' . escapeshellarg($newFile));
     }
   }
-}
\ No newline at end of file
+}
index 63bb5a83a5e90ff6aaff6c0eb63b3e62964a37ff..8c79fb8c796ecb69f7c6802725bf2f274b2398c7 100644 (file)
@@ -1,5 +1,6 @@
 <?php
-$options = getopt('bc:ht:'); if (isset($options['h'])) {
+$options = getopt('bc:ht:');
+if (isset($options['h'])) {
   print ("\nUsage: php civimail-spooler.php [-bh] [-c <config>] [-t <period>]\n");
   print ("   -b  Run this process continuously\n");
   print ("   -c  Path to CiviCRM civicrm.settings.php\n");
@@ -17,7 +18,7 @@ require_once "$config_file";
 require_once "CRM/Core/Config.php";
 ');
 
-$config = &CRM_Core_Config::singleton();
+$config = CRM_Core_Config::singleton();
 
 /* Temporary permissioning hack for now */
 
@@ -34,7 +35,6 @@ if (isset($options['b'])) {
          * process into the background and provide init.d scripts */
 
 
-
     CRM_Mailing_BAO_MailingJob::runJobs();
     sleep($config->mailerPeriod);
   }
index effecbdbb02e322eef025157b54b41f2a1bfc2b3..42c1f39dd5b92ebe60e89a7200a34fb5ab32f90a 100644 (file)
@@ -23,3 +23,20 @@ index 3acadc3..06f1e71 100644
  /**
   * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
   * @version //autogentag//
+diff --git a/src/parser/interfaces/part_parser.php b/src/parser/interfaces/part_parser.php
+index a81378b..6c59e5a 100644
+--- a/src/parser/interfaces/part_parser.php
++++ b/src/parser/interfaces/part_parser.php
+@@ -168,7 +168,11 @@ abstract class ezcMailPartParser
+                 break;
+             case 'text':
+-                if ( ezcMailPartParser::$parseTextAttachmentsAsFiles === true )
++                // dev/core#940 Ensure that emails are not processed as .unknown attachments by checking
++                // for Filename or name in the content-disposition and content-type headers.
++                if ( (ezcMailPartParser::$parseTextAttachmentsAsFiles === true)                   &&
++                     (preg_match('/\s*filename="?([^;"]*);?/i', $headers['Content-Disposition']) ||
++                      preg_match( '/\s*name="?([^;"]*);?/i'   , $headers['Content-Type'])        )  )
+                 {
+                     $bodyParser = new ezcMailFileParser( $mainType, $subType, $headers );
+                 }
index bbe6eeae6c10f50448e0090920188501d595cecd..d567aa6991a6aa466c29e4f19a350f4684a64f67 100644 (file)
@@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128);
 function &splitContactIDs(&$contactIDs) {
   // contactIDs could be a real large array, so we split it up into
   // smaller chunks and then general xml for each chunk
-  $chunks           = array();
-  $current          = 0;
-  $chunks[$current] = array();
-  $count            = 0;
+  $chunks = [];
+  $current = 0;
+  $chunks[$current] = [];
+  $count = 0;
 
   foreach ($contactIDs as $cid) {
     $chunks[$current][] = $cid;
@@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) {
 
     if ($count == CHUNK_SIZE) {
       $current++;
-      $chunks[$current] = array();
+      $chunks[$current] = [];
       $count = 0;
     }
   }
@@ -81,7 +81,7 @@ function &generateSolrJSON($values) {
 
     foreach ($tokens as $n => $v) {
       if (is_array($v)) {
-        $str = array();
+        $str = [];
         foreach ($v as $el) {
           $el = escapeJsonString($el);
           $str[] = "\"$el\"";
@@ -115,8 +115,8 @@ function &generateSolrJSON($values) {
  * @return mixed
  */
 function escapeJsonString($value) {
-  $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c");
-  $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b");
+  $escapers = ["\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"];
+  $replacements = ["\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"];
   return str_replace($escapers, $replacements, $value);
 }
 
@@ -127,10 +127,10 @@ function escapeJsonString($value) {
  * @return array
  */
 function getValues(&$contactIDs, &$values) {
-  $values = array();
+  $values = [];
 
   foreach ($contactIDs as $cid) {
-    $values[$cid] = array();
+    $values[$cid] = [];
   }
 
   getContactInfo($contactIDs, $values);
@@ -178,7 +178,8 @@ SELECT $selectString, $whereField as contact_id
  * @param $values
  */
 function getContactInfo(&$contactIDs, &$values) {
-  $fields = array('sort_name' => NULL,
+  $fields = [
+    'sort_name' => NULL,
     'display_name' => NULL,
     'contact_type' => NULL,
     'legal_identifier' => NULL,
@@ -190,7 +191,7 @@ function getContactInfo(&$contactIDs, &$values) {
     'organization_name' => NULL,
     'legal_name' => NULL,
     'job_title' => NULL,
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id');
 }
 
@@ -312,10 +313,17 @@ LEFT  JOIN civicrm_country        co ON a.country_id        = co.id
 WHERE c.id IN ( $ids )
 ";
 
-  $fields = array('location_type', 'street_address', 'supplemental_address_1',
-    'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code',
-    'state', 'country',
-  );
+  $fields = [
+    'location_type',
+    'street_address',
+    'supplemental_address_1',
+    'supplemental_address_2',
+    'supplemental_address_3',
+    'city',
+    'postal_code',
+    'state',
+    'country',
+  ];
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
     $address = '';
@@ -352,7 +360,7 @@ function appendValue(&$values, $contactID, $name, $value) {
   else {
     if (!is_array($values[$contactID][$name])) {
       $save = $values[$contactID][$name];
-      $values[$contactID][$name] = array();
+      $values[$contactID][$name] = [];
       $values[$contactID][$name][] = $save;
     }
     $values[$contactID][$name][] = $value;
@@ -366,14 +374,14 @@ function run(&$contactIDs) {
   $chunks = &splitContactIDs($contactIDs);
 
   foreach ($chunks as $chunk) {
-    $values = array();
+    $values = [];
     getValues($chunk, $values);
     $xml = &generateSolrJSON($values);
     echo $xml;
   }
 }
 
-$config = &CRM_Core_Config::singleton();
+$config = CRM_Core_Config::singleton();
 $config->userFramework = 'Soap';
 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
 $config->userHookClass = 'CRM_Utils_Hook_Soap';
@@ -385,7 +393,7 @@ EOT;
 $dao = &CRM_Core_DAO::executeQuery($sql);
 
 
-$contactIDs = array();
+$contactIDs = [];
 while ($dao->fetch()) {
   $contactIDs[] = $dao->id;
 }
index a00b15a4bfa0edd169b819067a45f49734f6287a..b0f207dc31166f8fa2f3f728f52be52cfe3ff08a 100644 (file)
@@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128);
 function &splitContactIDs(&$contactIDs) {
   // contactIDs could be a real large array, so we split it up into
   // smaller chunks and then general xml for each chunk
-  $chunks           = array();
-  $current          = 0;
-  $chunks[$current] = array();
-  $count            = 0;
+  $chunks = [];
+  $current = 0;
+  $chunks[$current] = [];
+  $count = 0;
 
   foreach ($contactIDs as $cid) {
     $chunks[$current][] = $cid;
@@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) {
 
     if ($count == CHUNK_SIZE) {
       $current++;
-      $chunks[$current] = array();
+      $chunks[$current] = [];
       $count = 0;
     }
   }
@@ -103,10 +103,10 @@ EOT;
  * @return array
  */
 function getValues(&$contactIDs, &$values) {
-  $values = array();
+  $values = [];
 
   foreach ($contactIDs as $cid) {
-    $values[$cid] = array();
+    $values[$cid] = [];
   }
 
   getContactInfo($contactIDs, $values);
@@ -146,7 +146,7 @@ SELECT $selectString, $whereField as contact_id
       if (!$name) {
         $name = $fld;
       }
-      $values[$dao->contact_id][] = array($name, $dao->$fld);
+      $values[$dao->contact_id][] = [$name, $dao->$fld];
     }
   }
 }
@@ -156,34 +156,38 @@ SELECT $selectString, $whereField as contact_id
  * @param $values
  */
 function getContactInfo(&$contactIDs, &$values) {
-  $fields = array('sort_name' => NULL,
+  $fields = [
+    'sort_name' => NULL,
     'display_name' => NULL,
     'contact_type' => NULL,
     'legal_identifier' => NULL,
     'external_identifier' => NULL,
     'source' => 'contact_source',
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id');
 
-  $fields = array('first_name' => NULL,
+  $fields = [
+    'first_name' => NULL,
     'last_name' => NULL,
     'middle_name' => NULL,
     'job_title' => NULL,
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_individual', $fields, 'contact_id');
 
-  $fields = array('household_name' => NULL);
+  $fields = ['household_name' => NULL];
   getTableInfo($contactIDs, $values, 'civicrm_household', $fields, 'contact_id');
 
-  $fields = array('organization_name' => NULL,
+  $fields = [
+    'organization_name' => NULL,
     'legal_name' => NULL,
     'sic_code' => NULL,
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_organization', $fields, 'contact_id');
 
-  $fields = array('note' => 'note_body',
+  $fields = [
+    'note' => 'note_body',
     'subject' => 'note_subject',
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_note', $fields, 'entity_id', "entity_table = 'civicrm_contact'");
 }
 
@@ -215,17 +219,28 @@ WHERE l.entity_table = 'civicrm_contact'
   AND l.entity_id IN ( $ids )
 ";
 
-  $fields = array('location_name', 'street_address', 'supplemental_address_1',
-    'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code', 'county', 'state',
-    'country', 'email', 'phone', 'im',
-  );
+  $fields = [
+    'location_name',
+    'street_address',
+    'supplemental_address_1',
+    'supplemental_address_2',
+    'supplemental_address_3',
+    'city',
+    'postal_code',
+    'county',
+    'state',
+    'country',
+    'email',
+    'phone',
+    'im',
+  ];
   $dao = CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
     foreach ($fields as $fld) {
       if (empty($dao->$fld)) {
         continue;
       }
-      $values[$dao->contact_id][] = array($fld, $dao->$fld);
+      $values[$dao->contact_id][] = [$fld, $dao->$fld];
     }
   }
 }
@@ -237,14 +252,14 @@ function run(&$contactIDs) {
   $chunks = &splitContactIDs($contactIDs);
 
   foreach ($chunks as $chunk) {
-    $values = array();
+    $values = [];
     getValues($chunk, $values);
     $xml = &generateSolrXML($values);
     echo $xml;
   }
 }
 
-$config = &CRM_Core_Config::singleton();
+$config = CRM_Core_Config::singleton();
 $config->userFramework = 'Soap';
 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
 $config->userHookClass = 'CRM_Utils_Hook_Soap';
@@ -255,7 +270,7 @@ FROM civicrm_contact
 EOT;
 $dao = CRM_Core_DAO::executeQuery($sql);
 
-$contactIDs = array();
+$contactIDs = [];
 while ($dao->fetch()) {
   $contactIDs[] = $dao->id;
 }
index 540978056c07fd635fc5cb4eafa1b67c4f1e317c..95d4fac75fffc867855038d0a964b0b944cf8235 100644 (file)
@@ -42,10 +42,10 @@ define('CHUNK_SIZE', 128);
 function &splitContactIDs(&$contactIDs) {
   // contactIDs could be a real large array, so we split it up into
   // smaller chunks and then general xml for each chunk
-  $chunks           = array();
-  $current          = 0;
-  $chunks[$current] = array();
-  $count            = 0;
+  $chunks = [];
+  $current = 0;
+  $chunks[$current] = [];
+  $count = 0;
 
   foreach ($contactIDs as $k => $v) {
     $chunks[$current][$k] = $v;
@@ -53,7 +53,7 @@ function &splitContactIDs(&$contactIDs) {
 
     if ($count == CHUNK_SIZE) {
       $current++;
-      $chunks[$current] = array();
+      $chunks[$current] = [];
       $count = 0;
     }
   }
@@ -74,7 +74,7 @@ function &splitContactIDs(&$contactIDs) {
  * @return array
  */
 function getValues(&$contactIDs, &$values, &$allContactIDs, &$addditionalContactIDs) {
-  $values = array();
+  $values = [];
 
   getContactInfo($contactIDs, $values);
   getAddressInfo($contactIDs, $values);
@@ -103,8 +103,8 @@ function getValues(&$contactIDs, &$values, &$allContactIDs, &$addditionalContact
  * @param bool $flat
  */
 function getTableInfo(&$contactIDs, &$values, $tableName, &$fields,
-  $whereField, $additionalWhereCond = NULL,
-  $flat = FALSE
+                      $whereField, $additionalWhereCond = NULL,
+                      $flat = FALSE
 ) {
   $selectString = implode(',', array_keys($fields));
   $idString = implode(',', $contactIDs);
@@ -121,7 +121,7 @@ SELECT $selectString, $whereField as contact_id
 
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
-    $contact = array();
+    $contact = [];
     foreach ($fields as $fld => $name) {
       $name = $name ? $name : $fld;
       if (empty($dao->$fld)) {
@@ -141,7 +141,8 @@ SELECT $selectString, $whereField as contact_id
  * @param $values
  */
 function getContactInfo(&$contactIDs, &$values) {
-  $fields = array('id' => NULL,
+  $fields = [
+    'id' => NULL,
     'sort_name' => NULL,
     'display_name' => NULL,
     'contact_type' => NULL,
@@ -154,7 +155,7 @@ function getContactInfo(&$contactIDs, &$values) {
     'organization_name' => NULL,
     'legal_name' => NULL,
     'job_title' => NULL,
-  );
+  ];
   getTableInfo($contactIDs, $values, 'civicrm_contact', $fields, 'id', NULL, TRUE);
 }
 
@@ -177,11 +178,12 @@ AND   entity_table = 'civicrm_contact'
 
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
-    $note = array('id' => $dao->id,
+    $note = [
+      'id' => $dao->id,
       'contact_id' => $dao->contact_id,
       'subject' => empty($dao->subject) ? NULL : $dao->subject,
       'note' => empty($dao->note) ? NULL : $dao->note,
-    );
+    ];
 
     appendValue($values, $dao->id, 'note', $note);
   }
@@ -213,12 +215,13 @@ AND        p.phone IS NOT NULL
 
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
-    $phone = array('id' => $dao->id,
+    $phone = [
+      'id' => $dao->id,
       'contact_id' => $dao->contact_id,
       'location_type' => empty($dao->location_type) ? NULL : $dao->location_type,
       'phone' => $dao->phone,
       'phone_type' => empty($dao->phone_type) ? NULL : $dao->phone_type,
-    );
+    ];
 
     appendValue($values, $dao->id, 'phone', $phone);
   }
@@ -247,11 +250,12 @@ AND        e.email IS NOT NULL
 
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
-    $email = array('id' => $dao->id,
+    $email = [
+      'id' => $dao->id,
       'contact_id' => $dao->contact_id,
       'location_type' => empty($dao->location_type) ? NULL : $dao->location_type,
       'email' => $dao->email,
-    );
+    ];
     appendValue($values, $dao->id, 'email', $email);
   }
   $dao->free();
@@ -279,14 +283,22 @@ LEFT  JOIN civicrm_country        co ON a.country_id        = co.id
 WHERE c.id IN ( $ids )
 ";
 
-  $fields = array('id', 'contact_id',
-    'location_type', 'street_address', 'supplemental_address_1',
-    'supplemental_address_2', 'supplemental_address_3', 'city', 'postal_code',
-    'state', 'country',
-  );
+  $fields = [
+    'id',
+    'contact_id',
+    'location_type',
+    'street_address',
+    'supplemental_address_1',
+    'supplemental_address_2',
+    'supplemental_address_3',
+    'city',
+    'postal_code',
+    'state',
+    'country',
+  ];
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
-    $address = array();
+    $address = [];
     foreach ($fields as $fld) {
       if (empty($dao->$fld)) {
         $address[$fld] = NULL;
@@ -308,7 +320,7 @@ WHERE c.id IN ( $ids )
  */
 function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalContacts) {
   // handle relationships only once
-  static $_relationshipsHandled = array();
+  static $_relationshipsHandled = [];
 
   $ids = implode(',', $contactIDs);
 
@@ -324,15 +336,15 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition
 ";
 
   $relationshipFields = getDBFields('CRM_Contact_DAO_Relationship');
-  $fields             = array_keys($relationshipFields);
-  $dao                = &CRM_Core_DAO::executeQuery($sql);
+  $fields = array_keys($relationshipFields);
+  $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
     if (isset($_relationshipsHandled[$dao->id])) {
       continue;
     }
     $_relationshipsHandled[$dao->id] = $dao->id;
 
-    $relationship = array();
+    $relationship = [];
     foreach ($fields as $fld) {
       if (empty($dao->$fld)) {
         $relationship[$fld] = NULL;
@@ -343,9 +355,10 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition
     }
     appendValue($values, $dao->id, 'relationship', $relationship);
 
-    addAdditionalContacts(array($dao->contact_id_a,
-        $dao->contact_id_b,
-      ),
+    addAdditionalContacts([
+      $dao->contact_id_a,
+      $dao->contact_id_b,
+    ],
       $allContactIDs, $additionalContacts
     );
   }
@@ -359,7 +372,7 @@ function getRelationshipInfo(&$contactIDs, &$values, &$allContactIDs, &$addition
  * @param $additionalContacts
  */
 function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalContacts) {
-  static $_activitiesHandled = array();
+  static $_activitiesHandled = [];
 
   $ids = implode(',', $contactIDs);
 
@@ -381,7 +394,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo
   $activityFields = &getDBFields('CRM_Activity_DAO_Activity');
   $fields = array_keys($activityFields);
 
-  $activityIDs = array();
+  $activityIDs = [];
   $dao = &CRM_Core_DAO::executeQuery($sql);
   while ($dao->fetch()) {
     if (isset($_activitiesHandled[$dao->id])) {
@@ -390,7 +403,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo
     $_activitiesHandled[$dao->id] = $dao->id;
     $activityIDs[] = $dao->id;
 
-    $activity = array();
+    $activity = [];
     foreach ($fields as $fld) {
       if (empty($dao->$fld)) {
         $activity[$fld] = NULL;
@@ -401,7 +414,7 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo
     }
 
     appendValue($values, $dao->id, 'activity', $activity);
-    addAdditionalContacts(array($dao->source_contact_id),
+    addAdditionalContacts([$dao->source_contact_id],
       $allContactIDs, $additionalContacts
     );
   }
@@ -414,14 +427,15 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo
   $activityIDString = implode(",", $activityIDs);
 
   // now get all assignee contact ids and target contact ids for this activity
-  $sql              = "SELECT * FROM civicrm_activity_assignment WHERE activity_id IN ($activityIDString)";
-  $aaDAO            = &CRM_Core_DAO::executeQuery($sql);
-  $activityContacts = array();
+  $sql = "SELECT * FROM civicrm_activity_assignment WHERE activity_id IN ($activityIDString)";
+  $aaDAO = &CRM_Core_DAO::executeQuery($sql);
+  $activityContacts = [];
   while ($aaDAO->fetch()) {
-    $activityAssignee = array('id' => $aaDAO->id,
+    $activityAssignee = [
+      'id' => $aaDAO->id,
       'assignee_contact_id' => $aaDAO->assignee_contact_id,
       'activity_id' => $aaDAO->activity_id,
-    );
+    ];
     appendValue($values, $aaDAO->id, 'activity_assignment', $activityAssignee);
     $activityContacts[] = $aaDAO->assignee_contact_id;
   }
@@ -430,10 +444,11 @@ function getActivityInfo(&$contactIDs, &$values, &$allContactIDs, &$additionalCo
   $sql = "SELECT * FROM civicrm_activity_target WHERE activity_id IN ($activityIDString)";
   $atDAO = &CRM_Core_DAO::executeQuery($sql);
   while ($atDAO->fetch()) {
-    $activityTarget = array('id' => $atDAO->id,
+    $activityTarget = [
+      'id' => $atDAO->id,
       'target_contact_id' => $atDAO->target_contact_id,
       'activity_id' => $atDAO->activity_id,
-    );
+    ];
     appendValue($values, $atDAO->id, 'activity_target', $activityTarget);
     $activityContacts[] = $atDAO->target_contact_id;
   }
@@ -455,7 +470,7 @@ function appendValue(&$values, $id, $name, $value, $ignored = FALSE) {
   }
 
   if (!isset($values[$name])) {
-    $values[$name] = array();
+    $values[$name] = [];
     $values[$name][] = array_keys($value);
   }
   $values[$name][] = array_values($value);
@@ -467,24 +482,25 @@ function appendValue(&$values, $id, $name, $value, $ignored = FALSE) {
  * @return mixed
  */
 function getDBFields($daoName) {
-  static $_fieldsRetrieved = array();
+  static $_fieldsRetrieved = [];
 
   if (!isset($_fieldsRetrieved[$daoName])) {
-    $_fieldsRetrieved[$daoName] = array();
+    $_fieldsRetrieved[$daoName] = [];
     $daoFile = str_replace('_',
-      DIRECTORY_SEPARATOR,
-      $daoName
-    ) . '.php';
-    include_once ($daoFile);
+        DIRECTORY_SEPARATOR,
+        $daoName
+      ) . '.php';
+    include_once($daoFile);
 
     $daoFields = &$daoName::fields();
     require_once 'CRM/Utils/Array.php';
 
     foreach ($daoFields as $key => & $value) {
-      $_fieldsRetrieved[$daoName][$value['name']] = array('uniqueName' => $key,
+      $_fieldsRetrieved[$daoName][$value['name']] = [
+        'uniqueName' => $key,
         'type' => $value['type'],
         'title' => CRM_Utils_Array::value('title', $value, NULL),
-      );
+      ];
     }
   }
   return $_fieldsRetrieved[$daoName];
@@ -514,7 +530,7 @@ function addAdditionalContacts($contactIDs, &$allContactIDs, &$additionalContact
 function run(&$values, &$contactIDs, &$allContactIDs) {
   $chunks = &splitContactIDs($contactIDs);
 
-  $additionalContactIDs = array();
+  $additionalContactIDs = [];
 
   foreach ($chunks as $chunk) {
     getValues($chunk, $values, $allContactIDs, $additionalContactIDs);
@@ -526,7 +542,7 @@ function run(&$values, &$contactIDs, &$allContactIDs) {
   }
 }
 
-$config = &CRM_Core_Config::singleton();
+$config = CRM_Core_Config::singleton();
 $config->userFramework = 'Soap';
 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
 $config->userHookClass = 'CRM_Utils_Hook_Soap';
@@ -539,12 +555,12 @@ LIMIT 10
 $dao = &CRM_Core_DAO::executeQuery($sql);
 
 
-$contactIDs = array();
+$contactIDs = [];
 while ($dao->fetch()) {
   $contactIDs[$dao->id] = $dao->id;
 }
 
-$values = array();
+$values = [];
 run($values, $contactIDs, $contactIDs);
 
 $json = json_encode($values);
index 4fe5925e2cddf15871b52992260d35605f29c103..04b6f856754ea73f15e0786d7085aba632e092a3 100755 (executable)
@@ -3,7 +3,7 @@
 
 // FIXME: Make this a proper app with unit-tests
 
-$civi_pkgs_dir = dirname( dirname( dirname( __FILE__ ) ) ) .   DIRECTORY_SEPARATOR . 'packages';
+$civi_pkgs_dir = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'packages';
 require_once $civi_pkgs_dir . DIRECTORY_SEPARATOR . 'simple_html_dom.php';
 exit(main($argv));
 
@@ -19,7 +19,7 @@ function main($argv) {
   $files = $argv;
   array_shift($files); // skip program name
   foreach ($files as $file) {
-    check_tpl($file, function($code, $message) use ($file) {
+    check_tpl($file, function ($code, $message) use ($file) {
       printf("[%s] %s\n", $file, $message);
     });
   }
index cfc14f5bd1367e616be40480647b47dd7bbc9a1f..d197f6bf0838f304d8b1cc48bd2cc43af2ef44e1 100644 (file)
     <import>true</import>
     <headerPattern>/legal\s?id/i</headerPattern>
     <dataPattern>/\w+?\d{5,}/</dataPattern>
-    <comment>May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.
-    </comment>
+    <comment>May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.</comment>
     <add>1.1</add>
     <html>
       <type>Text</type>
     <length>32</length>
     <comment>API Key for validating requests related to this contact.</comment>
     <add>2.2</add>
+    <protected>true</protected>
   </field>
   <index>
     <name>index_api_key</name>
index 4deea9bf9639c99e2e4e652cfbe7cfd1989c8e2a..330e1a42dbc35b86bcdca5c8e9ca165b7c03d22e 100644 (file)
@@ -35,6 +35,9 @@
     <localizable>true</localizable>
     <comment>Name of Group.</comment>
     <add>1.1</add>
+    <html>
+      <type>Text</type>
+    </html>
   </field>
   <field>
     <name>description</name>
index 6fa4b12709cbdc591c3defe1fe37931c953fdb4c..183c3594c79985e65310b1f64b4620d1998a530e 100644 (file)
     <title>Contact Subtype A</title>
     <type>varchar</type>
     <length>64</length>
-    <comment>If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
-    </comment>
+    <comment>If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.</comment>
     <add>3.1</add>
     <html>
       <type>Select</type>
     <title>Contact Subtype B</title>
     <type>varchar</type>
     <length>64</length>
-    <comment>If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
-    </comment>
+    <comment>If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.</comment>
     <add>3.1</add>
     <html>
       <type>Select</type>
     <title>Relationship Type is Active</title>
     <type>boolean</type>
     <default>1</default>
-    <comment>Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
-    </comment>
+    <comment>Is this relationship type currently active (i.e. can be used when creating or editing relationships)?</comment>
     <html>
       <type>CheckBox</type>
     </html>
index b492bd9453056aa70554dcb93d4278178ddee8cd..1e3a211e07b0ad1d408c971a08e112432a784c45 100644 (file)
@@ -7,6 +7,7 @@
   <log>true</log>
   <field>
     <name>id</name>
+    <uniqueName>contribution_recur_id</uniqueName>
     <title>Recurring Contribution ID</title>
     <type>int unsigned</type>
     <required>true</required>
   </field>
   <field>
     <name>processor_id</name>
+    <uniqueName>contribution_recur_processor_id</uniqueName>
     <title>Processor ID</title>
     <type>varchar</type>
     <length>255</length>
   </foreignKey>
   <field>
     <name>trxn_id</name>
+    <uniqueName>contribution_recur_trxn_id</uniqueName>
     <title>Transaction ID</title>
     <type>varchar</type>
     <length>255</length>
   </index>
   <field>
     <name>contribution_status_id</name>
+    <uniqueName>contribution_recur_contribution_status_id</uniqueName>
     <title>Status</title>
     <type>int unsigned</type>
     <default>1</default>
   <field>
     <name>payment_processor_id</name>
     <title>Payment Processor</title>
+    <uniqueName>contribution_recur_payment_processor_id</uniqueName>
     <type>int unsigned</type>
     <comment>Foreign key to civicrm_payment_processor.id</comment>
     <add>3.3</add>
index c67aa09b0053f73da2c370d6e72e6885d6bb1f42..ba522711e2d1a48768fc9283231160168a0f5849 100644 (file)
@@ -95,8 +95,7 @@
     <dataPattern>/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i</dataPattern>
     <comment>Concatenation of all routable street address components (prefix, street number, street name, suffix, unit
       number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail
-      delivery, etc.).
-    </comment>
+      delivery, etc.).</comment>
     <add>1.1</add>
     <html>
       <type>Text</type>
     <type>varchar</type>
     <length>8</length>
     <export>true</export>
-    <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A
-    </comment>
+    <comment>Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A</comment>
     <add>1.1</add>
     <html>
       <type>Text</type>
index c5ceff329d92e6e0259561ec0eeeaa6b7544b6ff..8ccce97d865d16e1311909f25d0326ff5c47ce9f 100644 (file)
@@ -31,9 +31,7 @@
     <title>Namespace reserved for component.</title>
     <type>varchar</type>
     <length>128</length>
-    <comment>Path to components main directory in a form of a class
-      namespace.
-    </comment>
+    <comment>Path to components main directory in a form of a class namespace.</comment>
     <add>2.0</add>
   </field>
 </table>
index 30f58d69c90731594e856719a229d2ffe4f8b9f4..cfc0eb09c3b38753bc8be8252f200dcb547fb318 100644 (file)
     <type>int unsigned</type>
     <default>1</default>
     <comment>Used to group mapping_field records into related sets (e.g. for criteria sets in search builder
-      mappings).
-    </comment>
+      mappings).</comment>
     <add>1.5</add>
   </field>
   <field>
index 2b7b047f1816d51d6f7bdfa87a6a9f428631aa34..378845845169e53cd414c007156c53101705cb16 100644 (file)
@@ -90,6 +90,7 @@
     <pseudoconstant>
       <optionGroupName>tag_used_for</optionGroupName>
     </pseudoconstant>
+    <serialize>COMMA</serialize>
     <add>3.2</add>
   </field>
   <field>
index 30f9a31720685fb6c8cb221071e1b711f737af60..8b267c84ebfce2b435c7a3553d81e20b65cecffb 100644 (file)
     <import>true</import>
     <serialize>SEPARATOR_BOOKEND</serialize>
     <comment>Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
-      we store the label value and not the key
-    </comment>
+      we store the label value and not the key</comment>
     <add>1.7</add>
   </field>
   <field>
index f4e39f4d6765c227a4009ce11a46d179668c41fd..14f15735dea13545474f6512dfc7366050aa39ed 100644 (file)
@@ -30,7 +30,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
 {foreach from=$table.fields item=field}
     /**
 {if $field.comment}
-     * {$field.comment}
+     * {$field.comment|regex_replace:"/\n[ ]*/":"\n* "}
      *
 {/if}
      * @var {$field.phpType}
@@ -128,6 +128,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
 {if $field.rule}
                       'rule'      => '{$field.rule}',
 {/if} {* field.rule *}
+{if $field.protected}
+                      'protected'      => '{$field.protected}',
+{/if}
 {if $field.default || $field.default === '0'}
                          'default'   => '{if ($field.default[0]=="'" or $field.default[0]=='"')}{$field.default|substring:1:-1}{else}{$field.default}{/if}',
 {/if} {* field.default *}
@@ -151,7 +154,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
   ),
 {/if}
 {if $field.pseudoconstant}
-  'pseudoconstant' => {$field.pseudoconstant|@print_array}
+  'pseudoconstant' => {$field.pseudoconstant|@print_array},
 {/if} {* field.pseudoconstant *}                                                                    ),
 {/foreach} {* table.fields *}
                                       );
index 07d0df45b4058051a642a98ed5f12a4bfb7cd6c6..3f79cb6a6ba5b668ea92cc63b57bc438a34688dc 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>5.14.alpha1</version_no>
+  <version_no>5.15.alpha1</version_no>
 </version>