From 0cc75f1a47868e588bcb28153e10daa9a2744a10 Mon Sep 17 00:00:00 2001 From: Kevin Cristiano <kcristiano@kcristiano.com> Date: Fri, 4 Oct 2019 10:36:19 -0400 Subject: [PATCH] civicrm 5.18.0 release --- civicrm.php | 31 +- civicrm/CRM/ACL/BAO/Cache.php | 4 +- .../CRM/ACL/DAO/{Cache.php => ACLCache.php} | 24 +- .../CRM/ACL/Form/WordPress/Permissions.php | 2 +- civicrm/CRM/Activity/BAO/Activity.php | 103 +- civicrm/CRM/Activity/BAO/ActivityType.php | 100 ++ civicrm/CRM/Activity/Form/Activity.php | 72 +- civicrm/CRM/Activity/Form/Task/Batch.php | 1 + civicrm/CRM/Activity/Page/AJAX.php | 2 +- civicrm/CRM/Activity/Selector/Search.php | 11 +- civicrm/CRM/Admin/Form/Extensions.php | 2 +- civicrm/CRM/Admin/Form/ScheduleReminders.php | 4 +- .../CRM/Admin/Form/Setting/Localization.php | 2 +- civicrm/CRM/Admin/Form/Setting/Smtp.php | 4 +- civicrm/CRM/Badge/BAO/Badge.php | 4 +- civicrm/CRM/Batch/BAO/Batch.php | 11 +- civicrm/CRM/Batch/Form/Entry.php | 4 +- civicrm/CRM/Case/BAO/Query.php | 9 +- .../Case/Form/Activity/ChangeCaseStatus.php | 24 +- .../CRM/Case/Form/Activity/ChangeCaseType.php | 2 +- civicrm/CRM/Case/XMLProcessor/Process.php | 32 +- civicrm/CRM/Contact/BAO/Contact/Utils.php | 32 +- civicrm/CRM/Contact/BAO/ContactType.php | 75 +- civicrm/CRM/Contact/BAO/Query.php | 73 +- civicrm/CRM/Contact/BAO/Relationship.php | 139 ++- civicrm/CRM/Contact/BAO/SavedSearch.php | 7 - civicrm/CRM/Contact/DAO/Contact.php | 20 +- civicrm/CRM/Contact/Form/Contact.php | 2 +- civicrm/CRM/Contact/Form/DedupeRules.php | 2 +- civicrm/CRM/Contact/Form/Merge.php | 4 +- .../CRM/Contact/Form/Task/ProximityCommon.php | 4 +- civicrm/CRM/Contact/Import/Form/MapField.php | 270 +----- civicrm/CRM/Contact/Import/MetadataTrait.php | 122 +++ civicrm/CRM/Contact/Import/Parser.php | 10 +- civicrm/CRM/Contact/Import/Parser/Contact.php | 53 +- civicrm/CRM/Contact/Page/AJAX.php | 3 +- civicrm/CRM/Contact/Page/DedupeFind.php | 6 +- civicrm/CRM/Contact/Page/DedupeMerge.php | 12 +- civicrm/CRM/Contact/Page/View.php | 2 +- civicrm/CRM/Contribute/BAO/Contribution.php | 132 +-- .../CRM/Contribute/BAO/ContributionPage.php | 3 +- .../CRM/Contribute/BAO/ContributionRecur.php | 1 + .../CRM/Contribute/Form/AdditionalPayment.php | 34 +- civicrm/CRM/Contribute/Form/Contribution.php | 10 +- .../Contribute/Form/Contribution/Confirm.php | 26 +- .../CRM/Contribute/Form/Contribution/Main.php | 22 +- .../CRM/Contribute/Form/ContributionPage.php | 2 +- .../Form/ContributionPage/Amount.php | 14 +- .../CRM/Contribute/Import/Form/MapField.php | 33 +- civicrm/CRM/Contribute/Import/Parser.php | 22 +- civicrm/CRM/Core/BAO/Address.php | 7 +- civicrm/CRM/Core/BAO/CustomField.php | 2 +- civicrm/CRM/Core/BAO/Location.php | 2 +- civicrm/CRM/Core/BAO/PrevNextCache.php | 19 +- civicrm/CRM/Core/BAO/RecurringEntity.php | 2 +- civicrm/CRM/Core/BAO/SchemaHandler.php | 4 +- civicrm/CRM/Core/BAO/Setting.php | 2 +- civicrm/CRM/Core/BAO/StatusPreference.php | 2 +- civicrm/CRM/Core/BAO/UFField.php | 3 +- civicrm/CRM/Core/ClassLoader.php | 6 + civicrm/CRM/Core/Config.php | 3 + civicrm/CRM/Core/DAO.php | 40 +- civicrm/CRM/Core/DAO/Address.php | 5 +- civicrm/CRM/Core/DAO/AllCoreTables.data.php | 6 +- civicrm/CRM/Core/DAO/AllCoreTables.php | 4 +- civicrm/CRM/Core/DAO/Cache.php | 7 +- civicrm/CRM/Core/DAO/Dashboard.php | 2 +- civicrm/CRM/Core/Error.php | 37 +- civicrm/CRM/Core/Form/RecurringEntity.php | 4 +- civicrm/CRM/Core/Form/Search.php | 2 +- civicrm/CRM/Core/Page/AJAX.php | 2 +- civicrm/CRM/Core/Page/AJAX/Location.php | 3 +- .../CRM/Core/Page/AJAX/RecurringEntity.php | 2 +- civicrm/CRM/Core/Payment/BaseIPN.php | 126 ++- civicrm/CRM/Core/Payment/PayPalIPN.php | 41 +- civicrm/CRM/Core/Payment/PayPalImpl.php | 6 +- civicrm/CRM/Core/Permission.php | 70 +- civicrm/CRM/Core/PseudoConstant.php | 4 +- civicrm/CRM/Custom/Form/CustomData.php | 4 +- civicrm/CRM/Custom/Form/CustomDataByType.php | 8 + civicrm/CRM/Custom/Form/Preview.php | 2 +- civicrm/CRM/Dedupe/Finder.php | 27 +- civicrm/CRM/Dedupe/Merger.php | 44 +- civicrm/CRM/Event/BAO/Event.php | 30 +- civicrm/CRM/Event/BAO/Query.php | 19 +- .../CRM/Event/Cart/Form/Checkout/Payment.php | 4 +- civicrm/CRM/Event/Form/ManageEvent/Repeat.php | 2 +- civicrm/CRM/Event/Form/Registration.php | 2 +- .../CRM/Event/Form/Registration/Confirm.php | 7 +- .../CRM/Event/Form/Registration/Register.php | 6 +- civicrm/CRM/Export/BAO/Export.php | 13 +- civicrm/CRM/Export/BAO/ExportProcessor.php | 1 + civicrm/CRM/Financial/BAO/ExportFormat.php | 8 +- civicrm/CRM/Financial/BAO/FinancialType.php | 2 +- civicrm/CRM/Financial/BAO/Payment.php | 42 +- .../CRM/Financial/Form/FinancialAccount.php | 2 +- civicrm/CRM/Grant/Form/Grant.php | 10 +- civicrm/CRM/Grant/Form/Task.php | 2 +- civicrm/CRM/Import/Form/MapField.php | 33 + civicrm/CRM/Import/ImportProcessor.php | 570 ++++++++++++ civicrm/CRM/Mailing/Form/Search.php | 26 +- civicrm/CRM/Mailing/Selector/Browse.php | 4 +- civicrm/CRM/Member/BAO/Membership.php | 16 +- civicrm/CRM/Member/BAO/MembershipType.php | 52 +- civicrm/CRM/Member/BAO/Query.php | 81 +- civicrm/CRM/Member/DAO/Membership.php | 10 +- civicrm/CRM/Member/Form/Membership.php | 10 +- civicrm/CRM/Member/Form/MembershipRenewal.php | 132 +-- civicrm/CRM/Member/Form/Search.php | 16 +- civicrm/CRM/Member/Form/Task/Batch.php | 2 +- .../CRM/Member/Import/Parser/Membership.php | 34 +- civicrm/CRM/Member/Selector/Search.php | 4 +- civicrm/CRM/Member/Tokens.php | 3 + civicrm/CRM/Pledge/BAO/Pledge.php | 2 +- civicrm/CRM/Pledge/BAO/PledgeBlock.php | 6 +- civicrm/CRM/Pledge/BAO/Query.php | 74 +- civicrm/CRM/Pledge/DAO/Pledge.php | 10 +- civicrm/CRM/Pledge/DAO/PledgePayment.php | 3 +- civicrm/CRM/Pledge/Form/Search.php | 19 +- civicrm/CRM/Price/BAO/LineItem.php | 44 +- civicrm/CRM/Price/BAO/PriceField.php | 9 +- civicrm/CRM/Price/BAO/PriceFieldValue.php | 49 +- civicrm/CRM/Price/BAO/PriceSet.php | 55 +- civicrm/CRM/Price/Form/Field.php | 2 +- civicrm/CRM/Price/Form/Option.php | 2 +- civicrm/CRM/Report/Form.php | 11 - .../Report/Form/Contact/LoggingSummary.php | 2 +- civicrm/CRM/Report/Form/Contribute/Detail.php | 2 +- civicrm/CRM/Report/Form/Event/Summary.php | 2 +- .../Report/Form/Member/ContributionDetail.php | 2 +- civicrm/CRM/Report/Form/Member/Detail.php | 2 +- civicrm/CRM/Report/Form/Member/Summary.php | 4 +- .../CRM/Report/Form/Membership/Summary.php | 2 +- civicrm/CRM/Report/Page/InstanceList.php | 5 + .../CRM/Upgrade/Incremental/SmartGroups.php | 16 +- .../Upgrade/Incremental/php/FiveEighteen.php | 177 ++++ .../CRM/Upgrade/Incremental/php/Template.php | 2 +- .../Upgrade/Incremental/sql/5.17.0.mysql.tpl | 1 - .../Upgrade/Incremental/sql/5.17.2.mysql.tpl | 1 - .../Upgrade/Incremental/sql/5.17.3.mysql.tpl | 1 - .../Upgrade/Incremental/sql/5.17.4.mysql.tpl | 1 - .../Upgrade/Incremental/sql/5.17.5.mysql.tpl | 1 - .../Upgrade/Incremental/sql/5.18.0.mysql.tpl | 1 + .../Incremental/sql/5.18.alpha1.mysql.tpl | 1 + .../Incremental/sql/5.18.beta1.mysql.tpl | 1 + civicrm/CRM/Utils/API/ReloadOption.php | 2 +- civicrm/CRM/Utils/Address.php | 2 +- civicrm/CRM/Utils/Array.php | 2 +- civicrm/CRM/Utils/JS.php | 6 +- civicrm/CRM/Utils/System.php | 3 +- civicrm/CRM/Utils/System/Backdrop.php | 3 - civicrm/CRM/Utils/System/Drupal.php | 3 - civicrm/CRM/Utils/System/Drupal6.php | 3 - civicrm/CRM/Utils/System/Drupal8.php | 3 - civicrm/CRM/Utils/System/Joomla.php | 20 - civicrm/CRM/Utils/System/WordPress.php | 13 +- civicrm/Civi/Core/Container.php | 4 +- civicrm/Civi/Test/Api3DocTrait.php | 4 +- civicrm/Civi/Test/GenericAssertionsTrait.php | 45 +- civicrm/ang/crmMailing/BlockMailing.html | 2 +- civicrm/ang/crmMailingAB/BlockMailing.html | 92 +- civicrm/api/v3/Batch.php | 10 +- civicrm/api/v3/Contribution.php | 12 +- civicrm/api/v3/Dedupe.php | 14 +- civicrm/api/v3/Event.php | 7 - civicrm/api/v3/Job.php | 8 +- civicrm/api/v3/LineItem.php | 4 +- civicrm/api/v3/MembershipType.php | 13 + civicrm/api/v3/Order.php | 6 +- civicrm/api/v3/Payment.php | 10 +- civicrm/api/v3/examples/Activity/Get.php | 50 +- .../v3/examples/ActivityContact/Create.php | 12 +- .../v3/examples/ActivityContact/Delete.php | 14 +- .../api/v3/examples/ActivityType/Create.php | 18 +- civicrm/api/v3/examples/ActivityType/Get.php | 35 +- .../api/v3/examples/Address/AddressLike.php | 16 +- .../api/v3/examples/Address/AddressParse.php | 16 +- .../api/v3/examples/Address/AddressSort.php | 20 +- civicrm/api/v3/examples/Address/Create.php | 27 +- civicrm/api/v3/examples/Address/Delete.php | 12 +- civicrm/api/v3/examples/Address/Get.php | 18 +- .../api/v3/examples/Address/GetOptions.php | 12 +- civicrm/api/v3/examples/Batch/Create.php | 12 +- civicrm/api/v3/examples/Batch/Delete.php | 12 +- civicrm/api/v3/examples/Batch/Get.php | 12 +- civicrm/api/v3/examples/Campaign/Create.php | 14 +- civicrm/api/v3/examples/Campaign/Delete.php | 12 +- civicrm/api/v3/examples/Campaign/Get.php | 12 +- civicrm/api/v3/examples/Case/Create.php | 21 +- .../api/v3/examples/CaseContact/Create.php | 78 ++ civicrm/api/v3/examples/CaseContact/Get.php | 12 +- civicrm/api/v3/examples/Constant/Get.php | 17 +- .../v3/examples/Contact/APIChainedArray.php | 43 +- .../Contact/APIChainedArrayFormats.php | 18 +- .../Contact/APIChainedArrayMultipleCustom.php | 16 +- ...IChainedArrayValuesFromSiblingFunction.php | 14 +- .../v3/examples/Contact/ChainTwoWebsites.php | 16 +- .../Contact/ChainTwoWebsitesSyntax2.php | 16 +- .../ContactIDOfLoggedInUserContactAPI.php | 23 +- civicrm/api/v3/examples/Contact/Create.php | 14 +- .../Contact/CreateParticipantPayment.php | 16 +- .../v3/examples/Contact/CustomFieldGet.php | 12 +- .../CustomFieldGetReturnSyntaxVariation.php | 12 +- civicrm/api/v3/examples/Contact/Delete.php | 12 +- .../examples/Contact/FormatIsSuccess_Fail.php | 12 +- .../examples/Contact/FormatIsSuccess_True.php | 14 +- .../api/v3/examples/Contact/FormatOnlyID.php | 16 +- .../v3/examples/Contact/FormatSingleValue.php | 16 +- civicrm/api/v3/examples/Contact/Get.php | 16 +- .../api/v3/examples/Contact/GetActions.php | 57 +- .../v3/examples/Contact/GetCountContact.php | 14 +- .../v3/examples/Contact/GetFieldsOptions.php | 201 +++- .../api/v3/examples/Contact/GetMergedfrom.php | 80 ++ .../api/v3/examples/Contact/GetMergedto.php | 76 ++ .../api/v3/examples/Contact/GetOptions.php | 12 +- .../v3/examples/Contact/GetSingleContact.php | 58 +- civicrm/api/v3/examples/Contact/GetUnique.php | 71 ++ .../Contact/GroupFilterUsingContactAPI.php | 16 +- .../examples/Contact/NestedReplaceEmail.php | 77 +- .../ContributionCreateWithHonoreeContact.php | 19 +- .../ContributionCreateWithNote.php | 17 +- .../ContributionCreateWithSoftCredit.php | 19 +- ...ntributionCreateWithSoftCreditDefaults.php | 19 +- .../api/v3/examples/Contribution/Create.php | 14 +- .../CreateWithNestedLineItems.php | 17 +- .../api/v3/examples/Contribution/Delete.php | 12 +- civicrm/api/v3/examples/Contribution/Get.php | 41 +- .../v3/examples/Contribution/GetUnique.php | 71 ++ .../v3/examples/ContributionPage/Create.php | 13 +- .../v3/examples/ContributionPage/Delete.php | 12 +- .../api/v3/examples/ContributionPage/Get.php | 12 +- .../v3/examples/ContributionPage/Submit.php | 18 +- .../v3/examples/ContributionRecur/Create.php | 13 +- .../v3/examples/ContributionRecur/Delete.php | 12 +- .../api/v3/examples/ContributionRecur/Get.php | 12 +- .../v3/examples/ContributionSoft/Create.php | 12 +- .../v3/examples/ContributionSoft/Delete.php | 19 +- .../api/v3/examples/ContributionSoft/Get.php | 12 +- civicrm/api/v3/examples/Country/Create.php | 12 +- civicrm/api/v3/examples/Country/Delete.php | 12 +- civicrm/api/v3/examples/Country/Get.php | 12 +- .../api/v3/examples/CustomField/Create.php | 12 +- .../api/v3/examples/CustomField/Delete.php | 12 +- .../api/v3/examples/CustomGroup/Create.php | 13 +- .../api/v3/examples/CustomGroup/Delete.php | 12 +- civicrm/api/v3/examples/CustomGroup/Get.php | 13 +- civicrm/api/v3/examples/Domain/Create.php | 16 +- civicrm/api/v3/examples/Domain/Get.php | 16 +- civicrm/api/v3/examples/Email/Create.php | 33 +- civicrm/api/v3/examples/Email/Delete.php | 14 +- civicrm/api/v3/examples/Email/Replace.php | 74 +- .../api/v3/examples/EntityBatch/Create.php | 12 +- .../api/v3/examples/EntityBatch/Delete.php | 12 +- civicrm/api/v3/examples/EntityBatch/Get.php | 12 +- civicrm/api/v3/examples/EntityTag/Delete.php | 16 +- civicrm/api/v3/examples/EntityTag/Get.php | 18 +- .../examples/Event/ContactRefCustomField.php | 12 +- civicrm/api/v3/examples/Event/Create.php | 12 +- civicrm/api/v3/examples/Event/Delete.php | 12 +- civicrm/api/v3/examples/Event/Get.php | 12 +- .../api/v3/examples/Event/IsCurrentOption.php | 12 +- .../api/v3/examples/Event/IsFullOption.php | 14 +- civicrm/api/v3/examples/Grant/Create.php | 12 +- civicrm/api/v3/examples/Grant/Delete.php | 12 +- civicrm/api/v3/examples/Grant/Get.php | 14 +- civicrm/api/v3/examples/Group/Get.php | 24 +- civicrm/api/v3/examples/Group/GetFields.php | 84 +- .../api/v3/examples/GroupContact/Create.php | 12 +- .../api/v3/examples/GroupContact/Delete.php | 12 +- civicrm/api/v3/examples/GroupContact/Get.php | 12 +- .../examples/GroupContact/GetWithGroupID.php | 18 +- .../api/v3/examples/GroupNesting/Create.php | 20 +- .../api/v3/examples/GroupNesting/Delete.php | 12 +- civicrm/api/v3/examples/GroupNesting/Get.php | 12 +- .../v3/examples/GroupOrganization/Create.php | 22 +- .../v3/examples/GroupOrganization/Delete.php | 12 +- .../api/v3/examples/GroupOrganization/Get.php | 12 +- civicrm/api/v3/examples/Im/Create.php | 25 +- civicrm/api/v3/examples/Im/Delete.php | 14 +- civicrm/api/v3/examples/Im/Get.php | 22 +- civicrm/api/v3/examples/Job/Clone.php | 83 ++ civicrm/api/v3/examples/Job/Create.php | 12 +- civicrm/api/v3/examples/Job/Delete.php | 14 +- civicrm/api/v3/examples/LineItem/Create.php | 12 +- civicrm/api/v3/examples/LineItem/Delete.php | 12 +- civicrm/api/v3/examples/LineItem/Get.php | 12 +- civicrm/api/v3/examples/LocBlock/Create.php | 12 +- .../v3/examples/LocBlock/CreateEntities.php | 14 +- civicrm/api/v3/examples/LocBlock/Get.php | 12 +- civicrm/api/v3/examples/Logging/Get.php | 52 +- civicrm/api/v3/examples/Logging/Revert.php | 16 +- .../MailSettings/ChainedGetDelete.php | 33 +- .../api/v3/examples/MailSettings/Create.php | 17 +- .../api/v3/examples/MailSettings/Delete.php | 12 +- civicrm/api/v3/examples/MailSettings/Get.php | 15 +- .../v3/examples/MailSettings/GetOptions.php | 12 +- civicrm/api/v3/examples/Mailing/Clone.php | 27 +- civicrm/api/v3/examples/Mailing/Create.php | 73 +- civicrm/api/v3/examples/Mailing/Delete.php | 14 +- civicrm/api/v3/examples/Mailing/GetTokens.php | 19 +- civicrm/api/v3/examples/Mailing/Submit.php | 29 +- civicrm/api/v3/examples/MailingAB/Create.php | 14 +- .../examples/MailingEventSubscribe/Create.php | 12 +- civicrm/api/v3/examples/Mapping/Create.php | 12 +- civicrm/api/v3/examples/Mapping/Delete.php | 12 +- civicrm/api/v3/examples/Mapping/Get.php | 12 +- .../api/v3/examples/MappingField/Create.php | 12 +- .../api/v3/examples/MappingField/Delete.php | 12 +- civicrm/api/v3/examples/MappingField/Get.php | 12 +- civicrm/api/v3/examples/Membership/Create.php | 25 +- .../Membership/CreateWithCustomData.php | 25 +- civicrm/api/v3/examples/Membership/Delete.php | 12 +- .../examples/Membership/FilterIsCurrent.php | 20 +- civicrm/api/v3/examples/Membership/Get.php | 20 +- .../Membership/SearchWithCustomData.php | 25 +- .../examples/Membership/UpdateCustomData.php | 25 +- .../v3/examples/MembershipPayment/Create.php | 12 +- .../api/v3/examples/MembershipPayment/Get.php | 12 +- .../v3/examples/MembershipStatus/Create.php | 12 +- .../api/v3/examples/MembershipStatus/Get.php | 12 +- .../api/v3/examples/MembershipType/Create.php | 12 +- .../api/v3/examples/MembershipType/Delete.php | 14 +- .../api/v3/examples/MembershipType/Get.php | 14 +- .../v3/examples/MessageTemplate/Create.php | 32 +- .../v3/examples/MessageTemplate/Delete.php | 12 +- .../api/v3/examples/MessageTemplate/Get.php | 36 +- civicrm/api/v3/examples/Note/Create.php | 26 +- civicrm/api/v3/examples/Note/Delete.php | 14 +- civicrm/api/v3/examples/Note/Get.php | 14 +- civicrm/api/v3/examples/OpenID/Create.php | 25 +- civicrm/api/v3/examples/OpenID/Delete.php | 14 +- civicrm/api/v3/examples/OpenID/Get.php | 22 +- .../api/v3/examples/OptionGroup/Create.php | 18 +- .../api/v3/examples/OptionGroup/Delete.php | 14 +- civicrm/api/v3/examples/OptionGroup/Get.php | 12 +- civicrm/api/v3/examples/OptionValue/Get.php | 12 +- .../v3/examples/OptionValue/SortOption.php | 12 +- civicrm/api/v3/examples/Order/Cancel.php | 15 +- civicrm/api/v3/examples/Order/Create.php | 23 +- .../examples/Order/CreateOrderParticipant.php | 21 +- civicrm/api/v3/examples/Order/Delete.php | 12 +- civicrm/api/v3/examples/Order/Get.php | 41 +- .../api/v3/examples/Participant/Create.php | 16 +- civicrm/api/v3/examples/Participant/Get.php | 13 +- .../v3/examples/Participant/NestedDelete.php | 18 +- .../examples/Participant/NestedEventGet.php | 15 +- .../v3/examples/ParticipantPayment/Create.php | 12 +- .../v3/examples/ParticipantPayment/Delete.php | 14 +- .../v3/examples/ParticipantPayment/Get.php | 26 +- .../examples/ParticipantStatusType/Create.php | 12 +- .../examples/ParticipantStatusType/Delete.php | 12 +- .../v3/examples/ParticipantStatusType/Get.php | 12 +- civicrm/api/v3/examples/Payment/Cancel.php | 20 +- civicrm/api/v3/examples/Payment/Create.php | 14 +- .../Payment/CreatePaymentWithLineItems.php | 14 +- civicrm/api/v3/examples/Payment/Delete.php | 12 +- civicrm/api/v3/examples/Payment/Get.php | 12 +- .../api/v3/examples/Payment/UpdatePayment.php | 14 +- .../v3/examples/PaymentProcessor/Create.php | 21 +- .../v3/examples/PaymentProcessor/Delete.php | 14 +- .../examples/PaymentProcessorType/Create.php | 12 +- .../examples/PaymentProcessorType/Delete.php | 12 +- .../api/v3/examples/PaymentToken/Create.php | 12 +- .../api/v3/examples/PaymentToken/Delete.php | 12 +- civicrm/api/v3/examples/PaymentToken/Get.php | 12 +- .../api/v3/examples/Pcp/ChainedGetDelete.php | 114 +++ civicrm/api/v3/examples/Pcp/Create.php | 12 +- civicrm/api/v3/examples/Pcp/Delete.php | 70 ++ civicrm/api/v3/examples/Pcp/Get.php | 89 ++ civicrm/api/v3/examples/Phone/Create.php | 27 +- civicrm/api/v3/examples/Phone/Delete.php | 14 +- civicrm/api/v3/examples/Phone/Get.php | 24 +- civicrm/api/v3/examples/Phone/GetOptions.php | 12 +- civicrm/api/v3/examples/Pledge/Create.php | 23 +- civicrm/api/v3/examples/Pledge/Delete.php | 12 +- civicrm/api/v3/examples/Pledge/Get.php | 18 +- .../v3/examples/Pledge/GetFilterHighDate.php | 20 +- .../api/v3/examples/PledgePayment/Create.php | 14 +- .../api/v3/examples/PledgePayment/Delete.php | 12 +- civicrm/api/v3/examples/PledgePayment/Get.php | 12 +- .../api/v3/examples/PledgePayment/Update.php | 12 +- civicrm/api/v3/examples/PriceField/Create.php | 12 +- civicrm/api/v3/examples/PriceField/Delete.php | 12 +- civicrm/api/v3/examples/PriceField/Get.php | 12 +- .../v3/examples/PriceFieldValue/Create.php | 13 +- .../v3/examples/PriceFieldValue/Delete.php | 12 +- .../api/v3/examples/PriceFieldValue/Get.php | 15 +- civicrm/api/v3/examples/PriceSet/Create.php | 18 +- civicrm/api/v3/examples/PriceSet/Delete.php | 14 +- civicrm/api/v3/examples/PriceSet/Get.php | 12 +- civicrm/api/v3/examples/Profile/Apply.php | 20 +- civicrm/api/v3/examples/Profile/Get.php | 14 +- civicrm/api/v3/examples/Profile/GetFields.php | 47 +- civicrm/api/v3/examples/Profile/Submit.php | 24 +- .../v3/examples/RelationshipType/Create.php | 12 +- .../v3/examples/RelationshipType/Delete.php | 12 +- .../v3/examples/ReportTemplate/Getrows.php | 82 +- .../examples/ReportTemplate/Getstatistics.php | 24 +- .../api/v3/examples/SavedSearch/Create.php | 18 +- .../api/v3/examples/SavedSearch/Delete.php | 12 +- civicrm/api/v3/examples/SavedSearch/Get.php | 12 +- civicrm/api/v3/examples/Setting/Create.php | 12 +- .../v3/examples/Setting/CreateAllDomains.php | 12 +- .../Setting/CreateSettingCurrentDomain.php | 12 +- .../Setting/CreateSpecifiedDomains.php | 12 +- civicrm/api/v3/examples/Setting/Get.php | 12 +- .../api/v3/examples/Setting/GetAllDomains.php | 12 +- .../api/v3/examples/Setting/GetDefaults.php | 12 +- civicrm/api/v3/examples/Setting/GetFields.php | 610 +++++++++--- .../Setting/GetSettingCurrentDomain.php | 12 +- .../examples/Setting/GetSpecifiedDomains.php | 12 +- civicrm/api/v3/examples/Setting/GetValue.php | 12 +- civicrm/api/v3/examples/Setting/Revert.php | 12 +- .../api/v3/examples/StateProvince/Create.php | 18 +- .../api/v3/examples/StateProvince/Delete.php | 14 +- civicrm/api/v3/examples/StateProvince/Get.php | 18 +- .../v3/examples/StatusPreference/Create.php | 12 +- .../v3/examples/StatusPreference/Delete.php | 12 +- .../api/v3/examples/StatusPreference/Get.php | 12 +- .../v3/examples/Survey/ChainedGetDelete.php | 12 +- civicrm/api/v3/examples/Survey/Create.php | 12 +- civicrm/api/v3/examples/Survey/Delete.php | 12 +- civicrm/api/v3/examples/Survey/Get.php | 12 +- .../api/v3/examples/SurveyRespondant/Get.php | 12 +- civicrm/api/v3/examples/System/Flush.php | 12 +- civicrm/api/v3/examples/Tag/Create.php | 24 +- civicrm/api/v3/examples/Tag/Delete.php | 14 +- civicrm/api/v3/examples/Tag/Get.php | 20 +- civicrm/api/v3/examples/Tag/GetFields.php | 46 +- civicrm/api/v3/examples/Tag/GetList.php | 14 +- .../api/v3/examples/Tag/GetReturnArray.php | 20 +- civicrm/api/v3/examples/UFField/Create.php | 12 +- civicrm/api/v3/examples/UFField/Delete.php | 12 +- civicrm/api/v3/examples/UFField/Get.php | 12 +- civicrm/api/v3/examples/UFField/Replace.php | 12 +- civicrm/api/v3/examples/UFGroup/Create.php | 16 +- civicrm/api/v3/examples/UFGroup/Delete.php | 12 +- civicrm/api/v3/examples/UFGroup/Get.php | 13 +- civicrm/api/v3/examples/UFJoin/Create.php | 12 +- civicrm/api/v3/examples/UFJoin/Get.php | 12 +- civicrm/api/v3/examples/UFMatch/Get.php | 12 +- civicrm/api/v3/examples/User/Get.php | 78 ++ civicrm/api/v3/examples/User/GetFields.php | 87 ++ civicrm/api/v3/examples/Website/Create.php | 12 +- civicrm/api/v3/examples/Website/Delete.php | 12 +- civicrm/api/v3/examples/Website/Get.php | 16 +- civicrm/api/v3/examples/Website/GetFields.php | 23 +- .../v3/examples/Website/GetWithMetadata.php | 23 +- civicrm/bower.json | 44 - .../angular-bootstrap/.bower.json | 31 - ...trap-02435d2082ac71ec4f13fbdf2f4d3e1a.json | 4 + .../angular-file-upload/.bower.json | 30 - ...load-e60440287b4df1cbc04045e77a8c05f5.json | 4 + .../angular-jquery-dialog-service/.bower.json | 13 - ...vice-1e0a7077e80f08e2a94cb4baa0a72f72.json | 4 + .../angular-mocks/.bower.json | 20 - ...ocks-f6200e65f802695e672eba66b582c642.json | 4 + .../angular-route/.bower.json | 20 - ...oute-e3ac2d15fca8a7bc6c303335035b7ec6.json | 4 + .../angular-sanitize/.bower.json | 20 - ...tize-2e0dffb0d66d69809f64b5824d8df7ec.json | 4 + .../angular-ui-sortable/.bower.json | 19 - ...able-c3c4e428641d501819195be170cbe824.json | 4 + .../angular-ui-utils/.bower.json | 18 - ...tils-74b1ad1150f4c22741f9e1e45a4f92cd.json | 4 + .../angular-unsavedChanges/.bower.json | 49 - ...nges-6731bbc27c37c58c64ec4701b2519568.json | 4 + .../angular-xeditable/.bower.json | 55 -- ...able-9b1e32a8b3e1d76027b3a4167ab2ff58.json | 4 + civicrm/bower_components/angular/.bower.json | 18 - ...ular-d18b8624a0f5f721da7b82365fc562dd.json | 4 + .../checklist-model/.bower.json | 30 - ...odel-71a4c0cb1382f152af0850bd2adbb843.json | 4 + civicrm/bower_components/ckeditor/.bower.json | 29 - ...itor-55ec7732cc4d2d985134a433fa86a610.json | 4 + .../crossfilter-1.3.x/.bower.json | 38 - ....3.x-7acfcad9e23c80333653a6e5d55428e5.json | 4 + .../bower_components/crossfilter2/.bower.json | 38 - ...ter2-cfc7aab525b6a272826f0d7b1046426e.json | 4 + .../css-color-names/.bower.json | 14 - ...ames-54216149e268d2a17ad72fce05bfdc93.json | 4 + civicrm/bower_components/d3-3.5.x/.bower.json | 18 - ....5.x-3ba96c298dad99990feb13a2bc313897.json | 4 + civicrm/bower_components/d3/.bower.json | 34 - .../d3-e53125275854402400f74fd6ab3f7659.json | 4 + .../bower_components/datatables/.bower.json | 42 - ...bles-06669348abd69fdff10f03f7c7ff1571.json | 4 + civicrm/bower_components/dc-2.1.x/.bower.json | 38 - ....1.x-ea78359606fb2b93565a6497513116e7.json | 4 + civicrm/bower_components/dc-2.1.x/bower.json | 24 - .../bower_components/es6-promise/.bower.json | 31 - ...mise-60df2490a63990439db23398a56349b2.json | 4 + .../bower_components/font-awesome/.bower.json | 36 - ...some-32b121f1e564c015b458c30a6337ac1b.json | 4 + .../bower_components/font-awesome/bower.json | 22 - .../google-code-prettify/.bower.json | 26 - ...tify-8b46b49e999a9774c040fd46f81a68a5.json | 4 + .../bower_components/jquery-ui/.bower.json | 22 - ...y-ui-f4e47df9c6fa2e82f5987f78dc64c392.json | 4 + .../jquery-validation/.bower.json | 40 - ...tion-134dc18b66d427be700a9e1241688102.json | 4 + civicrm/bower_components/jquery/.bower.json | 14 - ...uery-d223e1439188e478349d52476506c22e.json | 4 + civicrm/bower_components/jstree/.bower.json | 43 - ...tree-50d46fdfc87493925fbba33deede1c4b.json | 4 + civicrm/bower_components/jstree/bower.json | 33 - .../lodash-compat/.bower.json | 23 - ...mpat-bf9d53c8a06b2909c0053b89d9bcce3b.json | 4 + .../phantomjs-polyfill/.bower.json | 14 - ...fill-dce4e52b3d79fc404e0b05c8674afd11.json | 4 + civicrm/bower_components/qunit/.bower.json | 14 - ...unit-4f8ae0790a302e5ed86ca7b079f3ab20.json | 4 + civicrm/bower_components/select2/.bower.json | 23 - ...ect2-35368a19f307e4af02d0df055846840d.json | 4 + .../bower_components/smartmenus/.bower.json | 58 -- ...enus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json | 4 + civicrm/civicrm-version.php | 2 +- civicrm/composer.json | 117 +++ civicrm/composer.lock | 86 +- civicrm/css/joomla.css | 3 - civicrm/ext/api4/CRM/Api4/Page/AJAX.php | 12 +- .../ext/api4/CRM/Api4/Page/Api4Explorer.php | 6 +- civicrm/ext/api4/CRM/Api4/Services.php | 75 ++ civicrm/ext/api4/CRM/Api4/Upgrader.php | 24 +- .../Api4/Action/Address/AddressSaveTrait.php | 50 + .../api4/Civi/Api4/Action/Address/Create.php | 34 +- .../api4/Civi/Api4/Action/Address/Save.php | 11 + .../api4/Civi/Api4/Action/Address/Update.php | 34 +- .../api4/Civi/Api4/Action/Campaign/Get.php | 12 + .../api4/Civi/Api4/Action/Contact/Create.php | 22 - .../Civi/Api4/Action/Contact/GetChecksum.php | 45 + .../Api4/Action/Contact/ValidateChecksum.php | 42 + .../Civi/Api4/Action/Contribution/Create.php | 18 - .../Api4/Action/CustomValue/GetFields.php | 5 +- .../Civi/Api4/Action/CustomValue/Save.php | 11 + .../ext/api4/Civi/Api4/Action/Domain/Get.php | 27 + .../ext/api4/Civi/Api4/Action/Entity/Get.php | 4 +- .../api4/Civi/Api4/Action/Entity/GetLinks.php | 6 +- .../ext/api4/Civi/Api4/Action/Event/Get.php | 12 + .../ext/api4/Civi/Api4/Action/GetActions.php | 20 +- .../Civi/Api4/Action/GroupContact/Create.php | 29 +- .../GroupContact/GroupContactSaveTrait.php | 40 + .../Civi/Api4/Action/GroupContact/Save.php | 11 + .../Civi/Api4/Action/GroupContact/Update.php | 29 +- .../api4/Civi/Api4/Action/Navigation/Get.php | 19 - .../api4/Civi/Api4/Action/Participant/Get.php | 18 - .../Civi/Api4/Action/Relationship/Get.php | 12 + .../Action/Setting/AbstractSettingAction.php | 80 ++ .../ext/api4/Civi/Api4/Action/Setting/Get.php | 55 ++ .../Civi/Api4/Action/Setting/GetFields.php | 84 ++ .../api4/Civi/Api4/Action/Setting/Revert.php | 46 + .../ext/api4/Civi/Api4/Action/Setting/Set.php | 44 + .../api4/Civi/Api4/Action/System/Check.php | 83 ++ .../api4/Civi/Api4/Action/System/Flush.php | 32 + civicrm/ext/api4/Civi/Api4/Address.php | 7 + civicrm/ext/api4/Civi/Api4/Campaign.php | 19 + civicrm/ext/api4/Civi/Api4/Contact.php | 22 +- civicrm/ext/api4/Civi/Api4/Contribution.php | 7 - .../ext/api4/Civi/Api4/ContributionPage.php | 12 + civicrm/ext/api4/Civi/Api4/CustomValue.php | 8 + civicrm/ext/api4/Civi/Api4/Domain.php | 16 + civicrm/ext/api4/Civi/Api4/Entity.php | 2 +- civicrm/ext/api4/Civi/Api4/EntityTag.php | 12 + civicrm/ext/api4/Civi/Api4/Event.php | 7 + .../ext/api4/Civi/Api4/Event/GetSpecEvent.php | 6 +- .../Civi/Api4/Event/PostSelectQueryEvent.php | 8 +- .../Civi/Api4/Event/SchemaMapBuildEvent.php | 8 +- .../ActivityPreCreationSubscriber.php | 7 +- .../ActivitySchemaMapSubscriber.php | 6 +- .../Subscriber/ContactPreSaveSubscriber.php | 25 + .../Subscriber/ContactSchemaMapSubscriber.php | 8 +- .../ContributionPreSaveSubscriber.php | 18 + .../CustomFieldPreCreationSubscriber.php | 91 -- .../CustomFieldPreSaveSubscriber.php | 38 + .../CustomGroupPreCreationSubscriber.php | 5 +- .../AbstractPrepareSubscriber.php | 5 +- .../{ => Generic}/PreCreationSubscriber.php | 11 +- .../Subscriber/Generic/PreSaveSubscriber.php | 54 ++ .../Event/Subscriber/IsCurrentSubscriber.php | 39 + .../OptionValuePreCreationSubscriber.php | 8 +- .../Subscriber/PermissionCheckSubscriber.php | 1 + .../Subscriber/PostSelectQuerySubscriber.php | 27 +- .../Subscriber/ValidateFieldsSubscriber.php | 7 +- .../api4/Civi/Api4/Generic/AbstractAction.php | 147 ++- .../Civi/Api4/Generic/AbstractBatchAction.php | 2 +- .../Api4/Generic/AbstractCreateAction.php | 18 +- .../api4/Civi/Api4/Generic/AbstractEntity.php | 3 +- .../Civi/Api4/Generic/AbstractGetAction.php | 98 +- .../Civi/Api4/Generic/AbstractQueryAction.php | 39 + .../Civi/Api4/Generic/AbstractSaveAction.php | 90 ++ .../Civi/Api4/Generic/BasicBatchAction.php | 1 + .../api4/Civi/Api4/Generic/BasicGetAction.php | 62 +- .../Api4/Generic/BasicGetFieldsAction.php | 56 +- .../Civi/Api4/Generic/BasicReplaceAction.php | 83 +- .../Civi/Api4/Generic/BasicSaveAction.php | 79 ++ .../Civi/Api4/Generic/BasicUpdateAction.php | 6 + .../Civi/Api4/Generic/DAOCreateAction.php | 22 - .../Civi/Api4/Generic/DAODeleteAction.php | 12 +- .../ext/api4/Civi/Api4/Generic/DAOEntity.php | 7 + .../api4/Civi/Api4/Generic/DAOGetAction.php | 3 +- .../Civi/Api4/Generic/DAOGetFieldsAction.php | 7 +- .../api4/Civi/Api4/Generic/DAOSaveAction.php | 32 + .../Civi/Api4/Generic/DAOUpdateAction.php | 37 +- civicrm/ext/api4/Civi/Api4/Generic/Result.php | 26 + .../Generic/Traits/ArrayQueryActionTrait.php | 8 +- .../Generic/Traits/CustomValueActionTrait.php | 15 +- .../Api4/Generic/Traits/DAOActionTrait.php | 74 +- .../Api4/Generic/Traits/IsCurrentTrait.php | 40 + civicrm/ext/api4/Civi/Api4/GroupContact.php | 7 + civicrm/ext/api4/Civi/Api4/GroupNesting.php | 11 + .../ext/api4/Civi/Api4/GroupOrganization.php | 11 + civicrm/ext/api4/Civi/Api4/LocationType.php | 12 + civicrm/ext/api4/Civi/Api4/MailSettings.php | 12 + civicrm/ext/api4/Civi/Api4/Mapping.php | 14 + civicrm/ext/api4/Civi/Api4/MappingField.php | 14 + civicrm/ext/api4/Civi/Api4/Navigation.php | 7 - civicrm/ext/api4/Civi/Api4/Participant.php | 9 +- .../Api4/Provider/ActionObjectProvider.php | 19 +- .../api4/Civi/Api4/Query/Api4SelectQuery.php | 69 +- civicrm/ext/api4/Civi/Api4/Relationship.php | 7 + .../api4/Civi/Api4/Result/ReplaceResult.php | 10 + civicrm/ext/api4/Civi/Api4/Route.php | 76 ++ .../Schema/Joinable/CustomGroupJoinable.php | 6 +- .../Api4/Service/Schema/Joinable/Joinable.php | 8 +- .../api4/Civi/Api4/Service/Schema/Joiner.php | 9 +- .../Civi/Api4/Service/Schema/SchemaMap.php | 7 +- .../Api4/Service/Schema/SchemaMapBuilder.php | 10 +- .../api4/Civi/Api4/Service/Schema/Table.php | 10 +- .../api4/Civi/Api4/Service/Spec/FieldSpec.php | 55 +- .../Spec/Provider/ACLCreationSpecProvider.php | 23 + .../ActionScheduleCreationSpecProvider.php | 4 +- .../Provider/ActivityCreationSpecProvider.php | 3 +- .../Provider/AddressCreationSpecProvider.php | 6 +- .../Provider/CampaignCreationSpecProvider.php | 24 + .../Provider/ContactCreationSpecProvider.php | 5 +- .../ContactTypeCreationSpecProvider.php | 4 +- .../ContributionCreationSpecProvider.php | 3 +- .../CustomFieldCreationSpecProvider.php | 28 + .../CustomGroupCreationSpecProvider.php | 5 +- .../Spec/Provider/CustomValueSpecProvider.php | 2 +- .../Provider/DefaultLocationTypeProvider.php | 27 + .../Provider/DomainCreationSpecProvider.php | 24 + .../Provider/EmailCreationSpecProvider.php | 3 +- .../EntityTagCreationSpecProvider.php | 26 + .../Provider/EventCreationSpecProvider.php | 15 +- .../{ => Generic}/SpecProviderInterface.php | 5 +- .../Provider/GetActionDefaultsProvider.php | 33 + .../Provider/GroupCreationSpecProvider.php | 3 +- .../Provider/MappingCreationSpecProvider.php | 28 + .../Spec/Provider/NavigationSpecProvider.php | 25 + .../Provider/NoteCreationSpecProvider.php | 5 +- .../OptionValueCreationSpecProvider.php | 3 +- .../Provider/PhoneCreationSpecProvider.php | 4 +- .../RelationshipTypeCreationSpecProvider.php | 24 + .../StatusPreferenceCreationSpecProvider.php | 23 + .../Spec/Provider/TagCreationSpecProvider.php | 26 + .../Provider/UFFieldCreationSpecProvider.php | 23 + ...er.php => UFMatchCreationSpecProvider.php} | 5 +- .../Civi/Api4/Service/Spec/SpecFormatter.php | 115 ++- .../Civi/Api4/Service/Spec/SpecGatherer.php | 29 +- civicrm/ext/api4/Civi/Api4/Setting.php | 30 + .../ext/api4/Civi/Api4/StatusPreference.php | 12 + civicrm/ext/api4/Civi/Api4/System.php | 28 + civicrm/ext/api4/Civi/Api4/Tag.php | 15 + civicrm/ext/api4/Civi/Api4/UFField.php | 12 + civicrm/ext/api4/Civi/Api4/UFMatch.php | 12 + .../Civi/Api4/Utils/ArrayInsertionUtil.php | 1 + civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php | 17 +- .../api4/Civi/Api4/Utils/FormattingUtil.php | 10 - .../api4/Civi/Api4/Utils/ReflectionUtils.php | 23 +- civicrm/ext/api4/Civi/Api4/services.xml | 26 + civicrm/ext/api4/ang/api4Explorer.ang.php | 2 +- .../ext/api4/ang/api4Explorer/Explorer.html | 31 +- civicrm/ext/api4/ang/api4Explorer/Explorer.js | 343 ++++--- civicrm/ext/api4/api4.php | 118 +-- civicrm/ext/api4/css/explorer.css | 4 + civicrm/ext/api4/info.xml | 6 +- civicrm/ext/api4/services.xml | 122 --- .../phpunit/Action/UpdateContactTest.php | 34 - .../v4}/Action/BaseCustomValueTest.php | 8 +- .../{ => api/v4}/Action/BasicActionsTest.php | 81 +- .../v4}/Action/BasicCustomFieldTest.php | 2 +- .../phpunit/{ => api/v4}/Action/ChainTest.php | 6 +- .../{ => api/v4}/Action/ComplexQueryTest.php | 4 +- .../{ => api/v4}/Action/ContactApiKeyTest.php | 58 +- .../api/v4/Action/ContactChecksumTest.php | 56 ++ .../phpunit/api/v4/Action/ContactGetTest.php | 42 + .../v4}/Action/CreateCustomValueTest.php | 4 +- .../v4}/Action/CreateWithOptionGroupTest.php | 10 +- .../api/v4/Action/CurrentFilterTest.php | 71 ++ .../v4}/Action/CustomValuePerformanceTest.php | 4 +- .../{ => api/v4}/Action/CustomValueTest.php | 22 +- .../phpunit/{ => api/v4}/Action/DateTest.php | 4 +- .../v4}/Action/EvaluateConditionTest.php | 4 +- .../v4}/Action/ExtendFromIndividualTest.php | 5 +- .../{ => api/v4}/Action/FkJoinTest.php | 4 +- .../v4}/Action/GetExtraFieldsTest.php | 4 +- .../{ => api/v4}/Action/GetFromArrayTest.php | 4 +- .../phpunit/{ => api/v4}/Action/IndexTest.php | 4 +- .../{ => api/v4}/Action/NullValueTest.php | 4 +- .../{ => api/v4}/Action/ReplaceTest.php | 10 +- .../api/v4/Action/RequiredFieldTest.php | 24 + .../api/v4/Action/UpdateContactTest.php | 54 ++ .../v4}/Action/UpdateCustomValueTest.php | 4 +- .../api4/tests/phpunit/api/v4/AllTests.php | 68 ++ .../v4}/DataSets/ConformanceTest.json | 16 +- .../{ => api/v4}/DataSets/DefaultDataSet.json | 0 .../v4}/DataSets/MultiContactMultiEmail.json | 0 .../{ => api/v4}/DataSets/SingleContact.json | 0 .../{ => api/v4}/Entity/ConformanceTest.php | 76 +- .../{ => api/v4}/Entity/ContactJoinTest.php | 4 +- .../{ => api/v4}/Entity/EntityTest.php | 4 +- .../{ => api/v4}/Entity/ParticipantTest.php | 51 +- .../tests/phpunit/api/v4/Entity/RouteTest.php | 21 + .../phpunit/api/v4/Entity/SettingTest.php | 36 + .../Mock/Api4/Action/MockArrayEntity/Get.php | 0 .../v4}/Mock/Api4/MockArrayEntity.php | 1 + .../v4}/Mock/Api4/MockBasicEntity.php | 21 +- .../v4}/Mock/MockEntityDataStorage.php | 7 +- .../v4}/Mock/MockV4ReflectionBase.php | 2 +- .../v4}/Mock/MockV4ReflectionChild.php | 2 +- .../v4}/Mock/MockV4ReflectionGrandchild.php | 3 +- .../Query/Api4SelectQueryComplexJoinTest.php | 16 +- .../v4}/Query/Api4SelectQueryTest.php | 12 +- .../{ => api/v4}/Query/OneToOneJoinTest.php | 8 +- .../v4}/Query/OptionValueJoinTest.php | 6 +- .../v4}/Query/SelectQueryMultiJoinTest.php | 11 +- .../Service/Schema/SchemaMapRealTableTest.php | 5 +- .../v4}/Service/Schema/SchemaMapperTest.php | 4 +- .../Service/TestCreationParameterProvider.php | 42 +- .../{ => api/v4}/Spec/RequestSpecTest.php | 4 +- .../{ => api/v4}/Spec/SpecFormatterTest.php | 19 +- .../{ => api/v4}/Spec/SpecGathererTest.php | 17 +- .../v4}/Traits/OptionCleanupTrait.php | 2 +- .../{ => api/v4}/Traits/QueryCounterTrait.php | 4 +- .../{ => api/v4}/Traits/TableDropperTrait.php | 3 +- .../v4}/Traits/TestDataLoaderTrait.php | 2 +- .../phpunit/{ => api/v4}/UnitTestCase.php | 18 +- .../v4}/Utils/ArrayInsertionServiceTest.php | 14 +- .../v4}/Utils/ReflectionUtilsTest.php | 6 +- .../tests/{ => phpunit/api/v4}/services.xml | 2 +- civicrm/ext/api4/tests/phpunit/bootstrap.php | 4 +- civicrm/packages/DB/DataObject.php | 11 +- .../packages/HTML/QuickForm/hierselect.php | 5 +- civicrm/release-notes.md | 11 + civicrm/release-notes/5.18.0.md | 876 ++++++++++++++++++ civicrm/sql/civicrm.mysql | 10 +- civicrm/sql/civicrm_data.mysql | 10 +- civicrm/sql/civicrm_generated.mysql | 6 +- civicrm/sql/civicrm_navigation.mysql | 6 +- .../templates/CRM/Activity/Form/Activity.tpl | 4 +- civicrm/templates/CRM/Grant/Form/Grant.tpl | 2 - civicrm/templates/CRM/Group/Form/Search.tpl | 2 +- civicrm/templates/CRM/Mailing/Form/Search.tpl | 55 +- .../CRM/Member/Form/Search/Common.tpl | 65 +- .../templates/CRM/Member/Form/Selector.tpl | 2 +- .../CRM/Pledge/Form/Search/Common.tpl | 8 +- .../templates/CRM/Price/Form/Calculate.tpl | 73 +- .../CRM/Report/Form/Contact/Detail.tpl | 7 + .../CRM/Report/Form/Tabs/OrderBy.tpl | 4 +- civicrm/templates/CRM/common/customData.tpl | 7 +- .../templates/CRM/common/customDataBlock.tpl | 5 +- civicrm/templates/CRM/common/fatal.tpl | 4 +- civicrm/vendor/autoload.php | 2 +- .../composer-downloads-plugin/.gitignore | 3 + .../composer-downloads-plugin/.php_cs.dist | 22 + .../civicrm/composer-downloads-plugin/LICENSE | 20 + .../composer-downloads-plugin/README.md | 94 ++ .../composer-downloads-plugin/circle.yml | 24 + .../composer-downloads-plugin/composer.json | 40 + .../composer-downloads-plugin/phpunit.xml | 16 + .../src/DownloadsParser.php | 76 ++ .../src/GlobCleaner.php | 57 ++ .../src/Handler/ArchiveHandler.php | 65 ++ .../src/Handler/BaseHandler.php | 114 +++ .../src/Handler/FileHandler.php | 63 ++ .../src/Handler/PharHandler.php | 28 + .../composer-downloads-plugin/src/Plugin.php | 131 +++ .../src/Subpackage.php | 48 + .../vendor/composer/autoload_namespaces.php | 1 + civicrm/vendor/composer/autoload_psr4.php | 1 + civicrm/vendor/composer/autoload_real.php | 14 +- civicrm/vendor/composer/autoload_static.php | 24 +- civicrm/vendor/composer/installed.json | 88 ++ civicrm/vendor/togos/gitignore/.gitignore | 2 + civicrm/vendor/togos/gitignore/Makefile | 13 + civicrm/vendor/togos/gitignore/composer.json | 27 + .../main/php/TOGoS/GitIgnore/FileFinder.php | 42 + .../src/main/php/TOGoS/GitIgnore/Pattern.php | 56 ++ .../src/main/php/TOGoS/GitIgnore/Rule.php | 33 + .../src/main/php/TOGoS/GitIgnore/Ruleset.php | 51 + .../src/main/php/TOGoS/GitIgnore/Util.php | 17 + civicrm/xml/schema/ACL/Cache.xml | 2 +- civicrm/xml/schema/Contact/Contact.xml | 12 + civicrm/xml/schema/Core/ActionLog.xml | 2 +- civicrm/xml/schema/Core/Address.xml | 3 +- civicrm/xml/schema/Core/Cache.xml | 8 + civicrm/xml/schema/Core/Dashboard.xml | 1 + civicrm/xml/schema/Member/Membership.xml | 6 + civicrm/xml/schema/Pledge/Pledge.xml | 29 +- civicrm/xml/schema/Pledge/PledgePayment.xml | 3 + civicrm/xml/templates/civicrm_data.tpl | 2 +- civicrm/xml/templates/civicrm_navigation.tpl | 6 +- civicrm/xml/version.xml | 2 +- wp-rest/.editorconfig | 9 - wp-rest/Autoloader.php | 115 --- wp-rest/Civi/Mailing-Hooks.php | 136 --- wp-rest/Controller/AuthorizeIPN.php | 123 --- wp-rest/Controller/Base.php | 107 --- wp-rest/Controller/Cxn.php | 125 --- wp-rest/Controller/Open.php | 129 --- wp-rest/Controller/PayPalIPN.php | 134 --- wp-rest/Controller/PxIPN.php | 139 --- wp-rest/Controller/Rest.php | 522 ----------- wp-rest/Controller/Soap.php | 98 -- wp-rest/Controller/Url.php | 214 ----- wp-rest/Controller/Widget.php | 214 ----- wp-rest/Endpoint/Endpoint-Interface.php | 35 - wp-rest/Plugin.php | 193 ---- wp-rest/README.md | 59 -- 820 files changed, 13041 insertions(+), 8775 deletions(-) rename civicrm/CRM/ACL/DAO/{Cache.php => ACLCache.php} (91%) create mode 100644 civicrm/CRM/Activity/BAO/ActivityType.php create mode 100644 civicrm/CRM/Contact/Import/MetadataTrait.php create mode 100644 civicrm/CRM/Import/ImportProcessor.php create mode 100644 civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php delete mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl delete mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl delete mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl delete mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl delete mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl create mode 100644 civicrm/api/v3/examples/CaseContact/Create.php create mode 100644 civicrm/api/v3/examples/Contact/GetMergedfrom.php create mode 100644 civicrm/api/v3/examples/Contact/GetMergedto.php create mode 100644 civicrm/api/v3/examples/Contact/GetUnique.php create mode 100644 civicrm/api/v3/examples/Contribution/GetUnique.php create mode 100644 civicrm/api/v3/examples/Job/Clone.php create mode 100644 civicrm/api/v3/examples/Pcp/ChainedGetDelete.php create mode 100644 civicrm/api/v3/examples/Pcp/Delete.php create mode 100644 civicrm/api/v3/examples/Pcp/Get.php create mode 100644 civicrm/api/v3/examples/User/Get.php create mode 100644 civicrm/api/v3/examples/User/GetFields.php delete mode 100644 civicrm/bower.json delete mode 100644 civicrm/bower_components/angular-bootstrap/.bower.json create mode 100644 civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json delete mode 100644 civicrm/bower_components/angular-file-upload/.bower.json create mode 100644 civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json delete mode 100644 civicrm/bower_components/angular-jquery-dialog-service/.bower.json create mode 100644 civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json delete mode 100644 civicrm/bower_components/angular-mocks/.bower.json create mode 100644 civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json delete mode 100644 civicrm/bower_components/angular-route/.bower.json create mode 100644 civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json delete mode 100644 civicrm/bower_components/angular-sanitize/.bower.json create mode 100644 civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json delete mode 100644 civicrm/bower_components/angular-ui-sortable/.bower.json create mode 100644 civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json delete mode 100644 civicrm/bower_components/angular-ui-utils/.bower.json create mode 100644 civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json delete mode 100644 civicrm/bower_components/angular-unsavedChanges/.bower.json create mode 100644 civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json delete mode 100644 civicrm/bower_components/angular-xeditable/.bower.json create mode 100644 civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json delete mode 100644 civicrm/bower_components/angular/.bower.json create mode 100644 civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json delete mode 100644 civicrm/bower_components/checklist-model/.bower.json create mode 100644 civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json delete mode 100644 civicrm/bower_components/ckeditor/.bower.json create mode 100644 civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json delete mode 100644 civicrm/bower_components/crossfilter-1.3.x/.bower.json create mode 100644 civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json delete mode 100644 civicrm/bower_components/crossfilter2/.bower.json create mode 100644 civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json delete mode 100644 civicrm/bower_components/css-color-names/.bower.json create mode 100644 civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json delete mode 100644 civicrm/bower_components/d3-3.5.x/.bower.json create mode 100644 civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json delete mode 100644 civicrm/bower_components/d3/.bower.json create mode 100644 civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json delete mode 100644 civicrm/bower_components/datatables/.bower.json create mode 100644 civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json delete mode 100644 civicrm/bower_components/dc-2.1.x/.bower.json create mode 100644 civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json delete mode 100644 civicrm/bower_components/dc-2.1.x/bower.json delete mode 100644 civicrm/bower_components/es6-promise/.bower.json create mode 100644 civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json delete mode 100644 civicrm/bower_components/font-awesome/.bower.json create mode 100644 civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json delete mode 100644 civicrm/bower_components/font-awesome/bower.json delete mode 100644 civicrm/bower_components/google-code-prettify/.bower.json create mode 100644 civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json delete mode 100644 civicrm/bower_components/jquery-ui/.bower.json create mode 100644 civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json delete mode 100644 civicrm/bower_components/jquery-validation/.bower.json create mode 100644 civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json delete mode 100644 civicrm/bower_components/jquery/.bower.json create mode 100644 civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json delete mode 100644 civicrm/bower_components/jstree/.bower.json create mode 100644 civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json delete mode 100644 civicrm/bower_components/jstree/bower.json delete mode 100644 civicrm/bower_components/lodash-compat/.bower.json create mode 100644 civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json delete mode 100644 civicrm/bower_components/phantomjs-polyfill/.bower.json create mode 100644 civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json delete mode 100644 civicrm/bower_components/qunit/.bower.json create mode 100644 civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json delete mode 100644 civicrm/bower_components/select2/.bower.json create mode 100644 civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json delete mode 100644 civicrm/bower_components/smartmenus/.bower.json create mode 100644 civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json create mode 100644 civicrm/ext/api4/CRM/Api4/Services.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Address/Save.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php delete mode 100644 civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php delete mode 100644 civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Event/Get.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php delete mode 100644 civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php delete mode 100644 civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/System/Check.php create mode 100644 civicrm/ext/api4/Civi/Api4/Action/System/Flush.php create mode 100644 civicrm/ext/api4/Civi/Api4/Campaign.php create mode 100644 civicrm/ext/api4/Civi/Api4/ContributionPage.php create mode 100644 civicrm/ext/api4/Civi/Api4/Domain.php create mode 100644 civicrm/ext/api4/Civi/Api4/EntityTag.php create mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php create mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php delete mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php create mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php rename civicrm/ext/api4/Civi/Api4/Event/Subscriber/{ => Generic}/AbstractPrepareSubscriber.php (81%) rename civicrm/ext/api4/Civi/Api4/Event/Subscriber/{ => Generic}/PreCreationSubscriber.php (77%) create mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php create mode 100644 civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php create mode 100644 civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php create mode 100644 civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php create mode 100644 civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php create mode 100644 civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php create mode 100644 civicrm/ext/api4/Civi/Api4/GroupNesting.php create mode 100644 civicrm/ext/api4/Civi/Api4/GroupOrganization.php create mode 100644 civicrm/ext/api4/Civi/Api4/LocationType.php create mode 100644 civicrm/ext/api4/Civi/Api4/MailSettings.php create mode 100644 civicrm/ext/api4/Civi/Api4/Mapping.php create mode 100644 civicrm/ext/api4/Civi/Api4/MappingField.php create mode 100644 civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php create mode 100644 civicrm/ext/api4/Civi/Api4/Route.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php rename civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/{ => Generic}/SpecProviderInterface.php (74%) create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php create mode 100644 civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php rename civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/{NavigationCreationSpecProvider.php => UFMatchCreationSpecProvider.php} (70%) create mode 100644 civicrm/ext/api4/Civi/Api4/Setting.php create mode 100644 civicrm/ext/api4/Civi/Api4/StatusPreference.php create mode 100644 civicrm/ext/api4/Civi/Api4/System.php create mode 100644 civicrm/ext/api4/Civi/Api4/Tag.php create mode 100644 civicrm/ext/api4/Civi/Api4/UFField.php create mode 100644 civicrm/ext/api4/Civi/Api4/UFMatch.php create mode 100644 civicrm/ext/api4/Civi/Api4/services.xml delete mode 100644 civicrm/ext/api4/services.xml delete mode 100644 civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/BaseCustomValueTest.php (74%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/BasicActionsTest.php (62%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/BasicCustomFieldTest.php (99%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/ChainTest.php (95%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/ComplexQueryTest.php (96%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/ContactApiKeyTest.php (63%) create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/CreateCustomValueTest.php (95%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/CreateWithOptionGroupTest.php (94%) create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/CustomValuePerformanceTest.php (97%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/CustomValueTest.php (90%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/DateTest.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/EvaluateConditionTest.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/ExtendFromIndividualTest.php (93%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/FkJoinTest.php (96%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/GetExtraFieldsTest.php (89%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/GetFromArrayTest.php (98%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/IndexTest.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/NullValueTest.php (95%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/ReplaceTest.php (96%) create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Action/UpdateCustomValueTest.php (94%) create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/DataSets/ConformanceTest.json (56%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/DataSets/DefaultDataSet.json (100%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/DataSets/MultiContactMultiEmail.json (100%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/DataSets/SingleContact.json (100%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Entity/ConformanceTest.php (71%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Entity/ContactJoinTest.php (97%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Entity/EntityTest.php (91%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Entity/ParticipantTest.php (80%) create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php create mode 100644 civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/Api4/Action/MockArrayEntity/Get.php (100%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/Api4/MockArrayEntity.php (99%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/Api4/MockBasicEntity.php (79%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/MockEntityDataStorage.php (74%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/MockV4ReflectionBase.php (89%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/MockV4ReflectionChild.php (86%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Mock/MockV4ReflectionGrandchild.php (86%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Query/Api4SelectQueryComplexJoinTest.php (77%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Query/Api4SelectQueryTest.php (77%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Query/OneToOneJoinTest.php (87%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Query/OptionValueJoinTest.php (81%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Query/SelectQueryMultiJoinTest.php (91%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Service/Schema/SchemaMapRealTableTest.php (85%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Service/Schema/SchemaMapperTest.php (97%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Service/TestCreationParameterProvider.php (75%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Spec/RequestSpecTest.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Spec/SpecFormatterTest.php (82%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Spec/SpecGathererTest.php (88%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Traits/OptionCleanupTrait.php (95%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Traits/QueryCounterTrait.php (91%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Traits/TableDropperTrait.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Traits/TestDataLoaderTrait.php (98%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/UnitTestCase.php (94%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Utils/ArrayInsertionServiceTest.php (85%) rename civicrm/ext/api4/tests/phpunit/{ => api/v4}/Utils/ReflectionUtilsTest.php (91%) rename civicrm/ext/api4/tests/{ => phpunit/api/v4}/services.xml (78%) create mode 100644 civicrm/release-notes/5.18.0.md create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/README.md create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/composer.json create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php create mode 100644 civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php create mode 100644 civicrm/vendor/togos/gitignore/.gitignore create mode 100644 civicrm/vendor/togos/gitignore/Makefile create mode 100644 civicrm/vendor/togos/gitignore/composer.json create mode 100644 civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php create mode 100644 civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php create mode 100644 civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php create mode 100644 civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php create mode 100644 civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php delete mode 100644 wp-rest/.editorconfig delete mode 100644 wp-rest/Autoloader.php delete mode 100644 wp-rest/Civi/Mailing-Hooks.php delete mode 100644 wp-rest/Controller/AuthorizeIPN.php delete mode 100644 wp-rest/Controller/Base.php delete mode 100644 wp-rest/Controller/Cxn.php delete mode 100644 wp-rest/Controller/Open.php delete mode 100644 wp-rest/Controller/PayPalIPN.php delete mode 100644 wp-rest/Controller/PxIPN.php delete mode 100644 wp-rest/Controller/Rest.php delete mode 100644 wp-rest/Controller/Soap.php delete mode 100644 wp-rest/Controller/Url.php delete mode 100644 wp-rest/Controller/Widget.php delete mode 100644 wp-rest/Endpoint/Endpoint-Interface.php delete mode 100644 wp-rest/Plugin.php delete mode 100644 wp-rest/README.md diff --git a/civicrm.php b/civicrm.php index f560a3bba3..8e56c3fa58 100644 --- a/civicrm.php +++ b/civicrm.php @@ -2,7 +2,7 @@ /* Plugin Name: CiviCRM Description: CiviCRM - Growing and Sustaining Relationships -Version: 5.17.5 +Version: 5.18.0 Author: CiviCRM LLC Author URI: https://civicrm.org/ Plugin URI: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress @@ -137,17 +137,6 @@ if ( file_exists( CIVICRM_SETTINGS_PATH ) ) { // Prevent CiviCRM from rendering its own header define( 'CIVICRM_UF_HEAD', TRUE ); -/** - * Setting this to 'true' will replace all mailing URLs calls to 'extern/url.php' - * and 'extern/open.php' with their REST counterpart 'civicrm/v3/url' and 'civicrm/v3/open'. - * - * Use for test purposes, may affect mailing - * performance, see Plugin->replace_tracking_urls() method. - */ -if ( ! defined( 'CIVICRM_WP_REST_REPLACE_MAILING_TRACKING' ) ) { - define( 'CIVICRM_WP_REST_REPLACE_MAILING_TRACKING', false ); -} - /** * Define CiviCRM_For_WordPress Class. @@ -527,9 +516,6 @@ class CiviCRM_For_WordPress { include_once CIVICRM_PLUGIN_DIR . 'includes/civicrm.basepage.php'; $this->basepage = new CiviCRM_For_WordPress_Basepage; - // Include REST API autoloader class - require_once( CIVICRM_PLUGIN_DIR . 'wp-rest/Autoloader.php' ); - } @@ -642,12 +628,6 @@ class CiviCRM_For_WordPress { // Register hooks for clean URLs. $this->register_hooks_clean_urls(); - // Set up REST API. - CiviCRM_WP_REST\Autoloader::add_source( $source_path = trailingslashit( CIVICRM_PLUGIN_DIR . 'wp-rest' ) ); - - // Init REST API. - new CiviCRM_WP_REST\Plugin; - } @@ -852,12 +832,17 @@ class CiviCRM_For_WordPress { // CiviCRM Initialisation // --------------------------------------------------------------------------- + /** + * Check that the PHP version is supported. If not, raise a fatal error with a pointed message. + * + * One should check this before bootstrapping Civi - after we start the class-loader, the + * PHP-compatibility errors will become more ugly. + */ protected function assertPhpSupport() { - // Need to check this before bootstrapping - once we start bootstrapping, the error messages will become ugly. if ( version_compare( PHP_VERSION, CIVICRM_WP_PHP_MINIMUM ) < 0 ) { echo '<p>' . sprintf( - __( 'CiviCRM requires PHP version %s or greater. You are running PHP version %s', 'civicrm' ), + __( 'CiviCRM requires PHP version %1$s or greater. You are running PHP version %2$s', 'civicrm' ), CIVICRM_WP_PHP_MINIMUM, PHP_VERSION ) . diff --git a/civicrm/CRM/ACL/BAO/Cache.php b/civicrm/CRM/ACL/BAO/Cache.php index 921adfeaf6..c165e940c0 100644 --- a/civicrm/CRM/ACL/BAO/Cache.php +++ b/civicrm/CRM/ACL/BAO/Cache.php @@ -34,7 +34,7 @@ /** * Access Control Cache. */ -class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache { +class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_ACLCache { public static $_cache = NULL; @@ -96,7 +96,7 @@ SELECT acl_id */ public static function store($id, &$cache) { foreach ($cache as $aclID => $data) { - $dao = new CRM_ACL_DAO_Cache(); + $dao = new CRM_ACL_BAO_Cache(); if ($id) { $dao->contact_id = $id; } diff --git a/civicrm/CRM/ACL/DAO/Cache.php b/civicrm/CRM/ACL/DAO/ACLCache.php similarity index 91% rename from civicrm/CRM/ACL/DAO/Cache.php rename to civicrm/CRM/ACL/DAO/ACLCache.php index 34a3e7360b..cbf774e4b2 100644 --- a/civicrm/CRM/ACL/DAO/Cache.php +++ b/civicrm/CRM/ACL/DAO/ACLCache.php @@ -4,15 +4,15 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 * - * Generated from xml/schema/CRM/ACL/Cache.xml + * Generated from xml/schema/CRM/ACL/ACLCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6180a43e0d4bd8f2008286be6683d0ba) + * (GenCodeChecksum:a7bccfc35714fdcf0fdb6f4cd24842bd) */ /** - * Database access object for the Cache entity. + * Database access object for the ACLCache entity. */ -class CRM_ACL_DAO_Cache extends CRM_Core_DAO { +class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO { /** * Static instance to hold the table name. @@ -96,8 +96,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => TRUE, 'where' => 'civicrm_acl_cache.id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, ], 'contact_id' => [ @@ -107,8 +107,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'description' => ts('Foreign Key to Contact'), 'where' => 'civicrm_acl_cache.contact_id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', ], @@ -120,8 +120,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => TRUE, 'where' => 'civicrm_acl_cache.acl_id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, 'FKClassName' => 'CRM_ACL_DAO_ACL', ], @@ -133,8 +133,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => FALSE, 'where' => 'civicrm_acl_cache.modified_date', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, ], ]; diff --git a/civicrm/CRM/ACL/Form/WordPress/Permissions.php b/civicrm/CRM/ACL/Form/WordPress/Permissions.php index bad293c934..65191fb979 100644 --- a/civicrm/CRM/ACL/Form/WordPress/Permissions.php +++ b/civicrm/CRM/ACL/Form/WordPress/Permissions.php @@ -54,7 +54,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { } foreach ($wp_roles->role_names as $role => $name) { // Don't show the permissions options for administrator, as they have all permissions - if ( is_multisite() OR $role !== 'administrator') { + if ($role !== 'administrator') { $roleObj = $wp_roles->get_role($role); if (!empty($roleObj->capabilities)) { foreach ($roleObj->capabilities as $ckey => $cname) { diff --git a/civicrm/CRM/Activity/BAO/Activity.php b/civicrm/CRM/Activity/BAO/Activity.php index 313fa5c128..2a999323cd 100644 --- a/civicrm/CRM/Activity/BAO/Activity.php +++ b/civicrm/CRM/Activity/BAO/Activity.php @@ -312,9 +312,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } // Set priority to Normal for Auto-populated activities (for Cases) - if (CRM_Utils_Array::value('priority_id', $params) === NULL && + if (!isset($params['priority_id']) && // if not set and not 0 - !CRM_Utils_Array::value('id', $params) + empty($params['id']) ) { $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); $params['priority_id'] = array_search('Normal', $priority); @@ -902,6 +902,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { */ public function addSelectWhereClause() { $clauses = []; + // @todo - check if $permissedActivityTYpes === all activity types and do not add critieria if so. $permittedActivityTypeIDs = self::getPermittedActivityTypes(); if (empty($permittedActivityTypeIDs)) { // This just prevents a mysql fail if they have no access - should be extremely edge case. @@ -986,6 +987,56 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { return civicrm_api3('Activity', 'getcount', $activityParams); } + /** + * @param int $userID + * @param string $subject + * @param string $html + * @param string $text + * @param string $additionalDetails + * @param int $campaignID + * @param array $attachments + * + * @return int + * The created activity ID + * @throws \CRM_Core_Exception + */ + public static function createEmailActivity($userID, $subject, $html, $text, $additionalDetails, $campaignID, $attachments) { + $activityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Email'); + + // CRM-6265: save both text and HTML parts in details (if present) + if ($html and $text) { + $details = "-ALTERNATIVE ITEM 0-\n$html$additionalDetails\n-ALTERNATIVE ITEM 1-\n$text$additionalDetails\n-ALTERNATIVE END-\n"; + } + else { + $details = $html ? $html : $text; + $details .= $additionalDetails; + } + + $activityParams = [ + 'source_contact_id' => $userID, + 'activity_type_id' => $activityTypeID, + 'activity_date_time' => date('YmdHis'), + 'subject' => $subject, + 'details' => $details, + // FIXME: check for name Completed and get ID from that lookup + 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'), + 'campaign_id' => $campaignID, + ]; + + // CRM-5916: strip [case #…] before saving the activity (if present in subject) + $activityParams['subject'] = preg_replace('/\[case #([0-9a-h]{7})\] /', '', $activityParams['subject']); + + // add the attachments to activity params here + if ($attachments) { + // first process them + $activityParams = array_merge($activityParams, $attachments); + } + + $activity = self::create($activityParams); + + return $activity->id; + } + /** * Send the message to all the contacts. * @@ -1017,6 +1068,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { * * @return array * ( sent, activityId) if any email is sent and activityId + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function sendEmail( &$contactDetails, @@ -1060,45 +1113,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } //create the meta level record first ( email activity ) - $activityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Email'); + $activityID = self::createEmailActivity($userID, $subject, $html, $text, $additionalDetails, $campaignId, $attachments); - // CRM-6265: save both text and HTML parts in details (if present) - if ($html and $text) { - $details = "-ALTERNATIVE ITEM 0-\n$html$additionalDetails\n-ALTERNATIVE ITEM 1-\n$text$additionalDetails\n-ALTERNATIVE END-\n"; - } - else { - $details = $html ? $html : $text; - $details .= $additionalDetails; - } - - $activityParams = [ - 'source_contact_id' => $userID, - 'activity_type_id' => $activityTypeID, - 'activity_date_time' => date('YmdHis'), - 'subject' => $subject, - 'details' => $details, - // FIXME: check for name Completed and get ID from that lookup - 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'), - 'campaign_id' => $campaignId, - ]; - - // CRM-5916: strip [case #…] before saving the activity (if present in subject) - $activityParams['subject'] = preg_replace('/\[case #([0-9a-h]{7})\] /', '', $activityParams['subject']); - - // add the attachments to activity params here - if ($attachments) { - // first process them - $activityParams = array_merge($activityParams, - $attachments - ); - } - - $activity = self::create($activityParams); - - // get the set of attachments from where they are stored - $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', - $activity->id - ); $returnProperties = []; if (isset($messageToken['contact'])) { foreach ($messageToken['contact'] as $key => $value) { @@ -1206,8 +1222,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $tokenText, $tokenHtml, $emailAddress, - $activity->id, - $attachments, + $activityID, + // get the set of attachments from where they are stored + CRM_Core_BAO_File::getEntityFile('civicrm_activity', $activityID), $cc, $bcc ) @@ -1216,7 +1233,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } } - return [$sent, $activity->id]; + return [$sent, $activityID]; } /** diff --git a/civicrm/CRM/Activity/BAO/ActivityType.php b/civicrm/CRM/Activity/BAO/ActivityType.php new file mode 100644 index 0000000000..d26d143831 --- /dev/null +++ b/civicrm/CRM/Activity/BAO/ActivityType.php @@ -0,0 +1,100 @@ +<?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 + */ + +/** + * This class is a wrapper that moves some boilerplate code out of the Form class and helps remove some ambiguity with name and label. + */ +class CRM_Activity_BAO_ActivityType { + + /** + * key/value pair for this activity type + * + * @var array + * machineName The internal name for lookups - matches up to option_value 'name' column in the database + * displayLabel The label used for display/output - matches up to option_value 'label' column in the database + * id The value used to initialize this object - matches up to the option_value 'value' column in the database + */ + protected $_activityType = [ + 'machineName' => NULL, + 'displayLabel' => NULL, + 'id' => NULL, + ]; + + /** + * Constructor + * + * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + */ + public function __construct($activity_type_id) { + $this->setActivityType($activity_type_id); + } + + /** + * Get the key/value pair representing this activity type. + * + * @return array + * @see $this->_activityType + */ + public function getActivityType() { + return $this->_activityType; + } + + /** + * Look up the key/value pair representing this activity type from the id. + * Generally called from constructor. + * + * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + */ + public function setActivityType($activity_type_id) { + if ($activity_type_id && is_numeric($activity_type_id)) { + + /* + * These are pulled from CRM_Activity_Form_Activity. + * To avoid unexpectedly changing things like introducing hidden + * business logic or changing permission checks I've kept it using + * the same function call. It may or may not be desired to have + * that but this at least doesn't introduce anything that wasn't + * there before. + */ + $machineNames = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $activity_type_id, 'name'); + $displayLabels = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $activity_type_id, 'label'); + + $this->_activityType = [ + 'machineName' => CRM_Utils_Array::value($activity_type_id, $machineNames), + 'displayLabel' => CRM_Utils_Array::value($activity_type_id, $displayLabels), + 'id' => $activity_type_id, + ]; + } + } + +} diff --git a/civicrm/CRM/Activity/Form/Activity.php b/civicrm/CRM/Activity/Form/Activity.php index dc6718406b..e572fecd86 100644 --- a/civicrm/CRM/Activity/Form/Activity.php +++ b/civicrm/CRM/Activity/Form/Activity.php @@ -323,30 +323,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ); } - // Assigning Activity type name. - if ($this->_activityTypeId) { - $activityTName = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label'); - if ($activityTName[$this->_activityTypeId]) { - $this->_activityTypeName = $activityTName[$this->_activityTypeId]; - $this->assign('activityTName', $activityTName[$this->_activityTypeId]); - } - // Set title. - if (isset($activityTName)) { - $activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName); - - if ($this->_currentlyViewedContactId) { - $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); - // Check if this is default domain contact CRM-10482. - if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { - $displayName .= ' (' . ts('default organization') . ')'; - } - CRM_Utils_System::setTitle($displayName . ' - ' . $activityName); - } - else { - CRM_Utils_System::setTitle(ts('%1 Activity', [1 => $activityName])); - } - } - } + $this->assignActivityType(); // Check the mode when this form is called either single or as // search task action. @@ -483,6 +460,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } // when custom data is included in this page + $this->assign('cid', $this->_currentlyViewedContactId); if (!empty($_POST['hidden_custom'])) { // We need to set it in the session for the code below to work. // CRM-3014 @@ -666,7 +644,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $element = &$this->add('select', 'activity_type_id', ts('Activity Type'), ['' => '- ' . ts('select') . ' -'] + $this->_fields['followup_activity_type_id']['attributes'], FALSE, [ - 'onchange' => "CRM.buildCustomData( 'Activity', this.value );", + 'onchange' => "CRM.buildCustomData( 'Activity', this.value, false, false, false, false, false, false, {$this->_currentlyViewedContactId});", 'class' => 'crm-select2 required', ] ); @@ -744,7 +722,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->assign('surveyActivity', $this->_isSurveyActivity); // Add the "Activity Separation" field - $actionIsAdd = $this->_action != CRM_Core_Action::UPDATE; + $actionIsAdd = ($this->_action != CRM_Core_Action::UPDATE && $this->_action != CRM_Core_Action::VIEW); $separationIsPossible = $this->supportsActivitySeparation; if ($actionIsAdd && $separationIsPossible) { $this->addRadio( @@ -1246,4 +1224,46 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } + /** + * For the moment keeping this the same as the original pulled from preProcess(). Also note the "s" at the end of the function name - planning to change that but in baby steps. + * + * @return string[] + */ + public function getActivityTypeDisplayLabels() { + return CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label'); + } + + /** + * For the moment this is just pulled from preProcess + */ + public function assignActivityType() { + if ($this->_activityTypeId) { + $activityTypeDisplayLabels = $this->getActivityTypeDisplayLabels(); + if ($activityTypeDisplayLabels[$this->_activityTypeId]) { + $this->_activityTypeName = $activityTypeDisplayLabels[$this->_activityTypeId]; + + // At the moment this is duplicating other code in this section, but refactoring in small steps. + $activityTypeObj = new CRM_Activity_BAO_ActivityType($this->_activityTypeId); + $this->assign('activityTypeNameAndLabel', $activityTypeObj->getActivityType()); + } + // Set title. + if (isset($activityTypeDisplayLabels)) { + // FIXME - it's not clear why the if line just above is needed here and why we can't just set this once above and re-use. What is interesting, but can't possibly be the reason, is that the first if block will fail if the label is the string '0', whereas this one won't. But who would have an activity type called '0'? + $activityTypeDisplayLabel = CRM_Utils_Array::value($this->_activityTypeId, $activityTypeDisplayLabels); + + if ($this->_currentlyViewedContactId) { + $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); + // Check if this is default domain contact CRM-10482. + if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { + $displayName .= ' (' . ts('default organization') . ')'; + } + CRM_Utils_System::setTitle($displayName . ' - ' . $activityTypeDisplayLabel); + } + else { + CRM_Utils_System::setTitle(ts('%1 Activity', [1 => $activityTypeDisplayLabel])); + } + } + } + } + } diff --git a/civicrm/CRM/Activity/Form/Task/Batch.php b/civicrm/CRM/Activity/Form/Task/Batch.php index 9bdb768b8b..8b3fc16745 100644 --- a/civicrm/CRM/Activity/Form/Task/Batch.php +++ b/civicrm/CRM/Activity/Form/Task/Batch.php @@ -80,6 +80,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { if (!empty($contactDetails)) { foreach ($contactDetails as $key => $value) { $assignee = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($key); + $assigneeContact = []; foreach ($assignee as $values) { $assigneeContact[] = CRM_Contact_BAO_Contact::displayName($values); } diff --git a/civicrm/CRM/Activity/Page/AJAX.php b/civicrm/CRM/Activity/Page/AJAX.php index 6c78fb59c5..5688dd5093 100644 --- a/civicrm/CRM/Activity/Page/AJAX.php +++ b/civicrm/CRM/Activity/Page/AJAX.php @@ -185,7 +185,7 @@ class CRM_Activity_Page_AJAX { else { foreach ($value as $clientRole) { $relClient = []; - $relClient['relation'] = 'Client'; + $relClient['relation'] = ts('Client'); $relClient['name'] = $clientRole['sort_name']; $relClient['phone'] = $clientRole['phone']; $relClient['email'] = $clientRole['email']; diff --git a/civicrm/CRM/Activity/Selector/Search.php b/civicrm/CRM/Activity/Selector/Search.php index abd0bdfb24..77bb0fa9a8 100644 --- a/civicrm/CRM/Activity/Selector/Search.php +++ b/civicrm/CRM/Activity/Selector/Search.php @@ -129,7 +129,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM /** * The query object. * - * @var string + * @var \CRM_Contact_BAO_Query */ protected $_query; @@ -179,6 +179,13 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM // required here rather than "access my cases and activities" to // prevent those with only the later permission from seeing a list // of all cases which might present a privacy issue. + // @todo this is the cause of the current devastatingly bad performance on + // activity search - it involves a bad join. + // The correct fix is to use the permission infrastrucutre - ie. add in the + // clause generated by CRM_Activity_BAO_Query::addSelectWhere + // but some testing needs to check that before making the change + // see https://github.com/civicrm/civicrm-core/blob/be2fb01f90f5f299dd07402a41fed7c7c7567f00/CRM/Utils/SQL.php#L48 + // for how it's done in the api kernel. if (!CRM_Core_Permission::access($componentName, TRUE, TRUE)) { $componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) "; } @@ -435,7 +442,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM } /** - * @return string + * @return \CRM_Contact_BAO_Query */ public function &getQuery() { return $this->_query; diff --git a/civicrm/CRM/Admin/Form/Extensions.php b/civicrm/CRM/Admin/Form/Extensions.php index 852ebb0820..6826a159d4 100644 --- a/civicrm/CRM/Admin/Form/Extensions.php +++ b/civicrm/CRM/Admin/Form/Extensions.php @@ -205,7 +205,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { 'version' => 3, 'key' => $this->_key, ]); - if (!CRM_Utils_Array::value('is_error', $result, FALSE)) { + if (empty($result['is_error'])) { CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success"); } else { diff --git a/civicrm/CRM/Admin/Form/ScheduleReminders.php b/civicrm/CRM/Admin/Form/ScheduleReminders.php index e2365cb9d0..b827be6910 100644 --- a/civicrm/CRM/Admin/Form/ScheduleReminders.php +++ b/civicrm/CRM/Admin/Form/ScheduleReminders.php @@ -523,7 +523,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { 'end_date', ]; - if (!CRM_Utils_Array::value('absolute_date', $params)) { + if (empty($params['absolute_date'])) { $params['absolute_date'] = 'null'; } foreach ($moreKeys as $mkey) { @@ -577,7 +577,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0); - if (CRM_Utils_Array::value('is_repeat', $values) == 0) { + if (empty($values['is_repeat'])) { $params['repetition_frequency_unit'] = 'null'; $params['repetition_frequency_interval'] = 'null'; $params['end_frequency_unit'] = 'null'; diff --git a/civicrm/CRM/Admin/Form/Setting/Localization.php b/civicrm/CRM/Admin/Form/Setting/Localization.php index 2e85c5924a..a3cec9ae90 100644 --- a/civicrm/CRM/Admin/Form/Setting/Localization.php +++ b/civicrm/CRM/Admin/Form/Setting/Localization.php @@ -220,7 +220,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { } // add a new db locale if the requested language is not yet supported by the db - if (!CRM_Utils_Array::value('makeSinglelingual', $values) and CRM_Utils_Array::value('addLanguage', $values)) { + if (empty($values['makeSinglelingual']) && !empty($values['addLanguage'])) { $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); if (!substr_count($domain->locales, $values['addLanguage'])) { diff --git a/civicrm/CRM/Admin/Form/Setting/Smtp.php b/civicrm/CRM/Admin/Form/Setting/Smtp.php index cebf70c8ca..45dc52dcce 100644 --- a/civicrm/CRM/Admin/Form/Setting/Smtp.php +++ b/civicrm/CRM/Admin/Form/Setting/Smtp.php @@ -105,8 +105,8 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(); if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') { - $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1'); - CRM_Core_Error::statusBounce(ts('The site administrator needs to enter a valid email address in <a href="%1">Administer CiviCRM » Communications » Organization Address and Contact Info</a>. The email address used may need to be a valid mail account with your email service provider.', [1 => $fixUrl])); + $fixUrl = CRM_Utils_System::url("civicrm/admin/options/from_email_address", 'action=update&reset=1'); + CRM_Core_Error::statusBounce(ts('The site administrator needs to enter a valid \'FROM Email Address\' in <a href="%1">Administer CiviCRM » System Settings » Option Groups » From Email Address</a>. The email address used may need to be a valid mail account with your email service provider.', [1 => $fixUrl])); } if (!$toEmail) { CRM_Core_Error::statusBounce(ts('Cannot send a test email because your user record does not have a valid email address.')); diff --git a/civicrm/CRM/Badge/BAO/Badge.php b/civicrm/CRM/Badge/BAO/Badge.php index 7775cd4ae5..b4ff8e4103 100644 --- a/civicrm/CRM/Badge/BAO/Badge.php +++ b/civicrm/CRM/Badge/BAO/Badge.php @@ -225,8 +225,8 @@ class CRM_Badge_BAO_Badge { break; } $this->pdf->Image($formattedRow['participant_image'], $x + $imageAlign, $y + $startOffset, CRM_Utils_Array::value('width_participant_image', $formattedRow), CRM_Utils_Array::value('height_participant_image', $formattedRow)); - if ($startOffset == NULL && CRM_Utils_Array::value('height_participant_image', $formattedRow)) { - $startOffset = CRM_Utils_Array::value('height_participant_image', $formattedRow); + if ($startOffset == NULL && !empty($formattedRow['height_participant_image'])) { + $startOffset = $formattedRow['height_participant_image']; } } diff --git a/civicrm/CRM/Batch/BAO/Batch.php b/civicrm/CRM/Batch/BAO/Batch.php index 771c0cc412..93bb4b6c3e 100644 --- a/civicrm/CRM/Batch/BAO/Batch.php +++ b/civicrm/CRM/Batch/BAO/Batch.php @@ -334,9 +334,14 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $aid = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Export Accounting Batch'); $activityParams = ['source_record_id' => $values['id'], 'activity_type_id' => $aid]; $exportActivity = CRM_Activity_BAO_Activity::retrieve($activityParams, $val); - $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id'); - $fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid); - $tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens); + if ($exportActivity) { + $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id'); + $fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid); + $tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens); + } + else { + CRM_Utils_Array::remove($newLinks, 'export', 'download'); + } } $values['action'] = CRM_Core_Action::formLink( $newLinks, diff --git a/civicrm/CRM/Batch/Form/Entry.php b/civicrm/CRM/Batch/Form/Entry.php index 038f320944..5d98871c54 100644 --- a/civicrm/CRM/Batch/Form/Entry.php +++ b/civicrm/CRM/Batch/Form/Entry.php @@ -395,7 +395,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $completeStatus = CRM_Contribute_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); $specialFields = [ - 'join_date' => date('Y-m-d'), + 'membership_join_date' => date('Y-m-d'), 'receive_date' => $currentDate, 'contribution_status_id' => $completeStatus, ]; @@ -825,7 +825,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } else { $dateTypes = [ - 'join_date' => 'joinDate', + 'membership_join_date' => 'joinDate', 'membership_start_date' => 'startDate', 'membership_end_date' => 'endDate', ]; diff --git a/civicrm/CRM/Case/BAO/Query.php b/civicrm/CRM/Case/BAO/Query.php index 321118bf96..3db0adee60 100644 --- a/civicrm/CRM/Case/BAO/Query.php +++ b/civicrm/CRM/Case/BAO/Query.php @@ -481,7 +481,14 @@ class CRM_Case_BAO_Query extends CRM_Core_BAO_Query { $tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE]); if (!empty($value)) { - $val = explode(',', $value); + if (is_array($value)) { + // Search tag(s) are part of a tag set + $val = array_keys($value); + } + else { + // Search tag(s) are part of the tag tree + $val = explode(',', $value); + } foreach ($val as $v) { if ($v) { $names[] = $tags[$v]; diff --git a/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php b/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php index 6316f3a223..aa4a6ce43f 100644 --- a/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -165,7 +165,6 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { * @param CRM_Activity_BAO_Activity $activity */ public static function endPostProcess(&$form, &$params, $activity) { - $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value'); // Set case end_date if we're closing the case. Clear end_date if we're (re)opening it. @@ -175,14 +174,14 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { // End case-specific relationships (roles) foreach ($params['target_contact_id'] as $cid) { $rels = CRM_Case_BAO_Case::getCaseRoles($cid, $params['case_id']); - // FIXME: Is there an existing function to close a relationship? - $query = 'UPDATE civicrm_relationship SET end_date=%2 WHERE id=%1'; foreach ($rels as $relId => $relData) { - $relParams = [ - 1 => [$relId, 'Integer'], - 2 => [$params['end_date'], 'Timestamp'], + $relationshipParams = [ + 'id' => $relId, + 'end_date' => $params['end_date'], ]; - CRM_Core_DAO::executeQuery($query, $relParams); + // @todo we can't switch directly to api because there is too much business logic and it breaks closing cases with organisations as client relationships + //civicrm_api3('Relationship', 'create', $relationshipParams); + CRM_Contact_BAO_Relationship::add($relationshipParams); } } } @@ -192,11 +191,14 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { // Reopen case-specific relationships (roles) foreach ($params['target_contact_id'] as $cid) { $rels = CRM_Case_BAO_Case::getCaseRoles($cid, $params['case_id'], NULL, FALSE); - // FIXME: Is there an existing function? - $query = 'UPDATE civicrm_relationship SET end_date=NULL WHERE id=%1'; foreach ($rels as $relId => $relData) { - $relParams = [1 => [$relId, 'Integer']]; - CRM_Core_DAO::executeQuery($query, $relParams); + $relationshipParams = [ + 'id' => $relId, + 'end_date' => 'null', + ]; + // @todo we can't switch directly to api because there is too much business logic and it breaks closing cases with organisations as client relationships + //civicrm_api3('Relationship', 'create', $relationshipParams); + CRM_Contact_BAO_Relationship::add($relationshipParams); } } } diff --git a/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php b/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php index 2a8ac64e85..1e683a8beb 100644 --- a/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php +++ b/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php @@ -119,7 +119,7 @@ class CRM_Case_Form_Activity_ChangeCaseType { $params['id'] = $form->_id; } - if (CRM_Utils_Array::value('is_reset_timeline', $params) == 0) { + if (empty($params['is_reset_timeline'])) { unset($params['reset_date_time']); } } diff --git a/civicrm/CRM/Case/XMLProcessor/Process.php b/civicrm/CRM/Case/XMLProcessor/Process.php index 4cfb5c8d7e..1b96b2e152 100644 --- a/civicrm/CRM/Case/XMLProcessor/Process.php +++ b/civicrm/CRM/Case/XMLProcessor/Process.php @@ -105,7 +105,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { foreach ($xml->CaseRoles as $caseRoleXML) { foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) { if ((int ) $relationshipTypeXML->creator == 1) { - if (!$this->createRelationships((string ) $relationshipTypeXML->name, + if (!$this->createRelationships($this->locateNameOrLabel($relationshipTypeXML), $params ) ) { @@ -846,4 +846,34 @@ AND a.is_deleted = 0 return $default; } + /** + * At some point name and label got mixed up for case roles. + * Check for higher priority tag <machineName> first which represents name, then fall back to the <name> tag which somehow became label. + * We do this to avoid requiring people to update their xml files which can be stored in external files. + * + * Note this is different than doing something like comparing the <name> tag against name in the database and then falling back to comparing label in the database, which is subject to an edge case where you would get the wrong one (where the label of one relationship type is the same as the name of another). Here there are two tags with explicit single meanings. + * + * @param SimpleXMLElement $xml + * + * @return string + */ + public function locateNameOrLabel($xml) { + /* While it's unlikely, it's possible somebody is using '0' as their machineName, so we should let them. + * Specifically if machineName is: + * missing - use name + * null - use name + * blank - use name + * the string '0' - use machineName + * the number 0 - use machineName (but can't really have number 0 in simplexml unless cast to number) + * the word 'null' - use machineName and best not to think about it + */ + if (isset($xml->machineName)) { + $machineName = (string) $xml->machineName; + if ($machineName !== '') { + return $machineName; + } + } + return (string) $xml->name; + } + } diff --git a/civicrm/CRM/Contact/BAO/Contact/Utils.php b/civicrm/CRM/Contact/BAO/Contact/Utils.php index 1d9f166a71..28f3802490 100644 --- a/civicrm/CRM/Contact/BAO/Contact/Utils.php +++ b/civicrm/CRM/Contact/BAO/Contact/Utils.php @@ -242,33 +242,6 @@ WHERE id IN ( $idString ) return ($inputTS + ($inputLF * 60 * 60) >= $now); } - /** - * Get the count of contact loctions. - * - * @param int $contactId - * Contact id. - * - * @return int - * max locations for the contact - */ - public static function maxLocations($contactId) { - $contactLocations = []; - - // find number of location blocks for this contact and adjust value accordinly - // get location type from email - $query = " -( SELECT location_type_id FROM civicrm_email WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_phone WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_im WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_address WHERE contact_id = {$contactId} ) -"; - $dao = CRM_Core_DAO::executeQuery($query); - return $dao->N; - } - /** * Create Current employer relationship for a individual. * @@ -469,9 +442,6 @@ WHERE id={$contactId}; "; * */ public static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) { - - $config = CRM_Core_Config::singleton(); - $form->assign('contact_type', $contactType); $form->assign('fieldSetTitle', $title); $form->assign('contactEditMode', TRUE); @@ -509,7 +479,7 @@ WHERE id={$contactId}; "; ); } - $addressSequence = $config->addressSequence(); + $addressSequence = CRM_Utils_Address::sequence(\Civi::settings()->get('address_format')); $form->assign('addressSequence', array_fill_keys($addressSequence, 1)); //Primary Phone diff --git a/civicrm/CRM/Contact/BAO/ContactType.php b/civicrm/CRM/Contact/BAO/ContactType.php index 8ee3011f27..a4d7cc6af4 100644 --- a/civicrm/CRM/Contact/BAO/ContactType.php +++ b/civicrm/CRM/Contact/BAO/ContactType.php @@ -149,65 +149,45 @@ WHERE parent_id IS NULL * .. * @param bool $all * @param bool $ignoreCache - * @param bool $reset * * @return array * Array of sub type information */ - public static function subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE, $reset = FALSE) { - static $_cache = NULL; - - if ($reset === TRUE) { - $_cache = NULL; - } - - if ($_cache === NULL) { - $_cache = []; - } - if ($contactType && !is_array($contactType)) { - $contactType = [$contactType]; - } - + public static function subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE) { $argString = $all ? 'CRM_CT_STI_1_' : 'CRM_CT_STI_0_'; if (!empty($contactType)) { + $contactType = (array) $contactType; $argString .= implode('_', $contactType); } + if (!Civi::cache('contactTypes')->has($argString) || $ignoreCache) { + $ctWHERE = ''; + if (!empty($contactType)) { + $ctWHERE = " AND parent.name IN ('" . implode("','", $contactType) . "')"; + } - if ((!array_key_exists($argString, $_cache)) || $ignoreCache) { - $cache = CRM_Utils_Cache::singleton(); - $_cache[$argString] = $cache->get($argString); - if (!$_cache[$argString] || $ignoreCache) { - $_cache[$argString] = []; - - $ctWHERE = ''; - if (!empty($contactType)) { - $ctWHERE = " AND parent.name IN ('" . implode("','", $contactType) . "')"; - } - - $sql = " + $sql = " SELECT subtype.*, parent.name as parent, parent.label as parent_label FROM civicrm_contact_type subtype INNER JOIN civicrm_contact_type parent ON subtype.parent_id = parent.id WHERE subtype.name IS NOT NULL AND subtype.parent_id IS NOT NULL {$ctWHERE} "; - if ($all === FALSE) { - $sql .= " AND subtype.is_active = 1 AND parent.is_active = 1 ORDER BY parent.id"; - } - $dao = CRM_Core_DAO::executeQuery($sql, [], - FALSE, 'CRM_Contact_DAO_ContactType' - ); - while ($dao->fetch()) { - $value = []; - CRM_Core_DAO::storeValues($dao, $value); - $value['parent'] = $dao->parent; - $value['parent_label'] = $dao->parent_label; - $_cache[$argString][$dao->name] = $value; - } - - $cache->set($argString, $_cache[$argString]); + if ($all === FALSE) { + $sql .= " AND subtype.is_active = 1 AND parent.is_active = 1 ORDER BY parent.id"; } + $dao = CRM_Core_DAO::executeQuery($sql, [], + FALSE, 'CRM_Contact_DAO_ContactType' + ); + $values = []; + while ($dao->fetch()) { + $value = []; + CRM_Core_DAO::storeValues($dao, $value); + $value['parent'] = $dao->parent; + $value['parent_label'] = $dao->parent_label; + $values[$dao->name] = $value; + } + Civi::cache('contactTypes')->set($argString, $values); } - return $_cache[$argString]; + return Civi::cache('contactTypes')->get($argString); } /** @@ -378,6 +358,7 @@ WHERE type.name IS NOT NULL $isSeparator = TRUE, $separator = '__' ) { + // @todo - use Cache class - ie like Civi::cache('contactTypes') static $_cache = NULL; if ($_cache === NULL) { @@ -467,6 +448,7 @@ AND ( p.is_active = 1 OR p.id IS NULL ) * basicTypes. */ public static function getBasicType($subType) { + // @todo - use Cache class - ie like Civi::cache('contactTypes') static $_cache = NULL; if ($_cache === NULL) { $_cache = []; @@ -617,8 +599,9 @@ DELETE FROM civicrm_navigation WHERE name = %1"; $params = [1 => ["New $name", 'String']]; - $dao = CRM_Core_DAO::executeQuery($sql, $params); + CRM_Core_DAO::executeQuery($sql, $params); CRM_Core_BAO_Navigation::resetNavigation(); + Civi::cache('contactTypes')->clear(); } return TRUE; } @@ -680,9 +663,7 @@ WHERE name = %1"; CRM_Core_BAO_Navigation::add($navigation); } CRM_Core_BAO_Navigation::resetNavigation(); - - // reset the cache after adding - self::subTypeInfo(NULL, FALSE, FALSE, TRUE); + Civi::cache('contactTypes')->clear(); return $contactType; } diff --git a/civicrm/CRM/Contact/BAO/Query.php b/civicrm/CRM/Contact/BAO/Query.php index e7fca08a8d..9d5e64a38a 100644 --- a/civicrm/CRM/Contact/BAO/Query.php +++ b/civicrm/CRM/Contact/BAO/Query.php @@ -1585,7 +1585,17 @@ class CRM_Contact_BAO_Query { self::filterCountryFromValuesIfStateExists($formValues); // We shouldn't have to whitelist fields to not hack but here we are, for now. - $nonLegacyDateFields = ['participant_register_date_relative', 'receive_date_relative']; + $nonLegacyDateFields = [ + 'participant_register_date_relative', + 'receive_date_relative', + 'pledge_end_date_relative', + 'pledge_create_date_relative', + 'pledge_start_date_relative', + 'pledge_payment_scheduled_date_relative', + 'membership_join_date_relative', + 'membership_start_date_relative', + 'membership_end_date_relative', + ]; // Handle relative dates first foreach (array_keys($formValues) as $id) { if ( @@ -1818,6 +1828,7 @@ class CRM_Contact_BAO_Query { $this->buildRelativeDateQuery($values); return; } + // @todo also handle _low, _high generically here with if ($query->buildDateRangeQuery($values)) {return} // do not process custom fields or prefixed contact ids or component params if (CRM_Core_BAO_CustomField::getKeyID($values[0]) || @@ -5264,7 +5275,7 @@ civicrm_relationship.start_date > {$today} * @param string $dateFormat */ public function dateQueryBuilder( - &$values, $tableName, $fieldName, + $values, $tableName, $fieldName, $dbFieldName, $fieldTitle, $appendTimeStamp = TRUE, $dateFormat = 'YmdHis' @@ -6950,6 +6961,47 @@ AND displayRelType.is_active = 1 return isset($this->_fields[$realField]); } + /** + * Get the specifications for the field, if available. + * + * @param string $fieldName + * Fieldname as displayed on the form. + * + * @return array + */ + public function getFieldSpec($fieldName) { + if (isset($this->_fields[$fieldName])) { + return $this->_fields[$fieldName]; + } + $lowFieldName = str_replace('_low', '', $fieldName); + if (isset($this->_fields[$lowFieldName])) { + return array_merge($this->_fields[$lowFieldName], ['field_name' => $lowFieldName]); + } + $highFieldName = str_replace('_high', '', $fieldName); + if (isset($this->_fields[$highFieldName])) { + return array_merge($this->_fields[$highFieldName], ['field_name' => $highFieldName]); + } + return []; + } + + public function buildWhereForDate() { + + } + + /** + * Is the field a relative date field. + * + * @param string $fieldName + * + * @return bool + */ + protected function isADateRangeField($fieldName) { + if (substr($fieldName, -4, 4) !== '_low' && substr($fieldName, -5, 5) !== '_high') { + return FALSE; + } + return !empty($this->getFieldSpec($fieldName)); + } + /** * @param $values */ @@ -6995,6 +7047,23 @@ AND displayRelType.is_active = 1 } } + /** + * Build the query for a date field if it is a _high or _low field. + * + * @param $values + * + * @return bool + */ + public function buildDateRangeQuery($values) { + if ($this->isADateRangeField($values[0])) { + $fieldSpec = $this->getFieldSpec($values[0]); + $title = empty($fieldSpec['unique_title']) ? $fieldSpec['title'] : $fieldSpec['unique_title']; + $this->dateQueryBuilder($values, $fieldSpec['table_name'], $fieldSpec['field_name'], $fieldSpec['name'], $title); + return TRUE; + } + return FALSE; + } + /** * Add the address table into the query. * diff --git a/civicrm/CRM/Contact/BAO/Relationship.php b/civicrm/CRM/Contact/BAO/Relationship.php index 5d55ef141a..b210da587a 100644 --- a/civicrm/CRM/Contact/BAO/Relationship.php +++ b/civicrm/CRM/Contact/BAO/Relationship.php @@ -181,6 +181,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $hook = 'edit'; } + // @todo pre hook is called from add - remove it from here CRM_Utils_Hook::pre($hook, 'Relationship', $relationshipId, $params); if (!$relationshipId) { @@ -295,33 +296,55 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { if ($params['id']) { $hook = 'edit'; } - //@todo hook are called from create and add - remove one CRM_Utils_Hook::pre($hook, 'Relationship', $params['id'], $params); $relationshipTypes = CRM_Utils_Array::value('relationship_type_id', $params); - // explode the string with _ to get the relationship type id // and to know which contact has to be inserted in // contact_id_a and which one in contact_id_b - list($type) = explode('_', $relationshipTypes); + list($relationshipTypeID) = explode('_', $relationshipTypes); + + $relationship = new CRM_Contact_BAO_Relationship(); + if (!empty($params['id'])) { + $relationship->id = $params['id']; + // Only load the relationship if we're missing required params + $requiredParams = ['contact_id_a', 'contact_id_b', 'relationship_type_id']; + foreach ($requiredParams as $requiredKey) { + if (!isset($params[$requiredKey])) { + $relationship->find(TRUE); + break; + } + } + + } + $relationship->copyValues($params); + // @todo we could probably set $params['relationship_type_id'] above but it's unclear + // what that would do with the code below this. So for now be conservative and set it manually. + if (!empty($relationshipTypeID)) { + $relationship->relationship_type_id = $relationshipTypeID; + } + + $params['contact_id_a'] = $relationship->contact_id_a; + $params['contact_id_b'] = $relationship->contact_id_b; // check if the relationship type is Head of Household then update the // household's primary contact with this contact. - if ($type == 6) { - CRM_Contact_BAO_Household::updatePrimaryContact($params['contact_id_b'], $params['contact_id_a']); + try { + $headOfHouseHoldID = civicrm_api3('RelationshipType', 'getvalue', [ + 'return' => "id", + 'name_a_b' => "Head of Household for", + ]); + if ($relationshipTypeID == $headOfHouseHoldID) { + CRM_Contact_BAO_Household::updatePrimaryContact($relationship->contact_id_b, $relationship->contact_id_a); + } } - if (!empty($params['id']) && self::isCurrentEmployerNeedingToBeCleared($params, $params['id'], $type)) { - CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($params['contact_id_a']); + catch (Exception $e) { + // No "Head of Household" relationship found so we skip specific processing } - $relationship = new CRM_Contact_BAO_Relationship(); - //@todo this code needs to be updated for the possibility that not all fields are set - // by using $relationship->copyValues($params); - // (update) - $relationship->contact_id_b = $params['contact_id_b']; - $relationship->contact_id_a = $params['contact_id_a']; - $relationship->relationship_type_id = $type; - $relationship->id = $params['id']; + if (!empty($params['id']) && self::isCurrentEmployerNeedingToBeCleared($relationship->toArray(), $params['id'], $relationshipTypeID)) { + CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a); + } $dateFields = ['end_date', 'start_date']; @@ -1512,6 +1535,7 @@ LEFT JOIN civicrm_country ON (civicrm_address.country_id = civicrm_country.id) * @param bool $active * * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function relatedMemberships($contactId, &$params, $ids, $action = CRM_Core_Action::ADD, $active = TRUE) { // Check the end date and set the status of the relationship @@ -1668,23 +1692,17 @@ LEFT JOIN civicrm_country ON (civicrm_address.country_id = civicrm_country.id) $mainRelatedContactId = reset($relatedContacts); foreach ($details['memberships'] as $membershipId => $membershipValues) { + $membershipInherittedFromContactID = NULL; + if (!empty($membershipValues['owner_membership_id'])) { + // Use get not getsingle so that we get e-notice noise but not a fatal is the membership has already been deleted. + $inheritedFromMembership = civicrm_api3('Membership', 'get', ['id' => $membershipValues['owner_membership_id'], 'sequential' => 1])['values'][0]; + $membershipInherittedFromContactID = (int) $inheritedFromMembership['contact_id']; + } $relTypeIds = []; if ($action & CRM_Core_Action::DELETE) { - // Delete memberships of the related contacts only if relationship type exists for membership type - $query = " -SELECT relationship_type_id, relationship_direction - FROM civicrm_membership_type - WHERE id = {$membershipValues['membership_type_id']}"; - $dao = CRM_Core_DAO::executeQuery($query); - $relTypeDirs = []; - while ($dao->fetch()) { - $relTypeId = $dao->relationship_type_id; - $relDirection = $dao->relationship_direction; - } - $relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $relTypeId); - if (in_array($values[$cid]['relationshipTypeId'], $relTypeIds - //CRM-16300 check if owner membership exist for related membership - ) && !empty($membershipValues['owner_membership_id']) && !empty($values[$mainRelatedContactId]['memberships'][$membershipValues['owner_membership_id']])) { + // @todo don't return relTypeId here - but it seems to be used later in a cryptic way (hint cryptic is not a complement). + list($relTypeId, $isDeletable) = self::isInheritedMembershipInvalidated($membershipValues, $values, $cid, $mainRelatedContactId); + if ($isDeletable) { CRM_Member_BAO_Membership::deleteRelatedMemberships($membershipValues['owner_membership_id'], $membershipValues['membership_contact_id']); } continue; @@ -1758,17 +1776,10 @@ SELECT relationship_type_id, relationship_direction if (!empty($membershipValues['status_id']) && $membershipValues['status_id'] == $pendingStatusId) { $membershipValues['skipStatusCal'] = TRUE; } - - // check whether we have some related memberships still available - $query = " -SELECT count(*) - FROM civicrm_membership - LEFT JOIN civicrm_membership_status ON (civicrm_membership_status.id = civicrm_membership.status_id) - WHERE membership_type_id = {$membershipValues['membership_type_id']} AND owner_membership_id = {$membershipValues['owner_membership_id']} - AND is_current_member = 1"; - $result = CRM_Core_DAO::singleValueQuery($query); - if ($result < CRM_Utils_Array::value('max_related', $membershipValues, PHP_INT_MAX)) { - CRM_Member_BAO_Membership::create($membershipValues); + // As long as the membership itself was not created by inheritance from the same contact + // that stands to inherit the membership we add an inherited membership. + if ($membershipInherittedFromContactID !== (int) $membershipValues['contact_id']) { + $membershipValues = self::addInheritedMembership($membershipValues); } } } @@ -2324,4 +2335,50 @@ AND cc.sort_name LIKE '%$name%'"; return $isCurrentEmployerRelationshipType; } + /** + * Is the inherited relationship invalidated by this relationship change. + * + * @param $membershipValues + * @param array $values + * @param int $cid + * @param int $mainRelatedContactId + * + * @return array + * @throws \CiviCRM_API3_Exception + */ + private static function isInheritedMembershipInvalidated($membershipValues, array $values, $cid, $mainRelatedContactId): array { + $membershipType = CRM_Member_BAO_MembershipType::getMembershipType($membershipValues['membership_type_id']); + $relTypeIds = $membershipType['relationship_type_id']; + $membshipInheritedFrom = $membershipValues['owner_membership_id'] ?? NULL; + if (!$membshipInheritedFrom || !in_array($values[$cid]['relationshipTypeId'], $relTypeIds)) { + return [implode(',', $relTypeIds), FALSE]; + } + //CRM-16300 check if owner membership exist for related membership + $isDeletable = !empty($values[$mainRelatedContactId]['memberships'][$membshipInheritedFrom]); + return [implode(',', $relTypeIds), $isDeletable]; + } + + /** + * Add an inherited membership, provided max related not exceeded. + * + * @param array $membershipValues + * + * @return array + * @throws \CRM_Core_Exception + */ + protected static function addInheritedMembership($membershipValues) { + $query = " +SELECT count(*) + FROM civicrm_membership + LEFT JOIN civicrm_membership_status ON (civicrm_membership_status.id = civicrm_membership.status_id) + WHERE membership_type_id = {$membershipValues['membership_type_id']} + AND owner_membership_id = {$membershipValues['owner_membership_id']} + AND is_current_member = 1"; + $result = CRM_Core_DAO::singleValueQuery($query); + if ($result < CRM_Utils_Array::value('max_related', $membershipValues, PHP_INT_MAX)) { + CRM_Member_BAO_Membership::create($membershipValues); + } + return $membershipValues; + } + } diff --git a/civicrm/CRM/Contact/BAO/SavedSearch.php b/civicrm/CRM/Contact/BAO/SavedSearch.php index 4037b82856..749a716a49 100644 --- a/civicrm/CRM/Contact/BAO/SavedSearch.php +++ b/civicrm/CRM/Contact/BAO/SavedSearch.php @@ -443,13 +443,6 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ 'case_to_relative', 'participant_relative', 'log_date_relative', - 'pledge_payment_date_relative', - 'pledge_start_date_relative', - 'pledge_end_date_relative', - 'pledge_create_date_relative', - 'member_join_date_relative', - 'member_start_date_relative', - 'member_end_date_relative', 'birth_date_relative', 'deceased_date_relative', 'mailing_date_relative', diff --git a/civicrm/CRM/Contact/DAO/Contact.php b/civicrm/CRM/Contact/DAO/Contact.php index 5bc2b38a3b..a7da4e718e 100644 --- a/civicrm/CRM/Contact/DAO/Contact.php +++ b/civicrm/CRM/Contact/DAO/Contact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Contact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:bd37bd31a0ac8ba4fd5f411fddef080b) + * (GenCodeChecksum:ee3bf9f2d1faed5a4de439ecf0537ac6) */ /** @@ -963,7 +963,9 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Communication Style'), 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'), + 'import' => TRUE, 'where' => 'civicrm_contact.communication_style_id', + 'headerPattern' => '/style/i', 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', @@ -1589,6 +1591,22 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id', ], + 'index_created_date' => [ + 'name' => 'index_created_date', + 'field' => [ + 0 => 'created_date', + ], + 'localizable' => FALSE, + 'sig' => 'civicrm_contact::0::created_date', + ], + 'index_modified_date' => [ + 'name' => 'index_modified_date', + 'field' => [ + 0 => 'modified_date', + ], + 'localizable' => FALSE, + 'sig' => 'civicrm_contact::0::modified_date', + ], ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } diff --git a/civicrm/CRM/Contact/Form/Contact.php b/civicrm/CRM/Contact/Form/Contact.php index f275cfa377..11bef4a629 100644 --- a/civicrm/CRM/Contact/Form/Contact.php +++ b/civicrm/CRM/Contact/Form/Contact.php @@ -227,7 +227,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); if ($defaults['is_deceased']) { - $displayName .= ' <span class="crm-contact-deceased">(deceased)</span>'; + $displayName .= ' <span class="crm-contact-deceased">(' . ts('deceased') . ')</span>'; } $displayName = ts('Edit %1', [1 => $displayName]); diff --git a/civicrm/CRM/Contact/Form/DedupeRules.php b/civicrm/CRM/Contact/Form/DedupeRules.php index 318138ff76..84dd28002b 100644 --- a/civicrm/CRM/Contact/Form/DedupeRules.php +++ b/civicrm/CRM/Contact/Form/DedupeRules.php @@ -62,7 +62,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { // check if $contactType is valid $contactTypes = civicrm_api3('Contact', 'getOptions', ['field' => "contact_type", 'context' => "validate"]); $contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0); - if (CRM_Utils_Array::value($contactType, $contactTypes['values'])) { + if (!empty($contactTypes['values'][$contactType])) { $this->_contactType = $contactType; } elseif (!empty($contactType)) { diff --git a/civicrm/CRM/Contact/Form/Merge.php b/civicrm/CRM/Contact/Form/Merge.php index 91f282f6bb..da804021ea 100644 --- a/civicrm/CRM/Contact/Form/Merge.php +++ b/civicrm/CRM/Contact/Form/Merge.php @@ -114,7 +114,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { CRM_Core_Session::singleton()->pushUserContext($browseUrl); } - $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid, json_decode($this->criteria, TRUE)); + $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid, json_decode($this->criteria, TRUE), TRUE, $this->limit); $join = CRM_Dedupe_Merger::getJoinOnDedupeTable(); $where = "de.id IS NULL"; @@ -331,7 +331,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { } if ($this->next && $this->_mergeId) { - $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid, json_decode($this->criteria, TRUE)); + $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid, json_decode($this->criteria, TRUE), TRUE, $this->limit); $join = CRM_Dedupe_Merger::getJoinOnDedupeTable(); $where = "de.id IS NULL"; diff --git a/civicrm/CRM/Contact/Form/Task/ProximityCommon.php b/civicrm/CRM/Contact/Form/Task/ProximityCommon.php index 6f632cb9de..b4a0bb0ab3 100644 --- a/civicrm/CRM/Contact/Form/Task/ProximityCommon.php +++ b/civicrm/CRM/Contact/Form/Task/ProximityCommon.php @@ -107,9 +107,7 @@ class CRM_Contact_Form_Task_ProximityCommon { if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) { $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance."); } - if (!CRM_Utils_Array::value('prox_postal_code', $fields) and - !CRM_Utils_Array::value('prox_city', $fields) - ) { + if (empty($fields['prox_postal_code']) && empty($fields['prox_city'])) { $errors["prox_distance"] = ts("City OR Postal Code are required to search by distance."); } } diff --git a/civicrm/CRM/Contact/Import/Form/MapField.php b/civicrm/CRM/Contact/Import/Form/MapField.php index df77083cca..0d2d3ce56e 100644 --- a/civicrm/CRM/Contact/Import/Form/MapField.php +++ b/civicrm/CRM/Contact/Import/Form/MapField.php @@ -36,6 +36,7 @@ */ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { + use CRM_Contact_Import_MetadataTrait; /** * An array of all contact fields with @@ -62,20 +63,19 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { * FIXME: This is essentially the same function as parent::defaultFromHeader * * @param string $columnName name of column header - * @param array $patterns pattern to match for the column * * @return string */ - public function defaultFromColumnName($columnName, $patterns) { + public function defaultFromColumnName($columnName) { if (!preg_match('/^[a-z0-9 ]$/i', $columnName)) { - if ($columnKey = array_search($columnName, $this->_mapperFields)) { + if ($columnKey = array_search($columnName, $this->getFieldTitles())) { $this->_fieldUsed[$columnKey] = TRUE; return $columnKey; } } - foreach ($patterns as $key => $re) { + foreach ($this->getHeaderPatterns() as $key => $re) { // Skip empty key/patterns if (!$key || !$re || strlen("$re") < 5) { continue; @@ -176,7 +176,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } $showColNames = TRUE; - if ($dataSource == 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) { + if ($dataSource === 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) { $showColNames = FALSE; } $this->assign('showColNames', $showColNames); @@ -193,46 +193,12 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { /** * Build the form object. + * + * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { - //to save the current mappings - if (!$this->get('savedMapping')) { - $saveDetailsName = ts('Save this field mapping'); - $this->applyFilter('saveMappingName', 'trim'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - else { - $savedMapping = $this->get('savedMapping'); - - list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue, $mappingWebsiteType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping, TRUE); - - //get loaded Mapping Fields - $mappingName = CRM_Utils_Array::value(1, $mappingName); - $mappingLocation = CRM_Utils_Array::value(1, $mappingLocation); - $mappingPhoneType = CRM_Utils_Array::value(1, $mappingPhoneType); - $mappingImProvider = CRM_Utils_Array::value(1, $mappingImProvider); - $mappingRelation = CRM_Utils_Array::value(1, $mappingRelation); - $mappingWebsiteType = CRM_Utils_Array::value(1, $mappingWebsiteType); - - $this->assign('loadedMapping', $savedMapping); - $this->set('loadedMapping', $savedMapping); - - $params = ['id' => $savedMapping]; - $temp = []; - $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp); - - $this->assign('savedName', $mappingDetails->name); - - $this->add('hidden', 'mappingId', $savedMapping); - - $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); - $saveDetailsName = ts('Save as a new field mapping'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - - $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + $savedMappingID = (int) $this->get('savedMapping'); + $this->buildSavedMappingFields($savedMappingID); $this->addFormRule(['CRM_Contact_Import_Form_MapField', 'formRule']); @@ -241,8 +207,6 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $defaults = []; $mapperKeys = array_keys($this->_mapperFields); $hasColumnNames = !empty($this->_columnNames); - $columnPatterns = $this->get('columnPatterns'); - $dataPatterns = $this->get('dataPatterns'); $hasLocationTypes = $this->get('fieldTypes'); $this->_location_types = ['Primary' => ts('Primary')] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); @@ -301,7 +265,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { $id = $first = $second = NULL; } - if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) { + if (($first === 'a' && $second === 'b') || ($first === 'b' && $second === 'a')) { $cType = $contactRelationCache[$id]["contact_type_{$second}"]; //CRM-5125 for contact subtype specific relationshiptypes @@ -322,7 +286,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (isset($hasLocationTypes[$name])) { $sel3[$key][$name] = $this->_location_types; } - elseif ($name == 'url') { + elseif ($name === 'url') { $sel3[$key][$name] = $websiteTypes; } else { @@ -354,7 +318,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } foreach ($highlightedFields as $k => $v) { - if ($v == $cType || $v == 'All') { + if ($v == $cType || $v === 'All') { $highlightedRelFields[$key][] = $k; } } @@ -385,7 +349,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (!empty($hasLocationTypes[$key])) { $options = $this->_location_types; } - elseif ($key == 'url') { + elseif ($key === 'url') { $options = $websiteTypes; } $sel2[$key] = $options; @@ -395,19 +359,26 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $js = "<script type='text/javascript'>\n"; $formName = 'document.forms.' . $this->_name; //used to warn for mismatch column count or mismatch mapping - $warning = 0; + CRM_Core_Session::singleton()->setStatus(NULL); + $processor = new CRM_Import_ImportProcessor(); + $processor->setMappingID($savedMappingID); + $processor->setFormName($formName); + $processor->setMetadata($this->getContactImportMetadata()); + $processor->setContactTypeByConstant($this->get('contactType')); + $processor->setContactSubType($this->get('contactSubType')); + for ($i = 0; $i < $this->_columnCount; $i++) { $sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', [1 => $i]), NULL); - if ($this->get('savedMapping')) { - list($mappingName, $defaults, $js) = $this->loadSavedMapping($mappingName, $i, $mappingRelation, $mappingWebsiteType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $defaults, $formName, $js, $hasColumnNames, $dataPatterns, $columnPatterns); + if ($this->get('savedMapping') && $processor->getFieldName($i)) { + $defaults["mapper[$i]"] = $processor->getSavedQuickformDefaultsForColumn($i); + $js .= $processor->getQuickFormJSForField($i); } else { $js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_0_');\n"; if ($hasColumnNames) { // do array search first to see if has mapped key - $columnKey = ''; - $columnKey = array_search($this->_columnNames[$i], $this->_mapperFields); + $columnKey = array_search($this->_columnNames[$i], $this->getFieldTitles()); if (isset($this->_fieldUsed[$columnKey])) { $defaults["mapper[$i]"] = $columnKey; $this->_fieldUsed[$key] = TRUE; @@ -415,9 +386,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { // Infer the default from the column names if we have them $defaults["mapper[$i]"] = [ - $this->defaultFromColumnName($this->_columnNames[$i], - $columnPatterns - ), + $this->defaultFromColumnName($this->_columnNames[$i]), 0, ]; } @@ -425,7 +394,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { // Otherwise guess the default from the form of the data $defaults["mapper[$i]"] = [ - $this->defaultFromData($dataPatterns, $i), + $this->defaultFromData($this->getDataPatterns(), $i), // $defaultLocationType->id 0, ]; @@ -441,16 +410,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (isset($mappingName) && ($this->_columnCount != count($mappingName)) ) { - $warning++; - } - - if ($warning != 0 && $this->get('savedMapping')) { - $session = CRM_Core_Session::singleton(); - $session->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.')); - } - else { - $session = CRM_Core_Session::singleton(); - $session->setStatus(NULL); + CRM_Core_Session::singleton()->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.')); } $this->setDefaults($defaults); @@ -597,17 +557,17 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //need to differentiate non location elements. if ($selOne && (is_numeric($selOne) || $selOne === 'Primary')) { - if ($fldName == 'url') { + if ($fldName === 'url') { $parserParameters['mapperWebsiteType'][$i] = $websiteTypes[$selOne]; } else { $locations[$i] = $locationTypes[$selOne]; $parserParameters['mapperLocType'][$i] = $selOne; if ($selTwo && is_numeric($selTwo)) { - if ($fldName == 'phone') { + if ($fldName === 'phone') { $parserParameters['mapperPhoneType'][$i] = $phoneTypes[$selTwo]; } - elseif ($fldName == 'im') { + elseif ($fldName === 'im') { $parserParameters['mapperImProvider'][$i] = $imProviders[$selTwo]; } } @@ -616,21 +576,21 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //relationship contact mapper info. list($id, $first, $second) = CRM_Utils_System::explode('_', $fldName, 3); - if (($first == 'a' && $second == 'b') || - ($first == 'b' && $second == 'a') + if (($first === 'a' && $second === 'b') || + ($first === 'b' && $second === 'a') ) { $parserParameters['mapperRelated'][$i] = $this->_mapperFields[$fldName]; if ($selOne) { - if ($selOne == 'url') { + if ($selOne === 'url') { $parserParameters['relatedContactWebsiteType'][$i] = $websiteTypes[$selTwo]; } else { $parserParameters['relatedContactLocType'][$i] = CRM_Utils_Array::value($selTwo, $locationTypes); if ($selThree) { - if ($selOne == 'phone') { + if ($selOne === 'phone') { $parserParameters['relatedContactPhoneType'][$i] = $phoneTypes[$selThree]; } - elseif ($selOne == 'im') { + elseif ($selOne === 'im') { $parserParameters['relatedContactImProvider'][$i] = $imProviders[$selThree]; } } @@ -703,7 +663,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { elseif (CRM_Utils_Array::value('1', $mapperKeys[$i]) == 'im') { $updateMappingFields->im_provider_id = isset($mapperKeys[$i][3]) ? $mapperKeys[$i][3] : NULL; } - $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; + $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) && is_numeric($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; } } else { @@ -848,160 +808,4 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { return $saveMappingFields->mapping_id; } - /** - * @param $mappingName - * @param int $i - * @param $mappingRelation - * @param $mappingWebsiteType - * @param $mappingLocation - * @param $mappingPhoneType - * @param $mappingImProvider - * @param array $defaults - * @param string $formName - * @param string $js - * @param bool $hasColumnNames - * @param array $dataPatterns - * @param array $columnPatterns - * - * @return array - */ - protected function loadSavedMapping($mappingName, $i, $mappingRelation, $mappingWebsiteType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $defaults, $formName, $js, $hasColumnNames, $dataPatterns, $columnPatterns) { - $jsSet = FALSE; - if (isset($mappingName[$i])) { - if ($mappingName[$i] != ts('- do not import -')) { - - if (isset($mappingRelation[$i])) { - // relationship mapping - switch ($this->get('contactType')) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: - $contactType = 'Individual'; - break; - - case CRM_Import_Parser::CONTACT_HOUSEHOLD: - $contactType = 'Household'; - break; - - case CRM_Import_Parser::CONTACT_ORGANIZATION: - $contactType = 'Organization'; - } - //CRM-5125 - $contactSubType = NULL; - if ($this->get('contactSubType')) { - $contactSubType = $this->get('contactSubType'); - } - - $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $contactType, - FALSE, 'label', TRUE, $contactSubType - ); - - foreach ($relations as $key => $var) { - if ($key == $mappingRelation[$i]) { - $relation = $key; - break; - } - } - - $contactDetails = strtolower(str_replace(" ", "_", $mappingName[$i])); - $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL; - $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0; - $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL; - //get provider id from saved mappings - $imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL; - - if ($websiteTypeId) { - $defaults["mapper[$i]"] = [$relation, $contactDetails, $websiteTypeId]; - if (!$websiteTypeId) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - } - else { - // default for IM/phone when mapping with relation is true - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } - $defaults["mapper[$i]"] = [$relation, $contactDetails, $locationId, $typeId]; - if (!$locationId) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - } - // fix for edge cases, CRM-4954 - if ($contactDetails == 'image_url') { - $contactDetails = str_replace('url', 'URL', $contactDetails); - } - - if (!$contactDetails) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - - if ((!$phoneType) && (!$imProvider)) { - $js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - } - //$js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - $jsSet = TRUE; - } - else { - $mappingHeader = array_keys($this->_mapperFields, $mappingName[$i]); - $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL; - $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0; - $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL; - // get IM service provider id - $imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL; - - if ($websiteTypeId) { - if (!$websiteTypeId) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - $defaults["mapper[$i]"] = [$mappingHeader[0], $websiteTypeId]; - } - else { - if (!$locationId) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - //default for IM/phone without related contact - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } - $defaults["mapper[$i]"] = [$mappingHeader[0] ?? '', $locationId, $typeId]; - } - - if ((!$phoneType) && (!$imProvider)) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - - $js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - - $jsSet = TRUE; - } - } - else { - $defaults["mapper[$i]"] = []; - } - if (!$jsSet) { - for ($k = 1; $k < 4; $k++) { - $js .= "{$formName}['mapper[$i][$k]'].style.display = 'none';\n"; - } - } - } - else { - // this load section to help mapping if we ran out of saved columns when doing Load Mapping - $js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_0_');\n"; - - if ($hasColumnNames) { - $defaults["mapper[$i]"] = [$this->defaultFromColumnName($this->_columnNames[$i], $columnPatterns)]; - } - else { - $defaults["mapper[$i]"] = [$this->defaultFromData($dataPatterns, $i)]; - } - } - return [$mappingName, $defaults, $js]; - } - } diff --git a/civicrm/CRM/Contact/Import/MetadataTrait.php b/civicrm/CRM/Contact/Import/MetadataTrait.php new file mode 100644 index 0000000000..ba55c45f38 --- /dev/null +++ b/civicrm/CRM/Contact/Import/MetadataTrait.php @@ -0,0 +1,122 @@ +<?php + +/** + * Trait CRM_Contact_Import_MetadataTrait + * + * Trait for handling contact import specific metadata so it + * does not need to be passed from one form to the next. + */ +trait CRM_Contact_Import_MetadataTrait { + + /** + * Get metadata for contact importable fields. + * + * @return array + */ + protected function getContactImportMetadata(): array { + $cacheKey = 'importable_contact_field_metadata' . $this->getContactType() . $this->getContactSubType(); + if (Civi::cache('fields')->has($cacheKey)) { + return Civi::cache('fields')->get($cacheKey); + } + $contactFields = CRM_Contact_BAO_Contact::importableFields($this->getContactType()); + // exclude the address options disabled in the Address Settings + $fields = CRM_Core_BAO_Address::validateAddressOptions($contactFields); + + //CRM-5125 + //supporting import for contact subtypes + $csType = NULL; + if ($this->getContactSubType()) { + //custom fields for sub type + $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($this->getContactSubType()); + + if (!empty($subTypeFields)) { + foreach ($subTypeFields as $customSubTypeField => $details) { + $fields[$customSubTypeField] = $details; + } + } + } + + foreach ($this->getRelationships() as $key => $var) { + list($type) = explode('_', $key); + $relationshipType[$key]['title'] = $var; + $relationshipType[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/'; + $relationshipType[$key]['import'] = TRUE; + $relationshipType[$key]['relationship_type_id'] = $type; + $relationshipType[$key]['related'] = TRUE; + } + + if (!empty($relationshipType)) { + $fields = array_merge($fields, [ + 'related' => [ + 'title' => ts('- related contact info -'), + ], + ], $relationshipType); + } + Civi::cache('fields')->set($cacheKey, $fields); + return $fields; + } + + /** + * Get sorted available relationships. + * + * @return array + */ + protected function getRelationships(): array { + $cacheKey = 'importable_contact_relationship_field_metadata' . $this->getContactType() . $this->getContactSubType(); + if (Civi::cache('fields')->has($cacheKey)) { + return Civi::cache('fields')->get($cacheKey); + } + //Relationship importables + $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType( + NULL, NULL, NULL, $this->getContactType(), + FALSE, 'label', TRUE, $this->getContactSubType() + ); + asort($relations); + Civi::cache('fields')->set($cacheKey, $relations); + return $relations; + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getHeaderPatterns() { + return CRM_Utils_Array::collect('headerPattern', $this->getContactImportMetadata()); + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getDataPatterns() { + return CRM_Utils_Array::collect('dataPattern', $this->getContactImportMetadata()); + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getFieldTitles() { + return CRM_Utils_Array::collect('title', $this->getContactImportMetadata()); + } + + /** + * Get configured contact type. + */ + protected function getContactType() { + return $this->_contactType ?? 'Individual'; + } + + /** + * Get configured contact sub type. + * + * @return string + */ + protected function getContactSubType() { + return $this->_contactSubType ?? NULL; + } + +} diff --git a/civicrm/CRM/Contact/Import/Parser.php b/civicrm/CRM/Contact/Import/Parser.php index c0fac2ee07..067582ace3 100644 --- a/civicrm/CRM/Contact/Import/Parser.php +++ b/civicrm/CRM/Contact/Import/Parser.php @@ -578,6 +578,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { * @return array */ public function getColumnPatterns() { + CRM_Core_Error::deprecatedFunctionWarning('no longer used- use CRM_Contact_Import_MetadataTrait'); $values = []; foreach ($this->_fields as $name => $field) { $values[$name] = $field->_columnPattern; @@ -616,8 +617,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { $store->set('fields', $this->getSelectValues()); $store->set('fieldTypes', $this->getSelectTypes()); - $store->set('columnPatterns', $this->getColumnPatterns()); - $store->set('dataPatterns', $this->getDataPatterns()); $store->set('columnCount', $this->_activeFieldCount); $store->set('totalRowCount', $this->_totalCount); @@ -1207,6 +1206,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { if (!array_key_exists($blockFieldName, $values)) { continue; } + $blockIndex = $values['location_type_id'] . (!empty($values['phone_type_id']) ? '_' . $values['phone_type_id'] : ''); // block present in value array. if (!array_key_exists($blockFieldName, $params) || !is_array($params[$blockFieldName])) { @@ -1221,13 +1221,13 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { } _civicrm_api3_store_values($fields[$block], $values, - $params[$blockFieldName][$values['location_type_id']] + $params[$blockFieldName][$blockIndex] ); - $this->fillPrimary($params[$blockFieldName][$values['location_type_id']], $values, $block, CRM_Utils_Array::value('id', $params)); + $this->fillPrimary($params[$blockFieldName][$blockIndex], $values, $block, CRM_Utils_Array::value('id', $params)); if (empty($params['id']) && (count($params[$blockFieldName]) == 1)) { - $params[$blockFieldName][$values['location_type_id']]['is_primary'] = TRUE; + $params[$blockFieldName][$blockIndex]['is_primary'] = TRUE; } // we only process single block at a time. diff --git a/civicrm/CRM/Contact/Import/Parser/Contact.php b/civicrm/CRM/Contact/Import/Parser/Contact.php index a93dfc1ae4..1002b8adcb 100644 --- a/civicrm/CRM/Contact/Import/Parser/Contact.php +++ b/civicrm/CRM/Contact/Import/Parser/Contact.php @@ -37,6 +37,9 @@ require_once 'api/v3/utils.php'; * class to parse contact csv files */ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { + + use CRM_Contact_Import_MetadataTrait; + protected $_mapperKeys = []; protected $_mapperLocType = []; protected $_mapperPhoneType; @@ -122,11 +125,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * @param array $mapperRelatedContactWebsiteType */ public function __construct( - &$mapperKeys, $mapperLocType = [], $mapperPhoneType = [], $mapperImProvider = [], $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], + $mapperKeys, $mapperLocType = [], $mapperPhoneType = [], $mapperImProvider = [], $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], $mapperWebsiteType = [], $mapperRelatedContactWebsiteType = [] ) { parent::__construct(); - $this->_mapperKeys = &$mapperKeys; + $this->_mapperKeys = $mapperKeys; $this->_mapperLocType = &$mapperLocType; $this->_mapperPhoneType = &$mapperPhoneType; $this->_mapperWebsiteType = $mapperWebsiteType; @@ -2054,49 +2057,9 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * Set field metadata. */ protected function setFieldMetadata() { - $contactFields = CRM_Contact_BAO_Contact::importableFields($this->_contactType); - // exclude the address options disabled in the Address Settings - $fields = CRM_Core_BAO_Address::validateAddressOptions($contactFields); - - //CRM-5125 - //supporting import for contact subtypes - $csType = NULL; - if (!empty($this->_contactSubType)) { - //custom fields for sub type - $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($this->_contactSubType); - - if (!empty($subTypeFields)) { - foreach ($subTypeFields as $customSubTypeField => $details) { - $fields[$customSubTypeField] = $details; - } - } - } - - //Relationship importables - $this->_relationships = $relations - = CRM_Contact_BAO_Relationship::getContactRelationshipType( - NULL, NULL, NULL, $this->_contactType, - FALSE, 'label', TRUE, $this->_contactSubType - ); - asort($relations); - - foreach ($relations as $key => $var) { - list($type) = explode('_', $key); - $relationshipType[$key]['title'] = $var; - $relationshipType[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/'; - $relationshipType[$key]['import'] = TRUE; - $relationshipType[$key]['relationship_type_id'] = $type; - $relationshipType[$key]['related'] = TRUE; - } - - if (!empty($relationshipType)) { - $fields = array_merge($fields, [ - 'related' => [ - 'title' => ts('- related contact info -'), - ], - ], $relationshipType); - } - $this->setImportableFieldsMetadata($fields); + $this->setImportableFieldsMetadata($this->getContactImportMetadata()); + // Probably no longer needed but here for now. + $this->_relationships = $this->getRelationships(); } } diff --git a/civicrm/CRM/Contact/Page/AJAX.php b/civicrm/CRM/Contact/Page/AJAX.php index 7dcedcc8cd..3ac0326cf7 100644 --- a/civicrm/CRM/Contact/Page/AJAX.php +++ b/civicrm/CRM/Contact/Page/AJAX.php @@ -638,6 +638,7 @@ LIMIT {$offset}, {$rowCount} $gid = CRM_Utils_Request::retrieve('gid', 'Positive'); $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive'); + $limit = CRM_Utils_Request::retrieveValue('limit', 'Positive', 0); $null = NULL; $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $null, FALSE, '{}'); $selected = CRM_Utils_Request::retrieveValue('selected', 'Boolean'); @@ -646,7 +647,7 @@ LIMIT {$offset}, {$rowCount} } $whereClause = $orderByClause = ''; - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE)); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE), TRUE, $limit); $searchRows = []; diff --git a/civicrm/CRM/Contact/Page/DedupeFind.php b/civicrm/CRM/Contact/Page/DedupeFind.php index 8b22a7140d..b7a22ea666 100644 --- a/civicrm/CRM/Contact/Page/DedupeFind.php +++ b/civicrm/CRM/Contact/Page/DedupeFind.php @@ -105,13 +105,13 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { 'reset' => 1, 'rgid' => $rgid, 'gid' => $gid, - 'limit' => $limit, + 'limit' => (int) $limit, 'criteria' => $criteria, ]; $this->assign('urlQuery', CRM_Utils_System::makeQueryString($urlQry)); $this->assign('isSelected', $this->isSelected()); $criteria = json_decode($criteria, TRUE); - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, TRUE, $limit); $this->assign('cacheKey', $cacheKeyString); if ($context == 'search') { @@ -129,7 +129,7 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { } elseif ($action & CRM_Core_Action::MAP) { // do a batch merge if requested - $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', 75, 2, $criteria); + $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', 75, 2, $criteria, TRUE, NULL, $limit); $skippedCount = CRM_Utils_Request::retrieve('skipped', 'Positive', $this, FALSE, 0); $skippedCount = $skippedCount + count($result['skipped']); diff --git a/civicrm/CRM/Contact/Page/DedupeMerge.php b/civicrm/CRM/Contact/Page/DedupeMerge.php index 1dddf56194..348f65b1d8 100644 --- a/civicrm/CRM/Contact/Page/DedupeMerge.php +++ b/civicrm/CRM/Contact/Page/DedupeMerge.php @@ -70,7 +70,7 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { ]; $criteria = json_decode($criteria, TRUE); - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, TRUE, $limit); if ($mode == 'aggressive' && !CRM_Core_Permission::check('force merge duplicate contacts')) { CRM_Core_Session::setStatus(ts('You do not have permission to force merge duplicate contact records'), ts('Permission Denied'), 'error'); @@ -98,7 +98,7 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { for ($i = 1; $i <= ceil($total / self::BATCHLIMIT); $i++) { $task = new CRM_Queue_Task( ['CRM_Contact_Page_DedupeMerge', 'callBatchMerge'], - [$rgid, $gid, $mode, self::BATCHLIMIT, $onlyProcessSelected, $criteria], + [$rgid, $gid, $mode, self::BATCHLIMIT, $onlyProcessSelected, $criteria, $limit], "Processed " . $i * self::BATCHLIMIT . " pair of duplicates out of " . $total ); @@ -132,11 +132,15 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { * @param int $batchLimit * @param int $isSelected * @param array $criteria + * @param int $searchLimit * * @return int + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria) { - CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, TRUE, FALSE); + public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria, $searchLimit) { + CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, TRUE, FALSE, $searchLimit); return CRM_Queue_Task::TASK_SUCCESS; } diff --git a/civicrm/CRM/Contact/Page/View.php b/civicrm/CRM/Contact/Page/View.php index 8f7a78f214..52fb0683bb 100644 --- a/civicrm/CRM/Contact/Page/View.php +++ b/civicrm/CRM/Contact/Page/View.php @@ -323,7 +323,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { // set page title $title = "{$contactImage} {$displayName}"; if ($contactDetails[$contactId]['isDeceased']) { - $title .= ' <span class="crm-contact-deceased">(deceased)</span>'; + $title .= ' <span class="crm-contact-deceased">(' . ts('deceased') . ')</span>'; } if ($isDeleted) { $title = "<del>{$title}</del>"; diff --git a/civicrm/CRM/Contribute/BAO/Contribution.php b/civicrm/CRM/Contribute/BAO/Contribution.php index 0268840ba9..33a350ef6a 100644 --- a/civicrm/CRM/Contribute/BAO/Contribution.php +++ b/civicrm/CRM/Contribute/BAO/Contribution.php @@ -241,7 +241,16 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { //add Account details $params['contribution'] = $contribution; - self::recordFinancialAccounts($params); + if (empty($params['is_post_payment_create'])) { + // If this is being called from the Payment.create api/ BAO then that Entity + // takes responsibility for the financial transactions. In fact calling Payment.create + // to add payments & having it call completetransaction and / or contribution.create + // to update related entities is the preferred flow. + // Note that leveraging this parameter for any other code flow is not supported and + // is likely to break in future and / or cause serious problems in your data. + // https://github.com/civicrm/civicrm-core/pull/14673 + self::recordFinancialAccounts($params); + } if (self::isUpdateToRecurringContribution($params)) { CRM_Contribute_BAO_ContributionRecur::updateOnNewPayment( @@ -946,19 +955,10 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * @return int */ public static function getToFinancialAccount($contribution, $params) { - $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - $pendingStatus = [ - array_search('Pending', $contributionStatuses), - array_search('In Progress', $contributionStatuses), - ]; - if (in_array(CRM_Utils_Array::value('contribution_status_id', $contribution), $pendingStatus)) { - return CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['financial_type_id'], 'Accounts Receivable Account is'); - } - elseif (!empty($params['payment_processor'])) { + if (!empty($params['payment_processor'])) { return CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['payment_processor'], NULL, 'civicrm_payment_processor'); } - elseif (!empty($params['payment_instrument_id'])) { + if (!empty($params['payment_instrument_id'])) { return CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($contribution['payment_instrument_id']); } else { @@ -1016,6 +1016,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * @return array */ protected static function cancel($processContributionObject, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it $processContribution = FALSE; $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); if (is_array($memberships)) { @@ -1205,6 +1206,27 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { return [TRUE, $isARefund]; } + /** + * It is possible to override the membership id that is updated from the payment processor. + * + * Historically Paypal does this & it still does if it determines data is messed up - see + * https://lab.civicrm.org/dev/membership/issues/13 + * + * Read the comment block on repeattransaction for more information + * about how things should work. + * + * @param int $contributionID + * @param array $input + * + * @throws \CiviCRM_API3_Exception + */ + protected static function handleMembershipIDOverride($contributionID, $input) { + if (!empty($input['membership_id'])) { + Civi::log()->debug('The related membership id has been overridden - this may impact data - see https://github.com/civicrm/civicrm-core/pull/15053'); + civicrm_api3('MembershipPayment', 'create', ['contribution_id' => $contributionID, 'membership_id' => $input['membership_id']]); + } + } + /** * @inheritDoc */ @@ -2400,11 +2422,35 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ /** * Repeat a transaction as part of a recurring series. * - * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function - * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a - * subsequent call to the contribution.completetransaction api. - * - * The completeTransaction functionality has historically been overloaded to both complete and repeat payments. + * The ideal flow is + * 1) Processor calls contribution.repeattransaction with contribution_status_id = Pending + * 2) The repeattransaction loads the 'template contribution' and calls a hook to allow altering of it . + * 3) Repeat transaction calls order.create to create the pending contribution with correct line items + * and associated entities. + * 4) The calling code calls Payment.create which in turn calls CompleteOrder (if completing) + * which updates the various entities and sends appropriate emails. + * + * Gaps in the above (@todo) + * 1) many processors still call repeattransaction with contribution_status_id = Completed + * 2) repeattransaction code is current munged into completeTransaction code for historical bad coding reasons + * 3) Repeat transaction duplicates rather than calls Order.create + * 4) Use of payment.create still limited - completetransaction is more common. + * 5) the template transaction is tricky - historically we used the first contribution + * linked to a recurring contribution. More recently that was changed to be the most recent. + * Ideally it would be an actual template - not a contribution used as a template which + * would give more appropriate flexibility. Note line_items have an entity so that table + * could be used for the line item template - the difficulty is the custom fields... + * 6) the determination of the membership to be linked is tricksy. The prioritised method is + * to load the membership(s) referred to via line items in the template transactions. Any other + * method is likely to lead to incorrect line items & related entities being created (as the line_item + * link is a required part of 'correct data'). However there are 3 other methods to determine it + * - membership_payment record + * - civicrm_membership.contribution_recur_id + * - input override. + * Passing in an input override WILL ensure the membership is extended to prevent regressions + * of historical processors since this has been handled 'forever' - specifically for paypal. + * albeit by an even nastier mechanism than the current input override. + * The count is out on how correct related entities wind up in this case. * * @param CRM_Contribute_BAO_Contribution $contribution * @param array $input @@ -2468,6 +2514,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ $createContribution = civicrm_api3('Contribution', 'create', $contributionParams); $contribution->id = $createContribution['id']; CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id); + self::handleMembershipIDOverride($contribution->id, $input); return TRUE; } } @@ -2962,7 +3009,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac if (!empty($lineItems)) { $firstLineItem = reset($lineItems); $priceSet = []; - if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) { + if (!empty($firstLineItem['price_set_id'])) { $priceSet = civicrm_api3('PriceSet', 'getsingle', [ 'id' => $firstLineItem['price_set_id'], 'return' => 'is_quick_config, id', @@ -3901,40 +3948,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac return FALSE; } - /** - * Function to record additional payment for partial and refund contributions. - * - * @param int $contributionId - * is the invoice contribution id (got created after processing participant payment). - * @param array $trxnsData - * to take user provided input of transaction details. - * @param string $paymentType - * 'owed' for purpose of recording partial payments, 'refund' for purpose of recording refund payments. - * @param int $participantId - * @param bool $updateStatus - * - * @return int - * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception - */ - public static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL, $updateStatus = TRUE) { - - if ($paymentType == 'owed') { - $financialTrxn = CRM_Financial_BAO_Payment::recordPayment($contributionId, $trxnsData, $participantId); - if (!empty($financialTrxn)) { - self::recordPaymentActivity($contributionId, $participantId, $financialTrxn->total_amount, $financialTrxn->currency, $financialTrxn->trxn_date); - return $financialTrxn->id; - } - } - elseif ($paymentType == 'refund') { - $trxnsData['total_amount'] = -$trxnsData['total_amount']; - $trxnsData['participant_id'] = $participantId; - $trxnsData['contribution_id'] = $contributionId; - return civicrm_api3('Payment', 'create', $trxnsData)['id']; - } - } - /** * @param int $targetCid * @param $activityType @@ -4013,7 +4026,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId); $baseTrxnId = $baseTrxnId['financialTrxnId']; } - if (!CRM_Utils_Array::value('total_amount', $total) || $usingLineTotal) { + if (empty($total['total_amount']) || $usingLineTotal) { $total = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } else { @@ -4408,10 +4421,16 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * @param CRM_Core_Transaction $transaction * @param int $recur * @param CRM_Contribute_BAO_Contribution $contribution + * @param bool $isPostPaymentCreate + * Is this being called from the payment.create api. If so the api has taken care of financial entities. + * Note that our goal is that this would only ever be called from payment.create and never handle financials (only + * transitioning related elements). * * @return array + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution) { + public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isPostPaymentCreate = FALSE) { $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)) { @@ -4531,6 +4550,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac } $contributionParams['id'] = $contribution->id; + $contributionParams['is_post_payment_create'] = $isPostPaymentCreate; // CRM-19309 - if you update the contribution here with financial_type_id it can/will mess with $lineItem // unsetting it here does NOT cause any other contribution test to fail! @@ -4538,7 +4558,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $contributionResult = civicrm_api3('Contribution', 'create', $contributionParams); // Add new soft credit against current $contribution. - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id); } @@ -5046,7 +5066,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac public static function checkContributeSettings($name = NULL, $checkInvoicing = FALSE) { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); - if ($checkInvoicing && !CRM_Utils_Array::value('invoicing', $contributeSettings)) { + if ($checkInvoicing && empty($contributeSettings['invoicing'])) { return NULL; } diff --git a/civicrm/CRM/Contribute/BAO/ContributionPage.php b/civicrm/CRM/Contribute/BAO/ContributionPage.php index 164ab946ab..a108185d42 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionPage.php +++ b/civicrm/CRM/Contribute/BAO/ContributionPage.php @@ -328,8 +328,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio if ($preID = CRM_Utils_Array::value('custom_pre_id', $values)) { if (!empty($values['related_contact'])) { $preProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($preID); - //@todo - following line should not refer to undefined $postProfileTypes? figure out way to test - if (in_array('Individual', $preProfileTypes) || in_array('Contact', $postProfileTypes)) { + if (in_array('Individual', $preProfileTypes) || in_array('Contact', $preProfileTypes)) { //Take Individual contact ID $userID = CRM_Utils_Array::value('related_contact', $values); } diff --git a/civicrm/CRM/Contribute/BAO/ContributionRecur.php b/civicrm/CRM/Contribute/BAO/ContributionRecur.php index c6197f14ce..233377eb15 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionRecur.php +++ b/civicrm/CRM/Contribute/BAO/ContributionRecur.php @@ -284,6 +284,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi $recur->cancel_date = date('YmdHis'); $recur->save(); + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it $dao = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recurId); if ($dao && $dao->recur_id) { $details = CRM_Utils_Array::value('details', $activityParams); diff --git a/civicrm/CRM/Contribute/Form/AdditionalPayment.php b/civicrm/CRM/Contribute/Form/AdditionalPayment.php index f34854f597..fdb7c478f3 100644 --- a/civicrm/CRM/Contribute/Form/AdditionalPayment.php +++ b/civicrm/CRM/Contribute/Form/AdditionalPayment.php @@ -73,6 +73,11 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract public $_action = NULL; + /** + * Pre process form. + * + * @throws \CRM_Core_Exception + */ public function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); @@ -118,11 +123,11 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->_paymentType = 'owed'; } else { - CRM_Core_Error::fatal(ts('No payment information found for this record')); + throw new CRM_Core_Exception(ts('No payment information found for this record')); } if (!empty($this->_mode) && $this->_paymentType == 'refund') { - CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use')); + throw new CRM_Core_Exception(ts('Credit card payment is not for Refund payments use')); } list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); @@ -139,6 +144,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract * Is this function being called from a datatable selector. * * If so we don't want to show the buttons. + * + * @throws \CRM_Core_Exception */ protected function isBeingCalledFromSelectorContext() { return CRM_Utils_Request::retrieve('selector', 'Positive'); @@ -356,19 +363,16 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->processCreditCard(); } - $defaults = []; - $contribution = civicrm_api3('Contribution', 'getsingle', [ - 'return' => ["contribution_status_id"], - 'id' => $this->_contributionId, - ]); - $contributionStatusId = CRM_Utils_Array::value('contribution_status_id', $contribution); - $paymentID = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $this->_params, $this->_paymentType, $participantId); - // Fetch the contribution & do proportional line item assignment - $params = ['id' => $this->_contributionId]; - $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); - // @todo - this line needs to be moved to the Payment.create api - it's not form layer appropriate. - // testing required. - CRM_Contribute_BAO_Contribution::addPayments([$contribution], $contributionStatusId); + $trxnsData = $this->_params; + if ($this->_paymentType == 'refund') { + $trxnsData['total_amount'] = -$trxnsData['total_amount']; + } + $trxnsData['participant_id'] = $participantId; + $trxnsData['contribution_id'] = $this->_contributionId; + // From the + $trxnsData['is_send_contribution_notification'] = FALSE; + $paymentID = civicrm_api3('Payment', 'create', $trxnsData)['id']; + if ($this->_contributionId && CRM_Core_Permission::access('CiviMember')) { $membershipPaymentCount = civicrm_api3('MembershipPayment', 'getCount', ['contribution_id' => $this->_contributionId]); if ($membershipPaymentCount) { diff --git a/civicrm/CRM/Contribute/Form/Contribution.php b/civicrm/CRM/Contribute/Form/Contribution.php index 23ec91d2d9..057ba8f142 100644 --- a/civicrm/CRM/Contribute/Form/Contribution.php +++ b/civicrm/CRM/Contribute/Form/Contribution.php @@ -665,10 +665,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $componentDetails = []; if ($this->_id) { $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); - if (CRM_Utils_Array::value('membership', $componentDetails)) { + if (!empty($componentDetails['membership'])) { $component = 'membership'; } - elseif (CRM_Utils_Array::value('participant', $componentDetails)) { + elseif (!empty($componentDetails['participant'])) { $component = 'participant'; } } @@ -831,8 +831,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); $isCancelledStatus = ($this->_values['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled')); - if (CRM_Utils_Array::value('membership', $componentDetails) || - CRM_Utils_Array::value('participant', $componentDetails) || + if (!empty($componentDetails['membership']) || + !empty($componentDetails['participant']) || // if status is Cancelled freeze Amount, Payment Instrument, Check #, Financial Type, // Net and Fee Amounts are frozen in AdditionalInfo::buildAdditionalDetail $isCancelledStatus @@ -1710,7 +1710,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) { $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); - if (!CRM_Utils_Array::value('invoicing', $invoiceSettings)) { + if (empty($invoiceSettings['invoicing'])) { return; } $taxRate = []; diff --git a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php index 601b3bf3b4..95fddb2ce9 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php @@ -117,7 +117,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $pledgeParams['frequency_day'] = 1; } $pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd"); - if (CRM_Utils_Array::value('start_date', $params)) { + if (!empty($params['start_date'])) { $pledgeParams['frequency_day'] = intval(date("d", strtotime(CRM_Utils_Array::value('start_date', $params)))); $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime(CRM_Utils_Array::value('start_date', $params))); } @@ -1364,7 +1364,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $membershipTypeIDs = (array) $membershipParams['selectMembership']; $membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs); $membershipType = empty($membershipTypes) ? [] : reset($membershipTypes); - $isPending = $this->getIsPending(); $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType)); $this->_values['membership_name'] = CRM_Utils_Array::value('name', $membershipType); @@ -1392,7 +1391,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->postProcessMembership($membershipParams, $contactID, $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID, - $membershipLineItems, $isPending); + $membershipLineItems); $this->assign('membership_assign', TRUE); $this->set('membershipTypeID', $membershipParams['selectMembership']); @@ -1424,14 +1423,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * @param int $financialTypeID * @param array $unprocessedLineItems * Line items for payment options chosen on the form. - * @param bool $isPending * * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception + * @throws \Civi\Payment\Exception\PaymentProcessorException */ protected function postProcessMembership( $membershipParams, $contactID, &$form, $premiumParams, $customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID, - $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems, $isPending) { + $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems) { $membershipContribution = NULL; $isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE); @@ -1532,13 +1532,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $i++; $numTerms = CRM_Utils_Array::value($memType, $typesTerms, 1); - if (!empty($membershipContribution)) { - $pendingStatus = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'); - $pending = ($membershipContribution->contribution_status_id == $pendingStatus) ? TRUE : FALSE; - } - else { - $pending = $isPending; - } $contributionRecurID = isset($form->_params['contributionRecurID']) ? $form->_params['contributionRecurID'] : NULL; $membershipSource = NULL; @@ -1560,6 +1553,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } + // @todo Move this into CRM_Member_BAO_Membership::processMembership + if (!empty($membershipContribution)) { + $pending = ($membershipContribution->contribution_status_id == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE; + } + else { + $pending = $this->getIsPending(); + } list($membership, $renewalMode, $dates) = CRM_Member_BAO_Membership::processMembership( $contactID, $memType, $isTest, date('YmdHis'), CRM_Utils_Array::value('cms_contactID', $membershipParams), @@ -1942,7 +1942,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $form->_fields['billing_first_name'] = 1; $form->_fields['billing_last_name'] = 1; // CRM-18854 - Set form values to allow pledge to be created for api test. - if (CRM_Utils_Array::value('pledge_block_id', $params)) { + if (!empty($params['pledge_block_id'])) { $form->_values['pledge_id'] = CRM_Utils_Array::value('pledge_id', $params, NULL); $form->_values['pledge_block_id'] = $params['pledge_block_id']; $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($params['id']); diff --git a/civicrm/CRM/Contribute/Form/Contribution/Main.php b/civicrm/CRM/Contribute/Form/Contribution/Main.php index 44d9ffecf1..6b8d915b8d 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Main.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Main.php @@ -631,9 +631,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu public static function formRule($fields, $files, $self) { $errors = []; $amount = self::computeAmount($fields, $self->_values); - if (CRM_Utils_Array::value('auto_renew', $fields) && - CRM_Utils_Array::value('payment_processor_id', $fields) == 0 - ) { + if (!empty($fields['auto_renew']) && empty($fields['payment_processor_id'])) { $errors['auto_renew'] = ts('You cannot have auto-renewal on if you are paying later.'); } @@ -876,15 +874,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu //CRM-16285 - Function to handle validation errors on form, for recurring contribution field. CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors); - if (!empty($fields['is_recur']) && - CRM_Utils_Array::value('payment_processor_id', $fields) == 0 - ) { + if (!empty($fields['is_recur']) && empty($fields['payment_processor_id'])) { $errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.'); } // validate PCP fields - if not anonymous, we need a nick name value if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) && - (CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) && + empty($fields['pcp_is_anonymous']) && CRM_Utils_Array::value('pcp_roll_nickname', $fields) == '' ) { $errors['pcp_roll_nickname'] = ts('Please enter a name to include in the Honor Roll, or select \'contribute anonymously\'.'); @@ -915,13 +911,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.'); } else { - if (CRM_Utils_Array::value('pledge_installments', $fields) == NULL) { + if (!isset($fields['pledge_installments'])) { $errors['pledge_installments'] = ts('Pledge Installments is required field.'); } elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 1) { $errors['pledge_installments'] = ts('Pledges consist of multiple scheduled payments. Select one-time contribution if you want to make your gift in a single payment.'); } - elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 0) { + elseif (empty($fields['pledge_installments'])) { $errors['pledge_installments'] = ts('Pledge Installments field must be > 1.'); } } @@ -931,10 +927,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $errors['pledge_frequency_interval'] = ts('Please enter a valid Pledge Frequency Interval.'); } else { - if (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == NULL) { + if (!isset($fields['pledge_frequency_interval'])) { $errors['pledge_frequency_interval'] = ts('Pledge Frequency Interval. is required field.'); } - elseif (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == 0) { + elseif (empty($fields['pledge_frequency_interval'])) { $errors['pledge_frequency_interval'] = ts('Pledge frequency interval field must be > 0'); } } @@ -947,7 +943,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu return $errors; } - if (CRM_Utils_Array::value('payment_processor_id', $fields) === NULL) { + if (!isset($fields['payment_processor_id'])) { $errors['payment_processor_id'] = ts('Payment Method is a required field.'); } else { @@ -1192,7 +1188,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($params['amount'] != 0 && (($this->_values['is_pay_later'] && empty($this->_paymentProcessor) && !array_key_exists('hidden_processor', $params)) || - (CRM_Utils_Array::value('payment_processor_id', $params) == 0)) + empty($params['payment_processor_id'])) ) { $params['is_pay_later'] = 1; } diff --git a/civicrm/CRM/Contribute/Form/ContributionPage.php b/civicrm/CRM/Contribute/Form/ContributionPage.php index f1490ee44c..343c11998a 100644 --- a/civicrm/CRM/Contribute/Form/ContributionPage.php +++ b/civicrm/CRM/Contribute/Form/ContributionPage.php @@ -306,7 +306,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { ]; foreach ($pledgeBlock as $key) { $defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults); - if ($key == 'pledge_start_date' && CRM_Utils_Array::value($key, $pledgeBlockDefaults)) { + if ($key == 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) { $defaultPledgeDate = (array) json_decode($pledgeBlockDefaults['pledge_start_date']); $pledgeDateFields = [ 'pledge_calendar_date' => 'calendar_date', diff --git a/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php b/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php index 538569eb2c..ef3d9071c5 100644 --- a/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php @@ -95,10 +95,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co if ($id != 0) { $paymentProcessor[$id] = $processor['name']; } - if (CRM_Utils_Array::value('is_recur', $processor)) { + if (!empty($processor['is_recur'])) { $recurringPaymentProcessor[] = $id; } - if (CRM_Utils_Array::value('object', $processor) && $processor['object']->supports('FutureRecurStartDate')) { + if (!empty($processor['object']) && $processor['object']->supports('FutureRecurStartDate')) { $futurePaymentProcessor[] = $id; } } @@ -345,7 +345,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co } // CRM-18854 Check if recurring start date is in the future. - if (CRM_Utils_Array::value('pledge_calendar_date', $fields)) { + if (!empty($fields['pledge_calendar_date'])) { if (date('Ymd') > date('Ymd', strtotime($fields['pledge_calendar_date']))) { $errors['pledge_calendar_date'] = ts('The recurring start date cannot be prior to the current date.'); } @@ -506,7 +506,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE); } - if (CRM_Utils_Array::value('adjust_recur_start_date', $params)) { + if (!empty($params['adjust_recur_start_date'])) { $fieldValue = ''; $pledgeDateFields = [ 'calendar_date' => 'pledge_calendar_date', @@ -517,7 +517,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co } else { foreach ($pledgeDateFields as $key => $pledgeDateField) { - if (CRM_Utils_Array::value($pledgeDateField, $params) && $params['pledge_default_toggle'] == $key) { + if (!empty($params[$pledgeDateField]) && $params['pledge_default_toggle'] == $key) { $fieldValue = json_encode([$key => $params[$pledgeDateField]]); break; } @@ -531,10 +531,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $params['is_pledge_start_date_visible'] = 0; $params['is_pledge_start_date_editable'] = 0; } - if (!CRM_Utils_Array::value('is_pledge_start_date_visible', $params)) { + if (empty($params['is_pledge_start_date_visible'])) { $params['is_pledge_start_date_visible'] = 0; } - if (!CRM_Utils_Array::value('is_pledge_start_date_editable', $params)) { + if (empty($params['is_pledge_start_date_editable'])) { $params['is_pledge_start_date_editable'] = 0; } diff --git a/civicrm/CRM/Contribute/Import/Form/MapField.php b/civicrm/CRM/Contribute/Import/Form/MapField.php index 7828bb5216..14d8c0805e 100644 --- a/civicrm/CRM/Contribute/Import/Form/MapField.php +++ b/civicrm/CRM/Contribute/Import/Form/MapField.php @@ -156,31 +156,12 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { /** * Build the form object. + * + * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { - //to save the current mappings - if (!$this->get('savedMapping')) { - $saveDetailsName = ts('Save this field mapping'); - $this->applyFilter('saveMappingName', 'trim'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - else { - $savedMapping = $this->get('savedMapping'); - - $mappingName = (string) civicrm_api3('Mapping', 'getvalue', ['id' => $savedMapping, 'return' => 'name']); - $this->set('loadedMapping', $savedMapping); - $this->assign('loadedMapping', $mappingName); - $this->assign('savedName', $mappingName); - $this->add('hidden', 'mappingId', $savedMapping); - - $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); - $saveDetailsName = ts('Save as a new field mapping'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - - $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + $savedMappingID = $this->get('savedMapping'); + $this->buildSavedMappingFields($savedMappingID); $this->addFormRule([ 'CRM_Contribute_Import_Form_MapField', @@ -227,7 +208,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', [1 => $i]), NULL); $jsSet = FALSE; if ($this->get('savedMapping')) { - list($mappingName, $mappingContactType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping); + list($mappingName, $mappingContactType) = CRM_Core_BAO_Mapping::getMappingFields($savedMappingID); $mappingName = $mappingName[1]; $mappingContactType = $mappingContactType[1]; @@ -247,8 +228,8 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $defaults["mapper[$i]"] = [ CRM_Utils_Array::value(0, $mappingHeader), ($softField) ? $softField : "", - (isset($locationId)) ? $locationId : "", - (isset($phoneType)) ? $phoneType : "", + "", + "", ]; $jsSet = TRUE; } diff --git a/civicrm/CRM/Contribute/Import/Parser.php b/civicrm/CRM/Contribute/Import/Parser.php index 9ceac6a63d..24c30758c8 100644 --- a/civicrm/CRM/Contribute/Import/Parser.php +++ b/civicrm/CRM/Contribute/Import/Parser.php @@ -427,20 +427,34 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { } /** + * Store the soft credit field information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCredit($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditField = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditField = $element; } } /** + * Store the soft credit field type information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCreditType($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditType = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditType = $element; } } diff --git a/civicrm/CRM/Core/BAO/Address.php b/civicrm/CRM/Core/BAO/Address.php index 71ebf132db..af3dbd233d 100644 --- a/civicrm/CRM/Core/BAO/Address.php +++ b/civicrm/CRM/Core/BAO/Address.php @@ -416,9 +416,9 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { if (substr($name, 0, 7) == 'country') { // make sure its different from the default country // iso code - $defaultCountry = $config->defaultContactCountry(); + $defaultCountry = CRM_Core_BAO_Country::defaultContactCountry(); // full name - $defaultCountryName = $config->defaultContactCountryName(); + $defaultCountryName = CRM_Core_BAO_Country::defaultContactCountryName(); if ($defaultCountry) { if ($value == $defaultCountry || @@ -663,8 +663,7 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC, * Array of address sequence. */ public static function addressSequence() { - $config = CRM_Core_Config::singleton(); - $addressSequence = $config->addressSequence(); + $addressSequence = CRM_Utils_Address::sequence(\Civi::settings()->get('address_format')); $countryState = $cityPostal = FALSE; foreach ($addressSequence as $key => $field) { diff --git a/civicrm/CRM/Core/BAO/CustomField.php b/civicrm/CRM/Core/BAO/CustomField.php index 07530e3f52..26907960b8 100644 --- a/civicrm/CRM/Core/BAO/CustomField.php +++ b/civicrm/CRM/Core/BAO/CustomField.php @@ -1261,7 +1261,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if (!$value) { $config = CRM_Core_Config::singleton(); if ($config->defaultContactCountry) { - $value = $config->defaultContactCountry(); + $value = CRM_Core_BAO_Country::defaultContactCountry(); } } } diff --git a/civicrm/CRM/Core/BAO/Location.php b/civicrm/CRM/Core/BAO/Location.php index b0c68d1b8a..b8e7f073fe 100644 --- a/civicrm/CRM/Core/BAO/Location.php +++ b/civicrm/CRM/Core/BAO/Location.php @@ -84,7 +84,7 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { // when we come from a form which displays all the location elements (like the edit form or the inline block // elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded // form - if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) { + if (empty($params['updateBlankLocInfo'])) { // make sure contact should have only one primary block, CRM-5051 self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params)); } diff --git a/civicrm/CRM/Core/BAO/PrevNextCache.php b/civicrm/CRM/Core/BAO/PrevNextCache.php index bcc8e650f8..f217d87441 100644 --- a/civicrm/CRM/Core/BAO/PrevNextCache.php +++ b/civicrm/CRM/Core/BAO/PrevNextCache.php @@ -429,7 +429,7 @@ WHERE (pn.cachekey $op %1 OR pn.cachekey $op %2) * @throws \CiviCRM_API3_Exception */ public static function refillCache($rgid, $gid, $criteria, $checkPermissions, $searchLimit = 0) { - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions, $searchLimit); // 1. Clear cache if any $sql = "DELETE FROM civicrm_prevnext_cache WHERE cachekey LIKE %1"; @@ -450,15 +450,24 @@ WHERE (pn.cachekey $op %1 OR pn.cachekey $op %2) // would chain to a delete. Limiting to getfields for 'get' limits us to declared fields, // although we might wish to revisit later to allow joins. $validFieldsForRetrieval = civicrm_api3('Contact', 'getfields', ['action' => 'get'])['values']; - if (!empty($criteria)) { + $filteredCriteria = isset($criteria['contact']) ? array_intersect_key($criteria['contact'], $validFieldsForRetrieval) : []; + + if (!empty($criteria) || !empty($searchLimit)) { $contacts = civicrm_api3('Contact', 'get', array_merge([ - 'options' => ['limit' => 0], + 'options' => ['limit' => $searchLimit], 'return' => 'id', 'check_permissions' => TRUE, - ], array_intersect_key($criteria['contact'], $validFieldsForRetrieval))); + 'contact_type' => civicrm_api3('RuleGroup', 'getvalue', ['id' => $rgid, 'return' => 'contact_type']), + ], $filteredCriteria)); $contactIDs = array_keys($contacts['values']); + + if (empty($contactIDs)) { + // If there is criteria but no contacts were found then we should return now + // since we have no contacts to match. + return []; + } } - $foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIDs, $checkPermissions, $searchLimit); + $foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIDs, $checkPermissions); } if (!empty($foundDupes)) { diff --git a/civicrm/CRM/Core/BAO/RecurringEntity.php b/civicrm/CRM/Core/BAO/RecurringEntity.php index 95ef8907ec..daf86a7806 100644 --- a/civicrm/CRM/Core/BAO/RecurringEntity.php +++ b/civicrm/CRM/Core/BAO/RecurringEntity.php @@ -917,7 +917,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { } } if ($formParams['repeats_by'] == 2) { - if (CRM_Utils_Array::value('entity_status_1', $formParams) && CRM_Utils_Array::value('entity_status_2', $formParams)) { + if (!empty($formParams['entity_status_1']) && !empty($formParams['entity_status_2'])) { $dbParams['entity_status'] = $formParams['entity_status_1'] . " " . $formParams['entity_status_2']; } } diff --git a/civicrm/CRM/Core/BAO/SchemaHandler.php b/civicrm/CRM/Core/BAO/SchemaHandler.php index 004907fa12..0b0ee3b5f9 100644 --- a/civicrm/CRM/Core/BAO/SchemaHandler.php +++ b/civicrm/CRM/Core/BAO/SchemaHandler.php @@ -626,7 +626,7 @@ MODIFY {$columnName} varchar( $length ) 2 => [$table_name, 'String'], 3 => [$constraint_name, 'String'], ]; - $dao = CRM_Core_DAO::executeQuery($query, $params); + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE); if ($dao->fetch()) { return TRUE; @@ -644,7 +644,7 @@ MODIFY {$columnName} varchar( $length ) */ public static function safeRemoveFK($table_name, $constraint_name) { if (self::checkFKExists($table_name, $constraint_name)) { - CRM_Core_DAO::executeQuery("ALTER TABLE {$table_name} DROP FOREIGN KEY {$constraint_name}", []); + CRM_Core_DAO::executeQuery("ALTER TABLE {$table_name} DROP FOREIGN KEY {$constraint_name}", [], TRUE, NULL, FALSE, FALSE); return TRUE; } return FALSE; diff --git a/civicrm/CRM/Core/BAO/Setting.php b/civicrm/CRM/Core/BAO/Setting.php index 2c4b837bda..41d520efef 100644 --- a/civicrm/CRM/Core/BAO/Setting.php +++ b/civicrm/CRM/Core/BAO/Setting.php @@ -496,7 +496,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { public static function isAPIJobAllowedToRun($params) { $environment = CRM_Core_Config::environment(NULL, TRUE); if ($environment != 'Production') { - if (CRM_Utils_Array::value('runInNonProductionEnvironment', $params)) { + if (!empty($params['runInNonProductionEnvironment'])) { $mailing = Civi::settings()->get('mailing_backend_store'); if ($mailing) { Civi::settings()->set('mailing_backend', $mailing); diff --git a/civicrm/CRM/Core/BAO/StatusPreference.php b/civicrm/CRM/Core/BAO/StatusPreference.php index 98e9a35faa..fbeb8528f3 100644 --- a/civicrm/CRM/Core/BAO/StatusPreference.php +++ b/civicrm/CRM/Core/BAO/StatusPreference.php @@ -66,7 +66,7 @@ class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference { } // Check if this StatusPreference already exists. - if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) { + if (empty($params['id']) && !empty($params['name'])) { $statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID()); $statusPreference->name = $params['name']; diff --git a/civicrm/CRM/Core/BAO/UFField.php b/civicrm/CRM/Core/BAO/UFField.php index 4549d78d3b..58dd31f08f 100644 --- a/civicrm/CRM/Core/BAO/UFField.php +++ b/civicrm/CRM/Core/BAO/UFField.php @@ -827,7 +827,7 @@ SELECT id if (in_array($field['field_name'], $validBillingFields)) { $validProfileFields[] = $field['field_name']; } - if (CRM_Utils_Array::value('is_required', $field)) { + if (!empty($field['is_required'])) { $requiredProfileFields[] = $field['field_name']; } } @@ -970,6 +970,7 @@ SELECT id 'membership_type_id', 'member_is_test', 'is_override', + 'member_is_override', 'status_override_end_date', 'status_id', 'member_is_pay_later' diff --git a/civicrm/CRM/Core/ClassLoader.php b/civicrm/CRM/Core/ClassLoader.php index f951e578c7..51dbcf9b1d 100644 --- a/civicrm/CRM/Core/ClassLoader.php +++ b/civicrm/CRM/Core/ClassLoader.php @@ -205,6 +205,12 @@ class CRM_Core_ClassLoader { * @param $class */ public function loadClass($class) { + if ($class === 'CiviCRM_API3_Exception') { + //call internal error class api/Exception first + // allow api/Exception class call external error class + // CiviCRM_API3_Exception + require_once 'api/Exception.php'; + } if ( // Only load classes that clearly belong to CiviCRM. // Note: api/v3 does not use classes, but api_v3's test-suite does diff --git a/civicrm/CRM/Core/Config.php b/civicrm/CRM/Core/Config.php index 4e3679fb6d..f8952cf419 100644 --- a/civicrm/CRM/Core/Config.php +++ b/civicrm/CRM/Core/Config.php @@ -471,6 +471,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function addressSequence() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Utils_Address::sequence(Civi::settings()->get(\'address_format\')'); return CRM_Utils_Address::sequence(Civi::settings()->get('address_format')); } @@ -478,6 +479,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountry() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountry'); return CRM_Core_BAO_Country::defaultContactCountry(); } @@ -485,6 +487,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountryName() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountryName'); return CRM_Core_BAO_Country::defaultContactCountryName(); } diff --git a/civicrm/CRM/Core/DAO.php b/civicrm/CRM/Core/DAO.php index a0d75859cb..83dac3f433 100644 --- a/civicrm/CRM/Core/DAO.php +++ b/civicrm/CRM/Core/DAO.php @@ -234,26 +234,22 @@ class CRM_Core_DAO extends DB_DataObject { if ($fkDAO->find(TRUE)) { $this->$dbName = $fkDAO->id; } - $fkDAO->free(); } elseif (in_array($FKClassName, CRM_Core_DAO::$_testEntitiesToSkip)) { $depObject = new $FKClassName(); $depObject->find(TRUE); $this->$dbName = $depObject->id; - $depObject->free(); } elseif ($daoName == 'CRM_Member_DAO_MembershipType' && $fieldName == 'member_of_contact_id') { // FIXME: the fields() metadata is not specific enough $depObject = CRM_Core_DAO::createTestObject($FKClassName, ['contact_type' => 'Organization']); $this->$dbName = $depObject->id; - $depObject->free(); } else { //if it is required we need to generate the dependency object first $depObject = CRM_Core_DAO::createTestObject($FKClassName, CRM_Utils_Array::value($dbName, $params, 1)); $this->$dbName = $depObject->id; - $depObject->free(); } } @@ -567,6 +563,7 @@ class CRM_Core_DAO extends DB_DataObject { $event = new \Civi\Core\DAO\Event\PostUpdate($this); \Civi::service('dispatcher')->dispatch("civi.dao.postUpdate", $event); } + $this->clearDbColumnValueCache(); } else { $this->insert(); @@ -620,6 +617,8 @@ class CRM_Core_DAO extends DB_DataObject { \Civi::service('dispatcher')->dispatch("civi.dao.postDelete", $event); $this->free(); + $this->clearDbColumnValueCache(); + return $result; } @@ -1196,12 +1195,16 @@ FROM civicrm_domain CRM_Core_Error::fatal(); } - $cacheKey = "{$daoName}:{$searchValue}:{$returnColumn}:{$searchColumn}"; - if (self::$_dbColumnValueCache === NULL) { - self::$_dbColumnValueCache = []; + self::$_dbColumnValueCache = self::$_dbColumnValueCache ?? []; + + while (strpos($daoName, '_BAO_') !== FALSE) { + $daoName = get_parent_class($daoName); } - if (!array_key_exists($cacheKey, self::$_dbColumnValueCache) || $force) { + if ($force || + empty(self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue]) || + !array_key_exists($returnColumn, self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue]) + ) { $object = new $daoName(); $object->$searchColumn = $searchValue; $object->selectAdd(); @@ -1211,11 +1214,10 @@ FROM civicrm_domain if ($object->find(TRUE)) { $result = $object->$returnColumn; } - $object->free(); - self::$_dbColumnValueCache[$cacheKey] = $result; + self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue][$returnColumn] = $result; } - return self::$_dbColumnValueCache[$cacheKey]; + return self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue][$returnColumn]; } /** @@ -2954,4 +2956,20 @@ SELECT contact_id return $fields; } + /** + * Remove item from static cache during update/delete operations + */ + private function clearDbColumnValueCache() { + $daoName = get_class($this); + while (strpos($daoName, '_BAO_') !== FALSE) { + $daoName = get_parent_class($daoName); + } + if (isset($this->id)) { + unset(self::$_dbColumnValueCache[$daoName]['id'][$this->id]); + } + if (isset($this->name)) { + unset(self::$_dbColumnValueCache[$daoName]['name'][$this->name]); + } + } + } diff --git a/civicrm/CRM/Core/DAO/Address.php b/civicrm/CRM/Core/DAO/Address.php index 4e896f5572..96de13e2c4 100644 --- a/civicrm/CRM/Core/DAO/Address.php +++ b/civicrm/CRM/Core/DAO/Address.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Address.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9cc91d1b8831b712698603b619aa1906) + * (GenCodeChecksum:e026e63074a6ffc2f4fda166e6ea6b5a) */ /** @@ -709,9 +709,10 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { 'manual_geo_code' => [ 'name' => 'manual_geo_code', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is manually geocoded'), + 'title' => ts('Is Manually Geocoded'), 'description' => ts('Is this a manually entered geo code'), 'where' => 'civicrm_address.manual_geo_code', + 'export' => TRUE, 'default' => '0', 'table_name' => 'civicrm_address', 'entity' => 'Address', diff --git a/civicrm/CRM/Core/DAO/AllCoreTables.data.php b/civicrm/CRM/Core/DAO/AllCoreTables.data.php index e42e08bf4e..8a366e7b07 100644 --- a/civicrm/CRM/Core/DAO/AllCoreTables.data.php +++ b/civicrm/CRM/Core/DAO/AllCoreTables.data.php @@ -397,9 +397,9 @@ return [ 'class' => 'CRM_Core_DAO_StatusPreference', 'table' => 'civicrm_status_pref', ], - 'CRM_ACL_DAO_Cache' => [ - 'name' => 'Cache', - 'class' => 'CRM_ACL_DAO_Cache', + 'CRM_ACL_DAO_ACLCache' => [ + 'name' => 'ACLCache', + 'class' => 'CRM_ACL_DAO_ACLCache', 'table' => 'civicrm_acl_cache', ], 'CRM_Contact_DAO_Group' => [ diff --git a/civicrm/CRM/Core/DAO/AllCoreTables.php b/civicrm/CRM/Core/DAO/AllCoreTables.php index df25312569..d38f96ba1b 100644 --- a/civicrm/CRM/Core/DAO/AllCoreTables.php +++ b/civicrm/CRM/Core/DAO/AllCoreTables.php @@ -300,7 +300,7 @@ class CRM_Core_DAO_AllCoreTables { $fields = $dao::fields(); foreach ($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { $exports[$labelName] = & $fields[$name]; } @@ -340,7 +340,7 @@ class CRM_Core_DAO_AllCoreTables { $fields = $dao::fields(); foreach ($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { $imports[$labelName] = & $fields[$name]; } diff --git a/civicrm/CRM/Core/DAO/Cache.php b/civicrm/CRM/Core/DAO/Cache.php index 01536dda8e..15f2f22268 100644 --- a/civicrm/CRM/Core/DAO/Cache.php +++ b/civicrm/CRM/Core/DAO/Cache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Cache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:97df4edaa4829ea30a151dbb95ff754d) + * (GenCodeChecksum:4d3ccecb7d91aa67b8c78c3c39933ae8) */ /** @@ -29,6 +29,8 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { public static $_log = FALSE; /** + * Unique table ID + * * @var int */ public $id; @@ -109,6 +111,8 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cache ID'), + 'description' => ts('Unique table ID'), 'required' => TRUE, 'where' => 'civicrm_cache.id', 'table_name' => 'civicrm_cache', @@ -157,6 +161,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Component ID'), 'description' => ts('Component that this menu item belongs to'), 'where' => 'civicrm_cache.component_id', 'table_name' => 'civicrm_cache', diff --git a/civicrm/CRM/Core/DAO/Dashboard.php b/civicrm/CRM/Core/DAO/Dashboard.php index 026937454c..f772fef108 100644 --- a/civicrm/CRM/Core/DAO/Dashboard.php +++ b/civicrm/CRM/Core/DAO/Dashboard.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Dashboard.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2b085baa3414de05ee5c52a4d7d4f81f) + * (GenCodeChecksum:6fd1bfbecace855a159025ad31e37fb0) */ /** diff --git a/civicrm/CRM/Core/Error.php b/civicrm/CRM/Core/Error.php index 16ac8caf4d..e52e51515a 100644 --- a/civicrm/CRM/Core/Error.php +++ b/civicrm/CRM/Core/Error.php @@ -232,7 +232,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { $errorDetails = CRM_Core_Error::debug('', $error, FALSE); $template->assign_by_ref('errorDetails', $errorDetails); - CRM_Core_Error::debug_var('Fatal Error Details', $error); + CRM_Core_Error::debug_var('Fatal Error Details', $error, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); if ($config->initialized) { @@ -339,7 +339,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { if (self::$modeException) { // CRM-11043 - CRM_Core_Error::debug_var('Fatal Error Details', $vars); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); $details = 'A fatal error was triggered'; @@ -381,7 +381,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { self::backtrace(); } - CRM_Core_Error::debug_var('Fatal Error Details', $vars); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); // If we are in an ajax callback, format output appropriately @@ -421,7 +421,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { } catch (Exception $other) { // if the exception-handler generates an exception, then that sucks! oh, well. carry on. - CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other)); + CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other), TRUE, TRUE, '', PEAR_LOG_ERR); } $config = CRM_Core_Config::singleton(); $vars = [ @@ -459,24 +459,19 @@ class CRM_Core_Error extends PEAR_ErrorStack { // Case C: Default error handler // log to file - CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); // print to screen $template = CRM_Core_Smarty::singleton(); $template->assign($vars); $content = $template->fetch('CRM/common/fatal.tpl'); + if ($config->backtrace) { $content = self::formatHtmlException($exception) . $content; } - if ($config->userFramework == 'Joomla' && - class_exists('JError') - ) { - JError::raiseError('CiviCRM-001', $content); - } - else { - echo CRM_Utils_System::theme($content); - } + + echo CRM_Utils_System::theme($content); // fin self::abend(CRM_Core_Error::FATAL_ERROR); @@ -544,6 +539,8 @@ class CRM_Core_Error extends PEAR_ErrorStack { * Log or return the output? * @param string $prefix * Prefix for output logfile. + * @param int $priority + * The log priority level. * * @return string * The generated output @@ -551,7 +548,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * @see CRM_Core_Error::debug() * @see CRM_Core_Error::debug_log_message() */ - public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '') { + public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '', $priority = NULL) { // check if variable is set if (!isset($variable)) { $out = "\$$variable_name is not set"; @@ -574,7 +571,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { reset($variable); } } - return self::debug_log_message($out, FALSE, $prefix); + return self::debug_log_message($out, FALSE, $prefix, $priority); } /** @@ -635,7 +632,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { CRM_Core_Error::backtrace($string, TRUE); } elseif (CIVICRM_DEBUG_LOG_QUERY) { - CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log'); + CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log', PEAR_LOG_DEBUG); } } } @@ -647,7 +644,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { */ public static function debug_query_result($query) { $results = CRM_Core_DAO::executeQuery($query)->fetchAll(); - CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results]); + CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results], TRUE, TRUE, '', PEAR_LOG_DEBUG); } /** @@ -731,7 +728,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { CRM_Core_Error::debug($msg, $message); } else { - CRM_Core_Error::debug_var($msg, $message); + CRM_Core_Error::debug_var($msg, $message, TRUE, TRUE, '', PEAR_LOG_DEBUG); } } @@ -948,7 +945,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * @throws PEAR_Exception */ public static function exceptionHandler($pearError) { - CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError)); + CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError), TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); throw new PEAR_Exception($pearError->getMessage(), $pearError); } @@ -962,7 +959,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * $obj */ public static function nullHandler($obj) { - CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}"); + CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}", FALSE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); return $obj; } diff --git a/civicrm/CRM/Core/Form/RecurringEntity.php b/civicrm/CRM/Core/Form/RecurringEntity.php index 85f53b22e2..4e44aa0d09 100644 --- a/civicrm/CRM/Core/Form/RecurringEntity.php +++ b/civicrm/CRM/Core/Form/RecurringEntity.php @@ -343,7 +343,7 @@ class CRM_Core_Form_RecurringEntity { $params['entity_id'] = self::$_entityId; } //Process this function only when you get this variable - if ($params['allowRepeatConfigToSubmit'] == 1) { + if (CRM_Utils_Array::value('allowRepeatConfigToSubmit', $params) == 1) { if (!empty($params['entity_table']) && !empty($params['entity_id']) && $type) { $params['used_for'] = $type; if (empty($params['parent_entity_id'])) { @@ -369,7 +369,7 @@ class CRM_Core_Form_RecurringEntity { //exclude dates $excludeDateList = []; - if (CRM_Utils_Array::value('exclude_date_list', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) { + if (!empty($params['exclude_date_list']) && !empty($params['parent_entity_id']) && $actionScheduleObj->entity_value) { //Since we get comma separated values lets get them in array $excludeDates = explode(",", $params['exclude_date_list']); diff --git a/civicrm/CRM/Core/Form/Search.php b/civicrm/CRM/Core/Form/Search.php index c4711b7d52..7fab1da759 100644 --- a/civicrm/CRM/Core/Form/Search.php +++ b/civicrm/CRM/Core/Form/Search.php @@ -337,7 +337,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { $this->addElement('checkbox', 'toggleSelect', NULL, NULL, ['class' => 'select-rows']); if (!empty($rows)) { foreach ($rows as $row) { - if (CRM_Utils_Array::value('checkbox', $row)) { + if (!empty($row['checkbox'])) { $this->addElement('checkbox', $row['checkbox'], NULL, NULL, ['class' => 'select-row']); } } diff --git a/civicrm/CRM/Core/Page/AJAX.php b/civicrm/CRM/Core/Page/AJAX.php index 7c2d1a00b7..0569c7ee86 100644 --- a/civicrm/CRM/Core/Page/AJAX.php +++ b/civicrm/CRM/Core/Page/AJAX.php @@ -269,7 +269,7 @@ class CRM_Core_Page_AJAX { } foreach ($optionalParams as $param => $type) { - if (CRM_Utils_Array::value($param, $_GET)) { + if (!empty($_GET[$param])) { if (!is_array($_GET[$param])) { $params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type); } diff --git a/civicrm/CRM/Core/Page/AJAX/Location.php b/civicrm/CRM/Core/Page/AJAX/Location.php index 7a998fe2a5..f54c05d2c4 100644 --- a/civicrm/CRM/Core/Page/AJAX/Location.php +++ b/civicrm/CRM/Core/Page/AJAX/Location.php @@ -67,8 +67,7 @@ class CRM_Core_Page_AJAX_Location { $entityBlock = ['contact_id' => $cid]; $location = CRM_Core_BAO_Location::getValues($entityBlock); - $config = CRM_Core_Config::singleton(); - $addressSequence = array_flip($config->addressSequence()); + $addressSequence = array_flip(CRM_Utils_Address::sequence(\Civi::settings()->get('address_format'))); $profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL diff --git a/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php b/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php index 198b22c33e..15706f62cc 100644 --- a/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php +++ b/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php @@ -14,7 +14,7 @@ class CRM_Core_Page_AJAX_RecurringEntity { public static function updateMode() { $finalResult = []; - if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) { + if (!empty($_REQUEST['mode']) && !empty($_REQUEST['entityId']) && !empty($_REQUEST['entityTable'])) { $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer'); $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer'); $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String'); diff --git a/civicrm/CRM/Core/Payment/BaseIPN.php b/civicrm/CRM/Core/Payment/BaseIPN.php index 35af834bd5..9e7ed420ba 100644 --- a/civicrm/CRM/Core/Payment/BaseIPN.php +++ b/civicrm/CRM/Core/Payment/BaseIPN.php @@ -213,6 +213,7 @@ class CRM_Core_Payment_BaseIPN { * @param array $input * * @return bool + * @throws \CiviCRM_API3_Exception */ public function failed(&$objects, &$transaction, $input = []) { $contribution = &$objects['contribution']; @@ -235,10 +236,10 @@ class CRM_Core_Payment_BaseIPN { 'labelColumn' => 'name', 'flip' => 1, ]); + $contribution->contribution_status_id = $contributionStatuses['Failed']; $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); - $contribution->contribution_status_id = $contributionStatuses['Failed']; $contribution->save(); // Add line items for recurring payments. @@ -255,33 +256,19 @@ class CRM_Core_Payment_BaseIPN { if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) { if (!empty($memberships)) { - // if transaction is failed then set "Cancelled" as membership status - $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', [ - 'labelColumn' => 'name', - 'flip' => 1, - ]); foreach ($memberships as $membership) { - if ($membership) { - $membership->status_id = $membershipStatuses['Cancelled']; - $membership->save(); - - //update related Memberships. - $params = ['status_id' => $membershipStatuses['Cancelled']]; - CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); - } + // @fixme Should we cancel only Pending memberships? per cancelled() + $this->cancelMembership($membership, $membership->status_id, FALSE); } } if ($participant) { - $participantParams['id'] = $participant->id; - $participantParams['status_id'] = 'Cancelled'; - civicrm_api3('Participant', 'create', $participantParams); + $this->cancelParticipant($participant->id); } } $transaction->commit(); - CRM_Core_Error::debug_log_message("Setting contribution status to failed"); - //echo "Success: Setting contribution status to failed<p>"; + Civi::log()->debug("Setting contribution status to Failed"); return TRUE; } @@ -295,7 +282,7 @@ class CRM_Core_Payment_BaseIPN { */ public function pending(&$objects, &$transaction) { $transaction->commit(); - CRM_Core_Error::debug_log_message("returning since contribution status is pending"); + Civi::log()->debug("Returning since contribution status is Pending"); echo "Success: Returning since contribution status is pending<p>"; return TRUE; } @@ -308,32 +295,38 @@ class CRM_Core_Payment_BaseIPN { * @param array $input * * @return bool + * @throws \CiviCRM_API3_Exception */ public function cancelled(&$objects, &$transaction, $input = []) { $contribution = &$objects['contribution']; - $memberships = &$objects['membership']; - if (is_numeric($memberships)) { - $memberships = [$objects['membership']]; + $memberships = []; + if (!empty($objects['membership'])) { + $memberships = &$objects['membership']; + if (is_numeric($memberships)) { + $memberships = [$objects['membership']]; + } } - $participant = &$objects['participant']; $addLineItems = FALSE; if (empty($contribution->id)) { $addLineItems = TRUE; } + $participant = &$objects['participant']; + + // CRM-15546 $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [ 'labelColumn' => 'name', 'flip' => 1, ]); $contribution->contribution_status_id = $contributionStatuses['Cancelled']; - $contribution->cancel_date = self::$_now; - $contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input); $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); + $contribution->cancel_date = self::$_now; + $contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input); $contribution->save(); - //add lineitems for recurring payments + // Add line items for recurring payments. if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) { CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($objects['contributionRecur']->id, $contribution); } @@ -347,34 +340,19 @@ class CRM_Core_Payment_BaseIPN { if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) { if (!empty($memberships)) { - $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', [ - 'labelColumn' => 'name', - 'flip' => 1, - ]); - // Cancel only Pending memberships - // CRM-18688 - $pendingStatusId = $membershipStatuses['Pending']; foreach ($memberships as $membership) { - if ($membership && ($membership->status_id == $pendingStatusId)) { - $membership->status_id = $membershipStatuses['Cancelled']; - $membership->save(); - - //update related Memberships. - $params = ['status_id' => $membershipStatuses['Cancelled']]; - CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); + if ($membership) { + $this->cancelMembership($membership, $membership->status_id); } } } if ($participant) { - $participantParams['id'] = $participant->id; - $participantParams['status_id'] = 'Cancelled'; - civicrm_api3('Participant', 'create', $participantParams); + $this->cancelParticipant($participant->id); } } $transaction->commit(); - CRM_Core_Error::debug_log_message("Setting contribution status to cancelled"); - //echo "Success: Setting contribution status to cancelled<p>"; + Civi::log()->debug("Setting contribution status to Cancelled"); return TRUE; } @@ -388,11 +366,60 @@ class CRM_Core_Payment_BaseIPN { */ public function unhandled(&$objects, &$transaction) { $transaction->rollback(); - CRM_Core_Error::debug_log_message("returning since contribution status: is not handled"); + Civi::log()->debug("Returning since contribution status is not handled"); echo "Failure: contribution status is not handled<p>"; return FALSE; } + /** + * Logic to cancel a participant record when the related contribution changes to failed/cancelled. + * @todo This is part of a bigger refactor for dev/core/issues/927 - "duplicate" functionality exists in CRM_Contribute_BAO_Contribution::cancel() + * + * @param $participantID + * + * @throws \CiviCRM_API3_Exception + */ + private function cancelParticipant($participantID) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it + $participantParams['id'] = $participantID; + $participantParams['status_id'] = 'Cancelled'; + civicrm_api3('Participant', 'create', $participantParams); + } + + /** + * Logic to cancel a membership record when the related contribution changes to failed/cancelled. + * @todo This is part of a bigger refactor for dev/core/issues/927 - "duplicate" functionality exists in CRM_Contribute_BAO_Contribution::cancel() + * @param \CRM_Member_BAO_Membership $membership + * @param int $membershipStatusID + * @param boolean $onlyCancelPendingMembership + * Do we only cancel pending memberships? OR memberships in any status? (see CRM-18688) + * @fixme Historically failed() cancelled membership in any status, cancelled() cancelled only pending memberships so we retain that behaviour for now. + * + */ + private function cancelMembership($membership, $membershipStatusID, $onlyCancelPendingMembership = TRUE) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it + // Cancel only Pending memberships + $pendingMembershipStatusId = CRM_Core_PseudoConstant::getKey('CRM_Member_BAO_Membership', 'status_id', 'Pending'); + if (($membershipStatusID == $pendingMembershipStatusId) || ($onlyCancelPendingMembership == FALSE)) { + $cancelledMembershipStatusId = CRM_Core_PseudoConstant::getKey('CRM_Member_BAO_Membership', 'status_id', 'Cancelled'); + + $membership->status_id = $cancelledMembershipStatusId; + $membership->save(); + + $params = ['status_id' => $cancelledMembershipStatusId]; + CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); + + // @todo Convert the above to API + // $membershipParams = [ + // 'id' => $membership->id, + // 'status_id' => $cancelledMembershipStatusId, + // ]; + // civicrm_api3('Membership', 'create', $membershipParams); + // CRM_Member_BAO_Membership::updateRelatedMemberships($membershipParams['id'], ['status_id' => $cancelledMembershipStatusId]); + } + + } + /** * @deprecated * @@ -447,6 +474,9 @@ class CRM_Core_Payment_BaseIPN { * @param array $objects * @param CRM_Core_Transaction $transaction * @param bool $recur + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) { $contribution = &$objects['contribution']; @@ -493,6 +523,8 @@ class CRM_Core_Payment_BaseIPN { * is because the function is also used to generate pdfs * * @return array + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) { return CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution']->id, $values, diff --git a/civicrm/CRM/Core/Payment/PayPalIPN.php b/civicrm/CRM/Core/Payment/PayPalIPN.php index 3ad4c74d27..d7a13692b6 100644 --- a/civicrm/CRM/Core/Payment/PayPalIPN.php +++ b/civicrm/CRM/Core/Payment/PayPalIPN.php @@ -313,7 +313,9 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { $input['component'] = $component; $ids['contact'] = $this->retrieve('contactID', 'Integer', TRUE); - $ids['contribution'] = $this->retrieve('contributionID', 'Integer', TRUE); + $contributionID = $ids['contribution'] = $this->retrieve('contributionID', 'Integer', TRUE); + $membershipID = $this->retrieve('membershipID', 'Integer', FALSE); + $contributionRecurID = $this->retrieve('contributionRecurID', 'Integer', FALSE); $this->getInput($input, $ids); @@ -323,17 +325,48 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { } else { // get the optional ids - $ids['membership'] = $this->retrieve('membershipID', 'Integer', FALSE); - $ids['contributionRecur'] = $this->retrieve('contributionRecurID', 'Integer', FALSE); + $ids['membership'] = $membershipID; + $ids['contributionRecur'] = $contributionRecurID; $ids['contributionPage'] = $this->retrieve('contributionPageID', 'Integer', FALSE); $ids['related_contact'] = $this->retrieve('relatedContactID', 'Integer', FALSE); $ids['onbehalf_dupe_alert'] = $this->retrieve('onBehalfDupeAlert', 'Integer', FALSE); } - $paymentProcessorID = self::getPayPalPaymentProcessorID($input, $ids); + $paymentProcessorID = $this->getPayPalPaymentProcessorID($input, $ids); Civi::log()->debug('PayPalIPN: Received (ContactID: ' . $ids['contact'] . '; trxn_id: ' . $input['trxn_id'] . ').'); + if ($this->retrieve('membershipID', 'Integer', FALSE)) { + $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionRecurID); + $membershipPayment = civicrm_api3('MembershipPayment', 'get', [ + 'contribution_id' => $templateContribution['id'], + 'membership_id' => $membershipID, + ]); + $lineItems = civicrm_api3('LineItem', 'get', [ + 'contribution_id' => $templateContribution['id'], + 'entity_id' => $membershipID, + 'entity_table' => 'civicrm_membership', + ]); + Civi::log()->debug('PayPalIPN: Received payment for membership ' . (int) $membershipID + . '. Original contribution was ' . (int) $contributionID . '. The template for this contribution is ' + . $templateContribution['id'] . ' it is linked to ' . $membershipPayment['count'] + . 'payments for this membership. It has ' . $lineItems['count'] . ' line items linked to this membership.' + . ' it is expected the original contribution will be linked by both entities to the membership.' + ); + if (empty($membershipPayment['count']) && empty($lineItems['count'])) { + Civi::log()->debug('PayPalIPN: Will attempt to compensate'); + $input['membership_id'] = $this->retrieve('membershipID', 'Integer', FALSE); + } + if ($contributionRecurID) { + $recurLinks = civicrm_api3('ContributionRecur', 'get', [ + 'membership_id' => $membershipID, + 'contribution_recur_id' => $contributionRecurID, + ]); + Civi::log()->debug('PayPalIPN: Membership should be linked to contribution recur record ' . $contributionRecurID + . ' ' . $recurLinks['count'] . 'links found' + ); + } + } if (!$this->validateData($input, $ids, $objects, TRUE, $paymentProcessorID)) { return; } diff --git a/civicrm/CRM/Core/Payment/PayPalImpl.php b/civicrm/CRM/Core/Payment/PayPalImpl.php index 5b4a109802..905e369a61 100644 --- a/civicrm/CRM/Core/Payment/PayPalImpl.php +++ b/civicrm/CRM/Core/Payment/PayPalImpl.php @@ -352,7 +352,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function doExpressCheckout(&$params) { - $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id'); if (!empty($params['is_recur'])) { return $this->createRecurringPayments($params); } @@ -379,7 +378,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { } /* Success */ - $params['trxn_id'] = $result['transactionid']; $params['gross_amount'] = $result['amt']; $params['fee_amount'] = $result['feeamt']; @@ -391,10 +389,10 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $params['pending_reason'] = $result['pendingreason']; if (!empty($params['is_recur'])) { // See comment block. - $params['payment_status_id'] = array_search('Pending', $statuses); + $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'); } else { - $params['payment_status_id'] = array_search('Completed', $statuses); + $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); } return $params; } diff --git a/civicrm/CRM/Core/Permission.php b/civicrm/CRM/Core/Permission.php index 57d58ec747..6623bfd1f3 100644 --- a/civicrm/CRM/Core/Permission.php +++ b/civicrm/CRM/Core/Permission.php @@ -81,48 +81,43 @@ class CRM_Core_Permission { /** * Given a permission string or array, check for access requirements - * @param string|array $permissions - * The permission to check as an array or string -see examples. - * - * @param int $contactId - * Contact id to check permissions for. Defaults to current logged-in user. * - * Ex 1 + * Ex 1: Must have 'access CiviCRM' + * (string) 'access CiviCRM' * - * Must have 'access CiviCRM' - * (string) 'access CiviCRM' + * Ex 2: Must have 'access CiviCRM' and 'access Ajax API' + * ['access CiviCRM', 'access Ajax API'] * + * Ex 3: Must have 'access CiviCRM' or 'access Ajax API' + * [ + * ['access CiviCRM', 'access Ajax API'], + * ], * - * Ex 2 Must have 'access CiviCRM' and 'access Ajax API' - * array('access CiviCRM', 'access Ajax API') + * Ex 4: Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' + * [ + * ['access CiviCRM', 'access Ajax API'], + * 'access CiviEvent', + * ], * - * Ex 3 Must have 'access CiviCRM' or 'access Ajax API' - * array( - * array('access CiviCRM', 'access Ajax API'), - * ), + * Note that in permissions.php this is keyed by the action eg. + * (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) + * 'myaction' => [ + * ['access CiviCRM', 'access Ajax API'], + * ['access CiviEvent', 'access CiviContribute'] + * ], * - * Ex 4 Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' - * array( - * array('access CiviCRM', 'access Ajax API'), - * 'access CiviEvent', - * ), + * @param string|array $permissions + * The permission to check as an array or string -see examples. * - * Note that in permissions.php this is keyed by the action eg. - * (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) - * 'myaction' => array( - * array('access CiviCRM', 'access Ajax API'), - * array('access CiviEvent', 'access CiviContribute') - * ), + * @param int $contactId + * Contact id to check permissions for. Defaults to current logged-in user. * * @return bool - * true if yes, else false + * true if contact has permission(s), else false */ public static function check($permissions, $contactId = NULL) { $permissions = (array) $permissions; - $userId = NULL; - if ($contactId) { - $userId = CRM_Core_BAO_UFMatch::getUFId($contactId); - } + $userId = CRM_Core_BAO_UFMatch::getUFId($contactId); /** @var CRM_Core_Permission_Temp $tempPerm */ $tempPerm = CRM_Core_Config::singleton()->userPermissionTemp; @@ -976,6 +971,12 @@ class CRM_Core_Permission { 'duplicatecheck' => [ 'access CiviCRM', ], + 'merge' => ['merge duplicate contacts'], + ]; + + $permissions['dedupe'] = [ + 'getduplicates' => ['access CiviCRM'], + 'getstatistics' => ['access CiviCRM'], ]; // CRM-16963 - Permissions for country. @@ -1179,6 +1180,15 @@ class CRM_Core_Permission { 'edit all events', ], ]; + // Exception refers to dedupe_exception. + $permissions['exception'] = [ + 'default' => ['merge duplicate contacts'], + ]; + + $permissions['job'] = [ + 'process_batch_merge' => ['merge duplicate contacts'], + ]; + $permissions['rule_group']['get'] = [['merge duplicate contacts', 'administer CiviCRM']]; // Loc block is only used for events $permissions['loc_block'] = $permissions['event']; diff --git a/civicrm/CRM/Core/PseudoConstant.php b/civicrm/CRM/Core/PseudoConstant.php index c53c451d2d..14e2e7fcf2 100644 --- a/civicrm/CRM/Core/PseudoConstant.php +++ b/civicrm/CRM/Core/PseudoConstant.php @@ -836,9 +836,9 @@ WHERE id = %1"; self::populate(self::$country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active', $whereClause); // if default country is set, percolate it to the top - if ($config->defaultContactCountry()) { + if (CRM_Core_BAO_Country::defaultContactCountry()) { $countryIsoCodes = self::countryIsoCode(); - $defaultID = array_search($config->defaultContactCountry(), $countryIsoCodes); + $defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes); if ($defaultID !== FALSE) { $default[$defaultID] = CRM_Utils_Array::value($defaultID, self::$country); self::$country = $default + self::$country; diff --git a/civicrm/CRM/Custom/Form/CustomData.php b/civicrm/CRM/Custom/Form/CustomData.php index 42d6a5372a..f508e14138 100644 --- a/civicrm/CRM/Custom/Form/CustomData.php +++ b/civicrm/CRM/Custom/Form/CustomData.php @@ -49,10 +49,11 @@ class CRM_Custom_Form_CustomData { * e.g Student for contact type * @param null|string $subName value in civicrm_custom_group.extends_entity_column_id * @param null|int $groupCount number of entities that could have custom data + * @param null|int $contact_id contact ID associated with the custom data. * * @throws \CRM_Core_Exception */ - public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1) { + public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1, $contact_id = NULL) { $entityName = $form->getDefaultEntity(); $entityID = $form->getEntityId(); // FIXME: If the form has been converted to use entityFormTrait then getEntitySubTypeId() will exist. @@ -80,6 +81,7 @@ class CRM_Custom_Form_CustomData { $form->assign('customDataType', $entityName); $form->assign('customDataSubType', $entitySubType); $form->assign('entityID', $entityID); + $form->assign('cid', $contact_id); } /** diff --git a/civicrm/CRM/Custom/Form/CustomDataByType.php b/civicrm/CRM/Custom/Form/CustomDataByType.php index c88a29fb16..a2f162d972 100644 --- a/civicrm/CRM/Custom/Form/CustomDataByType.php +++ b/civicrm/CRM/Custom/Form/CustomDataByType.php @@ -36,6 +36,13 @@ */ class CRM_Custom_Form_CustomDataByType extends CRM_Core_Form { + /** + * Contact ID associated with the Custom Data + * + * @var int + */ + public $_contactID = NULL; + /** * Preprocess function. */ @@ -46,6 +53,7 @@ class CRM_Custom_Form_CustomDataByType extends CRM_Core_Form { $this->_subName = CRM_Utils_Request::retrieve('subName', 'String'); $this->_groupCount = CRM_Utils_Request::retrieve('cgcount', 'Positive'); $this->_entityId = CRM_Utils_Request::retrieve('entityID', 'Positive'); + $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive'); $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive'); $this->_onlySubtype = CRM_Utils_Request::retrieve('onlySubtype', 'Boolean'); $this->_action = CRM_Utils_Request::retrieve('action', 'Alphanumeric'); diff --git a/civicrm/CRM/Custom/Form/Preview.php b/civicrm/CRM/Custom/Form/Preview.php index 9f7c9e06a7..149049992d 100644 --- a/civicrm/CRM/Custom/Form/Preview.php +++ b/civicrm/CRM/Custom/Form/Preview.php @@ -71,7 +71,7 @@ class CRM_Custom_Form_Preview extends CRM_Core_Form { if (!empty($defaults['is_view'])) { CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.')); } - elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) { + elseif (empty($defaults['is_active'])) { CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.')); } diff --git a/civicrm/CRM/Dedupe/Finder.php b/civicrm/CRM/Dedupe/Finder.php index f3fa9a01b7..63725439a9 100644 --- a/civicrm/CRM/Dedupe/Finder.php +++ b/civicrm/CRM/Dedupe/Finder.php @@ -51,31 +51,17 @@ class CRM_Dedupe_Finder { * @param bool $checkPermissions * Respect logged in user permissions. * - * @param int $searchLimit - * Limit for the number of contacts to be used for comparison. - * The search methodology finds all matches for the searchedContacts so this limits - * the number of searched contacts, not the matches found. - * * @return array * Array of (cid1, cid2, weight) dupe triples * - * @throws CiviCRM_API3_Exception * @throws Exception */ - public static function dupes($rgid, $cids = [], $checkPermissions = TRUE, $searchLimit = 0) { + public static function dupes($rgid, $cids = [], $checkPermissions = TRUE) { $rgBao = new CRM_Dedupe_BAO_RuleGroup(); $rgBao->id = $rgid; $rgBao->contactIds = $cids; if (!$rgBao->find(TRUE)) { - CRM_Core_Error::fatal("Dedupe rule not found for selected contacts"); - } - if (empty($rgBao->contactIds) && !empty($searchLimit)) { - $limitedContacts = civicrm_api3('Contact', 'get', [ - 'return' => 'id', - 'contact_type' => $rgBao->contact_type, - 'options' => ['limit' => $searchLimit], - ]); - $rgBao->contactIds = array_keys($limitedContacts['values']); + throw new CRM_Core_Exception('Dedupe rule not found for selected contacts'); } $rgBao->fillTable(); @@ -113,6 +99,7 @@ class CRM_Dedupe_Finder { * * @return array * matching contact ids + * @throws \CRM_Core_Exception */ public static function dupesByParams( $params, @@ -144,7 +131,7 @@ class CRM_Dedupe_Finder { $rgBao->contact_type = $ctype; $rgBao->used = $used; if (!$rgBao->find(TRUE)) { - CRM_Core_Error::fatal("$used rule for $ctype does not exist"); + throw new CRM_Core_Exception("$used rule for $ctype does not exist"); } } @@ -181,6 +168,7 @@ class CRM_Dedupe_Finder { * * @return array * array of (cid1, cid2, weight) dupe triples + * @throws \CiviCRM_API3_Exception */ public static function dupesInGroup($rgid, $gid, $searchLimit = 0) { $cids = array_keys(CRM_Contact_BAO_Group::getMember($gid, TRUE, $searchLimit)); @@ -201,6 +189,7 @@ class CRM_Dedupe_Finder { * * @return array * valid $params array for dedupe + * @throws \CRM_Core_Exception */ public static function formatParams($fields, $ctype) { $flat = []; @@ -306,7 +295,7 @@ class CRM_Dedupe_Finder { } } } - if ($table == 'civicrm_phone') { + if ($table === 'civicrm_phone') { $fixes = [ 'phone' => 'phone_numeric', ]; @@ -340,8 +329,6 @@ class CRM_Dedupe_Finder { * -dstName * -weight * -canMerge - * - * @throws CRM_Core_Exception */ public static function parseAndStoreDupePairs($foundDupes, $cacheKeyString) { $cids = []; diff --git a/civicrm/CRM/Dedupe/Merger.php b/civicrm/CRM/Dedupe/Merger.php index 9e501f35f6..b943027d8f 100644 --- a/civicrm/CRM/Dedupe/Merger.php +++ b/civicrm/CRM/Dedupe/Merger.php @@ -691,11 +691,21 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * If not set explicitly this is calculated but it is preferred that it be set * per comments on isSelected above. * + * @param int $searchLimit + * Limit on number of contacts to search for duplicates for. + * This means that if the limit is 1000 then only duplicates for the first 1000 contacts + * matching criteria will be found and batchMerged (the number of merges could be less than or greater than 100) + * * @return array|bool + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL) { + public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL, $searchLimit = 0) { $redirectForPerformance = ($batchLimit > 1) ? TRUE : FALSE; - + if ($mode === 'aggressive' && $checkPermissions && !CRM_Core_Permission::check('force merge duplicate contacts')) { + throw new CRM_Core_Exception(ts('Insufficient permissions for aggressive mode batch merge')); + } if (!isset($reloadCacheIfEmpty)) { $reloadCacheIfEmpty = (!$redirectForPerformance && $isSelected == 2); } @@ -703,10 +713,10 @@ 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, $searchLimit); $cacheParams = [ - 'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions), + 'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions, $searchLimit), // @todo stop passing these parameters in & instead calculate them in the merge function based // on the 'real' params like $isRespectExclusions $batchLimit and $isSelected. 'join' => self::getJoinOnDedupeTable(), @@ -1181,7 +1191,11 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $locations[$moniker][$blockName][$cnt] = $value; // Fix address display if ($blockName == 'address') { + // For performance avoid geocoding while merging https://issues.civicrm.org/jira/browse/CRM-21786 + // we can expect existing geocode values to be retained. + $value['skip_geocode'] = TRUE; CRM_Core_BAO_Address::fixAddress($value); + unset($value['skip_geocode']); $locations[$moniker][$blockName][$cnt]['display'] = CRM_Utils_Address::format($value); } // Fix email display @@ -1833,20 +1847,23 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param int $searchLimit * Limit to searching for matches against this many contacts. * + * @param int $isForceNewSearch + * Should a new search be forced, bypassing any cache retrieval. + * * @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, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) { - $dupePairs = self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions); + public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0, $isForceNewSearch = 0) { + $dupePairs = $isForceNewSearch ? [] : self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions, $searchLimit); 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, $criteria, $checkPermissions, $searchLimit); - return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions); + return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions, $searchLimit); } return $dupePairs; } @@ -1859,17 +1876,21 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param array $criteria * Additional criteria to narrow down the merge group. * Currently we are only supporting the key 'contact' within it. - * * @param bool $checkPermissions * Respect the users permissions. + * @param int $searchLimit + * Number of contacts to seek dupes for (we need this because if + * we change it the results won't be refreshed otherwise. Changing the limit + * from 100 to 1000 SHOULD result in a new dedupe search). * * @return string */ - public static function getMergeCacheKeyString($rule_group_id, $group_id, $criteria = [], $checkPermissions = TRUE) { + public static function getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit) { $contactType = CRM_Dedupe_BAO_RuleGroup::getContactTypeForRuleGroup($rule_group_id); $cacheKeyString = "merge_{$contactType}"; $cacheKeyString .= $rule_group_id ? "_{$rule_group_id}" : '_0'; $cacheKeyString .= $group_id ? "_{$group_id}" : '_0'; + $cacheKeyString .= '_' . (int) $searchLimit; $cacheKeyString .= !empty($criteria) ? md5(serialize($criteria)) : '_0'; if ($checkPermissions) { $contactID = CRM_Core_Session::getLoggedInContactID(); @@ -2487,12 +2508,13 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param bool $includeConflicts * @param array $criteria * @param int $checkPermissions + * @param int $searchLimit * * @return array */ - protected static function getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions) { + protected static function getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions, $searchLimit = 0) { return CRM_Core_BAO_PrevNextCache::retrieve( - self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions), + self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit), self::getJoinOnDedupeTable(), self::getWhereString($isSelected), 0, $batchLimit, diff --git a/civicrm/CRM/Event/BAO/Event.php b/civicrm/CRM/Event/BAO/Event.php index 1faee23279..ec9d0e6b48 100644 --- a/civicrm/CRM/Event/BAO/Event.php +++ b/civicrm/CRM/Event/BAO/Event.php @@ -83,7 +83,6 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * @return CRM_Event_DAO_Event */ public static function add(&$params) { - CRM_Utils_System::flushCache(); $financialTypeId = NULL; if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Event', $params['id'], $params); @@ -133,6 +132,13 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { $params['created_id'] = $session->get('userID'); } $params['created_date'] = date('YmdHis'); + + // Clone from template + if (!empty($params['template_id'])) { + $copy = self::copy($params['template_id']); + $params['id'] = $copy->id; + unset($params['template_id']); + } } $event = self::add($params); @@ -1055,7 +1061,7 @@ WHERE civicrm_event.is_active = 1 * @return array|null * @throws \CiviCRM_API3_Exception */ - public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) { + public static function sendMail($contactID, $values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) { $template = CRM_Core_Smarty::singleton(); $gIds = [ @@ -1137,6 +1143,15 @@ WHERE civicrm_event.is_active = 1 // @todo - the goal is that all params available to the message template are explicitly defined here rather than // 'in a smattering of places'. Note that leakage can happen between mailings when not explicitly defined. + if ($postProfileID) { + $customPostTitles = empty($profilePost[1]) ? NULL : []; + foreach ($postProfileID as $offset => $id) { + $customPostTitles[$offset] = CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $id); + } + } + else { + $customPostTitles = NULL; + } $tplParams = array_merge($values, $participantParams, [ 'email' => $email, 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), @@ -1146,7 +1161,7 @@ WHERE civicrm_event.is_active = 1 'customPre' => $profilePre[0], 'customPre_grouptitle' => empty($profilePre[1]) ? NULL : [CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $preProfileID)], 'customPost' => $profilePost[0], - 'customPost_grouptitle' => empty($profilePost[1]) ? NULL : [CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $postProfileID)], + 'customPost_grouptitle' => $customPostTitles, 'participantID' => $participantId, 'conference_sessions' => $sessions, 'credit_card_number' => CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $participantParams)), @@ -1359,6 +1374,15 @@ WHERE civicrm_event.is_active = 1 CRM_Core_BAO_UFGroup::getValues($cid, $fields, $values, FALSE, $params); + //dev/event#10 + //If the event profile includes a note field and the submitted value of + //that field is "", then remove the old note returned by getValues. + if (isset($participantParams['note']) && empty($participantParams['note'])) { + $noteKeyPos = array_search('note', array_keys($fields)); + $valuesKeys = array_keys($values); + $values[$valuesKeys[$noteKeyPos]] = ""; + } + if (isset($fields['participant_status_id']['title']) && isset($values[$fields['participant_status_id']['title']]) && is_numeric($values[$fields['participant_status_id']['title']]) diff --git a/civicrm/CRM/Event/BAO/Query.php b/civicrm/CRM/Event/BAO/Query.php index beb5f96e33..03d83044cb 100644 --- a/civicrm/CRM/Event/BAO/Query.php +++ b/civicrm/CRM/Event/BAO/Query.php @@ -339,16 +339,13 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { return; case 'participant_fee_id': - $val_regexp = []; - foreach ($value as $k => &$val) { - $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label'); - $val_regexp[$k] = CRM_Core_DAO::escapeString(preg_quote(trim($val))); - $val = CRM_Core_DAO::escapeString(trim($val)); + $labels = []; + foreach ($value as $val) { + $labels[] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label'); } - $feeLabel = implode('|', $val_regexp); - $query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'"; - $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value); - $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; + $query->_where[$grouping][] = "civicrm_line_item.price_field_value_id IN (" . implode(', ', $value) . ")"; + $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $labels); + $query->_tables['civicrm_participant'] = $query->_tables['civicrm_line_item'] = $query->_whereTables['civicrm_line_item'] = 1; return; case 'participant_fee_amount_high': @@ -516,6 +513,10 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { $from = " $side JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id )"; $from .= " $side JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id ) "; break; + + case 'civicrm_line_item': + $from .= " $side JOIN civicrm_line_item ON civicrm_line_item.entity_id = civicrm_participant.id AND civicrm_line_item.entity_table = 'civicrm_participant'"; + break; } return $from; } diff --git a/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php b/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php index 143096e352..ece09d61d1 100644 --- a/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php @@ -47,7 +47,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { if ($participant->must_wait) { $participant_status = 'On waitlist'; } - elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) { + elseif (!empty($params['is_pay_later'])) { $participant_status = 'Pending from pay later'; } else { @@ -714,7 +714,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $config = CRM_Core_Config::singleton(); $default_country = new CRM_Core_DAO_Country(); - $default_country->iso_code = $config->defaultContactCountry(); + $default_country->iso_code = CRM_Core_BAO_Country::defaultContactCountry(); $default_country->find(TRUE); $defaults["billing_country_id-{$this->_bltID}"] = $default_country->id; diff --git a/civicrm/CRM/Event/Form/ManageEvent/Repeat.php b/civicrm/CRM/Event/Form/ManageEvent/Repeat.php index 9aad1cd161..c7fb5591e1 100644 --- a/civicrm/CRM/Event/Form/ManageEvent/Repeat.php +++ b/civicrm/CRM/Event/Form/ManageEvent/Repeat.php @@ -207,7 +207,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities); //Check if participants exists for events foreach ($getRelatedEntities as $key => $value) { - if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) { + if (empty($participantDetails['countByID'][$value['id']]) && $value['id'] != $eventID) { //CRM_Event_BAO_Event::del($value['id']); $eventIdsWithNoRegistration[] = $value['id']; } diff --git a/civicrm/CRM/Event/Form/Registration.php b/civicrm/CRM/Event/Form/Registration.php index d9a1825e14..2ac4111730 100644 --- a/civicrm/CRM/Event/Form/Registration.php +++ b/civicrm/CRM/Event/Form/Registration.php @@ -476,7 +476,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->assign($v, $params[$v]); } } - elseif (CRM_Utils_Array::value('amount', $params) == 0) { + elseif (empty($params['amount'])) { $this->assign($v, CRM_Utils_Array::value($v, $params)); } } diff --git a/civicrm/CRM/Event/Form/Registration/Confirm.php b/civicrm/CRM/Event/Form/Registration/Confirm.php index db2829ef08..18e9ca607c 100644 --- a/civicrm/CRM/Event/Form/Registration/Confirm.php +++ b/civicrm/CRM/Event/Form/Registration/Confirm.php @@ -457,7 +457,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $participantCount[$participantNum] = 'participant'; } $totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0); - if (CRM_Utils_Array::value('is_primary', $record)) { + if (!empty($record['is_primary'])) { $taxAmount = &$params[$participantNum]['tax_amount']; } //lets get additional participant id to cancel. @@ -928,7 +928,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //send mail to primary as well as additional participants. $this->assign('contactID', $contactId); - $this->assign('participantID', $participantID); CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest); } } @@ -1302,8 +1301,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // This happens in buildQuickForm so emulate here. $form->_amount = $form->_totalAmount = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('totalAmount', $params)); $form->set('params', $params['params']); - $form->_values['custom_pre_id'] = []; - $form->_values['custom_post_id'] = []; + $form->_values['custom_pre_id'] = CRM_Utils_Array::value('custom_pre_id', $params); + $form->_values['custom_post_id'] = CRM_Utils_Array::value('custom_post_id', $params); $form->_values['event'] = CRM_Utils_Array::value('event', $params); $form->_contributeMode = $params['contributeMode']; $eventParams = ['id' => $params['id']]; diff --git a/civicrm/CRM/Event/Form/Registration/Register.php b/civicrm/CRM/Event/Form/Registration/Register.php index 12ff73031d..77297e325a 100644 --- a/civicrm/CRM/Event/Form/Registration/Register.php +++ b/civicrm/CRM/Event/Form/Registration/Register.php @@ -103,7 +103,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { protected static function isZeroAmount($fields, $form): bool { $isZeroAmount = FALSE; if (!empty($fields['priceSetId'])) { - if (CRM_Utils_Array::value('amount', $fields) == 0) { + if (empty($fields['amount'])) { $isZeroAmount = TRUE; } } @@ -1155,7 +1155,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { "_qf_Register_display=1&qfKey={$this->controller->_key}", TRUE, NULL, FALSE ); - if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) { + if (!empty($params['additional_participants'])) { $urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}"; } else { @@ -1194,7 +1194,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } // If registering > 1 participant, give status message - if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) { + if (!empty($params['additional_participants'])) { $statusMsg = ts('Registration information for participant 1 has been saved.'); CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); } diff --git a/civicrm/CRM/Export/BAO/Export.php b/civicrm/CRM/Export/BAO/Export.php index 2be84a1d8f..a95df716d8 100644 --- a/civicrm/CRM/Export/BAO/Export.php +++ b/civicrm/CRM/Export/BAO/Export.php @@ -70,9 +70,6 @@ class CRM_Export_BAO_Export { * @param array $exportParams * @param string $queryOperator * - * @return array|null - * An array can be requested from within a unit test. - * * @throws \CRM_Core_Exception */ public static function exportComponents( @@ -206,15 +203,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $processor->mergeSameAddress(); } - // In order to be able to write a unit test against this function we need to suppress - // the csv writing. In future hopefully the csv writing & the main processing will be in separate functions. - if (empty($exportParams['suppress_csv_for_testing'])) { - $processor->writeCSVFromTable(); - } - else { - // return tableName sqlColumns headerRows in test context - return [$processor->getTemporaryTable(), $sqlColumns, $processor->getHeaderRows(), $processor]; - } + $processor->writeCSVFromTable(); // delete the export temp table and component table $sql = "DROP TABLE IF EXISTS " . $processor->getTemporaryTable(); diff --git a/civicrm/CRM/Export/BAO/ExportProcessor.php b/civicrm/CRM/Export/BAO/ExportProcessor.php index 86ac5057df..6fae79fac1 100644 --- a/civicrm/CRM/Export/BAO/ExportProcessor.php +++ b/civicrm/CRM/Export/BAO/ExportProcessor.php @@ -623,6 +623,7 @@ class CRM_Export_BAO_ExportProcessor { $queryFields['country']['context'] = 'country'; $queryFields['world_region']['context'] = 'country'; $queryFields['state_province']['context'] = 'province'; + $queryFields['contact_id'] = ['title' => ts('Contact ID'), 'type' => CRM_Utils_Type::T_INT]; $this->queryFields = $queryFields; } diff --git a/civicrm/CRM/Financial/BAO/ExportFormat.php b/civicrm/CRM/Financial/BAO/ExportFormat.php index b352f9bb84..cf41115096 100644 --- a/civicrm/CRM/Financial/BAO/ExportFormat.php +++ b/civicrm/CRM/Financial/BAO/ExportFormat.php @@ -209,11 +209,10 @@ abstract class CRM_Financial_BAO_ExportFormat { // create activity. $subject .= ' ' . ts('Batch') . '[' . $values['title'] . ']'; - $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); $activityParams = [ - 'activity_type_id' => array_search('Export Accounting Batch', $activityTypes), + 'activity_type_id' => 'Export Accounting Batch', 'subject' => $subject, - 'status_id' => 2, + 'status_id' => 'Completed', 'activity_date_time' => date('YmdHis'), 'source_contact_id' => $session->get('userID'), 'source_record_id' => $values['id'], @@ -226,8 +225,7 @@ abstract class CRM_Financial_BAO_ExportFormat { 'upload_date' => date('YmdHis'), ], ]; - - CRM_Activity_BAO_Activity::create($activityParams); + civicrm_api3('Activity', 'create', $activityParams); } /** diff --git a/civicrm/CRM/Financial/BAO/FinancialType.php b/civicrm/CRM/Financial/BAO/FinancialType.php index b9154b1d6d..618bec0d19 100644 --- a/civicrm/CRM/Financial/BAO/FinancialType.php +++ b/civicrm/CRM/Financial/BAO/FinancialType.php @@ -487,7 +487,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { $realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type'); if (!$realSetting) { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); - if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) { + if (!empty($contributeSettings['acl_financial_type'])) { \Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE; } } diff --git a/civicrm/CRM/Financial/BAO/Payment.php b/civicrm/CRM/Financial/BAO/Payment.php index a4de716b08..0854915d03 100644 --- a/civicrm/CRM/Financial/BAO/Payment.php +++ b/civicrm/CRM/Financial/BAO/Payment.php @@ -59,12 +59,7 @@ class CRM_Financial_BAO_Payment { $isPaymentCompletesContribution = self::isPaymentCompletesContribution($params['contribution_id'], $params['total_amount']); - // For legacy reasons Pending payments are completed through completetransaction. - // @todo completetransaction should transition components but financial transactions - // should be handled through Payment.create. - $isSkipRecordingPaymentHereForLegacyHandlingReasons = ($contributionStatus == 'Pending' && $isPaymentCompletesContribution); - - if (!$isSkipRecordingPaymentHereForLegacyHandlingReasons && $params['total_amount'] > 0) { + if ($params['total_amount'] > 0) { $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_BAO_Contribution::getToFinancialAccount($contribution, $params); $balanceTrxnParams['from_financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship($contribution['financial_type_id'], 'Accounts Receivable Account is'); $balanceTrxnParams['total_amount'] = $params['total_amount']; @@ -88,7 +83,7 @@ class CRM_Financial_BAO_Payment { $trxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams); // @todo - this is just weird & historical & inconsistent - why 2 tracks? - if (CRM_Utils_Array::value('line_item', $params) && !empty($trxn)) { + if (!empty($params['line_item']) && !empty($trxn)) { foreach ($params['line_item'] as $values) { foreach ($values as $id => $amount) { $p = ['id' => $id]; @@ -164,7 +159,11 @@ class CRM_Financial_BAO_Payment { ); } else { - civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]); + civicrm_api3('Contribution', 'completetransaction', [ + 'id' => $contribution['id'], + 'is_post_payment_create' => TRUE, + 'is_email_receipt' => $params['is_send_contribution_notification'], + ]); // Get the trxn $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC'); $ftParams = ['id' => $trxnId['financialTrxnId']]; @@ -362,8 +361,6 @@ class CRM_Financial_BAO_Payment { * @param $updateStatus * - deprecate this param * - * @todo - make this protected once recordAdditionalPayment no longer calls it. - * * @return CRM_Financial_DAO_FinancialTrxn */ protected static function recordRefundPayment($contributionId, $trxnData, $updateStatus) { @@ -388,31 +385,6 @@ class CRM_Financial_BAO_Payment { if ($updateStatus) { CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $completedStatusId); } - // add financial item entry - $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id); - if (!empty($lineItems)) { - foreach ($lineItems as $lineItemId => $lineItemValue) { - // don't record financial item for cancelled line-item - if ($lineItemValue['qty'] == 0) { - continue; - } - $paid = $financialTrxn->total_amount; - if (!empty(floatval($contributionDAO->total_amount))) { - $paid = $lineItemValue['line_total'] * ($financialTrxn->total_amount / $contributionDAO->total_amount); - } - $addFinancialEntry = [ - 'transaction_date' => $financialTrxn->trxn_date, - 'contact_id' => $contributionDAO->contact_id, - 'amount' => round($paid, 2), - 'currency' => $contributionDAO->currency, - 'status_id' => $paidStatus, - 'entity_id' => $lineItemId, - 'entity_table' => 'civicrm_line_item', - ]; - $trxnIds = ['id' => $financialTrxn->id]; - CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds); - } - } return $financialTrxn; } diff --git a/civicrm/CRM/Financial/Form/FinancialAccount.php b/civicrm/CRM/Financial/Form/FinancialAccount.php index 227e6d0143..7240598884 100644 --- a/civicrm/CRM/Financial/Form/FinancialAccount.php +++ b/civicrm/CRM/Financial/Form/FinancialAccount.php @@ -143,7 +143,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { if ($values['financial_account_type_id'] != $financialAccountTypeId) { $errorMsg['financial_account_type_id'] = ts('Taxable accounts should have Financial Account Type set to Liability.'); } - if (CRM_Utils_Array::value('tax_rate', $values) == NULL) { + if (!isset($values['tax_rate'])) { $errorMsg['tax_rate'] = ts('Please enter value for tax rate'); } } diff --git a/civicrm/CRM/Grant/Form/Grant.php b/civicrm/CRM/Grant/Form/Grant.php index 36d7afa24f..de05a0c7cb 100644 --- a/civicrm/CRM/Grant/Form/Grant.php +++ b/civicrm/CRM/Grant/Form/Grant.php @@ -142,6 +142,11 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { $defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], NULL, '%a'); } } + else { + if ($this->_contactID) { + $defaults['contact_id'] = $this->_contactID; + } + } return $defaults; } @@ -224,8 +229,9 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { ], ]); - if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE); + $contactField = $this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE); + if ($this->_context != 'standalone') { + $contactField->freeze(); } } diff --git a/civicrm/CRM/Grant/Form/Task.php b/civicrm/CRM/Grant/Form/Task.php index e868f4d646..1cc6fddb24 100644 --- a/civicrm/CRM/Grant/Form/Task.php +++ b/civicrm/CRM/Grant/Form/Task.php @@ -63,7 +63,7 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task { public static function preProcessCommon(&$form) { $form->_grantIds = []; - $values = $form->controller->exportValues('Search'); + $values = $form->controller->exportValues($form->get('searchFormName')); $form->_task = $values['task']; $tasks = CRM_Grant_Task::tasks(); diff --git a/civicrm/CRM/Import/Form/MapField.php b/civicrm/CRM/Import/Form/MapField.php index 654f273268..9a5a309a23 100644 --- a/civicrm/CRM/Import/Form/MapField.php +++ b/civicrm/CRM/Import/Form/MapField.php @@ -153,4 +153,37 @@ abstract class CRM_Import_Form_MapField extends CRM_Core_Form { return $best; } + /** + * Add the saved mapping fields to the form. + * + * @param int|null $savedMappingID + * + * @throws \CiviCRM_API3_Exception + */ + protected function buildSavedMappingFields($savedMappingID) { + //to save the current mappings + if (!$savedMappingID) { + $saveDetailsName = ts('Save this field mapping'); + $this->applyFilter('saveMappingName', 'trim'); + $this->add('text', 'saveMappingName', ts('Name')); + $this->add('text', 'saveMappingDesc', ts('Description')); + } + else { + $savedMapping = $this->get('savedMapping'); + + $mappingName = (string) civicrm_api3('Mapping', 'getvalue', ['id' => $savedMappingID, 'return' => 'name']); + $this->set('loadedMapping', $savedMapping); + $this->assign('loadedMapping', $mappingName); + $this->assign('savedName', $mappingName); + $this->add('hidden', 'mappingId', $savedMappingID); + + $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); + $saveDetailsName = ts('Save as a new field mapping'); + $this->add('text', 'saveMappingName', ts('Name')); + $this->add('text', 'saveMappingDesc', ts('Description')); + } + + $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + } + } diff --git a/civicrm/CRM/Import/ImportProcessor.php b/civicrm/CRM/Import/ImportProcessor.php new file mode 100644 index 0000000000..79ddc3b640 --- /dev/null +++ b/civicrm/CRM/Import/ImportProcessor.php @@ -0,0 +1,570 @@ +<?php + +/** + * Class CRM_Import_ImportProcessor. + * + * Import processor class. This is intended to provide a sanitising wrapper around + * the form-oriented import classes. In particular it is intended to provide a clear translation + * between the saved mapping field format and the quick form & parser formats. + * + * In the first instance this is only being used in unit tests but the intent is to migrate + * to it on a trajectory similar to the ExportProcessor so it is not in the tests. + */ +class CRM_Import_ImportProcessor { + + /** + * An array of fields in the format used in the table civicrm_mapping_field. + * + * @var array + */ + protected $mappingFields = []; + + /** + * @var array + */ + protected $metadata = []; + + /** + * Metadata keyed by field title. + * + * @var array + */ + protected $metadataByTitle = []; + + /** + * Get contact type being imported. + * + * @var string + */ + protected $contactType; + + /** + * Get contact sub type being imported. + * + * @var string + */ + protected $contactSubType; + + /** + * Array of valid relationships for the contact type & subtype. + * + * @var array + */ + protected $validRelationships = []; + + /** + * Name of the form. + * + * Used for js for quick form. + * + * @var string + */ + protected $formName; + + /** + * @return string + */ + public function getFormName(): string { + return $this->formName; + } + + /** + * @param string $formName + */ + public function setFormName(string $formName) { + $this->formName = $formName; + } + + /** + * @return array + */ + public function getValidRelationships(): array { + if (!isset($this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()])) { + //Relationship importables + $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType( + NULL, NULL, NULL, $this->getContactType(), + FALSE, 'label', TRUE, $this->getContactSubType() + ); + asort($relations); + $this->setValidRelationships($relations); + } + return $this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()]; + } + + /** + * @param array $validRelationships + */ + public function setValidRelationships(array $validRelationships) { + $this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()] = $validRelationships; + } + + /** + * Get contact subtype for import. + * + * @return string + */ + public function getContactSubType(): string { + return $this->contactSubType ?? ''; + } + + /** + * Set contact subtype for import. + * + * @param string $contactSubType + */ + public function setContactSubType($contactSubType) { + $this->contactSubType = (string) $contactSubType; + } + + /** + * Saved Mapping ID. + * + * @var int + */ + protected $mappingID; + + /** + * @return array + */ + public function getMetadata(): array { + return $this->metadata; + } + + /** + * Setting for metadata. + * + * We wrangle the label for custom fields to include the label since the + * metadata trait presents it in a more 'pure' form but the label is appended for importing. + * + * @param array $metadata + * + * @throws \CiviCRM_API3_Exception + */ + public function setMetadata(array $metadata) { + $fieldDetails = civicrm_api3('CustomField', 'get', [ + 'return' => ['custom_group_id.title'], + 'options' => ['limit' => 0], + ])['values']; + foreach ($metadata as $index => $field) { + if (!empty($field['custom_field_id'])) { + // The 'label' format for import is custom group title :: custom name title + $metadata[$index]['name'] = $index; + $metadata[$index]['title'] .= ' :: ' . $fieldDetails[$field['custom_field_id']]['custom_group_id.title']; + } + } + $this->metadata = $metadata; + } + + /** + * @return int + */ + public function getMappingID(): int { + return $this->mappingID; + } + + /** + * @param int $mappingID + */ + public function setMappingID(int $mappingID) { + $this->mappingID = $mappingID; + } + + /** + * Get the contact type for the import. + * + * @return string + */ + public function getContactType(): string { + return $this->contactType; + } + + /** + * @param string $contactType + */ + public function setContactType(string $contactType) { + $this->contactType = $contactType; + } + + /** + * Set the contact type according to the constant. + * + * @param int $contactTypeKey + */ + public function setContactTypeByConstant($contactTypeKey) { + $constantTypeMap = [ + CRM_Import_Parser::CONTACT_INDIVIDUAL => 'Individual', + CRM_Import_Parser::CONTACT_HOUSEHOLD => 'Household', + CRM_Import_Parser::CONTACT_ORGANIZATION => 'Organization', + ]; + $this->contactType = $constantTypeMap[$contactTypeKey]; + } + + /** + * Get Mapping Fields. + * + * @return array + * + * @throws \CiviCRM_API3_Exception + */ + public function getMappingFields(): array { + if (empty($this->mappingFields) && !empty($this->getMappingID())) { + $this->loadSavedMapping(); + } + return $this->mappingFields; + } + + /** + * Set mapping fields. + * + * We do a little cleanup here too. + * + * We ensure that column numbers are set and that the fields are ordered by them. + * + * This would mean the fields could be loaded unsorted. + * + * @param array $mappingFields + */ + public function setMappingFields(array $mappingFields) { + $i = 0; + foreach ($mappingFields as &$mappingField) { + if (!isset($mappingField['column_number'])) { + $mappingField['column_number'] = $i; + } + if ($mappingField['column_number'] > $i) { + $i = $mappingField['column_number']; + } + $i++; + } + $this->mappingFields = $this->rekeyBySortedColumnNumbers($mappingFields); + } + + /** + * Get the names of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldNames() { + return CRM_Utils_Array::collect('name', $this->getMappingFields()); + } + + /** + * Get the field name for the given column. + * + * @param int $columnNumber + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getFieldName($columnNumber) { + return $this->getFieldNames()[$columnNumber]; + } + + /** + * Get the field name for the given column. + * + * @param int $columnNumber + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getRelationshipKey($columnNumber) { + $field = $this->getMappingFields()[$columnNumber]; + return empty($field['relationship_type_id']) ? NULL : $field['relationship_type_id'] . '_' . $field['relationship_direction']; + } + + /** + * Get relationship key only if it is valid. + * + * @param int $columnNumber + * + * @return string|null + * + * @throws \CiviCRM_API3_Exception + */ + public function getValidRelationshipKey($columnNumber) { + $key = $this->getRelationshipKey($columnNumber); + return $this->isValidRelationshipKey($key) ? $key : NULL; + } + + /** + * Get the IM Provider ID. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getIMProviderID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['im_provider_id'] ?? NULL; + } + + /** + * Get the Phone Type + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getPhoneTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['phone_type_id'] ?? NULL; + } + + /** + * Get the Website Type + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getWebsiteTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['website_type_id'] ?? NULL; + } + + /** + * Get the Location Type + * + * Returning 0 rather than null is historical. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getLocationTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['location_type_id'] ?? 0; + } + + /** + * Get the IM or Phone type. + * + * We have a field that would be the 'relevant' type - which could be either. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getPhoneOrIMTypeID($columnNumber) { + return $this->getIMProviderID($columnNumber) ?? $this->getPhoneTypeID($columnNumber); + } + + /** + * Get the location types of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldLocationTypes() { + return CRM_Utils_Array::collect('location_type_id', $this->getMappingFields()); + } + + /** + * Get the phone types of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldPhoneTypes() { + return CRM_Utils_Array::collect('phone_type_id', $this->getMappingFields()); + } + + /** + * Get the names of the im_provider fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldIMProviderTypes() { + return CRM_Utils_Array::collect('im_provider_id', $this->getMappingFields()); + } + + /** + * Get the names of the website fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldWebsiteTypes() { + return CRM_Utils_Array::collect('im_provider_id', $this->getMappingFields()); + } + + /** + * Get an instance of the importer object. + * + * @return CRM_Contact_Import_Parser_Contact + * + * @throws \CiviCRM_API3_Exception + */ + public function getImporterObject() { + $importer = new CRM_Contact_Import_Parser_Contact( + $this->getFieldNames(), + $this->getFieldLocationTypes(), + $this->getFieldPhoneTypes(), + $this->getFieldIMProviderTypes(), + // @todo - figure out related mappings. + // $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], + [], + [], + [], + [], + [], + [], + $this->getFieldWebsiteTypes() + // $mapperRelatedContactWebsiteType = [] + ); + $importer->init(); + $importer->_contactType = $this->getContactType(); + return $importer; + } + + /** + * Load the mapping from the datbase into the format that would be received from the UI. + * + * @throws \CiviCRM_API3_Exception + */ + protected function loadSavedMapping() { + $fields = civicrm_api3('MappingField', 'get', [ + 'mapping_id' => $this->getMappingID(), + 'options' => ['limit' => 0], + ])['values']; + foreach ($fields as $index => $field) { + // Fix up the fact that for lost reasons we save by label not name. + $fields[$index]['label'] = $field['name']; + if (empty($field['relationship_type_id'])) { + $fields[$index]['name'] = $this->getNameFromLabel($field['name']); + } + else { + // Honour legacy chaos factor. + if ($field['name'] === ts('- do not import -')) { + // This is why we save names not labels people.... + $field['name'] = 'do_not_import'; + } + $fields[$index]['name'] = strtolower(str_replace(" ", "_", $field['name'])); + // fix for edge cases, CRM-4954 + if ($fields[$index]['name'] === 'image_url') { + $fields[$index]['name'] = str_replace('url', 'URL', $fields[$index]['name']); + } + } + $fieldSpec = $this->getMetadata()[$fields[$index]['name']]; + if (empty($field['location_type_id']) && !empty($fieldSpec['hasLocationType'])) { + $fields[$index]['location_type_id'] = 'Primary'; + } + } + $this->mappingFields = $this->rekeyBySortedColumnNumbers($fields); + } + + /** + * Get the titles from metadata. + */ + public function getMetadataTitles() { + if (empty($this->metadataByTitle)) { + $this->metadataByTitle = CRM_Utils_Array::collect('title', $this->getMetadata()); + } + return $this->metadataByTitle; + } + + /** + * Rekey the array by the column_number. + * + * @param array $mappingFields + * + * @return array + */ + protected function rekeyBySortedColumnNumbers(array $mappingFields) { + $this->mappingFields = CRM_Utils_Array::rekey($mappingFields, 'column_number'); + ksort($this->mappingFields); + return $this->mappingFields; + } + + /** + * Get the field name from the label. + * + * @param string $label + * + * @return string + */ + protected function getNameFromLabel($label) { + $titleMap = array_flip($this->getMetadataTitles()); + return $titleMap[$label] ?? ''; + } + + /** + * Validate the key against the relationships available for the contatct type & subtype. + * + * @param string $key + * + * @return bool + */ + protected function isValidRelationshipKey($key) { + return !empty($this->getValidRelationships()[$key]) ? TRUE : FALSE; + } + + /** + * Get the relevant js for quickform. + * + * @param int $column + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getQuickFormJSForField($column) { + $columnNumbersToHide = []; + if ($this->getFieldName($column) === 'do_not_import') { + $columnNumbersToHide = [1, 2, 3]; + } + elseif ($this->getRelationshipKey($column)) { + if (!$this->getWebsiteTypeID($column) && !$this->getLocationTypeID($column)) { + $columnNumbersToHide[] = 2; + } + if (!$this->getFieldName($column)) { + $columnNumbersToHide[] = 1; + } + if (!$this->getPhoneOrIMTypeID($column)) { + $columnNumbersToHide[] = 3; + } + } + else { + if (!$this->getLocationTypeID($column) && !$this->getWebsiteTypeID($column)) { + $columnNumbersToHide[] = 1; + } + if (!$this->getPhoneOrIMTypeID($column)) { + $columnNumbersToHide[] = 2; + } + $columnNumbersToHide[] = 3; + } + + $jsClauses = []; + foreach ($columnNumbersToHide as $columnNumber) { + $jsClauses[] = $this->getFormName() . "['mapper[$column][" . $columnNumber . "]'].style.display = 'none';"; + } + return empty($jsClauses) ? '' : implode("\n", $jsClauses) . "\n"; + } + + /** + * Get the defaults for the column from the saved mapping. + * + * @param int $column + * + * @return array + * @throws \CiviCRM_API3_Exception + */ + public function getSavedQuickformDefaultsForColumn($column) { + if ($this->getFieldName($column) === 'do_not_import') { + return []; + } + if ($this->getValidRelationshipKey($column)) { + if ($this->getWebsiteTypeID($column)) { + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getWebsiteTypeID($column)]; + } + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getLocationTypeID($column), $this->getPhoneOrIMTypeID($column)]; + } + if ($this->getWebsiteTypeID($column)) { + return [$this->getFieldName($column), $this->getWebsiteTypeID($column)]; + } + return [(string) $this->getFieldName($column), $this->getLocationTypeID($column), $this->getPhoneOrIMTypeID($column)]; + } + +} diff --git a/civicrm/CRM/Mailing/Form/Search.php b/civicrm/CRM/Mailing/Form/Search.php index d2d6af941e..6c03b4e9ef 100644 --- a/civicrm/CRM/Mailing/Form/Search.php +++ b/civicrm/CRM/Mailing/Form/Search.php @@ -44,7 +44,8 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title') ); - CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE); + $dateFieldLabel = ($parent->_sms) ? ts('SMS Date') : ts('Mailing Date'); + $this->addDatePickerRange('mailing', $dateFieldLabel); $this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name') @@ -111,14 +112,20 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { public function postProcess() { $params = $this->controller->exportValues($this->_name); - CRM_Contact_BAO_Query::fixDateValues($params["mailing_relative"], $params['mailing_from'], $params['mailing_to']); + if (!empty($params['mailing_relative'])) { + list($params['mailing_low'], $params['mailing_high']) = CRM_Utils_Date::getFromTo($params['mailing_relative'], $params['mailing_low'], $params['mailing_high']); + unset($params['mailing_relative']); + } + elseif (!empty($params['mailing_high'])) { + $params['mailing_high'] .= ' ' . '23:59:59'; + } $parent = $this->controller->getParent(); if (!empty($params)) { $fields = [ 'mailing_name', - 'mailing_from', - 'mailing_to', + 'mailing_low', + 'mailing_high', 'sort_name', 'campaign_id', 'mailing_status', @@ -132,16 +139,7 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field]) ) { - if (in_array($field, [ - 'mailing_from', - 'mailing_to', - ]) && !$params["mailing_relative"]) { - $time = ($field == 'mailing_to') ? '235959' : NULL; - $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time)); - } - else { - $parent->set($field, $params[$field]); - } + $parent->set($field, $params[$field]); } else { $parent->set($field, NULL); diff --git a/civicrm/CRM/Mailing/Selector/Browse.php b/civicrm/CRM/Mailing/Selector/Browse.php index a0ae8f5b65..9440a77bb1 100644 --- a/civicrm/CRM/Mailing/Selector/Browse.php +++ b/civicrm/CRM/Mailing/Selector/Browse.php @@ -522,7 +522,7 @@ LEFT JOIN civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul } $dateClause1 = $dateClause2 = []; - $from = $this->_parent->get('mailing_from'); + $from = $this->_parent->get('mailing_low'); if (!CRM_Utils_System::isNull($from)) { if ($this->_parent->get('unscheduled')) { $dateClause1[] = 'civicrm_mailing.created_date >= %2'; @@ -534,7 +534,7 @@ LEFT JOIN civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul $params[2] = [$from, 'String']; } - $to = $this->_parent->get('mailing_to'); + $to = $this->_parent->get('mailing_high'); if (!CRM_Utils_System::isNull($to)) { if ($this->_parent->get('unscheduled')) { $dateClause1[] = ' civicrm_mailing.created_date <= %3 '; diff --git a/civicrm/CRM/Member/BAO/Membership.php b/civicrm/CRM/Member/BAO/Membership.php index 2b0dbc7512..bbd24740df 100644 --- a/civicrm/CRM/Member/BAO/Membership.php +++ b/civicrm/CRM/Member/BAO/Membership.php @@ -255,13 +255,13 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { * (reference ) an assoc array of name/value pairs. * @param array $ids * Deprecated parameter The array that holds all the db ids. - * @param bool $skipRedirect - * - * @throws CRM_Core_Exception * * @return CRM_Member_BAO_Membership|CRM_Core_Error + * @throws \CiviCRM_API3_Exception + * + * @throws CRM_Core_Exception */ - public static function create(&$params, &$ids = [], $skipRedirect = FALSE) { + public static function create(&$params, &$ids = []) { // always calculate status if is_override/skipStatusCal is not true. // giving respect to is_override during import. CRM-4012 @@ -381,14 +381,14 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { foreach ($params['line_item'] as $priceSetId => $lineItems) { foreach ($lineItems as $lineIndex => $lineItem) { $lineMembershipType = CRM_Utils_Array::value('membership_type_id', $lineItem); - if (CRM_Utils_Array::value('contribution', $params)) { + if (!empty($params['contribution'])) { $params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id; } if ($lineMembershipType && $lineMembershipType == CRM_Utils_Array::value('membership_type_id', $params)) { $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $membership->id; $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_membership'; } - elseif (!$lineMembershipType && CRM_Utils_Array::value('contribution', $params)) { + elseif (!$lineMembershipType && !empty($params['contribution'])) { $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $params['contribution']->id; $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_contribution'; } @@ -1874,7 +1874,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND $memParams['contribution_recur_id'] = $contributionRecurID; } // @todo stop passing $ids - it is empty - $membership = self::create($memParams, $ids, FALSE); + $membership = self::create($memParams, $ids); return array($membership, $renewalMode, $dates); } @@ -2048,7 +2048,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND // Relevant tests in api_v3_ContributionPageTest. $memParams['line_item'] = $lineItems; // @todo stop passing $ids (membership and userId may be set by this point) - $membership = self::create($memParams, $ids, FALSE); + $membership = self::create($memParams, $ids); // not sure why this statement is here, seems quite odd :( - Lobo: 12/26/2010 // related to: http://forum.civicrm.org/index.php/topic,11416.msg49072.html#msg49072 diff --git a/civicrm/CRM/Member/BAO/MembershipType.php b/civicrm/CRM/Member/BAO/MembershipType.php index 7452946151..f6e98d7a3a 100644 --- a/civicrm/CRM/Member/BAO/MembershipType.php +++ b/civicrm/CRM/Member/BAO/MembershipType.php @@ -156,6 +156,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { CRM_Member_PseudoConstant::membershipType(NULL, TRUE); civicrm_api3('membership', 'getfields', ['cache_clear' => 1, 'fieldname' => 'membership_type_id']); civicrm_api3('profile', 'getfields', ['action' => 'submit', 'cache_clear' => 1]); + Civi::cache('metadata')->clear(); } /** @@ -266,6 +267,8 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { /** * Get membership Types. * + * @deprecated use getAllMembershipTypes. + * * @param bool $public * * @return array @@ -288,6 +291,8 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { /** * Get membership Type Details. * + * @deprecated use getMembershipType. + * * @param int $membershipTypeId * * @return array|null @@ -625,27 +630,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { return $membershipDates; } - /** - * @deprecated Please use the Membership API - * Retrieve all Membership Types associated with an Organization - * - * @param int $orgID - * Id of Organization. - * - * @return array - * array of the details of membership types - */ - public static function getMembershipTypesByOrg($orgID) { - CRM_Core_Error::deprecatedFunctionWarning('membership_type api'); - $memberTypesSameParentOrg = civicrm_api3('MembershipType', 'get', [ - 'member_of_contact_id' => $orgID, - 'options' => [ - 'limit' => 0, - ], - ]); - return CRM_Utils_Array::value('values', $memberTypesSameParentOrg, []); - } - /** * Retrieve all Membership Types with Member of Contact id. * @@ -841,4 +825,30 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { } } + /** + * Cached wrapper for membership types. + * + * Since this is used from the batched script caching helps. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getAllMembershipTypes() { + if (!Civi::cache('metadata')->has(__CLASS__ . __FUNCTION__)) { + Civi::cache('metadata')->set(__CLASS__ . __FUNCTION__, civicrm_api3('MembershipType', 'get', ['options' => ['limit' => 0, 'sort' => 'weight']])['values']); + } + return Civi::cache('metadata')->get(__CLASS__ . __FUNCTION__); + } + + /** + * Get a specific membership type (leveraging the cache). + * + * @param int $id + * + * @return mixed + * @throws \CiviCRM_API3_Exception + */ + public static function getMembershipType($id) { + return self::getAllMembershipTypes()[$id]; + } + } diff --git a/civicrm/CRM/Member/BAO/Query.php b/civicrm/CRM/Member/BAO/Query.php index 9edfe64693..d8e0d9b9ea 100644 --- a/civicrm/CRM/Member/BAO/Query.php +++ b/civicrm/CRM/Member/BAO/Query.php @@ -67,9 +67,9 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { } //add join date - if (!empty($query->_returnProperties['join_date'])) { - $query->_select['join_date'] = "civicrm_membership.join_date as join_date"; - $query->_element['join_date'] = 1; + if (!empty($query->_returnProperties['membership_join_date'])) { + $query->_select['membership_join_date'] = "civicrm_membership.join_date as membership_join_date"; + $query->_element['membership_join_date'] = 1; } //add source @@ -161,12 +161,22 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { * @param CRM_Contact_BAO_Query $query */ public static function whereClauseSingle(&$values, &$query) { + if ($query->buildDateRangeQuery($values)) { + // @todo - move this to Contact_Query in or near the call to + // $this->buildRelativeDateQuery($values); + return; + } list($name, $op, $value, $grouping) = $values; switch ($name) { case 'member_join_date_low': case 'member_join_date_high': + Civi::log()->warning( + 'member_join_date field is deprecated please use membership_join_date field instead', + ['civi.tag' => 'deprecated'] + ); + $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, - 'civicrm_membership', 'member_join_date', 'join_date', + 'civicrm_membership', $fldName, 'join_date', 'Member Since' ); return; @@ -174,6 +184,10 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { case 'membership_start_date': case 'member_start_date_low': case 'member_start_date_high': + Civi::log()->warning( + 'member_start_date field is deprecated please use membership_start_date field instead', + ['civi.tag' => 'deprecated'] + ); $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, 'civicrm_membership', $fldName, 'start_date', @@ -184,6 +198,10 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { case 'membership_end_date': case 'member_end_date_low': case 'member_end_date_high': + Civi::log()->warning( + 'member_end_date field is deprecated please use membership_end_date field instead', + ['civi.tag' => 'deprecated'] + ); $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, 'civicrm_membership', $fldName, 'end_date', @@ -376,6 +394,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { $query->_qill[$grouping][] = $value ? ts("Membership Status Is Overriden") : ts("Membership Status Is NOT Overriden"); $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1; return; + } } @@ -443,7 +462,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'membership_type' => 1, 'member_is_test' => 1, 'member_is_pay_later' => 1, - 'join_date' => 1, + 'membership_join_date' => 1, 'membership_start_date' => 1, 'membership_end_date' => 1, 'membership_source' => 1, @@ -454,7 +473,6 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'membership_recur_id' => 1, 'member_campaign_id' => 1, 'member_is_override' => 1, - 'member_auto_renew' => 1, ]; if ($includeCustomFields) { @@ -471,12 +489,29 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { return $properties; } + /** + * Get the metadata for fields to be included on the grant search form. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getSearchFieldMetadata() { + $fields = [ + 'membership_join_date', + 'membership_start_date', + 'membership_end_date', + ]; + $metadata = civicrm_api3('Membership', 'getfields', [])['values']; + return array_intersect_key($metadata, array_flip($fields)); + } + /** * Build the search form. * * @param CRM_Core_Form $form */ public static function buildSearchForm(&$form) { + $form->addSearchFieldMetadata(['Membership' => self::getSearchFieldMetadata()]); + $form->addFormFieldsFromMetadata(); $membershipStatus = CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label', FALSE, FALSE); $form->add('select', 'membership_status_id', ts('Membership Status'), $membershipStatus, FALSE, [ 'id' => 'membership_status_id', @@ -494,17 +529,6 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { $form->addElement('text', 'member_source', ts('Source')); $form->add('number', 'membership_id', ts('Membership ID'), ['class' => 'four', 'min' => 1]); - CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_join_date_range_error'); - - CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_start_date_range_error'); - - CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_end_date_range_error'); - - $form->addFormRule(['CRM_Member_BAO_Query', 'formRule'], $form); - $form->addYesNo('membership_is_current_member', ts('Current Member?'), TRUE); $form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE); $form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE); @@ -544,27 +568,4 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { } } - /** - * Custom form rules. - * - * @param array $fields - * @param array $files - * @param CRM_Core_Form $form - * - * @return bool|array - */ - public static function formRule($fields, $files, $form) { - $errors = []; - - if ((empty($fields['member_join_date_low']) || empty($fields['member_join_date_high'])) && (empty($fields['member_start_date_low']) || empty($fields['member_start_date_high'])) && (empty($fields['member_end_date_low']) || empty($fields['member_end_date_high']))) { - return TRUE; - } - - CRM_Utils_Rule::validDateRange($fields, 'member_join_date', $errors, ts('Member Since')); - CRM_Utils_Rule::validDateRange($fields, 'member_start_date', $errors, ts('Start Date')); - CRM_Utils_Rule::validDateRange($fields, 'member_end_date', $errors, ts('End Date')); - - return empty($errors) ? TRUE : $errors; - } - } diff --git a/civicrm/CRM/Member/DAO/Membership.php b/civicrm/CRM/Member/DAO/Membership.php index 3fa1ead539..d9948efa77 100644 --- a/civicrm/CRM/Member/DAO/Membership.php +++ b/civicrm/CRM/Member/DAO/Membership.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/Membership.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:64ef044391b9dee565e8e2a9d893f4cf) + * (GenCodeChecksum:97d01bc13256a1dd315a86fb5faea1dc) */ /** @@ -229,7 +229,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'labelColumn' => 'name', ], ], - 'join_date' => [ + 'membership_join_date' => [ 'name' => 'join_date', 'type' => CRM_Utils_Type::T_DATE, 'title' => ts('Member Since'), @@ -328,7 +328,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'labelColumn' => 'label', ], ], - 'is_override' => [ + 'member_is_override' => [ 'name' => 'is_override', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Status Override'), @@ -381,6 +381,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'title' => ts('Max Related'), 'description' => ts('Maximum number of related memberships (membership_type override).'), 'where' => 'civicrm_membership.max_related', + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', @@ -423,12 +424,13 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'type' => 'CheckBox', ], ], - 'contribution_recur_id' => [ + 'membership_recur_id' => [ 'name' => 'contribution_recur_id', 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Membership Recurring Contribution'), 'description' => ts('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.'), 'where' => 'civicrm_membership.contribution_recur_id', + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', diff --git a/civicrm/CRM/Member/Form/Membership.php b/civicrm/CRM/Member/Form/Membership.php index 3169844fdc..bdc9c86110 100644 --- a/civicrm/CRM/Member/Form/Membership.php +++ b/civicrm/CRM/Member/Form/Membership.php @@ -1162,10 +1162,16 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $lineItem = [$this->_priceSetId => []]; + // BEGIN Fix for dev/core/issues/860 + // Prepare fee block and call buildAmount hook - based on CRM_Price_BAO_PriceSet::buildPriceSet(). + CRM_Price_BAO_PriceSet::applyACLFinancialTypeStatusToFeeBlock($this->_priceSet['fields']); + CRM_Utils_Hook::buildAmount('membership', $this, $this->_priceSet['fields']); + // END Fix for dev/core/issues/860 + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $formValues, $lineItem[$this->_priceSetId], NULL, $this->_priceSetId); - if (CRM_Utils_Array::value('tax_amount', $formValues)) { + if (!empty($formValues['tax_amount'])) { $params['tax_amount'] = $formValues['tax_amount']; } $params['total_amount'] = CRM_Utils_Array::value('amount', $formValues); @@ -1739,7 +1745,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // if selected membership doesn't match with earlier membership !in_array($this->_memType, $this->_memTypeSelected) ) { - if (CRM_Utils_Array::value('is_recur', $inputParams)) { + if (!empty($inputParams['is_recur'])) { CRM_Core_Session::setStatus(ts('Associated recurring contribution cannot be updated on membership type change.', ts('Error'), 'error')); return; } diff --git a/civicrm/CRM/Member/Form/MembershipRenewal.php b/civicrm/CRM/Member/Form/MembershipRenewal.php index 4c984618d3..2553d1f1fb 100644 --- a/civicrm/CRM/Member/Form/MembershipRenewal.php +++ b/civicrm/CRM/Member/Form/MembershipRenewal.php @@ -488,6 +488,8 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { * Process form submission. * * This function is also accessed by a unit test. + * + * @throws \CRM_Core_Exception */ protected function submit() { $this->storeContactFields($this->_params); @@ -585,12 +587,12 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $membershipSource = $this->_params['membership_source']; } - $isPending = ($this->_params['contribution_status_id'] == 2) ? TRUE : FALSE; - + // @todo Move this into CRM_Member_BAO_Membership::processMembership + $pending = ($this->_params['contribution_status_id'] == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE; list($membership) = CRM_Member_BAO_Membership::processMembership( $this->_contactID, $this->_params['membership_type_id'][1], $isTestMembership, $renewalDate, NULL, $customFieldsFormatted, $numRenewTerms, $this->_membershipId, - $isPending, + $pending, $contributionRecurID, $membershipSource, $this->_params['is_pay_later'], CRM_Utils_Array::value('campaign_id', $this->_params) ); @@ -651,72 +653,82 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { } if (!empty($this->_params['send_receipt'])) { + $this->sendReceipt($membership); + } + } - $receiptFrom = $this->_params['from_email_address']; - - if (!empty($this->_params['payment_instrument_id'])) { - $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); - $this->_params['paidBy'] = $paymentInstrument[$this->_params['payment_instrument_id']]; - } - //get the group Tree - $this->_groupTree = CRM_Core_BAO_CustomGroup::getTree('Membership', NULL, $this->_id, FALSE, $this->_memType); + /** + * Send a receipt. + * + * @param array $membership + * + * @throws \CRM_Core_Exception + */ + protected function sendReceipt($membership) { + $receiptFrom = $this->_params['from_email_address']; - // retrieve custom data - $customFields = $customValues = $fo = []; - foreach ($this->_groupTree as $groupID => $group) { - if ($groupID == 'info') { - continue; - } - foreach ($group['fields'] as $k => $field) { - $field['title'] = $field['label']; - $customFields["custom_{$k}"] = $field; - } + if (!empty($this->_params['payment_instrument_id'])) { + $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); + $this->_params['paidBy'] = $paymentInstrument[$this->_params['payment_instrument_id']]; + } + //get the group Tree + $this->_groupTree = CRM_Core_BAO_CustomGroup::getTree('Membership', NULL, $this->_id, FALSE, $this->_memType); + + // retrieve custom data + $customFields = $customValues = $fo = []; + foreach ($this->_groupTree as $groupID => $group) { + if ($groupID == 'info') { + continue; } - $members = [['member_id', '=', $this->_membershipId, 0, 0]]; - // check whether its a test drive - if ($this->_mode == 'test') { - $members[] = ['member_test', '=', 1, 0, 0]; + foreach ($group['fields'] as $k => $field) { + $field['title'] = $field['label']; + $customFields["custom_{$k}"] = $field; } - CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members); + } + $members = [['member_id', '=', $this->_membershipId, 0, 0]]; + // check whether its a test drive + if ($this->_mode == 'test') { + $members[] = ['member_test', '=', 1, 0, 0]; + } + CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members); - $this->assign_by_ref('formValues', $this->_params); - if (!empty($this->_params['contribution_id'])) { - $this->assign('contributionID', $this->_params['contribution_id']); - } + $this->assign_by_ref('formValues', $this->_params); + if (!empty($this->_params['contribution_id'])) { + $this->assign('contributionID', $this->_params['contribution_id']); + } - $this->assign('membership_name', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', - $membership->membership_type_id + $this->assign('membership_name', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', + $membership->membership_type_id + )); + $this->assign('customValues', $customValues); + $this->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date)); + $this->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date)); + if ($this->_mode) { + $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters( + $this->_params, + $this->_bltID )); - $this->assign('customValues', $customValues); - $this->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date)); - $this->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date)); - if ($this->_mode) { - $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters( - $this->_params, - $this->_bltID - )); - $this->assign('contributeMode', 'direct'); - $this->assign('isAmountzero', 0); - $this->assign('is_pay_later', 0); - $this->assign('isPrimary', 1); - $this->assign('receipt_text_renewal', $this->_params['receipt_text']); - if ($this->_mode == 'test') { - $this->assign('action', '1024'); - } + $this->assign('contributeMode', 'direct'); + $this->assign('isAmountzero', 0); + $this->assign('is_pay_later', 0); + $this->assign('isPrimary', 1); + $this->assign('receipt_text_renewal', $this->_params['receipt_text']); + if ($this->_mode == 'test') { + $this->assign('action', '1024'); } - - list($this->isMailSent) = CRM_Core_BAO_MessageTemplate::sendTemplate( - [ - 'groupName' => 'msg_tpl_workflow_membership', - 'valueName' => 'membership_offline_receipt', - 'contactId' => $this->_receiptContactId, - 'from' => $receiptFrom, - 'toName' => $this->_contributorDisplayName, - 'toEmail' => $this->_contributorEmail, - 'isTest' => $this->_mode == 'test', - ] - ); } + + list($this->isMailSent) = CRM_Core_BAO_MessageTemplate::sendTemplate( + [ + 'groupName' => 'msg_tpl_workflow_membership', + 'valueName' => 'membership_offline_receipt', + 'contactId' => $this->_receiptContactId, + 'from' => $receiptFrom, + 'toName' => $this->_contributorDisplayName, + 'toEmail' => $this->_contributorEmail, + 'isTest' => $this->_mode == 'test', + ] + ); } } diff --git a/civicrm/CRM/Member/Form/Search.php b/civicrm/CRM/Member/Form/Search.php index 8eba67bfa9..3d7afe8ffc 100644 --- a/civicrm/CRM/Member/Form/Search.php +++ b/civicrm/CRM/Member/Form/Search.php @@ -95,6 +95,8 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { } if ($this->_force) { + $this->addSearchFieldMetadata(['Membership' => CRM_Member_BAO_Query::getSearchFieldMetadata()]); + $this->addFormFieldsFromMetadata(); $this->postProcess(); $this->set('force', 0); } @@ -227,8 +229,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { } $this->_done = TRUE; - - $this->_formValues = $this->controller->exportValues($this->_name); + $this->setFormValues(); $this->fixFormValues(); @@ -292,17 +293,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $controller->run(); } - /** - * Set default values. - * - * @todo - can this function override be removed? - * - * @return array - */ - public function setDefaultValues() { - return $this->_defaults; - } - /** * If this search has been forced then see if there are any get values, and if so over-ride the post values. * diff --git a/civicrm/CRM/Member/Form/Task/Batch.php b/civicrm/CRM/Member/Form/Task/Batch.php index 99d6af35a4..35cc5a6b09 100644 --- a/civicrm/CRM/Member/Form/Task/Batch.php +++ b/civicrm/CRM/Member/Form/Task/Batch.php @@ -212,7 +212,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test // handling of custom data, specifically checkbox fields. $dates = [ - 'join_date', + 'membership_join_date', 'membership_start_date', 'membership_end_date', ]; diff --git a/civicrm/CRM/Member/Import/Parser/Membership.php b/civicrm/CRM/Member/Import/Parser/Membership.php index 2cea95d33e..224261207b 100644 --- a/civicrm/CRM/Member/Import/Parser/Membership.php +++ b/civicrm/CRM/Member/Import/Parser/Membership.php @@ -29,13 +29,8 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 - * $Id$ - * */ - -require_once 'api/api.php'; - /** * class to parse membership csv files */ @@ -43,8 +38,6 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { protected $_mapperKeys; - private $_contactIdIndex; - private $_totalAmountIndex; private $_membershipTypeIndex; private $_membershipStatusIndex; @@ -93,16 +86,12 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $this->setActiveFields($this->_mapperKeys); // FIXME: we should do this in one place together with Form/MapField.php - $this->_contactIdIndex = -1; $this->_membershipTypeIndex = -1; $this->_membershipStatusIndex = -1; $index = 0; foreach ($this->_mapperKeys as $key) { switch ($key) { - case 'membership_contact_id': - $this->_contactIdIndex = $index; - break; case 'membership_type_id': $this->_membershipTypeIndex = $index; @@ -335,7 +324,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $params[$key] = $this->parsePseudoConstantField($val, $this->fieldMetadata[$key]); break; - case 'is_override': + case 'member_is_override': $params[$key] = CRM_Utils_String::strtobool($val); break; } @@ -374,7 +363,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { else { //fix for CRM-2219 Update Membership // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE - if (!empty($formatted['is_override']) && empty($formatted['status_id'])) { + if (!empty($formatted['member_is_override']) && empty($formatted['status_id'])) { array_unshift($values, 'Required parameter missing: Status'); return CRM_Import_Parser::ERROR; } @@ -425,7 +414,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $formatted), '%Y-%m-%d'); $joinDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $formatted), '%Y-%m-%d'); - if ($this->_contactIdIndex < 0) { + if (!$this->isContactIDColumnPresent()) { $error = $this->checkContactDuplicate($formatValues); if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) { @@ -449,7 +438,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (empty($formatted['is_override'])) { + if (empty($formatted['member_is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -464,7 +453,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if (empty($formatted['status_id'])) { $formatted['status_id'] = $calcStatus['id']; } - elseif (empty($formatted['is_override'])) { + elseif (empty($formatted['member_is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . $formatValues['status_id'] . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -539,7 +528,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (empty($formatted['is_override'])) { + if (empty($formatted['member_is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -553,7 +542,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if (empty($formatted['status_id'])) { $formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus); } - elseif (empty($formatted['is_override'])) { + elseif (empty($formatted['member_is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . CRM_Utils_Array::value('status_id', $formatValues) . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -749,4 +738,13 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { return NULL; } + /** + * Is the contact ID mapped. + * + * @return bool + */ + protected function isContactIDColumnPresent(): bool { + return in_array('membership_contact_id', $this->_mapperKeys, TRUE); + } + } diff --git a/civicrm/CRM/Member/Selector/Search.php b/civicrm/CRM/Member/Selector/Search.php index 7c94dafc07..0189535ece 100644 --- a/civicrm/CRM/Member/Selector/Search.php +++ b/civicrm/CRM/Member/Selector/Search.php @@ -62,7 +62,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C 'contact_type', 'sort_name', 'membership_type', - 'join_date', + 'membership_join_date', 'membership_start_date', 'membership_end_date', 'membership_source', @@ -493,7 +493,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C ], [ 'name' => ts('Member Since'), - 'sort' => 'join_date', + 'sort' => 'membership_join_date', 'direction' => CRM_Utils_Sort::DESCENDING, ], [ diff --git a/civicrm/CRM/Member/Tokens.php b/civicrm/CRM/Member/Tokens.php index 44100317ac..455ba74ffa 100644 --- a/civicrm/CRM/Member/Tokens.php +++ b/civicrm/CRM/Member/Tokens.php @@ -94,6 +94,9 @@ class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber { if (in_array($field, ['start_date', 'end_date', 'join_date'])) { $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field)); } + elseif ($field == 'fee') { + $row->tokens($entity, $field, \CRM_Utils_Money::format($actionSearchResult->$field, NULL, NULL, TRUE)); + } elseif (isset($actionSearchResult->$field)) { $row->tokens($entity, $field, $actionSearchResult->$field); } diff --git a/civicrm/CRM/Pledge/BAO/Pledge.php b/civicrm/CRM/Pledge/BAO/Pledge.php index 4e24c3e4e0..0026d4a9ff 100644 --- a/civicrm/CRM/Pledge/BAO/Pledge.php +++ b/civicrm/CRM/Pledge/BAO/Pledge.php @@ -1200,7 +1200,7 @@ SELECT pledge.contact_id as contact_id, public static function getPledgeStartDate($date, $pledgeBlock) { $startDate = (array) json_decode($pledgeBlock['pledge_start_date']); foreach ($startDate as $field => $value) { - if (!empty($date) && !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) { + if (!empty($date) && empty($pledgeBlock['is_pledge_start_date_editable'])) { return $date; } if (empty($date)) { diff --git a/civicrm/CRM/Pledge/BAO/PledgeBlock.php b/civicrm/CRM/Pledge/BAO/PledgeBlock.php index 732a61a450..9d63fd5db4 100644 --- a/civicrm/CRM/Pledge/BAO/PledgeBlock.php +++ b/civicrm/CRM/Pledge/BAO/PledgeBlock.php @@ -301,8 +301,8 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { } $form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits, ['aria-label' => ts('Frequency Units')]); // CRM-18854 - if (CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)) { - if (CRM_Utils_Array::value('pledge_start_date', $pledgeBlock)) { + if (!empty($pledgeBlock['is_pledge_start_date_visible'])) { + if (!empty($pledgeBlock['pledge_start_date'])) { $defaults = array(); $date = (array) json_decode($pledgeBlock['pledge_start_date']); foreach ($date as $field => $value) { @@ -335,7 +335,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $form->setDefaults($defaults); $form->assign('start_date_display', $paymentDate); $form->assign('start_date_editable', FALSE); - if (CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) { + if (!empty($pledgeBlock['is_pledge_start_date_editable'])) { $form->assign('start_date_editable', TRUE); if ($field == 'calendar_month') { $form->assign('is_date', FALSE); diff --git a/civicrm/CRM/Pledge/BAO/Query.php b/civicrm/CRM/Pledge/BAO/Query.php index 1b3779060e..1859eb7e06 100644 --- a/civicrm/CRM/Pledge/BAO/Query.php +++ b/civicrm/CRM/Pledge/BAO/Query.php @@ -82,6 +82,12 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } + if (!empty($query->_returnProperties['pledge_end_date'])) { + $query->_select['pledge_end_date'] = 'civicrm_pledge.end_date as pledge_end_date'; + $query->_element['pledge_end_date'] = 1; + $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; + } + if (!empty($query->_returnProperties['pledge_start_date'])) { $query->_select['pledge_start_date'] = 'civicrm_pledge.start_date as pledge_start_date'; $query->_element['pledge_start_date'] = 1; @@ -239,43 +245,24 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { } /** - * @param $values - * @param $query + * Get where clause for field. + * + * @todo most of this could be replaced by using metadata. + * + * @param array $values + * @param \CRM_Contact_BAO_Query $query + * + * @throws \CRM_Core_Exception */ public static function whereClauseSingle(&$values, &$query) { + if ($query->buildDateRangeQuery($values)) { + // @todo - move this to Contact_Query in or near the call to + // $this->buildRelativeDateQuery($values); + return; + } list($name, $op, $value, $grouping, $wildcard) = $values; switch ($name) { - case 'pledge_create_date_low': - case 'pledge_create_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_create_date', 'create_date', 'Pledge Made' - ); - case 'pledge_start_date_low': - case 'pledge_start_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_start_date', 'start_date', 'Pledge Start Date' - ); - return; - - case 'pledge_end_date_low': - case 'pledge_end_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_end_date', 'end_date', 'Pledge End Date' - ); - return; - - case 'pledge_payment_date_low': - case 'pledge_payment_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge_payment', 'pledge_payment_date', 'scheduled_date', 'Payment Scheduled' - ); - return; - case 'pledge_amount': case 'pledge_amount_low': case 'pledge_amount_high': @@ -531,11 +518,27 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { public static function getSearchFieldMetadata() { $fields = [ 'pledge_status_id', + 'pledge_start_date', + 'pledge_end_date', + 'pledge_create_date', ]; $metadata = civicrm_api3('Pledge', 'getfields', [])['values']; return array_intersect_key($metadata, array_flip($fields)); } + /** + * Get the metadata for fields to be included on the grant search form. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getPledgePaymentSearchFieldMetadata() { + $fields = [ + 'pledge_payment_scheduled_date', + ]; + $metadata = civicrm_api3('PledgePayment', 'getfields', [])['values']; + return array_intersect_key($metadata, array_flip($fields)); + } + /** * Build the search for for pledges. * @@ -547,13 +550,8 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { public static function buildSearchForm(&$form) { // pledge related dates $form->addSearchFieldMetadata(['Pledge' => self::getSearchFieldMetadata()]); + $form->addSearchFieldMetadata(['PledgePayment' => self::getPledgePaymentSearchFieldMetadata()]); $form->addFormFieldsFromMetadata(); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_end_date', 1, '_low', '_high', ts('From'), FALSE); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_create_date', 1, '_low', '_high', ts('From'), FALSE); - - // pledge payment related dates - CRM_Core_Form_Date::buildDateRange($form, 'pledge_payment_date', 1, '_low', '_high', ts('From'), FALSE); $form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE); $form->add('text', 'pledge_amount_low', ts('From'), ['size' => 8, 'maxlength' => 8]); diff --git a/civicrm/CRM/Pledge/DAO/Pledge.php b/civicrm/CRM/Pledge/DAO/Pledge.php index fe6abc9014..76d0e11dd2 100644 --- a/civicrm/CRM/Pledge/DAO/Pledge.php +++ b/civicrm/CRM/Pledge/DAO/Pledge.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Pledge/Pledge.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5e5bb725caa46ae10f0c5d039a03c675) + * (GenCodeChecksum:a25cc68d8392b1d60d7179ca484b604a) */ /** @@ -420,17 +420,19 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { 'type' => 'Text', ], ], - 'start_date' => [ + 'pledge_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'title' => ts('Pledge Start Date'), 'description' => ts('The date the first scheduled pledge occurs.'), 'required' => TRUE, 'where' => 'civicrm_pledge.start_date', + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, + 'unique_title' => ts('Payments Start Date'), 'html' => [ 'type' => 'Select Date', ], @@ -491,16 +493,18 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { 'type' => 'Select Date', ], ], - 'end_date' => [ + 'pledge_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'title' => ts('Pledge End Date'), 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'), 'where' => 'civicrm_pledge.end_date', + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, + 'unique_title' => ts('Payments Ended Date'), 'html' => [ 'type' => 'Select Date', ], diff --git a/civicrm/CRM/Pledge/DAO/PledgePayment.php b/civicrm/CRM/Pledge/DAO/PledgePayment.php index 5e1da56ae5..879a6fa973 100644 --- a/civicrm/CRM/Pledge/DAO/PledgePayment.php +++ b/civicrm/CRM/Pledge/DAO/PledgePayment.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Pledge/PledgePayment.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7dfb4f8000b79fa8b1abab1de3712fc1) + * (GenCodeChecksum:563e2926d00b9fe0c4919bfd9a0a05e7) */ /** @@ -236,6 +236,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO { 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, + 'unique_title' => ts('Payment Scheduled'), 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDate', diff --git a/civicrm/CRM/Pledge/Form/Search.php b/civicrm/CRM/Pledge/Form/Search.php index ecf8f503e4..1f735e48af 100644 --- a/civicrm/CRM/Pledge/Form/Search.php +++ b/civicrm/CRM/Pledge/Form/Search.php @@ -98,6 +98,10 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { } if ($this->_force) { + // pledge related dates + $this->addSearchFieldMetadata(['Pledge' => CRM_Pledge_BAO_Query::getSearchFieldMetadata()]); + $this->addSearchFieldMetadata(['PledgePayment' => CRM_Pledge_BAO_Query::getPledgePaymentSearchFieldMetadata()]); + $this->addFormFieldsFromMetadata(); $this->postProcess(); $this->set('force', 0); } @@ -230,7 +234,7 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { $this->_done = TRUE; - $this->_formValues = $this->controller->exportValues($this->_name); + $this->setFormValues(); $this->fixFormValues(); @@ -321,19 +325,6 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { $this->addFormRule(['CRM_Pledge_Form_Search', 'formRule']); } - /** - * Set the default form values. - * - * - * @return array - * the default array reference - */ - public function setDefaultValues() { - $defaults = []; - $defaults = $this->_formValues; - return $defaults; - } - public function fixFormValues() { if (!$this->_force) { return; diff --git a/civicrm/CRM/Price/BAO/LineItem.php b/civicrm/CRM/Price/BAO/LineItem.php index a64651d670..0c88ab14d9 100644 --- a/civicrm/CRM/Price/BAO/LineItem.php +++ b/civicrm/CRM/Price/BAO/LineItem.php @@ -70,7 +70,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { $params['unit_price'] = 0; } } - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { if (empty($params['financial_type_id'])) { throw new Exception('Mandatory key(s) missing from params array: financial_type_id'); } @@ -769,21 +769,18 @@ WHERE li.contribution_id = %1"; ]); unset($updateFinancialItemInfoValues['financialTrxn']); } - elseif (!empty($updateFinancialItemInfoValues['link-financial-trxn']) && $newFinancialItem->amount != 0) { + elseif ($trxn && $newFinancialItem->amount != 0) { civicrm_api3('EntityFinancialTrxn', 'create', [ 'entity_id' => $newFinancialItem->id, 'entity_table' => 'civicrm_financial_item', 'financial_trxn_id' => $trxn->id, 'amount' => $newFinancialItem->amount, ]); - unset($updateFinancialItemInfoValues['link-financial-trxn']); } } } - // @todo - it may be that trxn_id is always empty - flush out scenarios. Add tests. - $trxnId = !empty($trxn->id) ? ['id' => $trxn->id] : []; - $lineItemObj->addFinancialItemsOnLineItemsChange(array_merge($requiredChanges['line_items_to_add'], $requiredChanges['line_items_to_resurrect']), $entityID, $entityTable, $contributionId, $trxnId); + $lineItemObj->addFinancialItemsOnLineItemsChange(array_merge($requiredChanges['line_items_to_add'], $requiredChanges['line_items_to_resurrect']), $entityID, $entityTable, $contributionId, $trxn->id ?? NULL); // update participant fee_amount column $lineItemObj->updateEntityRecordOnChangeFeeSelection($params, $entityID, $entity); @@ -842,8 +839,6 @@ WHERE li.contribution_id = %1"; if ($amountChangeOnTextLineItem !== (float) 0) { // calculate the amount difference, considered as financial item amount $updateFinancialItemInfoValues['amount'] = $amountChangeOnTextLineItem; - // add a flag, later used to link financial trxn and this new financial item - $updateFinancialItemInfoValues['link-financial-trxn'] = TRUE; if ($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']) { $updateFinancialItemInfoValues['tax']['amount'] = $lineItemsToUpdate[$updateFinancialItemInfoValues['entity_id']]['tax_amount'] - $previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']; $updateFinancialItemInfoValues['tax']['description'] = $this->getSalesTaxTerm(); @@ -1033,13 +1028,14 @@ WHERE li.contribution_id = %1"; * @param int $entityID * @param string $entityTable * @param int $contributionID - * @param bool $isCreateAdditionalFinancialTrxn + * @param bool $trxnID * Is there a change to the total balance requiring additional transactions to be created. */ - protected function addFinancialItemsOnLineItemsChange($lineItemsToAdd, $entityID, $entityTable, $contributionID, $isCreateAdditionalFinancialTrxn) { + protected function addFinancialItemsOnLineItemsChange($lineItemsToAdd, $entityID, $entityTable, $contributionID, $trxnID) { $updatedContribution = new CRM_Contribute_BAO_Contribution(); $updatedContribution->id = $contributionID; $updatedContribution->find(TRUE); + $trxnArray = $trxnID ? ['id' => $trxnID] : NULL; foreach ($lineItemsToAdd as $priceFieldValueID => $lineParams) { $lineParams = array_merge($lineParams, [ @@ -1047,7 +1043,14 @@ WHERE li.contribution_id = %1"; 'entity_id' => $entityID, 'contribution_id' => $contributionID, ]); - $this->addFinancialItemsOnLineItemChange($isCreateAdditionalFinancialTrxn, $lineParams, $updatedContribution); + $financialTypeChangeTrxnID = $this->addFinancialItemsOnLineItemChange($trxnID, $lineParams, $updatedContribution); + $lineObj = CRM_Price_BAO_LineItem::retrieve($lineParams); + // insert financial items + // ensure entity_financial_trxn table has a linking of it. + CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, NULL, $trxnArray); + if (isset($lineObj->tax_amount)) { + CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, TRUE, $trxnArray); + } } } @@ -1253,15 +1256,13 @@ WHERE li.contribution_id = %1"; $tempFinancialTrxnID = NULL; // don't add financial item for cancelled line item if ($lineParams['qty'] == 0) { - return; + return NULL; } elseif ($isCreateAdditionalFinancialTrxn) { // This routine & the return below is super uncomfortable. - // I have refactored to here but don't understand how this would be hit - // and it is how it would be a good thing, given the odd return below which - // does not seem consistent with what is going on. - // I'm tempted to add an e-deprecated into it to confirm my suspicion it only exists to - // cause mental anguish. + // I have refactored to here and it is hit from + // testSubmitUnpaidPriceChangeWhileStillPending + // but I'm still skeptical it's not covered elsewhere. // original comment : add financial item if ONLY financial type is changed if ($lineParams['financial_type_id'] != $updatedContribution->financial_type_id) { $changedFinancialTypeID = (int) $lineParams['financial_type_id']; @@ -1279,16 +1280,9 @@ WHERE li.contribution_id = %1"; 'currency' => $updatedContribution->currency, ]; $adjustedTrxn = CRM_Core_BAO_FinancialTrxn::create($adjustedTrxnValues); - $tempFinancialTrxnID = ['id' => $adjustedTrxn->id]; + return $adjustedTrxn->id; } } - $lineObj = CRM_Price_BAO_LineItem::retrieve($lineParams); - // insert financial items - // ensure entity_financial_trxn table has a linking of it. - CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, NULL, $tempFinancialTrxnID); - if (isset($lineObj->tax_amount)) { - CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, TRUE, $tempFinancialTrxnID); - } } /** diff --git a/civicrm/CRM/Price/BAO/PriceField.php b/civicrm/CRM/Price/BAO/PriceField.php index 67bcd99b65..1020c6009a 100644 --- a/civicrm/CRM/Price/BAO/PriceField.php +++ b/civicrm/CRM/Price/BAO/PriceField.php @@ -61,6 +61,9 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { * @return CRM_Price_BAO_PriceField */ public static function add(&$params) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceField', CRM_Utils_Array::value('id', $params), $params); + $priceFieldBAO = new CRM_Price_BAO_PriceField(); $priceFieldBAO->copyValues($params); @@ -70,6 +73,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } $priceFieldBAO->save(); + CRM_Utils_Hook::post($hook, 'PriceField', $priceFieldBAO->id, $priceFieldBAO); return $priceFieldBAO; } @@ -112,6 +116,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { ]); foreach ($fieldOptions['values'] as $option) { $optionsIds['id'] = $option['id']; + $params['option_id'] = [1 => $option['id']]; // CRM-19741 If we are dealing with price fields that are Text only set the field value label to match if (!empty($params['id']) && $priceField->label != $option['label']) { $fieldValue = new CRM_Price_DAO_PriceFieldValue(); @@ -173,10 +178,10 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } if ($opIds = CRM_Utils_Array::value('option_id', $params)) { if ($opId = CRM_Utils_Array::value($index, $opIds)) { - $optionsIds['id'] = $opId; + $options['id'] = $opId; } else { - $optionsIds['id'] = NULL; + $options['id'] = NULL; } } try { diff --git a/civicrm/CRM/Price/BAO/PriceFieldValue.php b/civicrm/CRM/Price/BAO/PriceFieldValue.php index dd590ca82f..57a78fc071 100644 --- a/civicrm/CRM/Price/BAO/PriceFieldValue.php +++ b/civicrm/CRM/Price/BAO/PriceFieldValue.php @@ -48,19 +48,17 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { * @return CRM_Price_DAO_PriceFieldValue */ public static function add(&$params, $ids = []) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceFieldValue', CRM_Utils_Array::value('id', $params), $params); $fieldValueBAO = new CRM_Price_BAO_PriceFieldValue(); $fieldValueBAO->copyValues($params); - if ($id = CRM_Utils_Array::value('id', $ids)) { - $fieldValueBAO->id = $id; - $prevLabel = self::getOptionLabel($id); - if (!empty($params['label']) && $prevLabel != $params['label']) { - self::updateAmountAndFeeLevel($id, $prevLabel, $params['label']); - } - } // CRM-16189 $priceFieldID = CRM_Utils_Array::value('price_field_id', $params); + + $id = CRM_Utils_Array::value('id', $ids, CRM_Utils_Array::value('id', $params)); + if (!$priceFieldID) { $priceFieldID = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceFieldValue', $id, 'price_field_id'); } @@ -71,6 +69,8 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { } $fieldValueBAO->save(); + CRM_Utils_Hook::post($hook, 'PriceFieldValue', $fieldValueBAO->id, $fieldValueBAO); + // Reset the cached values in this function. CRM_Price_BAO_PriceField::getOptions(CRM_Utils_Array::value('price_field_id', $params), FALSE, TRUE); return $fieldValueBAO; @@ -312,39 +312,4 @@ WHERE cpse.id IS NOT NULL {$where}"; CRM_Core_DAO::executeQuery($sql, $params); } - /** - * Update price option label in line_item, civicrm_contribution and civicrm_participant. - * - * @param int $id - id of the price_field_value - * @param string $prevLabel - * @param string $newLabel - * - */ - public static function updateAmountAndFeeLevel($id, $prevLabel, $newLabel) { - // update price field label in line item. - $lineItem = new CRM_Price_DAO_LineItem(); - $lineItem->price_field_value_id = $id; - $lineItem->label = $prevLabel; - $lineItem->find(); - while ($lineItem->fetch()) { - $lineItemParams['id'] = $lineItem->id; - $lineItemParams['label'] = $newLabel; - CRM_Price_BAO_LineItem::create($lineItemParams); - - // update amount and fee level in civicrm_contribution and civicrm_participant - $params = [ - 1 => [CRM_Core_DAO::VALUE_SEPARATOR . $prevLabel . ' -', 'String'], - 2 => [CRM_Core_DAO::VALUE_SEPARATOR . $newLabel . ' -', 'String'], - ]; - // Update contribution - if (!empty($lineItem->contribution_id)) { - CRM_Core_DAO::executeQuery("UPDATE `civicrm_contribution` SET `amount_level` = REPLACE(amount_level, %1, %2) WHERE id = {$lineItem->contribution_id}", $params); - } - // Update participant - if ($lineItem->entity_table == 'civicrm_participant') { - CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$lineItem->entity_id}", $params); - } - } - } - } diff --git a/civicrm/CRM/Price/BAO/PriceSet.php b/civicrm/CRM/Price/BAO/PriceSet.php index c5b7caaad6..c7d9ebe707 100644 --- a/civicrm/CRM/Price/BAO/PriceSet.php +++ b/civicrm/CRM/Price/BAO/PriceSet.php @@ -60,6 +60,9 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet { * @return CRM_Price_DAO_PriceSet */ public static function create(&$params) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceSet', CRM_Utils_Array::value('id', $params), $params); + if (empty($params['id']) && empty($params['name'])) { $params['name'] = CRM_Utils_String::munge($params['title'], '_', 242); } @@ -81,7 +84,10 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet { if (self::eventPriceSetDomainID()) { $priceSetBAO->domain_id = CRM_Core_Config::domainID(); } - return $priceSetBAO->save(); + $priceSetBAO->save(); + + CRM_Utils_Hook::post($hook, 'PriceSet', $priceSetBAO->id, $priceSetBAO); + return $priceSetBAO; } /** @@ -727,7 +733,7 @@ WHERE id = %1"; $field['options'][$optionValueId]['tax_amount'] = round($taxAmount['tax_amount'], 2); } } - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); } $totalPrice += $lineItem[$firstOption['id']]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[key($field['options'])]); @@ -742,7 +748,7 @@ WHERE id = %1"; $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]); CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override); - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); if ($amount_override) { $lineItem[$optionValueId]['line_total'] = $lineItem[$optionValueId]['unit_price'] = CRM_Utils_Rule::cleanMoney($lineItem[$optionValueId]['line_total'] - $lineItem[$optionValueId]['tax_amount']); @@ -765,7 +771,7 @@ WHERE id = %1"; $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]); CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); } $totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]); @@ -782,7 +788,7 @@ WHERE id = %1"; CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); foreach ($params["price_{$id}"] as $optionId => $option) { - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionId])) { + if (!empty($field['options'][$optionId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax); } $totalPrice += $lineItem[$optionId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionId]); @@ -1008,19 +1014,9 @@ WHERE id = %1"; else { $feeBlock = &$form->_priceSet['fields']; } - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { - foreach ($feeBlock as $key => $value) { - foreach ($value['options'] as $k => $options) { - if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($options['financial_type_id']))) { - unset($feeBlock[$key]['options'][$k]); - } - } - if (empty($feeBlock[$key]['options'])) { - unset($feeBlock[$key]); - } - } - } - // call the hook. + + self::applyACLFinancialTypeStatusToFeeBlock($feeBlock); + // Call the buildAmount hook. CRM_Utils_Hook::buildAmount($component, $form, $feeBlock); // CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions @@ -1074,6 +1070,29 @@ WHERE id = %1"; } } + /** + * Apply ACLs on Financial Type to the price options in a fee block. + * + * @param array $feeBlock + * Fee block: array of price fields. + * + * @return void + */ + public static function applyACLFinancialTypeStatusToFeeBlock(&$feeBlock) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { + foreach ($feeBlock as $key => $value) { + foreach ($value['options'] as $k => $options) { + if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($options['financial_type_id']))) { + unset($feeBlock[$key]['options'][$k]); + } + } + if (empty($feeBlock[$key]['options'])) { + unset($feeBlock[$key]); + } + } + } + } + /** * Check the current Membership having end date null. * diff --git a/civicrm/CRM/Price/Form/Field.php b/civicrm/CRM/Price/Form/Field.php index dc237c1fa7..08ff9e40af 100644 --- a/civicrm/CRM/Price/Form/Field.php +++ b/civicrm/CRM/Price/Form/Field.php @@ -422,7 +422,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { } if ((is_numeric(CRM_Utils_Array::value('count', $fields)) && - CRM_Utils_Array::value('count', $fields) == 0 + empty($fields['count']) ) && (CRM_Utils_Array::value('html_type', $fields) == 'Text') ) { diff --git a/civicrm/CRM/Price/Form/Option.php b/civicrm/CRM/Price/Form/Option.php index 1ad15e8ddc..3e52ab48c9 100644 --- a/civicrm/CRM/Price/Form/Option.php +++ b/civicrm/CRM/Price/Form/Option.php @@ -357,7 +357,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { $params['visibility_id'] = CRM_Utils_Array::value('visibility_id', $params, FALSE); $ids = []; if ($this->_oid) { - $ids['id'] = $this->_oid; + $params['id'] = $this->_oid; } $optionValue = CRM_Price_BAO_PriceFieldValue::create($params, $ids); diff --git a/civicrm/CRM/Report/Form.php b/civicrm/CRM/Report/Form.php index 8090032de0..77495fdcba 100644 --- a/civicrm/CRM/Report/Form.php +++ b/civicrm/CRM/Report/Form.php @@ -155,9 +155,6 @@ class CRM_Report_Form extends CRM_Core_Form { */ protected $_groupFilter = FALSE; - // [ML] Required for civiexportexcel - public $supportsExportExcel = TRUE; - /** * Has the report been optimised for group filtering. * @@ -2845,11 +2842,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->_absoluteUrl = TRUE; $this->addPaging = FALSE; } - elseif ($this->_outputMode == 'excel2007') { - $printOnly = TRUE; - $this->_absoluteUrl = TRUE; - $this->addPaging = FALSE; - } elseif ($this->_outputMode == 'group') { $this->assign('outputMode', 'group'); } @@ -3502,9 +3494,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND elseif ($this->_outputMode == 'csv') { CRM_Report_Utils_Report::export2csv($this, $rows); } - elseif ($this->_outputMode == 'excel2007') { - CRM_CiviExportExcel_Utils_Report::export2excel2007($this, $rows); - } elseif ($this->_outputMode == 'group') { $group = $this->_params['groups']; $this->add2group($group); diff --git a/civicrm/CRM/Report/Form/Contact/LoggingSummary.php b/civicrm/CRM/Report/Form/Contact/LoggingSummary.php index 97ebefc94b..4c98b4eb64 100644 --- a/civicrm/CRM/Report/Form/Contact/LoggingSummary.php +++ b/civicrm/CRM/Report/Form/Contact/LoggingSummary.php @@ -271,7 +271,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $date = CRM_Utils_Date::isoToMysql($row['log_civicrm_entity_log_date']); - if ('Update' == CRM_Utils_Array::value('log_civicrm_entity_log_action', $row)) { + if (in_array(CRM_Utils_Array::value('log_civicrm_entity_log_action', $row), ['Update', 'Delete'])) { $row = $this->addDetailReportLinksToRow($baseQueryCriteria, $row); } diff --git a/civicrm/CRM/Report/Form/Contribute/Detail.php b/civicrm/CRM/Report/Form/Contribute/Detail.php index a4c6e0d31f..bea5471f54 100644 --- a/civicrm/CRM/Report/Form/Contribute/Detail.php +++ b/civicrm/CRM/Report/Form/Contribute/Detail.php @@ -380,7 +380,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { $contributionOrSoftVal = $this->getElementValue('contribution_or_soft_value'); if ($contributionOrSoftVal[0] == 'contributions_only') { $groupBySoft = $this->getElementValue('group_bys'); - if (CRM_Utils_Array::value('soft_credit_id', $groupBySoft)) { + if (!empty($groupBySoft['soft_credit_id'])) { $this->setElementError('group_bys', ts('You cannot group by soft credit when displaying contributions only. Please uncheck "Soft Credit" in the Grouping tab.')); } } diff --git a/civicrm/CRM/Report/Form/Event/Summary.php b/civicrm/CRM/Report/Form/Event/Summary.php index ec4d864bb1..bfbc8e5a91 100644 --- a/civicrm/CRM/Report/Form/Event/Summary.php +++ b/civicrm/CRM/Report/Form/Event/Summary.php @@ -349,7 +349,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form { $rows[$key]['civicrm_event_id'] . ") "; } - if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) { + if (empty($rows[$key]['totalAmount'])) { $countEvent = count($rows); } diff --git a/civicrm/CRM/Report/Form/Member/ContributionDetail.php b/civicrm/CRM/Report/Form/Member/ContributionDetail.php index 3b92f9b633..a1c5d33850 100644 --- a/civicrm/CRM/Report/Form/Member/ContributionDetail.php +++ b/civicrm/CRM/Report/Form/Member/ContributionDetail.php @@ -311,7 +311,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { 'source' => ['title' => ts('Membership Source')], ], 'filters' => [ - 'join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], + 'membership_join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ diff --git a/civicrm/CRM/Report/Form/Member/Detail.php b/civicrm/CRM/Report/Form/Member/Detail.php index cdb100c8f2..92cd8f40e9 100644 --- a/civicrm/CRM/Report/Form/Member/Detail.php +++ b/civicrm/CRM/Report/Form/Member/Detail.php @@ -115,7 +115,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { 'source' => ['title' => ts('Source')], ], 'filters' => [ - 'join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], + 'membership_join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ diff --git a/civicrm/CRM/Report/Form/Member/Summary.php b/civicrm/CRM/Report/Form/Member/Summary.php index e4fb27ac9b..ab7dcab267 100644 --- a/civicrm/CRM/Report/Form/Member/Summary.php +++ b/civicrm/CRM/Report/Form/Member/Summary.php @@ -73,7 +73,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { ], ], 'filters' => [ - 'join_date' => [ + 'membership_join_date' => [ 'title' => ts('Member Since'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, @@ -595,7 +595,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency implode(",", $this->_params['status_id_value']); } $url = CRM_Report_Utils_Report::getNextUrl('member/detail', - "reset=1&force=1&join_date_from={$dateStart}&join_date_to={$dateEnd}{$typeUrl}{$statusUrl}", + "reset=1&force=1&membership_join_date_from={$dateStart}&membership_join_date_to={$dateEnd}{$typeUrl}{$statusUrl}", $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); $row['civicrm_membership_join_date_start'] = CRM_Utils_Date::format($row['civicrm_membership_join_date_start']); diff --git a/civicrm/CRM/Report/Form/Membership/Summary.php b/civicrm/CRM/Report/Form/Membership/Summary.php index 1a25d45603..9ab478c084 100644 --- a/civicrm/CRM/Report/Form/Membership/Summary.php +++ b/civicrm/CRM/Report/Form/Membership/Summary.php @@ -100,7 +100,7 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form { 'membership_type_id' => ['title' => ts('Membership Type')], ], 'filters' => [ - 'join_date' => ['type' => CRM_Utils_Type::T_DATE], + 'membership_join_date' => ['type' => CRM_Utils_Type::T_DATE], ], ], 'civicrm_address' => [ diff --git a/civicrm/CRM/Report/Page/InstanceList.php b/civicrm/CRM/Report/Page/InstanceList.php index 8e8b17cbdd..b7aa9fab33 100644 --- a/civicrm/CRM/Report/Page/InstanceList.php +++ b/civicrm/CRM/Report/Page/InstanceList.php @@ -282,6 +282,11 @@ class CRM_Report_Page_InstanceList extends CRM_Core_Page { 'confirm_message' => ts('Are you sure you want delete this report? This action cannot be undone.'), ]; } + CRM_Utils_Hook::links('view.report.links', + $className, + $instanceID, + $actions + ); return $actions; } diff --git a/civicrm/CRM/Upgrade/Incremental/SmartGroups.php b/civicrm/CRM/Upgrade/Incremental/SmartGroups.php index feb9c6438a..2ff9287b82 100644 --- a/civicrm/CRM/Upgrade/Incremental/SmartGroups.php +++ b/civicrm/CRM/Upgrade/Incremental/SmartGroups.php @@ -56,20 +56,26 @@ class CRM_Upgrade_Incremental_SmartGroups { */ public function datePickerConversion($fields) { $fieldPossibilities = $relativeFieldNames = []; - foreach ($fields as $field) { - $fieldPossibilities[] = $field; - $fieldPossibilities[] = $field . '_high'; - $fieldPossibilities[] = $field . '_low'; - } $relativeDateMappings = [ 'activity_date_time' => 'activity', 'participant_register_date' => 'participant', 'receive_date' => 'contribution', 'contribution_cancel_date' => 'contribution_cancel', + 'membership_join_date' => 'member_join', + 'membership_start_date' => 'member_start', + 'membership_end_date' => 'member_end', + 'pledge_payment_scheduled_date' => 'pledge_payment', + 'pledge_create_date' => 'pledge_create', + 'pledge_end_date' => 'pledge_end', + 'pledge_start_date' => 'pledge_start', ]; foreach ($fields as $field) { foreach ($this->getSearchesWithField($field) as $savedSearch) { + // Only populate field possibilities as we go to convert each field + $fieldPossibilities[] = $field; + $fieldPossibilities[] = $field . '_high'; + $fieldPossibilities[] = $field . '_low'; $formValues = $savedSearch['form_values']; $isRelative = $hasRelative = FALSE; $relativeFieldName = $field . '_relative'; diff --git a/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php b/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php new file mode 100644 index 0000000000..5fb3adce2c --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php @@ -0,0 +1,177 @@ +<?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 FiveEighteen */ +class CRM_Upgrade_Incremental_php_FiveEighteen 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_18_alpha1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); + $this->addTask('Update smart groups to reflect change of unique name for is_override', 'updateSmartGroups', [ + 'renameField' => [ + ['old' => 'is_override', 'new' => 'member_is_override'], + ], + ]); + $this->addTask('Remove Foreign Key from civicrm_dashboard on domain_id if exists', 'removeDomainIDFK'); + $this->addTask('Remove Index on domain_id that might have been randomly added in the same format as FK', 'dropIndex', 'civicrm_dashboard', 'FK_civicrm_dashboard_domain_id'); + $this->addTask('Re-Create Foreign key between civicrm_dashboard and civicrm_domain correctly', 'recreateDashboardFK'); + $this->addTask('Update smart groups to rename filters on pledge_payment_date to pledge_payment_scheduled_date', 'updateSmartGroups', [ + 'renameField' => [ + ['old' => 'pledge_payment_date_relative', 'new' => 'pledge_payment_scheduled_date_relative'], + ['old' => 'pledge_payment_date_high', 'new' => 'pledge_payment_scheduled_date_high'], + ['old' => 'pledge_payment_date_low', 'new' => 'pledge_payment_scheduled_date_low'], + ['old' => 'member_join_date_relative', 'new' => 'membership_join_date_relative'], + ['old' => 'member_join_date_high', 'new' => 'membership_join_date_high'], + ['old' => 'member_join_date_low', 'new' => 'membership_join_date_low'], + ['old' => 'member_start_date_relative', 'new' => 'membership_start_date_relative'], + ['old' => 'member_start_date_high', 'new' => 'membership_start_date_high'], + ['old' => 'member_start_date_low', 'new' => 'membership_start_date_low'], + ['old' => 'member_end_date_relative', 'new' => 'membership_end_date_relative'], + ['old' => 'member_end_date_high', 'new' => 'membership_end_date_high'], + ['old' => 'member_end_date_low', 'new' => 'membership_end_date_low'], + ], + ]); + $this->addTask('Update smart groups where jcalendar fields have been converted to datepicker', 'updateSmartGroups', [ + 'datepickerConversion' => [ + 'pledge_payment_scheduled_date', + 'pledge_create_date', + 'pledge_end_date', + 'pledge_start_date', + 'membership_join_date', + 'membership_end_date', + 'membership_start_date', + ], + ]); + $this->addTask('Update civicrm_mapping_field and civicrm_uf_field for change in join_date name', 'updateJoinDateMappingUF'); + $this->addTask('Update civicrm_report_instances for change in filter from join_date to membership_join_date', 'joinDateReportUpdate'); + } + + public static function removeDomainIDFK() { + CRM_Core_BAO_SchemaHandler::safeRemoveFK('civicrm_dashboard', 'FK_civicrm_dashboard_domain_id'); + return TRUE; + } + + public static function recreateDashboardFK() { + $sql = CRM_Core_BAO_SchemaHandler::buildForeignKeySQL([ + 'fk_table_name' => 'civicrm_domain', + 'fk_field_name' => 'id', + 'name' => 'domain_id', + 'fk_attributes' => ' ON DELETE CASCADE', + ], "\n", " ADD ", 'civicrm_dashboard'); + CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_dashboard " . $sql, [], TRUE, NULL, FALSE, FALSE); + return TRUE; + } + + public static function updateJoinDateMappingUF() { + CRM_Core_DAO::executeQuery("UPDATE civicrm_mapping_field SET name = 'membership_join_date' WHERE name = 'join_date' AND contact_type = 'Membership'"); + CRM_Core_DAO::executeQuery("UPDATE civicrm_uf_field SET field_name = 'membership_join_date' WHERE field_name = 'join_date' AND field_type = 'Membership'"); + return TRUE; + } + + public static function joinDateReportUpdate() { + $report_templates = ['member/contributionDetail', 'member/Detail', 'member/Summary']; + $substitutions = [ + 'join_date_relative' => 'membership_join_date_relative', + 'join_date_from' => 'membership_join_date_from', + 'join_date_to' => 'membership_join_date_to', + ]; + foreach ($report_templates as $report_template) { + $reports = civicrm_api3('ReportInstance', 'get', [ + 'report_id' => $report_template, + 'options' => ['limit' => 0], + ])['values']; + foreach ($reports as $report) { + if (!is_array($report['form_values'])) { + $form_values = unserialize($report['form_values']); + } + else { + $form_values = $report['form_values']; + } + foreach ($form_values as $key => $value) { + if (array_key_exists($key, $substitutions)) { + $form_values[$substitutions[$key]] = $value; + unset($form_values[$key]); + } + } + $form_values = serialize($form_values); + CRM_Core_DAO::executeQuery("UPDATE civicrm_report_instance SET form_values = %1 WHERE id = %2", [ + 1 => [$form_values, 'String'], + 2 => [$report['id'], 'Positive'], + ]); + } + } + return TRUE; + } + + // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { + // return TRUE; + // } + +} diff --git a/civicrm/CRM/Upgrade/Incremental/php/Template.php b/civicrm/CRM/Upgrade/Incremental/php/Template.php index d9fbf67e0f..bce4716c11 100644 --- a/civicrm/CRM/Upgrade/Incremental/php/Template.php +++ b/civicrm/CRM/Upgrade/Incremental/php/Template.php @@ -79,7 +79,7 @@ class CRM_Upgrade_Incremental_php_<?php echo $camelNumber; ?> extends CRM_Upgrad // * @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(ts('Upgrade DB to %1: SQL', [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. diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl deleted file mode 100644 index fb5a361377..0000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.0 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl deleted file mode 100644 index 08c75608e2..0000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.2 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl deleted file mode 100644 index 684237bb69..0000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.3 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl deleted file mode 100644 index bf00882ddf..0000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.4 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl deleted file mode 100644 index 13dae8841f..0000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.5 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl new file mode 100644 index 0000000000..34af8cc252 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.0 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl new file mode 100644 index 0000000000..9db49d5112 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.alpha1 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl new file mode 100644 index 0000000000..341608e6f1 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.beta1 during upgrade *} diff --git a/civicrm/CRM/Utils/API/ReloadOption.php b/civicrm/CRM/Utils/API/ReloadOption.php index 4eaa30cfe1..6b0793a26f 100644 --- a/civicrm/CRM/Utils/API/ReloadOption.php +++ b/civicrm/CRM/Utils/API/ReloadOption.php @@ -76,7 +76,7 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper { public function toApiOutput($apiRequest, $result) { $reloadMode = NULL; if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']) && is_array($apiRequest['params']['options']) && isset($apiRequest['params']['options']['reload'])) { - if (!CRM_Utils_Array::value('is_error', $result, FALSE)) { + if (empty($result['is_error'])) { $reloadMode = $apiRequest['params']['options']['reload']; } $id = (!empty($apiRequest['params']['sequential'])) ? 0 : $result['id']; diff --git a/civicrm/CRM/Utils/Address.php b/civicrm/CRM/Utils/Address.php index 4f2cdc5f5c..518c17e772 100644 --- a/civicrm/CRM/Utils/Address.php +++ b/civicrm/CRM/Utils/Address.php @@ -343,7 +343,7 @@ class CRM_Utils_Address { $alternateName = $alternate2; } //Include values which prepend 'billing_' to country and state_province. - if (CRM_Utils_Array::value($alternateName, $params)) { + if (!empty($params[$alternateName])) { if (empty($value) || !is_numeric($value)) { $value = $params[$alternateName]; } diff --git a/civicrm/CRM/Utils/Array.php b/civicrm/CRM/Utils/Array.php index 4cda076ea3..7dd32cd4be 100644 --- a/civicrm/CRM/Utils/Array.php +++ b/civicrm/CRM/Utils/Array.php @@ -375,7 +375,7 @@ class CRM_Utils_Array { public static function crmInArray($value, $params, $caseInsensitive = TRUE) { foreach ($params as $item) { if (is_array($item)) { - $ret = crmInArray($value, $item, $caseInsensitive); + $ret = self::crmInArray($value, $item, $caseInsensitive); } else { $ret = ($caseInsensitive) ? strtolower($item) == strtolower($value) : $item == $value; diff --git a/civicrm/CRM/Utils/JS.php b/civicrm/CRM/Utils/JS.php index 06331b5a2c..718afc4576 100644 --- a/civicrm/CRM/Utils/JS.php +++ b/civicrm/CRM/Utils/JS.php @@ -143,11 +143,13 @@ class CRM_Utils_JS { */ public static function decode($js) { $js = trim($js); - if ($js[0] === "'" || $js[0] === '"') { + $first = substr($js, 0, 1); + $last = substr($js, -1); + if ($last === $first && ($first === "'" || $first === '"')) { // Use a temp placeholder for escaped backslashes return str_replace(['\\\\', "\\'", '\\"', '\\&', '\\/', '**backslash**'], ['**backslash**', "'", '"', '&', '/', '\\'], substr($js, 1, -1)); } - if ($js[0] === '{' || $js[0] === '[') { + if (($first === '{' && $last === '}') || ($first === '[' && $last === ']')) { $obj = self::getRawProps($js); foreach ($obj as $idx => $item) { $obj[$idx] = self::decode($item); diff --git a/civicrm/CRM/Utils/System.php b/civicrm/CRM/Utils/System.php index 622e1aae9a..b529323688 100644 --- a/civicrm/CRM/Utils/System.php +++ b/civicrm/CRM/Utils/System.php @@ -53,7 +53,6 @@ * @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. - * @method static sendResponse(\Psr\Http\Message\ResponseInterface $response) function to handle RepsoseInterface for delivering HTTP Responses. */ class CRM_Utils_System { @@ -1442,6 +1441,8 @@ class CRM_Utils_System { Civi::cache('groups')->flush(); Civi::cache('navigation')->flush(); Civi::cache('customData')->flush(); + Civi::cache('contactTypes')->clear(); + Civi::cache('metadata')->clear(); CRM_Extension_System::singleton()->getCache()->flush(); CRM_Cxn_CiviCxnHttp::singleton()->getCache()->flush(); } diff --git a/civicrm/CRM/Utils/System/Backdrop.php b/civicrm/CRM/Utils/System/Backdrop.php index 5482e80089..e7e8ace39f 100644 --- a/civicrm/CRM/Utils/System/Backdrop.php +++ b/civicrm/CRM/Utils/System/Backdrop.php @@ -880,9 +880,6 @@ AND u.status = 1 else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal.php b/civicrm/CRM/Utils/System/Drupal.php index 4af4391244..44e4349b86 100644 --- a/civicrm/CRM/Utils/System/Drupal.php +++ b/civicrm/CRM/Utils/System/Drupal.php @@ -836,9 +836,6 @@ AND u.status = 1 else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal6.php b/civicrm/CRM/Utils/System/Drupal6.php index 9fc4813751..af566e5d2a 100644 --- a/civicrm/CRM/Utils/System/Drupal6.php +++ b/civicrm/CRM/Utils/System/Drupal6.php @@ -815,9 +815,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal8.php b/civicrm/CRM/Utils/System/Drupal8.php index 4a54bdc799..38ed2933c6 100644 --- a/civicrm/CRM/Utils/System/Drupal8.php +++ b/civicrm/CRM/Utils/System/Drupal8.php @@ -616,9 +616,6 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Joomla.php b/civicrm/CRM/Utils/System/Joomla.php index fa5b4e5b68..4fd07e84d0 100644 --- a/civicrm/CRM/Utils/System/Joomla.php +++ b/civicrm/CRM/Utils/System/Joomla.php @@ -833,23 +833,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { } } - /** - * Output code from error function. - * @param string $content - */ - public function outputError($content) { - if (class_exists('JErrorPage')) { - $error = new Exception($content); - JErrorPage::render($error); - } - elseif (class_exists('JError')) { - JError::raiseError('CiviCRM-001', $content); - } - else { - parent::outputError($content); - } - } - /** * @inheritDoc */ @@ -897,9 +880,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index d841ba15d8..382892d314 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -827,13 +827,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $contactCreated = 0; $contactMatching = 0; - // previously used $wpdb - which means WordPress *must* be bootstrapped - $wpUsers = get_users(array( - 'blog_id' => get_current_blog_id(), - 'number' => -1, - )); + global $wpdb; + $wpUserIds = $wpdb->get_col("SELECT $wpdb->users.ID FROM $wpdb->users"); - foreach ($wpUsers as $wpUserData) { + foreach ($wpUserIds as $wpUserId) { + $wpUserData = get_userdata($wpUserId); $contactCount++; if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($wpUserData, $wpUserData->$id, @@ -849,9 +847,6 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/Civi/Core/Container.php b/civicrm/Civi/Core/Container.php index 9c78f0b312..0dfebb73ed 100644 --- a/civicrm/Civi/Core/Container.php +++ b/civicrm/Civi/Core/Container.php @@ -159,6 +159,8 @@ class Container { 'navigation' => 'navigation', 'customData' => 'custom data', 'fields' => 'contact fields', + 'contactTypes' => 'contactTypes', + 'metadata' => 'metadata', ]; foreach ($basicCaches as $cacheSvc => $cacheGrp) { $definitionParams = [ @@ -168,7 +170,7 @@ class Container { // For Caches that we don't really care about the ttl for and/or maybe accessed // fairly often we use the fastArrayDecorator which improves reads and writes, these // caches should also not have concurrency risk. - $fastArrayCaches = ['groups', 'navigation', 'customData', 'fields']; + $fastArrayCaches = ['groups', 'navigation', 'customData', 'fields', 'contactTypes', 'metadata']; if (in_array($cacheSvc, $fastArrayCaches)) { $definitionParams['withArray'] = 'fast'; } diff --git a/civicrm/Civi/Test/Api3DocTrait.php b/civicrm/Civi/Test/Api3DocTrait.php index 6b3ad189a2..cde9462501 100644 --- a/civicrm/Civi/Test/Api3DocTrait.php +++ b/civicrm/Civi/Test/Api3DocTrait.php @@ -124,7 +124,9 @@ trait Api3DocTrait { mkdir($civicrm_root . "/api/v3/examples/$entity"); } $f = fopen($civicrm_root . "/api/v3/examples/$entity/$exampleName.php", "w+b"); - fwrite($f, $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl')); + $contents = $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl'); + $contents = \CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents); + fwrite($f, $contents); fclose($f); } } diff --git a/civicrm/Civi/Test/GenericAssertionsTrait.php b/civicrm/Civi/Test/GenericAssertionsTrait.php index 1e969f7c39..993e1278cb 100644 --- a/civicrm/Civi/Test/GenericAssertionsTrait.php +++ b/civicrm/Civi/Test/GenericAssertionsTrait.php @@ -12,8 +12,10 @@ namespace Civi\Test; trait GenericAssertionsTrait { /** - * @param $expected + * @param string $expected + * Ex: 'array', 'object', 'int' * @param $actual + * The variable/item to check. * @param string $message */ public function assertType($expected, $actual, $message = '') { @@ -21,8 +23,13 @@ trait GenericAssertionsTrait { } /** - * Assert that two array-trees are exactly equal, notwithstanding - * the sorting of keys + * Assert that two array-trees are exactly equal. + * + * The ordering of keys do not affect the outcome (within either the roots + * or in any child elements). + * + * Error messages will reveal a readable -path-, regardless of how many + * levels of nesting are present. * * @param array $expected * @param array $actual @@ -39,25 +46,29 @@ trait GenericAssertionsTrait { } /** - * Assert that two numbers are approximately equal. + * Assert that two numbers are approximately equal, + * give or take some $tolerance. * * @param int|float $expected * @param int|float $actual * @param int|float $tolerance + * Any differences <$tolerance are considered irrelevant. + * Differences >=$tolerance are considered relevant. * @param string $message */ public function assertApproxEquals($expected, $actual, $tolerance, $message = NULL) { + $diff = abs($actual - $expected); if ($message === NULL) { - $message = sprintf("approx-equals: expected=[%.3f] actual=[%.3f] tolerance=[%.3f]", $expected, $actual, $tolerance); + $message = sprintf("approx-equals: expected=[%.3f] actual=[%.3f] diff=[%.3f] tolerance=[%.3f]", $expected, $actual, $diff, $tolerance); } - $this->assertTrue(abs($actual - $expected) < $tolerance, $message); + $this->assertTrue($diff < $tolerance, $message); } /** * Assert attributes are equal. * - * @param $expectedValues - * @param $actualValues + * @param array $expectedValues + * @param array $actualValues * @param string $message * * @throws \PHPUnit_Framework_AssertionFailedError @@ -74,34 +85,32 @@ trait GenericAssertionsTrait { } /** - * @param $key - * @param $list + * @param string|int $key + * @param array $list */ public function assertArrayKeyExists($key, &$list) { $result = isset($list[$key]) ? TRUE : FALSE; - $this->assertTrue($result, ts("%1 element exists?", - array(1 => $key) - )); + $this->assertTrue($result, sprintf("%s element exists?", $key)); } /** - * @param $key - * @param $list + * @param string|int $key + * @param array $list */ public function assertArrayValueNotNull($key, &$list) { $this->assertArrayKeyExists($key, $list); $value = isset($list[$key]) ? $list[$key] : NULL; $this->assertTrue($value, - ts("%1 element not null?", - array(1 => $key) - ) + sprintf("%s element not null?", $key) ); } /** * Assert the 2 arrays have the same values. * + * The order of arrays, and keys of the arrays, do not affect the outcome. + * * @param array $array1 * @param array $array2 */ diff --git a/civicrm/ang/crmMailing/BlockMailing.html b/civicrm/ang/crmMailing/BlockMailing.html index 8e09974322..3f6c7ca44a 100644 --- a/civicrm/ang/crmMailing/BlockMailing.html +++ b/civicrm/ang/crmMailing/BlockMailing.html @@ -6,7 +6,7 @@ It could perhaps be thinned by 30-60% by making more directives. --> <div class="crm-block" ng-form="subform" crm-ui-id-scope> <div class="crm-group"> - <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}"> + <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="mailing.template_type=='traditional'"> <div crm-mailing-block-templates="{name: 'templates', id: 'subform.msg_template_id'}" crm-mailing="mailing"></div> </div> <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}"> diff --git a/civicrm/ang/crmMailingAB/BlockMailing.html b/civicrm/ang/crmMailingAB/BlockMailing.html index 9244815641..592e94c847 100644 --- a/civicrm/ang/crmMailingAB/BlockMailing.html +++ b/civicrm/ang/crmMailingAB/BlockMailing.html @@ -14,57 +14,57 @@ processed by Angular; if false, the field will be hidden and completely ignored <div class="crm-block" ng-form="subform" crm-ui-id-scope> <div class="crm-group"> - - <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="fields.msg_template_id"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_id" - name="msg_template_id" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.a.msg_template_id" - ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div ng-if="abtest.mailings.a.template_type=='traditional'"> + <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="fields.msg_template_id"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_id" + name="msg_template_id" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.a.msg_template_id" + ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> - </div> - <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_idA" - name="msg_template_idA" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.a.msg_template_id" - ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_idA" + name="msg_template_idA" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.a.msg_template_id" + ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> - </div> - <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_idB" - name="msg_template_idB" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.b.msg_template_id" - ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_idB" + name="msg_template_idB" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.b.msg_template_id" + ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> </div> - <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}" ng-if="fields.fromAddress"> <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> <select diff --git a/civicrm/api/v3/Batch.php b/civicrm/api/v3/Batch.php index 36b5ee35df..9e93ad9f4e 100644 --- a/civicrm/api/v3/Batch.php +++ b/civicrm/api/v3/Batch.php @@ -37,6 +37,8 @@ * @param array $params * * @return array + * @throws \API_Exception + * @throws \Civi\API\Exception\UnauthorizedException */ function civicrm_api3_batch_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Batch'); @@ -56,8 +58,10 @@ function _civicrm_api3_batch_create_spec(&$params) { $params['entity_table']['api.default'] = "civicrm_batch"; $params['entity_table']['type'] = CRM_Utils_Type::T_STRING; $params['entity_table']['title'] = 'Batch Entity Table - remove?'; - - $params['modified_date']['api.default'] = "now"; + $params['created_id']['api.default'] = 'user_contact_id'; + $params['created_date']['api.default'] = 'now'; + $params['modified_id']['api.default'] = 'user_contact_id'; + $params['modified_date']['api.default'] = 'now'; $params['status_id']['api.required'] = 1; $params['title']['api.required'] = 1; $params['status_id']['api.required'] = 1; @@ -82,6 +86,8 @@ function civicrm_api3_batch_get($params) { * * @return array * Array of deleted values. + * @throws \API_Exception + * @throws \Civi\API\Exception\UnauthorizedException */ function civicrm_api3_batch_delete($params) { return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/civicrm/api/v3/Contribution.php b/civicrm/api/v3/Contribution.php index 6c710fdc6c..f190f3eb32 100644 --- a/civicrm/api/v3/Contribution.php +++ b/civicrm/api/v3/Contribution.php @@ -612,6 +612,15 @@ function _civicrm_api3_contribution_completetransaction_spec(&$params) { 'optionGroupName' => 'accept_creditcard', ], ]; + // At some point we will deprecate this api in favour of calling payment create which will in turn call this + // api if appropriate to transition related entities and send receipts - ie. financial responsibility should + // not exist in completetransaction. For now we just need to allow payment.create to force a bypass on the + // things it does itself. + $params['is_post_payment_create'] = [ + 'title' => 'Is this being called from payment create?', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'description' => 'The \'correct\' flow is to call payment.create for the financial side & for that to call completecontribution for the entity & receipt management. However, we need to still support completetransaction directly for legacy reasons', + ]; } /** @@ -669,6 +678,7 @@ function civicrm_api3_contribution_repeattransaction($params) { 'fee_amount', 'financial_type_id', 'contribution_status_id', + 'membership_id', ]; $input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL)); @@ -728,7 +738,7 @@ function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstC $input['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $params); $transaction = new CRM_Core_Transaction(); return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction, - !empty($contribution->contribution_recur_id), $contribution); + !empty($contribution->contribution_recur_id), $contribution, CRM_Utils_Array::value('is_post_payment_create', $params)); } /** diff --git a/civicrm/api/v3/Dedupe.php b/civicrm/api/v3/Dedupe.php index 0099206918..6762af43c6 100644 --- a/civicrm/api/v3/Dedupe.php +++ b/civicrm/api/v3/Dedupe.php @@ -107,7 +107,8 @@ function civicrm_api3_dedupe_getstatistics($params) { $params['rule_group_id'], CRM_Utils_Array::value('group_id', $params), CRM_Utils_Array::value('criteria', $params, []), - CRM_Utils_Array::value('check_permissions', $params, []) + !empty($params['check_permissions']), + CRM_Utils_Array::value('search_limit', $params, 0) )); return civicrm_api3_create_success($stats); } @@ -135,6 +136,11 @@ function _civicrm_api3_dedupe_getstatistics_spec(&$params) { 'title' => ts('Criteria'), 'description' => ts('Dedupe search criteria, as parsable by v3 Contact.get api'), ]; + $spec['search_limit'] = [ + 'title' => ts('Number of contacts to look for matches for.'), + 'type' => CRM_Utils_Type::T_INT, + 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), + ]; } @@ -150,7 +156,7 @@ function _civicrm_api3_dedupe_getstatistics_spec(&$params) { */ function civicrm_api3_dedupe_getduplicates($params) { $options = _civicrm_api3_get_options_from_params($params); - $dupePairs = CRM_Dedupe_Merger::getDuplicatePairs($params['rule_group_id'], NULL, TRUE, $options['limit'], FALSE, TRUE, $params['criteria'], CRM_Utils_Array::value('check_permissions', $params), CRM_Utils_Array::value('search_limit', $params, 0)); + $dupePairs = CRM_Dedupe_Merger::getDuplicatePairs($params['rule_group_id'], NULL, TRUE, $options['limit'], FALSE, TRUE, $params['criteria'], CRM_Utils_Array::value('check_permissions', $params), CRM_Utils_Array::value('search_limit', $params, 0), CRM_Utils_Array::value('is_force_new_search', $params)); return civicrm_api3_create_success($dupePairs); } @@ -178,5 +184,9 @@ function _civicrm_api3_dedupe_getduplicates_spec(&$params) { 'type' => CRM_Utils_Type::T_INT, 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), ]; + $spec['is_force_new_search'] = [ + 'title' => ts('Force a new search, refreshing any cached search'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + ]; } diff --git a/civicrm/api/v3/Event.php b/civicrm/api/v3/Event.php index 8f30864e46..f99d9a0430 100644 --- a/civicrm/api/v3/Event.php +++ b/civicrm/api/v3/Event.php @@ -59,13 +59,6 @@ function civicrm_api3_event_create($params) { ]); } - // Clone event from template - if (!empty($params['template_id']) && empty($params['id'])) { - $copy = CRM_Event_BAO_Event::copy($params['template_id']); - $params['id'] = $copy->id; - unset($params['template_id']); - } - _civicrm_api3_event_create_legacy_support_42($params); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event'); } diff --git a/civicrm/api/v3/Job.php b/civicrm/api/v3/Job.php index 86cfa253d2..4a4b0eca75 100644 --- a/civicrm/api/v3/Job.php +++ b/civicrm/api/v3/Job.php @@ -541,7 +541,7 @@ function civicrm_api3_job_process_batch_merge($params) { $gid = CRM_Utils_Array::value('gid', $params); $mode = CRM_Utils_Array::value('mode', $params, 'safe'); - $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params)); + $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params), NULL, $params['search_limit']); return civicrm_api3_create_success($result, $params); } @@ -571,6 +571,12 @@ function _civicrm_api3_job_process_batch_merge_spec(&$params) { 'description' => 'let the api decide which contact to retain and which to delete?', 'type' => CRM_Utils_Type::T_BOOLEAN, ]; + $params['search_limit'] = [ + 'title' => ts('Number of contacts to look for matches for.'), + 'type' => CRM_Utils_Type::T_INT, + 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), + ]; + } /** diff --git a/civicrm/api/v3/LineItem.php b/civicrm/api/v3/LineItem.php index ff37983e6b..9b784435c6 100644 --- a/civicrm/api/v3/LineItem.php +++ b/civicrm/api/v3/LineItem.php @@ -78,7 +78,7 @@ function _civicrm_api3_line_item_create_spec(&$params) { * Array of matching line_items */ function civicrm_api3_line_item_get($params) { - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { CRM_Price_BAO_LineItem::getAPILineItemParams($params); } return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); @@ -95,7 +95,7 @@ function civicrm_api3_line_item_get($params) { * @throws API_Exception */ function civicrm_api3_line_item_delete($params) { - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, CRM_Core_Action::DELETE); if (empty($params['financial_type_id'])) { $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id'); diff --git a/civicrm/api/v3/MembershipType.php b/civicrm/api/v3/MembershipType.php index 386626c548..cf4bccf62e 100644 --- a/civicrm/api/v3/MembershipType.php +++ b/civicrm/api/v3/MembershipType.php @@ -87,6 +87,7 @@ function civicrm_api3_membership_type_get($params) { // Workaround for fields using nonstandard serialization foreach (['relationship_type_id', 'relationship_direction'] as $field) { if (isset($item[$field]) && !is_array($item[$field])) { + // @todo - this should be handled by the serialization now... $item[$field] = (array) $item[$field]; } } @@ -95,6 +96,18 @@ function civicrm_api3_membership_type_get($params) { return $results; } +/** + * Adjust Metadata for Get action. + * + * The metadata is used for setting defaults, documentation & validation. + * + * @param array $params + * Array of parameters determined by getfields. + */ +function _civicrm_api3_membership_type_get_spec(&$params) { + $params['domain_id']['api.default'] = CRM_Core_Config::domainID(); +} + /** * Adjust input for getlist action. * diff --git a/civicrm/api/v3/Order.php b/civicrm/api/v3/Order.php index 6d3b4bad5e..e570855b57 100644 --- a/civicrm/api/v3/Order.php +++ b/civicrm/api/v3/Order.php @@ -45,7 +45,7 @@ function civicrm_api3_order_get($params) { $contributions = []; $params['api.line_item.get'] = ['qty' => ['<>' => 0]]; $isSequential = FALSE; - if (CRM_Utils_Array::value('sequential', $params)) { + if (!empty($params['sequential'])) { $params['sequential'] = 0; $isSequential = TRUE; } @@ -88,7 +88,7 @@ function civicrm_api3_order_create($params) { $entity = NULL; $entityIds = []; - if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) { + if (!empty($params['line_items']) && is_array($params['line_items'])) { $priceSetID = NULL; CRM_Contribute_BAO_Contribution::checkLineItems($params); foreach ($params['line_items'] as $lineItems) { @@ -124,7 +124,7 @@ function civicrm_api3_order_create($params) { } $contribution = civicrm_api3('Contribution', 'create', $params); // add payments - if ($entity && CRM_Utils_Array::value('id', $contribution)) { + if ($entity && !empty($contribution['id'])) { foreach ($entityIds as $entityId) { $paymentParams = [ 'contribution_id' => $contribution['id'], diff --git a/civicrm/api/v3/Payment.php b/civicrm/api/v3/Payment.php index a2deaf562c..4ac10c070f 100644 --- a/civicrm/api/v3/Payment.php +++ b/civicrm/api/v3/Payment.php @@ -43,7 +43,7 @@ function civicrm_api3_payment_get($params) { $financialTrxn = []; $limit = ''; - if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) { + if (isset($params['options']) && !empty($params['options']['limit'])) { $limit = CRM_Utils_Array::value('limit', $params['options']); } $params['options']['limit'] = 0; @@ -132,7 +132,7 @@ function civicrm_api3_payment_cancel($params) { */ function civicrm_api3_payment_create($params) { // Check if it is an update - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $amount = $params['total_amount']; civicrm_api3('Payment', 'cancel', $params); $params['total_amount'] = $amount; @@ -178,6 +178,12 @@ function _civicrm_api3_payment_create_spec(&$params) { 'title' => ts('Cancel Date'), 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, ], + 'is_send_contribution_notification' => [ + 'title' => ts('Send out notifications based on contribution status change?'), + 'description' => ts('Most commonly this equates to emails relating to the contribution, event, etcwhen a payment completes a contribution'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'api.default' => TRUE, + ], ]; } diff --git a/civicrm/api/v3/examples/Activity/Get.php b/civicrm/api/v3/examples/Activity/Get.php index 0c8055de06..014e703a3d 100644 --- a/civicrm/api/v3/examples/Activity/Get.php +++ b/civicrm/api/v3/examples/Activity/Get.php @@ -7,10 +7,9 @@ */ function activity_get_example() { $params = [ - 'contact_id' => 1, - 'activity_type_id' => 9999, - 'sequential' => 1, - 'return.custom_1' => 1, + 'case_id' => [ + 'IS NULL' => 1, + ], ]; try{ @@ -44,28 +43,25 @@ function activity_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 9, 'values' => [ - '0' => [ - 'id' => '1', - 'activity_type_id' => '9999', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'duration' => '120', - 'location' => 'Pennsylvania', - 'details' => 'a test activity', + '9' => [ + 'id' => '9', + 'activity_type_id' => '2', + 'subject' => 'Ask not what your API can do for you, but what you can do for your API.', + 'activity_date_time' => '2019-08-20 19:10:43', 'status_id' => '2', - 'priority_id' => '1', + 'priority_id' => '2', 'is_test' => 0, 'is_auto' => 0, 'is_current_revision' => '1', 'is_deleted' => 0, 'is_star' => 0, - 'custom_1' => 'custom string', - 'source_contact_id' => '1', - 'status' => 'Completed', - 'activity_name' => 'Test activity type', - 'custom_1_1' => 'custom string', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'source_contact_id' => '19', + 'source_contact_name' => 'Mr. Anthony Anderson II', + 'source_contact_sort_name' => 'Anderson, Anthony', ], ], ]; @@ -75,22 +71,22 @@ function activity_get_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testActivityGetContact_idCustom" +* The test that created it is called "testGet" * and can be found at: -* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityCaseTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityContact/Create.php b/civicrm/api/v3/examples/ActivityContact/Create.php index 551318b114..d538c10419 100644 --- a/civicrm/api/v3/examples/ActivityContact/Create.php +++ b/civicrm/api/v3/examples/ActivityContact/Create.php @@ -64,17 +64,17 @@ function activity_contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityContact/Delete.php b/civicrm/api/v3/examples/ActivityContact/Delete.php index e3cc42dceb..34a0727e07 100644 --- a/civicrm/api/v3/examples/ActivityContact/Delete.php +++ b/civicrm/api/v3/examples/ActivityContact/Delete.php @@ -7,7 +7,7 @@ */ function activity_contact_delete_example() { $params = [ - 'id' => 8, + 'id' => 11, ]; try{ @@ -54,17 +54,17 @@ function activity_contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityType/Create.php b/civicrm/api/v3/examples/ActivityType/Create.php index 10325428f7..32298d8739 100644 --- a/civicrm/api/v3/examples/ActivityType/Create.php +++ b/civicrm/api/v3/examples/ActivityType/Create.php @@ -49,10 +49,10 @@ function activity_type_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 849, + 'id' => 869, 'values' => [ - '849' => [ - 'id' => '849', + '869' => [ + 'id' => '869', 'option_group_id' => '2', 'label' => 'send out letters', 'value' => '55', @@ -85,17 +85,17 @@ function activity_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityType/Get.php b/civicrm/api/v3/examples/ActivityType/Get.php index a1d8d70fd9..0c81f5052c 100644 --- a/civicrm/api/v3/examples/ActivityType/Get.php +++ b/civicrm/api/v3/examples/ActivityType/Get.php @@ -41,7 +41,7 @@ function activity_type_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 54, + 'count' => 35, 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', @@ -55,27 +55,9 @@ function activity_type_get_expectedresult() { '10' => 'Pledge Acknowledgment', '11' => 'Pledge Reminder', '12' => 'Inbound Email', - '13' => 'Open Case', - '14' => 'Follow up', - '15' => 'Change Case Type', - '16' => 'Change Case Status', '17' => 'Membership Renewal Reminder', - '18' => 'Change Case Start Date', '19' => 'Bulk Email', - '20' => 'Assign Case Role', - '21' => 'Remove Case Role', '22' => 'Print/Merge Document', - '23' => 'Merge Case', - '24' => 'Reassigned Case', - '25' => 'Link Cases', - '26' => 'Change Case Tags', - '27' => 'Add Client To Case', - '28' => 'Survey', - '29' => 'Canvass', - '30' => 'PhoneBank', - '31' => 'WalkList', - '32' => 'Petition Signature', - '33' => 'Change Custom Data', '34' => 'Mass SMS', '35' => 'Change Membership Status', '36' => 'Change Membership Type', @@ -95,8 +77,7 @@ function activity_type_get_expectedresult() { '50' => 'Emailed Invoice', '51' => 'Contact Merged', '52' => 'Contact Deleted by Merge', - '53' => 'Failed Payment', - '54' => 'Close Accounting Period', + '54' => 'Failed Payment', ], 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.', ]; @@ -111,17 +92,17 @@ function activity_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressLike.php b/civicrm/api/v3/examples/Address/AddressLike.php index b781816ce6..6f36acfeb3 100644 --- a/civicrm/api/v3/examples/Address/AddressLike.php +++ b/civicrm/api/v3/examples/Address/AddressLike.php @@ -50,8 +50,8 @@ function address_get_expectedresult() { 'values' => [ '0' => [ 'id' => '1', - 'contact_id' => '20', - 'location_type_id' => '18', + 'contact_id' => '4', + 'location_type_id' => '33', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -75,17 +75,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressParse.php b/civicrm/api/v3/examples/Address/AddressParse.php index ddd86d3cc0..264e7684bf 100644 --- a/civicrm/api/v3/examples/Address/AddressParse.php +++ b/civicrm/api/v3/examples/Address/AddressParse.php @@ -11,7 +11,7 @@ function address_create_example() { $params = [ 'street_parsing' => 1, 'street_address' => '54A Excelsior Ave. Apt 1C', - 'location_type_id' => 7, + 'location_type_id' => 8, 'contact_id' => 4, ]; @@ -51,7 +51,7 @@ function address_create_expectedresult() { '1' => [ 'id' => '1', 'contact_id' => '4', - 'location_type_id' => '7', + 'location_type_id' => '8', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => '54A Excelsior Ave. Apt 1C', @@ -74,17 +74,17 @@ function address_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressSort.php b/civicrm/api/v3/examples/Address/AddressSort.php index edde7694d2..7c4937ba12 100644 --- a/civicrm/api/v3/examples/Address/AddressSort.php +++ b/civicrm/api/v3/examples/Address/AddressSort.php @@ -50,8 +50,8 @@ function address_get_expectedresult() { 'values' => [ '0' => [ 'id' => '2', - 'contact_id' => '19', - 'location_type_id' => '17', + 'contact_id' => '4', + 'location_type_id' => '31', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'yzy', @@ -64,8 +64,8 @@ function address_get_expectedresult() { ], '1' => [ 'id' => '1', - 'contact_id' => '19', - 'location_type_id' => '17', + 'contact_id' => '4', + 'location_type_id' => '31', 'is_primary' => 0, 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -89,17 +89,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Create.php b/civicrm/api/v3/examples/Address/Create.php index d4075de134..870a0208e4 100644 --- a/civicrm/api/v3/examples/Address/Create.php +++ b/civicrm/api/v3/examples/Address/Create.php @@ -7,8 +7,7 @@ */ function address_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 4, 'street_name' => 'Ambachtstraat', 'street_number' => '23', 'street_address' => 'Ambachtstraat 23', @@ -49,12 +48,12 @@ function address_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 1, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '3', - 'location_type_id' => '6', + '1' => [ + 'id' => '1', + 'contact_id' => '4', + 'location_type_id' => '1', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -73,22 +72,22 @@ function address_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateAddress" +* The test that created it is called "testCreateAddressDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Delete.php b/civicrm/api/v3/examples/Address/Delete.php index 0f9508a113..ba8524486c 100644 --- a/civicrm/api/v3/examples/Address/Delete.php +++ b/civicrm/api/v3/examples/Address/Delete.php @@ -54,17 +54,17 @@ function address_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Get.php b/civicrm/api/v3/examples/Address/Get.php index 89cb571ae3..92f17e96cb 100644 --- a/civicrm/api/v3/examples/Address/Get.php +++ b/civicrm/api/v3/examples/Address/Get.php @@ -7,7 +7,7 @@ */ function address_get_example() { $params = [ - 'contact_id' => 17, + 'contact_id' => 4, 'street_name' => 'Ambachtstraat', ]; @@ -46,8 +46,8 @@ function address_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '17', - 'location_type_id' => '15', + 'contact_id' => '4', + 'location_type_id' => '27', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -71,17 +71,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/GetOptions.php b/civicrm/api/v3/examples/Address/GetOptions.php index 3ec7f662b9..db58c9f81b 100644 --- a/civicrm/api/v3/examples/Address/GetOptions.php +++ b/civicrm/api/v3/examples/Address/GetOptions.php @@ -60,17 +60,17 @@ function address_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Create.php b/civicrm/api/v3/examples/Batch/Create.php index e8cf61299b..978a965ab8 100644 --- a/civicrm/api/v3/examples/Batch/Create.php +++ b/civicrm/api/v3/examples/Batch/Create.php @@ -80,17 +80,17 @@ function batch_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Delete.php b/civicrm/api/v3/examples/Batch/Delete.php index a8478434a5..0180f59c03 100644 --- a/civicrm/api/v3/examples/Batch/Delete.php +++ b/civicrm/api/v3/examples/Batch/Delete.php @@ -54,17 +54,17 @@ function batch_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Get.php b/civicrm/api/v3/examples/Batch/Get.php index 45420adb86..84e73fed73 100644 --- a/civicrm/api/v3/examples/Batch/Get.php +++ b/civicrm/api/v3/examples/Batch/Get.php @@ -63,17 +63,17 @@ function batch_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Create.php b/civicrm/api/v3/examples/Campaign/Create.php index 1a8e74242d..342f8c3c64 100644 --- a/civicrm/api/v3/examples/Campaign/Create.php +++ b/civicrm/api/v3/examples/Campaign/Create.php @@ -59,7 +59,7 @@ function campaign_create_expectedresult() { 'status_id' => '', 'external_identifier' => '', 'parent_id' => '', - 'is_active' => '', + 'is_active' => '1', 'created_id' => '', 'created_date' => '2013-07-28 08:49:19', 'last_modified_id' => '', @@ -80,17 +80,17 @@ function campaign_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Delete.php b/civicrm/api/v3/examples/Campaign/Delete.php index b6d5d3c420..4acc3c37bb 100644 --- a/civicrm/api/v3/examples/Campaign/Delete.php +++ b/civicrm/api/v3/examples/Campaign/Delete.php @@ -54,17 +54,17 @@ function campaign_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Get.php b/civicrm/api/v3/examples/Campaign/Get.php index 5e6fb6a0f0..0938d0f7cb 100644 --- a/civicrm/api/v3/examples/Campaign/Get.php +++ b/civicrm/api/v3/examples/Campaign/Get.php @@ -66,17 +66,17 @@ function campaign_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Case/Create.php b/civicrm/api/v3/examples/Case/Create.php index d57c589a9c..abea3d5eca 100644 --- a/civicrm/api/v3/examples/Case/Create.php +++ b/civicrm/api/v3/examples/Case/Create.php @@ -7,9 +7,10 @@ */ function case_create_example() { $params = [ + 'case_type_id' => 1, 'subject' => 'Test case', 'contact_id' => 17, - 'case_type' => 'housing_support', + 'custom_1' => 'custom string', ]; try{ @@ -53,7 +54,9 @@ function case_create_expectedresult() { 'end_date' => '', 'details' => '', 'status_id' => '1', - 'is_deleted' => '', + 'is_deleted' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', ], ], ]; @@ -63,22 +66,22 @@ function case_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCaseCreate" +* The test that created it is called "testCaseCreateCustom" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CaseContact/Create.php b/civicrm/api/v3/examples/CaseContact/Create.php new file mode 100644 index 0000000000..9491e8d159 --- /dev/null +++ b/civicrm/api/v3/examples/CaseContact/Create.php @@ -0,0 +1,78 @@ +<?php +/** + * Test Generated example demonstrating the CaseContact.create API. + * + * @return array + * API result array + */ +function case_contact_create_example() { + $params = [ + 'case_id' => 2, + 'contact_id' => 20, + ]; + + try{ + $result = civicrm_api3('CaseContact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function case_contact_create_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + 'case_id' => '2', + 'contact_id' => '20', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testCaseContactCreate" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/CaseContact/Get.php b/civicrm/api/v3/examples/CaseContact/Get.php index 3f12514cea..75619449d6 100644 --- a/civicrm/api/v3/examples/CaseContact/Get.php +++ b/civicrm/api/v3/examples/CaseContact/Get.php @@ -61,17 +61,17 @@ function case_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Constant/Get.php b/civicrm/api/v3/examples/Constant/Get.php index c147be4c92..24ee51a80f 100644 --- a/civicrm/api/v3/examples/Constant/Get.php +++ b/civicrm/api/v3/examples/Constant/Get.php @@ -43,7 +43,7 @@ function constant_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 36, + 'count' => 35, 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', @@ -79,8 +79,7 @@ function constant_get_expectedresult() { '50' => 'Emailed Invoice', '51' => 'Contact Merged', '52' => 'Contact Deleted by Merge', - '53' => 'Failed Payment', - '54' => 'Close Accounting Period', + '54' => 'Failed Payment', ], 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.', ]; @@ -95,17 +94,17 @@ function constant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArray.php b/civicrm/api/v3/examples/Contact/APIChainedArray.php index d69e48ce4c..dbb7bc713a 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArray.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArray.php @@ -78,7 +78,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -115,7 +115,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -148,7 +148,9 @@ function contact_get_expectedresult() { 'display_name' => 'abc3 xyz3', 'contribution_id' => '2', 'currency' => 'USD', - 'payment_instrument' => 'Credit Card', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', 'payment_instrument_id' => '1', 'receive_date' => '2011-01-01 00:00:00', 'non_deductible_amount' => '10.00', @@ -157,37 +159,30 @@ function contact_get_expectedresult() { 'net_amount' => '90.00', 'trxn_id' => '12335', 'invoice_id' => '67830', - 'cancel_date' => '', + 'invoice_number' => '', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => 'SSF', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status' => 'Completed', - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', 'contribution_note' => '', 'contribution_batch' => '', + 'contribution_recur_status' => 'Completed', + 'payment_instrument' => 'Credit Card', + 'contribution_status' => 'Completed', 'check_number' => '', 'instrument_id' => '1', + 'cancel_date' => '', 'id' => '2', 'contribution_type_id' => '1', ], @@ -219,17 +214,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php b/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php index a0c462fcee..aed4d81f0a 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php @@ -79,7 +79,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -116,7 +116,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -136,7 +136,7 @@ function contact_get_expectedresult() { 'count' => 0, 'values' => [], ], - 'api.Membership.getCount' => 0, + 'api.Membership.getCount' => 1, ], ], ]; @@ -151,17 +151,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php b/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php index 555b0d3bc1..75640d5586 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php @@ -76,7 +76,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -113,7 +113,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -193,17 +193,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php b/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php index 91f2eae192..9570d244cd 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php @@ -83,7 +83,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -126,17 +126,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php b/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php index 1d2d015967..3526a4d009 100644 --- a/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php +++ b/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php @@ -25,6 +25,7 @@ function contact_create_example() { 'invoice_id' => 67990, 'source' => 'SSF', 'contribution_status_id' => 1, + 'skipCleanMoney' => 1, ], 'api.website.create' => [ 'url' => 'http://civicrm.org', @@ -95,7 +96,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -136,6 +137,7 @@ function contact_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '15345', 'invoice_id' => '67990', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -199,17 +201,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php b/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php index d3050a7b94..9d587c36b0 100644 --- a/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php +++ b/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php @@ -25,6 +25,7 @@ function contact_create_example() { 'invoice_id' => 67890, 'source' => 'SSF', 'contribution_status_id' => 1, + 'skipCleanMoney' => 1, ], 'api.website.create' => [ '0' => [ @@ -98,7 +99,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -139,6 +140,7 @@ function contact_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -204,17 +206,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php b/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php index c38bd4708b..a3f0d28d45 100644 --- a/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php +++ b/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php @@ -49,8 +49,8 @@ function contact_get_expectedresult() { 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'sort_name' => 'User 412074113, Logged In', - 'display_name' => 'Mr. Logged In User 412074113 II', + 'sort_name' => 'User 202290815, Logged In', + 'display_name' => 'Mr. Logged In User 202290815 II', 'do_not_email' => 0, 'do_not_phone' => 0, 'do_not_mail' => 0, @@ -67,11 +67,11 @@ function contact_get_expectedresult() { 'preferred_mail_format' => 'Both', 'first_name' => 'Logged In', 'middle_name' => 'J.', - 'last_name' => 'User 412074113', + 'last_name' => 'User 202290815', 'prefix_id' => '3', 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -86,6 +86,7 @@ function contact_get_expectedresult() { 'street_address' => '', 'supplemental_address_1' => '', 'supplemental_address_2' => '', + 'supplemental_address_3' => '', 'city' => '', 'postal_code_suffix' => '', 'postal_code' => '', @@ -107,7 +108,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => 'Mr.', 'individual_suffix' => 'II', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -127,17 +128,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Create.php b/civicrm/api/v3/examples/Contact/Create.php index a0727ef7e0..73ebfaa96f 100644 --- a/civicrm/api/v3/examples/Contact/Create.php +++ b/civicrm/api/v3/examples/Contact/Create.php @@ -76,7 +76,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -112,17 +112,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php b/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php index 9cc9537ae8..11aa8c872c 100644 --- a/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php +++ b/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php @@ -13,7 +13,7 @@ function contact_create_example() { 'contact_type' => 'Individual', 'display_name' => 'dlobo', 'api.participant' => [ - 'event_id' => 42, + 'event_id' => 43, 'status_id' => 1, 'role_id' => 1, 'format.only_id' => 1, @@ -90,7 +90,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -141,17 +141,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CustomFieldGet.php b/civicrm/api/v3/examples/Contact/CustomFieldGet.php index 32e6c2218a..d2dc04746f 100644 --- a/civicrm/api/v3/examples/Contact/CustomFieldGet.php +++ b/civicrm/api/v3/examples/Contact/CustomFieldGet.php @@ -65,17 +65,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php b/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php index 4e130c6fbf..0c4d4840db 100644 --- a/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php +++ b/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php @@ -65,17 +65,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Delete.php b/civicrm/api/v3/examples/Contact/Delete.php index c6d0df354b..ab8d6a6809 100644 --- a/civicrm/api/v3/examples/Contact/Delete.php +++ b/civicrm/api/v3/examples/Contact/Delete.php @@ -54,17 +54,17 @@ function contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php b/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php index c0625de776..4bff37e48d 100644 --- a/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php +++ b/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php @@ -53,17 +53,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php b/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php index 14d29195ea..ca3a493b0f 100644 --- a/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php +++ b/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php @@ -10,7 +10,7 @@ */ function contact_get_example() { $params = [ - 'id' => 17, + 'id' => 3, 'format.is_success' => 1, ]; @@ -53,17 +53,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatOnlyID.php b/civicrm/api/v3/examples/Contact/FormatOnlyID.php index 201111a312..2aad1376a6 100644 --- a/civicrm/api/v3/examples/Contact/FormatOnlyID.php +++ b/civicrm/api/v3/examples/Contact/FormatOnlyID.php @@ -11,7 +11,7 @@ */ function contact_get_example() { $params = [ - 'id' => 17, + 'id' => 3, 'format.only_id' => 1, ]; @@ -42,7 +42,7 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = 17; + $expectedResult = 3; return $expectedResult; } @@ -54,17 +54,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatSingleValue.php b/civicrm/api/v3/examples/Contact/FormatSingleValue.php index fa3f23783e..926da812be 100644 --- a/civicrm/api/v3/examples/Contact/FormatSingleValue.php +++ b/civicrm/api/v3/examples/Contact/FormatSingleValue.php @@ -11,7 +11,7 @@ */ function contact_getvalue_example() { $params = [ - 'id' => 17, + 'id' => 3, 'return' => 'display_name', ]; @@ -42,7 +42,7 @@ function contact_getvalue_example() { */ function contact_getvalue_expectedresult() { - $expectedResult = 'Test Contact'; + $expectedResult = 'Mr. Test Contact II'; return $expectedResult; } @@ -54,17 +54,17 @@ function contact_getvalue_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Get.php b/civicrm/api/v3/examples/Contact/Get.php index 17b6b62102..86b47f251b 100644 --- a/civicrm/api/v3/examples/Contact/Get.php +++ b/civicrm/api/v3/examples/Contact/Get.php @@ -69,7 +69,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -106,7 +106,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -126,17 +126,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetActions.php b/civicrm/api/v3/examples/Contact/GetActions.php index 459b2e1e64..5d293b478f 100644 --- a/civicrm/api/v3/examples/Contact/GetActions.php +++ b/civicrm/api/v3/examples/Contact/GetActions.php @@ -40,28 +40,37 @@ function contact_getactions_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 20, + 'count' => 29, 'values' => [ '0' => 'create', '1' => 'delete', '2' => 'duplicatecheck', - '3' => 'get', - '4' => 'getactions', - '5' => 'getcount', - '6' => 'getfield', - '7' => 'getfields', - '8' => 'getlist', - '9' => 'getoptions', - '10' => 'getquick', - '11' => 'getrefcount', - '12' => 'getsingle', - '13' => 'getvalue', - '14' => 'merge', - '15' => 'proximity', - '16' => 'replace', - '17' => 'setvalue', - '18' => 'update', - '19' => 'validate', + '3' => 'example_action1', + '4' => 'example_action2', + '5' => 'get', + '6' => 'get_merge_conflicts', + '7' => 'getactions', + '8' => 'getcount', + '9' => 'getfield', + '10' => 'getfields', + '11' => 'getlist', + '12' => 'getmergedfrom', + '13' => 'getmergedto', + '14' => 'getoptions', + '15' => 'getquick', + '16' => 'getrefcount', + '17' => 'getsingle', + '18' => 'getunique', + '19' => 'getvalue', + '20' => 'merge', + '21' => 'proximity', + '22' => 'replace', + '23' => 'setvalue', + '24' => 'type_create', + '25' => 'type_delete', + '26' => 'type_get', + '27' => 'update', + '28' => 'validate', ], 'deprecated' => [ 'getquick' => 'The "getquick" action is deprecated in favor of "getlist".', @@ -80,17 +89,17 @@ function contact_getactions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetCountContact.php b/civicrm/api/v3/examples/Contact/GetCountContact.php index 5bffef16fc..da0cff83cc 100644 --- a/civicrm/api/v3/examples/Contact/GetCountContact.php +++ b/civicrm/api/v3/examples/Contact/GetCountContact.php @@ -10,7 +10,7 @@ */ function contact_getcount_example() { $params = [ - 'id' => 17, + 'id' => 3, ]; try{ @@ -52,17 +52,17 @@ function contact_getcount_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetFieldsOptions.php b/civicrm/api/v3/examples/Contact/GetFieldsOptions.php index d800b72680..392bbe1d38 100644 --- a/civicrm/api/v3/examples/Contact/GetFieldsOptions.php +++ b/civicrm/api/v3/examples/Contact/GetFieldsOptions.php @@ -45,7 +45,7 @@ function contact_getfields_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 55, + 'count' => 56, 'values' => [ 'id' => [ 'name' => 'id', @@ -60,6 +60,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'contact_id', ], @@ -71,11 +73,12 @@ function contact_getfields_expectedresult() { 'description' => 'Type of Contact.', 'maxlength' => 64, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.contact_type', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 64, @@ -87,6 +90,7 @@ function contact_getfields_expectedresult() { 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', ], + 'is_core_field' => TRUE, 'api.required' => 1, ], 'contact_sub_type' => [ @@ -103,6 +107,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'serialize' => 1, 'html' => [ 'type' => 'Select', 'maxlength' => 255, @@ -114,6 +120,7 @@ function contact_getfields_expectedresult() { 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', ], + 'is_core_field' => TRUE, ], 'do_not_email' => [ 'name' => 'do_not_email', @@ -127,9 +134,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_phone' => [ 'name' => 'do_not_phone', @@ -143,9 +152,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_mail' => [ 'name' => 'do_not_mail', @@ -159,9 +170,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_sms' => [ 'name' => 'do_not_sms', @@ -175,9 +188,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_trade' => [ 'name' => 'do_not_trade', @@ -191,9 +206,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'is_opt_out' => [ 'name' => 'is_opt_out', @@ -207,16 +224,17 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'legal_identifier' => [ 'name' => 'legal_identifier', 'type' => 2, 'title' => 'Legal Identifier', - 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID. - ', + 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.', 'maxlength' => 32, 'size' => 20, 'import' => TRUE, @@ -227,11 +245,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, ], + 'is_core_field' => TRUE, ], 'external_identifier' => [ 'name' => 'external_identifier', @@ -248,11 +268,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 8, ], + 'is_core_field' => TRUE, ], 'sort_name' => [ 'name' => 'sort_name', @@ -261,16 +283,18 @@ function contact_getfields_expectedresult() { 'description' => 'Name used for sorting different contact types', 'maxlength' => 128, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.sort_name', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'display_name' => [ 'name' => 'display_name', @@ -279,16 +303,18 @@ function contact_getfields_expectedresult() { 'description' => 'Formatted name representing preferred format for display/print/other output.', 'maxlength' => 128, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.display_name', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'nick_name' => [ 'name' => 'nick_name', @@ -305,11 +331,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'legal_name' => [ 'name' => 'legal_name', @@ -325,11 +353,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'image_URL' => [ 'name' => 'image_URL', @@ -342,11 +372,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'File', 'rows' => 2, 'cols' => 80, ], + 'is_core_field' => TRUE, ], 'preferred_communication_method' => [ 'name' => 'preferred_communication_method', @@ -363,6 +395,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'serialize' => 1, 'html' => [ 'type' => 'Select', 'maxlength' => 255, @@ -372,6 +406,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'preferred_communication_method', 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', ], + 'is_core_field' => TRUE, ], 'preferred_language' => [ 'name' => 'preferred_language', @@ -387,6 +422,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 5, @@ -397,6 +433,7 @@ function contact_getfields_expectedresult() { 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', ], + 'is_core_field' => TRUE, ], 'preferred_mail_format' => [ 'name' => 'preferred_mail_format', @@ -413,6 +450,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 8, @@ -421,6 +459,7 @@ function contact_getfields_expectedresult() { 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::pmf', ], + 'is_core_field' => TRUE, ], 'hash' => [ 'name' => 'hash', @@ -429,11 +468,13 @@ function contact_getfields_expectedresult() { 'description' => 'Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => 20, - 'export' => TRUE, 'where' => 'civicrm_contact.hash', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'api_key' => [ 'name' => 'api_key', @@ -442,9 +483,18 @@ function contact_getfields_expectedresult() { 'description' => 'API Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => 20, + 'where' => 'civicrm_contact.api_key', + 'permission' => [ + '0' => [ + '0' => 'administer CiviCRM', + '1' => 'edit api keys', + ], + ], 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'first_name' => [ 'name' => 'first_name', @@ -461,11 +511,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'middle_name' => [ 'name' => 'middle_name', @@ -482,11 +534,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'last_name' => [ 'name' => 'last_name', @@ -503,11 +557,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'prefix_id' => [ 'name' => 'prefix_id', @@ -522,6 +578,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -531,6 +588,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'individual_prefix', 'optionEditPath' => 'civicrm/admin/options/individual_prefix', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'individual_prefix', '1' => 'individual_prefix_id', @@ -549,6 +607,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -558,6 +617,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'individual_suffix', 'optionEditPath' => 'civicrm/admin/options/individual_suffix', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'individual_suffix', '1' => 'individual_suffix_id', @@ -577,22 +637,25 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'communication_style_id' => [ 'name' => 'communication_style_id', 'type' => 1, 'title' => 'Communication Style', 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.', - 'export' => TRUE, 'where' => 'civicrm_contact.communication_style_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -602,15 +665,24 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'communication_style', 'optionEditPath' => 'civicrm/admin/options/communication_style', ], + 'is_core_field' => TRUE, ], 'email_greeting_id' => [ 'name' => 'email_greeting_id', 'type' => 1, 'title' => 'Email Greeting ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.', + 'where' => 'civicrm_contact.email_greeting_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'pseudoconstant' => [ + 'optionGroupName' => 'email_greeting', + 'optionEditPath' => 'civicrm/admin/options/email_greeting', + ], + 'is_core_field' => TRUE, ], 'email_greeting_custom' => [ 'name' => 'email_greeting_custom', @@ -624,11 +696,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'email_greeting_display' => [ 'name' => 'email_greeting_display', @@ -637,28 +711,39 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Email Greeting.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.email_greeting_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'postal_greeting_id' => [ 'name' => 'postal_greeting_id', 'type' => 1, 'title' => 'Postal Greeting ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.', + 'where' => 'civicrm_contact.postal_greeting_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'size' => 6, 'maxlength' => 14, ], + 'pseudoconstant' => [ + 'optionGroupName' => 'postal_greeting', + 'optionEditPath' => 'civicrm/admin/options/postal_greeting', + ], + 'is_core_field' => TRUE, ], 'postal_greeting_custom' => [ 'name' => 'postal_greeting_custom', @@ -672,11 +757,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'postal_greeting_display' => [ 'name' => 'postal_greeting_display', @@ -685,23 +772,34 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Postal greeting.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.postal_greeting_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'addressee_id' => [ 'name' => 'addressee_id', 'type' => 1, 'title' => 'Addressee ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.', + 'where' => 'civicrm_contact.addressee_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'pseudoconstant' => [ + 'optionGroupName' => 'addressee', + 'optionEditPath' => 'civicrm/admin/options/addressee', + ], + 'is_core_field' => TRUE, ], 'addressee_custom' => [ 'name' => 'addressee_custom', @@ -715,11 +813,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'addressee_display' => [ 'name' => 'addressee_display', @@ -728,14 +828,17 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Addressee.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.addressee_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'job_title' => [ 'name' => 'job_title', @@ -752,11 +855,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'gender_id' => [ 'name' => 'gender_id', @@ -770,6 +875,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -779,6 +885,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'gender', 'optionEditPath' => 'civicrm/admin/options/gender', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'gender', ], @@ -796,10 +903,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select Date', - 'format' => 'birth', + 'formatType' => 'birth', ], + 'is_core_field' => TRUE, ], 'is_deceased' => [ 'name' => 'is_deceased', @@ -812,9 +921,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'deceased_date' => [ 'name' => 'deceased_date', @@ -828,10 +939,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select Date', - 'format' => 'birth', + 'formatType' => 'birth', ], + 'is_core_field' => TRUE, ], 'household_name' => [ 'name' => 'household_name', @@ -848,26 +961,31 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'primary_contact_id' => [ 'name' => 'primary_contact_id', 'type' => 1, 'title' => 'Household Primary Contact ID', 'description' => 'Optional FK to Primary Contact for this household.', + 'where' => 'civicrm_contact.primary_contact_id', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, ], + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'organization_name' => [ @@ -885,11 +1003,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'sic_code' => [ 'name' => 'sic_code', @@ -905,11 +1025,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 8, 'size' => 8, ], + 'is_core_field' => TRUE, ], 'user_unique_id' => [ 'name' => 'user_unique_id', @@ -927,11 +1049,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'created_date' => [ 'name' => 'created_date', @@ -939,12 +1063,14 @@ function contact_getfields_expectedresult() { 'title' => 'Created Date', 'description' => 'When was the contact was created.', 'required' => '', - 'export' => TRUE, 'where' => 'civicrm_contact.created_date', + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'modified_date' => [ 'name' => 'modified_date', @@ -952,12 +1078,14 @@ function contact_getfields_expectedresult() { 'title' => 'Modified Date', 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.', 'required' => '', - 'export' => TRUE, 'where' => 'civicrm_contact.modified_date', + 'export' => TRUE, 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'source' => [ 'name' => 'source', @@ -973,11 +1101,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, ], + 'is_core_field' => TRUE, 'uniqueName' => 'contact_source', ], 'employer_id' => [ @@ -985,17 +1115,19 @@ function contact_getfields_expectedresult() { 'type' => 1, 'title' => 'Current Employer', 'description' => 'OPTIONAL FK to civicrm_contact record.', - 'export' => TRUE, 'where' => 'civicrm_contact.employer_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'html' => [ 'type' => 'EntityRef', 'size' => 6, 'maxlength' => 14, ], + 'is_core_field' => TRUE, 'uniqueName' => 'current_employer_id', 'FKApiName' => 'Contact', ], @@ -1004,20 +1136,28 @@ function contact_getfields_expectedresult() { 'type' => 16, 'title' => 'Contact is in Trash', 'required' => TRUE, - 'export' => TRUE, 'where' => 'civicrm_contact.is_deleted', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, 'uniqueName' => 'contact_is_deleted', ], 'custom_1' => [ + 'id' => '1', 'label' => 'Our special field', - 'groupTitle' => 'select_test_g', + 'headerPattern' => '//', + 'title' => 'Our special field', + 'custom_field_id' => '1', + 'groupTitle' => 'select_test_group', 'data_type' => 'String', + 'name' => 'custom_1', + 'type' => 2, 'html_type' => 'Select', 'default_value' => '', 'text_length' => '', @@ -1029,19 +1169,19 @@ function contact_getfields_expectedresult() { 'extends_entity_column_id' => '', 'is_view' => 0, 'is_multiple' => 0, - 'option_group_id' => '105', + 'option_group_id' => '110', 'date_format' => '', 'time_format' => '', 'is_required' => '1', 'table_name' => 'civicrm_value_select_test_g_1', 'column_name' => 'our_special_field_1', + 'where' => 'civicrm_value_select_test_g_1.our_special_field_1', + 'extends_table' => 'civicrm_contact', + 'search_table' => 'contact_a', 'pseudoconstant' => [ - 'optionGroupName' => 'our_special_field_20170207021937', - 'optionEditPath' => 'civicrm/admin/options/our_special_field_20170207021937', + 'optionGroupName' => 'our_special_field_20190820191605', + 'optionEditPath' => 'civicrm/admin/options/our_special_field_20190820191605', ], - 'name' => 'custom_1', - 'title' => 'Our special field', - 'type' => 2, 'options' => [ '1' => 'Label1', '2' => 'Label2', @@ -1059,6 +1199,13 @@ function contact_getfields_expectedresult() { 'type' => 16, 'name' => 'dupe_check', ], + 'skip_greeting_processing' => [ + 'title' => 'Skip Greeting processing', + 'description' => 'Do not process greetings, (these can be done by scheduled job and there may be a preference to do so for performance reasons)', + 'type' => 16, + 'api.default' => 0, + 'name' => 'skip_greeting_processing', + ], ], ]; @@ -1072,17 +1219,17 @@ function contact_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetMergedfrom.php b/civicrm/api/v3/examples/Contact/GetMergedfrom.php new file mode 100644 index 0000000000..5349486299 --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetMergedfrom.php @@ -0,0 +1,80 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getmergedfrom API. + * + * @return array + * API result array + */ +function contact_getmergedfrom_example() { + $params = [ + 'contact_id' => 4, + ]; + + try{ + $result = civicrm_api3('Contact', 'getmergedfrom', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getmergedfrom_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + ], + '5' => [ + 'id' => '5', + ], + '6' => [ + 'id' => '6', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testMergedGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GetMergedto.php b/civicrm/api/v3/examples/Contact/GetMergedto.php new file mode 100644 index 0000000000..7d50e49cc8 --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetMergedto.php @@ -0,0 +1,76 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getmergedto API. + * + * @return array + * API result array + */ +function contact_getmergedto_example() { + $params = [ + 'sequential' => 1, + 'contact_id' => 6, + ]; + + try{ + $result = civicrm_api3('Contact', 'getmergedto', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getmergedto_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => [ + '0' => [ + 'id' => '4', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testMergedGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GetOptions.php b/civicrm/api/v3/examples/Contact/GetOptions.php index 352a2296ea..60cd8e5197 100644 --- a/civicrm/api/v3/examples/Contact/GetOptions.php +++ b/civicrm/api/v3/examples/Contact/GetOptions.php @@ -59,17 +59,17 @@ function contact_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetSingleContact.php b/civicrm/api/v3/examples/Contact/GetSingleContact.php index de75c962f4..1c5534833b 100644 --- a/civicrm/api/v3/examples/Contact/GetSingleContact.php +++ b/civicrm/api/v3/examples/Contact/GetSingleContact.php @@ -11,7 +11,7 @@ */ function contact_getsingle_example() { $params = [ - 'id' => 17, + 'id' => 3, ]; try{ @@ -42,16 +42,16 @@ function contact_getsingle_example() { function contact_getsingle_expectedresult() { $expectedResult = [ - 'contact_id' => '17', + 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'sort_name' => '', - 'display_name' => 'Test Contact', - 'do_not_email' => '', - 'do_not_phone' => '', - 'do_not_mail' => '', - 'do_not_sms' => '', - 'do_not_trade' => '', + 'sort_name' => 'Contact, Test', + 'display_name' => 'Mr. Test Contact II', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, 'is_opt_out' => 0, 'legal_identifier' => '', 'external_identifier' => '', @@ -59,15 +59,15 @@ function contact_getsingle_expectedresult() { 'legal_name' => '', 'image_URL' => '', 'preferred_communication_method' => '', - 'preferred_language' => '', - 'preferred_mail_format' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', 'first_name' => 'Test', - 'middle_name' => '', + 'middle_name' => 'J.', 'last_name' => 'Contact', - 'prefix_id' => '', - 'suffix_id' => '', + 'prefix_id' => '3', + 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -93,23 +93,23 @@ function contact_getsingle_expectedresult() { 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', - 'email_id' => '', - 'email' => '', - 'on_hold' => '', + 'email_id' => '1', + 'email' => 'anthony_anderson@civicrm.org', + 'on_hold' => 0, 'im_id' => '', 'provider_id' => '', 'im' => '', 'worldregion_id' => '', 'world_region' => '', - 'languages' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', + 'languages' => 'English (United States)', + 'individual_prefix' => 'Mr.', + 'individual_suffix' => 'II', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', 'country' => '', - 'id' => '17', + 'id' => '3', ]; return $expectedResult; @@ -122,17 +122,17 @@ function contact_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetUnique.php b/civicrm/api/v3/examples/Contact/GetUnique.php new file mode 100644 index 0000000000..b8f75bcc4e --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetUnique.php @@ -0,0 +1,71 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getunique API. + * + * @return array + * API result array + */ +function contact_getunique_example() { + $params = []; + + try{ + $result = civicrm_api3('Contact', 'getunique', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getunique_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 'UI_external_identifier', + 'values' => [ + 'UI_external_identifier' => [], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testContactGetUnique" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php b/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php index 43d22f067b..1fd3b4f3ac 100644 --- a/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php +++ b/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php @@ -76,7 +76,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -113,7 +113,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -133,17 +133,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php b/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php index 753e3ffa78..04d61e2bc6 100644 --- a/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php +++ b/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php @@ -9,31 +9,31 @@ */ function contact_get_example() { $params = [ - 'id' => 10, + 'id' => 19, 'api.email.replace' => [ 'values' => [ '0' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-1@example.com', 'is_primary' => 1, ], '1' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-2@example.com', 'is_primary' => 0, ], '2' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-3@example.com', 'is_primary' => 0, ], '3' => [ - 'location_type_id' => 21, + 'location_type_id' => 39, 'email' => '2-1@example.com', 'is_primary' => 0, ], '4' => [ - 'location_type_id' => 21, + 'location_type_id' => 39, 'email' => '2-2@example.com', 'is_primary' => 0, ], @@ -72,10 +72,10 @@ function contact_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 10, + 'id' => 19, 'values' => [ - '10' => [ - 'contact_id' => '10', + '19' => [ + 'contact_id' => '19', 'contact_type' => 'Organization', 'contact_sub_type' => '', 'sort_name' => 'Unit Test Organization', @@ -100,7 +100,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -134,27 +134,28 @@ function contact_get_expectedresult() { 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', 'country' => '', - 'id' => '10', + 'id' => '19', 'api.email.replace' => [ 'is_error' => 0, 'version' => 3, 'count' => 5, 'values' => [ '0' => [ - 'id' => '18', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '19', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-1@example.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -162,13 +163,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '1' => [ - 'id' => '19', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '20', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -176,13 +177,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '2' => [ - 'id' => '20', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '21', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-3@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -190,13 +191,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '3' => [ - 'id' => '21', - 'contact_id' => '10', - 'location_type_id' => '21', + 'id' => '22', + 'contact_id' => '19', + 'location_type_id' => '39', 'email' => '2-1@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -204,13 +205,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '4' => [ - 'id' => '22', - 'contact_id' => '10', - 'location_type_id' => '21', + 'id' => '23', + 'contact_id' => '19', + 'location_type_id' => '39', 'email' => '2-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -233,17 +234,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php index fc33466272..e775abbb76 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 28, + 'contact_id' => 31, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -18,7 +18,7 @@ function contribution_create_example() { 'net_amount' => '95', 'source' => 'SSF', 'contribution_status_id' => 1, - 'honor_contact_id' => 29, + 'honor_contact_id' => 32, ]; try{ @@ -56,7 +56,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '28', + 'contact_id' => '31', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -67,6 +67,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -99,17 +100,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php index d9e863ea23..1c22dd7f1f 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 22, + 'contact_id' => 25, 'receive_date' => '2012-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -59,7 +59,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '22', + 'contact_id' => '25', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '1', @@ -70,6 +70,7 @@ function contribution_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -102,17 +103,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php index e8f3cf62b4..e4d36539ba 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 24, + 'contact_id' => 27, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -20,7 +20,7 @@ function contribution_create_example() { 'contribution_status_id' => 1, 'soft_credit' => [ '1' => [ - 'contact_id' => 25, + 'contact_id' => 28, 'amount' => 50, 'soft_credit_type_id' => 3, ], @@ -62,7 +62,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '24', + 'contact_id' => '27', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -73,6 +73,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -105,17 +106,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php index 9698b850e5..2c6729fb0a 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 26, + 'contact_id' => 29, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -18,7 +18,7 @@ function contribution_create_example() { 'net_amount' => '95', 'source' => 'SSF', 'contribution_status_id' => 1, - 'soft_credit_to' => 27, + 'soft_credit_to' => 30, ]; try{ @@ -56,7 +56,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '26', + 'contact_id' => '29', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -67,6 +67,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -99,17 +100,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Create.php b/civicrm/api/v3/examples/Contribution/Create.php index df458f5908..7540683df7 100644 --- a/civicrm/api/v3/examples/Contribution/Create.php +++ b/civicrm/api/v3/examples/Contribution/Create.php @@ -65,6 +65,7 @@ function contribution_create_expectedresult() { 'net_amount' => '100', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -83,7 +84,6 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - 'invoice_number' => '', ], ], ]; @@ -98,17 +98,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php b/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php index dd23dd07a6..3c27c405c5 100644 --- a/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php +++ b/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 11, + 'contact_id' => 12, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -73,7 +73,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '11', + 'contact_id' => '12', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '1', @@ -84,6 +84,7 @@ function contribution_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -166,17 +167,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Delete.php b/civicrm/api/v3/examples/Contribution/Delete.php index bb445f01b5..b13f4108dd 100644 --- a/civicrm/api/v3/examples/Contribution/Delete.php +++ b/civicrm/api/v3/examples/Contribution/Delete.php @@ -57,17 +57,17 @@ function contribution_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Get.php b/civicrm/api/v3/examples/Contribution/Get.php index ee07a1ab53..410875dc47 100644 --- a/civicrm/api/v3/examples/Contribution/Get.php +++ b/civicrm/api/v3/examples/Contribution/Get.php @@ -51,6 +51,10 @@ function contribution_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'contribution_id' => '1', 'currency' => 'USD', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', + 'payment_instrument_id' => '4', 'receive_date' => '2010-01-20 00:00:00', 'non_deductible_amount' => '10.00', 'total_amount' => '100.00', @@ -58,39 +62,30 @@ function contribution_get_expectedresult() { 'net_amount' => '95.00', 'trxn_id' => '23456', 'invoice_id' => '78910', - 'cancel_date' => '', + 'invoice_number' => 'INV_1', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => 'SSF', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', 'contribution_note' => '', 'contribution_batch' => '', - 'contribution_status' => 'Completed', + 'contribution_recur_status' => 'Completed', 'payment_instrument' => 'Check', - 'payment_instrument_id' => '4', - 'instrument_id' => '4', + 'contribution_status' => 'Completed', 'check_number' => '', + 'instrument_id' => '4', + 'cancel_date' => '', 'id' => '1', 'contribution_type_id' => '1', ], @@ -107,17 +102,17 @@ function contribution_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/GetUnique.php b/civicrm/api/v3/examples/Contribution/GetUnique.php new file mode 100644 index 0000000000..04b96bece6 --- /dev/null +++ b/civicrm/api/v3/examples/Contribution/GetUnique.php @@ -0,0 +1,71 @@ +<?php +/** + * Test Generated example demonstrating the Contribution.getunique API. + * + * @return array + * API result array + */ +function contribution_getunique_example() { + $params = []; + + try{ + $result = civicrm_api3('Contribution', 'getunique', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contribution_getunique_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => [ + 'UI_contrib_trxn_id' => [], + 'UI_contrib_invoice_id' => [], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testContributionGetUnique" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/ContributionPage/Create.php b/civicrm/api/v3/examples/ContributionPage/Create.php index 2b18e3ffca..5ad0fd2858 100644 --- a/civicrm/api/v3/examples/ContributionPage/Create.php +++ b/civicrm/api/v3/examples/ContributionPage/Create.php @@ -97,6 +97,7 @@ function contribution_page_create_expectedresult() { 'campaign_id' => '', 'is_share' => '', 'is_billing_required' => '', + 'contribution_type_id' => '1', ], ], ]; @@ -111,17 +112,17 @@ function contribution_page_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Delete.php b/civicrm/api/v3/examples/ContributionPage/Delete.php index 87221bb754..423f5c2b08 100644 --- a/civicrm/api/v3/examples/ContributionPage/Delete.php +++ b/civicrm/api/v3/examples/ContributionPage/Delete.php @@ -54,17 +54,17 @@ function contribution_page_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Get.php b/civicrm/api/v3/examples/ContributionPage/Get.php index f5b2b365ba..ae66d5d0db 100644 --- a/civicrm/api/v3/examples/ContributionPage/Get.php +++ b/civicrm/api/v3/examples/ContributionPage/Get.php @@ -82,17 +82,17 @@ function contribution_page_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Submit.php b/civicrm/api/v3/examples/ContributionPage/Submit.php index e58d1ef989..c7ef21f1c0 100644 --- a/civicrm/api/v3/examples/ContributionPage/Submit.php +++ b/civicrm/api/v3/examples/ContributionPage/Submit.php @@ -26,11 +26,11 @@ function contribution_page_submit_example() { ], 'cvv2' => 123, 'pledge_id' => '1', - 'cid' => '83', - 'contact_id' => '83', + 'cid' => '4', + 'contact_id' => '4', 'amount' => '100', 'is_pledge' => TRUE, - 'pledge_block_id' => 2, + 'pledge_block_id' => 1, ]; try{ @@ -77,17 +77,17 @@ function contribution_page_submit_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Create.php b/civicrm/api/v3/examples/ContributionRecur/Create.php index dc953c9d4f..7018d2ef9f 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Create.php +++ b/civicrm/api/v3/examples/ContributionRecur/Create.php @@ -62,6 +62,7 @@ function contribution_recur_create_expectedresult() { 'create_date' => '20120130621222105', 'modified_date' => '2012-11-14 16:02:35', 'cancel_date' => '', + 'cancel_reason' => '', 'end_date' => '', 'processor_id' => '', 'payment_token_id' => '', @@ -93,17 +94,17 @@ function contribution_recur_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Delete.php b/civicrm/api/v3/examples/ContributionRecur/Delete.php index d27fe4de88..52e8b6482b 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Delete.php +++ b/civicrm/api/v3/examples/ContributionRecur/Delete.php @@ -54,17 +54,17 @@ function contribution_recur_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Get.php b/civicrm/api/v3/examples/ContributionRecur/Get.php index de3ae05666..ce054103fc 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Get.php +++ b/civicrm/api/v3/examples/ContributionRecur/Get.php @@ -74,17 +74,17 @@ function contribution_recur_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Create.php b/civicrm/api/v3/examples/ContributionSoft/Create.php index 523683a58f..83a46b9e67 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Create.php +++ b/civicrm/api/v3/examples/ContributionSoft/Create.php @@ -72,17 +72,17 @@ function contribution_soft_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Delete.php b/civicrm/api/v3/examples/ContributionSoft/Delete.php index 5c663ddaa4..8bf895bebd 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Delete.php +++ b/civicrm/api/v3/examples/ContributionSoft/Delete.php @@ -37,7 +37,12 @@ function contribution_soft_delete_example() { */ function contribution_soft_delete_expectedresult() { - $expectedResult = ''; + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ]; return $expectedResult; } @@ -49,17 +54,17 @@ function contribution_soft_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Get.php b/civicrm/api/v3/examples/ContributionSoft/Get.php index 00f58d7e95..1ac873f42f 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Get.php +++ b/civicrm/api/v3/examples/ContributionSoft/Get.php @@ -65,17 +65,17 @@ function contribution_soft_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Create.php b/civicrm/api/v3/examples/Country/Create.php index 1d76d52b87..ab03f90864 100644 --- a/civicrm/api/v3/examples/Country/Create.php +++ b/civicrm/api/v3/examples/Country/Create.php @@ -69,17 +69,17 @@ function country_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Delete.php b/civicrm/api/v3/examples/Country/Delete.php index 07676caec1..691d99a2c6 100644 --- a/civicrm/api/v3/examples/Country/Delete.php +++ b/civicrm/api/v3/examples/Country/Delete.php @@ -54,17 +54,17 @@ function country_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Get.php b/civicrm/api/v3/examples/Country/Get.php index 7ff1292414..827b2c5c0d 100644 --- a/civicrm/api/v3/examples/Country/Get.php +++ b/civicrm/api/v3/examples/Country/Get.php @@ -63,17 +63,17 @@ function country_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomField/Create.php b/civicrm/api/v3/examples/CustomField/Create.php index a29f9842cb..1d622aa3de 100644 --- a/civicrm/api/v3/examples/CustomField/Create.php +++ b/civicrm/api/v3/examples/CustomField/Create.php @@ -97,17 +97,17 @@ function custom_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomField/Delete.php b/civicrm/api/v3/examples/CustomField/Delete.php index 90c6985ef0..6ea27931d3 100644 --- a/civicrm/api/v3/examples/CustomField/Delete.php +++ b/civicrm/api/v3/examples/CustomField/Delete.php @@ -54,17 +54,17 @@ function custom_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Create.php b/civicrm/api/v3/examples/CustomGroup/Create.php index 950622f0ea..99787e2640 100644 --- a/civicrm/api/v3/examples/CustomGroup/Create.php +++ b/civicrm/api/v3/examples/CustomGroup/Create.php @@ -74,6 +74,7 @@ function custom_group_create_expectedresult() { 'created_id' => '', 'created_date' => '', 'is_reserved' => '', + 'is_public' => '', ], ], ]; @@ -88,17 +89,17 @@ function custom_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Delete.php b/civicrm/api/v3/examples/CustomGroup/Delete.php index d05b071399..f09b053b27 100644 --- a/civicrm/api/v3/examples/CustomGroup/Delete.php +++ b/civicrm/api/v3/examples/CustomGroup/Delete.php @@ -54,17 +54,17 @@ function custom_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Get.php b/civicrm/api/v3/examples/CustomGroup/Get.php index 1ed12b4930..29cc2f521b 100644 --- a/civicrm/api/v3/examples/CustomGroup/Get.php +++ b/civicrm/api/v3/examples/CustomGroup/Get.php @@ -56,6 +56,7 @@ function custom_group_get_expectedresult() { 'is_multiple' => 0, 'collapse_adv_display' => 0, 'is_reserved' => 0, + 'is_public' => '1', ], ], ]; @@ -70,17 +71,17 @@ function custom_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Domain/Create.php b/civicrm/api/v3/examples/Domain/Create.php index 328446478e..85b9fb6dbe 100644 --- a/civicrm/api/v3/examples/Domain/Create.php +++ b/civicrm/api/v3/examples/Domain/Create.php @@ -10,7 +10,7 @@ function domain_create_example() { 'name' => 'A-team domain', 'description' => 'domain of chaos', 'domain_version' => '4.2', - 'contact_id' => 6, + 'contact_id' => 7, ]; try{ @@ -51,7 +51,7 @@ function domain_create_expectedresult() { 'name' => 'A-team domain', 'description' => 'domain of chaos', 'config_backend' => '', - 'contact_id' => '6', + 'contact_id' => '7', 'locales' => '', 'locale_custom_strings' => '', 'domain_version' => '4.2', @@ -69,17 +69,17 @@ function domain_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Domain/Get.php b/civicrm/api/v3/examples/Domain/Get.php index 8ea402bbaa..9ccfc284cd 100644 --- a/civicrm/api/v3/examples/Domain/Get.php +++ b/civicrm/api/v3/examples/Domain/Get.php @@ -65,8 +65,8 @@ function domain_get_expectedresult() { 'geo_code_1' => '', 'geo_code_2' => '', ], - 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', 'domain_version' => '4.6.alpha1', ], '1' => [ @@ -91,8 +91,8 @@ function domain_get_expectedresult() { 'geo_code_1' => '41.8328', 'geo_code_2' => '-72.9253', ], - 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', 'domain_version' => '4.6.alpha1', ], ], @@ -108,17 +108,17 @@ function domain_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Create.php b/civicrm/api/v3/examples/Email/Create.php index 98abb059d1..b2db488cab 100644 --- a/civicrm/api/v3/examples/Email/Create.php +++ b/civicrm/api/v3/examples/Email/Create.php @@ -7,10 +7,9 @@ */ function email_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 23, 'email' => 'api@a-team.com', - 'is_primary' => 1, + 'on_hold' => '2', ]; try{ @@ -44,18 +43,18 @@ function email_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 3, + 'id' => 26, 'values' => [ - '3' => [ - 'id' => '3', - 'contact_id' => '3', - 'location_type_id' => '6', + '26' => [ + 'id' => '26', + 'contact_id' => '23', + 'location_type_id' => '1', 'email' => 'api@a-team.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => '2', 'is_bulkmail' => '', - 'hold_date' => '', + 'hold_date' => '20190820191652', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', @@ -68,22 +67,22 @@ function email_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateEmail" +* The test that created it is called "testEmailOnHold" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Delete.php b/civicrm/api/v3/examples/Email/Delete.php index 4f10a208cb..b872078fc5 100644 --- a/civicrm/api/v3/examples/Email/Delete.php +++ b/civicrm/api/v3/examples/Email/Delete.php @@ -7,7 +7,7 @@ */ function email_delete_example() { $params = [ - 'id' => 11, + 'id' => 12, ]; try{ @@ -54,17 +54,17 @@ function email_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Replace.php b/civicrm/api/v3/examples/Email/Replace.php index f85feea547..4623896d51 100644 --- a/civicrm/api/v3/examples/Email/Replace.php +++ b/civicrm/api/v3/examples/Email/Replace.php @@ -7,30 +7,30 @@ */ function email_replace_example() { $params = [ - 'contact_id' => 9, + 'contact_id' => 17, 'values' => [ '0' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-1@example.com', 'is_primary' => 1, ], '1' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-2@example.com', 'is_primary' => 0, ], '2' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-3@example.com', 'is_primary' => 0, ], '3' => [ - 'location_type_id' => 19, + 'location_type_id' => 35, 'email' => '2-1@example.com', 'is_primary' => 0, ], '4' => [ - 'location_type_id' => 19, + 'location_type_id' => 35, 'email' => '2-2@example.com', 'is_primary' => 0, ], @@ -69,70 +69,70 @@ function email_replace_expectedresult() { 'version' => 3, 'count' => 5, 'values' => [ - '12' => [ - 'id' => '12', - 'contact_id' => '9', - 'location_type_id' => '18', + '13' => [ + 'id' => '13', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-1@example.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '13' => [ - 'id' => '13', - 'contact_id' => '9', - 'location_type_id' => '18', + '14' => [ + 'id' => '14', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '14' => [ - 'id' => '14', - 'contact_id' => '9', - 'location_type_id' => '18', + '15' => [ + 'id' => '15', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-3@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '15' => [ - 'id' => '15', - 'contact_id' => '9', - 'location_type_id' => '19', + '16' => [ + 'id' => '16', + 'contact_id' => '17', + 'location_type_id' => '35', 'email' => '2-1@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '16' => [ - 'id' => '16', - 'contact_id' => '9', - 'location_type_id' => '19', + '17' => [ + 'id' => '17', + 'contact_id' => '17', + 'location_type_id' => '35', 'email' => '2-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -152,17 +152,17 @@ function email_replace_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Create.php b/civicrm/api/v3/examples/EntityBatch/Create.php index 71bf9bbf30..b2039d6d94 100644 --- a/civicrm/api/v3/examples/EntityBatch/Create.php +++ b/civicrm/api/v3/examples/EntityBatch/Create.php @@ -64,17 +64,17 @@ function entity_batch_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Delete.php b/civicrm/api/v3/examples/EntityBatch/Delete.php index af39a1564b..1c195417e6 100644 --- a/civicrm/api/v3/examples/EntityBatch/Delete.php +++ b/civicrm/api/v3/examples/EntityBatch/Delete.php @@ -54,17 +54,17 @@ function entity_batch_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Get.php b/civicrm/api/v3/examples/EntityBatch/Get.php index fbe65d197a..20044f5e62 100644 --- a/civicrm/api/v3/examples/EntityBatch/Get.php +++ b/civicrm/api/v3/examples/EntityBatch/Get.php @@ -64,17 +64,17 @@ function entity_batch_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityTag/Delete.php b/civicrm/api/v3/examples/EntityTag/Delete.php index f79f4925ef..51ecc823bb 100644 --- a/civicrm/api/v3/examples/EntityTag/Delete.php +++ b/civicrm/api/v3/examples/EntityTag/Delete.php @@ -7,8 +7,8 @@ */ function entity_tag_delete_example() { $params = [ - 'contact_id_h' => 31, - 'tag_id' => '15', + 'contact_id_h' => 43, + 'tag_id' => '19', ]; try{ @@ -55,17 +55,17 @@ function entity_tag_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityTag/Get.php b/civicrm/api/v3/examples/EntityTag/Get.php index 94bb042ccc..5312259a60 100644 --- a/civicrm/api/v3/examples/EntityTag/Get.php +++ b/civicrm/api/v3/examples/EntityTag/Get.php @@ -7,7 +7,7 @@ */ function entity_tag_get_example() { $params = [ - 'contact_id' => 15, + 'contact_id' => 18, ]; try{ @@ -46,8 +46,8 @@ function entity_tag_get_expectedresult() { '5' => [ 'id' => '5', 'entity_table' => 'civicrm_contact', - 'entity_id' => '15', - 'tag_id' => '10', + 'entity_id' => '18', + 'tag_id' => '11', ], ], ]; @@ -62,17 +62,17 @@ function entity_tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/ContactRefCustomField.php b/civicrm/api/v3/examples/Event/ContactRefCustomField.php index 776dcc35a7..a492401dee 100644 --- a/civicrm/api/v3/examples/Event/ContactRefCustomField.php +++ b/civicrm/api/v3/examples/Event/ContactRefCustomField.php @@ -93,17 +93,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Create.php b/civicrm/api/v3/examples/Event/Create.php index b94693c427..0a9977424c 100644 --- a/civicrm/api/v3/examples/Event/Create.php +++ b/civicrm/api/v3/examples/Event/Create.php @@ -141,17 +141,17 @@ function event_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Delete.php b/civicrm/api/v3/examples/Event/Delete.php index 9e50397cca..99e53f4ab0 100644 --- a/civicrm/api/v3/examples/Event/Delete.php +++ b/civicrm/api/v3/examples/Event/Delete.php @@ -54,17 +54,17 @@ function event_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Get.php b/civicrm/api/v3/examples/Event/Get.php index a616f289f2..5eb8a9e871 100644 --- a/civicrm/api/v3/examples/Event/Get.php +++ b/civicrm/api/v3/examples/Event/Get.php @@ -88,17 +88,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/IsCurrentOption.php b/civicrm/api/v3/examples/Event/IsCurrentOption.php index 1c3cc7f06b..c43d238240 100644 --- a/civicrm/api/v3/examples/Event/IsCurrentOption.php +++ b/civicrm/api/v3/examples/Event/IsCurrentOption.php @@ -96,17 +96,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/IsFullOption.php b/civicrm/api/v3/examples/Event/IsFullOption.php index 4afe21ddc2..6954a283eb 100644 --- a/civicrm/api/v3/examples/Event/IsFullOption.php +++ b/civicrm/api/v3/examples/Event/IsFullOption.php @@ -67,7 +67,7 @@ function event_getsingle_expectedresult() { 'allow_selfcancelxfer' => 0, 'selfcancelxfer_time' => 0, 'is_template' => 0, - 'created_date' => '2017-02-07 02:22:22', + 'created_date' => '2019-08-20 19:17:20', 'is_share' => '1', 'is_confirm_enabled' => '1', 'is_billing_required' => 0, @@ -85,17 +85,17 @@ function event_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Create.php b/civicrm/api/v3/examples/Grant/Create.php index ceb0dd71ce..80c79bab87 100644 --- a/civicrm/api/v3/examples/Grant/Create.php +++ b/civicrm/api/v3/examples/Grant/Create.php @@ -80,17 +80,17 @@ function grant_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Delete.php b/civicrm/api/v3/examples/Grant/Delete.php index 4c0222a01e..8ef84ffc35 100644 --- a/civicrm/api/v3/examples/Grant/Delete.php +++ b/civicrm/api/v3/examples/Grant/Delete.php @@ -54,17 +54,17 @@ function grant_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Get.php b/civicrm/api/v3/examples/Grant/Get.php index a85ffc2317..16692d60bf 100644 --- a/civicrm/api/v3/examples/Grant/Get.php +++ b/civicrm/api/v3/examples/Grant/Get.php @@ -45,7 +45,7 @@ function grant_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '5', + 'contact_id' => '3', 'application_received_date' => '20130728084957', 'decision_date' => '20130805000000', 'grant_type_id' => '1', @@ -67,17 +67,17 @@ function grant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Group/Get.php b/civicrm/api/v3/examples/Group/Get.php index 9c6f7c0e14..f2a35bf736 100644 --- a/civicrm/api/v3/examples/Group/Get.php +++ b/civicrm/api/v3/examples/Group/Get.php @@ -41,18 +41,18 @@ function group_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 4, + 'id' => 1, 'values' => [ - '4' => [ - 'id' => '4', + '1' => [ + 'id' => '1', 'name' => 'Test Group 1', 'title' => 'New Test Group Created', 'description' => 'New Test Group Created', 'is_active' => '1', 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', + 'where_clause' => ' ( ( ( `civicrm_group_contact-5d5bbacea0631`.group_id IN (\"1\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:37:\"`civicrm_group_contact-5d5bbacea0631`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbacea0631` ON (contact_a.id = `civicrm_group_contact-5d5bbacea0631`.contact_id AND `civicrm_group_contact-5d5bbacea0631`.status IN (\'Added\'))\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:37:\"`civicrm_group_contact-5d5bbacea0631`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbacea0631` ON (contact_a.id = `civicrm_group_contact-5d5bbacea0631`.contact_id AND `civicrm_group_contact-5d5bbacea0631`.status IN (\'Added\'))\";}', 'group_type' => [ '0' => '1', '1' => '2', @@ -73,17 +73,17 @@ function group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Group/GetFields.php b/civicrm/api/v3/examples/Group/GetFields.php index a93b6f8754..09d09af2a4 100644 --- a/civicrm/api/v3/examples/Group/GetFields.php +++ b/civicrm/api/v3/examples/Group/GetFields.php @@ -50,9 +50,12 @@ function group_getfields_expectedresult() { 'title' => 'Group ID', 'description' => 'Group ID', 'required' => TRUE, + 'where' => 'civicrm_group.id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'group_id', ], @@ -64,9 +67,12 @@ function group_getfields_expectedresult() { 'description' => 'Internal name of Group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.name', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'title' => [ 'name' => 'title', @@ -75,9 +81,17 @@ function group_getfields_expectedresult() { 'description' => 'Name of Group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.title', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 1, + 'html' => [ + 'type' => 'Text', + 'maxlength' => 64, + 'size' => 30, + ], + 'is_core_field' => TRUE, 'api.required' => 1, ], 'description' => [ @@ -87,14 +101,17 @@ function group_getfields_expectedresult() { 'description' => 'Optional verbose description of the group.', 'rows' => 2, 'cols' => 60, + 'where' => 'civicrm_group.description', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'html' => [ 'type' => 'TextArea', 'rows' => 2, 'cols' => 60, ], + 'is_core_field' => TRUE, ], 'source' => [ 'name' => 'source', @@ -103,19 +120,25 @@ function group_getfields_expectedresult() { 'description' => 'Module or process which created this group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.source', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'saved_search_id' => [ 'name' => 'saved_search_id', 'type' => 1, 'title' => 'Saved Search ID', 'description' => 'FK to saved search table.', + 'where' => 'civicrm_group.saved_search_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', + 'is_core_field' => TRUE, 'FKApiName' => 'SavedSearch', ], 'is_active' => [ @@ -123,9 +146,12 @@ function group_getfields_expectedresult() { 'type' => 16, 'title' => 'Group Enabled', 'description' => 'Is this entry active?', + 'where' => 'civicrm_group.is_active', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.default' => 1, ], 'visibility' => [ @@ -135,10 +161,12 @@ function group_getfields_expectedresult() { 'description' => 'In what context(s) is this field visible.', 'maxlength' => 24, 'size' => 20, + 'where' => 'civicrm_group.visibility', 'default' => 'User and User Admin Only', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 24, @@ -147,33 +175,45 @@ function group_getfields_expectedresult() { 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', ], + 'is_core_field' => TRUE, ], 'where_clause' => [ 'name' => 'where_clause', 'type' => 32, 'title' => 'Group Where Clause', 'description' => 'the sql where clause if a saved search acl', + 'where' => 'civicrm_group.where_clause', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'select_tables' => [ 'name' => 'select_tables', 'type' => 32, 'title' => 'Tables For Select Clause', 'description' => 'the tables to be included in a select data', + 'where' => 'civicrm_group.select_tables', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 4, + 'is_core_field' => TRUE, ], 'where_tables' => [ 'name' => 'where_tables', 'type' => 32, 'title' => 'Tables For Where Clause', 'description' => 'the tables to be included in the count statement', + 'where' => 'civicrm_group.where_tables', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 4, + 'is_core_field' => TRUE, ], 'group_type' => [ 'name' => 'group_type', @@ -182,13 +222,17 @@ function group_getfields_expectedresult() { 'description' => 'FK to group type', 'maxlength' => 128, 'size' => 45, + 'where' => 'civicrm_group.group_type', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 1, 'pseudoconstant' => [ 'optionGroupName' => 'group_type', 'optionEditPath' => 'civicrm/admin/options/group_type', ], + 'is_core_field' => TRUE, ], 'cache_date' => [ 'name' => 'cache_date', @@ -196,9 +240,12 @@ function group_getfields_expectedresult() { 'title' => 'Group Cache Date', 'description' => 'Date when we created the cache for a smart group', 'required' => '', + 'where' => 'civicrm_group.cache_date', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'refresh_date' => [ 'name' => 'refresh_date', @@ -206,54 +253,76 @@ function group_getfields_expectedresult() { 'title' => 'Next Group Refresh Time', 'description' => 'Date and time when we need to refresh the cache next.', 'required' => '', + 'where' => 'civicrm_group.refresh_date', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'parents' => [ 'name' => 'parents', 'type' => 32, 'title' => 'Group Parents', 'description' => 'IDs of the parent(s)', + 'where' => 'civicrm_group.parents', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 5, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_PseudoConstant::allGroup', + ], + 'is_core_field' => TRUE, ], 'children' => [ 'name' => 'children', 'type' => 32, 'title' => 'Group Children', 'description' => 'IDs of the child(ren)', + 'where' => 'civicrm_group.children', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_hidden' => [ 'name' => 'is_hidden', 'type' => 16, 'title' => 'Group is Hidden', 'description' => 'Is this group hidden?', + 'where' => 'civicrm_group.is_hidden', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Group is Reserved', + 'where' => 'civicrm_group.is_reserved', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'created_id' => [ 'name' => 'created_id', 'type' => 1, 'title' => 'Group Created By', 'description' => 'FK to contact table.', + 'where' => 'civicrm_group.created_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'modified_id' => [ @@ -261,10 +330,13 @@ function group_getfields_expectedresult() { 'type' => 1, 'title' => 'Group Modified By', 'description' => 'FK to contact table.', + 'where' => 'civicrm_group.modified_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], ], @@ -280,17 +352,17 @@ function group_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Create.php b/civicrm/api/v3/examples/GroupContact/Create.php index 4f8eff192c..afb9496b78 100644 --- a/civicrm/api/v3/examples/GroupContact/Create.php +++ b/civicrm/api/v3/examples/GroupContact/Create.php @@ -59,17 +59,17 @@ function group_contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Delete.php b/civicrm/api/v3/examples/GroupContact/Delete.php index b87de53d2a..0f4db2245f 100644 --- a/civicrm/api/v3/examples/GroupContact/Delete.php +++ b/civicrm/api/v3/examples/GroupContact/Delete.php @@ -58,17 +58,17 @@ function group_contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Get.php b/civicrm/api/v3/examples/GroupContact/Get.php index a8dda828c6..e7718d5511 100644 --- a/civicrm/api/v3/examples/GroupContact/Get.php +++ b/civicrm/api/v3/examples/GroupContact/Get.php @@ -65,17 +65,17 @@ function group_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php b/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php index e60f16df58..2607a81f7f 100644 --- a/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php +++ b/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php @@ -65,9 +65,9 @@ function group_contact_get_expectedresult() { 'description' => 'New Test Group Created', 'is_active' => '1', 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-3`.group_id IN ( 3 ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', + 'where_clause' => ' ( ( ( `civicrm_group_contact-5d5bbabeb0cbd`.group_id IN (\"3\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:37:\"`civicrm_group_contact-5d5bbabeb0cbd`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbabeb0cbd` ON (contact_a.id = `civicrm_group_contact-5d5bbabeb0cbd`.contact_id AND `civicrm_group_contact-5d5bbabeb0cbd`.status IN (\'Added\'))\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:37:\"`civicrm_group_contact-5d5bbabeb0cbd`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbabeb0cbd` ON (contact_a.id = `civicrm_group_contact-5d5bbabeb0cbd`.contact_id AND `civicrm_group_contact-5d5bbabeb0cbd`.status IN (\'Added\'))\";}', 'group_type' => [ '0' => '1', '1' => '2', @@ -91,17 +91,17 @@ function group_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Create.php b/civicrm/api/v3/examples/GroupNesting/Create.php index f450996409..a25f5bb463 100644 --- a/civicrm/api/v3/examples/GroupNesting/Create.php +++ b/civicrm/api/v3/examples/GroupNesting/Create.php @@ -42,9 +42,13 @@ function group_nesting_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 'is_error', + 'id' => 2, 'values' => [ - 'is_error' => 0, + '2' => [ + 'id' => '2', + 'child_group_id' => '3', + 'parent_group_id' => '1', + ], ], ]; @@ -58,17 +62,17 @@ function group_nesting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Delete.php b/civicrm/api/v3/examples/GroupNesting/Delete.php index baaea1baaa..dc99c74c88 100644 --- a/civicrm/api/v3/examples/GroupNesting/Delete.php +++ b/civicrm/api/v3/examples/GroupNesting/Delete.php @@ -54,17 +54,17 @@ function group_nesting_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Get.php b/civicrm/api/v3/examples/GroupNesting/Get.php index 3e19ef53b1..40631a5cc3 100644 --- a/civicrm/api/v3/examples/GroupNesting/Get.php +++ b/civicrm/api/v3/examples/GroupNesting/Get.php @@ -62,17 +62,17 @@ function group_nesting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Create.php b/civicrm/api/v3/examples/GroupOrganization/Create.php index 1a66937578..9d812d508a 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Create.php +++ b/civicrm/api/v3/examples/GroupOrganization/Create.php @@ -41,12 +41,14 @@ function group_organization_create_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 3, + 'count' => 1, 'id' => 3, 'values' => [ - 'id' => '3', - 'group_id' => '6', - 'organization_id' => '8', + '3' => [ + 'id' => '3', + 'group_id' => '6', + 'organization_id' => '8', + ], ], ]; @@ -60,17 +62,17 @@ function group_organization_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Delete.php b/civicrm/api/v3/examples/GroupOrganization/Delete.php index 79f776f3b0..722934bf19 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Delete.php +++ b/civicrm/api/v3/examples/GroupOrganization/Delete.php @@ -54,17 +54,17 @@ function group_organization_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Get.php b/civicrm/api/v3/examples/GroupOrganization/Get.php index 1ebfc68c3f..500c215a79 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Get.php +++ b/civicrm/api/v3/examples/GroupOrganization/Get.php @@ -54,17 +54,17 @@ function group_organization_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Create.php b/civicrm/api/v3/examples/Im/Create.php index c32a2ea5f8..dda5c2ccf6 100644 --- a/civicrm/api/v3/examples/Im/Create.php +++ b/civicrm/api/v3/examples/Im/Create.php @@ -7,9 +7,8 @@ */ function im_create_example() { $params = [ - 'contact_id' => 3, + 'contact_id' => 5, 'name' => 'My Yahoo IM Handle', - 'location_type_id' => 1, 'provider_id' => 1, ]; @@ -44,11 +43,11 @@ function im_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 2, 'values' => [ - '1' => [ - 'id' => '1', - 'contact_id' => '3', + '2' => [ + 'id' => '2', + 'contact_id' => '5', 'location_type_id' => '1', 'name' => 'My Yahoo IM Handle', 'provider_id' => '1', @@ -63,22 +62,22 @@ function im_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateIm" +* The test that created it is called "testCreateImDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Delete.php b/civicrm/api/v3/examples/Im/Delete.php index 81438d7302..975bfac70b 100644 --- a/civicrm/api/v3/examples/Im/Delete.php +++ b/civicrm/api/v3/examples/Im/Delete.php @@ -7,7 +7,7 @@ */ function im_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function im_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Get.php b/civicrm/api/v3/examples/Im/Get.php index 90d23fe359..e2cacaad3f 100644 --- a/civicrm/api/v3/examples/Im/Get.php +++ b/civicrm/api/v3/examples/Im/Get.php @@ -7,7 +7,7 @@ */ function im_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 7, 'name' => 'My Yahoo IM Handle', 'location_type_id' => 1, 'provider_id' => 1, @@ -44,11 +44,11 @@ function im_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '4', + '3' => [ + 'id' => '3', + 'contact_id' => '7', 'location_type_id' => '1', 'name' => 'My Yahoo IM Handle', 'provider_id' => '1', @@ -68,17 +68,17 @@ function im_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Job/Clone.php b/civicrm/api/v3/examples/Job/Clone.php new file mode 100644 index 0000000000..b2235b8854 --- /dev/null +++ b/civicrm/api/v3/examples/Job/Clone.php @@ -0,0 +1,83 @@ +<?php +/** + * Test Generated example demonstrating the Job.clone API. + * + * @return array + * API result array + */ +function job_clone_example() { + $params = [ + 'id' => 31, + ]; + + try{ + $result = civicrm_api3('Job', 'clone', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function job_clone_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 32, + 'values' => [ + '32' => [ + 'id' => '32', + 'domain_id' => '1', + 'run_frequency' => 'Daily', + 'name' => 'API_Test_Job - Copy', + 'description' => 'A long description written by hand in cursive', + 'api_entity' => 'ApiTestEntity', + 'api_action' => 'apitestaction', + 'parameters' => 'Semi-formal explanation of runtime job parameters', + 'is_active' => '1', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testClone" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Job/Create.php b/civicrm/api/v3/examples/Job/Create.php index 3e64c91d75..5109836ee9 100644 --- a/civicrm/api/v3/examples/Job/Create.php +++ b/civicrm/api/v3/examples/Job/Create.php @@ -76,17 +76,17 @@ function job_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Job/Delete.php b/civicrm/api/v3/examples/Job/Delete.php index 3fb1143598..6bbd95169a 100644 --- a/civicrm/api/v3/examples/Job/Delete.php +++ b/civicrm/api/v3/examples/Job/Delete.php @@ -7,7 +7,7 @@ */ function job_delete_example() { $params = [ - 'id' => 31, + 'id' => 33, ]; try{ @@ -49,17 +49,17 @@ function job_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Create.php b/civicrm/api/v3/examples/LineItem/Create.php index 44d2276096..050bcfa25d 100644 --- a/civicrm/api/v3/examples/LineItem/Create.php +++ b/civicrm/api/v3/examples/LineItem/Create.php @@ -79,17 +79,17 @@ function line_item_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Delete.php b/civicrm/api/v3/examples/LineItem/Delete.php index 2381abb562..a84be8f560 100644 --- a/civicrm/api/v3/examples/LineItem/Delete.php +++ b/civicrm/api/v3/examples/LineItem/Delete.php @@ -54,17 +54,17 @@ function line_item_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Get.php b/civicrm/api/v3/examples/LineItem/Get.php index 68a319605b..2e5d7fa2ec 100644 --- a/civicrm/api/v3/examples/LineItem/Get.php +++ b/civicrm/api/v3/examples/LineItem/Get.php @@ -71,17 +71,17 @@ function line_item_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/Create.php b/civicrm/api/v3/examples/LocBlock/Create.php index 723137931c..b752ec02a6 100644 --- a/civicrm/api/v3/examples/LocBlock/Create.php +++ b/civicrm/api/v3/examples/LocBlock/Create.php @@ -71,17 +71,17 @@ function loc_block_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/CreateEntities.php b/civicrm/api/v3/examples/LocBlock/CreateEntities.php index 2cb6213339..1ac4588448 100644 --- a/civicrm/api/v3/examples/LocBlock/CreateEntities.php +++ b/civicrm/api/v3/examples/LocBlock/CreateEntities.php @@ -76,7 +76,7 @@ function loc_block_create_expectedresult() { 'email' => 'test2@loc.block', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -130,17 +130,17 @@ function loc_block_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/Get.php b/civicrm/api/v3/examples/LocBlock/Get.php index dccde31f7b..926c03d45e 100644 --- a/civicrm/api/v3/examples/LocBlock/Get.php +++ b/civicrm/api/v3/examples/LocBlock/Get.php @@ -99,17 +99,17 @@ function loc_block_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Logging/Get.php b/civicrm/api/v3/examples/Logging/Get.php index f6d921898b..a0a26f4c25 100644 --- a/civicrm/api/v3/examples/Logging/Get.php +++ b/civicrm/api/v3/examples/Logging/Get.php @@ -49,7 +49,7 @@ function logging_get_expectedresult() { 'from' => 'Anderson, Anthony', 'to' => 'Dwarf, Dopey', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '1' => [ @@ -59,7 +59,7 @@ function logging_get_expectedresult() { 'from' => 'Mr. Anthony Anderson II', 'to' => 'Mr. Dopey Dwarf II', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '2' => [ @@ -69,7 +69,7 @@ function logging_get_expectedresult() { 'from' => 'Anthony', 'to' => 'Dopey', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '3' => [ @@ -79,17 +79,17 @@ function logging_get_expectedresult() { 'from' => 'Anderson', 'to' => 'Dwarf', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '4' => [ 'action' => 'Update', 'id' => '3', 'field' => 'modified_date', - 'from' => '2017-02-07 02:36:28', - 'to' => '2017-02-07 02:36:46', + 'from' => '2019-08-20 19:23:20', + 'to' => '2019-08-20 19:23:24', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '5' => [ @@ -99,7 +99,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '2', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '6' => [ @@ -109,7 +109,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '3', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '7' => [ @@ -117,9 +117,9 @@ function logging_get_expectedresult() { 'id' => '2', 'field' => 'location_type_id', 'from' => '', - 'to' => '', + 'to' => '1', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '8' => [ @@ -129,7 +129,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 'dopey@mail.com', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '9' => [ @@ -139,7 +139,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '10' => [ @@ -149,7 +149,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '11' => [ @@ -159,7 +159,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '12' => [ @@ -169,7 +169,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '13' => [ @@ -179,7 +179,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '14' => [ @@ -189,7 +189,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '15' => [ @@ -199,7 +199,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '16' => [ @@ -209,7 +209,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], ], @@ -225,17 +225,17 @@ function logging_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LoggingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Logging/Revert.php b/civicrm/api/v3/examples/Logging/Revert.php index 01642fc870..32fa318ff2 100644 --- a/civicrm/api/v3/examples/Logging/Revert.php +++ b/civicrm/api/v3/examples/Logging/Revert.php @@ -8,7 +8,7 @@ function logging_revert_example() { $params = [ 'log_conn_id' => 'woot', - 'log_date' => '2017-02-07 02:35:06', + 'log_date' => '2019-08-20 19:22:48', ]; try{ @@ -50,22 +50,22 @@ function logging_revert_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "/Users/emcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/tests/phpunit/api/v3/LoggingTest.php" +* The test that created it is called "/home/seamus/buildkit/build/47-test/sites/all/modules/civicrm/tests/phpunit/api/v3/LoggingTest.php" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/Revert * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php b/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php index 966d269684..b243259d28 100644 --- a/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php +++ b/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php @@ -9,7 +9,7 @@ */ function mail_settings_get_example() { $params = [ - 'title' => 'MailSettings title', + 'name' => 'delete this setting', 'api.MailSettings.delete' => 1, ]; @@ -43,27 +43,16 @@ function mail_settings_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 2, + 'count' => 1, + 'id' => 6, 'values' => [ - '1' => [ - 'id' => '1', - 'domain_id' => '1', - 'name' => 'default', - 'is_default' => 0, - 'domain' => 'EXAMPLE.ORG', - 'api.MailSettings.delete' => [ - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ], - ], '6' => [ 'id' => '6', 'domain_id' => '1', - 'name' => 'my mail setting', + 'name' => 'delete this setting', 'is_default' => '1', 'domain' => 'setting.com', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -88,17 +77,17 @@ function mail_settings_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Create.php b/civicrm/api/v3/examples/MailSettings/Create.php index 43fbf43856..08eba66597 100644 --- a/civicrm/api/v3/examples/MailSettings/Create.php +++ b/civicrm/api/v3/examples/MailSettings/Create.php @@ -10,7 +10,7 @@ function mail_settings_create_example() { 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', - 'local_part' => 'civicrm+', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -56,7 +56,7 @@ function mail_settings_create_expectedresult() { 'name' => 'my mail setting', 'is_default' => '1', 'domain' => 'setting.com', - 'localpart' => '', + 'localpart' => 'civicrm+', 'return_path' => '', 'protocol' => '', 'server' => 'localhost', @@ -65,6 +65,7 @@ function mail_settings_create_expectedresult() { 'password' => 'pass', 'is_ssl' => '', 'source' => '', + 'activity_status' => '', ], ], ]; @@ -79,17 +80,17 @@ function mail_settings_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Delete.php b/civicrm/api/v3/examples/MailSettings/Delete.php index a1cc7a50b4..dbfc74cfc5 100644 --- a/civicrm/api/v3/examples/MailSettings/Delete.php +++ b/civicrm/api/v3/examples/MailSettings/Delete.php @@ -54,17 +54,17 @@ function mail_settings_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Get.php b/civicrm/api/v3/examples/MailSettings/Get.php index 19c75bb4be..42d80d7c2e 100644 --- a/civicrm/api/v3/examples/MailSettings/Get.php +++ b/civicrm/api/v3/examples/MailSettings/Get.php @@ -10,7 +10,7 @@ function mail_settings_get_example() { 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', - 'local_part' => 'civicrm+', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -56,6 +56,7 @@ function mail_settings_get_expectedresult() { 'name' => 'my mail setting', 'is_default' => '1', 'domain' => 'setting.com', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -74,17 +75,17 @@ function mail_settings_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/GetOptions.php b/civicrm/api/v3/examples/MailSettings/GetOptions.php index 5a8de53942..a1c39a2fcb 100644 --- a/civicrm/api/v3/examples/MailSettings/GetOptions.php +++ b/civicrm/api/v3/examples/MailSettings/GetOptions.php @@ -59,17 +59,17 @@ function mail_settings_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Clone.php b/civicrm/api/v3/examples/Mailing/Clone.php index 7d5c86c2c5..46b12fa62b 100644 --- a/civicrm/api/v3/examples/Mailing/Clone.php +++ b/civicrm/api/v3/examples/Mailing/Clone.php @@ -7,7 +7,7 @@ */ function mailing_clone_example() { $params = [ - 'id' => 21, + 'id' => 27, ]; try{ @@ -41,10 +41,10 @@ function mailing_clone_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 22, + 'id' => 28, 'values' => [ - '22' => [ - 'id' => '22', + '28' => [ + 'id' => '28', 'domain_id' => '1', 'header_id' => '1', 'footer_id' => '2', @@ -63,7 +63,7 @@ function mailing_clone_expectedresult() { 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<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>', 'url_tracking' => '1', 'forward_replies' => 0, 'auto_responder' => 0, @@ -71,15 +71,16 @@ https://civicrm.org 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '147', + 'created_id' => '154', 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', 'scheduled_id' => '', 'scheduled_date' => '', 'approver_id' => '', 'approval_date' => '', 'approval_status_id' => '', 'approval_note' => '', - 'is_archived' => '', + 'is_archived' => 0, 'visibility' => 'Public Pages', 'campaign_id' => '', 'dedupe_email' => '1', @@ -102,17 +103,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Create.php b/civicrm/api/v3/examples/Mailing/Create.php index 026d9fc2c1..6562c989a0 100644 --- a/civicrm/api/v3/examples/Mailing/Create.php +++ b/civicrm/api/v3/examples/Mailing/Create.php @@ -11,17 +11,17 @@ function mailing_create_example() { 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<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' => 3, + 'created_id' => 15, 'header_id' => '', 'footer_id' => '', 'groups' => [ 'include' => [ - '0' => 2, + '0' => 13, ], 'exclude' => [ - '0' => 3, + '0' => 14, ], ], 'mailings' => [ @@ -31,7 +31,6 @@ https://civicrm.org 'options' => [ 'force_rollback' => 1, ], - 'api.mailing_job.create' => 1, 'api.MailingRecipients.get' => [ 'mailing_id' => '$value.id', 'api.contact.getvalue' => [ @@ -74,10 +73,10 @@ function mailing_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 9, 'values' => [ - '1' => [ - 'id' => '1', + '9' => [ + 'id' => '9', 'domain_id' => '1', 'header_id' => '', 'footer_id' => '', @@ -90,69 +89,49 @@ function mailing_create_expectedresult() { 'from_name' => 'FIXME', 'from_email' => 'info@EXAMPLE.ORG', 'replyto_email' => 'info@EXAMPLE.ORG', - 'template_type' => '', + 'template_type' => 'traditional', 'template_options' => '', 'subject' => 'Hello {contact.display_name}', 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<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>', 'url_tracking' => '1', - 'forward_replies' => '', - 'auto_responder' => '', + 'forward_replies' => 0, + 'auto_responder' => 0, 'open_tracking' => '1', 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '3', + 'created_id' => '15', 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', 'scheduled_id' => '', 'scheduled_date' => '', 'approver_id' => '', 'approval_date' => '', 'approval_status_id' => '', 'approval_note' => '', - 'is_archived' => '', + 'is_archived' => 0, 'visibility' => 'Public Pages', 'campaign_id' => '', 'dedupe_email' => '1', 'sms_provider_id' => '', 'hash' => '', 'location_type_id' => '', - 'email_selection_method' => '', + 'email_selection_method' => 'automatic', 'language' => '', - 'api.mailing_job.create' => [ - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => [ - '0' => [ - 'id' => '1', - 'mailing_id' => '1', - 'scheduled_date' => '20130728085413', - 'start_date' => '', - 'end_date' => '', - 'status' => 'Scheduled', - 'is_test' => 0, - 'job_type' => '', - 'parent_id' => '', - 'job_offset' => '', - 'job_limit' => '', - ], - ], - ], 'api.MailingRecipients.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 4, 'values' => [ '0' => [ - 'id' => '1', - 'mailing_id' => '1', - 'contact_id' => '4', - 'email_id' => '4', + 'id' => '4', + 'mailing_id' => '9', + 'contact_id' => '16', + 'email_id' => '16', 'api.contact.getvalue' => 'Mr. Includer Person II', 'api.email.getvalue' => 'include.me@example.org', ], @@ -172,17 +151,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Delete.php b/civicrm/api/v3/examples/Mailing/Delete.php index b2df37d02a..b0070b6eb4 100644 --- a/civicrm/api/v3/examples/Mailing/Delete.php +++ b/civicrm/api/v3/examples/Mailing/Delete.php @@ -7,7 +7,7 @@ */ function mailing_delete_example() { $params = [ - 'id' => 20, + 'id' => 26, ]; try{ @@ -54,17 +54,17 @@ function mailing_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/GetTokens.php b/civicrm/api/v3/examples/Mailing/GetTokens.php index 856e279527..bc343a4237 100644 --- a/civicrm/api/v3/examples/Mailing/GetTokens.php +++ b/civicrm/api/v3/examples/Mailing/GetTokens.php @@ -46,7 +46,7 @@ function mailing_gettokens_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 82, + 'count' => 88, 'values' => [ '{action.unsubscribe}' => 'Unsubscribe via email', '{action.unsubscribeUrl}' => 'Unsubscribe via web page', @@ -88,6 +88,9 @@ function mailing_gettokens_expectedresult() { '{contact.individual_suffix}' => 'Individual Suffix', '{contact.formal_title}' => 'Formal Title', '{contact.communication_style}' => 'Communication Style', + '{contact.email_greeting_id}' => 'Email Greeting ID', + '{contact.postal_greeting_id}' => 'Postal Greeting ID', + '{contact.addressee_id}' => 'Addressee ID', '{contact.job_title}' => 'Job Title', '{contact.gender}' => 'Gender', '{contact.birth_date}' => 'Birth Date', @@ -113,6 +116,7 @@ function mailing_gettokens_expectedresult() { '{contact.postal_code}' => 'Postal Code', '{contact.geo_code_1}' => 'Latitude', '{contact.geo_code_2}' => 'Longitude', + '{contact.manual_geo_code}' => 'Is Manually Geocoded', '{contact.address_name}' => 'Address Name', '{contact.master_id}' => 'Master Address Belongs To', '{contact.county}' => 'County', @@ -120,6 +124,7 @@ function mailing_gettokens_expectedresult() { '{contact.country}' => 'Country', '{contact.phone}' => 'Phone', '{contact.phone_ext}' => 'Phone Extension', + '{contact.phone_type_id}' => 'Phone Type', '{contact.email}' => 'Email', '{contact.on_hold}' => 'On Hold', '{contact.signature_text}' => 'Signature Text', @@ -144,17 +149,17 @@ function mailing_gettokens_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Submit.php b/civicrm/api/v3/examples/Mailing/Submit.php index d2971de198..059ac070e7 100644 --- a/civicrm/api/v3/examples/Mailing/Submit.php +++ b/civicrm/api/v3/examples/Mailing/Submit.php @@ -9,7 +9,7 @@ function mailing_submit_example() { $params = [ 'scheduled_date' => '2014-12-13 10:00:00', 'approval_date' => '2014-12-13 00:00:00', - 'id' => 18, + 'id' => 22, ]; try{ @@ -43,13 +43,13 @@ function mailing_submit_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 18, + 'id' => 22, 'values' => [ - '18' => [ - 'id' => '18', + '22' => [ + 'id' => '22', 'domain_id' => '1', 'header_id' => '', - 'footer_id' => '27', + 'footer_id' => '31', 'reply_id' => '8', 'unsubscribe_id' => '5', 'resubscribe_id' => '6', @@ -73,11 +73,12 @@ https://civicrm.org 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '40', + 'created_id' => '45', 'created_date' => '2013-07-28 08:49:19', - 'scheduled_id' => '41', + 'modified_date' => '2012-11-14 16:02:35', + 'scheduled_id' => '46', 'scheduled_date' => '20130728085413', - 'approver_id' => '41', + 'approver_id' => '46', 'approval_date' => '20130728085413', 'approval_status_id' => '1', 'approval_note' => '', @@ -104,17 +105,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailingAB/Create.php b/civicrm/api/v3/examples/MailingAB/Create.php index 735ad9ca37..8a53d6ca71 100644 --- a/civicrm/api/v3/examples/MailingAB/Create.php +++ b/civicrm/api/v3/examples/MailingAB/Create.php @@ -60,7 +60,7 @@ function mailing_a_b_create_expectedresult() { 'testing_criteria' => 'subject', 'winner_criteria' => 'open', 'specific_url' => '', - 'declare_winning_time' => '20170209023708', + 'declare_winning_time' => '20190822192332', 'group_percentage' => '10', 'created_id' => '3', 'created_date' => '2013-07-28 08:49:19', @@ -78,17 +78,17 @@ function mailing_a_b_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingABTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailingEventSubscribe/Create.php b/civicrm/api/v3/examples/MailingEventSubscribe/Create.php index a36db91cb5..01a5127b75 100644 --- a/civicrm/api/v3/examples/MailingEventSubscribe/Create.php +++ b/civicrm/api/v3/examples/MailingEventSubscribe/Create.php @@ -65,17 +65,17 @@ function mailing_event_subscribe_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Create.php b/civicrm/api/v3/examples/Mapping/Create.php index cfeb6060a5..4d5258489b 100644 --- a/civicrm/api/v3/examples/Mapping/Create.php +++ b/civicrm/api/v3/examples/Mapping/Create.php @@ -64,17 +64,17 @@ function mapping_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Delete.php b/civicrm/api/v3/examples/Mapping/Delete.php index 41b355bb33..33529d7cb3 100644 --- a/civicrm/api/v3/examples/Mapping/Delete.php +++ b/civicrm/api/v3/examples/Mapping/Delete.php @@ -54,17 +54,17 @@ function mapping_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Get.php b/civicrm/api/v3/examples/Mapping/Get.php index 2235f5075e..96161bb1d3 100644 --- a/civicrm/api/v3/examples/Mapping/Get.php +++ b/civicrm/api/v3/examples/Mapping/Get.php @@ -64,17 +64,17 @@ function mapping_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Create.php b/civicrm/api/v3/examples/MappingField/Create.php index 093863a69b..2841970b27 100644 --- a/civicrm/api/v3/examples/MappingField/Create.php +++ b/civicrm/api/v3/examples/MappingField/Create.php @@ -76,17 +76,17 @@ function mapping_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Delete.php b/civicrm/api/v3/examples/MappingField/Delete.php index ddc050529d..0dad4e6fd5 100644 --- a/civicrm/api/v3/examples/MappingField/Delete.php +++ b/civicrm/api/v3/examples/MappingField/Delete.php @@ -54,17 +54,17 @@ function mapping_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Get.php b/civicrm/api/v3/examples/MappingField/Get.php index 8fac202097..a2fa16de31 100644 --- a/civicrm/api/v3/examples/MappingField/Get.php +++ b/civicrm/api/v3/examples/MappingField/Get.php @@ -68,17 +68,17 @@ function mapping_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Create.php b/civicrm/api/v3/examples/Membership/Create.php index 7285304133..091043fb85 100644 --- a/civicrm/api/v3/examples/Membership/Create.php +++ b/civicrm/api/v3/examples/Membership/Create.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 79, - 'membership_type_id' => 47, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2006-01-21', 'start_date' => '2006-01-21', 'end_date' => '2006-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 30, + 'status_id' => 31, ]; try{ @@ -52,14 +52,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '79', - 'membership_type_id' => '47', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20060121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '30', + 'status_id' => '31', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -80,17 +81,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/CreateWithCustomData.php b/civicrm/api/v3/examples/Membership/CreateWithCustomData.php index 13651a3c95..8a108197c9 100644 --- a/civicrm/api/v3/examples/Membership/CreateWithCustomData.php +++ b/civicrm/api/v3/examples/Membership/CreateWithCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 91, - 'membership_type_id' => 55, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 34, + 'status_id' => 35, 'custom_1' => 'custom string', ]; @@ -53,14 +53,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '91', - 'membership_type_id' => '55', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '34', + 'status_id' => '35', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -81,17 +82,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Delete.php b/civicrm/api/v3/examples/Membership/Delete.php index 75e9066122..fdc16636eb 100644 --- a/civicrm/api/v3/examples/Membership/Delete.php +++ b/civicrm/api/v3/examples/Membership/Delete.php @@ -55,17 +55,17 @@ function membership_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/FilterIsCurrent.php b/civicrm/api/v3/examples/Membership/FilterIsCurrent.php index 6ab53bdccf..fba84157ee 100644 --- a/civicrm/api/v3/examples/Membership/FilterIsCurrent.php +++ b/civicrm/api/v3/examples/Membership/FilterIsCurrent.php @@ -9,7 +9,7 @@ */ function membership_get_example() { $params = [ - 'contact_id' => 47, + 'contact_id' => 3, 'filters' => [ 'is_current' => 1, ], @@ -50,13 +50,13 @@ function membership_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '47', - 'membership_type_id' => '29', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '2009-01-21', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '22', + 'status_id' => '23', 'is_override' => '1', 'is_test' => 0, 'is_pay_later' => 0, @@ -76,17 +76,17 @@ function membership_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Get.php b/civicrm/api/v3/examples/Membership/Get.php index cb6c5aa4bb..1fb614344e 100644 --- a/civicrm/api/v3/examples/Membership/Get.php +++ b/civicrm/api/v3/examples/Membership/Get.php @@ -7,7 +7,7 @@ */ function membership_get_example() { $params = [ - 'membership_type_id' => 23, + 'membership_type_id' => 1, ]; try{ @@ -45,13 +45,13 @@ function membership_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '38', - 'membership_type_id' => '23', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '2009-01-21', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '19', + 'status_id' => '20', 'is_override' => '1', 'is_test' => 0, 'is_pay_later' => 0, @@ -73,17 +73,17 @@ function membership_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/SearchWithCustomData.php b/civicrm/api/v3/examples/Membership/SearchWithCustomData.php index be147d722d..b287131e78 100644 --- a/civicrm/api/v3/examples/Membership/SearchWithCustomData.php +++ b/civicrm/api/v3/examples/Membership/SearchWithCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 94, - 'membership_type_id' => 57, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 35, + 'status_id' => 36, ]; try{ @@ -52,14 +52,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '94', - 'membership_type_id' => '57', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '35', + 'status_id' => '36', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -80,17 +81,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/UpdateCustomData.php b/civicrm/api/v3/examples/Membership/UpdateCustomData.php index 2a10b8e713..243c5968ca 100644 --- a/civicrm/api/v3/examples/Membership/UpdateCustomData.php +++ b/civicrm/api/v3/examples/Membership/UpdateCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 112, - 'membership_type_id' => 69, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 41, + 'status_id' => 42, 'custom_1' => 'custom string', ]; @@ -53,14 +53,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '112', - 'membership_type_id' => '69', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '41', + 'status_id' => '42', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -81,17 +82,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipPayment/Create.php b/civicrm/api/v3/examples/MembershipPayment/Create.php index 1df477999a..5cf4a9ee27 100644 --- a/civicrm/api/v3/examples/MembershipPayment/Create.php +++ b/civicrm/api/v3/examples/MembershipPayment/Create.php @@ -62,17 +62,17 @@ function membership_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipPayment/Get.php b/civicrm/api/v3/examples/MembershipPayment/Get.php index 86dfa26b05..fa8c03591c 100644 --- a/civicrm/api/v3/examples/MembershipPayment/Get.php +++ b/civicrm/api/v3/examples/MembershipPayment/Get.php @@ -62,17 +62,17 @@ function membership_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipStatus/Create.php b/civicrm/api/v3/examples/MembershipStatus/Create.php index 614c84415c..62b129aa52 100644 --- a/civicrm/api/v3/examples/MembershipStatus/Create.php +++ b/civicrm/api/v3/examples/MembershipStatus/Create.php @@ -73,17 +73,17 @@ function membership_status_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipStatus/Get.php b/civicrm/api/v3/examples/MembershipStatus/Get.php index 396a9a68ca..f31da82b91 100644 --- a/civicrm/api/v3/examples/MembershipStatus/Get.php +++ b/civicrm/api/v3/examples/MembershipStatus/Get.php @@ -68,17 +68,17 @@ function membership_status_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Create.php b/civicrm/api/v3/examples/MembershipType/Create.php index f78351a900..b3adad9070 100644 --- a/civicrm/api/v3/examples/MembershipType/Create.php +++ b/civicrm/api/v3/examples/MembershipType/Create.php @@ -89,17 +89,17 @@ function membership_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Delete.php b/civicrm/api/v3/examples/MembershipType/Delete.php index 59200470d9..810c7b062d 100644 --- a/civicrm/api/v3/examples/MembershipType/Delete.php +++ b/civicrm/api/v3/examples/MembershipType/Delete.php @@ -7,7 +7,7 @@ */ function membership_type_delete_example() { $params = [ - 'id' => 4, + 'id' => 5, ]; try{ @@ -54,17 +54,17 @@ function membership_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Get.php b/civicrm/api/v3/examples/MembershipType/Get.php index 232ad99518..35770ea494 100644 --- a/civicrm/api/v3/examples/MembershipType/Get.php +++ b/civicrm/api/v3/examples/MembershipType/Get.php @@ -49,7 +49,7 @@ function membership_type_get_expectedresult() { 'name' => 'General', 'member_of_contact_id' => '4', 'financial_type_id' => '2', - 'minimum_fee' => '0.00', + 'minimum_fee' => '0.000000000', 'duration_unit' => 'year', 'duration_interval' => '1', 'period_type' => 'rolling', @@ -71,17 +71,17 @@ function membership_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Create.php b/civicrm/api/v3/examples/MessageTemplate/Create.php index 16a8b53f25..293e6da69f 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Create.php +++ b/civicrm/api/v3/examples/MessageTemplate/Create.php @@ -7,11 +7,11 @@ */ function message_template_create_example() { $params = [ - 'msg_title' => 'msg_title_284', - 'msg_subject' => 'msg_subject_284', - 'msg_text' => 'msg_text_284', - 'msg_html' => 'msg_html_284', - 'workflow_id' => 284, + 'msg_title' => 'msg_title_471', + 'msg_subject' => 'msg_subject_471', + 'msg_text' => 'msg_text_471', + 'msg_html' => 'msg_html_471', + 'workflow_id' => 471, 'is_default' => '1', 'is_reserved' => 1, ]; @@ -51,12 +51,12 @@ function message_template_create_expectedresult() { 'values' => [ '69' => [ 'id' => '69', - 'msg_title' => 'msg_title_284', - 'msg_subject' => 'msg_subject_284', - 'msg_text' => 'msg_text_284', - 'msg_html' => 'msg_html_284', + 'msg_title' => 'msg_title_471', + 'msg_subject' => 'msg_subject_471', + 'msg_text' => 'msg_text_471', + 'msg_html' => 'msg_html_471', 'is_active' => '1', - 'workflow_id' => '284', + 'workflow_id' => '471', 'is_default' => '1', 'is_reserved' => '1', 'is_sms' => '', @@ -75,17 +75,17 @@ function message_template_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Delete.php b/civicrm/api/v3/examples/MessageTemplate/Delete.php index 70f769ff0d..5829e0df6c 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Delete.php +++ b/civicrm/api/v3/examples/MessageTemplate/Delete.php @@ -54,17 +54,17 @@ function message_template_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Get.php b/civicrm/api/v3/examples/MessageTemplate/Get.php index d29e2073f7..985ecbba48 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Get.php +++ b/civicrm/api/v3/examples/MessageTemplate/Get.php @@ -7,11 +7,11 @@ */ function message_template_get_example() { $params = [ - 'msg_title' => 'msg_title_285', - 'msg_subject' => 'msg_subject_285', - 'msg_text' => 'msg_text_285', - 'msg_html' => 'msg_html_285', - 'workflow_id' => 285, + 'msg_title' => 'msg_title_472', + 'msg_subject' => 'msg_subject_472', + 'msg_text' => 'msg_text_472', + 'msg_html' => 'msg_html_472', + 'workflow_id' => 472, 'is_default' => '1', 'is_reserved' => 1, ]; @@ -51,16 +51,16 @@ function message_template_get_expectedresult() { 'values' => [ '70' => [ 'id' => '70', - 'msg_title' => 'msg_title_285', - 'msg_subject' => 'msg_subject_285', - 'msg_text' => 'msg_text_285', - 'msg_html' => 'msg_html_285', + 'msg_title' => 'msg_title_472', + 'msg_subject' => 'msg_subject_472', + 'msg_text' => 'msg_text_472', + 'msg_html' => 'msg_html_472', 'is_active' => '1', - 'workflow_id' => '285', + 'workflow_id' => '472', 'is_default' => '1', 'is_reserved' => '1', - 'is_sms' => '1', - 'pdf_format_id' => '285', + 'is_sms' => 0, + 'pdf_format_id' => '472', ], ], ]; @@ -75,17 +75,17 @@ function message_template_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Create.php b/civicrm/api/v3/examples/Note/Create.php index 89166d5ee3..8e3cd49991 100644 --- a/civicrm/api/v3/examples/Note/Create.php +++ b/civicrm/api/v3/examples/Note/Create.php @@ -8,9 +8,9 @@ function note_create_example() { $params = [ 'entity_table' => 'civicrm_contact', - 'entity_id' => 9, + 'entity_id' => 15, 'note' => 'Hello!!! m testing Note', - 'contact_id' => 9, + 'contact_id' => 15, 'modified_date' => '2011-01-31', 'subject' => 'Test Note', ]; @@ -46,14 +46,14 @@ function note_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 8, + 'id' => 14, 'values' => [ - '8' => [ - 'id' => '8', + '14' => [ + 'id' => '14', 'entity_table' => 'civicrm_contact', - 'entity_id' => '9', + 'entity_id' => '15', 'note' => 'Hello!!! m testing Note', - 'contact_id' => '9', + 'contact_id' => '15', 'modified_date' => '2012-11-14 16:02:35', 'subject' => 'Test Note', 'privacy' => 0, @@ -71,17 +71,17 @@ function note_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Delete.php b/civicrm/api/v3/examples/Note/Delete.php index 7fdca70af5..cec6389e29 100644 --- a/civicrm/api/v3/examples/Note/Delete.php +++ b/civicrm/api/v3/examples/Note/Delete.php @@ -7,7 +7,7 @@ */ function note_delete_example() { $params = [ - 'id' => 19, + 'id' => 32, ]; try{ @@ -54,17 +54,17 @@ function note_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Get.php b/civicrm/api/v3/examples/Note/Get.php index f045d610ab..17e84a67a2 100644 --- a/civicrm/api/v3/examples/Note/Get.php +++ b/civicrm/api/v3/examples/Note/Get.php @@ -8,7 +8,7 @@ function note_get_example() { $params = [ 'entity_table' => 'civicrm_contact', - 'entity_id' => 3, + 'entity_id' => 5, ]; try{ @@ -55,17 +55,17 @@ function note_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Create.php b/civicrm/api/v3/examples/OpenID/Create.php index 39cfeb0161..03244878a4 100644 --- a/civicrm/api/v3/examples/OpenID/Create.php +++ b/civicrm/api/v3/examples/OpenID/Create.php @@ -7,9 +7,8 @@ */ function open_i_d_create_example() { $params = [ - 'contact_id' => 3, + 'contact_id' => 5, 'openid' => 'My OpenID handle', - 'location_type_id' => 1, ]; try{ @@ -43,11 +42,11 @@ function open_i_d_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 2, 'values' => [ - '1' => [ - 'id' => '1', - 'contact_id' => '3', + '2' => [ + 'id' => '2', + 'contact_id' => '5', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => '', @@ -61,22 +60,22 @@ function open_i_d_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateOpenID" +* The test that created it is called "testCreateOpenIDDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Delete.php b/civicrm/api/v3/examples/OpenID/Delete.php index 291dbbc592..8c7318d836 100644 --- a/civicrm/api/v3/examples/OpenID/Delete.php +++ b/civicrm/api/v3/examples/OpenID/Delete.php @@ -7,7 +7,7 @@ */ function open_i_d_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function open_i_d_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Get.php b/civicrm/api/v3/examples/OpenID/Get.php index 4ebf7f556d..9a2da402ed 100644 --- a/civicrm/api/v3/examples/OpenID/Get.php +++ b/civicrm/api/v3/examples/OpenID/Get.php @@ -7,7 +7,7 @@ */ function open_i_d_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 7, 'openid' => 'My OpenID handle', 'location_type_id' => 1, ]; @@ -43,11 +43,11 @@ function open_i_d_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '4', + '3' => [ + 'id' => '3', + 'contact_id' => '7', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => 0, @@ -66,17 +66,17 @@ function open_i_d_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Create.php b/civicrm/api/v3/examples/OptionGroup/Create.php index b44190696a..109b81d4d2 100644 --- a/civicrm/api/v3/examples/OptionGroup/Create.php +++ b/civicrm/api/v3/examples/OptionGroup/Create.php @@ -51,10 +51,10 @@ function option_group_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 92, + 'id' => 96, 'values' => [ '0' => [ - 'id' => '92', + 'id' => '96', 'name' => 'civicrm_event.amount.560', 'title' => '', 'description' => '', @@ -62,7 +62,7 @@ function option_group_create_expectedresult() { 'is_reserved' => '1', 'is_active' => '1', 'is_locked' => '', - 'api.OptionValue.create' => 849, + 'api.OptionValue.create' => 869, ], ], ]; @@ -77,17 +77,17 @@ function option_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Delete.php b/civicrm/api/v3/examples/OptionGroup/Delete.php index 953f4eb760..7871a5b8b2 100644 --- a/civicrm/api/v3/examples/OptionGroup/Delete.php +++ b/civicrm/api/v3/examples/OptionGroup/Delete.php @@ -7,7 +7,7 @@ */ function option_group_delete_example() { $params = [ - 'id' => 97, + 'id' => 101, ]; try{ @@ -54,17 +54,17 @@ function option_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Get.php b/civicrm/api/v3/examples/OptionGroup/Get.php index 396906a3fc..a17a22183d 100644 --- a/civicrm/api/v3/examples/OptionGroup/Get.php +++ b/civicrm/api/v3/examples/OptionGroup/Get.php @@ -64,17 +64,17 @@ function option_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionValue/Get.php b/civicrm/api/v3/examples/OptionValue/Get.php index 9fc467248e..f7158fc069 100644 --- a/civicrm/api/v3/examples/OptionValue/Get.php +++ b/civicrm/api/v3/examples/OptionValue/Get.php @@ -115,17 +115,17 @@ function option_value_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionValue/SortOption.php b/civicrm/api/v3/examples/OptionValue/SortOption.php index bc4bbcd61b..ae9e2611cc 100644 --- a/civicrm/api/v3/examples/OptionValue/SortOption.php +++ b/civicrm/api/v3/examples/OptionValue/SortOption.php @@ -66,17 +66,17 @@ function option_value_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Cancel.php b/civicrm/api/v3/examples/Order/Cancel.php index eef34ecfae..2f4327d0d9 100644 --- a/civicrm/api/v3/examples/Order/Cancel.php +++ b/civicrm/api/v3/examples/Order/Cancel.php @@ -56,6 +56,7 @@ function order_cancel_expectedresult() { 'net_amount' => '100.00', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -70,7 +71,7 @@ function order_cancel_expectedresult() { 'address_id' => '', 'check_number' => '', 'campaign_id' => '', - 'creditnote_id' => 'CN_1', + 'creditnote_id' => '1', 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', @@ -88,17 +89,17 @@ function order_cancel_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Create.php b/civicrm/api/v3/examples/Order/Create.php index 8ab83214d1..05b76b87a2 100644 --- a/civicrm/api/v3/examples/Order/Create.php +++ b/civicrm/api/v3/examples/Order/Create.php @@ -10,7 +10,7 @@ function order_create_example() { 'contact_id' => 8, 'receive_date' => '2010-01-20', 'total_amount' => 200, - 'financial_type_id' => 1, + 'financial_type_id' => 'Event Fee', 'contribution_status_id' => 1, 'line_items' => [ '0' => [ @@ -21,8 +21,8 @@ function order_create_example() { 'label' => 'Price Field 2', 'field_title' => 'Price Field 2', 'qty' => 1, - 'unit_price' => '200', - 'line_total' => '200', + 'unit_price' => '200.000000000', + 'line_total' => '200.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_membership', 'membership_type_id' => 1, @@ -78,7 +78,7 @@ function order_create_expectedresult() { '1' => [ 'id' => '1', 'contact_id' => '8', - 'financial_type_id' => '1', + 'financial_type_id' => '4', 'contribution_page_id' => '', 'payment_instrument_id' => '4', 'receive_date' => '20100120000000', @@ -88,6 +88,7 @@ function order_create_expectedresult() { 'net_amount' => '200', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -105,7 +106,7 @@ function order_create_expectedresult() { 'creditnote_id' => '', 'tax_amount' => '', 'revenue_recognition_date' => '', - 'contribution_type_id' => '1', + 'contribution_type_id' => '4', ], ], ]; @@ -120,17 +121,17 @@ function order_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/CreateOrderParticipant.php b/civicrm/api/v3/examples/Order/CreateOrderParticipant.php index 6baee2a729..9915cf6d72 100644 --- a/civicrm/api/v3/examples/Order/CreateOrderParticipant.php +++ b/civicrm/api/v3/examples/Order/CreateOrderParticipant.php @@ -23,8 +23,8 @@ function order_create_example() { 'label' => 'Price Field 1', 'field_title' => 'Price Field 1', 'qty' => 1, - 'unit_price' => '100', - 'line_total' => '100', + 'unit_price' => '100.000000000', + 'line_total' => '100.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', ], @@ -34,8 +34,8 @@ function order_create_example() { 'label' => 'Price Field 2', 'field_title' => 'Price Field 2', 'qty' => 1, - 'unit_price' => '200', - 'line_total' => '200', + 'unit_price' => '200.000000000', + 'line_total' => '200.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', ], @@ -98,6 +98,7 @@ function order_create_expectedresult() { 'net_amount' => '300', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -130,17 +131,17 @@ function order_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Delete.php b/civicrm/api/v3/examples/Order/Delete.php index a1ba94375e..8c63b2bb6f 100644 --- a/civicrm/api/v3/examples/Order/Delete.php +++ b/civicrm/api/v3/examples/Order/Delete.php @@ -57,17 +57,17 @@ function order_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Get.php b/civicrm/api/v3/examples/Order/Get.php index 32ef1a23b7..c5af053154 100644 --- a/civicrm/api/v3/examples/Order/Get.php +++ b/civicrm/api/v3/examples/Order/Get.php @@ -51,6 +51,10 @@ function order_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'contribution_id' => '1', 'currency' => 'USD', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', + 'payment_instrument_id' => '4', 'receive_date' => '2010-01-20 00:00:00', 'non_deductible_amount' => '0.00', 'total_amount' => '100.00', @@ -58,39 +62,30 @@ function order_get_expectedresult() { 'net_amount' => '100.00', 'trxn_id' => '', 'invoice_id' => '', - 'cancel_date' => '', + 'invoice_number' => '', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => '', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', 'contribution_note' => '', 'contribution_batch' => '', - 'contribution_status' => 'Completed', + 'contribution_recur_status' => 'Completed', 'payment_instrument' => 'Check', - 'payment_instrument_id' => '4', - 'instrument_id' => '4', + 'contribution_status' => 'Completed', + 'financial_type' => 'Donation', 'check_number' => '', + 'instrument_id' => '4', + 'cancel_date' => '', 'id' => '1', 'contribution_type_id' => '1', 'line_items' => [ @@ -124,17 +119,17 @@ function order_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/Create.php b/civicrm/api/v3/examples/Participant/Create.php index a6a714208d..27dd8c000d 100644 --- a/civicrm/api/v3/examples/Participant/Create.php +++ b/civicrm/api/v3/examples/Participant/Create.php @@ -8,7 +8,7 @@ function participant_create_example() { $params = [ 'contact_id' => 2, - 'event_id' => 2, + 'event_id' => 3, 'status_id' => 1, 'role_id' => 1, 'register_date' => '2007-07-21 00:00:00', @@ -52,7 +52,7 @@ function participant_create_expectedresult() { '4' => [ 'id' => '4', 'contact_id' => '2', - 'event_id' => '2', + 'event_id' => '3', 'status_id' => '1', 'role_id' => '1', 'register_date' => '20070721000000', @@ -83,17 +83,17 @@ function participant_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/Get.php b/civicrm/api/v3/examples/Participant/Get.php index 0734b19708..d883a17061 100644 --- a/civicrm/api/v3/examples/Participant/Get.php +++ b/civicrm/api/v3/examples/Participant/Get.php @@ -53,6 +53,7 @@ function participant_get_expectedresult() { 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -85,17 +86,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/NestedDelete.php b/civicrm/api/v3/examples/Participant/NestedDelete.php index 8f098e52c3..599bf723a1 100644 --- a/civicrm/api/v3/examples/Participant/NestedDelete.php +++ b/civicrm/api/v3/examples/Participant/NestedDelete.php @@ -51,10 +51,11 @@ function participant_get_expectedresult() { 'contact_sub_type' => '', 'sort_name' => 'Anderson, Anthony', 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '41', + 'event_id' => '42', 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '2', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -86,10 +87,11 @@ function participant_get_expectedresult() { 'contact_sub_type' => '', 'sort_name' => 'Anderson, Anthony', 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '41', + 'event_id' => '42', 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '3', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -128,17 +130,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/NestedEventGet.php b/civicrm/api/v3/examples/Participant/NestedEventGet.php index 75bd573d5e..526905947a 100644 --- a/civicrm/api/v3/examples/Participant/NestedEventGet.php +++ b/civicrm/api/v3/examples/Participant/NestedEventGet.php @@ -56,6 +56,7 @@ function participant_get_expectedresult() { 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -104,7 +105,7 @@ function participant_get_expectedresult() { 'is_active' => '1', 'is_show_location' => 0, 'default_role_id' => '1', - 'is_email_confirm' => 0, + 'is_email_confirm' => '1', 'is_pay_later' => 0, 'is_partial_payment' => 0, 'is_multiple_registrations' => 0, @@ -134,17 +135,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Create.php b/civicrm/api/v3/examples/ParticipantPayment/Create.php index 9374697c02..afb8dc3e84 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Create.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Create.php @@ -62,17 +62,17 @@ function participant_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Delete.php b/civicrm/api/v3/examples/ParticipantPayment/Delete.php index 4bf80353ac..fd07bbc377 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Delete.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Delete.php @@ -7,7 +7,7 @@ */ function participant_payment_delete_example() { $params = [ - 'id' => 5, + 'id' => 6, ]; try{ @@ -54,17 +54,17 @@ function participant_payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Get.php b/civicrm/api/v3/examples/ParticipantPayment/Get.php index be2f52c535..c0b8e4b714 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Get.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Get.php @@ -7,8 +7,8 @@ */ function participant_payment_get_example() { $params = [ - 'participant_id' => 64, - 'contribution_id' => 6, + 'participant_id' => 68, + 'contribution_id' => 7, ]; try{ @@ -42,12 +42,12 @@ function participant_payment_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 6, + 'id' => 7, 'values' => [ - '6' => [ - 'id' => '6', - 'participant_id' => '64', - 'contribution_id' => '6', + '7' => [ + 'id' => '7', + 'participant_id' => '68', + 'contribution_id' => '7', ], ], ]; @@ -62,17 +62,17 @@ function participant_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Create.php b/civicrm/api/v3/examples/ParticipantStatusType/Create.php index 44a13f7418..474c521007 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Create.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Create.php @@ -74,17 +74,17 @@ function participant_status_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Delete.php b/civicrm/api/v3/examples/ParticipantStatusType/Delete.php index 4c1567d175..77d001b4b5 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Delete.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Delete.php @@ -54,17 +54,17 @@ function participant_status_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Get.php b/civicrm/api/v3/examples/ParticipantStatusType/Get.php index 70bd8a9d24..40b6e21dc2 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Get.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Get.php @@ -74,17 +74,17 @@ function participant_status_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Cancel.php b/civicrm/api/v3/examples/Payment/Cancel.php index c923220323..3b20cb8820 100644 --- a/civicrm/api/v3/examples/Payment/Cancel.php +++ b/civicrm/api/v3/examples/Payment/Cancel.php @@ -45,15 +45,15 @@ function payment_cancel_expectedresult() { 'id' => 3, 'values' => [ '3' => [ - 'id' => 3, + 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024650', + 'trxn_date' => '20190820192757', 'total_amount' => '-150', 'fee_amount' => '0.00', - 'net_amount' => '150.00', + 'net_amount' => '-150', 'currency' => 'USD', - 'is_payment' => 1, + 'is_payment' => '1', 'trxn_id' => '', 'trxn_result_code' => '', 'status_id' => '7', @@ -72,17 +72,17 @@ function payment_cancel_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Create.php b/civicrm/api/v3/examples/Payment/Create.php index 335945660b..98fc75e877 100644 --- a/civicrm/api/v3/examples/Payment/Create.php +++ b/civicrm/api/v3/examples/Payment/Create.php @@ -48,7 +48,7 @@ function payment_create_expectedresult() { 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024646', + 'trxn_date' => '20190820192755', 'total_amount' => '50', 'fee_amount' => '', 'net_amount' => '50', @@ -72,17 +72,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php b/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php index 7d2c3fdb15..a1351e8b02 100644 --- a/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php +++ b/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php @@ -58,7 +58,7 @@ function payment_create_expectedresult() { 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024648', + 'trxn_date' => '20190820192756', 'total_amount' => '50', 'fee_amount' => '', 'net_amount' => '50', @@ -82,17 +82,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Delete.php b/civicrm/api/v3/examples/Payment/Delete.php index 99c75f8b2c..dea29275c0 100644 --- a/civicrm/api/v3/examples/Payment/Delete.php +++ b/civicrm/api/v3/examples/Payment/Delete.php @@ -55,17 +55,17 @@ function payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Get.php b/civicrm/api/v3/examples/Payment/Get.php index d21df61552..45b2bfc958 100644 --- a/civicrm/api/v3/examples/Payment/Get.php +++ b/civicrm/api/v3/examples/Payment/Get.php @@ -71,17 +71,17 @@ function payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/UpdatePayment.php b/civicrm/api/v3/examples/Payment/UpdatePayment.php index 38b15474bf..7ac7eb09c5 100644 --- a/civicrm/api/v3/examples/Payment/UpdatePayment.php +++ b/civicrm/api/v3/examples/Payment/UpdatePayment.php @@ -52,7 +52,7 @@ function payment_create_expectedresult() { 'id' => '5', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024653', + 'trxn_date' => '20190820192758', 'total_amount' => '100', 'fee_amount' => '', 'net_amount' => '100', @@ -76,17 +76,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessor/Create.php b/civicrm/api/v3/examples/PaymentProcessor/Create.php index cb1794f201..d3483bdb93 100644 --- a/civicrm/api/v3/examples/PaymentProcessor/Create.php +++ b/civicrm/api/v3/examples/PaymentProcessor/Create.php @@ -45,15 +45,16 @@ function payment_processor_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 1, 'values' => [ - '2' => [ - 'id' => '2', + '1' => [ + 'id' => '1', 'domain_id' => '1', 'name' => 'API Test PP', + 'title' => '', 'description' => '', 'payment_processor_type_id' => '1', - 'is_active' => '', + 'is_active' => '1', 'is_default' => 0, 'is_test' => 0, 'user_name' => '', @@ -84,17 +85,17 @@ function payment_processor_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessor/Delete.php b/civicrm/api/v3/examples/PaymentProcessor/Delete.php index 4ee4993aa1..5c3ec5bf52 100644 --- a/civicrm/api/v3/examples/PaymentProcessor/Delete.php +++ b/civicrm/api/v3/examples/PaymentProcessor/Delete.php @@ -7,7 +7,7 @@ */ function payment_processor_delete_example() { $params = [ - 'id' => 2, + 'id' => 3, ]; try{ @@ -54,17 +54,17 @@ function payment_processor_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessorType/Create.php b/civicrm/api/v3/examples/PaymentProcessorType/Create.php index 80acce7330..e0baa78f23 100644 --- a/civicrm/api/v3/examples/PaymentProcessorType/Create.php +++ b/civicrm/api/v3/examples/PaymentProcessorType/Create.php @@ -86,17 +86,17 @@ function payment_processor_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessorType/Delete.php b/civicrm/api/v3/examples/PaymentProcessorType/Delete.php index 3126ca7a3d..e8e755d263 100644 --- a/civicrm/api/v3/examples/PaymentProcessorType/Delete.php +++ b/civicrm/api/v3/examples/PaymentProcessorType/Delete.php @@ -54,17 +54,17 @@ function payment_processor_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Create.php b/civicrm/api/v3/examples/PaymentToken/Create.php index 5df14cd19e..18c9c5da78 100644 --- a/civicrm/api/v3/examples/PaymentToken/Create.php +++ b/civicrm/api/v3/examples/PaymentToken/Create.php @@ -77,17 +77,17 @@ function payment_token_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Delete.php b/civicrm/api/v3/examples/PaymentToken/Delete.php index c7f368838f..84e51e4002 100644 --- a/civicrm/api/v3/examples/PaymentToken/Delete.php +++ b/civicrm/api/v3/examples/PaymentToken/Delete.php @@ -54,17 +54,17 @@ function payment_token_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Get.php b/civicrm/api/v3/examples/PaymentToken/Get.php index 43ae1e7202..d08f098493 100644 --- a/civicrm/api/v3/examples/PaymentToken/Get.php +++ b/civicrm/api/v3/examples/PaymentToken/Get.php @@ -67,17 +67,17 @@ function payment_token_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php b/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php new file mode 100644 index 0000000000..c5634e4add --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php @@ -0,0 +1,114 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.get API. + * + * Demonstrates get + delete in the same call. + * + * @return array + * API result array + */ +function pcp_get_example() { + $params = [ + 'title' => 'Pcp title', + 'api.Pcp.delete' => 1, + ]; + + try{ + $result = civicrm_api3('Pcp', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => [ + '3' => [ + 'id' => '3', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + 'api.Pcp.delete' => [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ], + ], + '5' => [ + 'id' => '5', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + 'api.Pcp.delete' => [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ], + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetPcpChainDelete" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Pcp/Create.php b/civicrm/api/v3/examples/Pcp/Create.php index dc659cce38..85da4f8b9d 100644 --- a/civicrm/api/v3/examples/Pcp/Create.php +++ b/civicrm/api/v3/examples/Pcp/Create.php @@ -77,17 +77,17 @@ function pcp_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pcp/Delete.php b/civicrm/api/v3/examples/Pcp/Delete.php new file mode 100644 index 0000000000..a623f9b68a --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/Delete.php @@ -0,0 +1,70 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.delete API. + * + * @return array + * API result array + */ +function pcp_delete_example() { + $params = [ + 'id' => 4, + ]; + + try{ + $result = civicrm_api3('Pcp', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_delete_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testDeletePcp" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Pcp/Get.php b/civicrm/api/v3/examples/Pcp/Get.php new file mode 100644 index 0000000000..d1f4a266a0 --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/Get.php @@ -0,0 +1,89 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.get API. + * + * @return array + * API result array + */ +function pcp_get_example() { + $params = [ + 'title' => 'Pcp title', + 'contact_id' => 1, + 'page_id' => 1, + 'pcp_block_id' => 1, + ]; + + try{ + $result = civicrm_api3('Pcp', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetPcp" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Phone/Create.php b/civicrm/api/v3/examples/Phone/Create.php index 8f2a0c2178..3fd8e7b230 100644 --- a/civicrm/api/v3/examples/Phone/Create.php +++ b/civicrm/api/v3/examples/Phone/Create.php @@ -7,8 +7,7 @@ */ function phone_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 5, 'phone' => '(123) 456-7890', 'is_primary' => 1, 'phone_type_id' => 1, @@ -45,12 +44,12 @@ function phone_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '3', - 'location_type_id' => '6', + '3' => [ + 'id' => '3', + 'contact_id' => '5', + 'location_type_id' => '1', 'is_primary' => '1', 'is_billing' => '', 'mobile_provider_id' => '', @@ -67,22 +66,22 @@ function phone_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreatePhone" +* The test that created it is called "testCreatePhoneDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/Delete.php b/civicrm/api/v3/examples/Phone/Delete.php index 07bb8a2353..beff5e9e33 100644 --- a/civicrm/api/v3/examples/Phone/Delete.php +++ b/civicrm/api/v3/examples/Phone/Delete.php @@ -7,7 +7,7 @@ */ function phone_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function phone_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/Get.php b/civicrm/api/v3/examples/Phone/Get.php index 40571916fc..57d25de2dd 100644 --- a/civicrm/api/v3/examples/Phone/Get.php +++ b/civicrm/api/v3/examples/Phone/Get.php @@ -7,7 +7,7 @@ */ function phone_get_example() { $params = [ - 'contact_id' => 7, + 'contact_id' => 12, 'phone' => '(123) 456-7890', ]; @@ -42,12 +42,12 @@ function phone_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 4, + 'id' => 5, 'values' => [ - '4' => [ - 'id' => '4', - 'contact_id' => '7', - 'location_type_id' => '10', + '5' => [ + 'id' => '5', + 'contact_id' => '12', + 'location_type_id' => '15', 'is_primary' => '1', 'is_billing' => 0, 'phone' => '(123) 456-7890', @@ -67,17 +67,17 @@ function phone_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/GetOptions.php b/civicrm/api/v3/examples/Phone/GetOptions.php index 1b7cd959b9..3ac7d56b31 100644 --- a/civicrm/api/v3/examples/Phone/GetOptions.php +++ b/civicrm/api/v3/examples/Phone/GetOptions.php @@ -60,17 +60,17 @@ function phone_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Create.php b/civicrm/api/v3/examples/Pledge/Create.php index e524f20c89..3ffb6b2d56 100644 --- a/civicrm/api/v3/examples/Pledge/Create.php +++ b/civicrm/api/v3/examples/Pledge/Create.php @@ -7,10 +7,10 @@ */ function pledge_create_example() { $params = [ - 'contact_id' => 11, - 'pledge_create_date' => '20170207', - 'start_date' => '20170207', - 'scheduled_date' => '20170209', + 'contact_id' => 12, + 'pledge_create_date' => '20190820', + 'start_date' => '20190820', + 'scheduled_date' => '20190822', 'amount' => '100', 'pledge_status_id' => '2', 'pledge_financial_type_id' => '1', @@ -57,7 +57,7 @@ function pledge_create_expectedresult() { 'values' => [ '0' => [ 'id' => '1', - 'contact_id' => '11', + 'contact_id' => '12', 'financial_type_id' => '1', 'contribution_page_id' => '', 'amount' => '100', @@ -79,6 +79,7 @@ function pledge_create_expectedresult() { 'status_id' => '2', 'is_test' => '', 'campaign_id' => '', + 'contribution_type_id' => '1', ], ], ]; @@ -93,17 +94,17 @@ function pledge_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Delete.php b/civicrm/api/v3/examples/Pledge/Delete.php index 7b6e86458f..d11698ce1b 100644 --- a/civicrm/api/v3/examples/Pledge/Delete.php +++ b/civicrm/api/v3/examples/Pledge/Delete.php @@ -57,17 +57,17 @@ function pledge_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Get.php b/civicrm/api/v3/examples/Pledge/Get.php index 7f75449bd0..b664e2b647 100644 --- a/civicrm/api/v3/examples/Pledge/Get.php +++ b/civicrm/api/v3/examples/Pledge/Get.php @@ -51,11 +51,11 @@ function pledge_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '1', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2017-02-07 00:00:00', - 'pledge_start_date' => '2017-02-07 00:00:00', + 'pledge_create_date' => '2019-08-20 00:00:00', + 'pledge_start_date' => '2019-08-20 00:00:00', 'pledge_status' => 'Pending', 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2017-02-09 00:00:00', + 'pledge_next_pay_date' => '2019-08-22 00:00:00', 'pledge_next_pay_amount' => '20.00', 'pledge_outstanding_amount' => '', 'pledge_financial_type' => 'Donation', @@ -80,17 +80,17 @@ function pledge_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php b/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php index c567d852e9..d7dcb34cf9 100644 --- a/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php +++ b/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php @@ -9,7 +9,7 @@ */ function pledge_get_example() { $params = [ - 'pledge_start_date_high' => '20170205024740', + 'pledge_start_date_high' => '20190818192828', ]; try{ @@ -53,11 +53,11 @@ function pledge_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '2', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2017-02-07 00:00:00', - 'pledge_start_date' => '2016-03-04 00:00:00', + 'pledge_create_date' => '2019-08-20 00:00:00', + 'pledge_start_date' => '2018-03-02 00:00:00', 'pledge_status' => 'Overdue', 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2016-03-04 00:00:00', + 'pledge_next_pay_date' => '2018-03-02 00:00:00', 'pledge_next_pay_amount' => '20.00', 'pledge_outstanding_amount' => '20.00', 'pledge_financial_type' => 'Donation', @@ -82,17 +82,17 @@ function pledge_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Create.php b/civicrm/api/v3/examples/PledgePayment/Create.php index 07070f6a61..b2c50bfaac 100644 --- a/civicrm/api/v3/examples/PledgePayment/Create.php +++ b/civicrm/api/v3/examples/PledgePayment/Create.php @@ -7,7 +7,7 @@ */ function pledge_payment_create_example() { $params = [ - 'contact_id' => 1, + 'contact_id' => 3, 'pledge_id' => 1, 'contribution_id' => 1, 'status_id' => 1, @@ -72,17 +72,17 @@ function pledge_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Delete.php b/civicrm/api/v3/examples/PledgePayment/Delete.php index ce498be4ef..7f5f8bb244 100644 --- a/civicrm/api/v3/examples/PledgePayment/Delete.php +++ b/civicrm/api/v3/examples/PledgePayment/Delete.php @@ -57,17 +57,17 @@ function pledge_payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Get.php b/civicrm/api/v3/examples/PledgePayment/Get.php index 3d42d7ba84..826d83948f 100644 --- a/civicrm/api/v3/examples/PledgePayment/Get.php +++ b/civicrm/api/v3/examples/PledgePayment/Get.php @@ -98,17 +98,17 @@ function pledge_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Update.php b/civicrm/api/v3/examples/PledgePayment/Update.php index b9dc6999d7..cf60c64a13 100644 --- a/civicrm/api/v3/examples/PledgePayment/Update.php +++ b/civicrm/api/v3/examples/PledgePayment/Update.php @@ -69,17 +69,17 @@ function pledge_payment_update_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Create.php b/civicrm/api/v3/examples/PriceField/Create.php index c25152293b..05ec60e5f9 100644 --- a/civicrm/api/v3/examples/PriceField/Create.php +++ b/civicrm/api/v3/examples/PriceField/Create.php @@ -80,17 +80,17 @@ function price_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Delete.php b/civicrm/api/v3/examples/PriceField/Delete.php index 51213fe012..483b6426e4 100644 --- a/civicrm/api/v3/examples/PriceField/Delete.php +++ b/civicrm/api/v3/examples/PriceField/Delete.php @@ -54,17 +54,17 @@ function price_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Get.php b/civicrm/api/v3/examples/PriceField/Get.php index 5ea6fe86b8..0562018818 100644 --- a/civicrm/api/v3/examples/PriceField/Get.php +++ b/civicrm/api/v3/examples/PriceField/Get.php @@ -70,17 +70,17 @@ function price_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Create.php b/civicrm/api/v3/examples/PriceFieldValue/Create.php index e6332aa8a0..7eb90fc41b 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Create.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Create.php @@ -68,6 +68,7 @@ function price_field_value_create_expectedresult() { 'is_active' => '1', 'financial_type_id' => '2', 'non_deductible_amount' => '', + 'visibility_id' => '', 'contribution_type_id' => '2', ], ], @@ -83,17 +84,17 @@ function price_field_value_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Delete.php b/civicrm/api/v3/examples/PriceFieldValue/Delete.php index b258473c78..58af271e84 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Delete.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Delete.php @@ -54,17 +54,17 @@ function price_field_value_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Get.php b/civicrm/api/v3/examples/PriceFieldValue/Get.php index 6a949c384e..5889b0a7a3 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Get.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Get.php @@ -48,12 +48,13 @@ function price_field_value_get_expectedresult() { 'price_field_id' => '1', 'name' => 'contribution_amount', 'label' => 'Contribution Amount', - 'amount' => '1', + 'amount' => '1.000000000', 'weight' => '1', 'is_default' => 0, 'is_active' => '1', 'financial_type_id' => '1', 'non_deductible_amount' => '0.00', + 'visibility_id' => '1', 'contribution_type_id' => '1', ], ], @@ -69,17 +70,17 @@ function price_field_value_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Create.php b/civicrm/api/v3/examples/PriceSet/Create.php index be4f7fd9bc..bb18c6768f 100644 --- a/civicrm/api/v3/examples/PriceSet/Create.php +++ b/civicrm/api/v3/examples/PriceSet/Create.php @@ -45,10 +45,10 @@ function price_set_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 18, + 'id' => 20, 'values' => [ - '18' => [ - 'id' => '18', + '20' => [ + 'id' => '20', 'domain_id' => '', 'name' => 'event price', 'title' => 'event price', @@ -75,17 +75,17 @@ function price_set_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Delete.php b/civicrm/api/v3/examples/PriceSet/Delete.php index e4f96909d3..7ad89e8168 100644 --- a/civicrm/api/v3/examples/PriceSet/Delete.php +++ b/civicrm/api/v3/examples/PriceSet/Delete.php @@ -7,7 +7,7 @@ */ function price_set_delete_example() { $params = [ - 'id' => 19, + 'id' => 21, ]; try{ @@ -54,17 +54,17 @@ function price_set_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Get.php b/civicrm/api/v3/examples/PriceSet/Get.php index be0f4fd52e..adfb4b89c3 100644 --- a/civicrm/api/v3/examples/PriceSet/Get.php +++ b/civicrm/api/v3/examples/PriceSet/Get.php @@ -67,17 +67,17 @@ function price_set_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Apply.php b/civicrm/api/v3/examples/Profile/Apply.php index c3d881b4b8..54279e7b13 100644 --- a/civicrm/api/v3/examples/Profile/Apply.php +++ b/civicrm/api/v3/examples/Profile/Apply.php @@ -7,8 +7,8 @@ */ function profile_apply_example() { $params = [ - 'profile_id' => 31, - 'contact_id' => 3, + 'profile_id' => 30, + 'contact_id' => 5, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-Primary' => 'abc2.xyz2@gmail.com', @@ -51,10 +51,10 @@ function profile_apply_expectedresult() { 'values' => [ 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'contact_id' => 3, + 'contact_id' => 5, 'version' => 3, 'debug' => 1, - 'profile_id' => 31, + 'profile_id' => 30, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email' => [ @@ -93,17 +93,17 @@ function profile_apply_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Get.php b/civicrm/api/v3/examples/Profile/Get.php index 0e9e07c701..a8f3e4f341 100644 --- a/civicrm/api/v3/examples/Profile/Get.php +++ b/civicrm/api/v3/examples/Profile/Get.php @@ -12,7 +12,7 @@ function profile_get_example() { '1' => 1, '2' => 'Billing', ], - 'contact_id' => 3, + 'contact_id' => 5, ]; try{ @@ -91,17 +91,17 @@ function profile_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/GetFields.php b/civicrm/api/v3/examples/Profile/GetFields.php index 588e90a21a..b95c81efca 100644 --- a/civicrm/api/v3/examples/Profile/GetFields.php +++ b/civicrm/api/v3/examples/Profile/GetFields.php @@ -10,7 +10,7 @@ function profile_getfields_example() { $params = [ 'action' => 'submit', - 'profile_id' => 27, + 'profile_id' => 22, ]; try{ @@ -46,9 +46,15 @@ function profile_getfields_expectedresult() { 'count' => 9, 'values' => [ 'custom_1' => [ + 'id' => '1', 'label' => '_addCustomFieldToProfile', - 'groupTitle' => '_addCustomFie', + 'headerPattern' => '//', + 'title' => 'first_name', + 'custom_field_id' => '1', + 'groupTitle' => '_addCustomFieldToProfile', 'data_type' => 'String', + 'name' => 'custom_1', + 'type' => 2, 'html_type' => 'Text', 'default_value' => 'defaultValue', 'text_length' => '', @@ -66,9 +72,9 @@ function profile_getfields_expectedresult() { 'is_required' => 0, 'table_name' => 'civicrm_value__addcustomfie_1', 'column_name' => '_addcustomfieldtoprofile_1', - 'name' => 'custom_1', - 'title' => 'first_name', - 'type' => 2, + 'where' => 'civicrm_value__addcustomfie_1._addcustomfieldtoprofile_1', + 'extends_table' => 'civicrm_contact', + 'search_table' => 'contact_a', 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -91,11 +97,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 6, ], + 'is_core_field' => TRUE, 'api.required' => 0, 'help_pre' => '', 'help_post' => '', @@ -107,9 +115,12 @@ function profile_getfields_expectedresult() { 'type' => 1, 'title' => 'State Province', 'description' => 'Which State_Province does this address belong to.', + 'where' => 'civicrm_address.state_province_id', 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, + 'localize_context' => 'province', 'FKClassName' => 'CRM_Core_DAO_StateProvince', 'html' => [ 'type' => 'ChainSelect', @@ -121,6 +132,7 @@ function profile_getfields_expectedresult() { 'keyColumn' => 'id', 'labelColumn' => 'name', ], + 'is_core_field' => TRUE, 'FKApiName' => 'StateProvince', 'api.required' => '1', 'help_pre' => '', @@ -133,9 +145,12 @@ function profile_getfields_expectedresult() { 'type' => 1, 'title' => 'Country', 'description' => 'Which Country does this address belong to.', + 'where' => 'civicrm_address.country_id', 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, + 'localize_context' => 'country', 'FKClassName' => 'CRM_Core_DAO_Country', 'html' => [ 'type' => 'Select', @@ -147,7 +162,9 @@ function profile_getfields_expectedresult() { 'keyColumn' => 'id', 'labelColumn' => 'name', 'nameColumn' => 'iso_code', + 'abbrColumn' => 'iso_code', ], + 'is_core_field' => TRUE, 'FKApiName' => 'Country', 'api.required' => '1', 'help_pre' => '', @@ -170,11 +187,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_phone', 'entity' => 'phone', 'bao' => 'CRM_Core_BAO_Phone', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -197,11 +216,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_email', 'entity' => 'email', 'bao' => 'CRM_Core_BAO_Email', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 254, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -225,11 +246,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -251,11 +274,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -280,17 +305,17 @@ function profile_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Submit.php b/civicrm/api/v3/examples/Profile/Submit.php index 35f3b2f770..3f2d700720 100644 --- a/civicrm/api/v3/examples/Profile/Submit.php +++ b/civicrm/api/v3/examples/Profile/Submit.php @@ -7,8 +7,8 @@ */ function profile_submit_example() { $params = [ - 'profile_id' => 29, - 'contact_id' => 3, + 'profile_id' => 24, + 'contact_id' => 5, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-primary' => 'abc2.xyz2@gmail.com', @@ -48,10 +48,10 @@ function profile_submit_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 3, + 'id' => 5, 'values' => [ - '3' => [ - 'id' => '3', + '5' => [ + 'id' => '5', 'contact_type' => 'Individual', 'contact_sub_type' => '', 'do_not_email' => 0, @@ -78,7 +78,7 @@ function profile_submit_expectedresult() { 'prefix_id' => '3', 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => 'Dear abc1', @@ -114,17 +114,17 @@ function profile_submit_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/RelationshipType/Create.php b/civicrm/api/v3/examples/RelationshipType/Create.php index d2e71aa285..e83a875ed6 100644 --- a/civicrm/api/v3/examples/RelationshipType/Create.php +++ b/civicrm/api/v3/examples/RelationshipType/Create.php @@ -76,17 +76,17 @@ function relationship_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/RelationshipType/Delete.php b/civicrm/api/v3/examples/RelationshipType/Delete.php index ec8c1aad7d..4f2afdd612 100644 --- a/civicrm/api/v3/examples/RelationshipType/Delete.php +++ b/civicrm/api/v3/examples/RelationshipType/Delete.php @@ -54,17 +54,17 @@ function relationship_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ReportTemplate/Getrows.php b/civicrm/api/v3/examples/ReportTemplate/Getrows.php index 48804cb7a5..97e0948a9d 100644 --- a/civicrm/api/v3/examples/ReportTemplate/Getrows.php +++ b/civicrm/api/v3/examples/ReportTemplate/Getrows.php @@ -2,14 +2,14 @@ /** * Test Generated example demonstrating the ReportTemplate.getrows API. * - * Retrieve rows from a report template (optionally providing the instance_id). + * Retrieve rows from a mailing opened report template. * * @return array * API result array */ function report_template_getrows_example() { $params = [ - 'report_id' => 'contact/summary', + 'report_id' => 'Mailing/opened', 'options' => [ 'metadata' => [ '0' => 'labels', @@ -48,25 +48,71 @@ function report_template_getrows_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 2, + 'count' => 5, 'values' => [ '0' => [ - 'civicrm_contact_sort_name' => 'Second Domain', - 'civicrm_contact_id' => '2', - 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=2', - 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', + 'civicrm_contact_id' => '102', + 'civicrm_contact_sort_name' => 'One, Test', + 'civicrm_mailing_mailing_name' => 'Second Test Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'Second Test Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello again, {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '17', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:23:22', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=102', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', ], '1' => [ - 'civicrm_contact_sort_name' => 'Unit Test Organization', - 'civicrm_contact_id' => '1', - 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=1', - 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', + 'civicrm_contact_id' => '109', + 'civicrm_contact_sort_name' => 'Five, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '9', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:19:03', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=109', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '2' => [ + 'civicrm_contact_id' => '110', + 'civicrm_contact_sort_name' => 'Six, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '5', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:17:54', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=110', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '3' => [ + 'civicrm_contact_id' => '111', + 'civicrm_contact_sort_name' => 'Seven, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '15', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:20:59', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=111', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '4' => [ + 'civicrm_contact_id' => '112', + 'civicrm_contact_sort_name' => 'Eight, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '11', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:19:44', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=112', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', ], ], 'metadata' => [ 'title' => 'ERROR: Title is not Set', 'labels' => [ 'civicrm_contact_sort_name' => 'Contact Name', + 'civicrm_mailing_mailing_name' => 'Mailing Name', + 'civicrm_mailing_mailing_subject' => 'Mailing Subject', + 'civicrm_mailing_event_opened_time_stamp' => 'Open Date', ], ], ]; @@ -76,22 +122,22 @@ function report_template_getrows_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testReportTemplateGetRowsContactSummary" +* The test that created it is called "testReportTemplateGetRowsMailingUniqueOpened" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php b/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php index cfb3de5822..40f22af22b 100644 --- a/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php +++ b/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php @@ -42,8 +42,16 @@ function report_template_getstatistics_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 0, - 'values' => '', + 'count' => 1, + 'id' => 'counts', + 'values' => [ + 'counts' => [ + 'rowCount' => [ + 'title' => 'Row(s) Listed', + 'value' => 0, + ], + ], + ], ]; return $expectedResult; @@ -56,17 +64,17 @@ function report_template_getstatistics_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Create.php b/civicrm/api/v3/examples/SavedSearch/Create.php index 149e9f6b03..4667b1f808 100644 --- a/civicrm/api/v3/examples/SavedSearch/Create.php +++ b/civicrm/api/v3/examples/SavedSearch/Create.php @@ -82,9 +82,9 @@ function saved_search_create_expectedresult() { 'saved_search_id' => '3', 'is_active' => '1', 'visibility' => 'User and User Admin Only', - 'where_clause' => ' ( ( `civicrm_group_contact_cache_1`.group_id IN (\"1\") ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:31:\"`civicrm_group_contact_cache_1`\";s:132:\" LEFT JOIN civicrm_group_contact_cache `civicrm_group_contact_cache_1` ON contact_a.id = `civicrm_group_contact_cache_1`.contact_id \";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:31:\"`civicrm_group_contact_cache_1`\";s:132:\" LEFT JOIN civicrm_group_contact_cache `civicrm_group_contact_cache_1` ON contact_a.id = `civicrm_group_contact_cache_1`.contact_id \";}', + 'where_clause' => ' ( ( ( civicrm_group_contact_cache_5d5bbe284d3e9.group_id IN (\"1\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:41:\"civicrm_group_contact_cache_5d5bbe284d3e9\";s:152:\" LEFT JOIN civicrm_group_contact_cache civicrm_group_contact_cache_5d5bbe284d3e9 ON contact_a.id = civicrm_group_contact_cache_5d5bbe284d3e9.contact_id \";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:41:\"civicrm_group_contact_cache_5d5bbe284d3e9\";s:152:\" LEFT JOIN civicrm_group_contact_cache civicrm_group_contact_cache_5d5bbe284d3e9 ON contact_a.id = civicrm_group_contact_cache_5d5bbe284d3e9.contact_id \";}', 'group_type' => '', 'cache_date' => '', 'refresh_date' => '', @@ -111,17 +111,17 @@ function saved_search_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Delete.php b/civicrm/api/v3/examples/SavedSearch/Delete.php index e2ed2a0ad2..00bbed7150 100644 --- a/civicrm/api/v3/examples/SavedSearch/Delete.php +++ b/civicrm/api/v3/examples/SavedSearch/Delete.php @@ -54,17 +54,17 @@ function saved_search_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Get.php b/civicrm/api/v3/examples/SavedSearch/Get.php index cb8f5c3f3e..302240797a 100644 --- a/civicrm/api/v3/examples/SavedSearch/Get.php +++ b/civicrm/api/v3/examples/SavedSearch/Get.php @@ -63,17 +63,17 @@ function saved_search_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Create.php b/civicrm/api/v3/examples/Setting/Create.php index 88a1afc59d..fc2b6b9bf2 100644 --- a/civicrm/api/v3/examples/Setting/Create.php +++ b/civicrm/api/v3/examples/Setting/Create.php @@ -60,17 +60,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateAllDomains.php b/civicrm/api/v3/examples/Setting/CreateAllDomains.php index 7cfef55b75..d25e161045 100644 --- a/civicrm/api/v3/examples/Setting/CreateAllDomains.php +++ b/civicrm/api/v3/examples/Setting/CreateAllDomains.php @@ -67,17 +67,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php b/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php index d600ec4c80..038295ee25 100644 --- a/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php +++ b/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php @@ -61,17 +61,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php b/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php index c7167e9131..d344556e71 100644 --- a/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php +++ b/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php @@ -67,17 +67,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Get.php b/civicrm/api/v3/examples/Setting/Get.php index 74d9c9a03b..d25be60d68 100644 --- a/civicrm/api/v3/examples/Setting/Get.php +++ b/civicrm/api/v3/examples/Setting/Get.php @@ -60,17 +60,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetAllDomains.php b/civicrm/api/v3/examples/Setting/GetAllDomains.php index 185f51b869..7a0f6b26f1 100644 --- a/civicrm/api/v3/examples/Setting/GetAllDomains.php +++ b/civicrm/api/v3/examples/Setting/GetAllDomains.php @@ -67,17 +67,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetDefaults.php b/civicrm/api/v3/examples/Setting/GetDefaults.php index 6b50ddf069..cda1629a63 100644 --- a/civicrm/api/v3/examples/Setting/GetDefaults.php +++ b/civicrm/api/v3/examples/Setting/GetDefaults.php @@ -67,17 +67,17 @@ function setting_getdefaults_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetFields.php b/civicrm/api/v3/examples/Setting/GetFields.php index e41b514ec5..c188d7d591 100644 --- a/civicrm/api/v3/examples/Setting/GetFields.php +++ b/civicrm/api/v3/examples/Setting/GetFields.php @@ -40,17 +40,20 @@ function setting_getfields_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 157, + 'count' => 173, 'values' => [ 'address_standardization_provider' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'address_standardization_provider', 'type' => 'String', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => '', 'add' => '4.1', 'title' => 'Address Standardization Provider.', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::addressProvider', + ], 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -61,10 +64,10 @@ function setting_getfields_expectedresult() { 'group' => 'address', 'name' => 'address_standardization_userid', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.1', - 'title' => 'Web service user ID', + 'title' => 'Provider service user ID', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -75,10 +78,10 @@ function setting_getfields_expectedresult() { 'group' => 'address', 'name' => 'address_standardization_url', 'type' => 'Text', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.1', - 'title' => 'Web Service URL', + 'title' => 'Provider Service URL', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -104,28 +107,38 @@ function setting_getfields_expectedresult() { 'group' => 'campaign', 'name' => 'tag_unconfirmed', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Unconfirmed', 'add' => '4.1', 'title' => 'Tag for Unconfirmed Petition Signers', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'help_text' => '', + 'settings_pages' => [ + 'campaign' => [ + 'weight' => 10, + ], + ], ], 'petition_contacts' => [ 'group_name' => 'Campaign Preferences', 'group' => 'campaign', 'name' => 'petition_contacts', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Petition Contacts', 'add' => '4.1', 'title' => 'Petition Signers Group', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => 'All contacts that have signed a CiviCampaign petition will be added to this group. The group will be created if it does not exist (it is required for email verification).', + 'help_text' => '', + 'settings_pages' => [ + 'campaign' => [ + 'weight' => 20, + ], + ], ], 'civicaseRedactActivityEmail' => [ 'group_name' => 'CiviCRM Preferences', @@ -184,11 +197,27 @@ function setting_getfields_expectedresult() { 'description' => 'How to sort activity-types on the \"Manage Case\" screen? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)', 'help_text' => '', ], + 'civicaseActivityRevisions' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'civicaseActivityRevisions', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '', + 'html_type' => 'radio', + 'add' => '4.7', + 'title' => 'Enable Embedded Activity Revisions', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enable tracking of activity revisions embedded within the \"civicrm_activity\" table. Alternatively, see \"Administer => System Settings => Misc => Logging\".', + 'help_text' => '', + ], 'cvv_backoffice_required' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'cvv_backoffice_required', 'type' => 'Boolean', + 'html_type' => 'radio', 'quick_form_type' => 'YesNo', 'default' => '1', 'add' => '4.1', @@ -223,7 +252,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'invoicing', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -231,14 +260,15 @@ function setting_getfields_expectedresult() { 'title' => 'Enable Tax and Invoicing', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'on_change' => [ + '0' => 'CRM_Invoicing_Utils::onToggle', + ], ], 'acl_financial_type' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'acl_financial_type', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -248,12 +278,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'help' => [ + 'id' => 'acl_financial_type', + ], ], 'deferred_revenue_enabled' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'deferred_revenue_enabled', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -269,10 +302,10 @@ function setting_getfields_expectedresult() { 'group' => 'contribute', 'name' => 'default_invoice_page', 'type' => 'Integer', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'Select', 'default' => '', 'pseudoconstant' => [ - 'name' => 'contributionPage', + 'callback' => 'CRM_Contribute_PseudoConstant::contributionPage', ], 'html_type' => 'select', 'add' => '4.7', @@ -286,7 +319,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'always_post_to_accounts_receivable', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -301,7 +334,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'update_contribution_on_membership_type_change', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -326,8 +359,9 @@ function setting_getfields_expectedresult() { 'title' => 'Viewing Contacts', 'is_domain' => '1', 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the tabs that should be displayed when viewing a contact record. EXAMPLE: If your organization does not keep track of \'Relationships\', then un-check this option to simplify the screen display. Tabs for Contributions, Pledges, Memberships, Events, Grants and Cases are also hidden if the corresponding component is not enabled. Go to Administer > System Settings > Enable Components to modify the components which are available for your site.', 'help_text' => '', + 'serialize' => 1, ], 'contact_edit_options' => [ 'group_name' => 'CiviCRM Preferences', @@ -343,11 +377,13 @@ function setting_getfields_expectedresult() { 'title' => 'Editing Contacts', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the sections that should be included when adding or editing a contact record. EXAMPLE: If your organization does not record Gender and Birth Date for individuals, then simplify the form by un-checking this option. Drag interface allows you to change the order of the panes displayed on contact add/edit screen.', 'help_text' => '', + 'serialize' => 1, ], 'advanced_search_options' => [ 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', 'name' => 'advanced_search_options', 'type' => 'String', 'html_type' => 'checkboxes', @@ -359,8 +395,8 @@ function setting_getfields_expectedresult() { 'title' => 'Contact Search', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Select the sections that should be included in the Basic and Advanced Search forms. EXAMPLE: If you don\'t track Relationships - then you do not need this section included in the advanced search form. Simplify the form by un-checking this option.', + 'serialize' => 1, ], 'user_dashboard_options' => [ 'group_name' => 'CiviCRM Preferences', @@ -376,32 +412,34 @@ function setting_getfields_expectedresult() { 'title' => 'Contact Dashboard', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the sections that should be included in the Contact Dashboard. EXAMPLE: If you don\'t want constituents to view their own contribution history, un-check that option.', 'help_text' => '', + 'serialize' => 1, ], 'address_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_options', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'optionGroupName' => 'address_options', ], 'default' => '123456891011', 'add' => '4.1', - 'title' => 'Addressing Options', + 'title' => 'Address Fields', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'serialize' => 1, ], 'address_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_format', 'type' => 'String', - 'html_type' => 'TextArea', + 'html_type' => 'textarea', 'default' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} @@ -410,7 +448,7 @@ function setting_getfields_expectedresult() { {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', 'add' => '4.1', - 'title' => 'Address Format', + 'title' => 'Address Display Format', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -421,7 +459,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'mailing_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.addressee} {contact.street_address} {contact.supplemental_address_1} @@ -430,7 +468,7 @@ function setting_getfields_expectedresult() { {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', 'add' => '4.1', - 'title' => 'Mailing Format', + 'title' => 'Mailing Label Format', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -441,28 +479,26 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'display_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}', 'add' => '4.1', - 'title' => 'Display Name Format', + 'title' => 'Individual Display Name Format', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Display name format for individual contact display names.', ], 'sort_name_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'sort_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.last_name}{, }{contact.first_name}', 'add' => '4.1', - 'title' => 'Sort Name Format', + 'title' => 'Individual Sort Name Format', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Sort name format for individual contact display names.', ], 'remote_profile_submissions' => [ 'group_name' => 'CiviCRM Preferences', @@ -485,13 +521,13 @@ function setting_getfields_expectedresult() { 'name' => 'allow_alert_autodismissal', 'type' => 'Boolean', 'quick_form_type' => 'YesNo', - 'default' => '1', + 'default' => TRUE, 'html_type' => 'radio', 'add' => '4.7', 'title' => 'Allow alerts to auto-dismiss?', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.', + 'description' => 'If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.', 'help_text' => '', ], 'editor_id' => [ @@ -499,10 +535,14 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'editor_id', 'type' => 'String', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => 'CKEditor', 'add' => '4.1', 'title' => 'Wysiwig Editor', + 'pseudoconstant' => [ + 'optionGroupName' => 'wysiwyg_editor', + 'keyColumn' => 'name', + ], 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -513,24 +553,29 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'contact_ajax_check_similar', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'radio', 'default' => '1', 'add' => '4.1', - 'title' => 'Ajax Check Similar', + 'title' => 'Check for Similar Contacts', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'options' => [ + '1' => 'While Typing', + '0' => 'When Saving', + '2' => 'Never', + ], ], 'ajaxPopupsEnabled' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'ajaxPopupsEnabled', 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', + 'html_type' => 'checkbox', 'default' => 1, 'add' => '4.5', - 'title' => 'Ajax Popups Enabled', + 'title' => 'Enable Popup Forms', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -540,8 +585,8 @@ function setting_getfields_expectedresult() { 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => '1', 'add' => '4.1', 'title' => 'Notify Activity Assignees', @@ -554,8 +599,8 @@ function setting_getfields_expectedresult() { 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification_ics', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.3', 'title' => 'Include ICal Invite to Activity Assignees', @@ -569,7 +614,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'contact_autocomplete_options', 'type' => 'String', - 'quick_form_type' => 'CheckBox', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions', ], @@ -580,13 +625,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.', 'help_text' => '', + 'serialize' => 1, + 'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne', ], 'contact_reference_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_reference_options', 'type' => 'String', - 'quick_form_type' => 'CheckBox', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions', ], @@ -597,6 +644,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in autocomplete dropdown search results for \'Contact Reference\' custom fields. Contact Name is always included. NOTE: You must assign \'access contact reference fields\' permission to the anonymous role if you want to use custom contact reference fields in profiles on public pages. For most situations, you should use the \'Limit List to Group\' setting when configuring a contact reference field which will be used in public forms to prevent exposing your entire contact list.', 'help_text' => '', + 'serialize' => 1, + 'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne', ], 'contact_smart_group_display' => [ 'group_name' => 'CiviCRM Preferences', @@ -609,8 +658,11 @@ function setting_getfields_expectedresult() { 'title' => 'Viewing Smart Groups', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Controls display of the smart groups that a contact is part of in each contact\'s \"Groups\" tab. \"Show on Demand\" provides the best performance, and is recommended for most sites.', 'help_text' => '', + 'pseudoconstant' => [ + 'optionGroupName' => 'contact_smart_group_display', + ], ], 'smart_group_cache_refresh_mode' => [ 'group_name' => 'CiviCRM Preferences', @@ -661,7 +713,7 @@ function setting_getfields_expectedresult() { 'title' => 'Maximum Attachments', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.', + 'description' => 'Maximum number of files (documents, images, etc.) which can be attached to emails or activities.', 'help_text' => '', ], 'maxFileSize' => [ @@ -680,7 +732,7 @@ function setting_getfields_expectedresult() { 'title' => 'Maximum File Size (in MB)', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.<br />Note: php.ini should support this file size.', + 'description' => 'Maximum Size of file (documents, images, etc.) which can be attached to emails or activities.<br />Note: php.ini should support this file size.', 'help_text' => '', ], 'contact_undelete' => [ @@ -770,7 +822,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 256, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Path to wkhtmltopdf executable', @@ -789,7 +841,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Options', @@ -808,7 +860,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Site Key', @@ -817,6 +869,21 @@ function setting_getfields_expectedresult() { 'description' => '', 'help_text' => '', ], + 'forceRecaptcha' => [ + 'add' => '4.7', + 'help_text' => '', + 'is_domain' => 1, + 'is_contact' => 0, + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'forceRecaptcha', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'html_type' => '', + 'default' => 0, + 'title' => 'Force reCAPTCHA on Contribution pages', + 'description' => 'If enabled, reCAPTCHA will show on all contribution pages.', + ], 'recaptchaPrivateKey' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -827,7 +894,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Secret Key', @@ -846,7 +913,7 @@ function setting_getfields_expectedresult() { 'size' => 2, 'maxlength' => 8, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 7, 'add' => '4.3', 'title' => 'Checksum Lifespan', @@ -865,7 +932,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Blog Feed URL', @@ -884,7 +951,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Community Messages URL', @@ -903,7 +970,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Getting Started URL', @@ -990,13 +1057,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'enable_components', 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', - 'html_attributes' => [ - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ], + 'html_type' => 'checkboxes', 'default' => '', 'add' => '4.4', 'title' => 'Enable Components', @@ -1009,6 +1070,9 @@ function setting_getfields_expectedresult() { '1' => 'CRM_Core_Component::flushEnabledComponents', '2' => 'call://resources/resetCacheCode', ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::getComponentSelectValues', + ], ], 'disable_core_css' => [ 'group_name' => 'CiviCRM Preferences', @@ -1117,7 +1181,7 @@ function setting_getfields_expectedresult() { 'size' => '32', 'maxlength' => '64', ], - 'default' => '', + 'default' => 'users', 'title' => 'CMS Users Table Name', 'description' => '', ], @@ -1231,29 +1295,160 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'syncCMSEmail', 'type' => 'Boolean', + 'html_type' => 'YesNo', 'quick_form_type' => 'YesNo', 'default' => 1, 'add' => '4.7', 'title' => 'Sync CMS Email', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.', + 'description' => 'If enabled, then CMS email id will be synchronised with CiviCRM contacts\'s primary email.', 'help_text' => '', ], 'preserve_activity_tab_filter' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'preserve_activity_tab_filter', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.7', 'title' => 'Preserve activity filters as a user preference', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts', + 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts.', + ], + 'do_not_notify_assignees_for' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'do_not_notify_assignees_for', + 'type' => 'Array', + 'add' => '4.7', + 'is_domain' => 1, + 'is_contact' => 0, + 'default' => [], + 'title' => 'Do not notify assignees for', + 'description' => 'These activity types will be excluded from automated email notifications to assignees.', + 'html_type' => 'select', + 'html_attributes' => [ + 'multiple' => 1, + 'class' => 'huge crm-select2', + ], + 'pseudoconstant' => [ + 'optionGroupName' => 'activity_type', + ], + 'quick_form_type' => 'Select', + ], + 'menubar_position' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'menubar_position', + 'type' => 'String', + 'html_type' => 'select', + 'default' => 'over-cms-menu', + 'add' => '5.12', + 'title' => 'Menubar position', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Location of the CiviCRM main menu.', + 'help_text' => '', + 'options' => [ + 'over-cms-menu' => 'Replace website menu', + 'below-cms-menu' => 'Below website menu', + 'above-crm-container' => 'Above content area', + 'none' => 'None - disable menu', + ], + ], + 'menubar_color' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'menubar_color', + 'type' => 'String', + 'html_type' => 'color', + 'default' => '#1b1b1b', + 'add' => '5.13', + 'title' => 'Menubar color', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Color of the CiviCRM main menu.', + 'help_text' => '', + 'validate_callback' => 'CRM_Utils_Color::normalize', + ], + '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' => 'Mime Types that can be passed as URL params', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Acceptable Mime Types that can be used as part of file urls', + 'help_text' => '', + ], + 'theme_frontend' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'theme_frontend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [ + 'class' => 'crm-select2', + ], + 'pseudoconstant' => [ + 'callback' => 'call://themes/getAvailable', + ], + 'default' => 'default', + 'add' => '5.16', + 'title' => 'Frontend Theme', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Theme to use on frontend pages', 'help_text' => '', ], + 'theme_backend' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'theme_backend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [ + 'class' => 'crm-select2', + ], + 'pseudoconstant' => [ + 'callback' => 'call://themes/getAvailable', + ], + 'default' => 'default', + 'add' => '5.16', + 'title' => 'Backend Theme', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Theme to use on backend pages', + 'help_text' => '', + ], + 'http_timeout' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'http_timeout', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => [ + 'size' => 2, + 'maxlength' => 3, + ], + 'default' => 5, + 'add' => '5.14', + 'title' => 'HTTP request timeout', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'How long should HTTP requests through Guzzle application run for in seconds', + 'help_text' => 'Set the number of seconds http requests should run for before terminating', + ], 'assetCache' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', @@ -1315,6 +1510,26 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', ], + 'environment' => [ + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'environment', + 'type' => 'String', + 'html_type' => 'Select', + 'quick_form_type' => 'Select', + 'default' => 'Production', + 'pseudoconstant' => [ + 'optionGroupName' => 'environment', + ], + 'add' => '4.7', + 'title' => 'Environment', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Setting to define the environment in which this CiviCRM instance is running.', + 'on_change' => [ + '0' => 'CRM_Core_BAO_Setting::onChangeEnvironmentSetting', + ], + ], 'fatalErrorHandler' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', @@ -1335,7 +1550,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'uploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1351,7 +1566,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'imageUploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1367,7 +1582,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customFileUploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1383,7 +1598,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customTemplateDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1399,7 +1614,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customPHPPathDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1415,7 +1630,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'extensionsDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1428,23 +1643,37 @@ function setting_getfields_expectedresult() { 'enable_cart' => [ 'name' => 'enable_cart', 'group_name' => 'Event Preferences', + 'settings_pages' => [ + 'event' => [ + 'weight' => 10, + ], + ], 'group' => 'event', 'type' => 'Boolean', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'CheckBox', 'default' => 0, 'add' => '4.1', - 'title' => 'Enable Event Cart', + 'title' => 'Use Shopping Cart Style Event Registration', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'WRITE ME', - 'help_text' => 'WRITE ME', + 'description' => 'This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a \"cart\" and then pay for them all at once. Enabling this setting will affect online registration for all active events. The code is an alpha state, and you will potentially need to have developer resources to debug and fix sections of the codebase while testing and deploying it', + 'help_text' => '', + 'documentation_link' => [ + 'page' => 'CiviEvent Cart Checkout', + 'resource' => 'wiki', + ], ], 'show_events' => [ 'name' => 'show_events', 'group_name' => 'Event Preferences', 'group' => 'event', + 'settings_pages' => [ + 'event' => [ + 'weight' => 20, + ], + ], 'type' => 'Integer', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'Select', 'default' => 10, 'add' => '4.5', 'title' => 'Dashboard entries', @@ -1453,6 +1682,9 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Configure how many events should be shown on the dashboard. This overrides the default value of 10 entries.', 'help_text' => '', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::getDashboardEntriesCount', + ], ], 'ext_repo_url' => [ 'group_name' => 'Extension Preferences', @@ -1464,7 +1696,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'https://civicrm.org/extdir/ver={ver}|cms={uf}', 'add' => '4.3', 'title' => 'Extension Repo URL', @@ -1590,11 +1822,11 @@ function setting_getfields_expectedresult() { 'quick_form_type' => 'Select', 'html_type' => 'Select', 'html_attributes' => [], - 'default' => '1228', 'add' => '4.4', 'title' => 'Default Country', 'is_domain' => 1, 'is_contact' => 0, + 'is_required' => '', 'description' => 'This value is selected by default when adding a new contact address.', 'help_text' => '', 'pseudoconstant' => [ @@ -1874,6 +2106,28 @@ function setting_getfields_expectedresult() { 'callback' => 'CRM_Core_I18n::languages', ], ], + 'uiLanguages' => [ + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'uiLanguages', + 'type' => 'Array', + 'quick_form_type' => 'Select', + 'html_type' => 'select', + 'html_attributes' => [ + 'multiple' => 1, + 'class' => 'crm-select2', + ], + 'default' => '', + 'add' => '5.9', + 'title' => 'Available Languages', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'User Interface languages available to users', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_I18n::languages', + ], + ], 'lcMessages' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', @@ -1981,7 +2235,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_double_optin', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => '1', 'add' => '4.1', @@ -1995,7 +2249,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'track_civimail_replies', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', @@ -2010,25 +2264,25 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_workflow', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Use CiviMail Workflow', + 'title' => 'Enable workflow support for CiviMail', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'Drupal-only. Rules module must be enabled (beta feature - use with caution).', 'help_text' => '', ], 'civimail_server_wide_lock' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_server_wide_lock', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Lock Mails Server-Wide for Mail Sending', + 'title' => 'Enable global server wide lock for CiviMail', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -2068,21 +2322,21 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_add_to_group_double_optin', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Enable Double Opt-in for Profile Group(s) field', + 'title' => 'Enable Double Opt-in for Profiles which use the \"Add to Group\" setting', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled and a profile uses the \"Add to Group\" setting, users who complete the profile form will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', ], 'disable_mandatory_tokens_check' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'disable_mandatory_tokens_check', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.4', @@ -2096,7 +2350,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'dedupe_email_default', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 1, 'add' => '4.5', @@ -2110,7 +2364,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'hash_mailing_url', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.5', @@ -2124,21 +2378,21 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_multiple_bulk_emails', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.5', - 'title' => ' Multiple Bulk Emails', + 'title' => 'Enable multiple bulk email address for a contact.', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.', + 'description' => 'CiviMail will deliver a copy of the email to each bulk email listed for the contact. Enabling this setting will also change the options for the \"Email on Hold\" field in Advanced Search.', 'help_text' => '', ], 'include_message_id' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'include_message_id', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => '', 'add' => '4.5', @@ -2248,7 +2502,8 @@ function setting_getfields_expectedresult() { 'group' => 'mailing', 'name' => 'write_activity_record', 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', + 'html_type' => 'checkbox', + 'quick_form_type' => 'CheckBox', 'default' => '1', 'add' => '4.7', 'title' => 'Enable CiviMail to create activities on delivery', @@ -2275,6 +2530,33 @@ function setting_getfields_expectedresult() { 'description' => 'The number of emails sendable via simple mail. Make sure you understand the implications for your spam reputation and legal requirements for bulk emails before editing. As there is some risk both to your spam reputation and the products if this is misused it is a hidden setting', 'help_text' => 'CiviCRM forces users sending more than this number of mails to use CiviMails. CiviMails have additional precautions: not sending to contacts who do not want bulk mail, adding domain name and opt out links. You should familiarise yourself with the law relevant to you on bulk mailings if changing this setting. For the US https://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003 is a good place to start.', ], + 'auto_recipient_rebuild' => [ + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'auto_recipient_rebuild', + 'type' => 'Boolean', + 'html_type' => 'checkbox', + 'quick_form_type' => 'CheckBox', + 'default' => '1', + 'title' => 'Enable automatic CiviMail recipient count display', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enable this setting to rebuild recipient list automatically during composing mail. Disable will allow you to rebuild recipient manually.', + 'help_text' => 'CiviMail automatically fetches recipient list and count whenever mailing groups are included or excluded while composing bulk mail. This phenomena may degrade performance for large sites, so disable this setting to build and fetch recipients for selected groups, manually.', + ], + 'allow_mail_from_logged_in_contact' => [ + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'allow_mail_from_logged_in_contact', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'title' => 'Allow mail from logged in contact', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Allow sending email from the logged in contact\'s email address', + 'help_text' => 'CiviCRM allows you to send email from the domain from email addresses and the logged in contact id addresses by default. Disable this if you only want to allow the domain from addresses to be used.', + ], 'geoAPIKey' => [ 'add' => '4.7', 'help_text' => '', @@ -2360,10 +2642,10 @@ function setting_getfields_expectedresult() { 'group' => 'member', 'name' => 'default_renewal_contribution_page', 'type' => 'Integer', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => '', 'pseudoconstant' => [ - 'name' => 'contributionPage', + 'callback' => 'CRM_Contribute_PseudoConstant::contributionPage', ], 'add' => '4.1', 'title' => 'Default online membership renewal page', @@ -2376,14 +2658,24 @@ function setting_getfields_expectedresult() { 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'is_enabled', - 'title' => 'Multisite Is enabled', - 'type' => 'Integer', + 'title' => 'Enable Multi Site Configuration', + 'html_type' => 'checkbox', + 'type' => 'Boolean', 'default' => 0, 'add' => '4.1', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Multisite is enabled', + 'description' => 'Make CiviCRM aware of multiple domains. You should configure a domain group if enabled', + 'documentation_link' => [ + 'page' => 'Multi Site Installation', + 'resource' => 'wiki', + ], 'help_text' => '', + 'settings_pages' => [ + 'multisite' => [ + 'weight' => 10, + ], + ], ], 'domain_group_id' => [ 'group_name' => 'Multi Site Preferences', @@ -2391,12 +2683,24 @@ function setting_getfields_expectedresult() { 'name' => 'domain_group_id', 'title' => 'Multisite Domain Group', 'type' => 'Integer', + 'html_type' => 'entity_reference', + 'entity_reference_options' => [ + 'entity' => 'Group', + 'select' => [ + 'minimumInputLength' => 0, + ], + ], 'default' => 0, 'add' => '4.1', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Contacts created on this site are added to this group', 'help_text' => '', + 'settings_pages' => [ + 'multisite' => [ + 'weight' => 20, + ], + ], ], 'event_price_set_domain_id' => [ 'group_name' => 'Multi Site Preferences', @@ -2430,11 +2734,7 @@ function setting_getfields_expectedresult() { 'name' => 'search_autocomplete_count', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => [ - 'size' => 2, - 'maxlength' => 2, - ], + 'html_type' => 'number', 'default' => 10, 'add' => '4.3', 'title' => 'Autocomplete Results', @@ -2473,7 +2773,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'simple', 'add' => '4.5', 'title' => 'How to handle full-tet queries', @@ -2558,7 +2858,7 @@ function setting_getfields_expectedresult() { 'name' => 'smartGroupCacheTimeout', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', + 'html_type' => 'number', 'default' => 5, 'add' => '4.6', 'title' => 'Smart group cache timeout', @@ -2588,6 +2888,25 @@ function setting_getfields_expectedresult() { 'description' => 'If set, this will be the default profile used for contact search.', 'help_text' => '', ], + 'prevNextBackend' => [ + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'prevNextBackend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [], + 'default' => 'default', + 'add' => '5.9', + 'title' => 'PrevNext Cache', + 'is_domain' => 1, + 'is_contact' => 0, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_BAO_PrevNextCache::getPrevNextBackends', + ], + 'description' => 'When performing a search, how should the search-results be cached?', + 'help_text' => '', + ], 'searchPrimaryDetailsOnly' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', @@ -2602,6 +2921,37 @@ function setting_getfields_expectedresult() { 'description' => 'If enabled, only primary details (eg contact\'s primary email, phone, etc) will be included in Basic and Advanced Search results. Disabling this feature will allow users to match contacts using any email, phone etc detail.', 'help_text' => '', ], + 'quicksearch_options' => [ + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'quicksearch_options', + 'type' => 'string', + 'serialize' => 1, + 'html_type' => 'checkboxes', + 'sortable' => TRUE, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::quicksearchOptions', + ], + 'default' => [ + '0' => 'sort_name', + '1' => 'contact_id', + '2' => 'external_identifier', + '3' => 'first_name', + '4' => 'last_name', + '5' => 'email', + '6' => 'phone_numeric', + '7' => 'street_address', + '8' => 'city', + '9' => 'postal_code', + '10' => 'job_title', + ], + 'add' => '5.8', + 'title' => 'Quicksearch options', + 'is_domain' => '1', + 'is_contact' => 0, + 'description' => 'Which fields can be searched on in the menubar quicksearch box? Don\'t see your custom field here? Make sure it is marked as Searchable.', + 'help_text' => '', + ], 'userFrameworkResourceURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', @@ -2609,7 +2959,7 @@ function setting_getfields_expectedresult() { 'name' => 'userFrameworkResourceURL', 'title' => 'CiviCRM Resource URL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2626,7 +2976,7 @@ function setting_getfields_expectedresult() { 'title' => 'Image Upload URL', 'name' => 'imageUploadURL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2643,7 +2993,7 @@ function setting_getfields_expectedresult() { 'name' => 'customCSSURL', 'title' => 'Custom CSS URL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2660,7 +3010,7 @@ function setting_getfields_expectedresult() { 'title' => 'Extension Resource URL', 'name' => 'extensionsURL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2683,17 +3033,17 @@ function setting_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php b/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php index de514afdc2..bc808c71ef 100644 --- a/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php +++ b/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php @@ -61,17 +61,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php b/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php index 9de1adaef0..1257cc53de 100644 --- a/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -69,17 +69,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetValue.php b/civicrm/api/v3/examples/Setting/GetValue.php index a5534bcac9..ef75b6a9e9 100644 --- a/civicrm/api/v3/examples/Setting/GetValue.php +++ b/civicrm/api/v3/examples/Setting/GetValue.php @@ -52,17 +52,17 @@ function setting_getvalue_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Revert.php b/civicrm/api/v3/examples/Setting/Revert.php index de5aa88ffa..7535db2a82 100644 --- a/civicrm/api/v3/examples/Setting/Revert.php +++ b/civicrm/api/v3/examples/Setting/Revert.php @@ -73,17 +73,17 @@ function setting_revert_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Create.php b/civicrm/api/v3/examples/StateProvince/Create.php index f84cd70bf2..d2a3e6c487 100644 --- a/civicrm/api/v3/examples/StateProvince/Create.php +++ b/civicrm/api/v3/examples/StateProvince/Create.php @@ -43,10 +43,10 @@ function state_province_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 13947, + 'id' => 14033, 'values' => [ - '13947' => [ - 'id' => '13947', + '14033' => [ + 'id' => '14033', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', @@ -64,17 +64,17 @@ function state_province_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Delete.php b/civicrm/api/v3/examples/StateProvince/Delete.php index 38863c43c8..9628de2efb 100644 --- a/civicrm/api/v3/examples/StateProvince/Delete.php +++ b/civicrm/api/v3/examples/StateProvince/Delete.php @@ -7,7 +7,7 @@ */ function state_province_delete_example() { $params = [ - 'id' => 13948, + 'id' => 14034, ]; try{ @@ -54,17 +54,17 @@ function state_province_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Get.php b/civicrm/api/v3/examples/StateProvince/Get.php index 7cdf17e9ca..3d3508aadc 100644 --- a/civicrm/api/v3/examples/StateProvince/Get.php +++ b/civicrm/api/v3/examples/StateProvince/Get.php @@ -41,10 +41,10 @@ function state_province_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 13949, + 'id' => 14035, 'values' => [ - '13949' => [ - 'id' => '13949', + '14035' => [ + 'id' => '14035', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', @@ -62,17 +62,17 @@ function state_province_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Create.php b/civicrm/api/v3/examples/StatusPreference/Create.php index d217d25a15..a18cc05451 100644 --- a/civicrm/api/v3/examples/StatusPreference/Create.php +++ b/civicrm/api/v3/examples/StatusPreference/Create.php @@ -69,17 +69,17 @@ function status_preference_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Delete.php b/civicrm/api/v3/examples/StatusPreference/Delete.php index 14afaefcda..3a7916de06 100644 --- a/civicrm/api/v3/examples/StatusPreference/Delete.php +++ b/civicrm/api/v3/examples/StatusPreference/Delete.php @@ -54,17 +54,17 @@ function status_preference_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Get.php b/civicrm/api/v3/examples/StatusPreference/Get.php index 8393a062f2..63c7503263 100644 --- a/civicrm/api/v3/examples/StatusPreference/Get.php +++ b/civicrm/api/v3/examples/StatusPreference/Get.php @@ -63,17 +63,17 @@ function status_preference_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/ChainedGetDelete.php b/civicrm/api/v3/examples/Survey/ChainedGetDelete.php index 222a49d251..a0b99eaede 100644 --- a/civicrm/api/v3/examples/Survey/ChainedGetDelete.php +++ b/civicrm/api/v3/examples/Survey/ChainedGetDelete.php @@ -77,17 +77,17 @@ function survey_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Create.php b/civicrm/api/v3/examples/Survey/Create.php index e4a4b55394..98ef5d3247 100644 --- a/civicrm/api/v3/examples/Survey/Create.php +++ b/civicrm/api/v3/examples/Survey/Create.php @@ -81,17 +81,17 @@ function survey_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Delete.php b/civicrm/api/v3/examples/Survey/Delete.php index acc86f7fa6..af49e79597 100644 --- a/civicrm/api/v3/examples/Survey/Delete.php +++ b/civicrm/api/v3/examples/Survey/Delete.php @@ -54,17 +54,17 @@ function survey_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Get.php b/civicrm/api/v3/examples/Survey/Get.php index ca7cbdd56c..a175e1473f 100644 --- a/civicrm/api/v3/examples/Survey/Get.php +++ b/civicrm/api/v3/examples/Survey/Get.php @@ -71,17 +71,17 @@ function survey_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SurveyRespondant/Get.php b/civicrm/api/v3/examples/SurveyRespondant/Get.php index 5fc87be96a..e54521f3aa 100644 --- a/civicrm/api/v3/examples/SurveyRespondant/Get.php +++ b/civicrm/api/v3/examples/SurveyRespondant/Get.php @@ -59,17 +59,17 @@ function survey_respondant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyRespondantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/System/Flush.php b/civicrm/api/v3/examples/System/Flush.php index e702ee259b..34b2ce28f4 100644 --- a/civicrm/api/v3/examples/System/Flush.php +++ b/civicrm/api/v3/examples/System/Flush.php @@ -54,17 +54,17 @@ function system_flush_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SystemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Create.php b/civicrm/api/v3/examples/Tag/Create.php index fbdc03fb9e..3905455770 100644 --- a/civicrm/api/v3/examples/Tag/Create.php +++ b/civicrm/api/v3/examples/Tag/Create.php @@ -42,16 +42,16 @@ function tag_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 12, + 'id' => 17, 'values' => [ - '12' => [ - 'id' => '12', + '17' => [ + 'id' => '17', 'name' => 'Super Heros', 'description' => 'Outside undie-wearers', 'parent_id' => '', - 'is_selectable' => '', - 'is_reserved' => '', - 'is_tagset' => '', + 'is_selectable' => '1', + 'is_reserved' => 0, + 'is_tagset' => 0, 'used_for' => 'civicrm_contact', 'created_id' => '', 'color' => '', @@ -70,17 +70,17 @@ function tag_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Delete.php b/civicrm/api/v3/examples/Tag/Delete.php index cd6dd09b6a..2f8867db1f 100644 --- a/civicrm/api/v3/examples/Tag/Delete.php +++ b/civicrm/api/v3/examples/Tag/Delete.php @@ -7,7 +7,7 @@ */ function tag_delete_example() { $params = [ - 'id' => '17', + 'id' => '24', ]; try{ @@ -54,17 +54,17 @@ function tag_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Get.php b/civicrm/api/v3/examples/Tag/Get.php index 4c4ac2faf0..c3d91f9dc2 100644 --- a/civicrm/api/v3/examples/Tag/Get.php +++ b/civicrm/api/v3/examples/Tag/Get.php @@ -7,7 +7,7 @@ */ function tag_get_example() { $params = [ - 'id' => '7', + 'id' => '8', 'name' => 'New Tag3', ]; @@ -42,10 +42,10 @@ function tag_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 7, + 'id' => 8, 'values' => [ - '7' => [ - 'id' => '7', + '8' => [ + 'id' => '8', 'name' => 'New Tag3', 'description' => 'This is description for Our New Tag ', 'is_selectable' => '1', @@ -67,17 +67,17 @@ function tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetFields.php b/civicrm/api/v3/examples/Tag/GetFields.php index 8636fb926d..acf9b173f7 100644 --- a/civicrm/api/v3/examples/Tag/GetFields.php +++ b/civicrm/api/v3/examples/Tag/GetFields.php @@ -50,9 +50,12 @@ function tag_getfields_expectedresult() { 'title' => 'Tag ID', 'description' => 'Tag ID', 'required' => TRUE, + 'where' => 'civicrm_tag.id', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'tag', ], @@ -65,9 +68,12 @@ function tag_getfields_expectedresult() { 'required' => TRUE, 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_tag.name', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.required' => 1, ], 'description' => [ @@ -77,20 +83,26 @@ function tag_getfields_expectedresult() { 'description' => 'Optional verbose description of the tag.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_tag.description', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'parent_id' => [ 'name' => 'parent_id', 'type' => 1, 'title' => 'Parent Tag', 'description' => 'Optional parent id for this tag.', + 'where' => 'civicrm_tag.parent_id', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Tag', + 'is_core_field' => TRUE, 'FKApiName' => 'Tag', ], 'is_selectable' => [ @@ -98,26 +110,35 @@ function tag_getfields_expectedresult() { 'type' => 16, 'title' => 'Display Tag?', 'description' => 'Is this tag selectable / displayed', + 'where' => 'civicrm_tag.is_selectable', 'default' => '1', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Reserved', + 'where' => 'civicrm_tag.is_reserved', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_tagset' => [ 'name' => 'is_tagset', 'type' => 16, 'title' => 'Tagset', + 'where' => 'civicrm_tag.is_tagset', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'used_for' => [ 'name' => 'used_for', @@ -125,10 +146,13 @@ function tag_getfields_expectedresult() { 'title' => 'Used For', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_tag.used_for', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'serialize' => 5, 'html' => [ 'type' => 'Select', 'maxlength' => 64, @@ -138,6 +162,7 @@ function tag_getfields_expectedresult() { 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', ], + 'is_core_field' => TRUE, 'api.default' => 'civicrm_contact', ], 'created_id' => [ @@ -145,10 +170,13 @@ function tag_getfields_expectedresult() { 'type' => 1, 'title' => 'Tag Created By', 'description' => 'FK to civicrm_contact, who created this tag', + 'where' => 'civicrm_tag.created_id', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'color' => [ @@ -158,19 +186,25 @@ function tag_getfields_expectedresult() { 'description' => 'Hex color value e.g. #ffffff', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_tag.color', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'created_date' => [ 'name' => 'created_date', 'type' => 12, 'title' => 'Tag Created Date', 'description' => 'Date and time that tag was created.', + 'where' => 'civicrm_tag.created_date', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], ], ]; @@ -185,17 +219,17 @@ function tag_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetList.php b/civicrm/api/v3/examples/Tag/GetList.php index 6c5b4b0394..a1fc219534 100644 --- a/civicrm/api/v3/examples/Tag/GetList.php +++ b/civicrm/api/v3/examples/Tag/GetList.php @@ -49,7 +49,7 @@ function tag_getlist_expectedresult() { 'id' => 0, 'values' => [ '0' => [ - 'id' => '19', + 'id' => '27', 'label' => 'New Tag3', 'description' => [ '0' => 'This is description for Our New Tag ', @@ -73,17 +73,17 @@ function tag_getlist_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetReturnArray.php b/civicrm/api/v3/examples/Tag/GetReturnArray.php index b4c541ce66..88bb104708 100644 --- a/civicrm/api/v3/examples/Tag/GetReturnArray.php +++ b/civicrm/api/v3/examples/Tag/GetReturnArray.php @@ -9,7 +9,7 @@ */ function tag_get_example() { $params = [ - 'id' => '8', + 'id' => '10', 'name' => 'New Tag3', 'return' => [ '0' => 'name', @@ -47,10 +47,10 @@ function tag_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 8, + 'id' => 10, 'values' => [ - '8' => [ - 'id' => '8', + '10' => [ + 'id' => '10', 'name' => 'New Tag3', ], ], @@ -66,17 +66,17 @@ function tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Create.php b/civicrm/api/v3/examples/UFField/Create.php index 7dfa389705..a4eb8f0eed 100644 --- a/civicrm/api/v3/examples/UFField/Create.php +++ b/civicrm/api/v3/examples/UFField/Create.php @@ -86,17 +86,17 @@ function uf_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Delete.php b/civicrm/api/v3/examples/UFField/Delete.php index c84edce6b0..b25806af75 100644 --- a/civicrm/api/v3/examples/UFField/Delete.php +++ b/civicrm/api/v3/examples/UFField/Delete.php @@ -54,17 +54,17 @@ function uf_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Get.php b/civicrm/api/v3/examples/UFField/Get.php index 91bfa7db7c..fc537cc71d 100644 --- a/civicrm/api/v3/examples/UFField/Get.php +++ b/civicrm/api/v3/examples/UFField/Get.php @@ -71,17 +71,17 @@ function uf_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Replace.php b/civicrm/api/v3/examples/UFField/Replace.php index dd32472a61..f0230b225e 100644 --- a/civicrm/api/v3/examples/UFField/Replace.php +++ b/civicrm/api/v3/examples/UFField/Replace.php @@ -152,17 +152,17 @@ function uf_field_replace_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Create.php b/civicrm/api/v3/examples/UFGroup/Create.php index b514ca44c4..f4096f2ac1 100644 --- a/civicrm/api/v3/examples/UFGroup/Create.php +++ b/civicrm/api/v3/examples/UFGroup/Create.php @@ -67,6 +67,7 @@ function uf_group_create_expectedresult() { 'is_active' => 0, 'group_type' => 'Individual,Contact', 'title' => 'Test Group', + 'frontend_title' => '', 'description' => '', 'help_pre' => 'help pre', 'help_post' => 'help post', @@ -86,6 +87,9 @@ function uf_group_create_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => '', + 'cancel_button_text' => '', + 'submit_button_text' => '', + 'add_cancel_button' => '', ], ], ]; @@ -100,17 +104,17 @@ function uf_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Delete.php b/civicrm/api/v3/examples/UFGroup/Delete.php index 58ee2e9cdb..b5560002db 100644 --- a/civicrm/api/v3/examples/UFGroup/Delete.php +++ b/civicrm/api/v3/examples/UFGroup/Delete.php @@ -54,17 +54,17 @@ function uf_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Get.php b/civicrm/api/v3/examples/UFGroup/Get.php index 2843f27ca2..e7abf95562 100644 --- a/civicrm/api/v3/examples/UFGroup/Get.php +++ b/civicrm/api/v3/examples/UFGroup/Get.php @@ -66,6 +66,7 @@ function uf_group_get_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => 0, + 'add_cancel_button' => '1', ], ], ]; @@ -80,17 +81,17 @@ function uf_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFJoin/Create.php b/civicrm/api/v3/examples/UFJoin/Create.php index 386b09b76c..4b388f10ac 100644 --- a/civicrm/api/v3/examples/UFJoin/Create.php +++ b/civicrm/api/v3/examples/UFJoin/Create.php @@ -72,17 +72,17 @@ function uf_join_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFJoin/Get.php b/civicrm/api/v3/examples/UFJoin/Get.php index 129626b354..88246c4694 100644 --- a/civicrm/api/v3/examples/UFJoin/Get.php +++ b/civicrm/api/v3/examples/UFJoin/Get.php @@ -67,17 +67,17 @@ function uf_join_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFMatch/Get.php b/civicrm/api/v3/examples/UFMatch/Get.php index 1c77731cb6..9f68b0c692 100644 --- a/civicrm/api/v3/examples/UFMatch/Get.php +++ b/civicrm/api/v3/examples/UFMatch/Get.php @@ -62,17 +62,17 @@ function uf_match_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFMatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/User/Get.php b/civicrm/api/v3/examples/User/Get.php new file mode 100644 index 0000000000..9c71f5b1b8 --- /dev/null +++ b/civicrm/api/v3/examples/User/Get.php @@ -0,0 +1,78 @@ +<?php +/** + * Test Generated example demonstrating the User.get API. + * + * @return array + * API result array + */ +function user_get_example() { + $params = [ + 'contact_id' => 3, + 'sequential' => 1, + ]; + + try{ + $result = civicrm_api3('User', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function user_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 6, + 'values' => [ + '0' => [ + 'id' => '6', + 'name' => 'superman', + 'contact_id' => '3', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testUserGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UserTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/User/GetFields.php b/civicrm/api/v3/examples/User/GetFields.php new file mode 100644 index 0000000000..d390e46af1 --- /dev/null +++ b/civicrm/api/v3/examples/User/GetFields.php @@ -0,0 +1,87 @@ +<?php +/** + * Test Generated example demonstrating the User.getfields API. + * + * @return array + * API result array + */ +function user_getfields_example() { + $params = [ + 'action' => 'get', + ]; + + try{ + $result = civicrm_api3('User', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function user_getfields_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => [ + 'contact_id' => [ + 'title' => 'Contact ID', + 'type' => 1, + 'api.required' => 1, + 'name' => 'contact_id', + ], + 'id' => [ + 'title' => 'CMS User ID', + 'type' => 1, + 'name' => 'id', + ], + 'name' => [ + 'title' => 'Username', + 'type' => 2, + 'name' => 'name', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetFields" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UserTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Website/Create.php b/civicrm/api/v3/examples/Website/Create.php index ca680c7339..66874a2227 100644 --- a/civicrm/api/v3/examples/Website/Create.php +++ b/civicrm/api/v3/examples/Website/Create.php @@ -64,17 +64,17 @@ function website_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/Delete.php b/civicrm/api/v3/examples/Website/Delete.php index 2b99ad2c6b..4a0d85693b 100644 --- a/civicrm/api/v3/examples/Website/Delete.php +++ b/civicrm/api/v3/examples/Website/Delete.php @@ -54,17 +54,17 @@ function website_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/Get.php b/civicrm/api/v3/examples/Website/Get.php index c4a8ee27ab..4c2470c789 100644 --- a/civicrm/api/v3/examples/Website/Get.php +++ b/civicrm/api/v3/examples/Website/Get.php @@ -7,7 +7,7 @@ */ function website_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 5, 'url' => 'website.com', 'website_type_id' => 1, ]; @@ -47,7 +47,7 @@ function website_get_expectedresult() { 'values' => [ '2' => [ 'id' => '2', - 'contact_id' => '4', + 'contact_id' => '5', 'url' => 'website.com', 'website_type_id' => '1', ], @@ -64,17 +64,17 @@ function website_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/GetFields.php b/civicrm/api/v3/examples/Website/GetFields.php index 32abee5b59..a4a5f78056 100644 --- a/civicrm/api/v3/examples/Website/GetFields.php +++ b/civicrm/api/v3/examples/Website/GetFields.php @@ -48,9 +48,12 @@ function website_getfields_expectedresult() { 'title' => 'Website ID', 'description' => 'Unique Website ID', 'required' => TRUE, + 'where' => 'civicrm_website.id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'website_id', ], @@ -60,10 +63,13 @@ function website_getfields_expectedresult() { 'type' => 1, 'title' => 'Contact', 'description' => 'FK to Contact ID', + 'where' => 'civicrm_website.contact_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'url' => [ @@ -81,20 +87,24 @@ function website_getfields_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'website_type_id' => [ 'name' => 'website_type_id', 'type' => 1, 'title' => 'Website Type', 'description' => 'Which Website type does this website belong to.', + 'where' => 'civicrm_website.website_type_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -104,6 +114,7 @@ function website_getfields_expectedresult() { 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', ], + 'is_core_field' => TRUE, ], ], ]; @@ -118,17 +129,17 @@ function website_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/GetWithMetadata.php b/civicrm/api/v3/examples/Website/GetWithMetadata.php index b77fac5a8b..2cf480b8f2 100644 --- a/civicrm/api/v3/examples/Website/GetWithMetadata.php +++ b/civicrm/api/v3/examples/Website/GetWithMetadata.php @@ -56,9 +56,12 @@ function website_get_expectedresult() { 'title' => 'Website ID', 'description' => 'Unique Website ID', 'required' => '1', + 'where' => 'civicrm_website.id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, + 'is_core_field' => '1', 'api.aliases' => [ '0' => 'website_id', ], @@ -68,10 +71,13 @@ function website_get_expectedresult() { 'type' => '1', 'title' => 'Contact', 'description' => 'FK to Contact ID', + 'where' => 'civicrm_website.contact_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => '1', 'FKApiName' => 'Contact', ], 'url' => [ @@ -89,20 +95,24 @@ function website_get_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => '128', 'size' => '30', ], + 'is_core_field' => '1', ], 'website_type_id' => [ 'name' => 'website_type_id', 'type' => '1', 'title' => 'Website Type', 'description' => 'Which Website type does this website belong to.', + 'where' => 'civicrm_website.website_type_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => '6', @@ -112,6 +122,7 @@ function website_get_expectedresult() { 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', ], + 'is_core_field' => '1', ], ], ], @@ -127,17 +138,17 @@ function website_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/bower.json b/civicrm/bower.json deleted file mode 100644 index 75e67552ef..0000000000 --- a/civicrm/bower.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "civicrm", - "description": "CiviCRM", - "version": "5.0.0", - "license": "AGPL-3.0", - "private": true, - "dependencies": { - "angular": "~1.5.0", - "angular-file-upload": ">=1.1.5 <=1.1.6", - "angular-jquery-dialog-service": "totten/angular-jquery-dialog-service#civicrm", - "angular-mocks": "~1.5.0", - "angular-route": "~1.5.0", - "angular-ui-sortable": "0.12.x", - "angular-ui-utils": "0.1.x", - "angular-unsavedChanges": "~0.1.1", - "qunit": "~1.10", - "d3": "3.4.11", - "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": "civicrm/jquery#1.12.4-civicrm-1.2", - "jquery-ui": "~1.12", - "lodash-compat": "~3.0", - "google-code-prettify": "~1.0", - "select2": "colemanw/select2#stable/3.5", - "jquery-validation": "~1.13", - "datatables": "~1.10", - "jstree": "~3", - "ckeditor": "~4.9", - "font-awesome": "~4", - "angular-bootstrap": "^2.5.0", - "angular-sanitize": "~1.5.0", - "smartmenus": "~1.1", - "phantomjs-polyfill": "^0.0.2", - "es6-promise": "^4.2.4", - "angular-xeditable": "^0.9.0", - "checklist-model": "~1", - "css-color-names": "~1" - }, - "resolutions": { - "angular": "~1.5.11", - "jquery": "1.12.4-civicrm-1.2" - } -} diff --git a/civicrm/bower_components/angular-bootstrap/.bower.json b/civicrm/bower_components/angular-bootstrap/.bower.json deleted file mode 100644 index f31ec0289a..0000000000 --- a/civicrm/bower_components/angular-bootstrap/.bower.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "author": { - "name": "https://github.com/angular-ui/bootstrap/graphs/contributors" - }, - "name": "angular-bootstrap", - "keywords": [ - "angular", - "angular-ui", - "bootstrap" - ], - "license": "MIT", - "ignore": [], - "description": "Native AngularJS (Angular) directives for Bootstrap.", - "version": "2.5.0", - "main": [ - "./ui-bootstrap-tpls.js" - ], - "dependencies": { - "angular": ">=1.4.0" - }, - "homepage": "https://github.com/angular-ui/bootstrap-bower", - "_release": "2.5.0", - "_resolution": { - "type": "version", - "tag": "2.5.0", - "commit": "2ab82fe5b072269e897d5d11333e9925888df456" - }, - "_source": "https://github.com/angular-ui/bootstrap-bower.git", - "_target": "^2.5.0", - "_originalSource": "angular-bootstrap" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json b/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json new file mode 100644 index 0000000000..ae35559dc5 --- /dev/null +++ b/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-bootstrap", + "url": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-file-upload/.bower.json b/civicrm/bower_components/angular-file-upload/.bower.json deleted file mode 100644 index aea5806e08..0000000000 --- a/civicrm/bower_components/angular-file-upload/.bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "angular-file-upload", - "main": "angular-file-upload.min.js", - "homepage": "https://github.com/nervgh/angular-file-upload", - "ignore": [ - "examples" - ], - "dependencies": { - "angular": "~1.2.11" - }, - "devDependencies": { - "es5-shim": ">=3.4.0" - }, - "keywords": [ - "angular", - "file", - "upload", - "module" - ], - "version": "1.1.6", - "_release": "1.1.6", - "_resolution": { - "type": "version", - "tag": "v1.1.6", - "commit": "1bf43e92ecb1bd46ffe34bbcd10d6173012b1b1d" - }, - "_source": "https://github.com/nervgh/angular-file-upload.git", - "_target": ">=1.1.5 <=1.1.6", - "_originalSource": "angular-file-upload" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json b/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json new file mode 100644 index 0000000000..c73357d95c --- /dev/null +++ b/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-file-upload", + "url": "https://github.com/nervgh/angular-file-upload/archive/v1.1.6.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-jquery-dialog-service/.bower.json b/civicrm/bower_components/angular-jquery-dialog-service/.bower.json deleted file mode 100644 index d3d7c85835..0000000000 --- a/civicrm/bower_components/angular-jquery-dialog-service/.bower.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "angular-jquery-dialog-service", - "homepage": "https://github.com/totten/angular-jquery-dialog-service", - "_release": "156e2f592f", - "_resolution": { - "type": "branch", - "branch": "civicrm", - "commit": "156e2f592f8cadd83f89e4b4b84f13fe0c72d21b" - }, - "_source": "https://github.com/totten/angular-jquery-dialog-service.git", - "_target": "civicrm", - "_originalSource": "totten/angular-jquery-dialog-service" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json b/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json new file mode 100644 index 0000000000..3c1ca0c3e0 --- /dev/null +++ b/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-jquery-dialog-service", + "url": "https://github.com/totten/angular-jquery-dialog-service/archive/v0.8.0-civicrm-1.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-mocks/.bower.json b/civicrm/bower_components/angular-mocks/.bower.json deleted file mode 100644 index 6aee5b3eab..0000000000 --- a/civicrm/bower_components/angular-mocks/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-mocks", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-mocks.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-mocks", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "8f1c89737c8a7e82fd91957cef92f577dad07565" - }, - "_source": "https://github.com/angular/bower-angular-mocks.git", - "_target": "~1.5.0", - "_originalSource": "angular-mocks" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json b/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json new file mode 100644 index 0000000000..3240c0443e --- /dev/null +++ b/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-mocks", + "url": "https://github.com/angular/bower-angular-mocks/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-route/.bower.json b/civicrm/bower_components/angular-route/.bower.json deleted file mode 100644 index a04afe45ea..0000000000 --- a/civicrm/bower_components/angular-route/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-route", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-route.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-route", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "cdb9db456ece8b3f80a638bb7bd69dc2dcd4eee9" - }, - "_source": "https://github.com/angular/bower-angular-route.git", - "_target": "~1.5.0", - "_originalSource": "angular-route" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json b/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json new file mode 100644 index 0000000000..060e6e74e1 --- /dev/null +++ b/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-route", + "url": "https://github.com/angular/bower-angular-route/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-sanitize/.bower.json b/civicrm/bower_components/angular-sanitize/.bower.json deleted file mode 100644 index b15e0090f1..0000000000 --- a/civicrm/bower_components/angular-sanitize/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-sanitize", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-sanitize.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-sanitize", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "84df06c4ec4f1eef7f9d0b849b9fdf5433c2669c" - }, - "_source": "https://github.com/angular/bower-angular-sanitize.git", - "_target": "~1.5.0", - "_originalSource": "angular-sanitize" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json b/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json new file mode 100644 index 0000000000..4811eb258d --- /dev/null +++ b/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-sanitize", + "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-sortable/.bower.json b/civicrm/bower_components/angular-ui-sortable/.bower.json deleted file mode 100644 index 716f51e468..0000000000 --- a/civicrm/bower_components/angular-ui-sortable/.bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "angular-ui-sortable", - "version": "0.12.11", - "main": "./sortable.js", - "dependencies": { - "angular": "~1.2.x", - "jquery-ui": ">=1.9" - }, - "homepage": "https://github.com/angular-ui/ui-sortable", - "_release": "0.12.11", - "_resolution": { - "type": "version", - "tag": "v0.12.11", - "commit": "1db53599b7fd28f6de36ff8a1111bdd47c10aa6d" - }, - "_source": "https://github.com/angular-ui/ui-sortable.git", - "_target": "0.12.x", - "_originalSource": "angular-ui-sortable" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json b/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json new file mode 100644 index 0000000000..4da6d34f8c --- /dev/null +++ b/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-ui-sortable", + "url": "https://github.com/angular-ui/ui-sortable/archive/v0.12.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-utils/.bower.json b/civicrm/bower_components/angular-ui-utils/.bower.json deleted file mode 100644 index 92a75199a3..0000000000 --- a/civicrm/bower_components/angular-ui-utils/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "angular-ui-utils", - "version": "0.1.1", - "main": "./ui-utils.js", - "dependencies": { - "angular": ">= 1.0.2" - }, - "homepage": "https://github.com/angular-ui/ui-utils", - "_release": "0.1.1", - "_resolution": { - "type": "version", - "tag": "v0.1.1", - "commit": "e25586548ff0a61df63bd4eb8fdc0715b1a87e72" - }, - "_source": "https://github.com/angular-ui/ui-utils.git", - "_target": "0.1.x", - "_originalSource": "angular-ui-utils" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json b/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json new file mode 100644 index 0000000000..d127edaf5c --- /dev/null +++ b/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-ui-utils", + "url": "https://github.com/angular-ui/ui-utils/archive/v0.1.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-unsavedChanges/.bower.json b/civicrm/bower_components/angular-unsavedChanges/.bower.json deleted file mode 100644 index b33b8a6232..0000000000 --- a/civicrm/bower_components/angular-unsavedChanges/.bower.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "angular-unsavedChanges", - "version": "0.1.1", - "homepage": "https://github.com/facultymatt/angular-unsavedChanges", - "authors": [ - "Matt Miller <matt@facultycreative.com>" - ], - "description": "AngularJS directive to warn user of unsaved changes when navigating away from a form.", - "main": "unsavedChanges.js", - "keywords": [ - "form", - "angularjs", - "unsaved", - "changes", - "warning", - "dirty", - "reload" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "angular": "~1.2.5" - }, - "devDependencies": { - "angular-route": "~1.2.2", - "angular-mocks": "~1.2.2", - "angular-scenario": "~1.2.2", - "jquery": "~2.0.3", - "angular-translate": "latest" - }, - "resolutions": { - "angular": "~1.2.5" - }, - "_release": "0.1.1", - "_resolution": { - "type": "version", - "tag": "v0.1.1", - "commit": "9bba1eba672e0e6169ff41ba02db1ce2c1c6acc7" - }, - "_source": "https://github.com/facultymatt/angular-unsavedChanges.git", - "_target": "~0.1.1", - "_originalSource": "angular-unsavedChanges" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json b/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json new file mode 100644 index 0000000000..bb30325b4e --- /dev/null +++ b/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-unsavedchanges", + "url": "https://github.com/facultymatt/angular-unsavedChanges/archive/v0.1.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-xeditable/.bower.json b/civicrm/bower_components/angular-xeditable/.bower.json deleted file mode 100644 index ed54a783e8..0000000000 --- a/civicrm/bower_components/angular-xeditable/.bower.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "angular-xeditable", - "version": "0.9.0", - "description": "Edit in place for AngularJS", - "author": "https://github.com/vitalets", - "license": "MIT", - "homepage": "http://vitalets.github.io/angular-xeditable", - "main": [ - "dist/css/xeditable.css", - "dist/js/xeditable.js" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "playground", - "test", - "libs", - "docs", - "zip", - "src", - "starter", - "Gruntfile.js", - "index.html", - "jsdoc.conf.json", - "package.json" - ], - "dependencies": { - "angular": "~1.x" - }, - "devDependencies": { - "angular": "~1.5.0", - "angular-mocks": "~1.5.0", - "angular-scenario": "~1.5.0", - "angular-sanitize": "~1.5.0", - "jquery": "^2.2.4", - "bootstrap": "^3.3.7", - "moment": "^2.17.1", - "checklist-model": "^0.10.0", - "ng-tags-input": "^3.1.1", - "angular-bootstrap": "^2.5.0", - "angular-ui-select": "^0.16.1", - "jquery-ui": "^1.12.1", - "angular-ui-date": "^1.0.1" - }, - "_release": "0.9.0", - "_resolution": { - "type": "version", - "tag": "0.9.0", - "commit": "a2fd62756d8ad19505814545bcbba5d7f9bba5ce" - }, - "_source": "https://github.com/vitalets/angular-xeditable.git", - "_target": "^0.9.0", - "_originalSource": "angular-xeditable" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json b/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json new file mode 100644 index 0000000000..013d08f17a --- /dev/null +++ b/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-xeditable", + "url": "https://github.com/vitalets/angular-xeditable/archive/0.9.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular/.bower.json b/civicrm/bower_components/angular/.bower.json deleted file mode 100644 index 23025d8a66..0000000000 --- a/civicrm/bower_components/angular/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "angular", - "version": "1.5.11", - "license": "MIT", - "main": "./angular.js", - "ignore": [], - "dependencies": {}, - "homepage": "https://github.com/angular/bower-angular", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "0f57428c3ffe2f486264ab7fbee3968dccc7b720" - }, - "_source": "https://github.com/angular/bower-angular.git", - "_target": "1.5.11", - "_originalSource": "angular" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json b/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json new file mode 100644 index 0000000000..3833c82330 --- /dev/null +++ b/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular", + "url": "https://github.com/angular/bower-angular/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/checklist-model/.bower.json b/civicrm/bower_components/checklist-model/.bower.json deleted file mode 100644 index 94fdf460f4..0000000000 --- a/civicrm/bower_components/checklist-model/.bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "checklist-model", - "version": "1.0.0", - "description": "AngularJS directive for list of checkboxes", - "author": "https://github.com/vitalets", - "license": "MIT", - "homepage": "http://vitalets.github.io/checklist-model", - "main": "checklist-model.js", - "ignore": [ - "**/.*", - "node_modules", - "docs", - "Gruntfile.js", - "index.html", - "package.json" - ], - "dependencies": { - "angular": ">=1.0.8" - }, - "devDependencies": {}, - "_release": "1.0.0", - "_resolution": { - "type": "version", - "tag": "1.0.0", - "commit": "a8d28276ec7fa697947074ab7d8c5ec3de0c3bb4" - }, - "_source": "https://github.com/vitalets/checklist-model.git", - "_target": "~1", - "_originalSource": "checklist-model" -} \ No newline at end of file diff --git a/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json b/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json new file mode 100644 index 0000000000..8222a0d263 --- /dev/null +++ b/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:checklist-model", + "url": "https://github.com/vitalets/checklist-model/archive/1.0.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/ckeditor/.bower.json b/civicrm/bower_components/ckeditor/.bower.json deleted file mode 100644 index c8e8e023fc..0000000000 --- a/civicrm/bower_components/ckeditor/.bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ckeditor", - "description": "JavaScript WYSIWYG web text editor.", - "keywords": [ - "ckeditor", - "fckeditor", - "editor", - "wysiwyg", - "html", - "richtext", - "text", - "javascript" - ], - "authors": "CKSource (http://cksource.com/)", - "license": "For licensing, see LICENSE.md or http://ckeditor.com/license.", - "homepage": "http://ckeditor.com", - "main": "./ckeditor.js", - "moduleType": "globals", - "version": "4.9.2", - "_release": "4.9.2", - "_resolution": { - "type": "version", - "tag": "4.9.2", - "commit": "993eb4fba6a70545f6c50da1988d39ecd9cf47a3" - }, - "_source": "https://github.com/ckeditor/ckeditor-releases.git", - "_target": "~4.9", - "_originalSource": "ckeditor" -} \ No newline at end of file diff --git a/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json b/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json new file mode 100644 index 0000000000..64a5a8586f --- /dev/null +++ b/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:ckeditor", + "url": "https://github.com/ckeditor/ckeditor-releases/archive/4.9.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter-1.3.x/.bower.json b/civicrm/bower_components/crossfilter-1.3.x/.bower.json deleted file mode 100644 index 9b5f903498..0000000000 --- a/civicrm/bower_components/crossfilter-1.3.x/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "crossfilter2", - "description": "Fast multidimensional filtering for coordinated views.", - "main": "crossfilter.min.js", - "license": "Apache-2.0", - "keywords": [ - "analytics", - "visualization", - "crossfilter" - ], - "homepage": "https://github.com/crossfilter/crossfilter", - "moduleType": [ - "globals", - "node" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "src", - "lib", - "test", - "component.json", - "package.json", - "index.js", - "Makefile" - ], - "version": "1.3.14", - "_release": "1.3.14", - "_resolution": { - "type": "version", - "tag": "1.3.14", - "commit": "8066669e84e13a8e3212df6dc20dee63f083cca2" - }, - "_source": "https://github.com/crossfilter/crossfilter.git", - "_target": "~1.3.11", - "_originalSource": "crossfilter2" -} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json b/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json new file mode 100644 index 0000000000..590664e856 --- /dev/null +++ b/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:crossfilter-1.3.x", + "url": "https://github.com/crossfilter/crossfilter/archive/1.3.14.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter2/.bower.json b/civicrm/bower_components/crossfilter2/.bower.json deleted file mode 100644 index 90836ab929..0000000000 --- a/civicrm/bower_components/crossfilter2/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "crossfilter2", - "description": "Fast multidimensional filtering for coordinated views.", - "main": "crossfilter.min.js", - "license": "Apache-2.0", - "keywords": [ - "analytics", - "visualization", - "crossfilter" - ], - "homepage": "https://github.com/crossfilter/crossfilter", - "moduleType": [ - "globals", - "node" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "package.json", - "index.js", - "src", - "component.json", - "media", - "test", - "tests" - ], - "version": "1.4.7", - "_release": "1.4.7", - "_resolution": { - "type": "version", - "tag": "1.4.7", - "commit": "8f29300df4949f70dafaeb675001d42991d75edd" - }, - "_source": "https://github.com/crossfilter/crossfilter.git", - "_target": "~1.4", - "_originalSource": "crossfilter2" -} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json b/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json new file mode 100644 index 0000000000..f5dd634474 --- /dev/null +++ b/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:crossfilter2", + "url": "https://github.com/crossfilter/crossfilter/archive/1.4.7.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/css-color-names/.bower.json b/civicrm/bower_components/css-color-names/.bower.json deleted file mode 100644 index db9d473fd8..0000000000 --- a/civicrm/bower_components/css-color-names/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "css-color-names", - "homepage": "https://github.com/bahamas10/css-color-names", - "version": "1.0.1", - "_release": "1.0.1", - "_resolution": { - "type": "version", - "tag": "v1.0.1", - "commit": "c41f2d98d6b018226f3505d6e0238bd7e2d7e611" - }, - "_source": "https://github.com/bahamas10/css-color-names.git", - "_target": "~1", - "_originalSource": "css-color-names" -} \ No newline at end of file diff --git a/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json b/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json new file mode 100644 index 0000000000..48818eca50 --- /dev/null +++ b/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:css-color-names", + "url": "https://github.com/bahamas10/css-color-names/archive/v1.0.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/d3-3.5.x/.bower.json b/civicrm/bower_components/d3-3.5.x/.bower.json deleted file mode 100644 index c83d63af97..0000000000 --- a/civicrm/bower_components/d3-3.5.x/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "d3", - "description": "A JavaScript visualization library for HTML and SVG.", - "main": "d3.js", - "license": "BSD-3-Clause", - "ignore": [], - "homepage": "https://github.com/mbostock-bower/d3-bower", - "version": "3.5.17", - "_release": "3.5.17", - "_resolution": { - "type": "version", - "tag": "v3.5.17", - "commit": "abe0262a205c9f3755c3a757de4dfd1d49f34b24" - }, - "_source": "https://github.com/mbostock-bower/d3-bower.git", - "_target": "~3.5.17", - "_originalSource": "d3" -} \ No newline at end of file diff --git a/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json b/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json new file mode 100644 index 0000000000..f7a4dc38bb --- /dev/null +++ b/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:d3-3.5.x", + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.5.17.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/d3/.bower.json b/civicrm/bower_components/d3/.bower.json deleted file mode 100644 index 4881d3b571..0000000000 --- a/civicrm/bower_components/d3/.bower.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "d3", - "version": "3.4.11", - "main": "d3.js", - "scripts": [ - "d3.js" - ], - "ignore": [ - ".DS_Store", - ".git", - ".gitignore", - ".npmignore", - ".travis.yml", - "Makefile", - "bin", - "component.json", - "index.js", - "lib", - "node_modules", - "package.json", - "src", - "test" - ], - "homepage": "https://github.com/mbostock-bower/d3-bower", - "_release": "3.4.11", - "_resolution": { - "type": "version", - "tag": "v3.4.11", - "commit": "e8317588b4c0494c494e510b968624609c1a3d3f" - }, - "_source": "https://github.com/mbostock-bower/d3-bower.git", - "_target": "3.4.11", - "_originalSource": "d3" -} \ No newline at end of file diff --git a/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json b/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json new file mode 100644 index 0000000000..3ac9931041 --- /dev/null +++ b/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:d3", + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.4.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/datatables/.bower.json b/civicrm/bower_components/datatables/.bower.json deleted file mode 100644 index b62efb2a7b..0000000000 --- a/civicrm/bower_components/datatables/.bower.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "datatables", - "main": [ - "media/js/jquery.dataTables.js", - "media/css/jquery.dataTables.css", - "media/images/sort_asc.png", - "media/images/sort_asc_disabled.png", - "media/images/sort_both.png", - "media/images/sort_desc.png", - "media/images/sort_desc_disabled.png" - ], - "dependencies": { - "jquery": ">=1.7.0" - }, - "license": "MIT", - "keywords": [ - "jquery", - "datatables", - "table", - "javascript", - "library" - ], - "ignore": [ - "/.*", - "examples", - "media/unit_testing", - "composer.json", - "dataTables.jquery.json", - "package.json" - ], - "homepage": "https://github.com/DataTables/DataTables", - "version": "1.10.19", - "_release": "1.10.19", - "_resolution": { - "type": "version", - "tag": "1.10.19", - "commit": "cedff8828e4507e36de9dc58e22edff5b8d37dfe" - }, - "_source": "https://github.com/DataTables/DataTables.git", - "_target": "~1.10", - "_originalSource": "datatables" -} \ No newline at end of file diff --git a/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json b/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json new file mode 100644 index 0000000000..326f23e456 --- /dev/null +++ b/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:datatables", + "url": "https://github.com/DataTables/DataTables/archive/1.10.19.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/.bower.json b/civicrm/bower_components/dc-2.1.x/.bower.json deleted file mode 100644 index a3ed44e63f..0000000000 --- a/civicrm/bower_components/dc-2.1.x/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "dcjs", - "main": [ - "dc.js", - "dc.css" - ], - "keywords": [ - "visualization", - "svg", - "animation", - "canvas", - "chart", - "dimensional", - "crossfilter", - "d3" - ], - "ignore": [ - "*", - "!dc.*", - "!LICENSE", - "!README.md" - ], - "dependencies": { - "d3": "3.x", - "crossfilter2": "~1.4" - }, - "homepage": "https://github.com/NickQiZhu/dc.js", - "version": "2.1.10", - "_release": "2.1.10", - "_resolution": { - "type": "version", - "tag": "2.1.10", - "commit": "1eb166ef26b33fca3875e490c29d1cacc960168e" - }, - "_source": "https://github.com/NickQiZhu/dc.js.git", - "_target": "~2.1.8", - "_originalSource": "dc.js" -} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json b/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json new file mode 100644 index 0000000000..7ef3ee7dfb --- /dev/null +++ b/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:dc-2.1.x", + "url": "https://github.com/NickQiZhu/dc.js/archive/2.1.10.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/bower.json b/civicrm/bower_components/dc-2.1.x/bower.json deleted file mode 100644 index 62f0c60a68..0000000000 --- a/civicrm/bower_components/dc-2.1.x/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "dcjs", - "main": ["dc.js", "dc.css"], - "keywords": [ - "visualization", - "svg", - "animation", - "canvas", - "chart", - "dimensional", - "crossfilter", - "d3" - ], - "ignore": [ - "*", - "!dc.*", - "!LICENSE", - "!README.md" - ], - "dependencies": { - "d3": "3.x", - "crossfilter2": "~1.4" - } -} diff --git a/civicrm/bower_components/es6-promise/.bower.json b/civicrm/bower_components/es6-promise/.bower.json deleted file mode 100644 index 516e10d580..0000000000 --- a/civicrm/bower_components/es6-promise/.bower.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "es6-promise", - "namespace": "Promise", - "description": "A polyfill for ES6-style Promises, tracking rsvp", - "authors": [ - "Stefan Penner <stefan.penner@gmail.com>" - ], - "main": "./es6-promise.js", - "keywords": [ - "promise" - ], - "repository": { - "type": "git", - "url": "git://github.com/stefanpenner/es6-promise.git" - }, - "bugs": { - "url": "https://github.com/stefanpenner/es6-promise/issues" - }, - "license": "MIT", - "homepage": "https://github.com/components/es6-promise", - "version": "4.2.4", - "_release": "4.2.4", - "_resolution": { - "type": "version", - "tag": "v4.2.4", - "commit": "c7911b0f272651dca8c3163704fd39628ed4283a" - }, - "_source": "https://github.com/components/es6-promise.git", - "_target": "^4.2.4", - "_originalSource": "es6-promise" -} \ No newline at end of file diff --git a/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json b/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json new file mode 100644 index 0000000000..ed3cc5662f --- /dev/null +++ b/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:es6-promise", + "url": "https://github.com/components/es6-promise/archive/v4.2.4.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/.bower.json b/civicrm/bower_components/font-awesome/.bower.json deleted file mode 100644 index 5903815482..0000000000 --- a/civicrm/bower_components/font-awesome/.bower.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "font-awesome", - "description": "Font Awesome", - "keywords": [], - "homepage": "http://fontawesome.io", - "dependencies": {}, - "devDependencies": {}, - "license": [ - "OFL-1.1", - "MIT", - "CC-BY-3.0" - ], - "main": [ - "less/font-awesome.less", - "scss/font-awesome.scss" - ], - "ignore": [ - "*/.*", - "*.json", - "src", - "*.yml", - "Gemfile", - "Gemfile.lock", - "*.md" - ], - "version": "4.7.0", - "_release": "4.7.0", - "_resolution": { - "type": "version", - "tag": "v4.7.0", - "commit": "a3fe90fa5f6fac55d197f9cbd18e3f57dafb716c" - }, - "_source": "https://github.com/FortAwesome/Font-Awesome.git", - "_target": "~4", - "_originalSource": "font-awesome" -} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json b/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json new file mode 100644 index 0000000000..a7cc944ae5 --- /dev/null +++ b/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:font-awesome", + "url": "https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/bower.json b/civicrm/bower_components/font-awesome/bower.json deleted file mode 100644 index 9e2112659b..0000000000 --- a/civicrm/bower_components/font-awesome/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "font-awesome", - "description": "Font Awesome", - "keywords": [], - "homepage": "http://fontawesome.io", - "dependencies": {}, - "devDependencies": {}, - "license": ["OFL-1.1", "MIT", "CC-BY-3.0"], - "main": [ - "less/font-awesome.less", - "scss/font-awesome.scss" - ], - "ignore": [ - "*/.*", - "*.json", - "src", - "*.yml", - "Gemfile", - "Gemfile.lock", - "*.md" - ] -} diff --git a/civicrm/bower_components/google-code-prettify/.bower.json b/civicrm/bower_components/google-code-prettify/.bower.json deleted file mode 100644 index ed3ae3e4af..0000000000 --- a/civicrm/bower_components/google-code-prettify/.bower.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "google-code-prettify", - "version": "1.0.5", - "main": [ - "./bin/prettify.min.css", - "./bin/prettify.min.js" - ], - "dependencies": {}, - "ignore": [ - "closure-compiler", - "js-modules", - "tests", - "yui-compressor", - "Makefile" - ], - "homepage": "https://github.com/tcollard/google-code-prettify", - "_release": "1.0.5", - "_resolution": { - "type": "version", - "tag": "v1.0.5", - "commit": "5e0b27bba2583a386c08ead942bbf25418c28784" - }, - "_source": "https://github.com/tcollard/google-code-prettify.git", - "_target": "~1.0", - "_originalSource": "google-code-prettify" -} \ No newline at end of file diff --git a/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json b/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json new file mode 100644 index 0000000000..5104588da1 --- /dev/null +++ b/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:google-code-prettify", + "url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-ui/.bower.json b/civicrm/bower_components/jquery-ui/.bower.json deleted file mode 100644 index d28097dd88..0000000000 --- a/civicrm/bower_components/jquery-ui/.bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "jquery-ui", - "version": "1.12.1", - "main": [ - "jquery-ui.js" - ], - "ignore": [], - "license": "MIT", - "dependencies": { - "jquery": ">=1.6" - }, - "homepage": "https://github.com/components/jqueryui", - "_release": "1.12.1", - "_resolution": { - "type": "version", - "tag": "1.12.1", - "commit": "44ecf3794cc56b65954cc19737234a3119d036cc" - }, - "_source": "https://github.com/components/jqueryui.git", - "_target": "~1.12", - "_originalSource": "jquery-ui" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json b/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json new file mode 100644 index 0000000000..a0bb4e854b --- /dev/null +++ b/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery-ui", + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-validation/.bower.json b/civicrm/bower_components/jquery-validation/.bower.json deleted file mode 100644 index 6f937f82ed..0000000000 --- a/civicrm/bower_components/jquery-validation/.bower.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "jquery-validation", - "homepage": "http://jqueryvalidation.org/", - "repository": { - "type": "git", - "url": "git://github.com/jzaefferer/jquery-validation.git" - }, - "authors": [ - "Jörn Zaefferer <joern.zaefferer@gmail.com>" - ], - "description": "Form validation made easy", - "main": "dist/jquery.validate.js", - "keywords": [ - "forms", - "validation", - "validate" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "demo", - "lib" - ], - "dependencies": { - "jquery": ">= 1.6.4" - }, - "version": "1.13.1", - "_release": "1.13.1", - "_resolution": { - "type": "version", - "tag": "1.13.1", - "commit": "91f9b8a8597ae8f8164671aadf5a8ed7eefcf4e4" - }, - "_source": "https://github.com/jzaefferer/jquery-validation.git", - "_target": "~1.13", - "_originalSource": "jquery-validation" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json b/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json new file mode 100644 index 0000000000..57affa2efd --- /dev/null +++ b/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery-validation", + "url": "https://github.com/jquery-validation/jquery-validation/archive/1.13.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery/.bower.json b/civicrm/bower_components/jquery/.bower.json deleted file mode 100644 index a833c07bba..0000000000 --- a/civicrm/bower_components/jquery/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "jquery", - "homepage": "https://github.com/civicrm/jquery", - "version": "1.12.4-civicrm-1.2", - "_release": "1.12.4-civicrm-1.2", - "_resolution": { - "type": "version", - "tag": "1.12.4-civicrm-1.2", - "commit": "b948cbb31d608a5ded2aa6bae6557aa754dbf47d" - }, - "_source": "https://github.com/civicrm/jquery.git", - "_target": "1.12.4-civicrm-1.2", - "_originalSource": "civicrm/jquery" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json b/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json new file mode 100644 index 0000000000..7a1a3609f7 --- /dev/null +++ b/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery", + "url": "https://github.com/civicrm/jquery/archive/1.12.4-civicrm-1.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/.bower.json b/civicrm/bower_components/jstree/.bower.json deleted file mode 100644 index 4486b7a786..0000000000 --- a/civicrm/bower_components/jstree/.bower.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "jstree", - "license": "MIT", - "version": "3.3.8", - "main": [ - "./dist/jstree.js", - "./dist/themes/default/style.css" - ], - "ignore": [ - "**/.*", - "docs", - "demo", - "libs", - "node_modules", - "test", - "libs", - "jstree.jquery.json", - "gruntfile.js", - "package.json", - "bower.json", - "component.json", - "LICENCE-MIT", - "README.md" - ], - "dependencies": { - "jquery": ">=1.9.1" - }, - "keywords": [ - "ui", - "tree", - "jstree" - ], - "homepage": "https://github.com/vakata/jstree", - "_release": "3.3.8", - "_resolution": { - "type": "version", - "tag": "3.3.8", - "commit": "c9d7c1425f2272c5400536fa631eba8657522ecf" - }, - "_source": "https://github.com/vakata/jstree.git", - "_target": "~3", - "_originalSource": "jstree" -} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json b/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json new file mode 100644 index 0000000000..fe930393c3 --- /dev/null +++ b/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jstree", + "url": "https://github.com/vakata/jstree/archive/3.3.8.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/bower.json b/civicrm/bower_components/jstree/bower.json deleted file mode 100644 index e3265b11f5..0000000000 --- a/civicrm/bower_components/jstree/bower.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "jstree", - "license": "MIT", - "version": "3.3.8", - "main" : [ - "./dist/jstree.js", - "./dist/themes/default/style.css" - ], - "ignore": [ - "**/.*", - "docs", - "demo", - "libs", - "node_modules", - "test", - "libs", - "jstree.jquery.json", - "gruntfile.js", - "package.json", - "bower.json", - "component.json", - "LICENCE-MIT", - "README.md" - ], - "dependencies": { - "jquery": ">=1.9.1" - }, - "keywords": [ - "ui", - "tree", - "jstree" - ] -} diff --git a/civicrm/bower_components/lodash-compat/.bower.json b/civicrm/bower_components/lodash-compat/.bower.json deleted file mode 100644 index 753792395f..0000000000 --- a/civicrm/bower_components/lodash-compat/.bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "lodash-compat", - "version": "3.0.1", - "main": "lodash.js", - "ignore": [ - ".*", - "*.log", - "*.md", - "component.json", - "package.json", - "node_modules" - ], - "homepage": "https://github.com/lodash/lodash-compat", - "_release": "3.0.1", - "_resolution": { - "type": "version", - "tag": "3.0.1", - "commit": "c0dd92d1e5c993c632d8efeb083d6b2ace640118" - }, - "_source": "https://github.com/lodash/lodash-compat.git", - "_target": "~3.0", - "_originalSource": "lodash-compat" -} \ No newline at end of file diff --git a/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json b/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json new file mode 100644 index 0000000000..0fb35c76cf --- /dev/null +++ b/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:lodash-compat", + "url": "https://github.com/lodash/lodash-compat/archive/3.0.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/phantomjs-polyfill/.bower.json b/civicrm/bower_components/phantomjs-polyfill/.bower.json deleted file mode 100644 index a6702b104c..0000000000 --- a/civicrm/bower_components/phantomjs-polyfill/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "phantomjs-polyfill", - "homepage": "https://github.com/conversocial/phantomjs-polyfill", - "version": "0.0.2", - "_release": "0.0.2", - "_resolution": { - "type": "version", - "tag": "v0.0.2", - "commit": "a1f767df019a1d02bfca39546dfe6bcc8c057c75" - }, - "_source": "https://github.com/conversocial/phantomjs-polyfill.git", - "_target": "^0.0.2", - "_originalSource": "phantomjs-polyfill" -} \ No newline at end of file diff --git a/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json b/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json new file mode 100644 index 0000000000..1ec7a2f5f7 --- /dev/null +++ b/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:phantomjs-polyfill", + "url": "https://github.com/conversocial/phantomjs-polyfill/archive/v0.0.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/qunit/.bower.json b/civicrm/bower_components/qunit/.bower.json deleted file mode 100644 index 7641228637..0000000000 --- a/civicrm/bower_components/qunit/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "qunit", - "homepage": "https://github.com/jquery/qunit", - "version": "1.10.0", - "_release": "1.10.0", - "_resolution": { - "type": "version", - "tag": "v1.10.0", - "commit": "900f72051b0112342feda3d700a7a049d886b9ce" - }, - "_source": "https://github.com/jquery/qunit.git", - "_target": "~1.10", - "_originalSource": "qunit" -} \ No newline at end of file diff --git a/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json b/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json new file mode 100644 index 0000000000..2438bdbaff --- /dev/null +++ b/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:qunit", + "url": "https://github.com/jquery/qunit/archive/v1.10.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/select2/.bower.json b/civicrm/bower_components/select2/.bower.json deleted file mode 100644 index ff78f03e76..0000000000 --- a/civicrm/bower_components/select2/.bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "select2", - "main": [ - "select2.js", - "select2.css", - "select2.png", - "select2x2.png", - "select2-spinner.gif" - ], - "dependencies": { - "jquery": ">= 1.7.1" - }, - "homepage": "https://github.com/colemanw/select2", - "_release": "1b03cb0b28", - "_resolution": { - "type": "branch", - "branch": "stable/3.5", - "commit": "1b03cb0b2837549350e17b8d07ae2947dd8ac0a6" - }, - "_source": "https://github.com/colemanw/select2.git", - "_target": "stable/3.5", - "_originalSource": "colemanw/select2" -} \ No newline at end of file diff --git a/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json b/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json new file mode 100644 index 0000000000..0ec2bae6e5 --- /dev/null +++ b/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:select2", + "url": "https://github.com/colemanw/select2/archive/v3.5-civicrm-1.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/smartmenus/.bower.json b/civicrm/bower_components/smartmenus/.bower.json deleted file mode 100644 index e655f19ef2..0000000000 --- a/civicrm/bower_components/smartmenus/.bower.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "smartmenus", - "title": "SmartMenus", - "description": "Advanced jQuery website menu plugin. Mobile first, responsive and accessible list-based website menus that work on all devices.", - "keywords": [ - "menu", - "navigation", - "accessible", - "responsive", - "mobile", - "ui", - "jquery-plugin", - "bootstrap", - "ecosystem:jquery" - ], - "version": "1.1.0", - "version_keyboard_addon": "0.4.0", - "version_bootstrap_addon": "0.4.0", - "version_bootstrap_4_addon": "0.1.0", - "main": [ - "dist/jquery.smartmenus.js" - ], - "author": { - "name": "Vasil Dinkov", - "email": "vasko.dinkov@gmail.com", - "url": "http://vadikom.com" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/vadikom/smartmenus.git" - }, - "bugs": "https://github.com/vadikom/smartmenus/issues", - "homepage": "http://www.smartmenus.org/", - "docs": "http://www.smartmenus.org/docs/", - "download": "http://www.smartmenus.org/download/", - "dependencies": { - "jquery": ">=1.7.0" - }, - "ignore": [ - ".gitignore", - "Gruntfile.js" - ], - "_release": "1.1.0", - "_resolution": { - "type": "version", - "tag": "1.1.0", - "commit": "9a73dd16049c8ac0b000d0c7b23b47defed61015" - }, - "_source": "https://github.com/vadikom/smartmenus.git", - "_target": "~1.1", - "_originalSource": "smartmenus" -} \ No newline at end of file diff --git a/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json b/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json new file mode 100644 index 0000000000..16db09c03c --- /dev/null +++ b/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:smartmenus", + "url": "https://github.com/vadikom/smartmenus/archive/1.1.0.zip" +} \ No newline at end of file diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php index 2600909108..1eb317eff8 100644 --- a/civicrm/civicrm-version.php +++ b/civicrm/civicrm-version.php @@ -1,7 +1,7 @@ <?php /** @deprecated */ function civicrmVersion( ) { - return array( 'version' => '5.17.5', + return array( 'version' => '5.18.0', 'cms' => 'Wordpress', 'revision' => '' ); } diff --git a/civicrm/composer.json b/civicrm/composer.json index f5dfe17601..b298a5c9ba 100644 --- a/civicrm/composer.json +++ b/civicrm/composer.json @@ -63,6 +63,7 @@ "cweagans/composer-patches": "~1.0", "pear/log": "1.13.1", "katzien/php-mime-type": "2.1.0", + "civicrm/composer-downloads-plugin": "^2.0", "league/csv": "^9.2" }, "require-dev": { @@ -87,6 +88,122 @@ ] }, "extra": { + "downloads": { + "*": { + "path": "bower_components/{$id}" + }, + "angular": { + "url": "https://github.com/angular/bower-angular/archive/v1.5.11.zip" + }, + "angular-bootstrap": { + "url": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.zip" + }, + "angular-file-upload": { + "url": "https://github.com/nervgh/angular-file-upload/archive/v1.1.6.zip", + "ignore": ["examples"] + }, + "angular-jquery-dialog-service": { + "url": "https://github.com/totten/angular-jquery-dialog-service/archive/v0.8.0-civicrm-1.0.zip" + }, + "angular-mocks": { + "url": "https://github.com/angular/bower-angular-mocks/archive/v1.5.11.zip" + }, + "angular-route": { + "url": "https://github.com/angular/bower-angular-route/archive/v1.5.11.zip" + }, + "angular-sanitize": { + "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.5.11.zip" + }, + "angular-ui-sortable": { + "url": "https://github.com/angular-ui/ui-sortable/archive/v0.12.11.zip" + }, + "angular-ui-utils": { + "url": "https://github.com/angular-ui/ui-utils/archive/v0.1.1.zip" + }, + "angular-unsavedChanges": { + "url": "https://github.com/facultymatt/angular-unsavedChanges/archive/v0.1.1.zip", + "ignore": [".*", "node_modules", "bower_components", "test", "tests"] + }, + "angular-xeditable": { + "url": "https://github.com/vitalets/angular-xeditable/archive/0.9.0.zip", + "ignore": [".*", "node_modules", "bower_components", "playground", "test", "libs", "docs", "zip", "src", "starter", "Gruntfile.js", "index.html", "jsdoc.conf.json", "package.json"] + }, + "checklist-model": { + "url": "https://github.com/vitalets/checklist-model/archive/1.0.0.zip", + "ignore": [".*", "node_modules", "docs", "Gruntfile.js", "index.html", "package.json", "test"] + }, + "ckeditor": { + "url": "https://github.com/ckeditor/ckeditor-releases/archive/4.9.2.zip" + }, + "crossfilter-1.3.x": { + "url": "https://github.com/crossfilter/crossfilter/archive/1.3.14.zip", + "ignore": [".*", "node_modules", "bower_components", "src", "lib", "test", "component.json", "package.json", "index.js", "Makefile"] + }, + "crossfilter2": { + "url": "https://github.com/crossfilter/crossfilter/archive/1.4.7.zip", + "ignore": [".*", "node_modules", "bower_components", "package.json", "index.js", "src", "component.json", "media", "test", "tests"] + }, + "css-color-names": { + "url": "https://github.com/bahamas10/css-color-names/archive/v1.0.1.zip" + }, + "d3": { + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.4.11.zip", + "ignore": [".DS_Store", ".git", ".gitignore", ".npmignore", ".travis.yml", "Makefile", "bin", "component.json", "index.js", "lib", "node_modules", "package.json", "src", "test"] + }, + "d3-3.5.x": { + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.5.17.zip" + }, + "datatables": { + "url": "https://github.com/DataTables/DataTables/archive/1.10.19.zip", + "ignore": ["/.*", "examples", "media/unit_testing", "composer.json", "dataTables.jquery.json", "package.json"] + }, + "dc-2.1.x": { + "url": "https://github.com/NickQiZhu/dc.js/archive/2.1.10.zip", + "ignore": [".*", "style", "web", "*.json", "regression", "scripts", "spec", "src", "docs", "grunt", "Gruntfile.js", "Changelog.md", "welcome.md", "class-hierarchy.dot", "index.js", "CONTRIBUTING.md", "LICENSE_BANNER", "AUTHORS"] + }, + "es6-promise": { + "url": "https://github.com/components/es6-promise/archive/v4.2.4.zip" + }, + "font-awesome": { + "url": "https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip", + "ignore": ["*/.*", "*.json", "src", "*.yml", "Gemfile", "Gemfile.lock", "*.md"] + }, + "google-code-prettify": { + "url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip", + "ignore": ["closure-compiler", "js-modules", "tests", "yui-compressor", "Makefile"] + }, + "jquery": { + "url": "https://github.com/civicrm/jquery/archive/1.12.4-civicrm-1.2.zip" + }, + "jquery-ui": { + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" + }, + "jquery-validation": { + "url": "https://github.com/jquery-validation/jquery-validation/archive/1.13.1.zip", + "ignore": [".*", "node_modules", "bower_components", "test", "demo", "lib"] + }, + "jstree": { + "url": "https://github.com/vakata/jstree/archive/3.3.8.zip", + "ignore": [".*", "docs", "demo", "libs", "node_modules", "test", "libs", "jstree.jquery.json", "gruntfile.js", "package.json", "bower.json", "component.json", "LICENCE-MIT", "README.md"] + }, + "lodash-compat": { + "url": "https://github.com/lodash/lodash-compat/archive/3.0.1.zip", + "ignore": [".*", "*.log", "*.md", "component.json", "package.json", "node_modules"] + }, + "phantomjs-polyfill": { + "url": "https://github.com/conversocial/phantomjs-polyfill/archive/v0.0.2.zip" + }, + "qunit": { + "url": "https://github.com/jquery/qunit/archive/v1.10.0.zip" + }, + "select2": { + "url": "https://github.com/colemanw/select2/archive/v3.5-civicrm-1.0.zip" + }, + "smartmenus": { + "url": "https://github.com/vadikom/smartmenus/archive/1.1.0.zip", + "ignore": [".gitignore", "Gruntfile.js"] + } + }, "patches": { "phpoffice/common": { "Fix handling of libxml_disable_entity_loader": "tools/scripts/composer/patches/phpoffice-common-xml-entity-fix.patch" diff --git a/civicrm/composer.lock b/civicrm/composer.lock index db62133882..ab0f88ec85 100644 --- a/civicrm/composer.lock +++ b/civicrm/composer.lock @@ -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": "ffdac3f93564fe6edb467d3ac43c4869", + "content-hash": "195f60bb40e72b390be3211fcc870a38", "packages": [ { "name": "civicrm/civicrm-cxn-rpc", @@ -80,6 +80,57 @@ "description": "CiviCRM installation library", "time": "2018-01-23T06:26:55+00:00" }, + { + "name": "civicrm/composer-downloads-plugin", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/civicrm/composer-downloads-plugin.git", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/civicrm/composer-downloads-plugin/zipball/869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "friendsofphp/php-cs-fixer": "^2.3", + "phpunit/phpunit": "^5.7", + "totten/process-helper": "^1.0.1" + }, + "type": "composer-plugin", + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + }, + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "description": "Composer plugin for downloading additional files within any composer package.", + "time": "2019-08-22T10:56:51+00:00" + }, { "name": "cweagans/composer-patches", "version": "1.6.5", @@ -2107,6 +2158,39 @@ ], "time": "2018-10-16T17:24:05+00:00" }, + { + "name": "togos/gitignore", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/TOGoS/PHPGitIgnore.git", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TOGoS/PHPGitIgnore/zipball/32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files", + "time": "2019-04-19T19:16:58+00:00" + }, { "name": "totten/ca-config", "version": "v17.05.0", diff --git a/civicrm/css/joomla.css b/civicrm/css/joomla.css index 3f417d7916..f232545eb1 100644 --- a/civicrm/css/joomla.css +++ b/civicrm/css/joomla.css @@ -155,9 +155,6 @@ br.clear { #header, #content { width: 100%; } -#header { - background-color: #69c; -} #logo { vertical-align: middle; border: 0; diff --git a/civicrm/ext/api4/CRM/Api4/Page/AJAX.php b/civicrm/ext/api4/CRM/Api4/Page/AJAX.php index 6a1bc2dee6..e8346ca032 100644 --- a/civicrm/ext/api4/CRM/Api4/Page/AJAX.php +++ b/civicrm/ext/api4/CRM/Api4/Page/AJAX.php @@ -33,7 +33,7 @@ class CRM_Api4_Page_AJAX extends CRM_Core_Page { ]; if (CRM_Core_Permission::check('view debug output')) { $response['error_message'] = $e->getMessage(); - if (CRM_Core_BAO_Setting::getItem(NULL, 'backtrace')) { + if (\Civi::settings()->get('backtrace')) { $response['backtrace'] = $e->getTrace(); } } @@ -54,12 +54,18 @@ class CRM_Api4_Page_AJAX extends CRM_Core_Page { */ protected function execute($entity, $action, $params = [], $index = NULL) { $params['checkPermissions'] = TRUE; - $result = civicrm_api4($entity, $action, $params, $index); + + // Handle numeric indexes later so we can get the count + $itemAt = CRM_Utils_Type::validate($index, 'Integer', FALSE); + + $result = civicrm_api4($entity, $action, $params, isset($itemAt) ? NULL : $index); + // Convert arrayObject into something more suitable for json - $vals = ['values' => (array) $result]; + $vals = ['values' => isset($itemAt) ? $result->itemAt($itemAt) : (array) $result]; foreach (get_class_vars(get_class($result)) as $key => $val) { $vals[$key] = $result->$key; } + $vals['count'] = $result->count(); return $vals; } diff --git a/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php b/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php index 50aa0c3d58..f06452548c 100644 --- a/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php +++ b/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php @@ -6,10 +6,14 @@ class CRM_Api4_Page_Api4Explorer extends CRM_Core_Page { $vars = [ 'operators' => \CRM_Core_DAO::acceptedSQLOperators(), 'basePath' => Civi::resources()->getUrl('org.civicrm.api4'), + 'schema' => (array) \Civi\Api4\Entity::get()->setChain(['fields' => ['$name', 'getFields']])->execute(), + 'links' => (array) \Civi\Api4\Entity::getLinks()->execute(), ]; Civi::resources() ->addVars('api4', $vars) - ->addScriptFile('org.civicrm.api4', 'js/load-bootstrap.js'); + ->addScriptFile('org.civicrm.api4', 'js/load-bootstrap.js') + ->addScriptFile('civicrm', 'bower_components/google-code-prettify/bin/prettify.min.js') + ->addStyleFile('civicrm', 'bower_components/google-code-prettify/bin/prettify.min.css'); $loader = new Civi\Angular\AngularLoader(); $loader->setModules(['api4Explorer']); diff --git a/civicrm/ext/api4/CRM/Api4/Services.php b/civicrm/ext/api4/CRM/Api4/Services.php new file mode 100644 index 0000000000..ddd889a390 --- /dev/null +++ b/civicrm/ext/api4/CRM/Api4/Services.php @@ -0,0 +1,75 @@ +<?php + +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\Config\FileLocator; + +class CRM_Api4_Services { + + /** + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public static function hook_container($container) { + $loader = new XmlFileLoader($container, new FileLocator(dirname(dirname(__DIR__)))); + $loader->load('Civi/Api4/services.xml'); + + self::loadServices('Civi\Api4\Service\Spec\Provider', 'spec_provider', $container); + self::loadServices('Civi\Api4\Event\Subscriber', 'event_subscriber', $container); + + $container->getDefinition('civi_api_kernel')->addMethodCall( + 'registerApiProvider', + [new Reference('action_object_provider')] + ); + + // add event subscribers$container->get( + $dispatcher = $container->getDefinition('dispatcher'); + $subscribers = $container->findTaggedServiceIds('event_subscriber'); + + foreach (array_keys($subscribers) as $subscriber) { + $dispatcher->addMethodCall( + 'addSubscriber', + [new Reference($subscriber)] + ); + } + + // add spec providers + $providers = $container->findTaggedServiceIds('spec_provider'); + $gatherer = $container->getDefinition('spec_gatherer'); + + foreach (array_keys($providers) as $provider) { + $gatherer->addMethodCall( + 'addSpecProvider', + [new Reference($provider)] + ); + } + + if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests') { + $loader->load('tests/phpunit/api/v4/services.xml'); + } + } + + /** + * Load all services in a given directory + * + * @param string $namespace + * @param string $tag + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public static function loadServices($namespace, $tag, $container) { + $namespace = \CRM_Utils_File::addTrailingSlash($namespace, '\\'); + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $path = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])) . str_replace('\\', DIRECTORY_SEPARATOR, $namespace); + foreach (glob("$path*.php") as $file) { + $matches = []; + preg_match('/(\w*).php/', $file, $matches); + $serviceName = $namespace . array_pop($matches); + $serviceClass = new \ReflectionClass($serviceName); + if ($serviceClass->isInstantiable()) { + $definition = $container->register(str_replace('\\', '_', $serviceName), $serviceName); + $definition->addTag($tag); + } + } + } + } + +} diff --git a/civicrm/ext/api4/CRM/Api4/Upgrader.php b/civicrm/ext/api4/CRM/Api4/Upgrader.php index b2fda2a724..534eca552f 100644 --- a/civicrm/ext/api4/CRM/Api4/Upgrader.php +++ b/civicrm/ext/api4/CRM/Api4/Upgrader.php @@ -12,23 +12,29 @@ class CRM_Api4_Upgrader extends CRM_Api4_Upgrader_Base { * Install script */ public function install() { - // Add menu item for api explorer; rename v3 explorer menu item. try { $v3Item = civicrm_api3('Navigation', 'get', [ 'name' => 'API Explorer', - 'return' => ['id', 'parent_id'], + 'return' => ['id', 'parent_id', 'weight'], 'sequential' => 1, + 'domain_id' => CRM_Core_Config::domainID(), 'api.Navigation.create' => ['label' => ts("Api Explorer v3")], ]); - civicrm_api3('Navigation', 'create', [ - 'parent_id' => $v3Item['values'][0]['parent_id'], - 'label' => ts("Api Explorer v4"), - 'weight' => 2, + $existing = civicrm_api3('Navigation', 'getcount', [ 'name' => "Api Explorer v4", - 'permission' => "administer CiviCRM", - 'url' => "civicrm/api4#/explorer", - 'is_active' => 1, + 'domain_id' => CRM_Core_Config::domainID(), ]); + if (!$existing) { + civicrm_api3('Navigation', 'create', [ + 'parent_id' => $v3Item['values'][0]['parent_id'] ?? 'Developer', + 'label' => ts("Api Explorer v4"), + 'weight' => $v3Item['values'][0]['weight'] ?? 2, + 'name' => "Api Explorer v4", + 'permission' => "administer CiviCRM", + 'url' => "civicrm/api4#/explorer", + 'is_active' => 1, + ]); + } } catch (Exception $e) { // Couldn't create menu item. diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php b/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php new file mode 100644 index 0000000000..640d67e525 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php @@ -0,0 +1,50 @@ +<?php + +namespace Civi\Api4\Action\Address; + +/** + * @inheritDoc + * @method bool getStreetParsing() + * @method $this setStreetParsing(bool $streetParsing) + * @method bool getSkipGeocode() + * @method $this setSkipGeocode(bool $skipGeocode) + * @method bool getFixAddress() + * @method $this setFixAddress(bool $fixAddress) + */ +trait AddressSaveTrait { + + /** + * Optional param to indicate you want the street_address field parsed into individual params + * + * @var bool + */ + protected $streetParsing = FALSE; + + /** + * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) + * + * @var bool + */ + protected $skipGeocode = FALSE; + + /** + * When true, apply various fixes to the address before insert. + * + * @var bool + */ + protected $fixAddress = TRUE; + + /** + * @inheritDoc + */ + protected function writeObjects($items) { + foreach ($items as &$item) { + if ($this->streetParsing && !empty($item['street_address'])) { + $item = array_merge($item, \CRM_Core_BAO_Address::parseStreetAddress($item['street_address'])); + } + $item['skip_geocode'] = $this->skipGeocode; + } + return parent::writeObjects($items); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php index 641b76f6f7..43278d4126 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php @@ -2,42 +2,10 @@ namespace Civi\Api4\Action\Address; -use Civi\Api4\Generic\Result; - /** * @inheritDoc */ class Create extends \Civi\Api4\Generic\DAOCreateAction { - - /** - * Optional param to indicate you want the street_address field parsed into individual params - * - * @var bool - */ - protected $streetParsing = TRUE; - - /** - * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) - * - * @var bool - */ - protected $skipGeocode = FALSE; - - /** - * When true, apply various fixes to the address before insert. - * - * @var bool - */ - protected $fixAddress = TRUE; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['street_parsing'] = $this->streetParsing; - $this->values['skip_geocode'] = $this->skipGeocode; - $this->values['fix_address'] = $this->fixAddress; - parent::_run($result); - } + use AddressSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php new file mode 100644 index 0000000000..d2b1e65820 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\Address; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use AddressSaveTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php index 862a8b9e7f..214c2acd3f 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php @@ -2,42 +2,10 @@ namespace Civi\Api4\Action\Address; -use Civi\Api4\Generic\Result; - /** * @inheritDoc */ class Update extends \Civi\Api4\Generic\DAOUpdateAction { - - /** - * Optional param to indicate you want the street_address field parsed into individual params - * - * @var bool - */ - protected $streetParsing = TRUE; - - /** - * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) - * - * @var bool - */ - protected $skipGeocode = FALSE; - - /** - * When true, apply various fixes to the address before insert. - * - * @var bool - */ - protected $fixAddress = TRUE; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['street_parsing'] = $this->streetParsing; - $this->values['skip_geocode'] = $this->skipGeocode; - $this->values['fix_address'] = $this->fixAddress; - parent::_run($result); - } + use AddressSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php new file mode 100644 index 0000000000..4b81accf16 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Campaign; + +/** + * @inheritDoc + * + * Set current = true to get active, non past campaigns. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php deleted file mode 100644 index 1bd0bcec83..0000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Contact; - -/** - * @inheritDoc - */ -class Create extends \Civi\Api4\Generic\DAOCreateAction { - - protected function fillDefaults(&$params) { - // Guess which type of contact is being created - if (empty($params['contact_type']) && !empty($params['organization_name'])) { - $params['contact_type'] = 'Organization'; - } - if (empty($params['contact_type']) && !empty($params['household_name'])) { - $params['contact_type'] = 'Household'; - } - // Will default to Individual per fieldSpec - parent::fillDefaults($params); - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php new file mode 100644 index 0000000000..daa81df4c1 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php @@ -0,0 +1,45 @@ +<?php + +namespace Civi\Api4\Action\Contact; + +use Civi\Api4\Generic\Result; + +/** + * Generate a security checksum for anonymous access to CiviCRM. + * + * @method $this setContactId(int $cid) Set contact ID (required) + * @method int getContactId() Get contact ID param + * @method $this setTtl(int $ttl) Set TTL param + * @method int getTtl() Get TTL param + */ +class GetChecksum extends \Civi\Api4\Generic\AbstractAction { + + /** + * ID of contact + * + * @var int + * @required + */ + protected $contactId; + + /** + * Expiration time (hours). Defaults to 168 (24 * [7 or value of checksum_timeout system setting]). + * + * Set to 0 for infinite. + * + * @var int + */ + protected $ttl = NULL; + + /** + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $ttl = ($this->ttl === 0 || $this->ttl === '0') ? 'inf' : $this->ttl; + $result[] = [ + 'id' => $this->contactId, + 'checksum' => \CRM_Contact_BAO_Contact_Utils::generateChecksum($this->contactId, NULL, $ttl), + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php new file mode 100644 index 0000000000..07819c7872 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php @@ -0,0 +1,42 @@ +<?php + +namespace Civi\Api4\Action\Contact; + +use Civi\Api4\Generic\Result; + +/** + * Generate a security checksum for anonymous access to CiviCRM. + * + * @method $this setContactId(int $cid) Set contact ID (required) + * @method int getContactId() Get contact ID param + * @method $this setChecksum(string $checksum) Set checksum param (required) + * @method string getChecksum() Get checksum param + */ +class ValidateChecksum extends \Civi\Api4\Generic\AbstractAction { + + /** + * ID of contact + * + * @var int + * @required + */ + protected $contactId; + + /** + * Value of checksum + * + * @var string + * @required + */ + protected $checksum; + + /** + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $result[] = [ + 'valid' => \CRM_Contact_BAO_Contact_Utils::validChecksum($this->contactId, $this->checksum), + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php deleted file mode 100644 index 52ee63c8ec..0000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Contribution; - -use Civi\Api4\Generic\Result; - -/** - * @inheritDoc - */ -class Create extends \Civi\Api4\Generic\DAOCreateAction { - - public function _run(Result $result) { - // Required by Contribution BAO - $this->values['skipCleanMoney'] = TRUE; - parent::_run($result); - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php index 733776b724..398ee36992 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php +++ b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php @@ -2,7 +2,6 @@ namespace Civi\Api4\Action\CustomValue; -use Civi\Api4\Service\Spec\SpecGatherer; use Civi\Api4\Service\Spec\SpecFormatter; /** @@ -13,10 +12,10 @@ class GetFields extends \Civi\Api4\Generic\DAOGetFieldsAction { protected function getRecords() { $fields = $this->_itemsToGet('name'); - /** @var SpecGatherer $gatherer */ + /** @var \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ $gatherer = \Civi::container()->get('spec_gatherer'); $spec = $gatherer->getSpec('Custom_' . $this->getCustomGroup(), $this->getAction(), $this->includeCustom); - return SpecFormatter::specToArray($spec->getFields($fields), (array) $this->select, $this->loadOptions); + return SpecFormatter::specToArray($spec->getFields($fields), $this->loadOptions); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php new file mode 100644 index 0000000000..b2982845db --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\CustomValue; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use \Civi\Api4\Generic\Traits\CustomValueActionTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php new file mode 100644 index 0000000000..9d67a80b1c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php @@ -0,0 +1,27 @@ +<?php + +namespace Civi\Api4\Action\Domain; + +/** + * @inheritDoc + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + + /** + * Return only the current domain. + * + * @var bool + */ + protected $currentDomain = FALSE; + + /** + * @inheritDoc + */ + protected function getObjects() { + if ($this->currentDomain) { + $this->addWhere('id', '=', \CRM_Core_Config::domainID()); + } + return parent::getObjects(); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php index 020c6398e0..1d4678cd3c 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php @@ -25,8 +25,8 @@ class Get extends \Civi\Api4\Generic\BasicGetAction { */ protected function getRecords() { $entities = []; - foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - $dir = \CRM_Utils_File::addTrailingSlash($path) . 'Civi/Api4'; + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $dir = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])) . 'Civi/Api4'; if (is_dir($dir)) { foreach (glob("$dir/*.php") as $file) { $matches = []; diff --git a/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php b/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php index ee274bf90b..bfd3c3b406 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php @@ -2,7 +2,7 @@ namespace Civi\Api4\Action\Entity; -use \CRM_Core_DAO_AllCoreTables as AllCoreTables; +use Civi\Api4\Utils\CoreUtil; /** * Get a list of FK links between entities @@ -14,7 +14,7 @@ class GetLinks extends \Civi\Api4\Generic\BasicGetAction { /** @var \Civi\Api4\Service\Schema\SchemaMap $schema */ $schema = \Civi::container()->get('schema_map'); foreach ($schema->getTables() as $table) { - $entity = AllCoreTables::getBriefName(AllCoreTables::getClassForTable($table->getName())); + $entity = CoreUtil::getApiNameFromTableName($table->getName()); // Since this is an api function, exclude tables that don't have an api if (class_exists('\Civi\Api4\\' . $entity)) { $item = [ @@ -24,7 +24,7 @@ class GetLinks extends \Civi\Api4\Generic\BasicGetAction { ]; foreach ($table->getTableLinks() as $link) { $link = $link->toArray(); - $link['entity'] = AllCoreTables::getBriefName(AllCoreTables::getClassForTable($link['targetTable'])); + $link['entity'] = CoreUtil::getApiNameFromTableName($link['targetTable']); $item['links'][] = $link; } $result[] = $item; diff --git a/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php new file mode 100644 index 0000000000..15cac2ff7a --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Event; + +/** + * @inheritDoc + * + * Set current = true to get active, non past events. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GetActions.php b/civicrm/ext/api4/Civi/Api4/Action/GetActions.php index 1dc4ebbb9a..67da925b86 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GetActions.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GetActions.php @@ -27,11 +27,10 @@ class GetActions extends BasicGetAction { } } if (!$this->_actionsToGet || count($this->_actionsToGet) > count($this->_actions)) { - $includePaths = array_unique(explode(PATH_SEPARATOR, get_include_path())); // Search entity-specific actions (including those provided by extensions) - foreach ($includePaths as $path) { - $dir = \CRM_Utils_File::addTrailingSlash($path) . 'Civi/Api4/Action/' . $this->_entityName; - $this->scanDir($dir); + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $dir = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])); + $this->scanDir($dir . 'Civi/Api4/Action/' . $this->_entityName); } } ksort($this->_actions); @@ -47,7 +46,10 @@ class GetActions extends BasicGetAction { $matches = []; preg_match('/(\w*).php/', $file, $matches); $actionName = array_pop($matches); - $this->loadAction(lcfirst($actionName)); + $actionClass = new \ReflectionClass('\\Civi\\Api4\\Action\\' . $this->_entityName . '\\' . $actionName); + if ($actionClass->isInstantiable() && $actionClass->isSubclassOf('\\Civi\\Api4\\Generic\\AbstractAction')) { + $this->loadAction(lcfirst($actionName)); + } } } } @@ -69,6 +71,14 @@ class GetActions extends BasicGetAction { } if ($this->_isFieldSelected('params')) { $this->_actions[$actionName]['params'] = $action->getParamInfo(); + // Language param is only relevant on multilingual sites + $languageLimit = (array) \Civi::settings()->get('languageLimit'); + if (count($languageLimit) < 2) { + unset($this->_actions[$actionName]['params']['language']); + } + elseif (isset($this->_actions[$actionName]['params']['language'])) { + $this->_actions[$actionName]['params']['language']['options'] = array_keys($languageLimit); + } } } } diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php index 44e61f2e75..89dd8695ae 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php @@ -2,37 +2,10 @@ namespace Civi\Api4\Action\GroupContact; -use Civi\Api4\Generic\Result; - /** * @inheritDoc - * - * @method $this setMethod(string $method) Indicate who added/removed the group. - * @method $this setTracking(string $tracking) Specify ip address or other tracking info. */ class Create extends \Civi\Api4\Generic\DAOCreateAction { - - /** - * String to indicate who added/removed the group. - * - * @var string - */ - protected $method = 'API'; - - /** - * IP address or other tracking info about who performed this group subscription. - * - * @var string - */ - protected $tracking = ''; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['method'] = $this->method; - $this->values['tracking'] = $this->tracking; - parent::_run($result); - } + use GroupContactSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php new file mode 100644 index 0000000000..7142259828 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php @@ -0,0 +1,40 @@ +<?php + +namespace Civi\Api4\Action\GroupContact; + +/** + * @inheritDoc + * + * @method $this setMethod(string $method) Indicate who added/removed the group. + * @method string getMethod() + * @method $this setTracking(string $tracking) Specify ip address or other tracking info. + * @method string getTracking() + */ +trait GroupContactSaveTrait { + + /** + * String to indicate who added/removed the group. + * + * @var string + */ + protected $method = 'API'; + + /** + * IP address or other tracking info about who performed this group subscription. + * + * @var string + */ + protected $tracking = ''; + + /** + * @inheritDoc + */ + protected function writeObjects($items) { + foreach ($items as &$item) { + $item['method'] = $this->method; + $item['tracking'] = $this->tracking; + } + return parent::writeObjects($items); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php new file mode 100644 index 0000000000..28ef046720 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\GroupContact; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use GroupContactSaveTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php index edb8a90213..f9b09334aa 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php @@ -2,37 +2,10 @@ namespace Civi\Api4\Action\GroupContact; -use Civi\Api4\Generic\Result; - /** * @inheritDoc - * - * @method $this setMethod(string $method) Indicate who added/removed the group. - * @method $this setTracking(string $tracking) Specify ip address or other tracking info. */ class Update extends \Civi\Api4\Generic\DAOUpdateAction { - - /** - * String to indicate who added/removed the group. - * - * @var string - */ - protected $method = 'API'; - - /** - * IP address or other tracking info about who performed this group subscription. - * - * @var string - */ - protected $tracking = ''; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['method'] = $this->method; - $this->values['tracking'] = $this->tracking; - parent::_run($result); - } + use GroupContactSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php deleted file mode 100644 index dcecc06a9d..0000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Navigation; - -/** - * @inheritDoc - * - * Fetch items from the navigation menu. By default this will fetch items from the current domain. - */ -class Get extends \Civi\Api4\Generic\DAOGetAction { - - /** - * @inheritDoc - */ - protected $where = [ - ['domain_id', '=', 'current_domain'], - ]; - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php deleted file mode 100644 index c5efec93d4..0000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Participant; - -/** - * @inheritDoc - */ -class Get extends \Civi\Api4\Generic\DAOGetAction { - - /** - * @inheritDoc - * $example->addWhere('contact_id.contact_type', 'IN', array('Individual', 'Household')) - */ - protected $where = [ - ['is_test', '=', 0], - ]; - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php new file mode 100644 index 0000000000..f94dad55f9 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Relationship; + +/** + * @inheritDoc + * + * Set current = true to get active, non past relationships. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php new file mode 100644 index 0000000000..a0481e1804 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php @@ -0,0 +1,80 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Domain; +use Civi\Api4\Generic\Result; + +/** + * Base class for setting actions. + * + * @method int getDomainId + * @method $this setDomainId(int $domainId) + */ +abstract class AbstractSettingAction extends \Civi\Api4\Generic\AbstractAction { + + /** + * Domain id of setting. Leave NULL for default domain. + * + * @var int|string|array + */ + protected $domainId; + + /** + * Contact - if this is a contact-related setting. + * + * @var int + */ + protected $contactId; + + public function _run(Result $result) { + $this->findDomains(); + $meta = []; + foreach ($this->domainId as $domain) { + $meta[$domain] = $this->validateSettings($domain); + } + foreach ($this->domainId as $domain) { + $settingsBag = $this->contactId ? \Civi::contactSettings($this->contactId, $domain) : \Civi::settings($domain); + $this->processSettings($result, $settingsBag, $meta[$domain], $domain); + } + } + + /** + * Checks that really ought to be taken care of by Civi::settings + * + * @param int $domain + * @return array + * @throws \API_Exception + */ + protected function validateSettings($domain) { + $meta = \Civi\Core\SettingsMetadata::getMetadata([], $domain); + $names = isset($this->values) ? array_keys($this->values) : $this->select; + $invalid = array_diff($names, array_keys($meta)); + if ($invalid) { + throw new \API_Exception("Unknown settings for domain $domain: " . implode(', ', $invalid)); + } + if (isset($this->values)) { + foreach ($this->values as $name => &$value) { + \CRM_Core_BAO_Setting::validateSetting($value, $meta[$name]); + } + } + return $meta; + } + + protected function findDomains() { + if ($this->domainId == 'all') { + $this->domainId = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + } + elseif ($this->domainId) { + $this->domainId = (array) $this->domainId; + $domains = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + $invalid = array_diff($this->domainId, $domains); + if ($invalid) { + throw new \API_Exception('Invalid domain id: ' . implode(', ', $invalid)); + } + } + else { + $this->domainId = [\CRM_Core_Config::domainID()]; + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php new file mode 100644 index 0000000000..31d5e8b2f2 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php @@ -0,0 +1,55 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Get the value of one or more CiviCRM settings. + * + * @method array getSelect + * @method $this addSelect(string $name) + * @method $this setSelect(array $select) + */ +class Get extends AbstractSettingAction { + + /** + * Names of settings to retrieve + * + * @var array + */ + protected $select = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + if ($this->select) { + foreach ($this->select as $name) { + $result[] = [ + 'name' => $name, + 'value' => $settingsBag->get($name), + 'domain_id' => $domain, + ]; + } + } + else { + foreach ($settingsBag->all() as $name => $value) { + $result[] = [ + 'name' => $name, + 'value' => $value, + 'domain_id' => $domain, + ]; + } + } + foreach ($result as $name => &$setting) { + if (isset($setting['value']) && !empty($meta[$name]['serialize'])) { + $setting['value'] = \CRM_Core_DAO::unSerializeField($setting['value'], $meta[$name]['serialize']); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php new file mode 100644 index 0000000000..5864a46879 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php @@ -0,0 +1,84 @@ +<?php +namespace Civi\Api4\Action\Setting; + +/** + * Get information about CiviCRM settings. + * + * @method int getDomainId + * @method $this setDomainId(int $domainId) + */ +class GetFields extends \Civi\Api4\Generic\BasicGetFieldsAction { + + /** + * Domain id of settings. Leave NULL for default domain. + * + * @var int + */ + protected $domainId; + + protected function getRecords() { + // TODO: Waiting for filter handling to get fixed in core + // $names = $this->_itemsToGet('name'); + // $filter = $names ? ['name' => $names] : []; + $filter = []; + return \Civi\Core\SettingsMetadata::getMetadata($filter, $this->domainId, $this->loadOptions); + } + + public function fields() { + return [ + [ + 'name' => 'name', + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'data_type' => 'String', + ], + [ + 'name' => 'description', + 'data_type' => 'String', + ], + [ + 'name' => 'help_text', + 'data_type' => 'String', + ], + [ + 'name' => 'default', + 'data_type' => 'String', + ], + [ + 'name' => 'pseudoconstant', + 'data_type' => 'String', + ], + [ + 'name' => 'options', + 'data_type' => 'Array', + ], + [ + 'name' => 'group_name', + 'data_type' => 'String', + ], + [ + 'name' => 'group', + 'data_type' => 'String', + ], + [ + 'name' => 'html_type', + 'data_type' => 'String', + ], + [ + 'name' => 'add', + 'data_type' => 'String', + ], + [ + 'name' => 'serialize', + 'data_type' => 'Integer', + ], + [ + 'name' => 'data_type', + 'data_type' => 'Integer', + ], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php new file mode 100644 index 0000000000..65540abfd7 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php @@ -0,0 +1,46 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Revert one or more CiviCRM settings to their default value. + * + * @method array getSelect + * @method $this addSelect(string $name) + * @method $this setSelect(array $select) + */ +class Revert extends AbstractSettingAction { + + /** + * Names of settings to revert + * + * @var array + * @required + */ + protected $select = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + foreach ($this->select as $name) { + $settingsBag->revert($name); + $result[] = [ + 'name' => $name, + 'value' => $settingsBag->get($name), + 'domain_id' => $domain, + ]; + } + foreach ($result as $name => &$setting) { + if (isset($setting['value']) && !empty($meta[$name]['serialize'])) { + $setting['value'] = \CRM_Core_DAO::unSerializeField($setting['value'], $meta[$name]['serialize']); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php new file mode 100644 index 0000000000..ad9804ab5a --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php @@ -0,0 +1,44 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Set the value of one or more CiviCRM settings. + * + * @method array getValues + * @method $this setValues(array $value) + * @method $this addValue(string $name, mixed $value) + */ +class Set extends AbstractSettingAction { + + /** + * Setting names/values to set. + * + * @var mixed + * @required + */ + protected $values = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + foreach ($this->values as $name => $value) { + if (isset($value) && !empty($meta[$name]['serialize'])) { + $value = \CRM_Core_DAO::serializeField($value, $meta[$name]['serialize']); + } + $settingsBag->set($name, $value); + $result[] = [ + 'name' => $name, + 'value' => $this->values[$name], + 'domain_id' => $domain, + ]; + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/System/Check.php b/civicrm/ext/api4/Civi/Api4/Action/System/Check.php new file mode 100644 index 0000000000..1910f61b0d --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/System/Check.php @@ -0,0 +1,83 @@ +<?php +namespace Civi\Api4\Action\System; + +/** + * Retrieve system notices, warnings, errors, etc. + */ +class Check extends \Civi\Api4\Generic\BasicGetAction { + + protected function getRecords() { + $messages = []; + foreach (\CRM_Utils_Check::checkAll() as $message) { + $messages[] = $message->toArray(); + } + return $messages; + } + + public static function fields() { + return [ + [ + 'name' => 'name', + 'title' => 'Name', + 'description' => 'Unique identifier', + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'title' => 'Title', + 'description' => 'Short title text', + 'data_type' => 'String', + ], + [ + 'name' => 'message', + 'title' => 'Message', + 'description' => 'Long description html', + 'data_type' => 'String', + ], + [ + 'name' => 'help', + 'title' => 'Help', + 'description' => 'Optional extra help (html string)', + 'data_type' => 'String', + ], + [ + 'name' => 'icon', + 'description' => 'crm-i class of icon to display with message', + 'data_type' => 'String', + ], + [ + 'name' => 'severity', + 'title' => 'Severity', + 'description' => 'Psr\Log\LogLevel string', + 'data_type' => 'String', + 'options' => array_combine(\CRM_Utils_Check::getSeverityList(), \CRM_Utils_Check::getSeverityList()), + ], + [ + 'name' => 'severity_id', + 'title' => 'Severity ID', + 'description' => 'Integer representation of Psr\Log\LogLevel', + 'data_type' => 'Integer', + 'options' => \CRM_Utils_Check::getSeverityList(), + ], + [ + 'name' => 'is_visible', + 'title' => 'is visible', + 'description' => '0 if message has been hidden by the user', + 'data_type' => 'Boolean', + ], + [ + 'name' => 'hidden_until', + 'title' => 'Hidden until', + 'description' => 'When will hidden message be visible again?', + 'data_type' => 'Date', + ], + [ + 'name' => 'actions', + 'title' => 'Actions', + 'description' => 'List of actions user can perform', + 'data_type' => 'Array', + ], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php b/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php new file mode 100644 index 0000000000..0a39138576 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php @@ -0,0 +1,32 @@ +<?php +namespace Civi\Api4\Action\System; + +/** + * Clear CiviCRM caches, and optionally rebuild triggers and reset sessions. + * + * @method bool getTriggers + * @method $this setTriggers(bool $triggers) + * @method bool getSession + * @method $this setSession(bool $session) + */ +class Flush extends \Civi\Api4\Generic\AbstractAction { + + /** + * Rebuild db triggers + * + * @var bool + */ + protected $triggers = FALSE; + + /** + * Reset sessions + * + * @var bool + */ + protected $session = FALSE; + + public function _run(\Civi\Api4\Generic\Result $result) { + \CRM_Core_Invoke::rebuildMenuAndCaches($this->triggers, $this->session); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Address.php b/civicrm/ext/api4/Civi/Api4/Address.php index e52b6283e4..be8df42d56 100644 --- a/civicrm/ext/api4/Civi/Api4/Address.php +++ b/civicrm/ext/api4/Civi/Api4/Address.php @@ -22,6 +22,13 @@ class Address extends Generic\DAOEntity { return new \Civi\Api4\Action\Address\Create(__CLASS__, __FUNCTION__); } + /** + * @return \Civi\Api4\Action\Address\Save + */ + public static function save() { + return new \Civi\Api4\Action\Address\Save(__CLASS__, __FUNCTION__); + } + /** * @return \Civi\Api4\Action\Address\Update */ diff --git a/civicrm/ext/api4/Civi/Api4/Campaign.php b/civicrm/ext/api4/Civi/Api4/Campaign.php new file mode 100644 index 0000000000..ee85821eb4 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Campaign.php @@ -0,0 +1,19 @@ +<?php + +namespace Civi\Api4; + +/** + * Campaign entity. + * + * @package Civi\Api4 + */ +class Campaign extends Generic\DAOEntity { + + /** + * @return \Civi\Api4\Action\Campaign\Get + */ + public static function get() { + return new \Civi\Api4\Action\Campaign\Get(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Contact.php b/civicrm/ext/api4/Civi/Api4/Contact.php index cca8c335d3..7282ba7cf9 100644 --- a/civicrm/ext/api4/Civi/Api4/Contact.php +++ b/civicrm/ext/api4/Civi/Api4/Contact.php @@ -14,26 +14,16 @@ namespace Civi\Api4; */ class Contact extends Generic\DAOEntity { - /** - * @return Action\Contact\Create - */ - public static function create() { - return new Action\Contact\Create(__CLASS__, __FUNCTION__); + public static function getFields() { + return new Action\Contact\GetFields(__CLASS__, __FUNCTION__); } - /** - * @return \Civi\Api4\Generic\DAOUpdateAction - */ - public static function update() { - // For some reason the contact bao requires this for updating - return new Generic\DAOUpdateAction(__CLASS__, __FUNCTION__, ['id', 'contact_type']); + public static function getChecksum() { + return new Action\Contact\GetChecksum(__CLASS__, __FUNCTION__); } - /** - * @return \Civi\Api4\Action\Contact\GetFields - */ - public static function getFields() { - return new Action\Contact\GetFields(__CLASS__, __FUNCTION__); + public static function validateChecksum() { + return new Action\Contact\ValidateChecksum(__CLASS__, __FUNCTION__); } } diff --git a/civicrm/ext/api4/Civi/Api4/Contribution.php b/civicrm/ext/api4/Civi/Api4/Contribution.php index 903c475340..1386caebf6 100644 --- a/civicrm/ext/api4/Civi/Api4/Contribution.php +++ b/civicrm/ext/api4/Civi/Api4/Contribution.php @@ -9,11 +9,4 @@ namespace Civi\Api4; */ class Contribution extends Generic\DAOEntity { - /** - * @return \Civi\Api4\Action\Contribution\Create - */ - public static function create() { - return new \Civi\Api4\Action\Contribution\Create(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/ContributionPage.php b/civicrm/ext/api4/Civi/Api4/ContributionPage.php new file mode 100644 index 0000000000..51c9232017 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/ContributionPage.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * ContributionPage entity. + * + * @package Civi\Api4 + */ +class ContributionPage extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/CustomValue.php b/civicrm/ext/api4/Civi/Api4/CustomValue.php index 9cf4da4360..037470e3af 100644 --- a/civicrm/ext/api4/Civi/Api4/CustomValue.php +++ b/civicrm/ext/api4/Civi/Api4/CustomValue.php @@ -25,6 +25,14 @@ class CustomValue extends Generic\AbstractEntity { return new Action\CustomValue\GetFields($customGroup, __FUNCTION__); } + /** + * @param string $customGroup + * @return Action\CustomValue\Save + */ + public static function save($customGroup) { + return new Action\CustomValue\Save($customGroup, __FUNCTION__); + } + /** * @param string $customGroup * @return Action\CustomValue\Create diff --git a/civicrm/ext/api4/Civi/Api4/Domain.php b/civicrm/ext/api4/Civi/Api4/Domain.php new file mode 100644 index 0000000000..9aebbf4708 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Domain.php @@ -0,0 +1,16 @@ +<?php + +namespace Civi\Api4; + +/** + * Domains - multisite instances of CiviCRM. + * + * @package Civi\Api4 + */ +class Domain extends Generic\DAOEntity { + + public static function get() { + return new \Civi\Api4\Action\Domain\Get(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Entity.php b/civicrm/ext/api4/Civi/Api4/Entity.php index bc759d0517..008e818f10 100644 --- a/civicrm/ext/api4/Civi/Api4/Entity.php +++ b/civicrm/ext/api4/Civi/Api4/Entity.php @@ -41,7 +41,7 @@ class Entity extends Generic\AbstractEntity { */ public static function permissions() { return [ - 'default' => ['access CiviCRM'] + 'default' => ['access CiviCRM'], ]; } diff --git a/civicrm/ext/api4/Civi/Api4/EntityTag.php b/civicrm/ext/api4/Civi/Api4/EntityTag.php new file mode 100644 index 0000000000..6274e0c8fd --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/EntityTag.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * EntityTag - links tags to contacts, activities, etc. + * + * @package Civi\Api4 + */ +class EntityTag extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event.php b/civicrm/ext/api4/Civi/Api4/Event.php index 1a07cc3df4..70555af82c 100644 --- a/civicrm/ext/api4/Civi/Api4/Event.php +++ b/civicrm/ext/api4/Civi/Api4/Event.php @@ -9,4 +9,11 @@ namespace Civi\Api4; */ class Event extends Generic\DAOEntity { + /** + * @return \Civi\Api4\Action\Event\Get + */ + public static function get() { + return new \Civi\Api4\Action\Event\Get(__CLASS__, __FUNCTION__); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php b/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php index cc24785377..d85f416c6f 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php @@ -7,19 +7,19 @@ use Symfony\Component\EventDispatcher\Event as BaseEvent; class GetSpecEvent extends BaseEvent { /** - * @var AbstractAction + * @var \Civi\Api4\Generic\AbstractAction */ protected $request; /** - * @param AbstractAction $request + * @param \Civi\Api4\Generic\AbstractAction $request */ public function __construct(AbstractAction $request) { $this->request = $request; } /** - * @return AbstractAction + * @return \Civi\Api4\Generic\AbstractAction */ public function getRequest() { return $this->request; diff --git a/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php b/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php index 4489033b22..15456d7ffe 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php @@ -13,14 +13,14 @@ class PostSelectQueryEvent extends Event { protected $results; /** - * @var Api4SelectQuery + * @var \Civi\Api4\Query\Api4SelectQuery */ protected $query; /** * PostSelectQueryEvent constructor. * @param array $results - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query */ public function __construct(array $results, Api4SelectQuery $query) { $this->results = $results; @@ -45,14 +45,14 @@ class PostSelectQueryEvent extends Event { } /** - * @return Api4SelectQuery + * @return \Civi\Api4\Query\Api4SelectQuery */ public function getQuery() { return $this->query; } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @return $this */ public function setQuery($query) { diff --git a/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php b/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php index f79f6b4be8..7698eb2df1 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php @@ -7,26 +7,26 @@ use Symfony\Component\EventDispatcher\Event as BaseEvent; class SchemaMapBuildEvent extends BaseEvent { /** - * @var SchemaMap + * @var \Civi\Api4\Service\Schema\SchemaMap */ protected $schemaMap; /** - * @param SchemaMap $schemaMap + * @param \Civi\Api4\Service\Schema\SchemaMap $schemaMap */ public function __construct(SchemaMap $schemaMap) { $this->schemaMap = $schemaMap; } /** - * @return SchemaMap + * @return \Civi\Api4\Service\Schema\SchemaMap */ public function getSchemaMap() { return $this->schemaMap; } /** - * @param SchemaMap $schemaMap + * @param \Civi\Api4\Service\Schema\SchemaMap $schemaMap * * @return $this */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php index 1938ce0bda..adfd17c8d0 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php @@ -5,9 +5,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; use Civi\Api4\OptionValue; -class ActivityPreCreationSubscriber extends PreCreationSubscriber { +class ActivityPreCreationSubscriber extends Generic\PreCreationSubscriber { + /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * @throws \API_Exception * @throws \Exception */ @@ -29,7 +30,7 @@ class ActivityPreCreationSubscriber extends PreCreationSubscriber { } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php index 52d58397d8..4e05c44de3 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php @@ -8,9 +8,9 @@ use Civi\Api4\Service\Schema\Joinable\ActivityToActivityContactAssigneesJoinable use Civi\Api4\Service\Schema\Joinable\BridgeJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use \CRM_Utils_String as StringHelper; class ActivitySchemaMapSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -21,13 +21,13 @@ class ActivitySchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param SchemaMapBuildEvent $event + * @param \Civi\Api4\Event\SchemaMapBuildEvent $event */ public function onSchemaBuild(SchemaMapBuildEvent $event) { $schema = $event->getSchemaMap(); $table = $schema->getTableByName('civicrm_activity'); - $middleAlias = StringHelper::createRandom(10, implode(range('a', 'z'))); + $middleAlias = \CRM_Utils_String::createRandom(10, implode(range('a', 'z'))); $middleLink = new ActivityToActivityContactAssigneesJoinable($middleAlias); $bridge = new BridgeJoinable('civicrm_contact', 'id', 'assignees', $middleLink); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php new file mode 100644 index 0000000000..21d2627aad --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php @@ -0,0 +1,25 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class ContactPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public $supportedOperation = 'create'; + + public function modify(&$contact, AbstractAction $request) { + // Guess which type of contact is being created + if (empty($contact['contact_type']) && !empty($contact['organization_name'])) { + $contact['contact_type'] = 'Organization'; + } + if (empty($contact['contact_type']) && !empty($contact['household_name'])) { + $contact['contact_type'] = 'Household'; + } + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'Contact'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php index edea3de659..f2c82a07c2 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php @@ -5,10 +5,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Event\Events; use Civi\Api4\Event\SchemaMapBuildEvent; use Civi\Api4\Service\Schema\Joinable\Joinable; -use Civi\Api4\Service\Schema\Table; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ContactSchemaMapSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -19,7 +19,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param SchemaMapBuildEvent $event + * @param \Civi\Api4\Event\SchemaMapBuildEvent $event */ public function onSchemaBuild(SchemaMapBuildEvent $event) { $schema = $event->getSchemaMap(); @@ -29,7 +29,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param Table $table + * @param \Civi\Api4\Service\Schema\Table $table */ private function addCreatedActivitiesLink($table) { $alias = 'created_activities'; @@ -40,7 +40,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param Table $table + * @param \Civi\Api4\Service\Schema\Table $table */ private function fixPreferredLanguageAlias($table) { foreach ($table->getExternalLinks() as $link) { diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php new file mode 100644 index 0000000000..dfc723a495 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php @@ -0,0 +1,18 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class ContributionPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public function modify(&$record, AbstractAction $request) { + // Required by Contribution BAO + $record['skipCleanMoney'] = TRUE; + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'Contribution'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php deleted file mode 100644 index 289e105715..0000000000 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -namespace Civi\Api4\Event\Subscriber; - -use Civi\Api4\Generic\DAOCreateAction; - -class CustomFieldPreCreationSubscriber extends PreCreationSubscriber { - - const OPTION_TYPE_NEW = 1; - const OPTION_STATUS_ACTIVE = 1; - - /** - * @param DAOCreateAction $request - */ - public function modify(DAOCreateAction $request) { - $this->formatOptionParams($request); - $this->setDefaults($request); - } - - /** - * @param DAOCreateAction $request - * - * @return bool - */ - protected function applies(DAOCreateAction $request) { - return $request->getEntityName() === 'CustomField'; - } - - /** - * Sets defaults required for option group and value creation - * @see CRM_Core_BAO_CustomField::create() - * - * @param DAOCreateAction $request - */ - protected function formatOptionParams(DAOCreateAction $request) { - $options = $request->getValue('options'); - - if (!is_array($options)) { - return; - } - - $dataTypeKey = 'data_type'; - $optionLabelKey = 'option_label'; - $optionWeightKey = 'option_weight'; - $optionStatusKey = 'option_status'; - $optionValueKey = 'option_value'; - $optionTypeKey = 'option_type'; - - $dataType = $request->getValue($dataTypeKey); - $optionLabel = $request->getValue($optionLabelKey); - $optionWeight = $request->getValue($optionWeightKey); - $optionStatus = $request->getValue($optionStatusKey); - $optionValue = $request->getValue($optionValueKey); - $optionType = $request->getValue($optionTypeKey); - - if (!$optionType) { - $request->addValue($optionTypeKey, self::OPTION_TYPE_NEW); - } - - if (!$dataType) { - $request->addValue($dataTypeKey, 'String'); - } - - if (!$optionLabel) { - $request->addValue($optionLabelKey, array_values($options)); - } - - if (!$optionValue) { - $request->addValue($optionValueKey, array_keys($options)); - } - - if (!$optionStatus) { - $statuses = array_fill(0, count($options), self::OPTION_STATUS_ACTIVE); - $request->addValue($optionStatusKey, $statuses); - } - - if (!$optionWeight) { - $request->addValue($optionWeightKey, range(1, count($options))); - } - } - - /** - * @param DAOCreateAction $request - */ - private function setDefaults(DAOCreateAction $request) { - if (!$request->getValue('option_type')) { - $request->addValue('option_type', NULL); - } - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php new file mode 100644 index 0000000000..0a4ce707a9 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php @@ -0,0 +1,38 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class CustomFieldPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public $supportedOperation = 'create'; + + public function modify(&$field, AbstractAction $request) { + if (!empty($field['option_values'])) { + $weight = 0; + foreach ($field['option_values'] as $key => $value) { + // Translate simple key/value pairs into full-blown option values + if (!is_array($value)) { + $value = [ + 'label' => $value, + 'value' => $key, + 'is_active' => 1, + 'weight' => $weight, + ]; + $key = $weight++; + } + $field['option_label'][$key] = $value['label']; + $field['option_value'][$key] = $value['value']; + $field['option_status'][$key] = $value['is_active']; + $field['option_weight'][$key] = $value['weight']; + } + } + $field['option_type'] = !empty($field['option_values']); + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'CustomField'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php index 70f6e426c2..e83c91f79e 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php @@ -4,9 +4,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; -class CustomGroupPreCreationSubscriber extends PreCreationSubscriber { +class CustomGroupPreCreationSubscriber extends Generic\PreCreationSubscriber { + /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function modify(DAOCreateAction $request) { $extends = $request->getValue('extends'); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php similarity index 81% rename from civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php rename to civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php index d4725e0dc8..833e886fd0 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php @@ -1,12 +1,13 @@ <?php -namespace Civi\Api4\Event\Subscriber; +namespace Civi\Api4\Event\Subscriber\Generic; use Civi\API\Event\PrepareEvent; use Civi\API\Events; use Symfony\Component\EventDispatcher\EventSubscriberInterface; abstract class AbstractPrepareSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -17,7 +18,7 @@ abstract class AbstractPrepareSubscriber implements EventSubscriberInterface { } /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event */ abstract public function onApiPrepare(PrepareEvent $event); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php similarity index 77% rename from civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php rename to civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php index 6737a9f368..66f5366df7 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php @@ -1,13 +1,14 @@ <?php -namespace Civi\Api4\Event\Subscriber; +namespace Civi\Api4\Event\Subscriber\Generic; use Civi\API\Event\PrepareEvent; use Civi\Api4\Generic\DAOCreateAction; abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { + /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event */ public function onApiPrepare(PrepareEvent $event) { $apiRequest = $event->getApiRequest(); @@ -24,7 +25,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Modify the request * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return void */ @@ -33,7 +34,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Check if this subscriber should be applied to the request * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ @@ -42,7 +43,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Sets default values common to all creation requests * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function addDefaultCreationValues(DAOCreateAction $request) { } diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php new file mode 100644 index 0000000000..a36ba1fa11 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php @@ -0,0 +1,54 @@ +<?php + +namespace Civi\Api4\Event\Subscriber\Generic; + +use Civi\API\Event\PrepareEvent; +use Civi\Api4\Generic\AbstractAction; +use Civi\Api4\Generic\AbstractCreateAction; +use Civi\Api4\Generic\AbstractUpdateAction; + +abstract class PreSaveSubscriber extends AbstractPrepareSubscriber { + + /** + * @var string + * create|update|both + */ + public $supportedOperation = 'both'; + + /** + * @param \Civi\API\Event\PrepareEvent $event + */ + public function onApiPrepare(PrepareEvent $event) { + $apiRequest = $event->getApiRequest(); + + if ($apiRequest instanceof AbstractAction && $this->applies($apiRequest)) { + if ( + ($apiRequest instanceof AbstractCreateAction && $this->supportedOperation !== 'update') || + ($apiRequest instanceof AbstractUpdateAction && $this->supportedOperation !== 'create') + ) { + $values = $apiRequest->getValues(); + $this->modify($values, $apiRequest); + $apiRequest->setValues($values); + } + } + } + + /** + * Modify the item about to be saved + * + * @param array $item + * @param \Civi\Api4\Generic\AbstractAction $request + * + */ + abstract protected function modify(&$item, AbstractAction $request); + + /** + * Check if this subscriber should be applied to the request + * + * @param \Civi\Api4\Generic\AbstractAction $request + * + * @return bool + */ + abstract protected function applies(AbstractAction $request); + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php new file mode 100644 index 0000000000..4f1d349461 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php @@ -0,0 +1,39 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\API\Event\PrepareEvent; +use Civi\Api4\Utils\ReflectionUtils; + +/** + * Process $current api param for Get actions + * + * @see \Civi\Api4\Generic\Traits\IsCurrentTrait + */ +class IsCurrentSubscriber extends Generic\AbstractPrepareSubscriber { + + public function onApiPrepare(PrepareEvent $event) { + /** @var \Civi\Api4\Generic\AbstractQueryAction $action */ + $action = $event->getApiRequest(); + if ($action['version'] == 4 && method_exists($action, 'getCurrent') + && in_array('Civi\Api4\Generic\Traits\IsCurrentTrait', ReflectionUtils::getTraits($action)) + ) { + $fields = $action->entityFields(); + if ($action->getCurrent()) { + if (isset($fields['is_active'])) { + $action->addWhere('is_active', '=', '1'); + } + $action->addClause('OR', ['start_date', 'IS NULL'], ['start_date', '<=', 'now']); + $action->addClause('OR', ['end_date', 'IS NULL'], ['end_date', '>=', 'now']); + } + elseif ($action->getCurrent() === FALSE) { + $conditions = [['end_date', '<', 'now'], ['start_date', '>', 'now']]; + if (isset($fields['is_active'])) { + $conditions[] = ['is_active', '=', '0']; + } + $action->addClause('OR', $conditions); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php index 3e671d61d3..2695cd4c1d 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php @@ -5,17 +5,17 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; use Civi\Api4\OptionGroup; -class OptionValuePreCreationSubscriber extends PreCreationSubscriber { +class OptionValuePreCreationSubscriber extends Generic\PreCreationSubscriber { /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function modify(DAOCreateAction $request) { $this->setOptionGroupId($request); } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ @@ -24,7 +24,7 @@ class OptionValuePreCreationSubscriber extends PreCreationSubscriber { } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * @throws \API_Exception * @throws \Exception */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php index 62d542d0e0..b63fdc553d 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php @@ -36,6 +36,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * Civi\API\Annotation\Permission. */ class PermissionCheckSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php index ff7e6d20d6..094a03c58d 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php @@ -19,12 +19,12 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { */ public static function getSubscribedEvents() { return [ - Events::POST_SELECT_QUERY => 'onPostQuery' + Events::POST_SELECT_QUERY => 'onPostQuery', ]; } /** - * @param PostSelectQueryEvent $event + * @param \Civi\Api4\Event\PostSelectQueryEvent $event */ public function onPostQuery(PostSelectQueryEvent $event) { $results = $event->getResults(); @@ -33,7 +33,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $results - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -69,7 +69,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $joinResults - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param string $alias */ private function formatJoinResults(&$joinResults, $query, $alias) { @@ -108,7 +108,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -140,11 +140,10 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { return $selects; } - /** * @param array $selects * @param $serializationType - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -202,13 +201,12 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { return $newResults; } - /** * Prepares selects for the subquery to fetch join results * * @param string $alias * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -236,7 +234,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -268,7 +266,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param $alias * @param $selects * @return array @@ -297,14 +295,15 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { * * @param string $pathString * Dot separated path to the field - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array * Index is table alias and value is boolean whether is 1-to-many join */ private function getJoinPathInfo($pathString, $query) { $pathParts = explode('.', $pathString); - array_pop($pathParts); // remove field + // remove field + array_pop($pathParts); $path = []; $isMultipleChecker = function($alias) use ($query) { foreach ($query->getJoinedTables() as $table) { @@ -326,7 +325,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { * Get all the option_value values required in the query * * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param array $values * * @return array diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php index 5e2c6f33f4..2e7faab588 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php @@ -32,10 +32,10 @@ use Civi\API\Event\PrepareEvent; /** * Validate field inputs based on annotations in the action class */ -class ValidateFieldsSubscriber extends AbstractPrepareSubscriber { +class ValidateFieldsSubscriber extends Generic\AbstractPrepareSubscriber { /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event * @throws \Exception */ public function onApiPrepare(PrepareEvent $event) { @@ -87,6 +87,9 @@ class ValidateFieldsSubscriber extends AbstractPrepareSubscriber { } break; + case 'mixed': + return TRUE; + default: throw new \API_Exception('Unknown parameter type: ' . $type); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php index 1b0786eae7..cd316f6210 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php @@ -1,10 +1,8 @@ <?php namespace Civi\Api4\Generic; -use Civi\API\Exception\UnauthorizedException; -use Civi\API\Kernel; -use Civi\Api4\Generic\Result; use Civi\Api4\Utils\ReflectionUtils; +use Civi\Api4\Utils\ActionUtil; /** * Base class for all api actions. @@ -53,23 +51,42 @@ abstract class AbstractAction implements \ArrayAccess { */ protected $checkPermissions = TRUE; - /* @var string */ + /** + * @var string + */ protected $_entityName; - /* @var string */ + /** + * @var string + */ protected $_actionName; - /* @var \ReflectionClass */ - private $thisReflection; + /** + * @var \ReflectionClass + */ + private $_reflection; - /* @var array */ - private $thisParamInfo; + /** + * @var array + */ + private $_paramInfo; - /* @var array */ - private $entityFields; + /** + * @var array + */ + private $_entityFields; - /* @var array */ - private $thisArrayStorage; + /** + * @var array + */ + private $_arrayStorage = []; + + /** + * @var int + * Used to identify api calls for transactions + * @see \Civi\Core\Transaction\Manager + */ + private $_id; /** * Action constructor. @@ -85,6 +102,7 @@ abstract class AbstractAction implements \ArrayAccess { } $this->_entityName = $entityName; $this->_actionName = $actionName; + $this->_id = \Civi\API\Request::getNextId(); } /** @@ -172,11 +190,11 @@ abstract class AbstractAction implements \ArrayAccess { * At this point all the params have been sent in and we initiate the api call & return the result. * This is basically the outer wrapper for api v4. * - * @return Result|array - * @throws UnauthorizedException + * @return \Civi\Api4\Generic\Result + * @throws \Civi\API\Exception\UnauthorizedException */ - final public function execute() { - /** @var Kernel $kernel */ + public function execute() { + /** @var \Civi\API\Kernel $kernel */ $kernel = \Civi::service('civi_api_kernel'); return $kernel->runRequest($this); @@ -193,7 +211,7 @@ abstract class AbstractAction implements \ArrayAccess { */ public function getParams() { $params = []; - foreach ($this->getReflection()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { + foreach ($this->reflect()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { $name = $property->getName(); // Skip variables starting with an underscore if ($name[0] != '_') { @@ -210,17 +228,17 @@ abstract class AbstractAction implements \ArrayAccess { * @return array of arrays [description, type, default, (comment)] */ public function getParamInfo($param = NULL) { - if (!isset($this->thisParamInfo)) { + if (!isset($this->_paramInfo)) { $defaults = $this->getParamDefaults(); - foreach ($this->getReflection()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { + foreach ($this->reflect()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { $name = $property->getName(); if ($name != 'version' && $name[0] != '_') { - $this->thisParamInfo[$name] = ReflectionUtils::getCodeDocs($property, 'Property'); - $this->thisParamInfo[$name]['default'] = $defaults[$name]; + $this->_paramInfo[$name] = ReflectionUtils::getCodeDocs($property, 'Property'); + $this->_paramInfo[$name]['default'] = $defaults[$name]; } } } - return $param ? $this->thisParamInfo[$param] : $this->thisParamInfo; + return $param ? $this->_paramInfo[$param] : $this->_paramInfo; } /** @@ -242,7 +260,7 @@ abstract class AbstractAction implements \ArrayAccess { * @param string $param * @return bool */ - protected function paramExists($param) { + public function paramExists($param) { return array_key_exists($param, $this->getParams()); } @@ -250,14 +268,14 @@ abstract class AbstractAction implements \ArrayAccess { * @return array */ protected function getParamDefaults() { - return array_intersect_key($this->getReflection()->getDefaultProperties(), $this->getParams()); + return array_intersect_key($this->reflect()->getDefaultProperties(), $this->getParams()); } /** * @inheritDoc */ public function offsetExists($offset) { - return in_array($offset, ['entity', 'action', 'params', 'version', 'check_permissions']) || isset($this->thisArrayStorage[$offset]); + return in_array($offset, ['entity', 'action', 'params', 'version', 'check_permissions', 'id']) || isset($this->_arrayStorage[$offset]); } /** @@ -276,8 +294,11 @@ abstract class AbstractAction implements \ArrayAccess { if ($offset == 'check_permissions') { return $this->checkPermissions; } - if (isset ($this->thisArrayStorage[$offset])) { - return $this->thisArrayStorage[$offset]; + if ($offset == 'id') { + return $this->_id; + } + if (isset($this->_arrayStorage[$offset])) { + return $this->_arrayStorage[$offset]; } return $val; } @@ -286,14 +307,14 @@ abstract class AbstractAction implements \ArrayAccess { * @inheritDoc */ public function offsetSet($offset, $value) { - if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'version'])) { + if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'version', 'id'])) { throw new \API_Exception('Cannot modify api4 state via array access'); } if ($offset == 'check_permissions') { $this->setCheckPermissions($value); } else { - $this->thisArrayStorage[$offset] = $value; + $this->_arrayStorage[$offset] = $value; } } @@ -301,10 +322,10 @@ abstract class AbstractAction implements \ArrayAccess { * @inheritDoc */ public function offsetUnset($offset) { - if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'check_permissions', 'version'])) { + if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'check_permissions', 'version', 'id'])) { throw new \API_Exception('Cannot modify api4 state via array access'); } - unset($this->thisArrayStorage[$offset]); + unset($this->_arrayStorage[$offset]); } /** @@ -319,6 +340,9 @@ abstract class AbstractAction implements \ArrayAccess { return \CRM_Core_Permission::check($permissions); } + /** + * @return array + */ public function getPermissions() { $permissions = call_user_func(["\\Civi\\Api4\\" . $this->_entityName, 'permissions']); $permissions += [ @@ -340,31 +364,62 @@ abstract class AbstractAction implements \ArrayAccess { /** * Returns schema fields for this entity & action. * + * Here we bypass the api wrapper and execute the getFields action directly. + * This is because we DON'T want the wrapper to check permissions as this is an internal op, + * but we DO want permissions to be checked inside the getFields request so e.g. the api_key + * field can be conditionally included. + * @see \Civi\Api4\Action\Contact\GetFields + * * @return array - * @throws \API_Exception */ - protected function getEntityFields() { - if (!$this->entityFields) { - $params = [ - 'action' => $this->getActionName(), - 'checkPermissions' => $this->checkPermissions, - ]; + public function entityFields() { + if (!$this->_entityFields) { + $getFields = ActionUtil::getAction($this->getEntityName(), 'getFields'); + $result = new Result(); if (method_exists($this, 'getBaoName')) { - $params['includeCustom'] = FALSE; + $getFields->setIncludeCustom(FALSE); } - $this->entityFields = (array) civicrm_api4($this->getEntityName(), 'getFields', $params, 'name'); + $getFields + ->setCheckPermissions($this->checkPermissions) + ->setAction($this->getActionName()) + ->_run($result); + $this->_entityFields = (array) $result->indexBy('name'); } - return $this->entityFields; + return $this->_entityFields; } /** * @return \ReflectionClass */ - protected function getReflection() { - if (!$this->thisReflection) { - $this->thisReflection = new \ReflectionClass($this); + public function reflect() { + if (!$this->_reflection) { + $this->_reflection = new \ReflectionClass($this); + } + return $this->_reflection; + } + + /** + * Validates required fields for actions which create a new object. + * + * @param $values + * @return array + * @throws \API_Exception + */ + protected function checkRequiredFields($values) { + $unmatched = []; + foreach ($this->entityFields() as $fieldName => $fieldInfo) { + if (!isset($values[$fieldName]) || $values[$fieldName] === '') { + if (!empty($fieldInfo['required']) && !isset($fieldInfo['default_value'])) { + $unmatched[] = $fieldName; + } + elseif (!empty($fieldInfo['required_if'])) { + if ($this->evaluateCondition($fieldInfo['required_if'], ['values' => $values])) { + $unmatched[] = $fieldName; + } + } + } } - return $this->thisReflection; + return $unmatched; } /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php index 91c3b461fd..b896aa0835 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php @@ -25,7 +25,7 @@ abstract class AbstractBatchAction extends AbstractQueryAction { private $select; /** - * QueryAction constructor. + * BatchAction constructor. * @param string $entityName * @param string $actionName * @param string|array $select diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php index 0cb55d109a..43f43b601b 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php @@ -33,23 +33,9 @@ abstract class AbstractCreateAction extends AbstractAction { * @throws \API_Exception */ protected function validateValues() { - $unmatched = []; - $params = NULL; - foreach ($this->getEntityFields() as $fieldName => $fieldInfo) { - if (!$this->getValue($fieldName)) { - if (!empty($fieldInfo['required']) && !isset($fieldInfo['default_value'])) { - $unmatched[] = $fieldName; - } - elseif (!empty($fieldInfo['required_if'])) { - $params = $params ?: $this->getParams(); - if ($this->evaluateCondition($fieldInfo['required_if'], $params)) { - $unmatched[] = $fieldName; - } - } - } - } + $unmatched = $this->checkRequiredFields($this->getValues()); if ($unmatched) { - throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: '" . implode("', '", $unmatched) . "'", "mandatory_missing", ["fields" => $unmatched]); + throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]); } } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php index e774baca38..ef380a52ad 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php @@ -50,7 +50,8 @@ abstract class AbstractEntity { $permissions = \CRM_Core_Permission::getEntityActionPermissions(); // For legacy reasons the permissions are keyed by lowercase entity name - $lcentity = _civicrm_api_get_entity_name_from_camel(self::getEntityName()); + // Note: Convert to camel & back in order to circumvent all the api3 naming oddities + $lcentity = _civicrm_api_get_entity_name_from_camel(\CRM_Utils_String::convertStringToCamel(self::getEntityName())); // Merge permissions for this entity with the defaults return \CRM_Utils_Array::value($lcentity, $permissions, []) + $permissions['default']; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php index f8374cf4ca..842836fe27 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php @@ -14,10 +14,106 @@ namespace Civi\Api4\Generic; abstract class AbstractGetAction extends AbstractQueryAction { /** - * Fields to return. Defaults to all non-custom fields. + * Fields to return. Defaults to all fields. + * + * Set to ["row_count"] to return only the number of items found. * * @var array */ protected $select = []; + /** + * Only return the number of found items. + * + * @return $this + */ + public function selectRowCount() { + $this->select = ['row_count']; + return $this; + } + + /** + * Adds field defaults to the where clause. + * + * Note: it will skip adding field defaults when fetching records by id, + * or if that field has already been added to the where clause. + * + * @throws \API_Exception + */ + protected function setDefaultWhereClause() { + if (!$this->_itemsToGet('id')) { + $fields = $this->entityFields(); + foreach ($fields as $field) { + if (isset($field['default_value']) && !$this->_whereContains($field['name'])) { + $this->addWhere($field['name'], '=', $field['default_value']); + } + } + } + } + + /** + * Helper to parse the WHERE param for getRecords to perform simple pre-filtering. + * + * This is intended to optimize some common use-cases e.g. calling the api to get + * one or more records by name or id. + * + * Ex: If getRecords fetches a long list of items each with a unique name, + * but the user has specified a single record to retrieve, you can optimize the call + * by checking $this->_itemsToGet('name') and only fetching the item(s) with that name. + * + * @param string $field + * @return array|null + */ + protected function _itemsToGet($field) { + foreach ($this->where as $clause) { + // Look for exact-match operators (=, IN, or LIKE with no wildcard) + if ($clause[0] == $field && (in_array($clause[1], ['=', 'IN']) || ($clause[1] == 'LIKE' && !(is_string($clause[2]) && strpos($clause[2], '%') !== FALSE)))) { + return (array) $clause[2]; + } + } + return NULL; + } + + /** + * Helper to see if a field should be selected by the getRecords function. + * + * Checks the SELECT, WHERE and ORDER BY params to see what fields are needed. + * + * Note that if no SELECT clause has been set then all fields should be selected + * and this function will always return TRUE. + * + * @param string $field + * @return bool + */ + protected function _isFieldSelected($field) { + if (!$this->select || in_array($field, $this->select) || isset($this->orderBy[$field])) { + return TRUE; + } + return $this->_whereContains($field); + } + + /** + * Walk through the where clause and check if a field is in use. + * + * @param string $field + * @param array $clauses + * @return bool + */ + protected function _whereContains($field, $clauses = NULL) { + if ($clauses === NULL) { + $clauses = $this->where; + } + foreach ($clauses as $clause) { + if (is_array($clause) && is_string($clause[0])) { + if ($clause[0] == $field) { + return TRUE; + } + elseif (is_array($clause[1])) { + return $this->_whereContains($field, $clause[1]); + } + } + } + return FALSE; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php index 993383dc44..82fd42fe28 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php @@ -102,4 +102,43 @@ abstract class AbstractQueryAction extends AbstractAction { return $this; } + /** + * A human-readable where clause, for the reading enjoyment of you humans. + * + * @param array $whereClause + * @param string $op + * @return string + */ + protected function whereClauseToString($whereClause = NULL, $op = 'AND') { + if ($whereClause === NULL) { + $whereClause = $this->where; + } + $output = ''; + if (!is_array($whereClause) || !$whereClause) { + return $output; + } + if (in_array($whereClause[0], ['AND', 'OR', 'NOT'])) { + $op = array_shift($whereClause); + if ($op == 'NOT') { + $output = 'NOT '; + $op = 'AND'; + } + return $output . '(' . $this->whereClauseToString($whereClause, $op) . ')'; + } + elseif (isset($whereClause[1]) && in_array($whereClause[1], \CRM_Core_DAO::acceptedSQLOperators())) { + $output = $whereClause[0] . ' ' . $whereClause[1] . ' '; + if (isset($whereClause[2])) { + $output .= is_array($whereClause[2]) ? '[' . implode(', ', $whereClause[2]) . ']' : $whereClause[2]; + } + } + else { + $clauses = []; + foreach (array_filter($whereClause) as $clause) { + $clauses[] = $this->whereClauseToString($clause, $op); + } + $output = implode(" $op ", $clauses); + } + return $output; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php new file mode 100644 index 0000000000..117a1fe77c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php @@ -0,0 +1,90 @@ +<?php + +namespace Civi\Api4\Generic; + +/** + * Base class for all "Save" api actions. + * + * @method $this setRecords(array $records) Array of records. + * @method $this addRecord($record) Add a record to update. + * @method array getRecords() + * @method $this setDefaults(array $defaults) Array of defaults. + * @method $this addDefault($name, $value) Add a default value. + * @method array getDefaults() + * @method $this setReload(bool $reload) Specify whether complete objects will be returned after saving. + * @method bool getReload() + * + * @package Civi\Api4\Generic + */ +abstract class AbstractSaveAction extends AbstractAction { + + /** + * Array of records. + * + * Should be in the same format as returned by Get. + * + * @var array + * @required + */ + protected $records = []; + + /** + * Array of default values. + * + * These defaults will be applied to all records unless they specify otherwise. + * + * @var array + */ + protected $defaults = []; + + /** + * Reload records after saving. + * + * By default this api typically returns partial records containing only the fields + * that were updated. Set reload to TRUE to do an additional lookup after saving + * to return complete records. + * + * @var bool + */ + protected $reload = FALSE; + + /** + * @var string + */ + private $idField; + + /** + * BatchAction constructor. + * @param string $entityName + * @param string $actionName + * @param string $idField + */ + public function __construct($entityName, $actionName, $idField = 'id') { + // $idField should be a string but some apis (e.g. CustomValue) give us an array + $this->idField = array_values((array) $idField)[0]; + parent::__construct($entityName, $actionName); + } + + /** + * @throws \API_Exception + */ + protected function validateValues() { + $unmatched = []; + foreach ($this->records as $record) { + if (empty($record[$this->idField])) { + $unmatched = array_unique(array_merge($unmatched, $this->checkRequiredFields($record))); + } + } + if ($unmatched) { + throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]); + } + } + + /** + * @return string + */ + protected function getIdField() { + return $this->idField; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php index 2f39cf23a2..49b76a5a56 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4\Generic; + use Civi\API\Exception\NotImplementedException; /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php index 23d47a13c5..033c702ca9 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php @@ -37,6 +37,7 @@ class BasicGetAction extends AbstractGetAction { * @param \Civi\Api4\Generic\Result $result */ public function _run(Result $result) { + $this->setDefaultWhereClause(); $values = $this->getRecords(); $result->exchangeArray($this->queryArray($values)); } @@ -80,65 +81,4 @@ class BasicGetAction extends AbstractGetAction { throw new NotImplementedException('Getter function not found for api4 ' . $this->getEntityName() . '::' . $this->getActionName()); } - /** - * Helper to parse the WHERE param for getRecords to perform simple pre-filtering. - * - * This is intended to optimize some common use-cases e.g. calling the api to get - * one or more records by name or id. - * - * Ex: If getRecords fetches a long list of items each with a unique name, - * but the user has specified a single record to retrieve, you can optimize the call - * by checking $this->_itemsToGet('name') and only fetching the item(s) with that name. - * - * @param string $field - * @return array|null - */ - public function _itemsToGet($field) { - foreach ($this->where as $clause) { - if ($clause[0] == $field && in_array($clause[1], ['=', 'IN'])) { - return (array) $clause[2]; - } - } - return NULL; - } - - /** - * Helper to see if a field should be selected by the getRecords function. - * - * Checks the SELECT, WHERE and ORDER BY params to see what fields are needed. - * - * Note that if no SELECT clause has been set then all fields should be selected - * and this function will always return TRUE. - * - * @param string $field - * @return bool - */ - public function _isFieldSelected($field) { - if (!$this->select || in_array($field, $this->select) || isset($this->orderBy[$field])) { - return TRUE; - } - return $this->_whereContains($field, $this->where); - } - - /** - * Walk through the where clause and check if a field is in use. - * - * @param string $field - * @param array $clauses - * @return bool - */ - private function _whereContains($field, $clauses) { - foreach ($clauses as $clause) { - if (is_array($clause) && is_string($clause[0])) { - if ($clause[0] == $field) { - return TRUE; - } - elseif (is_array($clause[1])) { - return $this->_whereContains($field, $clause[1]); - } - } - } - return FALSE; - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php index c9869d5e0c..198dc930f8 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php @@ -2,6 +2,7 @@ namespace Civi\Api4\Generic; +use Civi\API\Exception\NotImplementedException; use Civi\Api4\Utils\ActionUtil; /** @@ -40,8 +41,12 @@ class BasicGetFieldsAction extends BasicGetAction { * @throws \Civi\API\Exception\NotImplementedException */ public function _run(Result $result) { - $actionClass = ActionUtil::getAction($this->getEntityName(), $this->action); - if (method_exists($actionClass, 'fields')) { + try { + $actionClass = ActionUtil::getAction($this->getEntityName(), $this->getAction()); + } + catch (NotImplementedException $e) { + } + if (isset($actionClass) && method_exists($actionClass, 'fields')) { $values = $actionClass->fields(); } else { @@ -52,20 +57,30 @@ class BasicGetFieldsAction extends BasicGetAction { } /** + * Ensure every result contains, at minimum, the array keys as defined in $this->fields. + * + * Attempt to set some sensible defaults for some fields. + * + * In most cases it's not necessary to override this function, even if your entity is really weird. + * Instead just override $this->fields and thes function will respect that. + * * @param array $values */ - private function padResults(&$values) { + protected function padResults(&$values) { + $fields = array_column($this->fields(), 'name'); foreach ($values as &$field) { - $field += [ - 'title' => ucwords(str_replace('_', ' ', $field['name'])), + $defaults = array_intersect_key([ + 'title' => empty($field['name']) ? NULL : ucwords(str_replace('_', ' ', $field['name'])), 'entity' => $this->getEntityName(), 'required' => FALSE, - 'options' => FALSE, - 'data_type' => 'String', - ]; - if (!$this->loadOptions) { + 'options' => !empty($field['pseudoconstant']), + 'data_type' => \CRM_Utils_Array::value('type', $field, 'String'), + ], array_flip($fields)); + $field += $defaults; + if (!$this->loadOptions && isset($defaults['options'])) { $field['options'] = (bool) $field['options']; } + $field += array_fill_keys($fields, NULL); } } @@ -73,7 +88,12 @@ class BasicGetFieldsAction extends BasicGetAction { * @return string */ public function getAction() { - return $this->action; + // For actions that build on top of other actions, return fields for the simpler action + $sub = [ + 'save' => 'create', + 'replace' => 'create', + ]; + return $sub[$this->action] ?? $this->action; } public function fields() { @@ -98,6 +118,10 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'required', 'data_type' => 'Boolean', ], + [ + 'name' => 'required_if', + 'data_type' => 'String', + ], [ 'name' => 'options', 'data_type' => 'Array', @@ -106,6 +130,14 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'data_type', 'data_type' => 'String', ], + [ + 'name' => 'input_type', + 'data_type' => 'String', + ], + [ + 'name' => 'input_attrs', + 'data_type' => 'Array', + ], [ 'name' => 'fk_entity', 'data_type' => 'String', @@ -114,6 +146,10 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'serialize', 'data_type' => 'Integer', ], + [ + 'name' => 'entity', + 'data_type' => 'String', + ], ]; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php index 8e0dd22e5a..da4bac1a83 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php @@ -2,7 +2,8 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; +use Civi\API\Exception\NotImplementedException; +use Civi\Api4\Utils\ActionUtil; /** * Given a set of records, will appropriately update the database. @@ -10,6 +11,9 @@ use Civi\Api4\Generic\Result; * @method $this setRecords(array $records) Array of records. * @method $this addRecord($record) Add a record to update. * @method array getRecords() + * @method $this setDefaults(array $defaults) Array of defaults. + * @method $this addDefault($name, $value) Add a default value. + * @method array getDefaults() * @method $this setReload(bool $reload) Specify whether complete objects will be returned after saving. * @method bool getReload() */ @@ -20,60 +24,89 @@ class BasicReplaceAction extends AbstractBatchAction { * * Should be in the same format as returned by Get. * - * @required * @var array + * @required */ protected $records = []; /** - * Reload objects after saving. + * Array of default values. + * + * Will be merged into $records before saving. + * + * @var array + */ + protected $defaults = []; + + /** + * Reload records after saving. * - * Setting to TRUE will load complete records and return them as the api result. - * If FALSE the api usually returns only the fields specified to be updated. + * By default this api typically returns partial records containing only the fields + * that were updated. Set reload to TRUE to do an additional lookup after saving + * to return complete records. * * @var bool */ protected $reload = FALSE; + /** + * @return \Civi\Api4\Result\ReplaceResult + */ + public function execute() { + return parent::execute(); + } + /** * @inheritDoc */ public function _run(Result $result) { $items = $this->getBatchRecords(); - // Copy params from where clause if the operator is = - $paramsFromWhere = []; + // Copy defaults from where clause if the operator is = foreach ($this->where as $clause) { if (is_array($clause) && $clause[1] === '=') { - $paramsFromWhere[$clause[0]] = $clause[2]; + $this->defaults[$clause[0]] = $clause[2]; } } $idField = $this->getSelect()[0]; - $toDelete = array_column($items, NULL, $idField); + $toDelete = array_diff_key(array_column($items, NULL, $idField), array_flip(array_filter(\CRM_Utils_Array::collect($idField, $this->records)))); - foreach ($this->records as $record) { - $record += $paramsFromWhere; - if (!empty($record[$idField])) { - $id = $record[$idField]; - unset($toDelete[$id], $record[$idField]); - $result[] = civicrm_api4($this->getEntityName(), 'update', [ - 'reload' => $this->reload, - 'where' => [[$idField, '=', $id]], - 'values' => $record, - ])->first(); - } - else { - $result[] = civicrm_api4($this->getEntityName(), 'create', [ - 'values' => $record, - ])->first(); + // Try to delegate to the Save action + try { + $saveAction = ActionUtil::getAction($this->getEntityName(), 'save'); + $saveAction + ->setCheckPermissions($this->getCheckPermissions()) + ->setReload($this->reload) + ->setRecords($this->records) + ->setDefaults($this->defaults); + $result->exchangeArray((array) $saveAction->execute()); + } + // Fall back on Create/Update if Save doesn't exist + catch (NotImplementedException $e) { + foreach ($this->records as $record) { + $record += $this->defaults; + if (!empty($record[$idField])) { + $result[] = civicrm_api4($this->getEntityName(), 'update', [ + 'reload' => $this->reload, + 'where' => [[$idField, '=', $record[$idField]]], + 'values' => $record, + 'checkPermissions' => $this->getCheckPermissions(), + ])->first(); + } + else { + $result[] = civicrm_api4($this->getEntityName(), 'create', [ + 'values' => $record, + 'checkPermissions' => $this->getCheckPermissions(), + ])->first(); + } } } - $result->deleted = []; if ($toDelete) { $result->deleted = (array) civicrm_api4($this->getEntityName(), 'delete', [ 'where' => [[$idField, 'IN', array_keys($toDelete)]], + 'checkPermissions' => $this->getCheckPermissions(), ]); } } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php new file mode 100644 index 0000000000..c03d5af349 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php @@ -0,0 +1,79 @@ +<?php + +namespace Civi\Api4\Generic; + +use Civi\API\Exception\NotImplementedException; +use Civi\Api4\Utils\ActionUtil; + +/** + * Create or update one or more records. + * + * If creating more than one record with similar values, use the "defaults" param. + * + * Set "reload" if you need the api to return complete records. + */ +class BasicSaveAction extends AbstractSaveAction { + + /** + * @var callable + * + * Function(array $item, BasicCreateAction $thisAction) => array + */ + private $setter; + + /** + * Basic Create constructor. + * + * @param string $entityName + * @param string $actionName + * @param string $idField + * @param callable $setter + * Function(array $item, BasicCreateAction $thisAction) => array + */ + public function __construct($entityName, $actionName, $idField = 'id', $setter = NULL) { + parent::__construct($entityName, $actionName, $idField); + $this->setter = $setter; + } + + /** + * We pass the writeRecord function an array representing one item to write. + * We expect to get the same format back. + * + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $this->validateValues(); + foreach ($this->records as $record) { + $record += $this->defaults; + $result[] = $this->writeRecord($record); + } + if ($this->reload) { + /** @var BasicGetAction $get */ + $get = ActionUtil::getAction($this->getEntityName(), 'get'); + $get + ->setCheckPermissions($this->getCheckPermissions()) + ->addWhere($this->getIdField(), 'IN', (array) $result->column($this->getIdField())); + $result->exchangeArray((array) $get->execute()); + } + } + + /** + * This Basic Save class can be used in one of two ways: + * + * 1. Use this class directly by passing a callable ($setter) to the constructor. + * 2. Extend this class and override this function. + * + * Either way, this function should return an array representing the one new object. + * + * @param array $item + * @return array + * @throws \Civi\API\Exception\NotImplementedException + */ + protected function writeRecord($item) { + if (is_callable($this->setter)) { + return call_user_func($this->setter, $item, $this); + } + throw new NotImplementedException('Setter function not found for api4 ' . $this->getEntityName() . '::' . $this->getActionName()); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php index 40c93624e3..796944e3f4 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php @@ -38,11 +38,17 @@ class BasicUpdateAction extends AbstractUpdateAction { * We expect to get the same format back. * * @param \Civi\Api4\Generic\Result $result + * @throws \API_Exception + * @throws \Civi\API\Exception\NotImplementedException */ public function _run(Result $result) { foreach ($this->getBatchRecords() as $item) { $result[] = $this->writeRecord($this->values + $item); } + + if (!$result->count()) { + throw new \API_Exception('Cannot ' . $this->getActionName() . ' ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } } /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php index d7a0e86930..091eacf036 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Create a new object from supplied values. * @@ -35,24 +33,4 @@ class DAOCreateAction extends AbstractCreateAction { parent::validateValues(); } - /** - * Fill field defaults which were declared by the api. - * - * Note: default values from core are ignored because the BAO or database layer will supply them. - * - * @param array $params - */ - protected function fillDefaults(&$params) { - $fields = $this->getEntityFields(); - $bao = $this->getBaoName(); - $coreFields = array_column($bao::fields(), NULL, 'name'); - - foreach ($fields as $name => $field) { - // If a default value is set in the api but not in core, the api should supply it. - if (!isset($params[$name]) && !empty($field['default_value']) && empty($coreFields[$name]['default'])) { - $params[$name] = $field['default_value']; - } - } - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php index f61af3f1d2..00b32fe217 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Delete one or more items, based on criteria specified in Where param (required). */ @@ -16,11 +14,15 @@ class DAODeleteAction extends AbstractBatchAction { public function _run(Result $result) { $defaults = $this->getParamDefaults(); if ($defaults['where'] && !array_diff_key($this->where, $defaults['where'])) { - throw new \API_Exception('Cannot delete with no "where" parameter specified'); + throw new \API_Exception('Cannot delete ' . $this->getEntityName() . ' with no "where" parameter specified'); } $items = $this->getObjects(); + if (!$items) { + throw new \API_Exception('Cannot delete ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } + $ids = $this->deleteObjects($items); $result->exchangeArray($ids); @@ -46,7 +48,7 @@ class DAODeleteAction extends AbstractBatchAction { $args = [$item['id']]; $bao = call_user_func_array([$baoName, 'del'], $args); if ($bao !== FALSE) { - $ids[] = $item['id']; + $ids[] = ['id' => $item['id']]; } else { throw new \API_Exception("Could not delete {$this->getEntityName()} id {$item['id']}"); @@ -60,7 +62,7 @@ class DAODeleteAction extends AbstractBatchAction { // delete it $action_result = $bao->delete(); if ($action_result) { - $ids[] = $item['id']; + $ids[] = ['id' => $item['id']]; } else { throw new \API_Exception("Could not delete {$this->getEntityName()} id {$item['id']}"); diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php index 1ad175da4b..0f2b14160e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php @@ -14,6 +14,13 @@ abstract class DAOEntity extends AbstractEntity { return new DAOGetAction(static::class, __FUNCTION__); } + /** + * @return DAOGetAction + */ + public static function save() { + return new DAOSaveAction(static::class, __FUNCTION__); + } + /** * @return DAOGetFieldsAction */ diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php index 0216f0da8e..2420034bc1 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Retrieve items based on criteria specified in the 'where' param. * @@ -15,6 +13,7 @@ class DAOGetAction extends AbstractGetAction { use Traits\DAOActionTrait; public function _run(Result $result) { + $this->setDefaultWhereClause(); $result->exchangeArray($this->getObjects()); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php index e86d99bc28..9f351d075f 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php @@ -2,7 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Service\Spec\SpecGatherer; use Civi\Api4\Service\Spec\SpecFormatter; /** @@ -27,14 +26,14 @@ class DAOGetFieldsAction extends BasicGetFieldsAction { */ protected function getRecords() { $fields = $this->_itemsToGet('name'); - /** @var SpecGatherer $gatherer */ + /** @var \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ $gatherer = \Civi::container()->get('spec_gatherer'); // Any fields name with a dot in it is custom if ($fields) { $this->includeCustom = strpos(implode('', $fields), '.') !== FALSE; } - $spec = $gatherer->getSpec($this->getEntityName(), $this->action, $this->includeCustom); - return SpecFormatter::specToArray($spec->getFields($fields), (array) $this->select, $this->loadOptions); + $spec = $gatherer->getSpec($this->getEntityName(), $this->getAction(), $this->includeCustom); + return SpecFormatter::specToArray($spec->getFields($fields), $this->loadOptions); } public function fields() { diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php new file mode 100644 index 0000000000..4169ab3103 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php @@ -0,0 +1,32 @@ +<?php + +namespace Civi\Api4\Generic; + +/** + * Create or update one or more records. + * + * If creating more than one record with similar values, use the "defaults" param. + * + * Set "reload" if you need the api to return complete records. + */ +class DAOSaveAction extends AbstractSaveAction { + use Traits\DAOActionTrait; + + /** + * @inheritDoc + */ + public function _run(Result $result) { + foreach ($this->records as &$record) { + $record += $this->defaults; + if (empty($record['id'])) { + $this->fillDefaults($record); + } + } + $this->validateValues(); + + $resultArray = $this->writeObjects($this->records); + + $result->exchangeArray($resultArray); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php index 62da879667..28684ad9e5 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Update one or more records with new values. * @@ -12,19 +10,52 @@ use Civi\Api4\Generic\Result; class DAOUpdateAction extends AbstractUpdateAction { use Traits\DAOActionTrait; + /** + * Criteria for selecting items to update. + * + * Required if no id is supplied in values. + * + * @var array + */ + protected $where = []; + /** * @inheritDoc */ public function _run(Result $result) { + // Add ID from values to WHERE clause and check for mismatch if (!empty($this->values['id'])) { - throw new \Exception("Cannot update the id of an existing " . $this->getEntityName() . '.'); + $wheres = array_column($this->where, NULL, 0); + if (!isset($wheres['id'])) { + $this->addWhere('id', '=', $this->values['id']); + } + elseif (!($wheres['id'][1] === '=' && $wheres['id'][2] == $this->values['id'])) { + throw new \Exception("Cannot update the id of an existing " . $this->getEntityName() . '.'); + } + } + + // Require WHERE if we didn't get an ID from values + if (!$this->where) { + throw new \API_Exception('Parameter "where" is required unless an id is supplied in values.'); + } + + // Update a single record by ID unless select requires more than id + if ($this->getSelect() === ['id'] && count($this->where) === 1 && $this->where[0][0] === 'id' && $this->where[0][1] === '=' && !empty($this->where[0][2])) { + $this->values['id'] = $this->where[0][2]; + $result->exchangeArray($this->writeObjects([$this->values])); + return; } + // Batch update 1 or more records based on WHERE clause $items = $this->getObjects(); foreach ($items as &$item) { $item = $this->values + $item; } + if (!$items) { + throw new \API_Exception('Cannot ' . $this->getActionName() . ' ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } + $result->exchangeArray($this->writeObjects($items)); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Result.php b/civicrm/ext/api4/Civi/Api4/Generic/Result.php index 35fb6fb066..9930ce813f 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Result.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Result.php @@ -45,6 +45,8 @@ class Result extends \ArrayObject { */ public $version = 4; + private $indexedBy; + /** * Return first result. * @return array|null @@ -87,6 +89,7 @@ class Result extends \ArrayObject { * @throws \API_Exception */ public function indexBy($key) { + $this->indexedBy = $key; if (count($this)) { $newResults = []; foreach ($this as $values) { @@ -102,4 +105,27 @@ class Result extends \ArrayObject { return $this; } + /** + * Returns the number of results + * + * @return int + */ + public function count() { + $count = parent::count(); + if ($count == 1 && is_array($this->first()) && array_keys($this->first()) == ['row_count']) { + return $this->first()['row_count']; + } + return $count; + } + + /** + * Reduce each result to one field + * + * @param $name + * @return array + */ + public function column($name) { + return array_column($this->getArrayCopy(), $name, $this->indexedBy); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php index 1d223f1b79..4435d1f49f 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4\Generic\Traits; + use Civi\API\Exception\NotImplementedException; /** @@ -19,8 +20,8 @@ trait ArrayQueryActionTrait { protected function queryArray($values) { $values = $this->filterArray($values); $values = $this->sortArray($values); - $values = $this->selectArray($values); $values = $this->limitArray($values); + $values = $this->selectArray($values); return $values; } @@ -175,7 +176,10 @@ trait ArrayQueryActionTrait { * @return array */ protected function selectArray($values) { - if ($this->getSelect()) { + if ($this->getSelect() === ['row_count']) { + $values = [['row_count' => count($values)]]; + } + elseif ($this->getSelect()) { foreach ($values as &$value) { $value = array_intersect_key($value, array_flip($this->getSelect())); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php index 6a765b4092..dc59ca77b0 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php @@ -12,7 +12,7 @@ use Civi\Api4\Utils\CoreUtil; */ trait CustomValueActionTrait { - function __construct($customGroup, $actionName) { + public function __construct($customGroup, $actionName) { $this->customGroup = $customGroup; parent::__construct('CustomValue', $actionName, ['id', 'entity_id']); } @@ -36,8 +36,17 @@ trait CustomValueActionTrait { */ protected function writeObjects($items) { $result = []; + $fields = $this->entityFields(); foreach ($items as $item) { - FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->getEntityFields()); + FormattingUtil::formatWriteParams($item, $this->getEntityName(), $fields); + + // Convert field names to custom_xx format + foreach ($fields as $name => $field) { + if (!empty($field['custom_field_id']) && isset($item[$name])) { + $item['custom_' . $field['custom_field_id']] = $item[$name]; + unset($item[$name]); + } + } $result[] = \CRM_Core_BAO_CustomValueTable::setValues($item); } @@ -66,7 +75,7 @@ trait CustomValueActionTrait { * @inheritDoc */ protected function fillDefaults(&$params) { - foreach ($this->getEntityFields() as $name => $field) { + foreach ($this->entityFields() as $name => $field) { if (!isset($params[$name]) && isset($field['default_value'])) { $params[$name] = $field['default_value']; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php index 1c92906bf5..0d79389c2e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php @@ -5,8 +5,21 @@ use CRM_Utils_Array as UtilsArray; use Civi\Api4\Utils\FormattingUtil; use Civi\Api4\Query\Api4SelectQuery; +/** + * @method string getLanguage() + * @method setLanguage(string $language) + */ trait DAOActionTrait { + /** + * Specify the language to use if this is a multi-lingual environment. + * + * E.g. "en_US" or "fr_CA" + * + * @var string + */ + protected $language; + /** * @return \CRM_Core_DAO|string */ @@ -28,7 +41,7 @@ trait DAOActionTrait { foreach ($fields as $key => $field) { $name = $field['name']; if (property_exists($bao, $name)) { - $values[$name] = $bao->$name; + $values[$name] = isset($bao->$name) ? $bao->$name : NULL; } } return $values; @@ -38,7 +51,7 @@ trait DAOActionTrait { * @return array|int */ protected function getObjects() { - $query = new Api4SelectQuery($this->getEntityName(), $this->getCheckPermissions()); + $query = new Api4SelectQuery($this->getEntityName(), $this->getCheckPermissions(), $this->entityFields()); $query->select = $this->getSelect(); $query->where = $this->getWhere(); $query->orderBy = $this->getOrderBy(); @@ -48,12 +61,32 @@ trait DAOActionTrait { } /** - * Write a bao object as part of a create/update action. + * Fill field defaults which were declared by the api. + * + * Note: default values from core are ignored because the BAO or database layer will supply them. + * + * @param array $params + */ + protected function fillDefaults(&$params) { + $fields = $this->entityFields(); + $bao = $this->getBaoName(); + $coreFields = array_column($bao::fields(), NULL, 'name'); + + foreach ($fields as $name => $field) { + // If a default value in the api field is different than in core, the api should override it. + if (!isset($params[$name]) && !empty($field['default_value']) && $field['default_value'] != \CRM_Utils_Array::pathGet($coreFields, [$name, 'default'])) { + $params[$name] = $field['default_value']; + } + } + } + + /** + * Write bao objects as part of a create/update action. * * @param array $items - * The record to write to the DB. + * The records to write to the DB. * @return array - * The record after being written to the DB (e.g. including newly assigned "id"). + * The records after being written to the DB (e.g. including newly assigned "id"). * @throws \API_Exception */ protected function writeObjects($items) { @@ -61,11 +94,11 @@ trait DAOActionTrait { // Some BAOs are weird and don't support a straightforward "create" method. $oddballs = [ - 'Address' => 'add', + 'EntityTag' => 'add', 'GroupContact' => 'add', 'Website' => 'add', ]; - $method = UtilsArray::value($this->getEntityName(), $oddballs, 'create'); + $method = $oddballs[$this->getEntityName()] ?? 'create'; if (!method_exists($baoName, $method)) { $method = 'add'; } @@ -74,27 +107,23 @@ trait DAOActionTrait { foreach ($items as $item) { $entityId = UtilsArray::value('id', $item); - FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->getEntityFields()); + FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->entityFields()); $this->formatCustomParams($item, $entityId); $item['check_permissions'] = $this->getCheckPermissions(); - $apiKeyPermission = $this->getEntityName() != 'Contact' || !$this->getCheckPermissions() || array_key_exists('api_key', $this->getEntityFields()) - || ($entityId && \CRM_Core_Permission::check('edit own api keys') && \CRM_Core_Session::getLoggedInContactID() == $entityId); - - if (!$apiKeyPermission && array_key_exists('api_key', $item)) { - throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify api key'); - } - // For some reason the contact bao requires this if ($entityId && $this->getEntityName() == 'Contact') { $item['contact_id'] = $entityId; } - if ($this->getCheckPermissions() && $entityId) { + if ($this->getCheckPermissions()) { $this->checkContactPermissions($baoName, $item); } - if (method_exists($baoName, $method)) { + if ($this->getEntityName() == 'Address') { + $createResult = $baoName::add($item, $this->fixAddress); + } + elseif (method_exists($baoName, $method)) { $createResult = $baoName::$method($item); } else { @@ -113,10 +142,6 @@ trait DAOActionTrait { // trim back the junk and just get the array: $resultArray = $this->baoToArray($createResult); - if (!$apiKeyPermission && array_key_exists('api_key', $resultArray)) { - unset($resultArray['api_key']); - } - $result[] = $resultArray; } return $result; @@ -147,7 +172,7 @@ trait DAOActionTrait { * @param int $entityId * @return mixed */ - private function formatCustomParams(&$params, $entityId) { + protected function formatCustomParams(&$params, $entityId) { $customParams = []; // $customValueID is the ID of the custom value in the custom table for this @@ -191,7 +216,8 @@ trait DAOActionTrait { $customParams, $value, $customFieldExtends, - NULL, // todo check when this is needed + // todo check when this is needed + NULL, $entityId, FALSE, FALSE, @@ -213,7 +239,7 @@ trait DAOActionTrait { * @throws \Civi\API\Exception\UnauthorizedException */ protected function checkContactPermissions($baoName, $item) { - if ($baoName == 'CRM_Contact_BAO_Contact') { + if ($baoName == 'CRM_Contact_BAO_Contact' && !empty($item['id'])) { $permission = $this->getActionName() == 'delete' ? \CRM_Core_Permission::DELETE : \CRM_Core_Permission::EDIT; if (!\CRM_Contact_BAO_Contact_Permission::allow($item['id'], $permission)) { throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify contact record'); diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php new file mode 100644 index 0000000000..97a008ac09 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php @@ -0,0 +1,40 @@ +<?php +namespace Civi\Api4\Generic\Traits; + +/** + * This trait adds the $current param to a Get action. + * + * @see \Civi\Api4\Event\Subscriber\IsCurrentSubscriber + */ +trait IsCurrentTrait { + + /** + * Convenience filter for selecting items that are enabled and are currently within their start/end dates. + * + * Adding current = TRUE is a shortcut for + * WHERE is_active = 1 AND (end_date IS NULL OR end_date >= now) AND (start_date IS NULL OR start_DATE <= now) + * + * Adding current = FALSE is a shortcut for + * WHERE is_active = 0 OR start_date > now OR end_date < now + * + * @var bool + */ + protected $current; + + /** + * @return bool + */ + public function getCurrent() { + return $this->current; + } + + /** + * @param bool $current + * @return $this + */ + public function setCurrent($current) { + $this->current = $current; + return $this; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/GroupContact.php b/civicrm/ext/api4/Civi/Api4/GroupContact.php index 8901cd3bf6..e2664c2d37 100644 --- a/civicrm/ext/api4/Civi/Api4/GroupContact.php +++ b/civicrm/ext/api4/Civi/Api4/GroupContact.php @@ -19,6 +19,13 @@ class GroupContact extends Generic\DAOEntity { return new Action\GroupContact\Create(__CLASS__, __FUNCTION__); } + /** + * @return Action\GroupContact\Save + */ + public static function save() { + return new Action\GroupContact\Save(__CLASS__, __FUNCTION__); + } + /** * @return Action\GroupContact\Update */ diff --git a/civicrm/ext/api4/Civi/Api4/GroupNesting.php b/civicrm/ext/api4/Civi/Api4/GroupNesting.php new file mode 100644 index 0000000000..df3286b66f --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/GroupNesting.php @@ -0,0 +1,11 @@ +<?php +namespace Civi\Api4; + +/** + * GroupNesting entity. + * + * @package Civi\Api4 + */ +class GroupNesting extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/GroupOrganization.php b/civicrm/ext/api4/Civi/Api4/GroupOrganization.php new file mode 100644 index 0000000000..0263a5bad0 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/GroupOrganization.php @@ -0,0 +1,11 @@ +<?php +namespace Civi\Api4; + +/** + * GroupOrganization entity. + * + * @package Civi\Api4 + */ +class GroupOrganization extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/LocationType.php b/civicrm/ext/api4/Civi/Api4/LocationType.php new file mode 100644 index 0000000000..3bea60b2f5 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/LocationType.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * LocationType entity. + * + * @package Civi\Api4 + */ +class LocationType extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/MailSettings.php b/civicrm/ext/api4/Civi/Api4/MailSettings.php new file mode 100644 index 0000000000..c03f0dff73 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/MailSettings.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * MailSettings entity. + * + * @package Civi\Api4 + */ +class MailSettings extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Mapping.php b/civicrm/ext/api4/Civi/Api4/Mapping.php new file mode 100644 index 0000000000..910ae1a29d --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Mapping.php @@ -0,0 +1,14 @@ +<?php + +namespace Civi\Api4; + +/** + * Mapping entity. + * + * This is a collection of MappingFields, for reuse in import, export, etc. + * + * @package Civi\Api4 + */ +class Mapping extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/MappingField.php b/civicrm/ext/api4/Civi/Api4/MappingField.php new file mode 100644 index 0000000000..b1a1be14f9 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/MappingField.php @@ -0,0 +1,14 @@ +<?php + +namespace Civi\Api4; + +/** + * MappingField entity. + * + * This represents one field in a Mapping collection. + * + * @package Civi\Api4 + */ +class MappingField extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Navigation.php b/civicrm/ext/api4/Civi/Api4/Navigation.php index 31f2a9113e..8c0f79dbfb 100644 --- a/civicrm/ext/api4/Civi/Api4/Navigation.php +++ b/civicrm/ext/api4/Civi/Api4/Navigation.php @@ -9,11 +9,4 @@ namespace Civi\Api4; */ class Navigation extends Generic\DAOEntity { - /** - * @return Action\Navigation\Get - */ - public static function get() { - return new Action\Navigation\Get(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Participant.php b/civicrm/ext/api4/Civi/Api4/Participant.php index 0e09c79739..d0fce78eb1 100644 --- a/civicrm/ext/api4/Civi/Api4/Participant.php +++ b/civicrm/ext/api4/Civi/Api4/Participant.php @@ -3,17 +3,10 @@ namespace Civi\Api4; /** - * Participant entity. + * Participant entity, stores the participation record of a contact in an event. * * @package Civi\Api4 */ class Participant extends Generic\DAOEntity { - /** - * @return Action\Participant\Get - */ - public static function get() { - return new Action\Participant\Get(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php b/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php index 60596d9261..0169800af0 100644 --- a/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php @@ -31,7 +31,7 @@ use Civi\API\Event\ResolveEvent; use Civi\API\Provider\ProviderInterface; use Civi\Api4\Generic\AbstractAction; use Civi\API\Events; -use Civi\Api4\Generic\Result; +use Civi\Api4\Utils\ReflectionUtils; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -52,8 +52,9 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac ], ]; } + /** - * @param ResolveEvent $event + * @param \Civi\API\Event\ResolveEvent $event * API resolution event. */ public function onApiResolve(ResolveEvent $event) { @@ -68,12 +69,16 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac /** * @inheritDoc * - * @param AbstractAction $action + * @param \Civi\Api4\Generic\AbstractAction $action * - * @return array|mixed + * @return \Civi\Api4\Generic\Result */ public function invoke($action) { - $result = new Result(); + // Load result class based on @return annotation in the execute() method. + $reflection = new \ReflectionClass($action); + $doc = ReflectionUtils::getCodeDocs($reflection->getMethod('execute'), 'Method'); + $resultClass = \CRM_Utils_Array::value('return', $doc, '\\Civi\\Api4\\Generic\\Result'); + $result = new $resultClass(); $result->action = $action->getActionName(); $result->entity = $action->getEntityName(); $action->_run($result); @@ -84,8 +89,8 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac /** * Run each chained action once per row * - * @param AbstractAction $action - * @param Result $result + * @param \Civi\Api4\Generic\AbstractAction $action + * @param \Civi\Api4\Generic\Result $result */ protected function handleChains($action, $result) { foreach ($action->getChain() as $name => $request) { diff --git a/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php b/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php index a7a912dab4..7f62c59815 100644 --- a/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php +++ b/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php @@ -34,8 +34,7 @@ use Civi\Api4\Service\Schema\Joinable\CustomGroupJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Civi\Api4\Utils\FormattingUtil; use Civi\Api4\Utils\CoreUtil; -use CRM_Core_DAO_AllCoreTables as TableHelper; -use CRM_Core_DAO_CustomField as CustomFieldDAO; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; use CRM_Utils_Array as UtilsArray; /** @@ -65,7 +64,7 @@ class Api4SelectQuery extends SelectQuery { protected $fkSelectAliases = []; /** - * @var Joinable[] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[] * The joinable tables that have been joined so far */ protected $joinedTables = []; @@ -73,17 +72,18 @@ class Api4SelectQuery extends SelectQuery { /** * @param string $entity * @param bool $checkPermissions + * @param array $fields */ - public function __construct($entity, $checkPermissions) { + public function __construct($entity, $checkPermissions, $fields) { require_once 'api/v3/utils.php'; $this->entity = $entity; $this->checkPermissions = $checkPermissions; - $baoName = CoreUtil::getDAOFromApiName($entity); + $baoName = CoreUtil::getBAOFromApiName($entity); $bao = new $baoName(); $this->entityFieldNames = _civicrm_api3_field_names(_civicrm_api3_build_fields_array($bao)); - $this->apiFieldSpec = $this->getFields(); + $this->apiFieldSpec = (array) $fields; \CRM_Utils_SQL_Select::from($this->getTableName($baoName) . ' ' . self::MAIN_TABLE_ALIAS); @@ -97,9 +97,43 @@ class Api4SelectQuery extends SelectQuery { * @return array|int */ public function run() { - $this->preRun(); - $baseResults = parent::run(); - $event = new PostSelectQueryEvent($baseResults, $this); + $this->addJoins(); + $this->buildSelectFields(); + $this->buildWhereClause(); + + // Select + if (in_array('row_count', $this->select)) { + $this->query->select("count(*) as c"); + } + else { + foreach ($this->selectFields as $column => $alias) { + $this->query->select("$column as `$alias`"); + } + // Order by + $this->buildOrderBy(); + } + + // Limit + if (!empty($this->limit) || !empty($this->offset)) { + $this->query->limit($this->limit, $this->offset); + } + + $results = []; + $query = \CRM_Core_DAO::executeQuery($this->query->toSQL()); + + while ($query->fetch()) { + if (in_array('row_count', $this->select)) { + $results[]['row_count'] = (int) $query->c; + break; + } + $results[$query->id] = []; + foreach ($this->selectFields as $column => $alias) { + $returnName = $alias; + $alias = str_replace('.', '_', $alias); + $results[$query->id][$returnName] = property_exists($query, $alias) ? $query->$alias : NULL; + }; + } + $event = new PostSelectQueryEvent($results, $this); \Civi::dispatcher()->dispatch(Events::POST_SELECT_QUERY, $event); return $event->getResults(); @@ -108,7 +142,7 @@ class Api4SelectQuery extends SelectQuery { /** * Gets all FK fields and does the required joins */ - protected function preRun() { + protected function addJoins() { $allFields = array_merge($this->select, array_keys($this->orderBy)); $recurse = function($clauses) use (&$allFields, &$recurse) { foreach ($clauses as $clause) { @@ -209,7 +243,6 @@ class Api4SelectQuery extends SelectQuery { if ($this->getField($field)) { $this->query->orderBy(self::MAIN_TABLE_ALIAS . '.' . $field . " $dir"); } - // TODO: Handle joined fields, custom fields, etc. else { throw new \API_Exception("Invalid sort field. Cannot order by $field $dir"); } @@ -294,8 +327,7 @@ class Api4SelectQuery extends SelectQuery { * @inheritDoc */ protected function getFields() { - $fields = civicrm_api4($this->entity, 'getFields', ['action' => 'get', 'checkPermissions' => $this->checkPermissions, 'includeCustom' => FALSE])->indexBy('name'); - return (array) $fields; + return $this->apiFieldSpec; } /** @@ -337,7 +369,7 @@ class Api4SelectQuery extends SelectQuery { } $joinPath = $joiner->join($this, $pathString); - /** @var Joinable $lastLink */ + /** @var \Civi\Api4\Service\Schema\Joinable\Joinable $lastLink */ $lastLink = array_pop($joinPath); // Cache field info for retrieval by $this->getField() @@ -366,7 +398,7 @@ class Api4SelectQuery extends SelectQuery { } /** - * @param Joinable $joinable + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $joinable * * @return $this */ @@ -380,7 +412,7 @@ class Api4SelectQuery extends SelectQuery { * @return FALSE|string */ public function getFrom() { - return TableHelper::getTableForClass(TableHelper::getFullName($this->entity)); + return AllCoreTables::getTableForClass(AllCoreTables::getFullName($this->entity)); } /** @@ -496,14 +528,14 @@ class Api4SelectQuery extends SelectQuery { } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] */ public function getJoinedTables() { return $this->joinedTables; } /** - * @return Joinable + * @return \Civi\Api4\Service\Schema\Joinable\Joinable */ public function getJoinedTable($alias) { foreach ($this->joinedTables as $join) { @@ -528,7 +560,6 @@ class Api4SelectQuery extends SelectQuery { else { $bao = new $baoName(); $this->query = \CRM_Utils_SQL_Select::from($bao->tableName() . ' ' . self::MAIN_TABLE_ALIAS); - $bao->free(); } } diff --git a/civicrm/ext/api4/Civi/Api4/Relationship.php b/civicrm/ext/api4/Civi/Api4/Relationship.php index 5161f05fc5..49f0519959 100644 --- a/civicrm/ext/api4/Civi/Api4/Relationship.php +++ b/civicrm/ext/api4/Civi/Api4/Relationship.php @@ -9,4 +9,11 @@ namespace Civi\Api4; */ class Relationship extends Generic\DAOEntity { + /** + * @return \Civi\Api4\Action\Relationship\Get + */ + public static function get() { + return new \Civi\Api4\Action\Relationship\Get(static::class, __FUNCTION__); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php b/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php new file mode 100644 index 0000000000..a11b76c059 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php @@ -0,0 +1,10 @@ +<?php +namespace Civi\Api4\Result; + +class ReplaceResult extends \Civi\Api4\Generic\Result { + /** + * @var array + */ + public $deleted = []; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Route.php b/civicrm/ext/api4/Civi/Api4/Route.php new file mode 100644 index 0000000000..dda3a27c38 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Route.php @@ -0,0 +1,76 @@ +<?php +namespace Civi\Api4; + +use Civi\Api4\Generic\BasicGetFieldsAction; + +class Route extends \Civi\Api4\Generic\AbstractEntity { + + /** + * @return \Civi\Api4\Generic\BasicGetAction + */ + public static function get() { + return new \Civi\Api4\Generic\BasicGetAction(__CLASS__, __FUNCTION__, function ($get) { + // Pulling from ::items() rather than DB -- because it provides the final/live/altered data. + $items = \CRM_Core_Menu::items(); + $result = []; + foreach ($items as $path => $item) { + $result[] = ['path' => $path] + $item; + } + return $result; + }); + } + + public static function getFields() { + return new BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { + return [ + [ + 'name' => 'path', + 'title' => 'Relative Path', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'title' => 'Page Title', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'page_callback', + 'title' => 'Page Callback', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'page_arguments', + 'title' => 'Page Arguments', + 'required' => FALSE, + 'data_type' => 'String', + ], + [ + 'name' => 'path_arguments', + 'title' => 'Path Arguments', + 'required' => FALSE, + 'data_type' => 'String', + ], + [ + 'name' => 'access_arguments', + 'title' => 'Access Arguments', + 'required' => FALSE, + 'data_type' => 'Array', + ], + ]; + }); + } + + /** + * @return array + */ + public static function permissions() { + return [ + "meta" => ["access CiviCRM"], + "default" => ["administer CiviCRM"], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php index a1dd1a1d67..4069b9aff0 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php @@ -22,7 +22,8 @@ class CustomGroupJoinable extends Joinable { * @param $targetTable * @param $alias * @param bool $isMultiRecord - * @param null $entity + * @param string $entity + * @param string $columns */ public function __construct($targetTable, $alias, $isMultiRecord, $entity, $columns) { $this->entity = $entity; @@ -38,7 +39,8 @@ class CustomGroupJoinable extends Joinable { public function getEntityFields() { if (!$this->entityFields) { $fields = CustomField::get() - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_required', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value']) + ->setCheckPermissions(FALSE) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_required', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->addWhere('custom_group.table_name', '=', $this->getTargetTable()) ->execute(); foreach ($fields as $field) { diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php index 0e92e3ab83..f2f29916bf 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php @@ -2,8 +2,8 @@ namespace Civi\Api4\Service\Schema\Joinable; -use Civi\Api4\Service\Spec\FieldSpec; -use CRM_Core_DAO_AllCoreTables as Tables; +use Civi\Api4\Utils\CoreUtil; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; class Joinable { @@ -75,7 +75,7 @@ class Joinable { $this->targetTable = $targetTable; $this->targetColumn = $targetColumn; if (!$this->entity) { - $this->entity = Tables::getBriefName(Tables::getClassForTable($targetTable)); + $this->entity = CoreUtil::getApiNameFromTableName($targetTable); } $this->alias = $alias ?: str_replace('civicrm_', '', $targetTable); } @@ -252,7 +252,7 @@ class Joinable { */ public function getEntityFields() { if (!$this->entityFields) { - $bao = Tables::getClassForTable($this->getTargetTable()); + $bao = AllCoreTables::getClassForTable($this->getTargetTable()); if ($bao) { foreach ($bao::fields() as $field) { $this->entityFields[] = \Civi\Api4\Service\Spec\SpecFormatter::arrayToField($field, $this->getEntity()); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php index cb30ab5703..87677f1390 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php @@ -3,7 +3,6 @@ namespace Civi\Api4\Service\Schema; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Api4\Service\Schema\Joinable\Joinable; class Joiner { /** @@ -12,7 +11,7 @@ class Joiner { protected $schemaMap; /** - * @var Joinable[][] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[][] */ protected $cache = []; @@ -24,7 +23,7 @@ class Joiner { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * The query object to do the joins on * @param string $joinPath * A path of aliases in dot notation, e.g. contact.phone @@ -32,7 +31,7 @@ class Joiner { * Can be LEFT or INNER * * @throws \Exception - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * The path used to make the join */ public function join(Api4SelectQuery $query, $joinPath, $side = 'LEFT') { @@ -54,7 +53,7 @@ class Joiner { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param $joinPath * * @return bool diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php index 3989afeb4e..ed3743d9e5 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php @@ -3,7 +3,6 @@ namespace Civi\Api4\Service\Schema; use Civi\Api4\Service\Schema\Joinable\BridgeJoinable; -use Civi\Api4\Service\Schema\Joinable\Joinable; class SchemaMap { @@ -18,7 +17,7 @@ class SchemaMap { * @param $baseTableName * @param $targetTableAlias * - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * Array of links to the target table, empty if no path found */ public function getPath($baseTableName, $targetTableAlias) { @@ -98,9 +97,9 @@ class SchemaMap { * The target joinable table alias * @param int $depth * The current level of recursion which reflects the number of joins needed - * @param Joinable[] $path + * @param \Civi\Api4\Service\Schema\Joinable\Joinable[] $path * (By-reference) The possible paths to the target table - * @param Joinable[] $currentPath + * @param \Civi\Api4\Service\Schema\Joinable\Joinable[] $currentPath * For internal use only to track the path to reach the target table */ private function findPaths(Table $table, $target, $depth, &$path, $currentPath = [] diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php index b578b73a44..e1e62a7156 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php @@ -9,12 +9,12 @@ use Civi\Api4\Service\Schema\Joinable\CustomGroupJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Civi\Api4\Service\Schema\Joinable\OptionValueJoinable; -use CRM_Core_DAO_AllCoreTables as TableHelper; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; use CRM_Utils_Array as UtilsArray; class SchemaMapBuilder { /** - * @var EventDispatcherInterface + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected $dispatcher; /** @@ -23,7 +23,7 @@ class SchemaMapBuilder { protected $apiEntities; /** - * @param EventDispatcherInterface $dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; @@ -50,7 +50,7 @@ class SchemaMapBuilder { */ private function loadTables(SchemaMap $map) { /** @var \CRM_Core_DAO $daoName */ - foreach (TableHelper::get() as $daoName => $data) { + foreach (AllCoreTables::get() as $daoName => $data) { $table = new Table($data['table']); foreach ($daoName::fields() as $field => $fieldData) { $this->addJoins($table, $field, $fieldData); @@ -74,7 +74,7 @@ class SchemaMapBuilder { // can there be multiple methods e.g. pseudoconstant and fkclass if ($fkClass) { - $tableName = TableHelper::getTableForClass($fkClass); + $tableName = AllCoreTables::getTableForClass($fkClass); $fkKey = UtilsArray::value('FKKeyColumn', $data, 'id'); $alias = str_replace('_id', '', $field); $joinable = new Joinable($tableName, $fkKey, $alias); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php index 1f464a45d2..a6e706bebb 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php @@ -12,7 +12,7 @@ class Table { protected $name; /** - * @var Joinable[] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[] * Array of links to other tables */ protected $tableLinks = []; @@ -43,14 +43,14 @@ class Table { } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] */ public function getTableLinks() { return $this->tableLinks; } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * Only those links that are not joining the table to itself */ public function getExternalLinks() { @@ -60,7 +60,7 @@ class Table { } /** - * @param Joinable $linkToRemove + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $linkToRemove */ public function removeLink(Joinable $linkToRemove) { foreach ($this->tableLinks as $index => $link) { @@ -72,7 +72,7 @@ class Table { /** * @param string $baseColumn - * @param Joinable $joinable + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $joinable * * @return $this */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php index 1db2941ebb..685a7c7df6 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php @@ -50,6 +50,16 @@ class FieldSpec { */ protected $dataType; + /** + * @var string + */ + protected $inputType; + + /** + * @var array + */ + protected $inputAttrs = []; + /** * @var string */ @@ -187,7 +197,7 @@ class FieldSpec { } /** - * @param bool $required + * @param bool $requiredIf * * @return $this */ @@ -233,9 +243,46 @@ class FieldSpec { /** * @param int|null $serialize + * @return $this */ public function setSerialize($serialize) { $this->serialize = $serialize; + + return $this; + } + + /** + * @return string + */ + public function getInputType() { + return $this->inputType; + } + + /** + * @param string $inputType + * @return $this + */ + public function setInputType($inputType) { + $this->inputType = $inputType; + + return $this; + } + + /** + * @return array + */ + public function getInputAttrs() { + return $this->inputAttrs; + } + + /** + * @param array $inputAttrs + * @return $this + */ + public function setInputAttrs($inputAttrs) { + $this->inputAttrs = $inputAttrs; + + return $this; } /** @@ -244,7 +291,7 @@ class FieldSpec { * @return array */ private function getValidDataTypes() { - $extraTypes = ['Boolean', 'Text', 'Float', 'Url']; + $extraTypes = ['Boolean', 'Text', 'Float', 'Url', 'Array']; $extraTypes = array_combine($extraTypes, $extraTypes); return array_merge(\CRM_Utils_Type::dataTypes(), $extraTypes); @@ -262,8 +309,8 @@ class FieldSpec { $fieldName = sprintf('custom_%d', $this->getCustomFieldId()); } - $dao = CoreUtil::getDAOFromApiName($this->getEntity()); - $options = $dao::buildOptions($fieldName); + $bao = CoreUtil::getBAOFromApiName($this->getEntity()); + $options = $bao::buildOptions($fieldName); if (!is_array($options) || !$options) { $options = FALSE; diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php new file mode 100644 index 0000000000..cbc126cb59 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class ACLCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('entity_table')->setDefaultValue('civicrm_acl_role'); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'ACL' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php index 660bfec9d7..e05b7d5925 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php @@ -2,10 +2,10 @@ namespace Civi\Api4\Service\Spec\Provider; -use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class ActionScheduleCreationSpecProvider implements SpecProviderInterface { +class ActionScheduleCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php index dc254342cb..52eb75a2a0 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php @@ -5,7 +5,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class ActivityCreationSpecProvider implements SpecProviderInterface { +class ActivityCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php index afba9c79d6..ecb6b271b9 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php @@ -2,14 +2,12 @@ namespace Civi\Api4\Service\Spec\Provider; -use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; - -class AddressCreationSpecProvider implements SpecProviderInterface { +class AddressCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_id')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php new file mode 100644 index 0000000000..db0f48f7d6 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class CampaignCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('title')->setRequired(TRUE); + $spec->getFieldByName('name')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Campaign' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php index 94c68d9d09..9f826280e7 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php @@ -4,14 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContactCreationSpecProvider implements SpecProviderInterface { +class ContactCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_type') - ->setRequired(TRUE) ->setDefaultValue('Individual'); $spec->getFieldByName('is_opt_out')->setRequired(FALSE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php index f55deb1c1e..88c115edf2 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php @@ -4,10 +4,10 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContactTypeCreationSpecProvider implements SpecProviderInterface { +class ContactTypeCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('label')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php index 14861871e1..42d2a7a5da 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContributionCreationSpecProvider implements SpecProviderInterface { +class ContributionCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php new file mode 100644 index 0000000000..4d3aba5799 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\FieldSpec; +use Civi\Api4\Service\Spec\RequestSpec; + +class CustomFieldCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $optionField = new FieldSpec('option_values', $spec->getEntity(), 'Array'); + $optionField->setTitle(ts('Option Values')); + $optionField->setDescription('Pass an array of options (value => label) to create this field\'s option values'); + $spec->addFieldSpec($optionField); + $spec->getFieldByName('data_type')->setDefaultValue('String')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'CustomField' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php index cd033754e9..aa3002d95c 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php @@ -4,12 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class CustomGroupCreationSpecProvider implements SpecProviderInterface { +class CustomGroupCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { - return $spec->getFieldByName('extends')->setRequired(TRUE); + $spec->getFieldByName('extends')->setRequired(TRUE); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php index cd82d438f1..97b58ee34a 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php @@ -5,7 +5,7 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class CustomValueSpecProvider implements SpecProviderInterface { +class CustomValueSpecProvider implements Generic\SpecProviderInterface { /** * @inheritDoc diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php new file mode 100644 index 0000000000..54ee12061d --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php @@ -0,0 +1,27 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class DefaultLocationTypeProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $locationField = $spec->getFieldByName('location_type_id')->setRequired(TRUE); + $defaultType = \CRM_Core_BAO_LocationType::getDefault(); + if ($defaultType) { + $locationField->setDefaultValue($defaultType->id); + } + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $action === 'create' && in_array($entity, ['Address', 'Email', 'IM', 'OpenID', 'Phone']); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php new file mode 100644 index 0000000000..890bd7e9d4 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class DomainCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name')->setRequired(TRUE); + $spec->getFieldByName('version')->setRequired(TRUE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Domain' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php index 136b0e5402..aa6db7c350 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class EmailCreationSpecProvider implements SpecProviderInterface { +class EmailCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php new file mode 100644 index 0000000000..47df3af9f4 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php @@ -0,0 +1,26 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class EntityTagCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('entity_table')->setRequired(FALSE)->setDefaultValue('civicrm_contact'); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return $entity === 'EntityTag' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php index 42b74a6f75..109a3a98d8 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php @@ -2,14 +2,25 @@ namespace Civi\Api4\Service\Spec\Provider; +use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class EventCreationSpecProvider implements SpecProviderInterface { +class EventCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { - $spec->getFieldByName('is_template')->setRequired(FALSE); + $spec->getFieldByName('event_type_id')->setRequiredIf('empty($values.template_id)'); + $spec->getFieldByName('title')->setRequiredIf('empty($values.is_template)'); + $spec->getFieldByName('start_date')->setRequiredIf('empty($values.is_template)'); + $spec->getFieldByName('template_title')->setRequiredIf('!empty($values.is_template)'); + + $template_id = new FieldSpec('template_id', 'Event', 'Integer'); + $template_id + ->setTitle('Template Id') + ->setDescription('Template on which to base this new event'); + $spec->addFieldSpec($template_id); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php similarity index 74% rename from civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php rename to civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php index 8be77e68be..4b7a9887c6 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php @@ -1,12 +1,13 @@ <?php -namespace Civi\Api4\Service\Spec\Provider; +namespace Civi\Api4\Service\Spec\Provider\Generic; use Civi\Api4\Service\Spec\RequestSpec; interface SpecProviderInterface { + /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec * * @return void */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php new file mode 100644 index 0000000000..5f67131bf3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php @@ -0,0 +1,33 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class GetActionDefaultsProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + // Exclude deleted records from api Get by default + $isDeletedField = $spec->getFieldByName('is_deleted'); + if ($isDeletedField) { + $isDeletedField->setDefaultValue('0'); + } + + // Exclude test records from api Get by default + $isTestField = $spec->getFieldByName('is_test'); + if ($isTestField) { + $isTestField->setDefaultValue('0'); + } + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $action === 'get'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php index 8af69a0a53..b549fa05c9 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class GroupCreationSpecProvider implements SpecProviderInterface { +class GroupCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php new file mode 100644 index 0000000000..2139c5e4f3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class MappingCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * This function runs for both Mapping and MappingField entities + * + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name')->setRequired(TRUE); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return strpos($entity, 'Mapping') === 0 && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php new file mode 100644 index 0000000000..1a9188dc8d --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php @@ -0,0 +1,25 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class NavigationSpecProvider implements Generic\SpecProviderInterface { + + /** + * This runs for both create and get actions + * + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('domain_id')->setRequired(FALSE)->setDefaultValue('current_domain'); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Navigation' && in_array($action, ['create', 'get']); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php index f12e592cf8..20592543eb 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php @@ -4,11 +4,10 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; - -class NoteCreationSpecProvider implements SpecProviderInterface { +class NoteCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('note')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php index 4ea634c189..8e996ecb1a 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class OptionValueCreationSpecProvider implements SpecProviderInterface { +class OptionValueCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php index bb757d4390..a69177278e 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php @@ -4,13 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class PhoneCreationSpecProvider implements SpecProviderInterface { +class PhoneCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_id')->setRequired(TRUE); - $spec->getFieldByName('location_type_id')->setRequired(TRUE); $spec->getFieldByName('phone')->setRequired(TRUE); } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php new file mode 100644 index 0000000000..b2d60a5915 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class RelationshipTypeCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name_a_b')->setRequired(TRUE); + $spec->getFieldByName('name_b_a')->setRequired(TRUE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'RelationshipType' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php new file mode 100644 index 0000000000..66fa7ad820 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class StatusPreferenceCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('domain_id')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'StatusPreference' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php new file mode 100644 index 0000000000..f4fe05af0f --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php @@ -0,0 +1,26 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class TagCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('used_for')->setDefaultValue('civicrm_contact'); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return $entity === 'Tag' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php new file mode 100644 index 0000000000..e7cf393cbb --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class UFFieldCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('label')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'UFField' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php similarity index 70% rename from civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php rename to civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php index 7d5fc2707f..06b9bb25cc 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class NavigationCreationSpecProvider implements SpecProviderInterface { +class UFMatchCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ @@ -16,7 +17,7 @@ class NavigationCreationSpecProvider implements SpecProviderInterface { * @inheritDoc */ public function applies($entity, $action) { - return $entity === 'Navigation' && $action === 'create'; + return $entity === 'UFMatch' && $action === 'create'; } } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php index c8e4d3da4d..0e55012d73 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php @@ -3,24 +3,24 @@ namespace Civi\Api4\Service\Spec; use CRM_Utils_Array as ArrayHelper; -use CRM_Core_DAO_AllCoreTables as TableHelper; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; class SpecFormatter { + /** * @param FieldSpec[] $fields - * @param array $return * @param bool $includeFieldOptions * * @return array */ - public static function specToArray($fields, $return = [], $includeFieldOptions = FALSE) { + public static function specToArray($fields, $includeFieldOptions = FALSE) { $fieldArray = []; foreach ($fields as $field) { - if ($includeFieldOptions || in_array('options', $return)) { + if ($includeFieldOptions) { $field->getOptions(); } - $fieldArray[$field->getName()] = $field->toArray($return); + $fieldArray[$field->getName()] = $field->toArray(); } return $fieldArray; @@ -63,11 +63,12 @@ class SpecFormatter { $field->setDefaultValue(ArrayHelper::value('default', $data)); $field->setDescription(ArrayHelper::value('description', $data)); + self::setInputTypeAndAttrs($field, $data, $dataTypeName); $fkAPIName = ArrayHelper::value('FKApiName', $data); $fkClassName = ArrayHelper::value('FKClassName', $data); if ($fkAPIName || $fkClassName) { - $field->setFkEntity($fkAPIName ?: TableHelper::getBriefName($fkClassName)); + $field->setFkEntity($fkAPIName ?: AllCoreTables::getBriefName($fkClassName)); } return $field; @@ -89,7 +90,7 @@ class SpecFormatter { if (in_array($field['data_type'], ['ContactReference', 'Date'])) { return FALSE; } - if (strpos($field['html_type'], 'Select')) { + if (strpos($field['html_type'], 'Select') !== FALSE) { return TRUE; } return !empty($field['option_group_id']); @@ -105,7 +106,7 @@ class SpecFormatter { */ private static function getDataType(array $data) { if (isset($data['data_type'])) { - return $data['data_type']; + return !empty($data['time_format']) ? 'Timestamp' : $data['data_type']; } $dataTypeInt = ArrayHelper::value('type', $data); @@ -114,4 +115,102 @@ class SpecFormatter { return $dataTypeName; } + /** + * @param \Civi\Api4\Service\Spec\FieldSpec $fieldSpec + * @param array $data + * @param string $dataTypeName + */ + public static function setInputTypeAndAttrs(FieldSpec &$fieldSpec, $data, $dataTypeName) { + $inputType = isset($data['html']['type']) ? $data['html']['type'] : ArrayHelper::value('html_type', $data); + $inputAttrs = ArrayHelper::value('html', $data, []); + unset($inputAttrs['type']); + + if (!$inputType) { + // If no html type is set, guess + switch ($dataTypeName) { + case 'Int': + $inputType = 'Number'; + $inputAttrs['min'] = 0; + break; + + case 'Text': + $inputType = ArrayHelper::value('type', $data) === \CRM_Utils_Type::T_LONGTEXT ? 'TextArea' : 'Text'; + break; + + case 'Timestamp': + $inputType = 'Date'; + $inputAttrs['time'] = TRUE; + break; + + case 'Date': + $inputAttrs['time'] = FALSE; + break; + + case 'Time': + $inputType = 'Date'; + $inputAttrs['time'] = TRUE; + $inputAttrs['date'] = FALSE; + break; + + default: + $map = [ + 'Email' => 'Email', + 'Boolean' => 'Checkbox', + ]; + $inputType = ArrayHelper::value($dataTypeName, $map, 'Text'); + } + } + if (strstr($inputType, 'Multi-Select') || ($inputType == 'Select' && !empty($data['serialize']))) { + $inputAttrs['multiple'] = TRUE; + $inputType = 'Select'; + } + $map = [ + 'Select State/Province' => 'Select', + 'Select Country' => 'Select', + 'Select Date' => 'Date', + 'Link' => 'Url', + ]; + $inputType = ArrayHelper::value($inputType, $map, $inputType); + if ($inputType == 'Date' && !empty($inputAttrs['formatType'])) { + self::setLegacyDateFormat($inputAttrs); + } + // Date/time settings from custom fields + if ($inputType == 'Date' && !empty($data['custom_group_id'])) { + $inputAttrs['time'] = empty($data['time_format']) ? FALSE : ($data['time_format'] == 1 ? 12 : 24); + $inputAttrs['date'] = $data['date_format']; + $inputAttrs['start_date_years'] = (int) $data['start_date_years']; + $inputAttrs['end_date_years'] = (int) $data['end_date_years']; + } + if ($inputType == 'Text' && !empty($data['maxlength'])) { + $inputAttrs['maxlength'] = (int) $data['maxlength']; + } + if ($inputType == 'TextArea') { + foreach (['rows', 'cols', 'note_rows', 'note_cols'] as $prop) { + if (!empty($data[$prop])) { + $inputAttrs[str_replace('note_', '', $prop)] = (int) $data[$prop]; + } + } + } + $fieldSpec + ->setInputType($inputType) + ->setInputAttrs($inputAttrs); + } + + /** + * @param array $inputAttrs + */ + private static function setLegacyDateFormat(&$inputAttrs) { + if (empty(\Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']])) { + \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']] = []; + $params = ['name' => $inputAttrs['formatType']]; + \CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_PreferencesDate', $params, \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']]); + } + $dateFormat = \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']]; + unset($inputAttrs['formatType']); + $inputAttrs['time'] = !empty($dateFormat['time_format']); + $inputAttrs['date'] = TRUE; + $inputAttrs['start_date_years'] = (int) $dateFormat['start']; + $inputAttrs['end_date_years'] = (int) $dateFormat['end']; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php index b1c83c8959..ca5da91a59 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php @@ -3,13 +3,13 @@ namespace Civi\Api4\Service\Spec; use Civi\Api4\CustomField; -use Civi\Api4\Service\Spec\Provider\SpecProviderInterface; +use Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface; use Civi\Api4\Utils\CoreUtil; class SpecGatherer { /** - * @var SpecProviderInterface[] + * @var \Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface[] */ protected $specProviders = []; @@ -46,6 +46,13 @@ class SpecGatherer { $this->getCustomGroupFields(substr($entity, 7), $specification); } + // Default value only makes sense for create actions + if ($action != 'create') { + foreach ($specification->getFields() as $field) { + $field->setDefaultValue(NULL); + } + } + foreach ($this->specProviders as $provider) { if ($provider->applies($entity, $action)) { $provider->modifySpec($specification); @@ -56,7 +63,7 @@ class SpecGatherer { } /** - * @param SpecProviderInterface $provider + * @param \Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface $provider */ public function addSpecProvider(SpecProviderInterface $provider) { $this->specProviders[] = $provider; @@ -64,7 +71,8 @@ class SpecGatherer { /** * @param string $entity - * @param RequestSpec $specification + * @param string $action + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function addDAOFields($entity, $action, RequestSpec $specification) { $DAOFields = $this->getDAOFields($entity); @@ -86,13 +94,14 @@ class SpecGatherer { /** * @param string $entity - * @param RequestSpec $specification + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function addCustomFields($entity, RequestSpec $specification) { $extends = ($entity == 'Contact') ? ['Contact', 'Individual', 'Organization', 'Household'] : [$entity]; $customFields = CustomField::get() + ->setCheckPermissions(FALSE) ->addWhere('custom_group.extends', 'IN', $extends) - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value']) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->execute(); foreach ($customFields as $fieldArray) { @@ -103,12 +112,12 @@ class SpecGatherer { /** * @param string $customGroup - * @param RequestSpec $specification + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function getCustomGroupFields($customGroup, RequestSpec $specification) { $customFields = CustomField::get() ->addWhere('custom_group.name', '=', $customGroup) - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'custom_group.table_name', 'column_name']) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'custom_group.table_name', 'column_name', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->execute(); foreach ($customFields as $fieldArray) { @@ -123,9 +132,9 @@ class SpecGatherer { * @return array */ private function getDAOFields($entityName) { - $dao = CoreUtil::getDAOFromApiName($entityName); + $bao = CoreUtil::getBAOFromApiName($entityName); - return $dao::fields(); + return $bao::fields(); } } diff --git a/civicrm/ext/api4/Civi/Api4/Setting.php b/civicrm/ext/api4/Civi/Api4/Setting.php new file mode 100644 index 0000000000..abd76793cd --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Setting.php @@ -0,0 +1,30 @@ +<?php + +namespace Civi\Api4; + +/** + * CiviCRM settings api. + * + * Used to read/write persistent setting data from CiviCRM. + * + * @package Civi\Api4 + */ +class Setting extends Generic\AbstractEntity { + + public static function get() { + return new Action\Setting\Get(__CLASS__, __FUNCTION__); + } + + public static function set() { + return new Action\Setting\Set(__CLASS__, __FUNCTION__); + } + + public static function revert() { + return new Action\Setting\Revert(__CLASS__, __FUNCTION__); + } + + public static function getFields() { + return new Action\Setting\GetFields(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/StatusPreference.php b/civicrm/ext/api4/Civi/Api4/StatusPreference.php new file mode 100644 index 0000000000..c89ff979b2 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/StatusPreference.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * For setting "hush" preferences for system check alerts. + * + * @package Civi\Api4 + */ +class StatusPreference extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/System.php b/civicrm/ext/api4/Civi/Api4/System.php new file mode 100644 index 0000000000..fbbc37acbe --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/System.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4; + +use Civi\Api4\Generic\BasicGetFieldsAction; + +/** + * A collection of system maintenance/diagnostic utilities. + * + * @package Civi\Api4 + */ +class System extends Generic\AbstractEntity { + + public static function flush() { + return new Action\System\Flush(__CLASS__, __FUNCTION__); + } + + public static function check() { + return new Action\System\Check(__CLASS__, __FUNCTION__); + } + + public static function getFields() { + return new BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { + return []; + }); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Tag.php b/civicrm/ext/api4/Civi/Api4/Tag.php new file mode 100644 index 0000000000..a56679df43 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Tag.php @@ -0,0 +1,15 @@ +<?php + +namespace Civi\Api4; + +/** + * Tag entity. + * + * Tags in CiviCRM are used for Contacts, Activities, Cases & Attachments. + * They are connected to those entities via the EntityTag table. + * + * @package Civi\Api4 + */ +class Tag extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/UFField.php b/civicrm/ext/api4/Civi/Api4/UFField.php new file mode 100644 index 0000000000..736554ca8e --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/UFField.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * UFField entity - aka profile fields. + * + * @package Civi\Api4 + */ +class UFField extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/UFMatch.php b/civicrm/ext/api4/Civi/Api4/UFMatch.php new file mode 100644 index 0000000000..0840c4423e --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/UFMatch.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * UFMatch entity - links civicrm contacts with users created externally + * + * @package Civi\Api4 + */ +class UFMatch extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php index 54e3944b00..301e3f67c6 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php @@ -5,6 +5,7 @@ namespace Civi\Api4\Utils; use CRM_Utils_Array as UtilsArray; class ArrayInsertionUtil { + /** * If the values to be inserted contain a key _parent_id they will only be * inserted if the parent node ID matches their ID diff --git a/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php index b43e62ca26..b4ed48e82c 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php @@ -3,6 +3,7 @@ namespace Civi\Api4\Utils; use Civi\Api4\CustomGroup; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; require_once 'api/v3/utils.php'; @@ -14,14 +15,14 @@ class CoreUtil { * @param $entityName * * @return \CRM_Core_DAO|string - * The DAO name for use in static calls. Return doc block is hacked to allow + * The BAO name for use in static calls. Return doc block is hacked to allow * auto-completion of static methods */ - public static function getDAOFromApiName($entityName) { + public static function getBAOFromApiName($entityName) { if ($entityName === 'CustomValue' || strpos($entityName, 'Custom_') === 0) { return 'CRM_Contact_BAO_Contact'; } - return \_civicrm_api3_get_DAO($entityName); + return \_civicrm_api3_get_BAO($entityName); } /** @@ -39,4 +40,14 @@ class CoreUtil { ->first()['table_name']; } + /** + * Given a sql table name, return the name of the api entity. + * + * @param $tableName + * @return string + */ + public static function getApiNameFromTableName($tableName) { + return AllCoreTables::getBriefName(AllCoreTables::getClassForTable($tableName)); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php index 3a7cdae5ac..2070a22125 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php @@ -46,16 +46,6 @@ class FormattingUtil { $params[$name] = 'null'; } - if (strstr($entity, 'Custom_')) { - if ($name == 'entity_id') { - $params['entityID'] = $params['entity_id']; - unset($params['entity_id']); - } - elseif (!empty($field['custom_field_id'])) { - $params['custom_' . $field['custom_field_id']] = $params[$name]; - unset($params[$name]); - } - } } } diff --git a/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php b/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php index 76662647da..535f9523c5 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php @@ -31,6 +31,7 @@ namespace Civi\Api4\Utils; * Just another place to put static functions... */ class ReflectionUtils { + /** * @param \Reflector|\ReflectionClass $reflection * @param string $type @@ -58,7 +59,8 @@ class ReflectionUtils { $newReflection = $reflection->getParentClass(); } } - catch (\ReflectionException $e) {} + catch (\ReflectionException $e) { + } if ($newReflection) { // Mix in $additionalDocs = self::getCodeDocs($newReflection, $type); @@ -116,4 +118,23 @@ class ReflectionUtils { return $info; } + /** + * List all traits used by a class and its parents. + * + * @param object|string $class + * @return array + */ + public static function getTraits($class) { + $traits = []; + // Get traits of this class + parent classes + do { + $traits = array_merge(class_uses($class), $traits); + } while ($class = get_parent_class($class)); + // Get traits of traits + foreach ($traits as $trait => $same) { + $traits = array_merge(class_uses($trait), $traits); + } + return $traits; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/services.xml b/civicrm/ext/api4/Civi/Api4/services.xml new file mode 100644 index 0000000000..3d8a2fcab1 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/services.xml @@ -0,0 +1,26 @@ +<container xmlns="http://symfony.com/schema/dic/services" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + <services> + + <service id="spec_gatherer" class="Civi\Api4\Service\Spec\SpecGatherer"/> + + <service id="schema_map_builder" class="Civi\Api4\Service\Schema\SchemaMapBuilder" public="false"> + <argument type="service" id="dispatcher" /> + </service> + + <service id="schema_map" class="Civi\Api4\Service\Schema\SchemaMap"> + <factory service="schema_map_builder" method="build"/> + </service> + + <service id="joiner" class="Civi\Api4\Service\Schema\Joiner"> + <argument type="service" id="schema_map"/> + </service> + + <service id="action_object_provider" class="Civi\Api4\Provider\ActionObjectProvider"> + <tag name="event_subscriber"/> + </service> + + </services> +</container> diff --git a/civicrm/ext/api4/ang/api4Explorer.ang.php b/civicrm/ext/api4/ang/api4Explorer.ang.php index 6583f2778e..e00ea0985c 100644 --- a/civicrm/ext/api4/ang/api4Explorer.ang.php +++ b/civicrm/ext/api4/ang/api4Explorer.ang.php @@ -14,5 +14,5 @@ return [ 'ang/api4Explorer', ], 'basePages' => [], - 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4'], + 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4', 'ngSanitize'], ]; diff --git a/civicrm/ext/api4/ang/api4Explorer/Explorer.html b/civicrm/ext/api4/ang/api4Explorer/Explorer.html index 6cea301fce..bbfd35b959 100644 --- a/civicrm/ext/api4/ang/api4Explorer/Explorer.html +++ b/civicrm/ext/api4/ang/api4Explorer/Explorer.html @@ -26,12 +26,26 @@ </div> <div class="panel-body"> <div class="api4-input form-inline"> - <div class="form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-class="{'api4-option-selected': params[name]}" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool'"> + <div class="form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-class="{'api4-option-selected': params[name]}" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default !== null"> <input type="checkbox" id="api4-param-{{ name }}" ng-model="params[name]"/> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> </div> + <div class="form-control" ng-mouseenter="help('selectRowCount', availableParams.select)" ng-mouseleave="help()" ng-class="{'api4-option-selected': isSelectRowCount()}" ng-if="availableParams.select"> + <input type="checkbox" id="api4-param-selectRowCount" ng-checked="isSelectRowCount()" ng-click="selectRowCount()" /> + <label for="api4-param-selectRowCount">SelectRowCount</label> + </div> + </div> + <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default === null"> + <label>{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> + <label class="radio-inline"> + <input type="radio" ng-model="params[name]" ng-value="true" />true + </label> + <label class="radio-inline"> + <input type="radio" ng-model="params[name]" ng-value="false" />false + </label> + <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="params[name] !== null"><i class="crm-i fa-times"></i></a> </div> - <div class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select"> + <div class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select && !isSelectRowCount()"> <label for="api4-param-select">select<span class="crm-marker" ng-if="availableParams.select.required"> *</span></label> <input class="collapsible-optgroups form-control" ng-list crm-ui-select="{data: fieldsAndJoins, multiple: true}" id="api4-param-select" ng-model="params.select" style="width: 85%;"/> </div> @@ -45,10 +59,11 @@ </div> <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'string' || param.type[0] === 'int')"> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> - <input class="form-control" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"/> + <input class="form-control" ng-if="!param.options" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"/> + <select class="form-control" ng-if="param.options" ng-options="o for o in param.options" id="api4-param-{{ name }}" ng-model="params[name]"></select> <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="!!params[name]"><i class="crm-i fa-times"></i></a> </div> - <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'array'"> + <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'array' || param.type[0] === 'mixed')"> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> <textarea class="form-control" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"> </textarea> @@ -57,7 +72,7 @@ </fieldset> <fieldset ng-if="availableParams.values" ng-mouseenter="help('values', availableParams.values)" ng-mouseleave="help()"> <legend>values<span class="crm-marker" ng-if="availableParams.values.required"> *</span></legend> - <div class="api4-input form-inline" ng-repeat="clause in params.values"> + <div class="api4-input form-inline" ng-repeat="clause in params.values" ng-mouseenter="help('value: ' + clause[0], fieldHelp(clause[0]))" ng-mouseleave="help('values', availableParams.values)"> <input class="collapsible-optgroups form-control" ng-model="clause[0]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: valuesFields, allowClear: true, placeholder: 'Field'}" /> <input class="form-control" ng-model="clause[1]" api4-exp-value="{field: clause[0]}" /> </div> @@ -111,8 +126,8 @@ <div class="panel-body"> <table> <tr ng-repeat="(type, item) in code"> - <td>{{ type }}</td> - <td><pre>{{ item }}</pre></td> + <td>{{ codeLabel[type] }}</td> + <td><pre class="prettyprint" ng-bind-html="item"></pre></td> </tr> </table> </div> @@ -128,7 +143,7 @@ </h3> </div> <div class="panel-body"> - <pre ng-repeat="code in result">{{ code }}</pre> + <pre class="prettyprint" ng-repeat="code in result" ng-bind-html="code"></pre> </div> </div> </div> diff --git a/civicrm/ext/api4/ang/api4Explorer/Explorer.js b/civicrm/ext/api4/ang/api4Explorer/Explorer.js index 103917939e..c7e08dd960 100644 --- a/civicrm/ext/api4/ang/api4Explorer/Explorer.js +++ b/civicrm/ext/api4/ang/api4Explorer/Explorer.js @@ -1,9 +1,9 @@ (function(angular, $, _, undefined) { - // Cache schema metadata - var schema = []; - // Cache fk schema data - var links = []; + // Schema metadata + var schema = CRM.vars.api4.schema; + // FK schema data + var links = CRM.vars.api4.links; // Cache list of entities var entities = []; // Cache list of actions @@ -20,7 +20,7 @@ }); }); - angular.module('api4Explorer').controller('Api4Explorer', function($scope, $routeParams, $location, $timeout, crmUiHelp, crmApi4) { + angular.module('api4Explorer').controller('Api4Explorer', function($scope, $routeParams, $location, $timeout, $http, crmUiHelp, crmApi4) { var ts = $scope.ts = CRM.ts('api4'); $scope.entities = entities; $scope.actions = actions; @@ -29,10 +29,7 @@ $scope.availableParams = {}; $scope.params = {}; $scope.index = ''; - var getMetaParams = schema.length ? {} : { - schema: ['Entity', 'get', {chain: {fields: ['$name', 'getFields']}}], - links: ['Entity', 'getLinks'] - }, + var getMetaParams = {}, objectParams = {orderBy: 'ASC', values: '', chain: ['Entity', '', '{}']}, helpTitle = '', helpContent = {}; @@ -43,11 +40,23 @@ $scope.status = 'default'; $scope.loading = false; $scope.controls = {}; - $scope.code = { - php: '', - javascript: '', - cli: '' + $scope.codeLabel = { + oop: ts('PHP (oop style)'), + php: ts('PHP (traditional)'), + js: ts('Javascript'), + cli: ts('Command Line') }; + $scope.code = codeDefaults(); + + function codeDefaults() { + return _.mapValues($scope.codeLabel, function(val, key) { + return key === 'oop' ? ts('Select an entity and action') : ''; + }); + } + + if (!entities.length) { + formatForSelect2(schema, entities, 'name', ['description']); + } $scope.$bindToRoute({ expr: 'index', @@ -129,6 +138,26 @@ } }; + $scope.fieldHelp = function(fieldName) { + var field = getField(fieldName, $scope.entity, $scope.action); + if (!field) { + return; + } + var info = { + description: field.description, + type: field.data_type + }; + if (field.default_value) { + info.default = field.default_value; + } + if (field.required_if) { + info.required_if = field.required_if; + } else if (field.required) { + info.required = 'true'; + } + return info; + }; + $scope.valuesFields = function() { var fields = _.cloneDeep($scope.fields); // Disable fields that are already in use @@ -153,6 +182,21 @@ return _.contains(specialParams, name); }; + $scope.selectRowCount = function() { + if ($scope.isSelectRowCount()) { + $scope.params.select = []; + } else { + $scope.params.select = ['row_count']; + if ($scope.params.limit == 25) { + $scope.params.limit = 0; + } + } + }; + + $scope.isSelectRowCount = function() { + return $scope.params && $scope.params.select && $scope.params.select.length === 1 && $scope.params.select[0] === 'row_count'; + }; + function getEntity(entityName) { return _.findWhere(schema, {name: entityName || $scope.entity}); } @@ -173,33 +217,24 @@ if (params[key]) { var newParam = {}; _.each(params[key], function(item) { - newParam[item[0]] = parseYaml(_.cloneDeep(item[1])); + var val = _.cloneDeep(item[1]); + // Remove blank items from "chain" array + if (_.isArray(val)) { + _.eachRight(item[1], function(v, k) { + if (v) { + return false; + } + val.length--; + }); + } + newParam[item[0]] = parseYaml(val); }); params[key] = newParam; } }); - if (params.where) { - formatWhereClause(params.where); - } return params; } - // Coerce value to an array when the operator is IN or NOT IN - // Note this has already been passed through parseYaml once - function formatWhereClause(where) { - _.each(where, function(clause) { - if (_.isArray(clause)) { - if (clause.length === 3) { - if (_.contains(['IN', 'NOT IN'], clause[1]) && (_.isNumber(clause[2]) || (_.isString(clause[2]) && clause[2].length))) { - clause[2] = parseYaml('[' + clause[2] + ']'); - } - } else { - formatWhereClause(clause); - } - } - }); - } - function parseYaml(input) { if (typeof input === 'undefined') { return undefined; @@ -211,7 +246,9 @@ return input; } try { - return input === '>' ? '>' : jsyaml.safeLoad(input); + var output = (input === '>') ? '>' : jsyaml.safeLoad(input); + // We don't want dates parsed to js objects + return _.isDate(output) ? input : output; } catch (e) { return input; } @@ -220,7 +257,9 @@ function selectAction() { $scope.action = $routeParams.api4action; $scope.fieldsAndJoins = []; - formatForSelect2(getEntity().actions, actions, 'name', ['description', 'params']); + if (!actions.length) { + formatForSelect2(getEntity().actions, actions, 'name', ['description', 'params']); + } if ($scope.action) { var actionInfo = _.findWhere(actions, {id: $scope.action}); $scope.fields = getFieldList(); @@ -313,11 +352,7 @@ } function writeCode() { - var code = { - php: ts('Select an entity and action'), - javascript: '', - cli: '' - }, + var code = codeDefaults(), entity = $scope.entity, action = $scope.action, params = getParams(), @@ -330,67 +365,89 @@ } var results = lcfirst(_.isNumber(index) ? result : pluralize(result)), paramCount = _.size(params), + isSelectRowCount = params.select && params.select.length === 1 && params.select[0] === 'row_count', i = 0; + if (isSelectRowCount) { + results = result + 'Count'; + } + // Write javascript - code.javascript = "CRM.api4('" + entity + "', '" + action + "', {"; + code.js = "CRM.api4('" + entity + "', '" + action + "', {"; _.each(params, function(param, key) { - code.javascript += "\n " + key + ': ' + stringify(param) + + code.js += "\n " + key + ': ' + stringify(param) + (++i < paramCount ? ',' : ''); if (key === 'checkPermissions') { - code.javascript += ' // IGNORED: permissions are always enforced from client-side requests'; + code.js += ' // IGNORED: permissions are always enforced from client-side requests'; } }); - code.javascript += "\n}"; + code.js += "\n}"; if (index || index === 0) { - code.javascript += ', ' + JSON.stringify(index); + code.js += ', ' + JSON.stringify(index); } - code.javascript += ").then(function(" + results + ") {\n // do something with " + results + " array\n}, function(failure) {\n // handle failure\n});"; + code.js += ").then(function(" + results + ") {\n // do something with " + results + " array\n}, function(failure) {\n // handle failure\n});"; // Write php code + code.php = '$' + results + " = civicrm_api4('" + entity + "', '" + action + "', ["; + _.each(params, function(param, key) { + code.php += "\n '" + key + "' => " + phpFormat(param, 4) + ','; + }); + code.php += "\n]"; + if (index || index === 0) { + code.php += ', ' + phpFormat(index); + } + code.php += ");"; + + // Write oop code if (entity.substr(0, 7) !== 'Custom_') { - code.php = '$' + results + " = \\Civi\\Api4\\" + entity + '::' + action + '()'; + code.oop = '$' + results + " = \\Civi\\Api4\\" + entity + '::' + action + '()'; } else { - code.php = '$' + results + " = \\Civi\\Api4\\CustomValue::" + action + "('" + entity.substr(7) + "')"; + code.oop = '$' + results + " = \\Civi\\Api4\\CustomValue::" + action + "('" + entity.substr(7) + "')"; } _.each(params, function(param, key) { var val = ''; if (typeof objectParams[key] !== 'undefined' && key !== 'chain') { _.each(param, function(item, index) { val = phpFormat(index) + ', ' + phpFormat(item, 4); - code.php += "\n ->add" + ucfirst(key).replace(/s$/, '') + '(' + val + ')'; + code.oop += "\n ->add" + ucfirst(key).replace(/s$/, '') + '(' + val + ')'; }); } else if (key === 'where') { _.each(param, function (clause) { if (clause[0] === 'AND' || clause[0] === 'OR' || clause[0] === 'NOT') { - code.php += "\n ->addClause(" + phpFormat(clause[0]) + ", " + phpFormat(clause[1]).slice(1, -1) + ')'; + code.oop += "\n ->addClause(" + phpFormat(clause[0]) + ", " + phpFormat(clause[1]).slice(1, -1) + ')'; } else { - code.php += "\n ->addWhere(" + phpFormat(clause).slice(1, -1) + ")"; + code.oop += "\n ->addWhere(" + phpFormat(clause).slice(1, -1) + ")"; } }); + } else if (key === 'select' && isSelectRowCount) { + code.oop += "\n ->selectRowCount()"; } else { - code.php += "\n ->set" + ucfirst(key) + '(' + phpFormat(param, 4) + ')'; + code.oop += "\n ->set" + ucfirst(key) + '(' + phpFormat(param, 4) + ')'; } }); - code.php += "\n ->execute()"; + code.oop += "\n ->execute()"; if (_.isNumber(index)) { - code.php += !index ? '\n ->first()' : (index === -1 ? '\n ->last()' : '\n ->itemAt(' + index + ')'); + code.oop += !index ? '\n ->first()' : (index === -1 ? '\n ->last()' : '\n ->itemAt(' + index + ')'); } else if (index) { - code.php += "\n ->indexBy('" + index + "')"; + code.oop += "\n ->indexBy('" + index + "')"; + } else if (isSelectRowCount) { + code.oop += "\n ->count()"; } - code.php += ";\n"; - if (!_.isNumber(index)) { - code.php += "foreach ($" + results + ' as $' + ((_.isString(index) && index) ? index + ' => $' : '') + result + ') {\n // do something\n}'; + code.oop += ";\n"; + if (!_.isNumber(index) && !isSelectRowCount) { + code.oop += "foreach ($" + results + ' as $' + ((_.isString(index) && index) ? index + ' => $' : '') + result + ') {\n // do something\n}'; } // Write cli code code.cli = 'cv api4 ' + entity + '.' + action + " '" + stringify(params) + "'"; } - $scope.code = code; + _.each(code, function(val, type) { + $scope.code[type] = prettyPrintOne(val); + }); } function isInt(value) { - if (_.isNumber(value)) { + if (_.isFinite(value)) { return true; } if (!_.isString(value)) { @@ -399,24 +456,30 @@ return /^-{0,1}\d+$/.test(value); } + function formatMeta(resp) { + var ret = ''; + _.each(resp, function(val, key) { + if (key !== 'values' && !_.isPlainObject(val) && !_.isFunction(val)) { + ret += (ret.length ? ', ' : '') + key + ': ' + (_.isArray(val) ? '[' + val + ']' : val); + } + }); + return prettyPrintOne(ret); + } + $scope.execute = function() { $scope.status = 'warning'; $scope.loading = true; - crmApi4($scope.entity, $scope.action, getParams(), $scope.index) - .then(function(data) { - var meta = {length: _.size(data)}, - result = JSON.stringify(data, null, 2); - if (_.isArray(data)) { - data.length = 0; - _.assign(meta, data); - } + $http.get(CRM.url('civicrm/ajax/api4/' + $scope.entity + '/' + $scope.action, { + params: angular.toJson(getParams()), + index: $scope.index + })).then(function(resp) { $scope.loading = false; $scope.status = 'success'; - $scope.result = [JSON.stringify(meta).replace('{', '').replace(/}$/, ''), result]; - }, function(data) { + $scope.result = [formatMeta(resp.data), prettyPrintOne(JSON.stringify(resp.data.values, null, 2), 'js', 1)]; + }, function(resp) { $scope.loading = false; $scope.status = 'danger'; - $scope.result = [JSON.stringify(data, null, 2)]; + $scope.result = [formatMeta(resp), prettyPrintOne(JSON.stringify(resp.data, null, 2))]; }); }; @@ -430,18 +493,19 @@ indent = (typeof indent === 'number') ? _.repeat(' ', indent) : (indent || ''); var ret = '', baseLine = indent ? indent.slice(0, -2) : '', - newLine = indent ? '\n' : ''; + newLine = indent ? '\n' : '', + trailingComma = indent ? ',' : ''; if ($.isPlainObject(val)) { $.each(val, function(k, v) { ret += (ret ? ', ' : '') + newLine + indent + "'" + k + "' => " + phpFormat(v); }); - return '[' + ret + newLine + baseLine + ']'; + return '[' + ret + trailingComma + newLine + baseLine + ']'; } if ($.isArray(val)) { $.each(val, function(k, v) { ret += (ret ? ', ' : '') + newLine + indent + phpFormat(v); }); - return '[' + ret + newLine + baseLine + ']'; + return '[' + ret + trailingComma + newLine + baseLine + ']'; } if (_.isString(val) && !_.contains(val, "'")) { return "'" + val + "'"; @@ -452,17 +516,6 @@ function fetchMeta() { crmApi4(getMetaParams) .then(function(data) { - if (data.schema) { - schema = data.schema; - entities.length = 0; - formatForSelect2(schema, entities, 'name', ['description']); - if ($scope.entity && !$scope.action) { - showEntityHelp($scope.entity); - } - } - if (data.links) { - links = data.links; - } if (data.actions) { getEntity().actions = data.actions; selectAction(); @@ -483,20 +536,14 @@ if (!$scope.entity) { $scope.helpTitle = helpTitle = ts('Help'); $scope.helpContent = helpContent = {description: ts('Welcome to the api explorer.'), comment: ts('Select an entity to begin.')}; - if (getMetaParams.schema) { - fetchMeta(); - } - } else if (!actions.length && (!schema.length || !getEntity().actions)) { - if (getMetaParams.schema) { - entities.push({id: $scope.entity, text: $scope.entity}); - } + } else if (!actions.length && !getEntity().actions) { getMetaParams.actions = [$scope.entity, 'getActions', {chain: {fields: [$scope.entity, 'getFields', {action: '$name'}]}}]; fetchMeta(); } else { selectAction(); } - if ($scope.entity && schema.length) { + if ($scope.entity) { showEntityHelp($scope.entity); } @@ -591,28 +638,12 @@ scope: { data: '=api4ExpValue' }, - link: function (scope, element, attrs) { + require: 'ngModel', + link: function (scope, element, attrs, ctrl) { var ts = scope.ts = CRM.ts('api4'), - entity = $routeParams.api4entity; - - function getField(fieldName) { - var fieldNames = fieldName.split('.'); - return get(entity, fieldNames); - - function get(entity, fieldNames) { - if (fieldNames.length === 1) { - return _.findWhere(entityFields(entity), {name: fieldNames[0]}); - } - var comboName = _.findWhere(entityFields(entity), {name: fieldNames[0] + '.' + fieldNames[1]}); - if (comboName) { - return comboName; - } - var linkName = fieldNames.shift(), - entityLinks = _.findWhere(links, {entity: entity}).links, - newEntity = _.findWhere(entityLinks, {alias: linkName}).entity; - return get(newEntity, fieldNames); - } - } + multi = _.includes(['IN', 'NOT IN'], scope.data.op), + entity = $routeParams.api4entity, + action = $routeParams.api4action; function destroyWidget() { var $el = $(element); @@ -627,22 +658,26 @@ function makeWidget(field, op) { var $el = $(element), - dataType = field.data_type, - multi = _.includes(['IN', 'NOT IN'], op); + inputType = field.input_type; + dataType = field.data_type; + if (!op) { + op = field.serialize || dataType === 'Array' ? 'IN' : '='; + } + multi = _.includes(['IN', 'NOT IN'], op); if (op === 'IS NULL' || op === 'IS NOT NULL') { $el.hide(); return; } - if (dataType === 'Timestamp' || dataType === 'Date') { + if (inputType === 'Date') { if (_.includes(['=', '!=', '<>', '<', '>=', '<', '<='], op)) { - $el.crmDatepicker({time: dataType === 'Timestamp'}); + $el.crmDatepicker({time: (field.input_attrs && field.input_attrs.time) || false}); } - } else if (_.includes(['=', '!=', '<>', 'IN', 'NOT IN'], op)) { + } else if (_.includes(['=', '!=', '<>', 'IN', 'NOT IN'], op) && (field.fk_entity || field.options || dataType === 'Boolean')) { if (field.fk_entity) { $el.crmEntityRef({entity: field.fk_entity, select:{multiple: multi}}); } else if (field.options) { $el.addClass('loading').attr('placeholder', ts('- select -')).crmSelect2({multiple: multi, data: [{id: '', text: ''}]}); - loadFieldOptions(field.entity).then(function(data) { + loadFieldOptions(field.entity || entity).then(function(data) { var options = []; _.each(_.findWhere(data, {name: field.name}).options, function(val, key) { options.push({id: key, text: val}); @@ -655,11 +690,12 @@ {id: '0', text: ts('No')} ]}); } + } else if (dataType === 'Integer') { + $el.attr('type', 'number'); } } function loadFieldOptions(entity) { - var action = $routeParams.api4action; if (!fieldOptions[entity + action]) { fieldOptions[entity + action] = crmApi4(entity, 'getFields', { loadOptions: true, @@ -671,11 +707,42 @@ return fieldOptions[entity + action]; } + // Copied from ng-list but applied conditionally if field is multi-valued + var parseList = function(viewValue) { + // If the viewValue is invalid (say required but empty) it will be `undefined` + if (_.isUndefined(viewValue)) return; + + if (!multi) { + return viewValue; + } + + var list = []; + + if (viewValue) { + _.each(viewValue.split(','), function(value) { + if (value) list.push(_.trim(value)); + }); + } + + return list; + }; + + // Copied from ng-list + ctrl.$parsers.push(parseList); + ctrl.$formatters.push(function(value) { + return _.isArray(value) ? value.join(', ') : value; + }); + + // Copied from ng-list + ctrl.$isEmpty = function(value) { + return !value || !value.length; + }; + scope.$watchCollection('data', function(data) { destroyWidget(); - var field = getField(data.field); + var field = getField(data.field, entity, action); if (field) { - makeWidget(field, data.op || '='); + makeWidget(field, data.op); } }); } @@ -749,6 +816,9 @@ } else if (link && _.contains(['create'], newAction)) { scope.chain[1][2] = '{values: {' + link[0] + ': ' + link[1] + '}}'; + } + else if (link && _.contains(['save'], newAction)) { + scope.chain[1][2] = '{records: [{' + link[0] + ': ' + link[1] + '}]}'; } else { scope.chain[1][2] = '{}'; } @@ -765,8 +835,31 @@ return _.findWhere(schema, {name: entityName}); } - function entityFields(entityName) { - return _.result(getEntity(entityName), 'fields'); + function entityFields(entityName, action) { + var entity = getEntity(entityName); + if (entity && action && entity.actions) { + return _.findWhere(entity.actions, {name: action}).fields; + } + return _.result(entity, 'fields'); + } + + function getField(fieldName, entity, action) { + var fieldNames = fieldName.split('.'); + return get(entity, fieldNames); + + function get(entity, fieldNames) { + if (fieldNames.length === 1) { + return _.findWhere(entityFields(entity, action), {name: fieldNames[0]}); + } + var comboName = _.findWhere(entityFields(entity, action), {name: fieldNames[0] + '.' + fieldNames[1]}); + if (comboName) { + return comboName; + } + var linkName = fieldNames.shift(), + entityLinks = _.findWhere(links, {entity: entity}).links, + newEntity = _.findWhere(entityLinks, {alias: linkName}).entity; + return get(newEntity, fieldNames); + } } // Collapsible optgroups for select2 diff --git a/civicrm/ext/api4/api4.php b/civicrm/ext/api4/api4.php index 7d10d492be..d47872d0e5 100644 --- a/civicrm/ext/api4/api4.php +++ b/civicrm/ext/api4/api4.php @@ -3,89 +3,57 @@ require_once 'api4.civix.php'; require_once 'api/Exception.php'; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\Config\FileLocator; - if (!is_callable('civicrm_api4')) { -/** - * Procedural wrapper for the OO api version 4. - * - * @param string $entity - * @param string $action - * @param array $params - * @param string|int $index - * If $index is a string, the results array will be indexed by that key. - * If $index is an integer, only the result at that index will be returned. - * - * @return \Civi\Api4\Generic\Result - * @throws \API_Exception - * @throws \Civi\API\Exception\NotImplementedException - */ -function civicrm_api4($entity, $action, $params = [], $index = NULL) { - $apiCall = \Civi\Api4\Utils\ActionUtil::getAction($entity, $action); - foreach ($params as $name => $param) { - $setter = 'set' . ucfirst($name); - $apiCall->$setter($param); - } - $result = $apiCall->execute(); - - // Index results by key - if ($index && is_string($index) && !CRM_Utils_Rule::integer($index)) { - $result->indexBy($index); - } - // Return result at index - if (CRM_Utils_Rule::integer($index)) { - $item = $result->itemAt($index); - if (is_null($item)) { - throw new \API_Exception("Index $index not found in api results"); + /** + * Procedural wrapper for the OO api version 4. + * + * @param string $entity + * @param string $action + * @param array $params + * @param string|int $index + * If $index is a string, the results array will be indexed by that key. + * If $index is an integer, only the result at that index will be returned. + * + * @return \Civi\Api4\Generic\Result + * @throws \API_Exception + * @throws \Civi\API\Exception\NotImplementedException + */ + function civicrm_api4($entity, $action, $params = [], $index = NULL) { + $apiCall = \Civi\Api4\Utils\ActionUtil::getAction($entity, $action); + foreach ($params as $name => $param) { + $setter = 'set' . ucfirst($name); + $apiCall->$setter($param); } - $result->exchangeArray($item); - - } - return $result; -} + $result = $apiCall->execute(); -/** - * @param ContainerBuilder $container - */ -function api4_civicrm_container($container) { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__)); - $loader->load('services.xml'); - - $container->getDefinition('civi_api_kernel')->addMethodCall( - 'registerApiProvider', - [new Reference('action_object_provider')] - ); - - // add event subscribers$container->get( - $dispatcher = $container->getDefinition('dispatcher'); - $subscribers = $container->findTaggedServiceIds('event_subscriber'); - - foreach (array_keys($subscribers) as $subscriber) { - $dispatcher->addMethodCall( - 'addSubscriber', - [new Reference($subscriber)] - ); - } - - // add spec providers - $providers = $container->findTaggedServiceIds('spec_provider'); - $gatherer = $container->getDefinition('spec_gatherer'); + // Index results by key + if ($index && is_string($index) && !CRM_Utils_Rule::integer($index)) { + $result->indexBy($index); + } + // Return result at index + if (CRM_Utils_Rule::integer($index)) { + $item = $result->itemAt($index); + if (is_null($item)) { + throw new \API_Exception("Index $index not found in api results"); + } + // Attempt to return a Result object if item is array, otherwise just return the item + if (!is_array($item)) { + return $item; + } + $result->exchangeArray($item); - foreach (array_keys($providers) as $provider) { - $gatherer->addMethodCall( - 'addSpecProvider', - [new Reference($provider)] - ); + } + return $result; } - if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests') { - $loader->load('tests/services.xml'); + /** + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + function api4_civicrm_container($container) { + require_once __DIR__ . '/CRM/Api4/Services.php'; + CRM_Api4_Services::hook_container($container); } -} } diff --git a/civicrm/ext/api4/css/explorer.css b/civicrm/ext/api4/css/explorer.css index 0a5f5d17bb..a5be9c8a06 100644 --- a/civicrm/ext/api4/css/explorer.css +++ b/civicrm/ext/api4/css/explorer.css @@ -41,6 +41,10 @@ margin-bottom: 10px; } +#bootstrap-theme.api4-explorer-page .api4-input.form-inline > label { + margin-right: 12px; +} + #bootstrap-theme.api4-explorer-page .explorer-help-panel .panel-body { word-break: break-word; } diff --git a/civicrm/ext/api4/info.xml b/civicrm/ext/api4/info.xml index c61180bdd4..59ffd4069c 100644 --- a/civicrm/ext/api4/info.xml +++ b/civicrm/ext/api4/info.xml @@ -13,11 +13,11 @@ <url desc="Documentation">https://wiki.civicrm.org/confluence/display/CRM/API+v4+Spec</url> <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> </urls> - <releaseDate>2019-09-16</releaseDate> - <version>4.4.3</version> + <releaseDate>2019-11-17</releaseDate> + <version>4.5.2</version> <develStage>stable</develStage> <compatibility> - <ver>5.13</ver> + <ver>5.18</ver> </compatibility> <comments>This extension does nothing on its own. Install it if other extensions require you to do so.</comments> <classloader> diff --git a/civicrm/ext/api4/services.xml b/civicrm/ext/api4/services.xml deleted file mode 100644 index 24d0b061a0..0000000000 --- a/civicrm/ext/api4/services.xml +++ /dev/null @@ -1,122 +0,0 @@ -<container xmlns="http://symfony.com/schema/dic/services" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - <services> - - <service id="spec_gatherer" class="Civi\Api4\Service\Spec\SpecGatherer"/> - - <service id="schema_map_builder" class="Civi\Api4\Service\Schema\SchemaMapBuilder" public="false"> - <argument type="service" id="dispatcher" /> - </service> - - <service id="schema_map" class="Civi\Api4\Service\Schema\SchemaMap"> - <factory service="schema_map_builder" method="build"/> - </service> - - <service id="joiner" class="Civi\Api4\Service\Schema\Joiner"> - <argument type="service" id="schema_map"/> - </service> - - <service id="action_object_provider" class="Civi\Api4\Provider\ActionObjectProvider"> - <tag name="event_subscriber"/> - </service> - - <service id="contact_creation.spec_provider" class="Civi\Api4\Service\Spec\Provider\ContactCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ContactTypeCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\AddressCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service id="option_value_creation.spec_provider" class="Civi\Api4\Service\Spec\Provider\OptionValueCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ActivityCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ActionScheduleCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\EmailCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\PhoneCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\EventCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\NoteCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ContributionCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\CustomGroupCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\GroupCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\NavigationCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service id="custom_group.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\CustomGroupPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="custom_field.pre_creation.subsciber" class="Civi\Api4\Event\Subscriber\CustomFieldPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="option_value.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\OptionValuePreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="activity.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\ActivityPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="contact.schema_map.subscriber" class="Civi\Api4\Event\Subscriber\ContactSchemaMapSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="activity.schema_map.subscriber" class="Civi\Api4\Event\Subscriber\ActivitySchemaMapSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.permission_check.subscriber" class="Civi\Api4\Event\Subscriber\PermissionCheckSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.required_fields.subscriber" class="Civi\Api4\Event\Subscriber\ValidateFieldsSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.post_select_query.subscriber" class="Civi\Api4\Event\Subscriber\PostSelectQuerySubscriber"> - <tag name="event_subscriber"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\CustomValueSpecProvider"> - <tag name="spec_provider"/> - </service> - - </services> -</container> diff --git a/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php b/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php deleted file mode 100644 index 71265598a6..0000000000 --- a/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -namespace Civi\Test\Api4\Action; - -use Civi\Api4\Contact; -use Civi\Test\Api4\UnitTestCase; - -/** - * Class UpdateContactTest - * @package Civi\Test\Api4\Action - * @group headless - */ -class UpdateContactTest extends UnitTestCase { - - public function testUpdateWillWork() { - $contactId = Contact::create() - ->setCheckPermissions(FALSE) - ->addValue('first_name', 'Johann') - ->addValue('last_name', 'Tester') - ->addValue('contact_type', 'Individual') - ->execute() - ->first()['id']; - - $contact = Contact::update() - ->setCheckPermissions(FALSE) - ->addWhere('id', '=', $contactId) - ->addValue('first_name', 'Testy') - ->execute() - ->first(); - $this->assertEquals('Testy', $contact['first_name']); - $this->assertEquals('Tester', $contact['last_name']); - } - -} diff --git a/civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php similarity index 74% rename from civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php index 41fe7281c1..fd4dc717c8 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php @@ -1,13 +1,13 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; -use Civi\Test\Api4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; abstract class BaseCustomValueTest extends UnitTestCase { - use \Civi\Test\Api4\Traits\OptionCleanupTrait { + use \api\v4\Traits\OptionCleanupTrait { setUp as setUpOptionCleanup; } use TableDropperTrait; diff --git a/civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php similarity index 62% rename from civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php index 2952338914..18e76e5589 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\MockBasicEntity; /** @@ -20,8 +20,8 @@ class BasicActionsTest extends UnitTestCase { $id2 = MockBasicEntity::create()->addValue('foo', 'two')->execute()->first()['id']; - $result = MockBasicEntity::get()->execute(); - $this->assertCount(2, $result); + $result = MockBasicEntity::get()->selectRowCount()->execute(); + $this->assertEquals(2, $result->count()); MockBasicEntity::update()->addWhere('id', '=', $id2)->addValue('foo', 'new')->execute(); @@ -29,9 +29,27 @@ class BasicActionsTest extends UnitTestCase { $this->assertCount(1, $result); $this->assertEquals('new', $result->first()['foo']); + $result = MockBasicEntity::save() + ->addRecord(['id' => $id1, 'foo' => 'one updated']) + ->addRecord(['id' => $id2]) + ->addRecord(['foo' => 'three']) + ->addDefault('color', 'pink') + ->setReload(TRUE) + ->execute() + ->indexBy('id'); + + $this->assertEquals('new', $result[$id2]['foo']); + $this->assertEquals('three', $result->last()['foo']); + $this->assertCount(3, $result); + foreach ($result as $item) { + $this->assertEquals('pink', $item['color']); + } + + $this->assertEquals('one updated', MockBasicEntity::get()->addWhere('id', '=', $id1)->execute()->first()['foo']); + MockBasicEntity::delete()->addWhere('id', '=', $id2); $result = MockBasicEntity::get()->execute(); - $this->assertEquals('one', $result->first()['foo']); + $this->assertEquals('one updated', $result->first()['foo']); } public function testReplace() { @@ -52,7 +70,7 @@ class BasicActionsTest extends UnitTestCase { $replacements = [ ['color' => 'red', 'id' => $objects[0]['id']], ['color' => 'not blue', 'id' => $objects[1]['id']], - ['color' => 'yellow'] + ['color' => 'yellow'], ]; MockBasicEntity::replace()->addWhere('group', '=', 'one')->setRecords($replacements)->execute(); @@ -115,40 +133,51 @@ class BasicActionsTest extends UnitTestCase { ->addWhere('color', 'NOT IN', ['yellow']) ->addWhere('color', 'IN', ['red', 'blue']) ->addWhere('color', '!=', 'green') - ->addWhere('group', '=', 'one'); - - $this->assertEquals(['red', 'blue'], $get->_itemsToGet('color')); - $this->assertEquals(['one'], $get->_itemsToGet('group')); + ->addWhere('group', '=', 'one') + ->addWhere('size', 'LIKE', 'big') + ->addWhere('shape', 'LIKE', '%a'); + + $itemsToGet = new \ReflectionMethod($get, '_itemsToGet'); + $itemsToGet->setAccessible(TRUE); + + $this->assertEquals(['red', 'blue'], $itemsToGet->invoke($get, 'color')); + $this->assertEquals(['one'], $itemsToGet->invoke($get, 'group')); + $this->assertEquals(['big'], $itemsToGet->invoke($get, 'size')); + $this->assertEmpty($itemsToGet->invoke($get, 'shape')); + $this->assertEmpty($itemsToGet->invoke($get, 'weight')); } public function testFieldsToGet() { $get = MockBasicEntity::get() ->addWhere('color', '!=', 'green'); + $isFieldSelected = new \ReflectionMethod($get, '_isFieldSelected'); + $isFieldSelected->setAccessible(TRUE); + // If no "select" is set, should always return true - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('shape')); - $this->assertTrue($get->_isFieldSelected('size')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'shape')); + $this->assertTrue($isFieldSelected->invoke($get, 'size')); // With a non-empty "select" fieldsToSelect() will return fields needed to evaluate each clause. $get->addSelect('id'); - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('id')); - $this->assertFalse($get->_isFieldSelected('shape')); - $this->assertFalse($get->_isFieldSelected('size')); - $this->assertFalse($get->_isFieldSelected('weight')); - $this->assertFalse($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'id')); + $this->assertFalse($isFieldSelected->invoke($get, 'shape')); + $this->assertFalse($isFieldSelected->invoke($get, 'size')); + $this->assertFalse($isFieldSelected->invoke($get, 'weight')); + $this->assertFalse($isFieldSelected->invoke($get, 'group')); $get->addClause('OR', ['shape', '=', 'round'], ['AND', [['size', '=', 'big'], ['weight', '!=', 'small']]]); - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('id')); - $this->assertTrue($get->_isFieldSelected('shape')); - $this->assertTrue($get->_isFieldSelected('size')); - $this->assertTrue($get->_isFieldSelected('weight')); - $this->assertFalse($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'id')); + $this->assertTrue($isFieldSelected->invoke($get, 'shape')); + $this->assertTrue($isFieldSelected->invoke($get, 'size')); + $this->assertTrue($isFieldSelected->invoke($get, 'weight')); + $this->assertFalse($isFieldSelected->invoke($get, 'group')); $get->addOrderBy('group'); - $this->assertTrue($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'group')); } } diff --git a/civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php similarity index 99% rename from civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php index 85687a0858..b7ec2c9977 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; diff --git a/civicrm/ext/api4/tests/phpunit/Action/ChainTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/ChainTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php index bbd6a09228..cd896a8293 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ChainTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -22,7 +22,7 @@ class ChainTest extends UnitTestCase { $entities = \Civi\Api4\Entity::get() ->addSelect('name') ->setChain([ - 'actions' => ['$name', 'getActions', ['select' => ['name']], 'name'] + 'actions' => ['$name', 'getActions', ['select' => ['name']], 'name'], ]) ->execute() ->indexBy('name'); diff --git a/civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php index 0a320100ba..51fb272d2f 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Activity; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php similarity index 63% rename from civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php index 63d85d5564..d607ce05db 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php @@ -1,45 +1,70 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; +use Civi\Api4\Email; /** * @group headless */ -class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { +class ContactApiKeyTest extends \api\v4\UnitTestCase { public function testGetApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'add contacts', 'edit api keys', 'view all contacts', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() - ->setCheckPermissions(FALSE) ->addValue('first_name', 'Api') ->addValue('last_name', 'Key0') ->addValue('api_key', $key) + ->addChain('email', Email::create() + ->addValue('contact_id', '$id') + ->addValue('email', 'test@key.get'), + 0 + ) ->execute() ->first(); + // With sufficient permission we should see the key $result = Contact::get() - ->setCheckPermissions(FALSE) ->addWhere('id', '=', $contact['id']) ->addSelect('api_key') ->execute() ->first(); + $this->assertEquals($key, $result['api_key']); - $this->assertEquals($result['api_key'], $key); + // Can also be fetched via join + $email = Email::get() + ->addSelect('contact.api_key') + ->addWhere('id', '=', $contact['email']['id']) + ->execute()->first(); + $this->assertEquals($key, $email['contact']['api_key']); + // Remove permission and we should not see the key + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; $result = Contact::get() ->addWhere('id', '=', $contact['id']) ->addSelect('api_key') ->execute() ->first(); + $this->assertTrue(empty($result['api_key'])); + // Also not available via join + $email = Email::get() + ->addSelect('contact.api_key') + ->addWhere('id', '=', $contact['email']['id']) + ->execute()->first(); + $this->assertTrue(empty($email['contact']['api_key'])); + + $result = Contact::get() + ->addWhere('id', '=', $contact['id']) + ->execute() + ->first(); $this->assertTrue(empty($result['api_key'])); } - public function testCreateWithApiKey() { + public function testCreateWithInsufficientPermissions() { \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'add contacts']; $key = uniqid(); @@ -59,7 +84,7 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { } public function testUpdateApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() @@ -113,7 +138,7 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { } public function testUpdateOwnApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys', 'edit my contact']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() @@ -167,4 +192,19 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { $this->assertEquals($result['api_key'], "MyId!"); } + public function testApiKeyWithGetFields() { + // With sufficient permissions the field should exist + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit api keys']; + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'administer CiviCRM']; + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + + // Field hidden from non-privileged users... + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys']; + $this->assertArrayNotHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + + // ...unless you disable 'checkPermissions' + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', ['checkPermissions' => FALSE], 'name')); + } + } diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php new file mode 100644 index 0000000000..abf65cada2 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php @@ -0,0 +1,56 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; + +/** + * @group headless + */ +class ContactChecksumTest extends \api\v4\UnitTestCase { + + public function testGetChecksum() { + $contact = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Check') + ->addValue('last_name', 'Sum') + ->addChain('cs', Contact::getChecksum()->setContactId('$id')->setTtl(500), 0) + ->execute() + ->first(); + + $result = Contact::validateChecksum() + ->setContactId($contact['id']) + ->setChecksum($contact['cs']['checksum']) + ->execute() + ->first(); + + $this->assertTrue($result['valid']); + } + + public function testValidateChecksum() { + $cid = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Checker') + ->addValue('last_name', 'Sum') + ->execute() + ->first()['id']; + + $goodCs = \CRM_Contact_BAO_Contact_Utils::generateChecksum($cid, NULL, 500); + $badCs = \CRM_Contact_BAO_Contact_Utils::generateChecksum($cid, strtotime('now - 1 week'), 1); + + $result1 = Contact::validateChecksum() + ->setContactId($cid) + ->setChecksum($goodCs) + ->execute() + ->first(); + $this->assertTrue($result1['valid']); + + $result2 = Contact::validateChecksum() + ->setContactId($cid) + ->setChecksum($badCs) + ->execute() + ->first(); + $this->assertFalse($result2['valid']); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php new file mode 100644 index 0000000000..e023361dc5 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php @@ -0,0 +1,42 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; + +/** + * @group headless + */ +class ContactGetTest extends \api\v4\UnitTestCase { + + public function testGetDeletedContacts() { + $last_name = uniqid('deleteContactTest'); + + $bob = Contact::create() + ->setValues(['first_name' => 'Bob', 'last_name' => $last_name]) + ->execute()->first(); + + $jan = Contact::create() + ->setValues(['first_name' => 'Jan', 'last_name' => $last_name]) + ->execute()->first(); + + $del = Contact::create() + ->setValues(['first_name' => 'Del', 'last_name' => $last_name, 'is_deleted' => 1]) + ->execute()->first(); + + // Deleted contacts are not fetched by default + $this->assertCount(2, Contact::get()->addWhere('last_name', '=', $last_name)->selectRowCount()->execute()); + + // You can search for them specifically + $contacts = Contact::get()->addWhere('last_name', '=', $last_name)->addWhere('is_deleted', '=', 1)->addSelect('id')->execute(); + $this->assertEquals($del['id'], $contacts->first()['id']); + + // Or by id + $this->assertCount(3, Contact::get()->addWhere('id', 'IN', [$bob['id'], $jan['id'], $del['id']])->selectRowCount()->execute()); + + // Putting is_deleted anywhere in the where clause will disable the default + $contacts = Contact::get()->addClause('OR', ['last_name', '=', $last_name], ['is_deleted', '=', 0])->addSelect('id')->execute(); + $this->assertContains($del['id'], $contacts->column('id')); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php index 762b46173c..9cb119846d 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -25,7 +25,7 @@ class CreateCustomValueTest extends BaseCustomValueTest { CustomField::create() ->setCheckPermissions(FALSE) ->addValue('label', 'Color') - ->addValue('options', $optionValues) + ->addValue('option_values', $optionValues) ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') diff --git a/civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php index b4d0af85bd..c84238818f 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -36,7 +36,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) - ->addValue('options', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) + ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -46,7 +46,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) - ->addValue('options', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) + ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -114,7 +114,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) - ->addValue('options', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) + ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -124,7 +124,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) - ->addValue('options', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) + ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php new file mode 100644 index 0000000000..4034dbed81 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php @@ -0,0 +1,71 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Relationship; +use api\v4\UnitTestCase; +use Civi\Api4\Contact; + +/** + * @group headless + */ +class CurrentFilterTest extends UnitTestCase { + + public function testCurrentRelationship() { + $cid1 = Contact::create()->addValue('first_name', 'Bob1')->execute()->first()['id']; + $cid2 = Contact::create()->addValue('first_name', 'Bob2')->execute()->first()['id']; + + $current = Relationship::create()->setValues([ + 'relationship_type_id' => 1, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now + 1 week', + ])->execute()->first(); + $indefinite = Relationship::create()->setValues([ + 'relationship_type_id' => 2, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + ])->execute()->first(); + $expiring = Relationship::create()->setValues([ + 'relationship_type_id' => 3, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now', + ])->execute()->first(); + $past = Relationship::create()->setValues([ + 'relationship_type_id' => 3, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now - 1 week', + ])->execute()->first(); + $inactive = Relationship::create()->setValues([ + 'relationship_type_id' => 4, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'is_active' => 0, + ])->execute()->first(); + + $getCurrent = (array) Relationship::get()->setCurrent(TRUE)->execute()->indexBy('id'); + $notCurrent = (array) Relationship::get()->setCurrent(FALSE)->execute()->indexBy('id'); + $getAll = (array) Relationship::get()->execute()->indexBy('id'); + + $this->assertArrayHasKey($current['id'], $getAll); + $this->assertArrayHasKey($indefinite['id'], $getAll); + $this->assertArrayHasKey($expiring['id'], $getAll); + $this->assertArrayHasKey($past['id'], $getAll); + $this->assertArrayHasKey($inactive['id'], $getAll); + + $this->assertArrayHasKey($current['id'], $getCurrent); + $this->assertArrayHasKey($indefinite['id'], $getCurrent); + $this->assertArrayHasKey($expiring['id'], $getCurrent); + $this->assertArrayNotHasKey($past['id'], $getCurrent); + $this->assertArrayNotHasKey($inactive['id'], $getCurrent); + + $this->assertArrayNotHasKey($current['id'], $notCurrent); + $this->assertArrayNotHasKey($indefinite['id'], $notCurrent); + $this->assertArrayNotHasKey($expiring['id'], $notCurrent); + $this->assertArrayHasKey($past['id'], $notCurrent); + $this->assertArrayHasKey($inactive['id'], $notCurrent); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php index 3fa59ef465..1990f6c8e9 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use Civi\Test\Api4\Traits\QueryCounterTrait; +use api\v4\Traits\QueryCounterTrait; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php similarity index 90% rename from civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php index da954bc7f4..72d127508a 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -22,6 +22,7 @@ class CustomValueTest extends BaseCustomValueTest { $group = uniqid('groupc'); $colorField = uniqid('colorc'); + $textField = uniqid('txt'); $customGroup = CustomGroup::create() ->setCheckPermissions(FALSE) @@ -40,6 +41,14 @@ class CustomValueTest extends BaseCustomValueTest { ->addValue('data_type', 'String') ->execute(); + CustomField::create() + ->setCheckPermissions(FALSE) + ->addValue('label', $textField) + ->addValue('custom_group_id', $customGroup['id']) + ->addValue('html_type', 'Text') + ->addValue('data_type', 'String') + ->execute(); + $this->contactID = Contact::create() ->setCheckPermissions(FALSE) ->addValue('first_name', 'Johann') @@ -55,7 +64,16 @@ class CustomValueTest extends BaseCustomValueTest { 'custom_field_id' => 1, 'custom_group' => $group, 'name' => $colorField, - 'title' => ts($colorField), + 'title' => $colorField, + 'entity' => "Custom_$group", + 'data_type' => 'String', + 'fk_entity' => NULL, + ], + [ + 'custom_field_id' => 2, + 'custom_group' => $group, + 'name' => $textField, + 'title' => $textField, 'entity' => "Custom_$group", 'data_type' => 'String', 'fk_entity' => NULL, diff --git a/civicrm/ext/api4/tests/phpunit/Action/DateTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/DateTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php index 8cdbfc7c6c..507d80edd0 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/DateTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\Relationship; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php index 3726042fd3..31f7441899 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\MockBasicEntity; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php similarity index 93% rename from civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php index 2d3be50ca3..77e582b44d 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; @@ -16,7 +16,8 @@ class ExtendFromIndividualTest extends BaseCustomValueTest { $customGroup = CustomGroup::create() ->setCheckPermissions(FALSE) ->addValue('name', 'MyContactFields') - ->addValue('extends', 'Individual') // not Contact + // not Contact + ->addValue('extends', 'Individual') ->execute() ->first(); diff --git a/civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php index c2b044e5cd..85bf67e916 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Activity; use Civi\Api4\Contact; diff --git a/civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php similarity index 89% rename from civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php index bc9b10e7ad..837d7d87e0 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Contact; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php similarity index 98% rename from civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php index bee6fbf361..06a0c17ca2 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\MockArrayEntity; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/IndexTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/IndexTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php index 17356c92db..9e33ea4e21 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/IndexTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php index dc4f656aad..c8b6516f42 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php index 097e12b0cc..701f4e2172 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php @@ -1,13 +1,13 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; use Civi\Api4\CustomValue; use Civi\Api4\Email; -use Civi\Test\Api4\Traits\TableDropperTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; use Civi\Api4\Contact; /** @@ -55,7 +55,7 @@ class ReplaceTest extends UnitTestCase { ->first()['id']; $replacement = [ ['email' => 'firstedited@example.com', 'id' => $e1], - ['contact_id' => $cid1, 'email' => 'third@example.com', 'location_type_id' => 1] + ['contact_id' => $cid1, 'email' => 'third@example.com', 'location_type_id' => 1], ]; $replaced = Email::replace() ->setRecords($replacement) @@ -64,7 +64,7 @@ class ReplaceTest extends UnitTestCase { // Should have saved 2 records $this->assertEquals(2, $replaced->count()); // Should have deleted email2 - $this->assertEquals([$e2], $replaced->deleted); + $this->assertEquals([['id' => $e2]], $replaced->deleted); // Verify contact now has the new email records $results = Email::get() ->addWhere('contact_id', '=', $cid1) diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php new file mode 100644 index 0000000000..2374b335ca --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php @@ -0,0 +1,24 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Event; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class RequiredFieldTest extends UnitTestCase { + + public function testRequired() { + $msg = ''; + try { + Event::create()->execute(); + } + catch (\API_Exception $e) { + $msg = $e->getMessage(); + } + $this->assertEquals('Mandatory values missing from Api4 Event::create: title, event_type_id, start_date', $msg); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php new file mode 100644 index 0000000000..b1bffbbbf5 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php @@ -0,0 +1,54 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; +use api\v4\UnitTestCase; + +/** + * Class UpdateContactTest + * @package api\v4\Action + * @group headless + */ +class UpdateContactTest extends UnitTestCase { + + public function testUpdateWithIdInWhere() { + $contactId = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Johann') + ->addValue('last_name', 'Tester') + ->addValue('contact_type', 'Individual') + ->execute() + ->first()['id']; + + $contact = Contact::update() + ->setCheckPermissions(FALSE) + ->addWhere('id', '=', $contactId) + ->addValue('first_name', 'Testy') + ->execute() + ->first(); + $this->assertEquals('Testy', $contact['first_name']); + $this->assertEquals('Tester', $contact['last_name']); + } + + public function testUpdateWithIdInValues() { + $contactId = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Bobby') + ->addValue('last_name', 'Tester') + ->addValue('contact_type', 'Individual') + ->execute() + ->first()['id']; + + $contact = Contact::update() + ->setCheckPermissions(FALSE) + ->addValue('id', $contactId) + ->addValue('first_name', 'Billy') + ->execute(); + $this->assertCount(1, $contact); + $this->assertEquals($contactId, $contact[0]['id']); + $this->assertEquals('Billy', $contact[0]['first_name']); + $this->assertEquals('Tester', $contact[0]['last_name']); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php index 99a9f01101..23b6d2a46d 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use \CRM_Core_BAO_CustomValueTable as CustomValueTable; +use CRM_Core_BAO_CustomValueTable as CustomValueTable; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php b/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php new file mode 100644 index 0000000000..aea9bf33ba --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php @@ -0,0 +1,68 @@ +<?php +// vim: set si ai expandtab tabstop=4 shiftwidth=4 softtabstop=4: + +/** + * File for the api_v4_AllTests class + * + * (PHP 5) + * + * @author Walt Haas <walt@dharmatech.org> (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * GNU Affero General Public License version 3 + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM + * + * This file is part of CiviCRM + * + * CiviCRM is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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, see + * <http://www.gnu.org/licenses/>. + */ + +/** + * Class containing the APIv4 test suite + * + * @package CiviCRM + */ +class api_v4_AllTests extends CiviTestSuite { + private static $instance = NULL; + + /** + */ + private static function getInstance() { + if (is_null(self::$instance)) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Build test suite dynamically. + */ + public static function suite() { + $inst = self::getInstance(); + return $inst->implSuite(__FILE__); + } + +} +// class AllTests + +// -- set Emacs parameters -- +// Local variables: +// mode: php; +// tab-width: 4 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json similarity index 56% rename from civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json index fcaf896634..1028c5b6f8 100644 --- a/civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json +++ b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json @@ -3,7 +3,8 @@ { "first_name": "Janice", "last_name": "Voss", - "contact_type": "Individual" + "contact_type": "Individual", + "@ref": "test_contact_1" } ], "CustomGroup": [ @@ -24,5 +25,18 @@ "name": "the_group", "title": "The Group" } + ], + "Mapping": [ + { + "name": "the_mapping", + "mapping_type_id": "1" + } + ], + "Activity": [ + { + "subject": "Test A Phone Activity", + "activity_type": "Phone Call", + "source_contact_id": "@ref test_contact_1.id" + } ] } diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/DefaultDataSet.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/DefaultDataSet.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/DefaultDataSet.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/DefaultDataSet.json diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/MultiContactMultiEmail.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/MultiContactMultiEmail.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/MultiContactMultiEmail.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/MultiContactMultiEmail.json diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/SingleContact.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/SingleContact.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/SingleContact.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/SingleContact.json diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php similarity index 71% rename from civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php index 79fe5b30de..a038cbf82f 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php @@ -1,12 +1,10 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; -use Civi\Api4\Generic\AbstractEntity; use Civi\Api4\Entity; -use Civi\Test\Api4\Service\TestCreationParameterProvider; -use Civi\Test\Api4\Traits\TableDropperTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; /** * @group headless @@ -14,12 +12,12 @@ use Civi\Test\Api4\UnitTestCase; class ConformanceTest extends UnitTestCase { use TableDropperTrait; - use \Civi\Test\Api4\Traits\OptionCleanupTrait { + use \api\v4\Traits\OptionCleanupTrait { setUp as setUpOptionCleanup; } /** - * @var TestCreationParameterProvider + * @var \api\v4\Service\TestCreationParameterProvider */ protected $creationParamProvider; @@ -45,14 +43,7 @@ class ConformanceTest extends UnitTestCase { } public function getEntities() { - $result = []; - $entities = Entity::get()->setCheckPermissions(FALSE)->execute(); - foreach ($entities as $entity) { - if ($entity['name'] != 'Entity') { - $result[] = [$entity['name']]; - } - } - return $result; + return Entity::get()->setCheckPermissions(FALSE)->execute()->column('name'); } /** @@ -63,13 +54,20 @@ class ConformanceTest extends UnitTestCase { $this->assertNotEmpty($entities); foreach ($entities as $data) { - $entity = $data[0]; + $entity = $data; $entityClass = 'Civi\Api4\\' . $entity; - $this->checkActions($entityClass); + $actions = $this->checkActions($entityClass); + + // Go no further if it's not a CRUD entity + if (array_diff(['get', 'create', 'update', 'delete'], array_keys($actions))) { + continue; + } + $this->checkFields($entityClass, $entity); $id = $this->checkCreation($entity, $entityClass); $this->checkGet($entityClass, $id, $entity); + $this->checkGetCount($entityClass, $id, $entity); $this->checkUpdateFailsFromCreate($entityClass, $id); $this->checkWrongParamType($entityClass); $this->checkDeleteWithNoId($entityClass); @@ -104,12 +102,13 @@ class ConformanceTest extends UnitTestCase { ->execute() ->indexBy('name'); - $this->assertNotEmpty($actions->getArrayCopy()); + $this->assertNotEmpty($actions); + return (array) $actions; } /** * @param string $entity - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * * @return mixed */ @@ -130,7 +129,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id */ protected function checkUpdateFailsFromCreate($entityClass, $id) { @@ -148,7 +147,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id * @param string $entity */ @@ -159,11 +158,34 @@ class ConformanceTest extends UnitTestCase { ->execute(); $errMsg = sprintf('Failed to fetch a %s after creation', $entity); - $this->assertEquals(1, count($getResult), $errMsg); + $this->assertEquals($id, $getResult->first()['id'], $errMsg); + $this->assertEquals(1, $getResult->count(), $errMsg); + } + + /** + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass + * @param int $id + * @param string $entity + */ + protected function checkGetCount($entityClass, $id, $entity) { + $getResult = $entityClass::get() + ->setCheckPermissions(FALSE) + ->addWhere('id', '=', $id) + ->selectRowCount() + ->execute(); + $errMsg = sprintf('%s getCount failed', $entity); + $this->assertEquals(1, $getResult->count(), $errMsg); + + $getResult = $entityClass::get() + ->setCheckPermissions(FALSE) + ->selectRowCount() + ->execute(); + $errMsg = sprintf('%s getCount failed', $entity); + $this->assertGreaterThanOrEqual(1, $getResult->count(), $errMsg); } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass */ protected function checkDeleteWithNoId($entityClass) { $exceptionThrown = ''; @@ -178,7 +200,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass */ protected function checkWrongParamType($entityClass) { $exceptionThrown = ''; @@ -195,7 +217,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id */ protected function checkDeletion($entityClass, $id) { @@ -205,11 +227,11 @@ class ConformanceTest extends UnitTestCase { ->execute(); // should get back an array of deleted id - $this->assertEquals([$id], (array) $deleteResult); + $this->assertEquals([['id' => $id]], (array) $deleteResult); } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id * @param string $entity */ diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php index 392e0466a3..f2e0eaa38f 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Contact; use Civi\Api4\OptionValue; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php index 8f7ecd0058..7e0a392fdb 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Entity; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php similarity index 80% rename from civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php index 8236efb05a..7822ae9f5b 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Participant; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -62,11 +62,13 @@ class ParticipantTest extends UnitTestCase { 'contacts' => $this->createEntity([ 'type' => 'Individual', 'count' => $contactCount, - 'seq' => 1]), + 'seq' => 1, + ]), 'events' => $this->createEntity([ 'type' => 'Event', 'count' => $eventCount, - 'seq' => 1]), + 'seq' => 1, + ]), 'sources' => ['Paddington', 'Springfield', 'Central'], ]; @@ -77,8 +79,10 @@ class ParticipantTest extends UnitTestCase { 'overrides' => [ 'event_id' => $dummy['events'][$i % $eventCount]['id'], 'contact_id' => $dummy['contacts'][$i % $contactCount]['id'], - 'source' => $dummy['sources'][$i % 3], // 3 = number of sources - ]])['sample_params']; + // 3 = number of sources + 'source' => $dummy['sources'][$i % 3], + ], + ])['sample_params']; Participant::create() ->setValues($dummy['participants'][$i]) @@ -137,10 +141,9 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->setSelect(['id']) ->addClause('NOT', [ - ['event_id', '=', $firstEventId], - ['contact_id', '=', $firstContactId], - ] - ) + ['event_id', '=', $firstEventId], + ['contact_id', '=', $firstContactId], + ]) ->execute() ->indexBy('id'); @@ -149,10 +152,9 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->setSelect(['id']) ->addClause('NOT', 'AND', [ - ['event_id', '=', $firstEventId], - ['contact_id', '=', $firstContactId], - ] - ) + ['event_id', '=', $firstEventId], + ['contact_id', '=', $firstContactId], + ]) ->execute() ->indexBy('id'); @@ -187,7 +189,7 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->execute(); $expectedDeletes = [2, 7, 12, 17]; - $this->assertEquals($expectedDeletes, (array) $deleteResult, + $this->assertEquals($expectedDeletes, array_column((array) $deleteResult, 'id'), "didn't delete every second record as expected"); $sqlCount = $this->getRowCount('civicrm_participant'); @@ -195,6 +197,25 @@ class ParticipantTest extends UnitTestCase { $participantCount - count($expectedDeletes), $sqlCount, "records not gone from database after delete"); + + // Try creating is_test participants + foreach ($dummy['contacts'] as $contact) { + Participant::create() + ->addValue('is_test', 1) + ->addValue('contact_id', $contact['id']) + ->addValue('event_id', $secondEventId) + ->execute(); + } + + // By default is_test participants are hidden + $this->assertCount(0, Participant::get()->selectRowCount()->addWhere('event_id', '=', $secondEventId)->execute()); + + // Test records show up if you add is_test to the query + $testParticipants = Participant::get()->addWhere('event_id', '=', $secondEventId)->addWhere('is_test', '=', 1)->addSelect('id')->execute(); + $this->assertCount($contactCount, $testParticipants); + + // Or if you search by id + $this->assertCount(1, Participant::get()->selectRowCount()->addWhere('id', '=', $testParticipants->first()['id'])->execute()); } } diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php new file mode 100644 index 0000000000..d096029fde --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php @@ -0,0 +1,21 @@ +<?php + +namespace api\v4\Entity; + +use Civi\Api4\Route; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class RouteTest extends UnitTestCase { + + public function testGet() { + $result = Route::get()->addWhere('path', '=', 'civicrm/admin')->execute(); + $this->assertEquals(1, $result->count()); + + $result = Route::get()->addWhere('path', 'LIKE', 'civicrm/admin/%')->execute(); + $this->assertGreaterThan(10, $result->count()); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php new file mode 100644 index 0000000000..4443228366 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php @@ -0,0 +1,36 @@ +<?php + +namespace api\v4\Entity; + +use Civi\Api4\Setting; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class SettingTest extends UnitTestCase { + + public function testSettingASetting() { + $setting = Setting::set()->addValue('menubar_position', 'above-crm-container')->setCheckPermissions(FALSE)->execute()->first(); + $this->assertEquals('above-crm-container', $setting['value']); + $setting = Setting::get()->addSelect('menubar_position')->setCheckPermissions(FALSE)->execute()->first(); + $this->assertEquals('above-crm-container', $setting['value']); + + $setting = Setting::revert()->addSelect('menubar_position')->setCheckPermissions(FALSE)->execute()->indexBy('name')->column('value'); + $this->assertEquals(['menubar_position' => 'over-cms-menu'], $setting); + $setting = civicrm_api4('Setting', 'get', ['select' => ['menubar_position'], 'checkPermissions' => FALSE], 0); + $this->assertEquals('over-cms-menu', $setting['value']); + } + + public function testInvalidSetting() { + $message = ''; + try { + Setting::set()->addValue('not_a_real_setting!', 'hello')->setCheckPermissions(FALSE)->execute(); + } + catch (\API_Exception $e) { + $message = $e->getMessage(); + } + $this->assertContains('setting', $message); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/Action/MockArrayEntity/Get.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/Action/MockArrayEntity/Get.php similarity index 100% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/Action/MockArrayEntity/Get.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/Action/MockArrayEntity/Get.php diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php similarity index 99% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php index 371df50e94..b6e3fac5ea 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4; + use Civi\Api4\Generic\BasicGetFieldsAction; /** diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php similarity index 79% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php index aed11e4557..cc81035a4b 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php @@ -2,6 +2,8 @@ namespace Civi\Api4; +use api\v4\Mock\MockEntityDataStorage; + /** * MockBasicEntity entity. * @@ -9,8 +11,6 @@ namespace Civi\Api4; */ class MockBasicEntity extends Generic\AbstractEntity { - const STORAGE_CLASS = '\\Civi\\Test\\Api4\\Mock\\MockEntityDataStorage'; - /** * @return Generic\BasicGetFieldsAction */ @@ -26,7 +26,7 @@ class MockBasicEntity extends Generic\AbstractEntity { 'options' => [ 'one' => 'One', 'two' => 'Two', - ] + ], ], [ 'name' => 'color', @@ -48,28 +48,35 @@ class MockBasicEntity extends Generic\AbstractEntity { * @return Generic\BasicGetAction */ public static function get() { - return new Generic\BasicGetAction('MockBasicEntity', __FUNCTION__, [self::STORAGE_CLASS, 'get']); + return new Generic\BasicGetAction('MockBasicEntity', __FUNCTION__, [MockEntityDataStorage::CLASS, 'get']); } /** * @return Generic\BasicCreateAction */ public static function create() { - return new Generic\BasicCreateAction(static::class, __FUNCTION__, [self::STORAGE_CLASS, 'write']); + return new Generic\BasicCreateAction(static::class, __FUNCTION__, [MockEntityDataStorage::CLASS, 'write']); + } + + /** + * @return Generic\BasicSaveAction + */ + public static function save() { + return new Generic\BasicSaveAction(self::getEntityName(), __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'write']); } /** * @return Generic\BasicUpdateAction */ public static function update() { - return new Generic\BasicUpdateAction(self::getEntityName(), __FUNCTION__, 'id', [self::STORAGE_CLASS, 'write']); + return new Generic\BasicUpdateAction(self::getEntityName(), __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'write']); } /** * @return Generic\BasicBatchAction */ public static function delete() { - return new Generic\BasicBatchAction('MockBasicEntity', __FUNCTION__, 'id', [self::STORAGE_CLASS, 'delete']); + return new Generic\BasicBatchAction('MockBasicEntity', __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'delete']); } /** diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php similarity index 74% rename from civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php index fbb10465b3..1f2ad10015 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * Simple data backend for mock basic api. @@ -18,8 +18,11 @@ class MockEntityDataStorage { public static function write($record) { if (empty($record['id'])) { $record['id'] = self::$nextId++; + self::$data[$record['id']] = $record; + } + else { + self::$data[$record['id']] = $record + self::$data[$record['id']]; } - self::$data[$record['id']] = $record; return $record; } diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php similarity index 89% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php index e46272d2a1..c014f35adf 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * Class TestV4ReflectionBase diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php similarity index 86% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php index 83966b5c90..bb68c191c1 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * @inheritDoc diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php similarity index 86% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php index a2a93a4fa5..12cec53d14 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php @@ -1,7 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; - +namespace api\v4\Mock; /** * Grandchild class diff --git a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php similarity index 77% rename from civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php index 0e68843a18..129db653ee 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -27,7 +27,7 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testWithComplexRelatedEntitySelect() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'display_name'; $query->select[] = 'phones.phone'; @@ -59,10 +59,11 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testWithSelectOfOrphanDeepValues() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; - $query->select[] = 'emails.location_type.name'; // emails not selected + // emails not selected + $query->select[] = 'emails.location_type.name'; $results = $query->run(); $firstResult = array_shift($results); @@ -70,10 +71,11 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testOrderDoesNotMatter() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; - $query->select[] = 'emails.location_type.name'; // before emails selection + // before emails selection + $query->select[] = 'emails.location_type.name'; $query->select[] = 'emails.email'; $query->where[] = ['emails.email', 'IS NOT NULL']; $results = $query->run(); diff --git a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php similarity index 77% rename from civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php index ca9a5851eb..0ea07762ef 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -32,7 +32,7 @@ class Api4SelectQueryTest extends UnitTestCase { public function testWithSingleWhereJoin() { $phoneNum = $this->getReference('test_phone_1')['phone']; - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->where[] = ['phones.phone', '=', $phoneNum]; $results = $query->run(); @@ -42,7 +42,7 @@ class Api4SelectQueryTest extends UnitTestCase { public function testOneToManyJoin() { $phoneNum = $this->getReference('test_phone_1')['phone']; - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; $query->select[] = 'phones.phone'; @@ -60,7 +60,7 @@ class Api4SelectQueryTest extends UnitTestCase { $phoneNum = $this->getReference('test_phone_1')['phone']; $contact = $this->getReference('test_contact_1'); - $query = new Api4SelectQuery('Phone', FALSE); + $query = new Api4SelectQuery('Phone', FALSE, civicrm_api4('Phone', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'phone'; $query->select[] = 'contact.display_name'; @@ -76,7 +76,7 @@ class Api4SelectQueryTest extends UnitTestCase { } public function testOneToManyMultipleJoin() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; $query->select[] = 'phones.phone'; diff --git a/civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php similarity index 87% rename from civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php index ef05f6578d..1721665b49 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php @@ -1,15 +1,13 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Contact; -use Civi\Api4\OptionGroup; -use Civi\Api4\OptionValue; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * Class OneToOneJoinTest - * @package Civi\Test\Api4\Query + * @package api\v4\Query * @group headless */ class OneToOneJoinTest extends UnitTestCase { diff --git a/civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php similarity index 81% rename from civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php index 75d4b9771c..eb6bfa4d48 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -29,7 +29,7 @@ class OptionValueJoinTest extends UnitTestCase { } public function testCommunicationMethodJoin() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'first_name'; $query->select[] = 'preferred_communication_method.label'; $query->where[] = ['preferred_communication_method', 'IS NOT NULL']; diff --git a/civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php index 860bd78520..748d27ffe0 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php @@ -1,17 +1,18 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Contact; use Civi\Api4\Email; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * Class SelectQueryMultiJoinTest - * @package Civi\Test\Api4\Query + * @package api\v4\Query * @group headless */ class SelectQueryMultiJoinTest extends UnitTestCase { + public function setUpHeadless() { $this->cleanup(['tablesToTruncate' => ['civicrm_contact', 'civicrm_email']]); $this->loadDataSet('MultiContactMultiEmail'); @@ -34,8 +35,8 @@ class SelectQueryMultiJoinTest extends UnitTestCase { $secondContactEmails = array_column($secondContact['emails'], 'email'); $expectedFirstEmails = [ - 'test_contact_one_home@fakedomain.com', - 'test_contact_one_work@fakedomain.com', + 'test_contact_one_home@fakedomain.com', + 'test_contact_one_work@fakedomain.com', ]; $expectedSecondEmails = [ 'test_contact_two_home@fakedomain.com', diff --git a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php similarity index 85% rename from civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php index 183d34dc8f..fb5710fe34 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php @@ -1,13 +1,14 @@ <?php -namespace Civi\Test\Api4\Service\Schema; +namespace api\v4\Service\Schema; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless */ class SchemaMapRealTableTest extends UnitTestCase { + public function testAutoloadWillPopulateTablesByDefault() { $map = \Civi::container()->get('schema_map'); $this->assertNotEmpty($map->getTables()); diff --git a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php index 04952f7bfd..0c47982d5a 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Service\Schema; +namespace api\v4\Service\Schema; use Civi\Api4\Service\Schema\Joinable\Joinable; use Civi\Api4\Service\Schema\SchemaMap; use Civi\Api4\Service\Schema\Table; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php similarity index 75% rename from civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php index ef10cea981..477c43f9bd 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php @@ -1,20 +1,19 @@ <?php -namespace Civi\Test\Api4\Service; +namespace api\v4\Service; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\SpecGatherer; -use \CRM_Utils_String as StringHelper; class TestCreationParameterProvider { /** - * @var SpecGatherer + * @var \Civi\Api4\Service\Spec\SpecGatherer */ protected $gatherer; /** - * @param SpecGatherer $gatherer + * @param \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ public function __construct(SpecGatherer $gatherer) { $this->gatherer = $gatherer; @@ -49,7 +48,7 @@ class TestCreationParameterProvider { * Attempt to get a value using field option, defaults, FKEntity, or a random * value based on the data type. * - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field * * @return mixed * @throws \Exception @@ -63,7 +62,10 @@ class TestCreationParameterProvider { return $field->getDefaultValue(); } elseif ($field->getFkEntity()) { - return $this->getFkID($field); + return $this->getFkID($field, $field->getFkEntity()); + } + elseif (in_array($field->getName(), ['entity_id', 'contact_id'])) { + return $this->getFkID($field, 'Contact'); } $randomValue = $this->getRandomValue($field->getDataType()); @@ -76,32 +78,23 @@ class TestCreationParameterProvider { } /** - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field * * @return mixed */ private function getOption(FieldSpec $field) { $options = $field->getOptions(); - $useKeyNames = ['data_type', 'html_type']; - $shouldUseKey = in_array($field->getName(), $useKeyNames); - $isIdField = substr($field->getName(), -3) === '_id'; - - if ($isIdField || $shouldUseKey) { - return array_rand($options); // return key (ID) - } - else { - return $options[array_rand($options)]; - } + return array_rand($options); } /** - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field + * @param string $fkEntity * * @return mixed * @throws \Exception */ - private function getFkID(FieldSpec $field) { - $fkEntity = $field->getFkEntity(); + private function getFkID(FieldSpec $field, $fkEntity) { $params = ['checkPermissions' => FALSE]; // Be predictable about what type of contact we select if ($fkEntity === 'Contact') { @@ -130,16 +123,19 @@ class TestCreationParameterProvider { return rand(1, 2000); case 'String': - return StringHelper::createRandom(10, implode('', range('a', 'z'))); + return \CRM_Utils_String::createRandom(10, implode('', range('a', 'z'))); case 'Text': - return StringHelper::createRandom(100, implode('', range('a', 'z'))); + return \CRM_Utils_String::createRandom(100, implode('', range('a', 'z'))); case 'Money': - return sprintf('%d.%2d', rand(0, 2000), rand(1, 99)); + return sprintf('%d.%2d', rand(0, 2000), rand(10, 99)); case 'Date': return '20100102'; + + case 'Timestamp': + return 'now'; } return NULL; diff --git a/civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php index 45aa41b2dd..81db002346 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php similarity index 82% rename from civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php index bdb1c4599a..9c18da569f 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php @@ -1,12 +1,12 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\CustomFieldSpec; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; use Civi\Api4\Service\Spec\SpecFormatter; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -48,16 +48,18 @@ class SpecFormatterTest extends UnitTestCase { 'id' => $customFieldId, 'name' => $name, 'data_type' => 'String', - 'html_type' => 'MultiSelect', + 'html_type' => 'Multi-Select', ]; - /** @var CustomFieldSpec $field */ + /** @var \Civi\Api4\Service\Spec\CustomFieldSpec $field */ $field = SpecFormatter::arrayToField($data, 'TestEntity'); $this->assertInstanceOf(CustomFieldSpec::class, $field); $this->assertEquals('my_group', $field->getCustomGroupName()); $this->assertEquals($customFieldId, $field->getCustomFieldId()); $this->assertEquals(\CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND, $field->getSerialize()); + $this->assertEquals('Select', $field->getInputType()); + $this->assertTrue($field->getInputAttrs()['multiple']); } /** @@ -69,20 +71,21 @@ class SpecFormatterTest extends UnitTestCase { [ 'name' => 'Foo', 'title' => 'Bar', - 'type' => \CRM_Utils_Type::T_STRING + 'type' => \CRM_Utils_Type::T_STRING, ], 'Foo', - 'String' + 'String', ], [ [ 'name' => 'MyField', 'title' => 'Bar', 'type' => \CRM_Utils_Type::T_STRING, - 'data_type' => 'Boolean' // this should take precedence + // this should take precedence + 'data_type' => 'Boolean', ], 'MyField', - 'Boolean' + 'Boolean', ], ]; } diff --git a/civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php similarity index 88% rename from civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php index bf5b92b9c2..c030952f5b 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php @@ -1,16 +1,15 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\FieldSpec; -use Civi\Api4\Service\Spec\Provider\SpecProviderInterface; -use Civi\Api4\Service\Spec\RequestSpec; +use Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface; use Civi\Api4\Service\Spec\SpecGatherer; -use Civi\Test\Api4\Traits\OptionCleanupTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\OptionCleanupTrait; +use api\v4\UnitTestCase; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use Civi\Test\Api4\Traits\TableDropperTrait; +use api\v4\Traits\TableDropperTrait; use Prophecy\Argument; /** @@ -26,7 +25,7 @@ class SpecGathererTest extends UnitTestCase { $this->cleanup([ 'tablesToTruncate' => [ 'civicrm_custom_group', - 'civicrm_custom_field' + 'civicrm_custom_field', ], ]); return parent::setUpHeadless(); @@ -49,7 +48,7 @@ class SpecGathererTest extends UnitTestCase { $provider = $this->prophesize(SpecProviderInterface::class); $provider->applies('Contact', 'create')->willReturn(TRUE); $provider->modifySpec(Argument::any())->will(function ($args) { - /** @var RequestSpec $spec */ + /** @var \Civi\Api4\Service\Spec\RequestSpec $spec */ $spec = $args[0]; $spec->addFieldSpec(new FieldSpec('foo', 'Contact')); }); @@ -75,7 +74,7 @@ class SpecGathererTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroupId) - ->addValue('options', $options) + ->addValue('option_values', $options) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') ->execute(); diff --git a/civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php index 06f4323526..a848516249 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; trait OptionCleanupTrait { diff --git a/civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php index c7e10f1b93..988d8c2adf 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; -use \CRM_Utils_Array as ArrayHelper; +use CRM_Utils_Array as ArrayHelper; trait QueryCounterTrait { diff --git a/civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php index 6e54347334..a623e5ac62 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php @@ -1,8 +1,9 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; trait TableDropperTrait { + /** * @param $prefix */ diff --git a/civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php similarity index 98% rename from civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php index 1db2209046..b03ad8c4b6 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; /** * This probably should be a separate class diff --git a/civicrm/ext/api4/tests/phpunit/UnitTestCase.php b/civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/UnitTestCase.php rename to civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php index 4f872d120d..49f462831a 100644 --- a/civicrm/ext/api4/tests/phpunit/UnitTestCase.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4; +namespace api\v4; -use Civi\Test\Api4\Traits\TestDataLoaderTrait; +use api\v4\Traits\TestDataLoaderTrait; use Civi\Test\HeadlessInterface; use Civi\Test\TransactionalInterface; @@ -70,8 +70,12 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf /** * Create sample entities (using V3 for now). * - * @param array $params (type, seq, overrides, count) - * @return array (either single, or array of array if count >1) + * @param array $params + * (type, seq, overrides, count) + * @return array + * (either single, or array of array if count >1) + * @throws \CiviCRM_API3_Exception + * @throws \Exception */ public static function createEntity($params) { $params += [ @@ -154,7 +158,8 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf if (substr($value, 0, 6) === 'dummy.') { $foreign_entity = self::createEntity([ 'type' => substr($value, 6), - 'seq' => $params['seq']]); + 'seq' => $params['seq'], + ]); $sample_params[$key] = $foreign_entity['id']; } } @@ -217,7 +222,8 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf ], 'Contribution' => [ 'contact_id' => 'dummy.Individual', - 'financial_type_id' => 1, // donation, 2 = member, 3 = campaign contribution, 4=event + // donation, 2 = member, 3 = campaign contribution, 4=event + 'financial_type_id' => 1, 'total_amount' => 7.3, ], 'Activity' => [ diff --git a/civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php similarity index 85% rename from civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php index 462f07cc32..81d7878052 100644 --- a/civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Utils; +namespace api\v4\Utils; use Civi\Api4\Utils\ArrayInsertionUtil; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -18,7 +18,7 @@ class ArrayInsertionServiceTest extends UnitTestCase { $expected = [ 'foo' => [ - 'bar' => 'LALA' + 'bar' => 'LALA', ], ]; @@ -29,25 +29,25 @@ class ArrayInsertionServiceTest extends UnitTestCase { $contacts = [ [ 'id' => 1, - 'first_name' => 'Jim' + 'first_name' => 'Jim', ], [ 'id' => 2, - 'first_name' => 'Karen' + 'first_name' => 'Karen', ], ]; $emails = [ [ 'email' => 'jim@jim.com', 'id' => 2, - '_parent_id' => 1 + '_parent_id' => 1, ], ]; $locationTypes = [ [ 'name' => 'Home', 'id' => 3, - '_parent_id' => 2 + '_parent_id' => 2, ], ]; diff --git a/civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php index d94de33725..57b5aad877 100644 --- a/civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Utils; +namespace api\v4\Utils; use Civi\Api4\Utils\ReflectionUtils; -use Civi\Test\Api4\Mock\MockV4ReflectionGrandchild; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Mock\MockV4ReflectionGrandchild; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/services.xml b/civicrm/ext/api4/tests/phpunit/api/v4/services.xml similarity index 78% rename from civicrm/ext/api4/tests/services.xml rename to civicrm/ext/api4/tests/phpunit/api/v4/services.xml index 220ba910ab..3310b03e93 100644 --- a/civicrm/ext/api4/tests/services.xml +++ b/civicrm/ext/api4/tests/phpunit/api/v4/services.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <services> - <service id="test.param_provider" class="Civi\Test\Api4\Service\TestCreationParameterProvider"> + <service id="test.param_provider" class="api\v4\Service\TestCreationParameterProvider"> <argument type="service" id="spec_gatherer"/> </service> </services> diff --git a/civicrm/ext/api4/tests/phpunit/bootstrap.php b/civicrm/ext/api4/tests/phpunit/bootstrap.php index 1c28e61193..c9572477e7 100644 --- a/civicrm/ext/api4/tests/phpunit/bootstrap.php +++ b/civicrm/ext/api4/tests/phpunit/bootstrap.php @@ -8,8 +8,8 @@ eval($bootCode); preg_match('/require_once\s*\'(.*)\'/', $bootCode, $matches); $loader = require sprintf('%s/vendor/autoload.php', $matches[1]); -$loader->addPsr4('Civi\\Test\\Api4\\', __DIR__); -$loader->addPsr4('Civi\\Api4\\', __DIR__ . '/Mock/Api4'); +$loader->addPsr4('api\\v4\\', __DIR__ . '/api/v4'); +$loader->addPsr4('Civi\\Api4\\', __DIR__ . '/api/v4' . '/Mock/Api4'); /** * Call the "cv" command. diff --git a/civicrm/packages/DB/DataObject.php b/civicrm/packages/DB/DataObject.php index a18932c756..87edfbfbeb 100644 --- a/civicrm/packages/DB/DataObject.php +++ b/civicrm/packages/DB/DataObject.php @@ -2303,6 +2303,7 @@ class DB_DataObject extends DB_DataObject_Overload // change the connection and results charsets to UTF-8 if we're using MySQL 4.1+ $civicrmConfig = CRM_Core_Config::singleton(); $this->query("/*!40101 SET NAMES utf8 */"); + $this->query("/*!50503 SET NAMES utf8mb4 */"); if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug(serialize($_DB_DATAOBJECT['CONNECTIONS']), "CONNECT",5); @@ -2415,16 +2416,22 @@ class DB_DataObject extends DB_DataObject_Overload $result = $DB->query($string); } catch (PEAR_Exception $e) { + if ($tries == 0) { + // The original sin was what triggered the retry. Sometimes the retry fails because mysql has done an internal rollback + // of previous queries in the transaction so it has essentially failed to recover from the deadlock. If we can't + // recover we should return the original error. + $firstError = $e; + } // CRM-21489 If we have caught a DB lock - let it go around the loop until our tries limit is hit. // else rethrow the exception. The 2 locks we are looking at are mysql code 1205 (lock) and // 1213 (deadlock). $dbErrorMessage = $e->getCause()->getUserInfo(); if (!stristr($dbErrorMessage, 'nativecode=1205') && !stristr($dbErrorMessage, 'nativecode=1213')) { - throw $e; + throw $firstError; } $message = (stristr($dbErrorMessage, 'nativecode=1213') ? 'Database deadlock encountered' : 'Database lock encountered'); if (($tries + 1) === $maxTries) { - throw new CRM_Core_Exception($message, 0, array('sql' => $string, 'trace' => $e->getTrace())); + throw new CRM_Core_Exception($message, 0, array('sql' => $string, 'trace' => $firstError->getTrace())); } CRM_Core_Error::debug_log_message("Retrying after $message hit on attempt " . ($tries + 1) . ' at query : ' . $string); continue; diff --git a/civicrm/packages/HTML/QuickForm/hierselect.php b/civicrm/packages/HTML/QuickForm/hierselect.php index 21e4110aa7..c7ce5e199f 100644 --- a/civicrm/packages/HTML/QuickForm/hierselect.php +++ b/civicrm/packages/HTML/QuickForm/hierselect.php @@ -259,7 +259,10 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group */ function setValue($value) { - $this->_nbElements = count($value); + // $value could be a string or an array - prior to php 7.2 count handled both, returning 0 for NULL + // or an empty array. + // https://stackoverflow.com/questions/20257983/why-the-count-function-returns-1-for-false-and-0-for-null + $this->_nbElements = is_array($value) ? count($value) : ($value === NULL ? 0 : 1); parent::setValue($value); $this->_setOptions(); } // end func setValue diff --git a/civicrm/release-notes.md b/civicrm/release-notes.md index 75f98c7dff..c6185f5755 100644 --- a/civicrm/release-notes.md +++ b/civicrm/release-notes.md @@ -15,6 +15,17 @@ Other resources for identifying changes are: * https://github.com/civicrm/civicrm-joomla * https://github.com/civicrm/civicrm-wordpress +# CiviCRM 5.18.0 + +Released October 2, 2019 + +- **[Synopsis](release-notes/5.18.0.md#synopsis)** +- **[Features](release-notes/5.18.0.md#features)** +- **[Bugs resolved](release-notes/5.18.0.md#bugs)** +- **[Miscellany](release-notes/5.18.0.md#misc)** +- **[Credits](release-notes/5.18.0.md#credits)** +- **[Feedback](release-notes/5.18.0.md#feedback)** + ## CiviCRM 5.17.5 Released September 26, 2019 diff --git a/civicrm/release-notes/5.18.0.md b/civicrm/release-notes/5.18.0.md new file mode 100644 index 0000000000..35178222dd --- /dev/null +++ b/civicrm/release-notes/5.18.0.md @@ -0,0 +1,876 @@ +# CiviCRM 5.18.0 + +Released October 2, 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? | no | +| **Fix problems installing or upgrading to a previous version?** | **yes** | +| **Introduce features?** | **yes** | +| **Fix bugs?** | **yes** | + +## <a name="features"></a>Features + +### Core CiviCRM + +- **Enable view/revert delete action for detail logging + ([15045](https://github.com/civicrm/civicrm-core/pull/15045))** + + If detailed logging is enabled, you can now view and revert deleted + information. + +- **Download Bower dependencies using Composer + ([dev/drupal#8](https://lab.civicrm.org/dev/drupal/issues/8): + [15044](https://github.com/civicrm/civicrm-core/pull/15044))** + + This improves performance and caching by downloading Javascript libraries + using Composer with `composer-downloads-plugin` and specified zip files rather + than Bower. + +- **Add `hook_civicrm_pre` and `hook_civicrm_post` to Domain create and edit + operations ([dev/core#1203](https://lab.civicrm.org/dev/core/issues/1203): + [15104](https://github.com/civicrm/civicrm-core/pull/15104))** + + Makes it so one can detect when a new Domain has been created or when a Domain + has been edited with the usual `hook_civicrm_pre` and `hook_civicrm_post` + callbacks. + +- **Api support for deduping + (Work Towards [dev/core#1230](https://lab.civicrm.org/dev/core/issues/1230): + [15196](https://github.com/civicrm/civicrm-core/pull/15196), + [15188](https://github.com/civicrm/civicrm-core/pull/15188), + [15187](https://github.com/civicrm/civicrm-core/pull/15187), + [15227](https://github.com/civicrm/civicrm-core/pull/15227) and + [15154](https://github.com/civicrm/civicrm-core/pull/15154))** + + Work toward improving the new API support for deduping including: not + geocoding when merging for performance reasons, giving contacts with 'merge + duplicate contacts' permission to get dedupe rules, ensuring the API call + Dedupe.getstatistics requires "Access CiviCRM" and adds a check for 'force + merge duplicate contacts' if mode is aggressive. + +- **Add cid parameter in custom group form url & set it for Activity form + ([dev/core#752](https://lab.civicrm.org/dev/core/issues/752): + [15012](https://github.com/civicrm/civicrm-core/pull/15012))** + + Adds a contact id parameter (cid=) when loading custom data via back end forms + so that hooks can modify behavior based on the `contact_id` being viewed. + +- **Make report listing actions links hookable + ([dev/core#1077](https://lab.civicrm.org/dev/core/issues/1077): + [15074](https://github.com/civicrm/civicrm-core/pull/15074))** + + The actions list on the report listing screen can now be altered by developers + using `hook_civicrm_links`. + +- **Fixes inconsistency between constituency summary and constituency detail + ([15222](https://github.com/civicrm/civicrm-core/pull/15222))** + + This improves the consistency of how the "Print Report" action link functions + on the reports listing. Before this change, some "Print Report" links would + take the user to the report in print view, and some would trigger a print + pop-up. + +- **Add index to civicrm_contact.created_date & modified_date + ([15203](https://github.com/civicrm/civicrm-core/pull/15203))** + + This adds an index to the `created_date` and `modified_date` columns in the + `civicrm_contact` table. + +- **Added field title for Cache table + ([15204](https://github.com/civicrm/civicrm-core/pull/15204))** + + The Data Access Object for the `civicrm_cache` table now stores titles for + each field. + +- **Allow Manual Geo Code flag to be exported + ([14998](https://github.com/civicrm/civicrm-core/pull/14998))** + + The field denoting that an address has been manually geocoded can now be + exported. + +- **Use merge duplicate contacts as api permission for merging + ([15155](https://github.com/civicrm/civicrm-core/pull/15155))** + + Changes the API call `Contact.merge` to require 'merge duplicate contacts' + instead of 'Administer CiviCRM'. + +- **Adjust permissions on dedupe exception api to 'merge duplicate contacts' + ([15157](https://github.com/civicrm/civicrm-core/pull/15157))** + + The API for managing dedupe exceptions now requires the permission "merge + duplicate contacts" instead of "Administer CiviCRM". + +- **Open up permissions on Dedupe.getduplicates + ([15152](https://github.com/civicrm/civicrm-core/pull/15152))** + + Less restrictive permissions on the `Dedupe.getduplicates` API (currently only + used from unit tests) specifically moves from requiring the permission + "Administer CiviCRM" to "Access CiviCRM". + +- **Fix inconsistencies in duplicate retrieval + ([15160](https://github.com/civicrm/civicrm-core/pull/15160))** + + Ensures the API call `Dedupe.getduplicates` respects both 'limit' and + 'search_limit' parameters. + +- **Error log improvements: Provide priority level + ([14995](https://github.com/civicrm/civicrm-core/pull/14995))** + + Improves error logging by adding the ability to pass a priority level argument + to `CRM_Core_Error::debug_var()`. + +- **Improve deadlock error handling + ([258](https://github.com/civicrm/civicrm-packages/pull/258))** + + Improves deadlock error handling by capturing the error when the deadlock is + first hit so the backtrace is retained. + +- **Better error handling in CRM_Utils_JS::decode + ([15145](https://github.com/civicrm/civicrm-core/pull/15145))** + + Improves handling of malformed Javascript so as to reduce PHP notices. + +- **Replace some calls to CRM_Core_Error::fatal with exceptions + ([15156](https://github.com/civicrm/civicrm-core/pull/15156))** + + Instead of exiting with a fatal error, certain dedupe error situations now + throw an exception. + +### CiviEvent + +- **Creating an event clears the cache + ([dev/event#14](https://lab.civicrm.org/dev/event/issues/14): + [15140](https://github.com/civicrm/civicrm-core/pull/15140))** + + This change improves performance by not clearing caches every time an event is + created. + +### CiviMembership + +- **Convert jcalendar date fields to date picker for membership fields to + support date picker conversion + ([15177](https://github.com/civicrm/civicrm-core/pull/15177), + [15186](https://github.com/civicrm/civicrm-core/pull/15186), + [15198](https://github.com/civicrm/civicrm-core/pull/15198) and + [15200](https://github.com/civicrm/civicrm-core/pull/15200))** + + Date fields on membership search screens now use datepicker rather than + jCalendar. + + The `join_date` column on the `civicrm_membership` table is now keyed as + `membership_join_date` within the DAO in order to support the change to date + picker format for Membership date fields. + +- **Add default domain to membershiptype API + ([15120](https://github.com/civicrm/civicrm-core/pull/15120))** + + The domain ID now defaults to the current domain when using the membership + type API. + +- **Fix readability & caching on + CRM_Contact_BAO_Relationship::isInheritedMembershipInvalidated + ([15061](https://github.com/civicrm/civicrm-core/pull/15061))** + + Improves caching and performance when calculating inherited memberships. + +### CiviPledge + +- **Update Pledge XML to support date picker conversion + ([15180](https://github.com/civicrm/civicrm-core/pull/15180))** + + Updates the XML and associated files to support the change to date picker + format for Pledge date fields. + +### Backdrop Integration + +- **Fail more gracefully when upgrading on PHP5.x + ([98](https://github.com/civicrm/civicrm-backdrop/pull/98))** + + Provides a clearer error when someone tries to upgrade with PHP 5.x. + +### Drupal Integration + +- **Automatically tag the drupal-8 repository + (Work Towards [dev/release#9](https://lab.civicrm.org/dev/release/issues/9): + [15149](https://github.com/civicrm/civicrm-core/pull/15149))** + + Continues work to automatically tag a Drupal8 version when new CiviCRM + versions are released as is done for other CMS's. + +- **Error when upgrading to 5.16.0 + ([dev/drupal#79](https://lab.civicrm.org/dev/drupal/issues/79): + [583](https://github.com/civicrm/civicrm-drupal/pull/583))** + + Provides a clearer error when someone tries to upgrade with PHP 5.x. + +## <a name="bugs"></a>Bugs resolved + +### Core CiviCRM + +- **Warnings on importing contacts - PHP 7.2 + (Work Towards [dev/core#772](https://lab.civicrm.org/dev/core/issues/772): + [262](https://github.com/civicrm/civicrm-packages/pull/262))** + + This fixes a PHP warning on PHP 7.2 using hierarchical select fields, such as + selecting the matching fields for import columns. Some fields have no fields + nested below them, and those would trigger an error on the `count()` function. + +- **Warnings on CRM_Contribute_Import_Parser re countable + ([dev/core#1001](https://lab.civicrm.org/dev/core/issues/1001): + [14989](https://github.com/civicrm/civicrm-core/pull/14989))** + + Fixes a few PHP 7.2 count warnings when importing. + +- **Changing the label for the Inbound Email activity type lets you edit/delete + them even if the permission disallows + ([dev/core#1123](https://lab.civicrm.org/dev/core/issues/1123): + [15240](https://github.com/civicrm/civicrm-core/pull/15240) and + [15147](https://github.com/civicrm/civicrm-core/pull/15147))** + +- **Regression: Can't use CiviCRM menu on 5.16.0 + ([dev/core#1182](https://lab.civicrm.org/dev/core/issues/1182): + [15020](https://github.com/civicrm/civicrm-core/pull/15020) and + [15019](https://github.com/civicrm/civicrm-core/pull/15019))** + + Fixes a bug in CiviCRM 5.16.0 where a race condition was causing the CiviCRM + Admin Menu to break. + +- **csv import only import one phone number + ([dev/core#1187](https://lab.civicrm.org/dev/core/issues/1187): + [15190](https://github.com/civicrm/civicrm-core/pull/15190))** + + Fixes a bug whereby one phone number is not imported if 2 of the same location + type but different phone types are in an import. + +- **Fix Psalm issue Class or interface CiviCRM_API3_Exception does not exist + ([dev/core#1188](https://lab.civicrm.org/dev/core/issues/1188): + [15043](https://github.com/civicrm/civicrm-core/pull/15043))** + + Ensures that the Psalm Autoloader can find `CiviCRM_API3_Exception`. + +- **File attachment uploads - pptx issue + ([dev/core#1190](https://lab.civicrm.org/dev/core/issues/1190): + [15239](https://github.com/civicrm/civicrm-core/pull/15239))** + + Fixes the upgrade function for adding ".pptx" to the list of safe file types. + +- **ENOTICE when creating activity from contact search results / aka Repeat + Activity accordion section missing when using Add Activity from contact search + results ([dev/core#1192](https://lab.civicrm.org/dev/core/issues/1192): + [15079](https://github.com/civicrm/civicrm-core/pull/15079))** + + Fixes a PHP notice when using the "Add Activity" action from the contact + search results list. + +- **CiviCRM Dashboard does not respect multiple domains + ([dev/core#1200](https://lab.civicrm.org/dev/core/issues/1200): + [15099](https://github.com/civicrm/civicrm-core/pull/15099))** + + For sites with multisite enabled ensures that the CiviCRM Dashboard respects + multiple domains and shows unique dashlets depending on what domain you are + using. + +- **Contact subtype is removed after being cached incorrectly + ([dev/core#1222](https://lab.civicrm.org/dev/core/issues/1222): + [15171](https://github.com/civicrm/civicrm-core/pull/15171))** + + Ensures the static cache is cleared whenever updating or deleting a DAO + object. + +- **Regression: Searching on Email broken in advanced search + ([dev/core#1244](https://lab.civicrm.org/dev/core/issues/1244): + [15255](https://github.com/civicrm/civicrm-core/pull/15255))** + + This fixes a problem where attempting to search on email on the Advanced + search form resulted in a warning and no results. + +- **Trim form values when adding LIKE operator + ([15275](https://github.com/civicrm/civicrm-core/pull/15275))** + + Fixes a 5.17 regression whereby the email string is no longer being trimmed + when searching. + +- **Ensure filtering on email via the api looks for an exact match + ([15276](https://github.com/civicrm/civicrm-core/pull/15276))** + + Fixes a released regression whereby a wildcard was being added to API + Contact.get requests with the email parameter. + +- **Fix fatal when saving import mapping with a relationship but 'Primary' + location type ([15115](https://github.com/civicrm/civicrm-core/pull/15115))** + + When an import column was mapped to a field with the "Primary" location type + that was on a related contact, it would result in a fatal error. + +- **Fix export header for 'Contact ID' + ([15118](https://github.com/civicrm/civicrm-core/pull/15118))** + + This ensures when exporting a contact id column the header is "Contact ID" not + "contact_id". + +- **Changed ClassName for ACL cache + ([15193](https://github.com/civicrm/civicrm-core/pull/15193))** + + Ensures `civicrm_acl_cache` and `civicrm_cache` use different entity names. + +- **Set contact communication_style_id as importable + ([15205](https://github.com/civicrm/civicrm-core/pull/15205))** + + Ensures the "Contact Communication Style" is visible in profile view mode. + +- **Incorporate searchLimit in dedupe cacheKey + ([15185](https://github.com/civicrm/civicrm-core/pull/15185))** + + When you change the search limit after a duplicate search has been performed, + this ensures that a new search is run. + +- **Allow for the deselection of sorting filters + ([15029](https://github.com/civicrm/civicrm-core/pull/15029))** + + Fixes a bug where removing sorting filters on reports and refreshing the + results would nevertheless retain the sorting filters. + +- **CRM_Utils_Array::crmInArray() should recurse properly + ([dev/core#1196](https://lab.civicrm.org/dev/core/issues/1196): + [15092](https://github.com/civicrm/civicrm-core/pull/15092))** + +- **Add ts() to deceased string + ([15211](https://github.com/civicrm/civicrm-core/pull/15211))** + + The word "deceased" when appended to a contact's name is now translatable. + +- **Fatal Error in "Search Builder" if "Household" Contact type is disabled. + ([dev/core#1246](https://lab.civicrm.org/dev/core/issues/1246): + [15289](https://github.com/civicrm/civicrm-core/pull/15289))** + +- **Do not show Activity Separation on when viewing an Activity + ([15046](https://github.com/civicrm/civicrm-core/pull/15046))** + + The option to create separate activities for each contact, only applicable + when creating a new activity, would erroneously appear when viewing an + activity. + +- **Activity profile on Update multiple activities action displays duplicate + assignees ([dev/core#1185](https://lab.civicrm.org/dev/core/issues/1185): + [15035](https://github.com/civicrm/civicrm-core/pull/15035))** + + The list of assignees would display all of the assignees for each previous row + in addition to the assignee(s) for that activity. + +- **Ensure that civicrm_dashboard has a foreign key to civicrm_domain + ([15119](https://github.com/civicrm/civicrm-core/pull/15119))** + +- **Manage Group search message fix + ([15052](https://github.com/civicrm/civicrm-core/pull/15052))** + + When no the group listing is filtered and no groups match the criteria, the + message says that more clearly rather than stating there are no groups on the + site. + +### CiviCampaign + +- **Actions in campaign dashboard not working with pop-up disabled + ([dev/core#1233](https://lab.civicrm.org/dev/core/issues/1233): + [15233](https://github.com/civicrm/civicrm-core/pull/15233))** + + Ensures users with pop ups deactivated can edit and delete campaigns. + +### CiviCase + +- **Proposal to fix longstanding name vs label problems for case roles (Work + Towards [dev/core#1046](https://lab.civicrm.org/dev/core/issues/1046): + [15192](https://github.com/civicrm/civicrm-core/pull/15192) and + [15182](https://github.com/civicrm/civicrm-core/pull/15182))** + + These changes work towards fixing the label being used as the name in some + places in CiviCase by allowing for an override tag in the xml to specify the + actual "name". + +- **Changing a civicase activity's label breaks the max_instances check + (Work Towards [dev/core#1116](https://lab.civicrm.org/dev/core/issues/1116): + [14999](https://github.com/civicrm/civicrm-core/pull/14999), + [15002](https://github.com/civicrm/civicrm-core/pull/15002), + [15000](https://github.com/civicrm/civicrm-core/pull/15000) and + [15032](https://github.com/civicrm/civicrm-core/pull/15032))** + + Refactors and cleans up code in preparation for fixing a bug where CiviCase + activity's label breaks the max_instances check. + +- **Fix search for case tags that are part of tag sets + ([15212](https://github.com/civicrm/civicrm-core/pull/15212))** + + Fixes a DB Error when searching for tags that are a part of a tag set. + +- **Switch to relationship BAO when modifying relationships in change case + status so we don't bypass hooks + ([15030](https://github.com/civicrm/civicrm-core/pull/15030))** + +- **Word Replacements not working on manage case Roles + ([dev/core#1218](https://lab.civicrm.org/dev/core/issues/1218): + [15161](https://github.com/civicrm/civicrm-core/pull/15161))** + +### CiviContribute + +- **Renaming a price option / fee level breaks event participant lists + ([CRM-17182](https://issues.civicrm.org/jira/browse/CRM-17182): + [15064](https://github.com/civicrm/civicrm-core/pull/15064) and + [15350](https://github.com/civicrm/civicrm-core/pull/15350))** + + Fixes a bug where the `fee_amount` was being changed whenever a label was + changed and moves from searching based on regex on the `fee_amount` column to + searching based on the `price_field_value` id. + +- **Add pre/post hooks for price set / field/option + ([dev/core#870](https://lab.civicrm.org/dev/core/issues/870): + [15076](https://github.com/civicrm/civicrm-core/pull/15076))** + + The `hook_civicrm_pre` and `hook_civicrm_post` hooks get invoked when adding + price sets, fields, and options. + +- **Event/Contribution amounts are duplicated when the form is saved + ([dev/core#1240](https://lab.civicrm.org/dev/core/issues/1240): + [15245](https://github.com/civicrm/civicrm-core/pull/15245))** + + Fixes a bug where saving the "amounts" tab of either an event or contribution + page (when using that form to enter options, rather than a price set) results in the + duplication of the amount options listed. + +- **Fix PayPalImpl Contribution Status PseudoConstant for non-English + ([15164](https://github.com/civicrm/civicrm-core/pull/15164))** + + Ensures contribution statuses are set correctly for sites using PayPal Express + and a language other than English by switching to using the name property + instead of the label. + +- **Fix an HTML error in Calculate.tpl + ([15102](https://github.com/civicrm/civicrm-core/pull/15102))** + + This resolves a `<span>` that was not closed correctly on the calculation of a + price set's total amount due. + +- **Use api to create activity and removed hardcoded status id + ([14621](https://github.com/civicrm/civicrm-core/pull/14621))** + + When exporting an accounting batch, the activity that is created is now done + so using the API, and it uses the status name `Completed` rather than a + hard-coded status ID `2`. + +- **Fix wrong variable in check for profiles on contributionpage + ([15093](https://github.com/civicrm/civicrm-core/pull/15093))** + + Ensures the correct variable is being checked for pre profile types when + configuring a Contribution Page. + +- **Batch payment page breaks when an exported activity has no file to download + ([dev/financial#58](https://lab.civicrm.org/dev/financial/issues/58): + [14367](https://github.com/civicrm/civicrm-core/pull/14367))** + +- **Stop adding a refund payment from creating extraneous financial items + ([15143](https://github.com/civicrm/civicrm-core/pull/15143))** + +### CiviEvent + +- **Most recent contact note exposed in event confirmation emails + ([dev/event#10](https://lab.civicrm.org/dev/event/issues/10): + [15060](https://github.com/civicrm/civicrm-core/pull/15060))** + + Fixes a bug where when submitting an event registration which contains a + profile which contains a note field. If the note was left blank, then the + confirmation/notification emails would contain the most recent note in the + contact's record, potentially exposing confidential information. + +- **Custom field values for a new Event based on an Event Template are not + checked causing false validation message and Event not to + save ([dev/core#1241](https://lab.civicrm.org/dev/core/issues/1241): + [15296](https://github.com/civicrm/civicrm-core/pull/15296))** + +- **Confirmation emails include flawed subtitle for post-profiles + ([dev/event#15](https://lab.civicrm.org/dev/event/issues/15): [#15380](https://github.com/civicrm/civicrm-core/pull/15380))** + + Fixes a regression from 5.17.0 when sending a confirmation email. + The confirmation email includes subsections to summarize any + post-profile data, but the title was miscomputed. This manifested + as either a page crash or an inaccurate title. + +### CiviGrant + +- **Grant in Edit mode doesn't show the associated contact + ([dev/core#1065](https://lab.civicrm.org/dev/core/issues/1065): + [15238](https://github.com/civicrm/civicrm-core/pull/15238) and + [15209](https://github.com/civicrm/civicrm-core/pull/15209))** + + Ensures that the associated contact field is shown when editing a grant. + +- **Fixes for taking dynamic form name in grant search + ([15075](https://github.com/civicrm/civicrm-core/pull/15075))** + + This removes the hard-coded form name when retrieving the search results in + preparation for a search action. + +### CiviMail + +- **SMTP help text is misleading - references the wrong admin screen + ([dev/core#879](https://lab.civicrm.org/dev/core/issues/879): + [15165](https://github.com/civicrm/civicrm-core/pull/15165))** + + Fixes up the help text displayed when testing the SMTP configuration fails. + +- **Remove template field if using Mosaico in non shoreditch mode + ([14927](https://github.com/civicrm/civicrm-core/pull/14927))** + +### CiviMember + +- **Fix metadata on member export + ([14916](https://github.com/civicrm/civicrm-core/pull/14916))** + + Ensures when exporting memberships headings are set appropriately for the + following columns: `member_is_override`, `membership_recur_id` and + `max_related`. + +- **Incorrect line item created for back-end membership sign-up using price set + and CiviDiscount ([dev/core#860](https://lab.civicrm.org/dev/core/issues/860): + [15004](https://github.com/civicrm/civicrm-core/pull/15004))** + +- **[regression] Recurring contributions no longer properly update memberships + (on PayPal Pro, maybe others) + ([dev/membership#13](https://lab.civicrm.org/dev/membership/issues/13): + [15053](https://github.com/civicrm/civicrm-core/pull/15053))** + +- **Make sure inherited memberships are not themselves inherited + ([15114](https://github.com/civicrm/civicrm-core/pull/15114))** + + This prevents contacts from inheriting memberships that were inherited from + them. + +- **{Membership.Fee} appears on Membership Renewal Reminder emails with 9 + decimal places ([dev/core#377](https://lab.civicrm.org/dev/core/issues/377): + [14992](https://github.com/civicrm/civicrm-core/pull/14992))** + +### Drupal Integration + +- **Drupal8: getUrlPath: avoid relying on the deprecated 'q' variable + (Work Towards [dev/drupal#52](https://lab.civicrm.org/dev/drupal/issues/52): + [15268](https://github.com/civicrm/civicrm-core/pull/15268))** + + In Drupal8, the 'q' variable has been deprecated which has resulted in CiviCRM + throwing a bunch of PHP notices. This PR silences those notices while a more + long term fix is developed. + +### Joomla Integration + +- **Some error messages render a chunk of markup as plain text + ([dev/joomla#10](https://lab.civicrm.org/dev/joomla/issues/10): + [15159](https://github.com/civicrm/civicrm-core/pull/15159))** + + Removes Joomla-specific error display and use native CiviCRM display to avoid + some error messages rendering as plain text. + +- **PHP 7.2 countable warning after installation + ([dev/joomla#15](https://lab.civicrm.org/dev/joomla/issues/15): + [53](https://github.com/civicrm/civicrm-joomla/pull/53))** + +- **[Joomla 4.0] CiviCRM's CSS interferes with Joomla's top header background + colour ([dev/joomla#24](https://lab.civicrm.org/dev/joomla/issues/24): + [15137](https://github.com/civicrm/civicrm-core/pull/15137))** + +## <a name="misc"></a>Miscellany + +- **Swap CRM_Utils_Array::value for empty() in conditionals + ([15005](https://github.com/civicrm/civicrm-core/pull/15005))** + +- **Possible timing issue with test phpunit/api/v3/AttachmentTest::testCreate + ([dev/core#938](https://lab.civicrm.org/dev/core/issues/938): + [15216](https://github.com/civicrm/civicrm-core/pull/15216))** + +- **Change connection and results charsets to utf8mb4 on MySQL 5.5.3+ + ([241](https://github.com/civicrm/civicrm-packages/pull/241))** + +- **Fix upgrade version for #13487 + ([15031](https://github.com/civicrm/civicrm-core/pull/15031))** + +- **Update select2 to latest 3.x + patches + ([15054](https://github.com/civicrm/civicrm-core/pull/15054))** + +- **Further work on payment.create consolidation - always handle financials from + payment.create ([14673](https://github.com/civicrm/civicrm-core/pull/14673))** + +- **Extract function to create email activity when sending an email to contact + ([15133](https://github.com/civicrm/civicrm-core/pull/15133))** + +- **Extract cancelParticipant and cancelMembership functions in baseIPN + ([15134](https://github.com/civicrm/civicrm-core/pull/15134))** + +- **Rewrite subTypeInfo to use caching mechanism + ([14715](https://github.com/civicrm/civicrm-core/pull/14715))** + +- **providing clear indication that civicrm_engage module is deprecated. + ([582](https://github.com/civicrm/civicrm-drupal/pull/582))** + +- **distmaker - Finish migrating bower.json => composer.json + ([15148](https://github.com/civicrm/civicrm-core/pull/15148))** + +- **Switch recordAdditionalPayment fully over to api + ([14408](https://github.com/civicrm/civicrm-core/pull/14408))** + +- **Add note about testRenewMembership failing on certain days + ([15167](https://github.com/civicrm/civicrm-core/pull/15167))** + +- **Someimes ya just gotta say enough already + ([15175](https://github.com/civicrm/civicrm-core/pull/15175))** + +- **Extend loadSavedMapping to check defaults + ([15179](https://github.com/civicrm/civicrm-core/pull/15179))** + +- **Initial refactor of BaseIPN + ([15129](https://github.com/civicrm/civicrm-core/pull/15129))** + +- **Convert pledge date fields to use datepicker rather than jcalendar + ([15170](https://github.com/civicrm/civicrm-core/pull/15170))** + +- **Use metadata for pledgeDateRange fields + ([15191](https://github.com/civicrm/civicrm-core/pull/15191))** + +- **Add minimal test for testExportFinancialBatch + ([15136](https://github.com/civicrm/civicrm-core/pull/15136))** + +- **Code cleanup in CRM_Core_Permission::check + ([15141](https://github.com/civicrm/civicrm-core/pull/15141))** + +- **Event confirm - (very) minor cleanup + test + ([15010](https://github.com/civicrm/civicrm-core/pull/15010))** + +- **Stabalize Attachment API Test + ([15066](https://github.com/civicrm/civicrm-core/pull/15066))** + +- **Remove ?last? instances of ->free() + ([dev/core#562](https://lab.civicrm.org/dev/core/issues/562): + [14990](https://github.com/civicrm/civicrm-core/pull/14990))** + +- **Add myself to the contributor list + ([15036](https://github.com/civicrm/civicrm-core/pull/15036))** + +- **Remove silly dumb unreachable lines + ([15033](https://github.com/civicrm/civicrm-core/pull/15033))** + +- **Deprecate CRM_Core_Config::addressSequence() + ([15126](https://github.com/civicrm/civicrm-core/pull/15126))** + +- **Deprecate CRM_Core_Config::defaultContactCountry and + defaultContactCountryName + ([15127](https://github.com/civicrm/civicrm-core/pull/15127))** + +- **Use metadata for dataPatterns + ([15224](https://github.com/civicrm/civicrm-core/pull/15224))** + +- **SyntaxConformanceTest::testSqlOperators - Skip "Dedupe" entity on MySQL 5.5 + ([15234](https://github.com/civicrm/civicrm-core/pull/15234))** + +- **Add in 5.17.1 Release notes and migrate .tpl file for 5.17.1 to 5.18 to + support upgrade + ([15253](https://github.com/civicrm/civicrm-core/pull/15253))** + +- **(NFC) Add comments to relate to gitlab ticket + ([dev/core#927](https://lab.civicrm.org/dev/core/issues/927): + [15128](https://github.com/civicrm/civicrm-core/pull/15128))** + +- **Remove unused method CRM_Contact_BAO_Contact_Utils::maxLocations + ([15091](https://github.com/civicrm/civicrm-core/pull/15091))** + +- **Remove unused Selenium binaries + ([263](https://github.com/civicrm/civicrm-packages/pull/263))** + +- **Remove a few unused scripts from tools/bin/scripts + ([15078](https://github.com/civicrm/civicrm-core/pull/15078))** + +- **Remove deprecated unused function. + ([15070](https://github.com/civicrm/civicrm-core/pull/15070))** + +- **Remove unused skipRedirect param + ([15125](https://github.com/civicrm/civicrm-core/pull/15125))** + +- **[clean up][ export] Remove membership_auto_renew from defaultReturn + properties ([14980](https://github.com/civicrm/civicrm-core/pull/14980))** + +- **[Ref] [Import] Use processor to determine website type, location type, test + ([15116](https://github.com/civicrm/civicrm-core/pull/15116))** + +- **[Import] [ref] - minor cleanup to reduce code complexity + ([15097](https://github.com/civicrm/civicrm-core/pull/15097))** + +- **[ref] [ import] Extend tests & simpler retrieval to relationship_type_id + ([15130](https://github.com/civicrm/civicrm-core/pull/15130))** + +- **[REF] Import - minor cleanup - generate js on the processor class + ([15183](https://github.com/civicrm/civicrm-core/pull/15183))** + +- **[Import] Minor cleanup on membership import + ([15013](https://github.com/civicrm/civicrm-core/pull/15013))** + +- **[Import][ref] Minor code improvement - move setDefaults to processor + ([15189](https://github.com/civicrm/civicrm-core/pull/15189))** + +- **[Ref] [Import] more code cleanup + ([15219](https://github.com/civicrm/civicrm-core/pull/15219))** + +- **[Ref] [Import] Final round in the cleanup Load Mapping form epic + ([15226](https://github.com/civicrm/civicrm-core/pull/15226))** + +- **[Import] [REF] code cleanup & test on the code to 'guess the intended + field from the column name' + ([15220](https://github.com/civicrm/civicrm-core/pull/15220))** + +- **[REF] [Import] Minor cleanup on status setting. + ([15015](https://github.com/civicrm/civicrm-core/pull/15015))** + +- **[REF] [Import] extract saved mapping code to parent class + ([15017](https://github.com/civicrm/civicrm-core/pull/15017))** + +- **[Import] [Cleanup] remove unused parameters + ([14981](https://github.com/civicrm/civicrm-core/pull/14981))** + +- **[Ref] [Import] move metadata calculations to a trait + ([15018](https://github.com/civicrm/civicrm-core/pull/15018))** + +- **[Test] [Ref] [Import]Add wrapper class for importProcessor + ([15028](https://github.com/civicrm/civicrm-core/pull/15028))** + +- **Refactor CRM_Contact_BAO_Relationship::add to autoload missing params from + existing record ([15103](https://github.com/civicrm/civicrm-core/pull/15103) + and [15123](https://github.com/civicrm/civicrm-core/pull/15123))** + +- **[Ref] Extract addInheritedMembership + ([15113](https://github.com/civicrm/civicrm-core/pull/15113))** + +- **[REF] minor code refactor on import - Pass ProcessorObject into + loadSavedMapping & use it to load the formName + ([15068](https://github.com/civicrm/civicrm-core/pull/15068))** + +- **Minor refactor of 'Pending' parameter for processMembership + ([15124](https://github.com/civicrm/civicrm-core/pull/15124))** + +- **[REF] Very minor code cleanup on import code with good test cover + ([15173](https://github.com/civicrm/civicrm-core/pull/15173))** + +- **[REF] Move clone template functionality from api to bao + ([15163](https://github.com/civicrm/civicrm-core/pull/15163))** + +- **[REF] Extract chunk of code relating to whether to disabled an inherited + relationship ([14955](https://github.com/civicrm/civicrm-core/pull/14955))** + +- **[REF] Move calculation of js for import fields WITH relationship keys to + processor. ([15218](https://github.com/civicrm/civicrm-core/pull/15218))** + +- **[Datepicker][REF] Convert mailing date field on mailing search screen… + ([15181](https://github.com/civicrm/civicrm-core/pull/15181))** + +- **[Ref] Import use process for relationship defaults, add test + ([15215](https://github.com/civicrm/civicrm-core/pull/15215))** + +- **[REF] extract send receipt in MembershipRenewal fn + ([15117](https://github.com/civicrm/civicrm-core/pull/15117))** + +- **[NFC] Fix test syntax + ([15067](https://github.com/civicrm/civicrm-core/pull/15067))** + +- **[NFC] swap instances where double = is used but it should be triple = + ([15049](https://github.com/civicrm/civicrm-core/pull/15049))** + +- **[NFC] Update Upgrade Template to use short array syntax + ([15057](https://github.com/civicrm/civicrm-core/pull/15057))** + +- **[NFC] Remove redundant annotation + ([15172](https://github.com/civicrm/civicrm-core/pull/15172))** + +- **(NFC) assertPhpSupport - Code cleanup + ([164](https://github.com/civicrm/civicrm-wordpress/pull/164))** + +- **(NFC) civicrm.drush.inc - Cleanup style + ([99](https://github.com/civicrm/civicrm-backdrop/pull/99))** + +- **[NFC] Update Default report instances that filter on join date to be … + ([15247](https://github.com/civicrm/civicrm-core/pull/15247))** + +- **[NFC] Add ImportProcessor class & unit tests + extend existing cover + ([15072](https://github.com/civicrm/civicrm-core/pull/15072))** + +- **[NFC] Update the APIv3 documentation links. + ([15077](https://github.com/civicrm/civicrm-core/pull/15077))** + +- **(NFC) GenericAssertionsTrait - Improve docblocks + ([15071](https://github.com/civicrm/civicrm-core/pull/15071))** + +- **[NFC] Update Examples + ([15085](https://github.com/civicrm/civicrm-core/pull/15085))** + +- **[Test] [NFC] upgrade remaining export tests + ([15095](https://github.com/civicrm/civicrm-core/pull/15095))** + +- **[Test] Bring to life dormant test + ([15150](https://github.com/civicrm/civicrm-core/pull/15150))** + +- **[TEST] Enable apiv4 testing for GroupNesting and GroupOrganization entities + ([15217](https://github.com/civicrm/civicrm-core/pull/15217))** + +- **[Test] Demonstrate the truthiness of CRM_Utils_System::isNull + ([15027](https://github.com/civicrm/civicrm-core/pull/15027))** + +- **Unit test for custom date parsing + ([14988](https://github.com/civicrm/civicrm-core/pull/14988))** + +- **[NFC] [Test] dev/core#1098 Add unit test & code comments relating to the + slow activity search + ([15016](https://github.com/civicrm/civicrm-core/pull/15016))** + +- **[Import] [Test] Initial test on loadSavedMapping function. + ([15050](https://github.com/civicrm/civicrm-core/pull/15050))** + +- **[Test] Tolerance parameter in attachmenttest needs to be one higher for + integers ([15069](https://github.com/civicrm/civicrm-core/pull/15069))** + +- **[Test] Fix Last_name in CiviUnitTestCase::activityCreate + ([15112](https://github.com/civicrm/civicrm-core/pull/15112))** + +- **test for PR + ([15121](https://github.com/civicrm/civicrm-core/pull/15121))** + +## <a name="credits"></a>Credits + +This release was developed by the following code authors: + +19ATF77; AGH Strategies - Andrew Hunt; Agileware - Justin Freeman; Andrew +Thompson; Australian Greens - Seamus Lee; Caltha - Tomasz Pietrzkowski; +Christian Wach; Circle Interactive - Dave Jenkins, Pradeep Nayak, Reece Benson; +CiviCoop - Jaap Jansma; CiviCRM - Coleman Watts, Tim Otten; CiviDesk - Yashodha +Chaku; Coop SymbioTIC - Mathieu Lutfy; Dave D; Electronic Frontier Foundation - +Mark Burdett; Florian Kohrt; Greenpeace CEE - Patrick Figel; JMA Consulting - +Monish Deb; John Kingsnorth; Megaphone Technology Consulting - Jon Goldberg; MJW +Consulting - Matthew Wire; mmyriam; Onyemenam Ndubuisi; Progressive Technology +Project - Jamie McClelland; Tadpole Collective - Kevin Cristiano; Wikimedia +Foundation - Eileen McNaughton + +Most authors also reviewed code for this release; in addition, the following +reviewers contributed their comments: + +AGH Strategies - Alice Frumin; Agileware - Francis Whittle, Pengyi Zhang; +don-alejandro-z; Fuzion - Jitendra Purohit; iXiam - Luciano Spiegel; JMA +Consulting - Joe Murray; Nicol Wistreich; Semper IT - Karin Gerritsen; Squiffle +Consulting - Aidan Saunders; + +## <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/civicrm/sql/civicrm.mysql b/civicrm/sql/civicrm.mysql index a3cf1c0588..14488af243 100644 --- a/civicrm/sql/civicrm.mysql +++ b/civicrm/sql/civicrm.mysql @@ -764,6 +764,12 @@ CREATE TABLE `civicrm_contact` ( , sort_name , id ) + , INDEX `index_created_date`( + created_date + ) + , INDEX `index_modified_date`( + modified_date + ) , CONSTRAINT FK_civicrm_contact_primary_contact_id FOREIGN KEY (`primary_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL, CONSTRAINT FK_civicrm_contact_employer_id FOREIGN KEY (`employer_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; @@ -1732,7 +1738,7 @@ CREATE TABLE `civicrm_cxn` ( CREATE TABLE `civicrm_cache` ( - `id` int unsigned NOT NULL AUTO_INCREMENT , + `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique table ID', `group_name` varchar(32) NOT NULL COMMENT 'group name for cache element, useful in cleaning cache elements', `path` varchar(255) COMMENT 'Unique path name for cache element', `data` longtext COMMENT 'data associated with this path', @@ -3381,7 +3387,7 @@ CREATE TABLE `civicrm_dashboard` ( PRIMARY KEY (`id`) -, CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`) +, CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- /******************************************************* diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql index 375e6eec42..204eacab44 100644 --- a/civicrm/sql/civicrm_data.mysql +++ b/civicrm/sql/civicrm_data.mysql @@ -6437,7 +6437,7 @@ INSERT INTO civicrm_uf_field ( 10, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, 'Soft Credit', 'Contribution', NULL, NULL ), ( 10, 'soft_credit_type', 0, 0, 11, 'User and User Admin Only', 0, 0, NULL, 'Soft Credit Type', 'Contribution', NULL, NULL ), ( 11, 'membership_type', 1, 1, 1, 'User and User Admin Only', 0, 0, NULL, 'Membership Type', 'Membership', NULL, NULL ), - ( 11, 'join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, 'Member Since', 'Membership', NULL, NULL ), + ( 11, 'membership_join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, 'Member Since', 'Membership', NULL, NULL ), ( 11, 'membership_start_date', 0, 1, 3, 'User and User Admin Only', 0, 0, NULL, 'Start Date', 'Membership', NULL, NULL ), ( 11, 'membership_end_date', 0, 1, 4, 'User and User Admin Only', 0, 0, NULL, 'End Date', 'Membership', NULL, NULL ), ( 11, 'membership_source', 0, 0, 5, 'User and User Admin Only', 0, 0, NULL, 'Source', 'Membership', NULL, NULL ), @@ -23970,17 +23970,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) @@ -24050,4 +24050,4 @@ INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES ( @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}'); -UPDATE civicrm_domain SET version = '5.17.5'; +UPDATE civicrm_domain SET version = '5.18.0'; diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql index 96b54b644d..570e310bdf 100644 --- a/civicrm/sql/civicrm_generated.mysql +++ b/civicrm/sql/civicrm_generated.mysql @@ -399,7 +399,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_domain` WRITE; /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */; -INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.17.5',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.18.0',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}'); /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */; UNLOCK TABLES; @@ -1289,7 +1289,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_report_instance` WRITE; /*!40000 ALTER TABLE `civicrm_report_instance` DISABLE KEYS */; -INSERT INTO `civicrm_report_instance` (`id`, `domain_id`, `title`, `report_id`, `name`, `args`, `description`, `permission`, `grouprole`, `form_values`, `is_active`, `created_id`, `owner_id`, `email_subject`, `email_to`, `email_cc`, `header`, `footer`, `navigation_id`, `drilldown_id`, `is_reserved`) VALUES (1,1,'Constituent Summary','contact/summary',NULL,NULL,'Provides a list of address and telephone information for constituent records in your system.','view all contacts',NULL,'a:31:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:14:\"street_address\";s:1:\"1\";s:4:\"city\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:92:\"Provides a list of address and telephone information for constituent records in your system.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(2,1,'Constituent Detail','contact/detail',NULL,NULL,'Provides contact-related information on contributions, memberships, events and activities.','view all contacts',NULL,'a:25:{s:6:\"fields\";a:30:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:15:\"contribution_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:13:\"membership_id\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:20:\"membership_status_id\";s:1:\"1\";s:14:\"participant_id\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:21:\"participant_status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";s:25:\"participant_register_date\";s:1:\"1\";s:9:\"fee_level\";s:1:\"1\";s:10:\"fee_amount\";s:1:\"1\";s:15:\"relationship_id\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:12:\"contact_id_b\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:7:\"subject\";s:1:\"1\";s:17:\"source_contact_id\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:18:\"activity_status_id\";s:1:\"1\";s:17:\"target_contact_id\";s:1:\"1\";s:19:\"assignee_contact_id\";s:1:\"1\";}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:90:\"Provides contact-related information on contributions, memberships, events and activities.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(3,1,'Activity Details','activity',NULL,NULL,'Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)','view all contacts',NULL,'a:26:{s:6:\"fields\";a:6:{s:16:\"contact_assignee\";s:1:\"1\";s:14:\"contact_target\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:16:\"activity_subject\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:17:\"contact_source_op\";s:3:\"has\";s:20:\"contact_source_value\";s:0:\"\";s:19:\"contact_assignee_op\";s:3:\"has\";s:22:\"contact_assignee_value\";s:0:\"\";s:17:\"contact_target_op\";s:3:\"has\";s:20:\"contact_target_value\";s:0:\"\";s:15:\"current_user_op\";s:2:\"eq\";s:18:\"current_user_value\";s:1:\"0\";s:27:\"activity_date_time_relative\";s:10:\"this.month\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_subject_op\";s:3:\"has\";s:22:\"activity_subject_value\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:11:\"description\";s:126:\"Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"group_bys\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(4,1,'Current Employers','contact/currentEmployer',NULL,NULL,'Provides detail list of employer employee relationships along with employment details.','view all contacts',NULL,'a:33:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:9:\"job_title\";s:1:\"1\";s:10:\"start_date\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:19:\"start_date_relative\";s:1:\"0\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:98:\"Provides detail list of employer employee relationships along with employment details Ex Join Date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(5,1,'Relationships','contact/relationship',NULL,NULL,'Gives relationship details between two contacts','view all contacts',NULL,'a:28:{s:6:\"fields\";a:4:{s:11:\"sort_name_a\";s:1:\"1\";s:11:\"sort_name_b\";s:1:\"1\";s:9:\"label_a_b\";s:1:\"1\";s:9:\"label_b_a\";s:1:\"1\";}s:14:\"sort_name_a_op\";s:3:\"has\";s:17:\"sort_name_a_value\";s:0:\"\";s:14:\"sort_name_b_op\";s:3:\"has\";s:17:\"sort_name_b_value\";s:0:\"\";s:17:\"contact_type_a_op\";s:2:\"in\";s:20:\"contact_type_a_value\";a:0:{}s:17:\"contact_type_b_op\";s:2:\"in\";s:20:\"contact_type_b_value\";a:0:{}s:12:\"is_active_op\";s:2:\"eq\";s:15:\"is_active_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:19:\"Relationship Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(6,1,'Activity Summary','activitySummary',NULL,NULL,'Shows activity statistics by type / date','view all contacts',NULL,'a:26:{s:6:\"fields\";a:4:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:8:\"duration\";s:1:\"1\";s:2:\"id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:27:\"activity_date_time_relative\";s:0:\"\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:14:\"priority_id_op\";s:2:\"in\";s:17:\"priority_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"group_bys\";a:2:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:18:\"activity_date_time\";s:5:\"MONTH\";}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:16:\"activity_type_id\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:40:\"Shows activity statistics by type / date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(7,1,'Contribution Summary','contribute/summary',NULL,NULL,'Groups and totals contributions by criteria including contact, time period, contribution type, contributor location, etc.','access CiviContribute',NULL,'a:42:{s:6:\"fields\";a:1:{s:12:\"total_amount\";s:1:\"1\";}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:15:\"total_count_min\";s:0:\"\";s:15:\"total_count_max\";s:0:\"\";s:14:\"total_count_op\";s:3:\"lte\";s:17:\"total_count_value\";s:0:\"\";s:13:\"total_avg_min\";s:0:\"\";s:13:\"total_avg_max\";s:0:\"\";s:12:\"total_avg_op\";s:3:\"lte\";s:15:\"total_avg_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:12:\"receive_date\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:12:\"receive_date\";s:5:\"MONTH\";}s:11:\"description\";s:80:\"Shows contribution statistics by month / week / year .. country / state .. type.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(8,1,'Contribution Details','contribute/detail',NULL,NULL,'Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.','access CiviContribute',NULL,'a:56:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:7:\"note_op\";s:3:\"has\";s:10:\"note_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:194:\"Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(9,1,'Repeat Contributions','contribute/repeat',NULL,NULL,'Given two date ranges, shows contacts who contributed in both the date ranges with the amount contributed in each and the percentage increase / decrease.','access CiviContribute',NULL,'a:29:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:13:\"total_amount1\";s:1:\"1\";s:13:\"total_amount2\";s:1:\"1\";}s:22:\"receive_date1_relative\";s:13:\"previous.year\";s:18:\"receive_date1_from\";s:0:\"\";s:16:\"receive_date1_to\";s:0:\"\";s:22:\"receive_date2_relative\";s:9:\"this.year\";s:18:\"receive_date2_from\";s:0:\"\";s:16:\"receive_date2_to\";s:0:\"\";s:17:\"total_amount1_min\";s:0:\"\";s:17:\"total_amount1_max\";s:0:\"\";s:16:\"total_amount1_op\";s:3:\"lte\";s:19:\"total_amount1_value\";s:0:\"\";s:17:\"total_amount2_min\";s:0:\"\";s:17:\"total_amount2_max\";s:0:\"\";s:16:\"total_amount2_op\";s:3:\"lte\";s:19:\"total_amount2_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:2:\"id\";s:1:\"1\";}s:11:\"description\";s:140:\"Given two date ranges, shows contacts (and their contributions) who contributed in both the date ranges with percentage increase / decrease.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(10,1,'SYBUNT (some year but not this year)','contribute/sybunt',NULL,NULL,'Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.','access CiviContribute',NULL,'a:18:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:179:\"Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(11,1,'LYBUNT (last year but not this year)','contribute/lybunt',NULL,NULL,'Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.','access CiviContribute',NULL,'a:19:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:157:\"Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(12,1,'Contributions by Organization','contribute/organizationSummary',NULL,NULL,'Displays a detailed list of contributions grouped by organization, which includes contributions made by employees for the organisation.','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"4_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:193:\"Displays a detailed contribution report for Organization relationships with contributors, as to if contribution done was from an employee of some organization or from that Organization itself.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(13,1,'Contributions by Household','contribute/householdSummary',NULL,NULL,'Displays a detailed list of contributions grouped by household which includes contributions made by members of the household.','access CiviContribute',NULL,'a:21:{s:6:\"fields\";a:5:{s:14:\"household_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:17:\"household_name_op\";s:3:\"has\";s:20:\"household_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"6_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:213:\"Provides a detailed report for Contributions made by contributors(Or Household itself) who are having a relationship with household (For ex a Contributor is Head of Household for some household or is a member of.)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(14,1,'Top Donors','contribute/topDonor',NULL,NULL,'Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:2:{s:12:\"display_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:21:\"receive_date_relative\";s:9:\"this.year\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:15:\"total_range_min\";s:0:\"\";s:15:\"total_range_max\";s:0:\"\";s:14:\"total_range_op\";s:2:\"eq\";s:17:\"total_range_value\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:11:\"description\";s:148:\"Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(15,1,'Soft Credits','contribute/softcredit',NULL,NULL,'Shows contributions made by contacts that have been soft-credited to other contacts.','access CiviContribute',NULL,'a:23:{s:6:\"fields\";a:5:{s:21:\"display_name_creditor\";s:1:\"1\";s:24:\"display_name_constituent\";s:1:\"1\";s:14:\"email_creditor\";s:1:\"1\";s:14:\"phone_creditor\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:20:\"Soft Credit details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(16,1,'Contribution Aggregate by Relationship','contribute/history',NULL,NULL,'List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.','access CiviContribute',NULL,'a:41:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:17:\"civicrm_upto_2009\";s:1:\"1\";i:2010;s:1:\"1\";i:2011;s:1:\"1\";i:2012;s:1:\"1\";i:2013;s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"in\";s:26:\"relationship_type_id_value\";a:0:{}s:12:\"this_year_op\";s:2:\"eq\";s:15:\"this_year_value\";s:0:\"\";s:13:\"other_year_op\";s:2:\"eq\";s:16:\"other_year_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:127:\"List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(17,1,'Personal Campaign Page Summary','contribute/pcp',NULL,NULL,'Summarizes amount raised and number of contributors for each Personal Campaign Page.','access CiviContribute',NULL,'a:22:{s:6:\"fields\";a:8:{s:9:\"sort_name\";s:1:\"1\";s:10:\"page_title\";s:1:\"1\";s:5:\"title\";s:1:\"1\";s:11:\"goal_amount\";s:1:\"1\";s:8:\"amount_1\";s:1:\"1\";s:8:\"amount_2\";s:1:\"1\";s:7:\"soft_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"page_title_op\";s:3:\"has\";s:16:\"page_title_value\";s:0:\"\";s:8:\"title_op\";s:3:\"has\";s:11:\"title_value\";s:0:\"\";s:12:\"amount_2_min\";s:0:\"\";s:12:\"amount_2_max\";s:0:\"\";s:11:\"amount_2_op\";s:3:\"lte\";s:14:\"amount_2_value\";s:0:\"\";s:11:\"description\";s:35:\"Shows Personal Campaign Page Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(18,1,'Pledge Detail','pledge/detail',NULL,NULL,'List of pledges including amount pledged, pledge status, next payment date, balance due, total amount paid etc.','access CiviPledge',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:17:\"pledge_amount_min\";s:0:\"\";s:17:\"pledge_amount_max\";s:0:\"\";s:16:\"pledge_amount_op\";s:3:\"lte\";s:19:\"pledge_amount_value\";s:0:\"\";s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:13:\"Pledge Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(19,1,'Pledged But not Paid','pledge/pbnp',NULL,NULL,'Pledged but not Paid Report','access CiviPledge',NULL,'a:17:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"pledge_create_date\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:14:\"scheduled_date\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:27:\"Pledged but not Paid Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(20,1,'Bookkeeping Transactions','contribute/bookkeeping',NULL,NULL,'Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.','access CiviContribute',NULL,'a:40:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:21:\"debit_accounting_code\";s:1:\"1\";s:22:\"credit_accounting_code\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:12:\"check_number\";s:1:\"1\";s:21:\"payment_instrument_id\";s:1:\"1\";s:9:\"trxn_date\";s:1:\"1\";s:7:\"trxn_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:24:\"debit_accounting_code_op\";s:2:\"in\";s:27:\"debit_accounting_code_value\";a:0:{}s:25:\"credit_accounting_code_op\";s:2:\"in\";s:28:\"credit_accounting_code_value\";a:0:{}s:13:\"debit_name_op\";s:2:\"in\";s:16:\"debit_name_value\";a:0:{}s:14:\"credit_name_op\";s:2:\"in\";s:17:\"credit_name_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:18:\"trxn_date_relative\";s:1:\"0\";s:14:\"trxn_date_from\";s:0:\"\";s:12:\"trxn_date_to\";s:0:\"\";s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:11:\"description\";s:133:\"Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(21,1,'Recurring Contributions','contribute/recur',NULL,NULL,'Provides information about the status of recurring contributions','access CiviContribute',NULL,'a:39:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:18:\"frequency_interval\";s:1:\"1\";s:14:\"frequency_unit\";s:1:\"1\";s:12:\"installments\";s:1:\"1\";s:8:\"end_date\";s:1:\"1\";}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"5\";}s:11:\"currency_op\";s:2:\"in\";s:14:\"currency_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:17:\"frequency_unit_op\";s:2:\"in\";s:20:\"frequency_unit_value\";a:0:{}s:22:\"frequency_interval_min\";s:0:\"\";s:22:\"frequency_interval_max\";s:0:\"\";s:21:\"frequency_interval_op\";s:3:\"lte\";s:24:\"frequency_interval_value\";s:0:\"\";s:16:\"installments_min\";s:0:\"\";s:16:\"installments_max\";s:0:\"\";s:15:\"installments_op\";s:3:\"lte\";s:18:\"installments_value\";s:0:\"\";s:19:\"start_date_relative\";s:0:\"\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:37:\"next_sched_contribution_date_relative\";s:0:\"\";s:33:\"next_sched_contribution_date_from\";s:0:\"\";s:31:\"next_sched_contribution_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:0:\"\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:28:\"calculated_end_date_relative\";s:0:\"\";s:24:\"calculated_end_date_from\";s:0:\"\";s:22:\"calculated_end_date_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:41:\"Shows all pending recurring contributions\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:14:\"addToDashboard\";s:1:\"1\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(22,1,'Membership Summary','member/summary',NULL,NULL,'Provides a summary of memberships by type and join date.','access CiviMember',NULL,'a:18:{s:6:\"fields\";a:2:{s:18:\"membership_type_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:21:\"membership_type_id_op\";s:2:\"in\";s:24:\"membership_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:9:\"group_bys\";a:2:{s:9:\"join_date\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:9:\"join_date\";s:5:\"MONTH\";}s:11:\"description\";s:56:\"Provides a summary of memberships by type and join date.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(23,1,'Membership Details','member/detail',NULL,NULL,'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.','access CiviMember',NULL,'a:28:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:119:\"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(24,1,'Contribution and Membership Details','member/contributionDetail',NULL,NULL,'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.','access CiviMember',NULL,'a:67:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:1:\"0\";s:9:\"domain_id\";i:1;}{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(25,1,'Lapsed Memberships','member/lapse',NULL,NULL,'Provides a list of memberships that have lapsed or will lapse by the date you specify.','access CiviMember',NULL,'a:16:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:85:\"Provides a list of memberships that lapsed or will lapse before the date you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(26,1,'Event Participants List','event/participantListing',NULL,NULL,'Provides lists of participants for an event.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(27,1,'Event Income Summary','event/summary',NULL,NULL,'Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.','access CiviEvent',NULL,'a:18:{s:6:\"fields\";a:2:{s:5:\"title\";s:1:\"1\";s:13:\"event_type_id\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:16:\"event_type_id_op\";s:2:\"in\";s:19:\"event_type_id_value\";a:0:{}s:25:\"event_start_date_relative\";s:1:\"0\";s:21:\"event_start_date_from\";s:0:\"\";s:19:\"event_start_date_to\";s:0:\"\";s:23:\"event_end_date_relative\";s:1:\"0\";s:19:\"event_end_date_from\";s:0:\"\";s:17:\"event_end_date_to\";s:0:\"\";s:11:\"description\";s:181:\"Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(28,1,'Event Income Details','event/income',NULL,NULL,'Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.','access CiviEvent',NULL,'a:7:{s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";N;s:11:\"description\";s:133:\"Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(29,1,'Attendee List','event/participantListing',NULL,NULL,'Provides lists of event attendees.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(30,1,'Grant Details','grant/detail',NULL,NULL,'Grant Report Detail','access CiviGrant',NULL,'a:40:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:25:\"application_received_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:11:\"description\";s:19:\"Grant Report Detail\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(31,1,'Grant Statistics','grant/statistics',NULL,NULL,'Grant Report Statistics','access CiviGrant',NULL,'a:42:{s:6:\"fields\";a:2:{s:18:\"summary_statistics\";s:1:\"1\";s:13:\"grant_type_id\";s:1:\"1\";}s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:22:\"decision_date_relative\";s:1:\"0\";s:18:\"decision_date_from\";s:0:\"\";s:16:\"decision_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:24:\"grant_report_received_op\";s:2:\"eq\";s:27:\"grant_report_received_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:15:\"contact_type_op\";s:2:\"in\";s:18:\"contact_type_value\";a:0:{}s:12:\"region_id_op\";s:2:\"in\";s:15:\"region_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:11:\"description\";s:23:\"Grant Report Statistics\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"parent_id\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(32,1,'Mail Bounces','Mailing/bounce',NULL,NULL,'Bounce Report for mailings','access CiviMail',NULL,'a:33:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:11:\"bounce_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:19:\"bounce_type_name_op\";s:2:\"eq\";s:22:\"bounce_type_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:26:\"Bounce Report for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(33,1,'Mailing Summary','Mailing/summary',NULL,NULL,'Summary statistics for mailings','access CiviMail',NULL,'a:25:{s:6:\"fields\";a:5:{s:4:\"name\";s:1:\"1\";s:11:\"queue_count\";s:1:\"1\";s:15:\"delivered_count\";s:1:\"1\";s:12:\"bounce_count\";s:1:\"1\";s:17:\"unique_open_count\";s:1:\"1\";}s:15:\"is_completed_op\";s:2:\"eq\";s:18:\"is_completed_value\";s:1:\"1\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:9:\"status_op\";s:3:\"has\";s:12:\"status_value\";s:8:\"Complete\";s:11:\"is_test_min\";s:0:\"\";s:11:\"is_test_max\";s:0:\"\";s:10:\"is_test_op\";s:3:\"lte\";s:13:\"is_test_value\";s:1:\"0\";s:19:\"start_date_relative\";s:9:\"this.year\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:9:\"this.year\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:11:\"description\";s:31:\"Summary statistics for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(34,1,'Mail Opened','Mailing/opened',NULL,NULL,'Display contacts who opened emails from a mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:49:\"Display contacts who opened emails from a mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(35,1,'Mail Clickthroughs','Mailing/clicks',NULL,NULL,'Display clicks from each mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:6:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:3:\"url\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:32:\"Display clicks from each mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(36,1,'Mailing Details','mailing/detail',NULL,NULL,'Provides reporting on Intended and Successful Deliveries, Unsubscribes and Opt-outs, Replies and Forwards.','access CiviMail',NULL,'a:30:{s:6:\"fields\";a:6:{s:9:\"sort_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:11:\"delivery_id\";s:1:\"1\";s:14:\"unsubscribe_id\";s:1:\"1\";s:9:\"optout_id\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"mailing_id_op\";s:2:\"in\";s:16:\"mailing_id_value\";a:0:{}s:18:\"delivery_status_op\";s:2:\"eq\";s:21:\"delivery_status_value\";s:0:\"\";s:18:\"is_unsubscribed_op\";s:2:\"eq\";s:21:\"is_unsubscribed_value\";s:0:\"\";s:12:\"is_optout_op\";s:2:\"eq\";s:15:\"is_optout_value\";s:0:\"\";s:13:\"is_replied_op\";s:2:\"eq\";s:16:\"is_replied_value\";s:0:\"\";s:15:\"is_forwarded_op\";s:2:\"eq\";s:18:\"is_forwarded_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:21:\"Mailing Detail Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(37,1,'Survey Details','survey/detail',NULL,NULL,'Detailed report for canvassing, phone-banking, walk lists or other surveys.','access CiviReport',NULL,'a:39:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:6:\"result\";s:1:\"1\";}s:22:\"assignee_contact_id_op\";s:2:\"eq\";s:25:\"assignee_contact_id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:12:\"survey_id_op\";s:2:\"in\";s:15:\"survey_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"eq\";s:15:\"status_id_value\";s:1:\"1\";s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:75:\"Detailed report for canvassing, phone-banking, walk lists or other surveys.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviReport\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0); +INSERT INTO `civicrm_report_instance` (`id`, `domain_id`, `title`, `report_id`, `name`, `args`, `description`, `permission`, `grouprole`, `form_values`, `is_active`, `created_id`, `owner_id`, `email_subject`, `email_to`, `email_cc`, `header`, `footer`, `navigation_id`, `drilldown_id`, `is_reserved`) VALUES (1,1,'Constituent Summary','contact/summary',NULL,NULL,'Provides a list of address and telephone information for constituent records in your system.','view all contacts',NULL,'a:31:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:14:\"street_address\";s:1:\"1\";s:4:\"city\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:92:\"Provides a list of address and telephone information for constituent records in your system.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(2,1,'Constituent Detail','contact/detail',NULL,NULL,'Provides contact-related information on contributions, memberships, events and activities.','view all contacts',NULL,'a:25:{s:6:\"fields\";a:30:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:15:\"contribution_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:13:\"membership_id\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:20:\"membership_status_id\";s:1:\"1\";s:14:\"participant_id\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:21:\"participant_status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";s:25:\"participant_register_date\";s:1:\"1\";s:9:\"fee_level\";s:1:\"1\";s:10:\"fee_amount\";s:1:\"1\";s:15:\"relationship_id\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:12:\"contact_id_b\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:7:\"subject\";s:1:\"1\";s:17:\"source_contact_id\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:18:\"activity_status_id\";s:1:\"1\";s:17:\"target_contact_id\";s:1:\"1\";s:19:\"assignee_contact_id\";s:1:\"1\";}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:90:\"Provides contact-related information on contributions, memberships, events and activities.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(3,1,'Activity Details','activity',NULL,NULL,'Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)','view all contacts',NULL,'a:26:{s:6:\"fields\";a:6:{s:16:\"contact_assignee\";s:1:\"1\";s:14:\"contact_target\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:16:\"activity_subject\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:17:\"contact_source_op\";s:3:\"has\";s:20:\"contact_source_value\";s:0:\"\";s:19:\"contact_assignee_op\";s:3:\"has\";s:22:\"contact_assignee_value\";s:0:\"\";s:17:\"contact_target_op\";s:3:\"has\";s:20:\"contact_target_value\";s:0:\"\";s:15:\"current_user_op\";s:2:\"eq\";s:18:\"current_user_value\";s:1:\"0\";s:27:\"activity_date_time_relative\";s:10:\"this.month\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_subject_op\";s:3:\"has\";s:22:\"activity_subject_value\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:11:\"description\";s:126:\"Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"group_bys\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(4,1,'Current Employers','contact/currentEmployer',NULL,NULL,'Provides detail list of employer employee relationships along with employment details.','view all contacts',NULL,'a:33:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:9:\"job_title\";s:1:\"1\";s:10:\"start_date\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:19:\"start_date_relative\";s:1:\"0\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:98:\"Provides detail list of employer employee relationships along with employment details Ex Join Date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(5,1,'Relationships','contact/relationship',NULL,NULL,'Gives relationship details between two contacts','view all contacts',NULL,'a:28:{s:6:\"fields\";a:4:{s:11:\"sort_name_a\";s:1:\"1\";s:11:\"sort_name_b\";s:1:\"1\";s:9:\"label_a_b\";s:1:\"1\";s:9:\"label_b_a\";s:1:\"1\";}s:14:\"sort_name_a_op\";s:3:\"has\";s:17:\"sort_name_a_value\";s:0:\"\";s:14:\"sort_name_b_op\";s:3:\"has\";s:17:\"sort_name_b_value\";s:0:\"\";s:17:\"contact_type_a_op\";s:2:\"in\";s:20:\"contact_type_a_value\";a:0:{}s:17:\"contact_type_b_op\";s:2:\"in\";s:20:\"contact_type_b_value\";a:0:{}s:12:\"is_active_op\";s:2:\"eq\";s:15:\"is_active_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:19:\"Relationship Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(6,1,'Activity Summary','activitySummary',NULL,NULL,'Shows activity statistics by type / date','view all contacts',NULL,'a:26:{s:6:\"fields\";a:4:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:8:\"duration\";s:1:\"1\";s:2:\"id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:27:\"activity_date_time_relative\";s:0:\"\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:14:\"priority_id_op\";s:2:\"in\";s:17:\"priority_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"group_bys\";a:2:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:18:\"activity_date_time\";s:5:\"MONTH\";}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:16:\"activity_type_id\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:40:\"Shows activity statistics by type / date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(7,1,'Contribution Summary','contribute/summary',NULL,NULL,'Groups and totals contributions by criteria including contact, time period, contribution type, contributor location, etc.','access CiviContribute',NULL,'a:42:{s:6:\"fields\";a:1:{s:12:\"total_amount\";s:1:\"1\";}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:15:\"total_count_min\";s:0:\"\";s:15:\"total_count_max\";s:0:\"\";s:14:\"total_count_op\";s:3:\"lte\";s:17:\"total_count_value\";s:0:\"\";s:13:\"total_avg_min\";s:0:\"\";s:13:\"total_avg_max\";s:0:\"\";s:12:\"total_avg_op\";s:3:\"lte\";s:15:\"total_avg_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:12:\"receive_date\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:12:\"receive_date\";s:5:\"MONTH\";}s:11:\"description\";s:80:\"Shows contribution statistics by month / week / year .. country / state .. type.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(8,1,'Contribution Details','contribute/detail',NULL,NULL,'Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.','access CiviContribute',NULL,'a:56:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:7:\"note_op\";s:3:\"has\";s:10:\"note_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:194:\"Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(9,1,'Repeat Contributions','contribute/repeat',NULL,NULL,'Given two date ranges, shows contacts who contributed in both the date ranges with the amount contributed in each and the percentage increase / decrease.','access CiviContribute',NULL,'a:29:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:13:\"total_amount1\";s:1:\"1\";s:13:\"total_amount2\";s:1:\"1\";}s:22:\"receive_date1_relative\";s:13:\"previous.year\";s:18:\"receive_date1_from\";s:0:\"\";s:16:\"receive_date1_to\";s:0:\"\";s:22:\"receive_date2_relative\";s:9:\"this.year\";s:18:\"receive_date2_from\";s:0:\"\";s:16:\"receive_date2_to\";s:0:\"\";s:17:\"total_amount1_min\";s:0:\"\";s:17:\"total_amount1_max\";s:0:\"\";s:16:\"total_amount1_op\";s:3:\"lte\";s:19:\"total_amount1_value\";s:0:\"\";s:17:\"total_amount2_min\";s:0:\"\";s:17:\"total_amount2_max\";s:0:\"\";s:16:\"total_amount2_op\";s:3:\"lte\";s:19:\"total_amount2_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:2:\"id\";s:1:\"1\";}s:11:\"description\";s:140:\"Given two date ranges, shows contacts (and their contributions) who contributed in both the date ranges with percentage increase / decrease.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(10,1,'SYBUNT (some year but not this year)','contribute/sybunt',NULL,NULL,'Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.','access CiviContribute',NULL,'a:18:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:179:\"Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(11,1,'LYBUNT (last year but not this year)','contribute/lybunt',NULL,NULL,'Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.','access CiviContribute',NULL,'a:19:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:157:\"Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(12,1,'Contributions by Organization','contribute/organizationSummary',NULL,NULL,'Displays a detailed list of contributions grouped by organization, which includes contributions made by employees for the organisation.','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"4_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:193:\"Displays a detailed contribution report for Organization relationships with contributors, as to if contribution done was from an employee of some organization or from that Organization itself.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(13,1,'Contributions by Household','contribute/householdSummary',NULL,NULL,'Displays a detailed list of contributions grouped by household which includes contributions made by members of the household.','access CiviContribute',NULL,'a:21:{s:6:\"fields\";a:5:{s:14:\"household_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:17:\"household_name_op\";s:3:\"has\";s:20:\"household_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"6_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:213:\"Provides a detailed report for Contributions made by contributors(Or Household itself) who are having a relationship with household (For ex a Contributor is Head of Household for some household or is a member of.)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(14,1,'Top Donors','contribute/topDonor',NULL,NULL,'Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:2:{s:12:\"display_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:21:\"receive_date_relative\";s:9:\"this.year\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:15:\"total_range_min\";s:0:\"\";s:15:\"total_range_max\";s:0:\"\";s:14:\"total_range_op\";s:2:\"eq\";s:17:\"total_range_value\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:11:\"description\";s:148:\"Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(15,1,'Soft Credits','contribute/softcredit',NULL,NULL,'Shows contributions made by contacts that have been soft-credited to other contacts.','access CiviContribute',NULL,'a:23:{s:6:\"fields\";a:5:{s:21:\"display_name_creditor\";s:1:\"1\";s:24:\"display_name_constituent\";s:1:\"1\";s:14:\"email_creditor\";s:1:\"1\";s:14:\"phone_creditor\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:20:\"Soft Credit details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(16,1,'Contribution Aggregate by Relationship','contribute/history',NULL,NULL,'List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.','access CiviContribute',NULL,'a:41:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:17:\"civicrm_upto_2009\";s:1:\"1\";i:2010;s:1:\"1\";i:2011;s:1:\"1\";i:2012;s:1:\"1\";i:2013;s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"in\";s:26:\"relationship_type_id_value\";a:0:{}s:12:\"this_year_op\";s:2:\"eq\";s:15:\"this_year_value\";s:0:\"\";s:13:\"other_year_op\";s:2:\"eq\";s:16:\"other_year_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:127:\"List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(17,1,'Personal Campaign Page Summary','contribute/pcp',NULL,NULL,'Summarizes amount raised and number of contributors for each Personal Campaign Page.','access CiviContribute',NULL,'a:22:{s:6:\"fields\";a:8:{s:9:\"sort_name\";s:1:\"1\";s:10:\"page_title\";s:1:\"1\";s:5:\"title\";s:1:\"1\";s:11:\"goal_amount\";s:1:\"1\";s:8:\"amount_1\";s:1:\"1\";s:8:\"amount_2\";s:1:\"1\";s:7:\"soft_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"page_title_op\";s:3:\"has\";s:16:\"page_title_value\";s:0:\"\";s:8:\"title_op\";s:3:\"has\";s:11:\"title_value\";s:0:\"\";s:12:\"amount_2_min\";s:0:\"\";s:12:\"amount_2_max\";s:0:\"\";s:11:\"amount_2_op\";s:3:\"lte\";s:14:\"amount_2_value\";s:0:\"\";s:11:\"description\";s:35:\"Shows Personal Campaign Page Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(18,1,'Pledge Detail','pledge/detail',NULL,NULL,'List of pledges including amount pledged, pledge status, next payment date, balance due, total amount paid etc.','access CiviPledge',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:17:\"pledge_amount_min\";s:0:\"\";s:17:\"pledge_amount_max\";s:0:\"\";s:16:\"pledge_amount_op\";s:3:\"lte\";s:19:\"pledge_amount_value\";s:0:\"\";s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:13:\"Pledge Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(19,1,'Pledged But not Paid','pledge/pbnp',NULL,NULL,'Pledged but not Paid Report','access CiviPledge',NULL,'a:17:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"pledge_create_date\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:14:\"scheduled_date\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:27:\"Pledged but not Paid Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(20,1,'Bookkeeping Transactions','contribute/bookkeeping',NULL,NULL,'Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.','access CiviContribute',NULL,'a:40:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:21:\"debit_accounting_code\";s:1:\"1\";s:22:\"credit_accounting_code\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:12:\"check_number\";s:1:\"1\";s:21:\"payment_instrument_id\";s:1:\"1\";s:9:\"trxn_date\";s:1:\"1\";s:7:\"trxn_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:24:\"debit_accounting_code_op\";s:2:\"in\";s:27:\"debit_accounting_code_value\";a:0:{}s:25:\"credit_accounting_code_op\";s:2:\"in\";s:28:\"credit_accounting_code_value\";a:0:{}s:13:\"debit_name_op\";s:2:\"in\";s:16:\"debit_name_value\";a:0:{}s:14:\"credit_name_op\";s:2:\"in\";s:17:\"credit_name_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:18:\"trxn_date_relative\";s:1:\"0\";s:14:\"trxn_date_from\";s:0:\"\";s:12:\"trxn_date_to\";s:0:\"\";s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:11:\"description\";s:133:\"Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(21,1,'Recurring Contributions','contribute/recur',NULL,NULL,'Provides information about the status of recurring contributions','access CiviContribute',NULL,'a:39:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:18:\"frequency_interval\";s:1:\"1\";s:14:\"frequency_unit\";s:1:\"1\";s:12:\"installments\";s:1:\"1\";s:8:\"end_date\";s:1:\"1\";}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"5\";}s:11:\"currency_op\";s:2:\"in\";s:14:\"currency_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:17:\"frequency_unit_op\";s:2:\"in\";s:20:\"frequency_unit_value\";a:0:{}s:22:\"frequency_interval_min\";s:0:\"\";s:22:\"frequency_interval_max\";s:0:\"\";s:21:\"frequency_interval_op\";s:3:\"lte\";s:24:\"frequency_interval_value\";s:0:\"\";s:16:\"installments_min\";s:0:\"\";s:16:\"installments_max\";s:0:\"\";s:15:\"installments_op\";s:3:\"lte\";s:18:\"installments_value\";s:0:\"\";s:19:\"start_date_relative\";s:0:\"\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:37:\"next_sched_contribution_date_relative\";s:0:\"\";s:33:\"next_sched_contribution_date_from\";s:0:\"\";s:31:\"next_sched_contribution_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:0:\"\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:28:\"calculated_end_date_relative\";s:0:\"\";s:24:\"calculated_end_date_from\";s:0:\"\";s:22:\"calculated_end_date_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:41:\"Shows all pending recurring contributions\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:14:\"addToDashboard\";s:1:\"1\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(22,1,'Membership Summary','member/summary',NULL,NULL,'Provides a summary of memberships by type and join date.','access CiviMember',NULL,'a:18:{s:6:\"fields\";a:2:{s:18:\"membership_type_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:21:\"membership_type_id_op\";s:2:\"in\";s:24:\"membership_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:9:\"group_bys\";a:2:{s:9:\"join_date\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:9:\"join_date\";s:5:\"MONTH\";}s:11:\"description\";s:56:\"Provides a summary of memberships by type and join date.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(23,1,'Membership Details','member/detail',NULL,NULL,'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.','access CiviMember',NULL,'a:28:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:119:\"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(24,1,'Contribution and Membership Details','member/contributionDetail',NULL,NULL,'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.','access CiviMember',NULL,'a:67:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:1:\"0\";s:9:\"domain_id\";i:1;}{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(25,1,'Lapsed Memberships','member/lapse',NULL,NULL,'Provides a list of memberships that have lapsed or will lapse by the date you specify.','access CiviMember',NULL,'a:16:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:85:\"Provides a list of memberships that lapsed or will lapse before the date you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(26,1,'Event Participants List','event/participantListing',NULL,NULL,'Provides lists of participants for an event.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(27,1,'Event Income Summary','event/summary',NULL,NULL,'Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.','access CiviEvent',NULL,'a:18:{s:6:\"fields\";a:2:{s:5:\"title\";s:1:\"1\";s:13:\"event_type_id\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:16:\"event_type_id_op\";s:2:\"in\";s:19:\"event_type_id_value\";a:0:{}s:25:\"event_start_date_relative\";s:1:\"0\";s:21:\"event_start_date_from\";s:0:\"\";s:19:\"event_start_date_to\";s:0:\"\";s:23:\"event_end_date_relative\";s:1:\"0\";s:19:\"event_end_date_from\";s:0:\"\";s:17:\"event_end_date_to\";s:0:\"\";s:11:\"description\";s:181:\"Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(28,1,'Event Income Details','event/income',NULL,NULL,'Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.','access CiviEvent',NULL,'a:7:{s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";N;s:11:\"description\";s:133:\"Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(29,1,'Attendee List','event/participantListing',NULL,NULL,'Provides lists of event attendees.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(30,1,'Grant Details','grant/detail',NULL,NULL,'Grant Report Detail','access CiviGrant',NULL,'a:40:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:25:\"application_received_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:11:\"description\";s:19:\"Grant Report Detail\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(31,1,'Grant Statistics','grant/statistics',NULL,NULL,'Grant Report Statistics','access CiviGrant',NULL,'a:42:{s:6:\"fields\";a:2:{s:18:\"summary_statistics\";s:1:\"1\";s:13:\"grant_type_id\";s:1:\"1\";}s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:22:\"decision_date_relative\";s:1:\"0\";s:18:\"decision_date_from\";s:0:\"\";s:16:\"decision_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:24:\"grant_report_received_op\";s:2:\"eq\";s:27:\"grant_report_received_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:15:\"contact_type_op\";s:2:\"in\";s:18:\"contact_type_value\";a:0:{}s:12:\"region_id_op\";s:2:\"in\";s:15:\"region_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:11:\"description\";s:23:\"Grant Report Statistics\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"parent_id\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(32,1,'Mail Bounces','Mailing/bounce',NULL,NULL,'Bounce Report for mailings','access CiviMail',NULL,'a:33:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:11:\"bounce_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:19:\"bounce_type_name_op\";s:2:\"eq\";s:22:\"bounce_type_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:26:\"Bounce Report for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(33,1,'Mailing Summary','Mailing/summary',NULL,NULL,'Summary statistics for mailings','access CiviMail',NULL,'a:25:{s:6:\"fields\";a:5:{s:4:\"name\";s:1:\"1\";s:11:\"queue_count\";s:1:\"1\";s:15:\"delivered_count\";s:1:\"1\";s:12:\"bounce_count\";s:1:\"1\";s:17:\"unique_open_count\";s:1:\"1\";}s:15:\"is_completed_op\";s:2:\"eq\";s:18:\"is_completed_value\";s:1:\"1\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:9:\"status_op\";s:3:\"has\";s:12:\"status_value\";s:8:\"Complete\";s:11:\"is_test_min\";s:0:\"\";s:11:\"is_test_max\";s:0:\"\";s:10:\"is_test_op\";s:3:\"lte\";s:13:\"is_test_value\";s:1:\"0\";s:19:\"start_date_relative\";s:9:\"this.year\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:9:\"this.year\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:11:\"description\";s:31:\"Summary statistics for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(34,1,'Mail Opened','Mailing/opened',NULL,NULL,'Display contacts who opened emails from a mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:49:\"Display contacts who opened emails from a mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(35,1,'Mail Clickthroughs','Mailing/clicks',NULL,NULL,'Display clicks from each mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:6:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:3:\"url\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:32:\"Display clicks from each mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(36,1,'Mailing Details','mailing/detail',NULL,NULL,'Provides reporting on Intended and Successful Deliveries, Unsubscribes and Opt-outs, Replies and Forwards.','access CiviMail',NULL,'a:30:{s:6:\"fields\";a:6:{s:9:\"sort_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:11:\"delivery_id\";s:1:\"1\";s:14:\"unsubscribe_id\";s:1:\"1\";s:9:\"optout_id\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"mailing_id_op\";s:2:\"in\";s:16:\"mailing_id_value\";a:0:{}s:18:\"delivery_status_op\";s:2:\"eq\";s:21:\"delivery_status_value\";s:0:\"\";s:18:\"is_unsubscribed_op\";s:2:\"eq\";s:21:\"is_unsubscribed_value\";s:0:\"\";s:12:\"is_optout_op\";s:2:\"eq\";s:15:\"is_optout_value\";s:0:\"\";s:13:\"is_replied_op\";s:2:\"eq\";s:16:\"is_replied_value\";s:0:\"\";s:15:\"is_forwarded_op\";s:2:\"eq\";s:18:\"is_forwarded_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:21:\"Mailing Detail Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(37,1,'Survey Details','survey/detail',NULL,NULL,'Detailed report for canvassing, phone-banking, walk lists or other surveys.','access CiviReport',NULL,'a:39:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:6:\"result\";s:1:\"1\";}s:22:\"assignee_contact_id_op\";s:2:\"eq\";s:25:\"assignee_contact_id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:12:\"survey_id_op\";s:2:\"in\";s:15:\"survey_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"eq\";s:15:\"status_id_value\";s:1:\"1\";s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:75:\"Detailed report for canvassing, phone-banking, walk lists or other surveys.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviReport\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0); /*!40000 ALTER TABLE `civicrm_report_instance` ENABLE KEYS */; UNLOCK TABLES; @@ -1402,7 +1402,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_uf_field` WRITE; /*!40000 ALTER TABLE `civicrm_uf_field` DISABLE KEYS */; -INSERT INTO `civicrm_uf_field` (`id`, `uf_group_id`, `field_name`, `is_active`, `is_view`, `is_required`, `weight`, `help_post`, `help_pre`, `visibility`, `in_selector`, `is_searchable`, `location_type_id`, `phone_type_id`, `website_type_id`, `label`, `field_type`, `is_reserved`, `is_multi_summary`) VALUES (1,1,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(2,1,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(3,1,'street_address',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',0,0),(4,1,'city',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',0,0),(5,1,'postal_code',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(6,1,'country',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(7,1,'state_province',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(8,2,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(9,2,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(10,2,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(11,3,'participant_status',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Participant Status','Participant',1,0),(12,4,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(13,4,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(14,4,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(15,5,'organization_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(16,5,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(17,6,'household_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Household Name','Household',0,0),(18,6,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(19,7,'phone',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,1,NULL,'Home Phone','Contact',0,0),(20,7,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,2,NULL,'Home Mobile','Contact',0,0),(21,7,'street_address',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Address','Contact',0,0),(22,7,'city',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'City','Contact',0,0),(23,7,'state_province',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'State','Contact',0,0),(24,7,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Postal Code','Contact',0,0),(25,7,'email',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Email','Contact',0,0),(26,7,'group',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Groups','Contact',0,0),(27,7,'tag',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Tags','Contact',0,0),(28,7,'gender_id',1,0,1,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Gender','Individual',0,0),(29,7,'birth_date',1,0,1,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Date of Birth','Individual',0,0),(30,8,'street_address',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',1,0),(31,8,'city',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',1,0),(32,8,'postal_code',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(33,8,'country',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(34,8,'state_province',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(35,9,'organization_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(36,9,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,3,1,NULL,'Phone (Main) ','Contact',0,0),(37,9,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Email (Main) ','Contact',0,0),(38,9,'street_address',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Street Address','Contact',0,0),(39,9,'city',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'City','Contact',0,0),(40,9,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Postal Code','Contact',0,0),(41,9,'country',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Country','Contact',0,0),(42,9,'state_province',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'State/Province','Contact',0,0),(43,10,'financial_type',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Contribution',1,0),(44,10,'total_amount',1,0,0,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Contribution',1,0),(45,10,'contribution_status_id',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Status','Contribution',1,0),(46,10,'receive_date',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Contribution',1,0),(47,10,'contribution_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Contribution',0,0),(48,10,'payment_instrument',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Contribution',0,0),(49,10,'contribution_check_number',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Contribution',0,0),(50,10,'send_receipt',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Contribution',0,0),(51,10,'invoice_id',1,0,0,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Invoice ID','Contribution',0,0),(52,10,'soft_credit',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Contribution',0,0),(53,10,'soft_credit_type',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Contribution',0,0),(54,11,'membership_type',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Membership Type','Membership',1,0),(55,11,'join_date',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Member Since','Membership',1,0),(56,11,'membership_start_date',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Start Date','Membership',1,0),(57,11,'membership_end_date',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'End Date','Membership',1,0),(58,11,'membership_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Membership',0,0),(59,11,'send_receipt',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Membership',0,0),(60,11,'financial_type',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Membership',1,0),(61,11,'total_amount',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Membership',1,0),(62,11,'receive_date',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Membership',1,0),(63,11,'payment_instrument',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Membership',0,0),(64,11,'contribution_check_number',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Membership',0,0),(65,11,'contribution_status_id',1,0,1,12,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Status','Membership',1,0),(66,11,'soft_credit',1,0,0,13,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Membership',0,0),(67,11,'soft_credit_type',1,0,0,14,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Membership',0,0),(68,12,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(69,12,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(70,12,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(71,13,'prefix_id',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Individual Prefix','Individual',1,0),(72,13,'first_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',1,0),(73,13,'last_name',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',1,0),(74,13,'email',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Email Address','Contact',1,0); +INSERT INTO `civicrm_uf_field` (`id`, `uf_group_id`, `field_name`, `is_active`, `is_view`, `is_required`, `weight`, `help_post`, `help_pre`, `visibility`, `in_selector`, `is_searchable`, `location_type_id`, `phone_type_id`, `website_type_id`, `label`, `field_type`, `is_reserved`, `is_multi_summary`) VALUES (1,1,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(2,1,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(3,1,'street_address',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',0,0),(4,1,'city',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',0,0),(5,1,'postal_code',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(6,1,'country',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(7,1,'state_province',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(8,2,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(9,2,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(10,2,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(11,3,'participant_status',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Participant Status','Participant',1,0),(12,4,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(13,4,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(14,4,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(15,5,'organization_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(16,5,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(17,6,'household_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Household Name','Household',0,0),(18,6,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(19,7,'phone',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,1,NULL,'Home Phone','Contact',0,0),(20,7,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,2,NULL,'Home Mobile','Contact',0,0),(21,7,'street_address',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Address','Contact',0,0),(22,7,'city',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'City','Contact',0,0),(23,7,'state_province',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'State','Contact',0,0),(24,7,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Postal Code','Contact',0,0),(25,7,'email',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Email','Contact',0,0),(26,7,'group',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Groups','Contact',0,0),(27,7,'tag',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Tags','Contact',0,0),(28,7,'gender_id',1,0,1,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Gender','Individual',0,0),(29,7,'birth_date',1,0,1,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Date of Birth','Individual',0,0),(30,8,'street_address',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',1,0),(31,8,'city',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',1,0),(32,8,'postal_code',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(33,8,'country',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(34,8,'state_province',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(35,9,'organization_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(36,9,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,3,1,NULL,'Phone (Main) ','Contact',0,0),(37,9,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Email (Main) ','Contact',0,0),(38,9,'street_address',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Street Address','Contact',0,0),(39,9,'city',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'City','Contact',0,0),(40,9,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Postal Code','Contact',0,0),(41,9,'country',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Country','Contact',0,0),(42,9,'state_province',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'State/Province','Contact',0,0),(43,10,'financial_type',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Contribution',1,0),(44,10,'total_amount',1,0,0,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Contribution',1,0),(45,10,'contribution_status_id',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Status','Contribution',1,0),(46,10,'receive_date',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Contribution',1,0),(47,10,'contribution_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Contribution',0,0),(48,10,'payment_instrument',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Contribution',0,0),(49,10,'contribution_check_number',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Contribution',0,0),(50,10,'send_receipt',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Contribution',0,0),(51,10,'invoice_id',1,0,0,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Invoice ID','Contribution',0,0),(52,10,'soft_credit',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Contribution',0,0),(53,10,'soft_credit_type',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Contribution',0,0),(54,11,'membership_type',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Membership Type','Membership',1,0),(55,11,'membership_join_date',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Member Since','Membership',1,0),(56,11,'membership_start_date',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Start Date','Membership',1,0),(57,11,'membership_end_date',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'End Date','Membership',1,0),(58,11,'membership_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Membership',0,0),(59,11,'send_receipt',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Membership',0,0),(60,11,'financial_type',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Membership',1,0),(61,11,'total_amount',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Membership',1,0),(62,11,'receive_date',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Membership',1,0),(63,11,'payment_instrument',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Membership',0,0),(64,11,'contribution_check_number',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Membership',0,0),(65,11,'contribution_status_id',1,0,1,12,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Status','Membership',1,0),(66,11,'soft_credit',1,0,0,13,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Membership',0,0),(67,11,'soft_credit_type',1,0,0,14,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Membership',0,0),(68,12,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(69,12,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(70,12,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(71,13,'prefix_id',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Individual Prefix','Individual',1,0),(72,13,'first_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',1,0),(73,13,'last_name',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',1,0),(74,13,'email',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Email Address','Contact',1,0); /*!40000 ALTER TABLE `civicrm_uf_field` ENABLE KEYS */; UNLOCK TABLES; diff --git a/civicrm/sql/civicrm_navigation.mysql b/civicrm/sql/civicrm_navigation.mysql index ca63c25587..f200f5af8a 100644 --- a/civicrm/sql/civicrm_navigation.mysql +++ b/civicrm/sql/civicrm_navigation.mysql @@ -737,17 +737,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) diff --git a/civicrm/templates/CRM/Activity/Form/Activity.tpl b/civicrm/templates/CRM/Activity/Form/Activity.tpl index f1ca57e485..ac19690e42 100644 --- a/civicrm/templates/CRM/Activity/Form/Activity.tpl +++ b/civicrm/templates/CRM/Activity/Form/Activity.tpl @@ -79,7 +79,7 @@ </td> </tr> - {if $form.separation } + {if $form.separation} <tr class="crm-activity-form-block-separation crm-is-multi-activity-wrapper"> <td class="label">{$form.separation.label}</td> <td>{$form.separation.html} {help id="separation"}</td> @@ -252,7 +252,7 @@ {/if} {* End Delete vs. Add / Edit action *} </table> <div class="crm-submit-buttons"> - {if $action eq 4 && ($activityTName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)} + {if $action eq 4 && ($activityTypeNameAndLabel.machineName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)} {if !$context } {assign var="context" value='activity'} {/if} diff --git a/civicrm/templates/CRM/Grant/Form/Grant.tpl b/civicrm/templates/CRM/Grant/Form/Grant.tpl index a3385f6929..6deac7d975 100644 --- a/civicrm/templates/CRM/Grant/Form/Grant.tpl +++ b/civicrm/templates/CRM/Grant/Form/Grant.tpl @@ -35,12 +35,10 @@ {else} <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> <table class="form-layout-compressed"> - {if $context eq 'standalone'} <tr class="crm-grant-form-block-contact_id"> <td class="label">{$form.contact_id.label}</td> <td>{$form.contact_id.html}</td> </tr> - {/if} <tr class="crm-grant-form-block-status_id"> <td class="label">{$form.status_id.label}</td> <td>{$form.status_id.html}</td> diff --git a/civicrm/templates/CRM/Group/Form/Search.tpl b/civicrm/templates/CRM/Group/Form/Search.tpl index f73fd4b10e..d31dd2103b 100644 --- a/civicrm/templates/CRM/Group/Form/Search.tpl +++ b/civicrm/templates/CRM/Group/Form/Search.tpl @@ -109,7 +109,7 @@ // on initial load of manage group page and // also to handle search filtering for initial load of same page. var parentsOnly = 1 - var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">No Groups have been created for this site.{/ts}</div>'{literal}; + var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">None found.{/ts}</div>'{literal}; $('table.crm-group-selector').data({ "ajax": { "url": {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal}, diff --git a/civicrm/templates/CRM/Mailing/Form/Search.tpl b/civicrm/templates/CRM/Mailing/Form/Search.tpl index c726adf719..467e174b93 100644 --- a/civicrm/templates/CRM/Mailing/Form/Search.tpl +++ b/civicrm/templates/CRM/Mailing/Form/Search.tpl @@ -24,62 +24,57 @@ +--------------------------------------------------------------------+ *} <div class="crm-block crm-form-block crm-search-form-block"> -<table class="form-layout"> + <table class="form-layout"> <tr> - <td>{$form.mailing_name.label} {help id="id-mailing_name"}<br /> - {$form.mailing_name.html|crmAddClass:big} - </td> - </tr> - <tr> - <td> - <label>{if $sms eq 1}{ts}SMS Date{/ts}{else}{ts}Mailing Date{/ts}{/if}</label> - </td> + <td>{$form.mailing_name.label} {help id="id-mailing_name"}<br /> + {$form.mailing_name.html|crmAddClass:big} + </td> </tr> <tr> - {include file="CRM/Core/DateRange.tpl" fieldName="mailing" from='_from' to='_to'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="mailing" colspan='2'} </tr> <tr> - <td colspan="1">{$form.sort_name.label} {help id="id-create_sort_name"}<br /> - {$form.sort_name.html|crmAddClass:big} - <br/><br/> - <div class="crm-search-form-block-is_archive"> - {$form.is_archived.label} {help id="is_archived"}<br/> - {$form.is_archived.html} - </div> - </td> - {if $form.mailing_status} - <td width="100%"><label>{if $sms eq 1}{ts}SMS Status{/ts}{else}{ts}Mailing Status{/ts}{/if}</label><br /> + <td colspan="1">{$form.sort_name.label} {help id="id-create_sort_name"}<br /> + {$form.sort_name.html|crmAddClass:big} + <br/><br/> + <div class="crm-search-form-block-is_archive"> + {$form.is_archived.label} {help id="is_archived"}<br/> + {$form.is_archived.html} + </div> + </td> + {if $form.mailing_status} + <td width="100%"><label>{if $sms eq 1}{ts}SMS Status{/ts}{else}{ts}Mailing Status{/ts}{/if}</label><br /> <div class="listing-box" style="height: auto"> {foreach from=$form.mailing_status item="mailing_status_val"} - <div class="{cycle values="odd-row,even-row"}"> - {$mailing_status_val.html} - </div> + <div class="{cycle values="odd-row,even-row"}"> + {$mailing_status_val.html} + </div> {/foreach} <div class="{cycle values="odd-row,even-row"}"> {$form.status_unscheduled.html} </div> - </div><br /> - </td> - {/if} + </div><br /> + </td> + {/if} </tr> {* language *} {if $form.language} <tr> <td>{$form.language.label} {help id="id-language"}<br /> - {$form.language.html|crmAddClass:big} + {$form.language.html|crmAddClass:big} </td> </tr> {/if} {* campaign in mailing search *} {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" - campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} + campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} <tr> - <td>{$form.buttons.html}</td><td colspan="2"></td> + <td>{$form.buttons.html}</td><td colspan="2"></td> </tr> -</table> + </table> </div> {literal} diff --git a/civicrm/templates/CRM/Member/Form/Search/Common.tpl b/civicrm/templates/CRM/Member/Form/Search/Common.tpl index 38d8b78b37..79592f9859 100644 --- a/civicrm/templates/CRM/Member/Form/Search/Common.tpl +++ b/civicrm/templates/CRM/Member/Form/Search/Common.tpl @@ -33,58 +33,43 @@ </tr> <tr> - <td> - {$form.member_source.label} - <br />{$form.member_source.html} - <p> - {$form.member_test.label} {help id="is-test" file="CRM/Contact/Form/Search/Advanced"} {$form.member_test.html} - </p> + <td>{$form.member_source.label}<br /> + {$form.member_source.html} </td> <td> - <p> - {$form.membership_is_current_member.label} + {$form.membership_is_current_member.label}<br /> {$form.membership_is_current_member.html} - </p> - <p> - {$form.member_is_primary.label} - {help id="id-member_is_primary" file="CRM/Member/Form/Search.hlp"} - {$form.member_is_primary.html} - </p> - <p> - {$form.member_pay_later.label} {$form.member_pay_later.html} - </p> - <p> - {if $form.member_auto_renew} - <label>{$form.member_auto_renew.label}</label> - {help id="id-member_auto_renew" file="CRM/Member/Form/Search.hlp"} - <br/> - {$form.member_auto_renew.html} - {/if} - </p> - <p> - {$form.member_is_override.label} - {help id="id-member_is_override" file="CRM/Member/Form/Search.hlp"} - {$form.member_is_override.html} - </p> </td> </tr> - +<tr> + <td>{$form.member_test.label} {help id="is-test" file="CRM/Contact/Form/Search/Advanced"} {$form.member_test.html} + </td> + <td> + {$form.member_is_primary.label} {help id="id-member_is_primary" file="CRM/Member/Form/Search.hlp"} {$form.member_is_primary.html} + </td> +</tr> <tr><td><label>{$form.membership_id.label}</label> {$form.membership_id.html}</td> + <td>{$form.member_pay_later.label} {$form.member_pay_later.html}</td> </tr> - -<tr><td><label>{ts}Member Since{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_join_date" from='_low' to='_high'} + <td> + {if $form.member_auto_renew} + <label>{$form.member_auto_renew.label}</label> + {help id="id-member_auto_renew" file="CRM/Member/Form/Search.hlp"} + <br/> + {$form.member_auto_renew.html} + {/if} + </td> + <td>{$form.member_is_override.label}{help id="id-member_is_override" file="CRM/Member/Form/Search.hlp"}{$form.member_is_override.html}</td> </tr> - -<tr><td><label>{ts}Start Date{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_start_date" from='_low' to='_high'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_join_date" colspan='2'} +</tr> +<tr> + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_start_date" colspan='2'} </tr> - -<tr><td><label>{ts}End Date{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_end_date" from='_low' to='_high'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_end_date" colspan='2'} </tr> {* campaign in membership search *} diff --git a/civicrm/templates/CRM/Member/Form/Selector.tpl b/civicrm/templates/CRM/Member/Form/Selector.tpl index cfd4dc1ff9..f33db8e4a6 100644 --- a/civicrm/templates/CRM/Member/Form/Selector.tpl +++ b/civicrm/templates/CRM/Member/Form/Selector.tpl @@ -62,7 +62,7 @@ {$row.membership_type}{if $row.is_test} ({ts}test{/ts}){/if} {if $row.owner_membership_id}<br />({ts}by relationship{/ts}){/if} </td> - <td class="crm-membership-join_date">{$row.join_date|truncate:10:''|crmDate}</td> + <td class="crm-membership-join_date">{$row.membership_join_date|truncate:10:''|crmDate}</td> <td class="crm-membership-start_date">{$row.membership_start_date|truncate:10:''|crmDate}</td> <td class="crm-membership-end_date">{$row.membership_end_date|truncate:10:''|crmDate}</td> <td class="crm-membership-source">{$row.membership_source}</td> diff --git a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl index dbd5cc6d6c..9168c503b3 100644 --- a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl +++ b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl @@ -25,7 +25,7 @@ *} <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_payment_date" from='_low' to='_high' label="<label>Payment Scheduled</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_payment_scheduled_date" colspan="2"} </tr> <tr> <td colspan="2"> @@ -45,13 +45,13 @@ </td> </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_create_date" from='_low' to='_high' label="<label>Pledge Made</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_create_date" colspan="2"} </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_start_date" from='_low' to='_high' label="<label>Payments Start Date</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_start_date" colspan="2"} </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_end_date" from='_low' to='_high' label="<label>Payments Ended Date</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_end_date" colspan="2"} </tr> <tr> <td> diff --git a/civicrm/templates/CRM/Price/Form/Calculate.tpl b/civicrm/templates/CRM/Price/Form/Calculate.tpl index 268ce89acf..ec93545237 100644 --- a/civicrm/templates/CRM/Price/Form/Calculate.tpl +++ b/civicrm/templates/CRM/Price/Form/Calculate.tpl @@ -25,15 +25,16 @@ *} {assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay} + <div id="pricesetTotal" class="crm-section section-pricesetTotal"> - <div class="label -{if $hideTotal}, hiddenElement{/if}" id="pricelabel"> - {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )} - <span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span> - {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if} + <div id="pricelabel" class="label {if $hideTotal}hiddenElement{/if}"> + {if ($extends eq 'Contribution') || ($extends eq 'Membership')} + <span id='amount_sum_label'>{ts}Total Amount{/ts}</span> + {else} + <span id='amount_sum_label'>{ts}Total Fee(s){/ts}{if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}</span> {/if} </div> - <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div> + <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue"></div> </div> <script type="text/javascript"> @@ -44,25 +45,23 @@ var separator = '{/literal}{$config->monetaryDecimalPoint}{literal}'; var symbol = '{/literal}{$currencySymbol}{literal}'; var optionSep = '|'; +// Recalculate the total fees based on user selection cj("#priceset [price]").each(function () { + var elementType = cj(this).attr('type'); + if (this.tagName == 'SELECT') { + elementType = 'select-one'; + } - var elementType = cj(this).attr('type'); - if ( this.tagName == 'SELECT' ) { - elementType = 'select-one'; - } - - switch(elementType) { - case 'checkbox': - //event driven calculation of element. - cj(this).click(function(){ - calculateCheckboxLineItemValue(this); - display(calculateTotalFee()); - }); + switch(elementType) { + case 'checkbox': + cj(this).click(function(){ calculateCheckboxLineItemValue(this); + display(calculateTotalFee()); + }); + calculateCheckboxLineItemValue(this); break; case 'radio': - //event driven calculation of element. cj(this).click( function(){ calculateRadioLineItemValue(this); display(calculateTotalFee()); @@ -70,32 +69,26 @@ cj("#priceset [price]").each(function () { calculateRadioLineItemValue(this); break; - case 'text': - - //event driven calculation of element. - cj(this).bind( 'keyup', function() { - calculateText(this); - }).bind( 'blur' , function() { + case 'text': + cj(this).bind( 'keyup', function() { + calculateText(this); + }).bind( 'blur' , function() { + calculateText(this); + }); + //default calculation of element. calculateText(this); - }); - //default calculation of element. - calculateText(this); - - break; - - case 'select-one': - calculateSelectLineItemValue(this); + break; - //event driven calculation of element. - cj(this).change( function() { + case 'select-one': calculateSelectLineItemValue(this); - display(calculateTotalFee()); - }); - - - break; + cj(this).change(function() { + calculateSelectLineItemValue(this); + display(calculateTotalFee()); + }); + break; } + display(calculateTotalFee()); }); diff --git a/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl b/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl index a3e05682d5..83560773dd 100644 --- a/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl +++ b/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl @@ -201,3 +201,10 @@ {/if} {include file="CRM/Report/Form/ErrorMessage.tpl"} </div> + + +{if $outputMode == 'print'} + <script type="text/javascript"> + window.print(); + </script> +{/if} \ No newline at end of file diff --git a/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl b/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl index a785e6f8fd..1d00a21bac 100644 --- a/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl +++ b/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl @@ -82,8 +82,8 @@ function hideRow(i) { showHideRow(i); // clear values on hidden field, so they're not saved - cj('select#order_by_column_'+ i).val(''); - cj('select#order_by_order_'+ i).val('ASC'); + cj('select#order_bys_'+ i +'_column').val('-'); + cj('select#order_bys_'+ i +'_order').val('ASC'); cj('input#order_by_section_'+ i).prop('checked', false); cj('input#order_by_pagebreak_'+ i).prop('checked', false); } diff --git a/civicrm/templates/CRM/common/customData.tpl b/civicrm/templates/CRM/common/customData.tpl index 68208c9995..867013c0d4 100644 --- a/civicrm/templates/CRM/common/customData.tpl +++ b/civicrm/templates/CRM/common/customData.tpl @@ -26,7 +26,7 @@ {literal} <script type="text/javascript"> (function($) { - CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype) { + CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype, cid) { var dataUrl = CRM.url('civicrm/custom', {type: type}), prevCount = 1, fname = '#customData', @@ -62,9 +62,12 @@ dataUrl += '&qf=' + '{$qfKey}'; {/if} {if $action} - dataUrl += '&action=' + '{$action}'; + dataUrl += '&action=' + '{$action}'; {/if} {literal} + if (cid) { + dataUrl += '&cid=' + cid; + } if (!cgCount) { cgCount = 1; diff --git a/civicrm/templates/CRM/common/customDataBlock.tpl b/civicrm/templates/CRM/common/customDataBlock.tpl index d98b4a996a..ca3848df70 100644 --- a/civicrm/templates/CRM/common/customDataBlock.tpl +++ b/civicrm/templates/CRM/common/customDataBlock.tpl @@ -2,14 +2,15 @@ <div id="customData"></div> {*include custom data js file*} {include file="CRM/common/customData.tpl"} + {assign var='cid' value=$cid|default:'false'} {literal} <script type="text/javascript"> CRM.$(function($) { {/literal} {if $customDataSubType} - CRM.buildCustomData('{$customDataType}', {$customDataSubType}); + CRM.buildCustomData('{$customDataType}', {$customDataSubType}, false, false, false, false, false, {$cid}); {else} - CRM.buildCustomData('{$customDataType}'); + CRM.buildCustomData('{$customDataType}', false, false, false, false, false, false, {$cid}); {/if} {literal} }); diff --git a/civicrm/templates/CRM/common/fatal.tpl b/civicrm/templates/CRM/common/fatal.tpl index 321402ac84..61ba067007 100644 --- a/civicrm/templates/CRM/common/fatal.tpl +++ b/civicrm/templates/CRM/common/fatal.tpl @@ -24,7 +24,7 @@ +--------------------------------------------------------------------+ *} {* error.tpl: Display page for fatal errors. Provides complete HTML doc.*} -{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'} +{if $config->userFramework != 'WordPress'} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> @@ -89,7 +89,7 @@ function toggle( element ) { } </script> {/literal} -{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'} +{if $config->userFramework != 'WordPress'} </body> </html> {/if} diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php index f0caaff70e..6e60cb6a89 100644 --- a/civicrm/vendor/autoload.php +++ b/civicrm/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6::getLoader(); +return ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880::getLoader(); diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore b/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore new file mode 100644 index 0000000000..4a45ef5f7a --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.lock +.php_cs.cache diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist b/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist new file mode 100644 index 0000000000..b2de1a8cb5 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist @@ -0,0 +1,22 @@ +<?php + +$header = <<<'EOF' +This file is part of Composer Extra Files Plugin. + +(c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + +This source file is subject to the MIT license that is bundled +with this source code in the file LICENSE. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'header_comment' => ['header' => $header], + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in([__DIR__.'/src', __DIR__.'/tests']) + ); diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE b/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE new file mode 100644 index 0000000000..eda17bec4b --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE @@ -0,0 +1,20 @@ +(c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> +(c) 2019 CiviCRM LLC, Tim Otten <info@civicrm.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/README.md b/civicrm/vendor/civicrm/composer-downloads-plugin/README.md new file mode 100644 index 0000000000..9a4530db0c --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/README.md @@ -0,0 +1,94 @@ +Composer Downloads Plugin +=========================== + +> This is a fork of [lastcall/composer-extra-files](https://github.com/LastCallMedia/ComposerExtraFiles/). Some of the +> configuration options have changed, so it has been renamed to prevent it from conflicting in real-world usage. + +This `composer` plugin allows you to download extra files (`*.zip` or `*.tar.gz`) and extract them within your package. + +For example, suppose you publish a PHP package `foo/bar` which relies on an external artifact (such as JS, CSS, or image library). Place this configuration in the `composer.json` for `foo/bar`: + +```json +{ + "name": "foo/bar", + "require": { + "civicrm/composer-downloads-plugin": "~1.0" + }, + "extra": { + "downloads": { + "examplelib": { + "url": "`https://example.com/examplelib-0.1.zip`", + "path": "extern/examplelib", + "ignore": ["test", "doc", ".*"] + } + } + } +} +``` + +When a downstream user of `foo/bar` runs `composer install`, it will fetch and extract the zip file, creating `vendor/foo/bar/extern/examplelib`. + +This does not require consumers of `foo/bar` to make any special changes in their root-level project, and it uses `composer`'s built-in cache system. + +## When should I use this? + +The most common use-case is if you have compiled front-end code, where the compiled version is never committed to a git repository, and therefore isn't registered on packagist.org. For example, if you want your distributed package to depend on an NPM/Bower package. + +If you have the ability to maintain the root `composer.json` of consumers, then consider these alternatives -- when using multiple NPM/Bower packages, they provide more robust functionality (such as automatic updates and version-constraints). + +* [Asset Packagist](https://asset-packagist.org/) +* [Composer Asset Plugin](https://github.com/fxpio/composer-asset-plugin) + +The `downloads` approach is most appropriate if (a) you publish an intermediate (non-root) project to diverse consumers and (b) the external assets are relatively stable. + +## Configuration: Properties + +The `downloads` contains a list of files to download. Each extra-file as a symbolic ID (e.g. `examplelib` above) and some mix of properties: + +* `url`: The URL to fetch the content from. If it points to a tarball or zip file, it will be unpacked automatically. + +* `path`: The releative path where content will be extracted. + +* `type`: Determines how the download is handled + * `archive`: The `url` references a zip or tarball which should be extracted at the given `path`. (Default for URLs involving `*.zip`, `*.tar.gz`, or `*.tgz`.) + * `file`: The `url` should be downloaded to the given `path`. + * `phar`: The `url` references a PHP executable which should be installed at the given `path`. + +* `ignore`: A list of a files that should be omited from the extracted folder. (This supports a subset of `.gitignore` notation.) + +## Configuration: Defaults + +You may set default values for downloaded files using the `*` entry. + +```json +{ + "extra": { + "downloads": { + "*": { + "path": "bower_components/{$id}", + "ignore": ["test", "tests", "doc", "docs"] + }, + "jquery": { + "url": "https://github.com/jquery/jquery-dist/archive/1.12.4.zip" + }, + "jquery-ui": { + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" + } + } + } +} +``` + +## Tips + +In each downloaded folder, this plugin will create a small metadata file (`.composer-downloads.json`) to track the origin of the current code. If you modify the `composer.json` to use a different URL, then it will re-download the file. + +Download each extra file to a distinct `path`. Don't try to download into overlapping paths. (*This has not been tested, but it may lead to extraneous deletions/re-downloads.*) + +What should you do if you *normally* download the extra-file as `*.tgz` but sometimes (for local dev) need to grab bleeding edge content from somewhere else? Simply delete the autodownloaded folder and replace it with your own. `composer-downloads` will detect that conflict (by virtue of the absent `.composer-downloads.json`) and leave your code in place (until you choose to get rid of it). To switch back, you can simply delete the code and run `composer install` again. + +## Known Limitations + +If you use `downloads` in a root-project (or in symlinked dev repo), it will create+update downloads, but it will not remove orphaned items automatically. This could be addressed by doing a file-scan for `.composer-downloads.json` (and deleting any orphan folders). Since the edge-case is not particularly common right now, and since a file-scan could be time-consuming, it might make sense as a separate subcommand. + +I believe the limitation does *not* affect downstream consumers of a dependency. In that case, the regular `composer` install/update/removal mechanics should take care of any nested downloads. However, this is a little tricky to test right now. diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml b/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml new file mode 100644 index 0000000000..54042d6793 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml @@ -0,0 +1,24 @@ +version: 2 +jobs: + build: + working_directory: /srv + docker: + - image: lastcallmedia/php:7.0-dev + steps: + - checkout + - restore_cache: + key: composer-v1-{{ checksum "composer.json" }} + - run: composer install + - save_cache: + key: composer-v1-{{ checksum "composer.json" }} + paths: [vendor, composer.lock] + - run: | + COMMIT_RANGE=`echo $CIRCLE_COMPARE_URL | cut -d/ -f7` + IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")); unset IFS + vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}" + - run: | + composer validate + - run: mkdir -p /phpunit + - run: vendor/bin/phpunit --log-junit=/phpunit/junit.xml + - store_test_results: + path: /phpunit \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json b/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json new file mode 100644 index 0000000000..1e83d1e55d --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json @@ -0,0 +1,40 @@ +{ + "name": "civicrm/composer-downloads-plugin", + "description": "Composer plugin for downloading additional files within any composer package.", + "type": "composer-plugin", + "license": "MIT", + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "phpunit/phpunit": "^5.7", + "friendsofphp/php-cs-fixer": "^2.3", + "totten/process-helper": "^1.0.1" + }, + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "LastCall\\DownloadsPlugin\\Tests\\": "tests/" + } + }, + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + } +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml b/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml new file mode 100644 index 0000000000..c9f9021fb2 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit colors="true" bootstrap="vendor/autoload.php" defaultTestSuite="Plugin"> + <testsuites> + <testsuite name="Plugin"> + <directory>tests</directory> + </testsuite> + </testsuites> + + <filter> + <whitelist> + <directory>./src/*/</directory> + </whitelist> + </filter> + +</phpunit> \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php new file mode 100644 index 0000000000..212a6d9e07 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\Package\PackageInterface; +use LastCall\DownloadsPlugin\Handler\ArchiveHandler; +use LastCall\DownloadsPlugin\Handler\BaseHandler; +use LastCall\DownloadsPlugin\Handler\FileHandler; +use LastCall\DownloadsPlugin\Handler\PharHandler; + +class DownloadsParser +{ + + /** + * @param \Composer\Package\PackageInterface $package + * + * @return BaseHandler[] + * Each item is a specification of an extra file, with defaults and variables evaluated. + */ + public function parse(PackageInterface $package, $basePath) + { + $extraFiles = []; + $extra = $package->getExtra(); + + $defaults = isset($extra['downloads']['*']) ? $extra['downloads']['*'] : []; + + if (!empty($extra['downloads'])) { + foreach ((array) $extra['downloads'] as $id => $extraFile) { + if ($id === '*') continue; + + $vars = ['{$id}' => $id]; + $extraFile = array_merge($defaults, $extraFile); + $extraFile['id'] = $id; + foreach (['url', 'path'] as $prop) { + if (isset($extraFile[$prop])) { + $extraFile[$prop] = strtr($extraFile[$prop], $vars); + } + } + + $class = $this->pickClass($extraFile); + $extraFiles[] = new $class($package, $basePath, $extraFile); + } + } + + return $extraFiles; + } + + public function pickClass($extraFile) + { + $types = [ + 'archive' => ArchiveHandler::CLASS, + 'file' => FileHandler::CLASS, + 'phar' => PharHandler::CLASS, + ]; + if (isset($extraFile['type'], $types[$extraFile['type']])) { + return $types[$extraFile['type']]; + } + + $parts = parse_url($extraFile['url']); + $filename = pathinfo($parts['path'], PATHINFO_BASENAME); + if (preg_match('/\.(zip|tar\.gz|tgz)$/', $filename)) { + return $types['archive']; + } + + return $types['file']; + } +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php new file mode 100644 index 0000000000..0e7aaad664 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php @@ -0,0 +1,57 @@ +<?php +namespace LastCall\DownloadsPlugin; + +use Composer\IO\IOInterface; + +class GlobCleaner +{ + + /** + * @param IOInterface $io + * @param string $baseDir + * @param string[] $ignores + * @return \Generator|void + */ + public static function clean(IOInterface $io, $baseDir, $ignores) + { + if (empty($ignores)) { + return; + } + + $dirs = []; + + $finder = new \TOGoS_GitIgnore_FileFinder(array( + 'ruleset' => \TOGoS_GitIgnore_Ruleset::loadFromStrings($ignores), + 'invertRulesetResult' => false, + 'defaultResult' => false, + 'includeDirectories' => false, + 'callback' => function($file, $match) use ($baseDir, &$dirs) { + if ($match) { + unlink("$baseDir/$file"); + $dir = dirname($file); + if ($dir !== '.') { + $dirs[dirname($file)] = 1; + } + } + } + )); + $finder->findFiles($baseDir); + + // Cleanup any empy directories + $dirNames = array_keys($dirs); + $byLength = function ($a, $b) { + return strlen($b) - strlen($a); + }; + usort($dirNames, $byLength); + + while ($dirName = array_shift($dirNames)) { + if (!glob("$baseDir/$dirName/*")) { + @rmdir("$baseDir/$dirName"); + $dirNames[] = dirname($dirName); + usort($dirNames, $byLength); + } + } + } + + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php new file mode 100644 index 0000000000..19f95c26fe --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php @@ -0,0 +1,65 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use LastCall\DownloadsPlugin\GlobCleaner; + +class ArchiveHandler extends BaseHandler +{ + + public function createSubpackage() + { + $pkg = parent::createSubpackage(); + $pkg->setDistType($this->parseDistType($this->extraFile['url'])); + return $pkg; + } + + protected function parseDistType($url) + { + $parts = parse_url($url); + $filename = pathinfo($parts['path'], PATHINFO_BASENAME); + if (preg_match('/\.zip$/', $filename)) { + return 'zip'; + } elseif (preg_match('/\.(tar\.gz|tgz)$/', $filename)) { + return 'tar'; + } else { + throw new \RuntimeException("Failed to determine archive type for $filename"); + } + } + + public function getTrackingFile() + { + $file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json'; + return + $this->getTargetPath() . + DIRECTORY_SEPARATOR . self::DOT_DIR . + DIRECTORY_SEPARATOR . $file; + } + + /** + * @return string[]|NULL + * List of files to exclude. Use '**' to match subdirectories. + * Ex: ['.gitignore', '*.md'] + */ + public function findIgnores() + { + return isset($this->extraFile['ignore']) + ? $this->extraFile['ignore'] + : NULL; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) + { + $targetPath = $this->getTargetPath(); + $downloadManager = $composer->getDownloadManager(); + $downloadManager->download($this->getSubpackage(), $targetPath); + GlobCleaner::clean($io, $targetPath, $this->findIgnores()); + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php new file mode 100644 index 0000000000..020fff8303 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php @@ -0,0 +1,114 @@ +<?php +/** + * Created by PhpStorm. + * User: totten + * Date: 8/21/19 + * Time: 6:31 PM + */ + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Package\PackageInterface; +use Composer\Package\RootPackageInterface; +use Composer\Package\Version\VersionParser; +use LastCall\DownloadsPlugin\Subpackage; + + +abstract class BaseHandler +{ + const FAKE_VERSION = 'dev-master'; + const DOT_DIR = '.composer-downloads'; + + /** + * @var array + * File specification from composer.json, with defaults/substitutions applied. + */ + protected $extraFile; + + /** + * @var PackageInterface + */ + protected $parent; + + /** + * @var string + * Path to the parent package. + */ + protected $parentPath; + + /** + * @var Subpackage + */ + protected $subpackage; + + /** + * BaseHandler constructor. + * @param PackageInterface $parent + * @param string $parentPath + * @param array $extraFile + */ + public function __construct(PackageInterface $parent, $parentPath, $extraFile) + { + $this->parent = $parent; + $this->parentPath = $parentPath; + $this->extraFile = $extraFile; + } + + public function getSubpackage() { + if ($this->subpackage === NULL) { + $this->subpackage = $this->createSubpackage(); + } + return $this->subpackage; + } + + /** + * @return Subpackage + */ + public function createSubpackage() + { + $versionParser = new VersionParser(); + $extraFile = $this->extraFile; + $parent = $this->parent; + + $package = new Subpackage( + $parent, + $extraFile['id'], + $extraFile['url'], + NULL, + $extraFile['path'], + $parent instanceof RootPackageInterface ? $versionParser->normalize(self::FAKE_VERSION) : $parent->getVersion(), + $parent instanceof RootPackageInterface ? self::FAKE_VERSION : $parent->getPrettyVersion() + ); + + return $package; + } + + public function createTrackingData() { + return [ + 'name' => $this->getSubpackage()->getName(), + 'url' => $this->getSubpackage()->getDistUrl(), + ]; + } + + /** + * @return string + */ + public function getTargetPath() + { + return $this->parentPath . '/' . $this->extraFile['path']; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + abstract public function download(Composer $composer, IOInterface $io); + + /** + * @return string + */ + abstract public function getTrackingFile(); + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php new file mode 100644 index 0000000000..fbf8878373 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php @@ -0,0 +1,63 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Util\Filesystem; + +class FileHandler extends BaseHandler +{ + const TMP_PREFIX = '.composer-extra-tmp-'; + + public function createSubpackage() + { + $pkg = parent::createSubpackage(); + $pkg->setDistType('file'); + return $pkg; + } + + public function getTrackingFile() + { + $file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json'; + return + dirname($this->getTargetPath()) . + DIRECTORY_SEPARATOR . self::DOT_DIR . + DIRECTORY_SEPARATOR . $file; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) { + // We want to take advantage of the cache in composer's downloader, but it + // doesn't put the file the spot we want, so we shuffle a bit. + + $cfs = new Filesystem(); + $target = $this->getTargetPath(); + $tmpDir = dirname($target) . DIRECTORY_SEPARATOR . self::TMP_PREFIX . basename($target); + + if (file_exists($tmpDir)) { + $cfs->remove($tmpDir); + } + + $pkg = clone $this->getSubpackage(); + $pkg->setTargetDir($tmpDir); + $downloadManager = $composer->getDownloadManager(); + $downloadManager->download($pkg, $tmpDir); + + if (file_exists($target)) { + $cfs->remove($target); + } + + foreach ((array)glob("$tmpDir/*") as $file) { + if (is_file($file)) { + $cfs->rename($file, $target); + $cfs->remove($tmpDir); + break; + } + } + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php new file mode 100644 index 0000000000..1e531de7d4 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php @@ -0,0 +1,28 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Util\Platform; + + +class PharHandler extends FileHandler +{ + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) { + parent::download($composer, $io); + + if (Platform::isWindows()) { + // TODO make .bat or .cmd + } else { + chmod($this->getTargetPath(), 0777 ^ umask()); + } + } + + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php new file mode 100644 index 0000000000..90f10503a4 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php @@ -0,0 +1,131 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\Composer; +use Composer\EventDispatcher\EventSubscriberInterface; +use Composer\Installer\PackageEvent; +use Composer\Installer\PackageEvents; +use Composer\IO\IOInterface; +use Composer\Package\Package; +use Composer\Package\PackageInterface; +use Composer\Plugin\PluginInterface; +use Composer\Script\Event; +use Composer\Script\ScriptEvents; +use LastCall\DownloadsPlugin\Handler\BaseHandler; + +class Plugin implements PluginInterface, EventSubscriberInterface +{ + + /** @var Composer */ + private $composer; + /** @var IOInterface */ + private $io; + + private $parser; + + public function __construct() + { + $this->parser = new DownloadsParser(); + } + + public static function getSubscribedEvents() + { + return [ + PackageEvents::POST_PACKAGE_INSTALL => ['installDownloads', 10], + PackageEvents::POST_PACKAGE_UPDATE => ['updateDownloads', 10], + ScriptEvents::POST_INSTALL_CMD => ['installDownloadsRoot', 10], + ScriptEvents::POST_UPDATE_CMD => ['installDownloadsRoot', 10], + ]; + } + + public function installDownloadsRoot(Event $event) { + $rootPackage = $this->composer->getPackage(); + $this->installUpdateDownloads(getcwd(), $rootPackage); + + // Ensure that any other packages are properly reconciled. + $localRepo = $this->composer->getRepositoryManager()->getLocalRepository(); + $installationManager = $this->composer->getInstallationManager(); + foreach ($localRepo->getCanonicalPackages() as $package) { + /** @var \Composer\Package\PackageInterface $package */ + if (!empty($package->getExtra()['downloads'])) { + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + } + } + public function installDownloads(PackageEvent $event) + { + /** @var \Composer\Package\PackageInterface $package */ + $package = $event->getOperation()->getPackage(); + $installationManager = $event->getComposer()->getInstallationManager(); + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + + public function updateDownloads(PackageEvent $event) + { + /** @var \Composer\Package\PackageInterface $package */ + $package = $event->getOperation()->getTargetPackage(); + $installationManager = $event->getComposer()->getInstallationManager(); + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + + public function activate(Composer $composer, IOInterface $io) + { + $this->composer = $composer; + $this->io = $io; + } + + /** + * @param string $basePath + * @param PackageInterface $package + */ + protected function installUpdateDownloads($basePath, $package) + { + $first = TRUE; + foreach ($this->parser->parse($package, $basePath) as $extraFileHandler) { + /** @var BaseHandler $extraFileHandler */ + $extraFilePkg = $extraFileHandler->getSubpackage(); + $targetPath = $extraFileHandler->getTargetPath(); + $trackingFile = $extraFileHandler->getTrackingFile(); + + if (file_exists($targetPath) && !file_exists($trackingFile)) { + $this->io->write(sprintf("<info>Extra file <comment>%s</comment> has been locally overriden in <comment>%s</comment>. To reset it, delete and reinstall.</info>", $extraFilePkg->getName(), $extraFilePkg->getTargetDir()), TRUE); + continue; + } + + if (file_exists($targetPath) && file_exists($trackingFile)) { + $meta = @json_decode(file_get_contents($trackingFile), 1); + if ($meta['url'] === $extraFilePkg->getDistUrl()) { + $this->io->write(sprintf("<info>Skip extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERY_VERBOSE); + continue; + } + } + + if ($first) { + $this->io->write(sprintf("<info>Download extra files for <comment>%s</comment></info>", $package->getName())); + $first = FALSE; + } + + $this->io->write(sprintf("<info>Download extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERBOSE); + $extraFileHandler->download($this->composer, $this->io, $basePath); + + if (!file_exists(dirname($trackingFile))) { + mkdir(dirname($trackingFile), 0777, TRUE); + } + file_put_contents($trackingFile, json_encode( + $extraFileHandler->createTrackingData(), + JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES + )); + } + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php new file mode 100644 index 0000000000..62d4b754fc --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php @@ -0,0 +1,48 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\IO\IOInterface; +use Composer\Package\Package; +use Composer\Package\PackageInterface; +use Composer\Package\RootPackageInterface; + +/** + * Class Subpackage + * @package LastCall\DownloadsPlugin + * + * A subpackage is simulated package which lives beneath some parent package. + */ +class Subpackage extends Package +{ + + /** + * @var PackageInterface + */ + private $parent; + + public function __construct(PackageInterface $parent, $id, $url, $type, $path, $version = NULL, $prettyVersion = NULL) + { + parent::__construct( + sprintf('%s:%s', $parent->getName(), $id), + $version ? $version : $parent->getVersion(), + $prettyVersion ? $prettyVersion : $parent->getPrettyVersion() + ); + $this->parent = $parent; + $this->id = $id; + $this->setDistUrl($url); + $this->setDistType($type); + $this->setTargetDir($path); + $this->setInstallationSource('dist'); + } + +} diff --git a/civicrm/vendor/composer/autoload_namespaces.php b/civicrm/vendor/composer/autoload_namespaces.php index 573acec296..a423bbfc89 100644 --- a/civicrm/vendor/composer/autoload_namespaces.php +++ b/civicrm/vendor/composer/autoload_namespaces.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'Validate' => array($vendorDir . '/pear/validate_finance_creditcard'), + 'TOGoS_GitIgnore_' => array($vendorDir . '/togos/gitignore/src/main/php'), 'System' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'Svg\\' => array($vendorDir . '/phenx/php-svg-lib/src'), 'Sabberworm\\CSS' => array($vendorDir . '/sabberworm/php-css-parser/lib'), diff --git a/civicrm/vendor/composer/autoload_psr4.php b/civicrm/vendor/composer/autoload_psr4.php index 5da2a783b6..9c4781cc87 100644 --- a/civicrm/vendor/composer/autoload_psr4.php +++ b/civicrm/vendor/composer/autoload_psr4.php @@ -28,6 +28,7 @@ return array( 'MJS\\TopSort\\Tests\\' => array($vendorDir . '/marcj/topsort/tests/Tests'), 'MJS\\TopSort\\' => array($vendorDir . '/marcj/topsort/src'), 'League\\Csv\\' => array($vendorDir . '/league/csv/src'), + 'LastCall\\DownloadsPlugin\\' => array($vendorDir . '/civicrm/composer-downloads-plugin/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php index b848022d01..f402b107c8 100644 --- a/civicrm/vendor/composer/autoload_real.php +++ b/civicrm/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 +class ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; $includePaths[] = get_include_path(); @@ -31,7 +31,7 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -52,19 +52,19 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire6179788ed8c0396133d329bcbd0c0ed6($fileIdentifier, $file); + composerRequirebb3b672ecd66f991faa2e0268d5d8880($fileIdentifier, $file); } return $loader; } } -function composerRequire6179788ed8c0396133d329bcbd0c0ed6($fileIdentifier, $file) +function composerRequirebb3b672ecd66f991faa2e0268d5d8880($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/civicrm/vendor/composer/autoload_static.php b/civicrm/vendor/composer/autoload_static.php index da7509f769..31ecadcc80 100644 --- a/civicrm/vendor/composer/autoload_static.php +++ b/civicrm/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 +class ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880 { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -58,6 +58,7 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 'L' => array ( 'League\\Csv\\' => 11, + 'LastCall\\DownloadsPlugin\\' => 25, ), 'G' => array ( @@ -170,6 +171,10 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 array ( 0 => __DIR__ . '/..' . '/league/csv/src', ), + 'LastCall\\DownloadsPlugin\\' => + array ( + 0 => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src', + ), 'GuzzleHttp\\Psr7\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', @@ -212,6 +217,13 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 0 => __DIR__ . '/..' . '/pear/validate_finance_creditcard', ), ), + 'T' => + array ( + 'TOGoS_GitIgnore_' => + array ( + 0 => __DIR__ . '/..' . '/togos/gitignore/src/main/php', + ), + ), 'S' => array ( 'System' => @@ -456,11 +468,11 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixesPsr0; - $loader->fallbackDirsPsr0 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$fallbackDirsPsr0; - $loader->classMap = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixesPsr0; + $loader->fallbackDirsPsr0 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$fallbackDirsPsr0; + $loader->classMap = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$classMap; }, null, ClassLoader::class); } diff --git a/civicrm/vendor/composer/installed.json b/civicrm/vendor/composer/installed.json index 2114774cd4..b65a780813 100644 --- a/civicrm/vendor/composer/installed.json +++ b/civicrm/vendor/composer/installed.json @@ -198,6 +198,59 @@ ], "description": "CiviCRM installation library" }, + { + "name": "civicrm/composer-downloads-plugin", + "version": "v2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/civicrm/composer-downloads-plugin.git", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/civicrm/composer-downloads-plugin/zipball/869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "friendsofphp/php-cs-fixer": "^2.3", + "phpunit/phpunit": "^5.7", + "totten/process-helper": "^1.0.1" + }, + "time": "2019-08-22T10:56:51+00:00", + "type": "composer-plugin", + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "description": "Composer plugin for downloading additional files within any composer package." + }, { "name": "cweagans/composer-patches", "version": "1.6.5", @@ -2347,6 +2400,41 @@ "qrcode" ] }, + { + "name": "togos/gitignore", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/TOGoS/PHPGitIgnore.git", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TOGoS/PHPGitIgnore/zipball/32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "time": "2019-04-19T19:16:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files" + }, { "name": "totten/ca-config", "version": "v17.05.0", diff --git a/civicrm/vendor/togos/gitignore/.gitignore b/civicrm/vendor/togos/gitignore/.gitignore new file mode 100644 index 0000000000..ff72e2d08c --- /dev/null +++ b/civicrm/vendor/togos/gitignore/.gitignore @@ -0,0 +1,2 @@ +/composer.lock +/vendor diff --git a/civicrm/vendor/togos/gitignore/Makefile b/civicrm/vendor/togos/gitignore/Makefile new file mode 100644 index 0000000000..3f547218ef --- /dev/null +++ b/civicrm/vendor/togos/gitignore/Makefile @@ -0,0 +1,13 @@ +default: run-unit-tests + +.PHONY: run-unit-tests + +composer.lock: | composer.json + composer install + +vendor: composer.lock + composer install + touch "$@" + +run-unit-tests: vendor + vendor/bin/phpsimplertest --bootstrap vendor/autoload.php src/test/ --colorful-output diff --git a/civicrm/vendor/togos/gitignore/composer.json b/civicrm/vendor/togos/gitignore/composer.json new file mode 100644 index 0000000000..b5df8a8cc0 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/composer.json @@ -0,0 +1,27 @@ +{ + "name": "togos/gitignore", + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files", + "license": "MIT", + + "require": { + "php": ">=5.2" + }, + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + + + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "autoload-dev": { + "psr-0": { + "TOGoS_GitIgnore_": "src/test/php/" + } + }, + "scripts": { + "test": "vendor/bin/phpsimplertest --colorful-output --bootstrap vendor/autoload.php src/test/" + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php new file mode 100644 index 0000000000..a476937684 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php @@ -0,0 +1,42 @@ +<?php + +class TOGoS_GitIgnore_FileFinder +{ + public function __construct(array $options) { + // TODO: Validate options + $this->ruleset = $options['ruleset']; + $this->invertRulesetResult = $options['invertRulesetResult']; + $this->defaultResult = $options['defaultResult']; + $this->includeDirectories = $options['includeDirectories']; + $this->callback = $options['callback']; + } + + protected function match($rootDir, $f) { + $result = $this->ruleset->match($f); + if( $this->invertRulesetResult and $result !== null ) $result = !$result; + return $result === null ? $this->defaultResult : $result; + } + + protected function _findFiles($rootDir, $f) { + if( preg_match('#/$#', $rootDir) ) throw new Exception("Root directory argument to _findFiles should not end with a slash; given «{$rootDir}»"); + if( preg_match('#^/|/$#', $f) ) throw new Exception("Relative path argument to _findFiles should not start or end with a slash; given «{$f}»"); + //echo "_findFiles($rootDir, $f)\n"; + $fullPath = $f == '' ? $rootDir : $rootDir.'/'.$f; + if( $this->includeDirectories or !is_dir($fullPath) ) { + $result = $this->match($rootDir, $f); + call_user_func($this->callback, $f, $result); + } + if( is_dir($fullPath) ) { + $dh = opendir($fullPath); + while( ($fn = readdir($dh)) !== false ) { + if( $fn == '.' or $fn == '..' ) continue; + $this->_findFiles($rootDir, $f == '' ? $fn : $f.'/'.$fn); + } + closedir($dh); + } + } + + public function findFiles($dir) { + self::_findFiles($dir, ''); + } +} \ No newline at end of file diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php new file mode 100644 index 0000000000..10b9ab0c0d --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php @@ -0,0 +1,56 @@ +<?php + +class TOGoS_GitIgnore_Pattern +{ + protected $patternString; + protected $regex; + protected function __construct($pattern, $regex) { + $this->patternString = $pattern; + $this->regex = $regex; + } + + public function getPatternString() { + return $this->patternString; + } + + protected static function patternToRegex($pp) { + preg_match_all('/\*|\*\*|\?|[^\*\?]|\[![^\]+]|\[[^\]+]/', $pp, $bifs); + $regex = ''; + foreach( $bifs[0] as $part ) { + if( $part == '**' ) $regex .= ".*"; + else if( $part == '*' ) $regex .= "[^/]*"; + else if( $part == '?' ) $regex .= '?'; + else if( $part[0] == '[' ) { + // Not exactly, but maybe close enough. + // Maybe fnmatch is the thing to use + if( $part[1] == '!' ) $part[1] = '^'; + $regex .= $part; + } + else $regex .= preg_quote($part, '#'); + } + return $regex; + } + + public static function parse($pattern) { + $r = self::patternToRegex($pattern); + if( strlen($pattern) == 0 ) { + throw new Exception("Zero-length pattern string passed to ".__METHOD__); + } + if( $pattern[0] == '/' ) { + $r = '#^'.substr($r,1).'(?:$|/)#'; + } else { + $r = '#(?:^|/)'.$r.'(?:$|/)#'; + } + return new self($pattern, $r); + } + + public function match($path) { + if( strlen($path) > 0 and $path[0] == '/' ) { + throw new Exception("Paths passed to #match should not start with a slash; given: «".$path."»"); + } + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + return preg_match($this->regex, $path); + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php new file mode 100644 index 0000000000..3b09bcd545 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php @@ -0,0 +1,33 @@ +<?php + +class TOGoS_GitIgnore_Rule +{ + protected $isExclusion; + protected $pattern; + + public function __construct(TOGoS_GitIgnore_Pattern $pattern, $isExclusion) { + $this->pattern = $pattern; + $this->isExclusion = $isExclusion; + } + + /** @return true: include this file, false: exclude this file, null: rule does not apply to this file */ + public function match($path) { + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + if( $this->pattern->match($path) ) { + return $this->isExclusion ? false : true; + } + return null; + } + + public static function parse($str) { + $isExclusion = false; + if( $str[0] == '!' ) { + $isExclusion = true; + $str = substr($str, 1); + } + $pattern = TOGoS_GitIgnore_Pattern::parse($str); + return new self($pattern, $isExclusion); + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php new file mode 100644 index 0000000000..19b99cae52 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php @@ -0,0 +1,51 @@ +<?php + +class TOGoS_GitIgnore_Ruleset +{ + protected $rules; + + public function addRule($rule) { + if( is_string($rule) ) { + $str = trim($rule); + if( $str == '' ) return; + if( $str[0] == '#' ) return; + if( substr($str,0,2) == '\\#' ) $str = substr($str,1); + $rule = TOGoS_GitIgnore_Rule::parse($str); + } + if( !($rule instanceof TOGoS_GitIgnore_Rule) ) { + throw new Exception("Argument to TOGoS_GitIgnore_Ruleset#addRule should be a string or TOGoS_GitIgnore_Rule; received ".TOGoS_GitIgnore_Util::describe($rule)); + } + $this->rules[] = $rule; + } + + public function match($path) { + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + $lastResult = null; + foreach( $this->rules as $rule ) { + $result = $rule->match($path); + if( $result !== null ) $lastResult = $result; + } + return $lastResult; + } + + public static function loadFromStrings($lines) { + $rs = new self; + foreach( $lines as $line ) $rs->addRule($line); + return $rs; + } + + public static function loadFromString($str) { + $lines = explode("\n", $str); + return self::loadFromStrings($lines); + } + + public static function loadFromFile($filename) { + $rs = new self; + $fh = fopen($filename); + while( ($line = fgets($fh)) ) $rs->addRule($line); + fclose($fh); + return $rs; + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php new file mode 100644 index 0000000000..f4282ac707 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php @@ -0,0 +1,17 @@ +<?php + +class TOGoS_GitIgnore_Util +{ + public static function aize($word) { + if( preg_match('/^[aeiou]/', $word) ) return "an $word"; + return "a $word"; + } + + public static function describe($val) { + if( $val === null ) return "null"; + if( is_float($val) or is_int($val) ) return "the number $val"; + if( is_bool($val) ) return $val ? "true" : "false"; + if( is_object($val) ) return self::aize(get_class($val)); + return aize(gettype($val)); + } +} diff --git a/civicrm/xml/schema/ACL/Cache.xml b/civicrm/xml/schema/ACL/Cache.xml index d73ea8a08a..38c9df70bb 100644 --- a/civicrm/xml/schema/ACL/Cache.xml +++ b/civicrm/xml/schema/ACL/Cache.xml @@ -2,7 +2,7 @@ <table> <base>CRM/ACL</base> - <class>Cache</class> + <class>ACLCache</class> <name>civicrm_acl_cache</name> <comment>Cache for acls and contacts</comment> <add>1.6</add> diff --git a/civicrm/xml/schema/Contact/Contact.xml b/civicrm/xml/schema/Contact/Contact.xml index 1539d0c6e8..14965f9ffc 100644 --- a/civicrm/xml/schema/Contact/Contact.xml +++ b/civicrm/xml/schema/Contact/Contact.xml @@ -496,6 +496,8 @@ <optionGroupName>communication_style</optionGroupName> </pseudoconstant> <export>true</export> + <import>true</import> + <headerPattern>/style/i</headerPattern> <comment>Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.</comment> <add>4.4</add> <html> @@ -874,6 +876,11 @@ <default>NULL</default> <add>4.3</add> </field> + <index> + <name>index_created_date</name> + <fieldName>created_date</fieldName> + <add>5.18</add> + </index> <field> <name>modified_date</name> <type>timestamp</type> @@ -883,4 +890,9 @@ <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default> <add>4.3</add> </field> + <index> + <name>index_modified_date</name> + <fieldName>modified_date</fieldName> + <add>5.18</add> + </index> </table> diff --git a/civicrm/xml/schema/Core/ActionLog.xml b/civicrm/xml/schema/Core/ActionLog.xml index a707d70d6e..7c3e7a439b 100644 --- a/civicrm/xml/schema/Core/ActionLog.xml +++ b/civicrm/xml/schema/Core/ActionLog.xml @@ -103,6 +103,6 @@ <default>NULL</default> <comment>Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)</comment> <add>4.6</add> - <change>5.14</change> + <change>5.17</change> </field> </table> diff --git a/civicrm/xml/schema/Core/Address.xml b/civicrm/xml/schema/Core/Address.xml index 5b792fd4a6..3e9ff7f550 100644 --- a/civicrm/xml/schema/Core/Address.xml +++ b/civicrm/xml/schema/Core/Address.xml @@ -394,7 +394,7 @@ </field> <field> <name>manual_geo_code</name> - <title>Is manually geocoded</title> + <title>Is Manually Geocoded</title> <type>boolean</type> <default>0</default> <comment>Is this a manually entered geo code</comment> @@ -402,6 +402,7 @@ <html> <type>CheckBox</type> </html> + <export>true</export> </field> <field> <name>timezone</name> diff --git a/civicrm/xml/schema/Core/Cache.xml b/civicrm/xml/schema/Core/Cache.xml index 29445f1aa9..564a277329 100644 --- a/civicrm/xml/schema/Core/Cache.xml +++ b/civicrm/xml/schema/Core/Cache.xml @@ -8,8 +8,10 @@ <add>2.1</add> <field> <name>id</name> + <title>Cache ID</title> <type>int unsigned</type> <required>true</required> + <comment>Unique table ID</comment> <add>2.1</add> </field> <primaryKey> @@ -18,6 +20,7 @@ </primaryKey> <field> <name>group_name</name> + <title>Group Name</title> <type>varchar</type> <length>32</length> <required>true</required> @@ -26,6 +29,7 @@ </field> <field> <name>path</name> + <title>Path</title> <type>varchar</type> <length>255</length> <comment>Unique path name for cache element</comment> @@ -49,12 +53,14 @@ </index> <field> <name>data</name> + <title>Data</title> <type>longtext</type> <comment>data associated with this path</comment> <add>2.1</add> </field> <field> <name>component_id</name> + <title>Component ID</title> <type>int unsigned</type> <comment>Component that this menu item belongs to</comment> <add>2.1</add> @@ -75,6 +81,7 @@ </foreignKey> <field> <name>created_date</name> + <title>Created Date</title> <type>timestamp</type> <default>CURRENT_TIMESTAMP</default> <comment>When was the cache item created</comment> @@ -82,6 +89,7 @@ </field> <field> <name>expired_date</name> + <title>Expired Date</title> <type>timestamp</type> <default>NULL</default> <required>false</required> diff --git a/civicrm/xml/schema/Core/Dashboard.xml b/civicrm/xml/schema/Core/Dashboard.xml index 41ed111374..96da590e28 100644 --- a/civicrm/xml/schema/Core/Dashboard.xml +++ b/civicrm/xml/schema/Core/Dashboard.xml @@ -35,6 +35,7 @@ <table>civicrm_domain</table> <key>id</key> <add>3.1</add> + <onDelete>CASCADE</onDelete> </foreignKey> <field> <name>name</name> diff --git a/civicrm/xml/schema/Member/Membership.xml b/civicrm/xml/schema/Member/Membership.xml index 3be8131490..9522592d80 100644 --- a/civicrm/xml/schema/Member/Membership.xml +++ b/civicrm/xml/schema/Member/Membership.xml @@ -84,6 +84,7 @@ <type>Select Date</type> <formatType>activityDate</formatType> </html> + <uniqueName>membership_join_date</uniqueName> </field> <field> <name>start_date</name> @@ -156,8 +157,10 @@ </foreignKey> <field> <name>is_override</name> + <uniqueName>member_is_override</uniqueName> <title>Status Override</title> <import>true</import> + <export>true</export> <headerPattern>/override$/i</headerPattern> <type>boolean</type> <comment>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.</comment> @@ -203,6 +206,7 @@ <type>int</type> <comment>Maximum number of related memberships (membership_type override).</comment> <add>4.3</add> + <export>true</export> <html> <type>Text</type> </html> @@ -234,8 +238,10 @@ </field> <field> <name>contribution_recur_id</name> + <uniqueName>membership_recur_id</uniqueName> <title>Membership Recurring Contribution</title> <type>int unsigned</type> + <export>true</export> <comment>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.</comment> <add>3.3</add> </field> diff --git a/civicrm/xml/schema/Pledge/Pledge.xml b/civicrm/xml/schema/Pledge/Pledge.xml index 50ecd9c226..7fd1cf35cc 100644 --- a/civicrm/xml/schema/Pledge/Pledge.xml +++ b/civicrm/xml/schema/Pledge/Pledge.xml @@ -196,11 +196,14 @@ <type>datetime</type> <title>Pledge Start Date</title> <required>true</required> + <export>true</export> <comment>The date the first scheduled pledge occurs.</comment> <add>2.1</add> <html> - <type>Select Date</type> - </html> + <type>Select Date</type> + </html> + <uniqueName>pledge_start_date</uniqueName> + <uniqueTitle>Payments Start Date</uniqueTitle> </field> <field> <name>create_date</name> @@ -209,6 +212,7 @@ <title>Pledge Made</title> <required>true</required> <import>true</import> + <export>true</export> <comment>When this pledge record was created.</comment> <add>2.1</add> <html> @@ -222,7 +226,7 @@ <comment>When a pledge acknowledgement message was sent to the contributor.</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> </field> <field> @@ -239,18 +243,21 @@ <comment>Date this pledge was cancelled by contributor.</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> </field> <field> <name>end_date</name> <type>datetime</type> <title>Pledge End Date</title> + <export>true</export> <comment>Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> + <uniqueName>pledge_end_date</uniqueName> + <uniqueTitle>Payments Ended Date</uniqueTitle> </field> <field> <name>max_reminders</name> @@ -259,8 +266,8 @@ <default>1</default> <comment>The maximum number of payment reminders to send for any given payment.</comment> <html> - <type>Text</type> - </html> + <type>Text</type> + </html> <add>2.1</add> </field> <field> @@ -271,8 +278,8 @@ <comment>Send initial reminder this many days prior to the payment due date.</comment> <add>2.1</add> <html> - <type>Select</type> - </html> + <type>Select</type> + </html> </field> <field> <name>additional_reminder_day</name> @@ -282,8 +289,8 @@ <comment>Send additional reminder this many days after last one sent, up to maximum number of reminders.</comment> <add>2.1</add> <html> - <type>Text</type> - </html> + <type>Text</type> + </html> </field> <field> <name>status_id</name> diff --git a/civicrm/xml/schema/Pledge/PledgePayment.xml b/civicrm/xml/schema/Pledge/PledgePayment.xml index e13eb9e16b..bc711aef43 100644 --- a/civicrm/xml/schema/Pledge/PledgePayment.xml +++ b/civicrm/xml/schema/Pledge/PledgePayment.xml @@ -60,6 +60,7 @@ <uniqueName>pledge_payment_scheduled_amount</uniqueName> <title>Scheduled Amount</title> <import>true</import> + <export>true</export> <type>decimal</type> <required>true</required> <comment>Pledged amount for this payment (the actual contribution amount might be different).</comment> @@ -98,6 +99,7 @@ <uniqueName>pledge_payment_scheduled_date</uniqueName> <title>Scheduled Date</title> <import>true</import> + <export>true</export> <type>datetime</type> <required>true</required> <comment>The date the pledge payment is supposed to happen.</comment> @@ -106,6 +108,7 @@ <type>Select Date</type> <formatType>activityDate</formatType> </html> + <uniqueTitle>Payment Scheduled</uniqueTitle> </field> <field> <name>reminder_date</name> diff --git a/civicrm/xml/templates/civicrm_data.tpl b/civicrm/xml/templates/civicrm_data.tpl index f921cc8c44..42eff2a277 100644 --- a/civicrm/xml/templates/civicrm_data.tpl +++ b/civicrm/xml/templates/civicrm_data.tpl @@ -1603,7 +1603,7 @@ INSERT INTO civicrm_uf_field ( 10, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Soft Credit{/ts}', 'Contribution', NULL, NULL ), ( 10, 'soft_credit_type', 0, 0, 11, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Soft Credit Type{/ts}', 'Contribution', NULL, NULL ), ( 11, 'membership_type', 1, 1, 1, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Membership Type{/ts}', 'Membership', NULL, NULL ), - ( 11, 'join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Member Since{/ts}', 'Membership', NULL, NULL ), + ( 11, 'membership_join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Member Since{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_start_date', 0, 1, 3, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Start Date{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_end_date', 0, 1, 4, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}End Date{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_source', 0, 0, 5, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Source{/ts}', 'Membership', NULL, NULL ), diff --git a/civicrm/xml/templates/civicrm_navigation.tpl b/civicrm/xml/templates/civicrm_navigation.tpl index 7db2e3a1f5..4a39b8feb7 100644 --- a/civicrm/xml/templates/civicrm_navigation.tpl +++ b/civicrm/xml/templates/civicrm_navigation.tpl @@ -737,17 +737,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Membership Summary{/ts}', 'member/summary', '{ts escape="sql" skip="true"}Provides a summary of memberships by type and join date.{/ts}', 'access CiviMember', '{literal}a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Membership Summary{/ts}', 'member/summary', '{ts escape="sql" skip="true"}Provides a summary of memberships by type and join date.{/ts}', 'access CiviMember', '{literal}a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Membership Details{/ts}', 'member/detail', '{ts escape="sql" skip="true"}Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.{/ts}', 'access CiviMember', '{literal}a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Membership Details{/ts}', 'member/detail', '{ts escape="sql" skip="true"}Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.{/ts}', 'access CiviMember', '{literal}a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Contribution and Membership Details{/ts}', 'member/contributionDetail', '{ts escape="sql" skip="true"}Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.{/ts}', 'access CiviMember', '{literal}a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Contribution and Membership Details{/ts}', 'member/contributionDetail', '{ts escape="sql" skip="true"}Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.{/ts}', 'access CiviMember', '{literal}a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml index 44540ad98a..21081c4bc7 100644 --- a/civicrm/xml/version.xml +++ b/civicrm/xml/version.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="iso-8859-1" ?> <version> - <version_no>5.17.5</version_no> + <version_no>5.18.0</version_no> </version> diff --git a/wp-rest/.editorconfig b/wp-rest/.editorconfig deleted file mode 100644 index 09dc3747d3..0000000000 --- a/wp-rest/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -# EditorConfig is awesome: https://editorconfig.org - -# Not top-most EditorConfig file -root = false - -# Tab indentation -[*.php] -indent_style = tab -indent_size = 4 diff --git a/wp-rest/Autoloader.php b/wp-rest/Autoloader.php deleted file mode 100644 index dfa95f8a02..0000000000 --- a/wp-rest/Autoloader.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** - * Autoloader class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST; - -class Autoloader { - - /** - * Instance. - * - * @since 0.1 - * @var string - */ - private static $instance = null; - - /** - * Namespace. - * - * @since 0.1 - * @var string - */ - private $namespace = 'CiviCRM_WP_REST'; - - /** - * Autoloader directory sources. - * - * @since 0.1 - * @var array - */ - private static $source_directories = []; - - /** - * Constructor. - * - * @since 0.1 - */ - private function __construct() { - - $this->register_autoloader(); - - } - - /** - * Creates an instance of this class. - * - * @since 0.1 - */ - private static function instance() { - - if ( ! self::$instance ) self::$instance = new self; - - } - - /** - * Adds a directory source. - * - * @since 0.1 - * @param string $source The source path - */ - public static function add_source( string $source_path ) { - - // make sure we have an instance - self::instance(); - - if ( ! is_readable( trailingslashit( $source_path ) ) ) - return \WP_Error( 'civicrm_wp_rest_error', sprintf( __( 'The source %s is not readable.', 'civicrm' ), $source ) ); - - self::$source_directories[] = $source_path; - - } - - /** - * Registers the autoloader. - * - * @since 0.1 - * @return bool Wehather the autoloader has been registered or not - */ - private function register_autoloader() { - - return spl_autoload_register( [ $this, 'autoload' ] ); - - } - - /** - * Loads the classes. - * - * @since 0.1 - * @param string $class_name The class name to load - */ - private function autoload( $class_name ) { - - if ( false === strpos( $class_name, $this->namespace ) ) return; - - $parts = explode( '\\', $class_name ); - - // remove namespace and join class path - $class_path = str_replace( '_', '-', implode( DIRECTORY_SEPARATOR, array_slice( $parts, 1 ) ) ); - - array_map( function( $source_path ) use ( $class_path ) { - - $path = $source_path . $class_path . '.php'; - - if ( ! file_exists( $path ) ) return; - - require $path; - - }, static::$source_directories ); - - } - -} diff --git a/wp-rest/Civi/Mailing-Hooks.php b/wp-rest/Civi/Mailing-Hooks.php deleted file mode 100644 index 7113088b3b..0000000000 --- a/wp-rest/Civi/Mailing-Hooks.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * CiviCRM Mailing_Hooks class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Civi; - -class Mailing_Hooks { - - /** - * Mailing Url endpoint. - * - * @since 0.1 - * @var string - */ - public $url_endpoint; - - /** - * Mailing Open endpoint. - * - * @since 0.1 - * @var string - */ - public $open_endpoint; - - /** - * Constructor. - * - * @since 0.1 - */ - public function __construct() { - - $this->url_endpoint = rest_url( 'civicrm/v3/url' ); - - $this->open_endpoint = rest_url( 'civicrm/v3/open' ); - - } - - /** - * Register hooks. - * - * @since 0.1 - */ - public function register_hooks() { - - add_filter( 'civicrm_alterMailParams', [ $this, 'do_mailing_urls' ], 10, 2 ); - - } - - /** - * Filters the mailing html and replaces calls to 'extern/url.php' and - * 'extern/open.php' with their REST counterparts 'civicrm/v3/url' and 'civicrm/v3/open'. - * - * @uses 'civicrm_alterMailParams' - * - * @since 0.1 - * @param array &$params Mail params - * @param string $context The Context - * @return array $params The filtered Mail params - */ - public function do_mailing_urls( &$params, $context ) { - - if ( $context == 'civimail' ) { - - $params['html'] = $this->replace_html_mailing_tracking_urls( $params['html'] ); - - $params['text'] = $this->replace_text_mailing_tracking_urls( $params['text'] ); - - } - - return $params; - - } - - /** - * Replace html mailing tracking urls. - * - * @since 0.1 - * @param string $contnet The mailing content - * @return string $content The mailing content - */ - public function replace_html_mailing_tracking_urls( string $content ) { - - $doc = \phpQuery::newDocument( $content ); - - foreach ( $doc[ '[href*="civicrm/extern/url.php"], [src*="civicrm/extern/open.php"]' ] as $element ) { - - $href = pq( $element )->attr( 'href' ); - $src = pq( $element )->attr( 'src' ); - - // replace extern/url - if ( strpos( $href, 'civicrm/extern/url.php' ) ) { - - $query_string = strstr( $href, '?' ); - pq( $element )->attr( 'href', $this->url_endpoint . $query_string ); - - } - - // replace extern/open - if ( strpos( $src, 'civicrm/extern/open.php' ) ) { - - $query_string = strstr( $src, '?' ); - pq( $element )->attr( 'src', $this->open_endpoint . $query_string ); - - } - - unset( $href, $src, $query_string ); - - } - - return $doc->html(); - - } - - /** - * Replace text mailing tracking urls. - * - * @since 0.1 - * @param string $contnet The mailing content - * @return string $content The mailing content - */ - public function replace_text_mailing_tracking_urls( string $content ) { - - // replace extern url - $content = preg_replace( '/http.*civicrm\/extern\/url\.php/i', $this->url_endpoint, $content ); - - // replace open url - $content = preg_replace( '/http.*civicrm\/extern\/open\.php/i', $this->open_endpoint, $content ); - - return $content; - - } - -} diff --git a/wp-rest/Controller/AuthorizeIPN.php b/wp-rest/Controller/AuthorizeIPN.php deleted file mode 100644 index 4cd9da9a97..0000000000 --- a/wp-rest/Controller/AuthorizeIPN.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * AuthorizeIPN controller class. - * - * Replacement for CiviCRM's 'extern/authorizeIPN.php'. - * - * @see https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/authorize-net/#shell-script-testing-method - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class AuthorizeIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'authorizeIPN'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/authorizeIPN/params', $request->get_params(), $request ); - - $authorize_IPN = new \CRM_Core_Payment_AuthorizeNetIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=AuthNet', $params ); - - /** - * Filter AuthorizeIPN object. - * - * @param CRM_Core_Payment_AuthorizeNetIPN $authorize_IPN - * @param array $params - * @param WP_REST_Request $request - */ - $authorize_IPN = apply_filters( 'civi_wp_rest/controller/authorizeIPN/instance', $authorize_IPN, $params, $request ); - - try { - - if ( ! method_exists( $authorize_IPN, 'main' ) || ! $this->instance_of_crm_base_ipn( $authorize_IPN ) ) - return $this->civi_rest_error( sprintf( __( '%s must implement a "main" method.', 'civicrm' ), get_class( $authorize_IPN ) ) ); - - $result = $authorize_IPN->main(); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Checks whether object is an instance of CRM_Core_Payment_AuthorizeNetIPN or CRM_Core_Payment_BaseIPN. - * - * Needed because the instance is being filtered through 'civi_wp_rest/controller/authorizeIPN/instance'. - * - * @since 0.1 - * @param CRM_Core_Payment_AuthorizeNetIPN|CRM_Core_Payment_BaseIPN $object - * @return bool - */ - public function instance_of_crm_base_ipn( $object ) { - - return $object instanceof \CRM_Core_Payment_BaseIPN || $object instanceof \CRM_Core_Payment_AuthorizeNetIPN; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Base.php b/wp-rest/Controller/Base.php deleted file mode 100644 index 7546377e9e..0000000000 --- a/wp-rest/Controller/Base.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * Base controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -use CiviCRM_WP_REST\Endpoint\Endpoint_Interface; - -abstract class Base extends \WP_REST_Controller implements Endpoint_Interface { - - /** - * Route namespace. - * - * @since 0.1 - * @var string - */ - protected $namespace = 'civicrm/v3'; - - /** - * Gets the endpoint namespace. - * - * @since 0.1 - * @return string $namespace - */ - public function get_namespace() { - - return $this->namespace; - - } - - /** - * Gets the rest base route. - * - * @since 0.1 - * @return string $rest_base - */ - public function get_rest_base() { - - return '/' . $this->rest_base; - - } - - /** - * Retrieves the endpoint ie. '/civicrm/v3/rest'. - * - * @since 0.1 - * @return string $rest_base - */ - public function get_endpoint() { - - return '/' . $this->get_namespace() . $this->get_rest_base(); - - } - - /** - * Checks whether the requested route is equal to this endpoint. - * - * @since 0.1 - * @param WP_REST_Request $request - * @return bool $is_current_endpoint True if it's equal, false otherwise - */ - public function is_current_endpoint( $request ) { - - return $this->get_endpoint() == $request->get_route(); - - } - - /** - * Authorization status code. - * - * @since 0.1 - * @return int $status - */ - protected function authorization_status_code() { - - $status = 401; - - if ( is_user_logged_in() ) $status = 403; - - return $status; - - } - - /** - * Wrapper for WP_Error. - * - * @since 0.1 - * @param string|\CiviCRM_API3_Exception $error - * @param mixed $data Error data - * @return WP_Error $error - */ - protected function civi_rest_error( $error, $data = [] ) { - - if ( $error instanceof \CiviCRM_API3_Exception ) { - - return $error->getExtraParams(); - - } - - return new \WP_Error( 'civicrm_rest_api_error', $error, empty( $data ) ? [ 'status' => $this->authorization_status_code() ] : $data ); - - } - -} diff --git a/wp-rest/Controller/Cxn.php b/wp-rest/Controller/Cxn.php deleted file mode 100644 index 7f7cca5c56..0000000000 --- a/wp-rest/Controller/Cxn.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Cxn controller class. - * - * CiviConnect endpoint, replacement for CiviCRM's 'extern/cxn.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Cxn extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'cxn'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/cxn/params', $request->get_params(), $request ); - - // init connection server - $cxn = \CRM_Cxn_BAO_Cxn::createApiServer(); - - /** - * Filter connection server object. - * - * @param Civi\Cxn\Rpc\ApiServer $cxn - * @param array $params - * @param WP_REST_Request $request - */ - $cxn = apply_filters( 'civi_wp_rest/controller/cxn/instance', $cxn, $params, $request ); - - try { - - $result = $cxn->handle( $request->get_body() ); - - } catch ( Civi\Cxn\Rpc\Exception\CxnException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\ExpiredCertException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\InvalidCertException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\InvalidMessageException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\GarbledMessageException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } - - /** - * Bypass WP and send request from Cxn. - */ - add_filter( 'rest_pre_serve_request', function( $served, $response, $request, $server ) use ( $result ) { - - // Civi\Cxn\Rpc\Message->send() - $result->send(); - - return true; - - }, 10, 4 ); - - return rest_ensure_response( $result ); - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Open.php b/wp-rest/Controller/Open.php deleted file mode 100644 index 450ef991a3..0000000000 --- a/wp-rest/Controller/Open.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php -/** - * Open controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Open extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'open'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get item. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - $queue_id = $request->get_param( 'q' ); - - // track open - \CRM_Mailing_Event_BAO_Opened::open( $queue_id ); - - // serve tracker file - add_filter( 'rest_pre_serve_request', [ $this, 'serve_tracker_file' ], 10, 4 ); - - } - - /** - * Serves the tracker gif file. - * - * @since 0.1 - * @param bool $served Whether the request has been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - * @return bool $served Whether the request has been served - */ - public function serve_tracker_file( $served, $result, $request, $server ) { - - // tracker file path - $file = CIVICRM_PLUGIN_DIR . 'civicrm/i/tracker.gif'; - - // set headers - $server->send_header( 'Content-type', 'image/gif' ); - $server->send_header( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0' ); - $server->send_header( 'Content-Description', 'File Transfer' ); - $server->send_header( 'Content-Disposition', 'inline; filename=tracker.gif' ); - $server->send_header( 'Content-Length', filesize( $file ) ); - - $buffer = readfile( $file ); - - return true; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm/v3/open', - 'description' => __( 'CiviCRM Open endpoint', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'q' ], - 'properties' => [ - 'q' => [ - 'type' => 'integer' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'q' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Controller/PayPalIPN.php b/wp-rest/Controller/PayPalIPN.php deleted file mode 100644 index 5b5c380045..0000000000 --- a/wp-rest/Controller/PayPalIPN.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php -/** - * PayPalIPN controller class. - * - * PayPal IPN endpoint, replacement for CiviCRM's 'extern/ipn.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class PayPalIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'ipn'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/ipn/params', $request->get_params(), $request ); - - if ( $request->get_method() == 'GET' ) { - - // paypal standard - $paypal_IPN = new \CRM_Core_Payment_PayPalIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=PayPal_Standard', $params ); - - } else { - - // paypal pro - $paypal_IPN = new \CRM_Core_Payment_PayPalProIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=PayPal', $params ); - - } - - /** - * Filter PayPalIPN object. - * - * @param CRM_Core_Payment_PayPalIPN|CRM_Core_Payment_PayPalProIPN $paypal_IPN - * @param array $params - * @param WP_REST_Request $request - */ - $paypal_IPN = apply_filters( 'civi_wp_rest/controller/ipn/instance', $paypal_IPN, $params, $request ); - - try { - - if ( ! method_exists( $paypal_IPN, 'main' ) || ! $this->instance_of_crm_base_ipn( $paypal_IPN ) ) - return $this->civi_rest_error( sprintf( __( '%s must implement a "main" method.', 'civicrm' ), get_class( $paypal_IPN ) ) ); - - $result = $paypal_IPN->main(); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Checks whether object is an instance of CRM_Core_Payment_BaseIPN|CRM_Core_Payment_PayPalProIPN|CRM_Core_Payment_PayPalIPN. - * - * Needed because the instance is being filtered through 'civi_wp_rest/controller/ipn/instance'. - * - * @since 0.1 - * @param CRM_Core_Payment_BaseIPN|CRM_Core_Payment_PayPalProIPN|CRM_Core_Payment_PayPalIPN $object - * @return bool - */ - public function instance_of_crm_base_ipn( $object ) { - - return $object instanceof \CRM_Core_Payment_BaseIPN || $object instanceof \CRM_Core_Payment_PayPalProIPN || $object instanceof \CRM_Core_Payment_PayPalIPN; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/PxIPN.php b/wp-rest/Controller/PxIPN.php deleted file mode 100644 index d68fc8d787..0000000000 --- a/wp-rest/Controller/PxIPN.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php -/** - * PxIPN controller class. - * - * PxPay IPN endpoint, replacement for CiviCRM's 'extern/pxIPN.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class PxIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'pxIPN'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter payment processor params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( - 'civi_wp_rest/controller/pxIPN/params', - $this->get_payment_processor_args( $request ), - $request - ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=Payment_Express', $params ); - - try { - - $result = \CRM_Core_Payment_PaymentExpressIPN::main( ...$params ); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Get payment processor necessary params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $args - */ - public function get_payment_processor_args( $request ) { - - // get payment processor types - $payment_processor_types = civicrm_api3( 'PaymentProcessor', 'getoptions', [ - 'field' => 'payment_processor_type_id' - ] ); - - // payment processor params - $params = apply_filters( 'civi_wp_rest/controller/pxIPN/payment_processor_params', [ - 'user_name' => $request->get_param( 'userid' ), - 'payment_processor_type_id' => array_search( - 'DPS Payment Express', - $payment_processor_types['values'] - ), - 'is_active' => 1, - 'is_test' => 0 - ] ); - - // get payment processor - $payment_processor = civicrm_api3( 'PaymentProcessor', 'get', $params ); - - $args = $payment_processor['values'][$payment_processor['id']]; - - $method = empty( $args['signature'] ) ? 'pxpay' : 'pxaccess'; - - return [ - $method, - $request->get_param( 'result' ), - $args['url_site'], - $args['user_name'], - $args['password'], - $args['signature'] - ]; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Rest.php b/wp-rest/Controller/Rest.php deleted file mode 100644 index 61706f85fd..0000000000 --- a/wp-rest/Controller/Rest.php +++ /dev/null @@ -1,522 +0,0 @@ -<?php -/** - * Rest controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Rest extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'rest'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_items' ], - 'permission_callback' => [ $this, 'permissions_check' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Check get permission. - * - * @since 0.1 - * @param WP_REST_Request $request - * @return bool - */ - public function permissions_check( $request ) { - - if ( ! $this->is_valid_api_key( $request ) ) - return $this->civi_rest_error( __( 'Param api_key is not valid.', 'civicrm' ) ); - - if ( ! $this->is_valid_site_key() ) - return $this->civi_rest_error( __( 'Param key is not valid.', 'civicrm' ) ); - - return true; - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_items( $request ) { - - /** - * Filter formatted api params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/rest/api_params', $this->get_formatted_api_params( $request ), $request ); - - try { - - $items = civicrm_api3( ...$params ); - - } catch ( \CiviCRM_API3_Exception $e ) { - - $items = $this->civi_rest_error( $e ); - - } - - if ( ! isset( $items ) || empty( $items ) ) - return rest_ensure_response( [] ); - - /** - * Filter civi api result. - * - * @since 0.1 - * @param array $items - * @param WP_REST_Request $request - */ - $data = apply_filters( 'civi_wp_rest/controller/rest/api_result', $items, $params, $request ); - - // only collections of items, ie any action but 'getsingle' - if ( isset( $data['values'] ) ) { - - $data['values'] = array_reduce( $items['values'] ?? $items, function( $items, $item ) use ( $request ) { - - $response = $this->prepare_item_for_response( $item, $request ); - - $items[] = $this->prepare_response_for_collection( $response ); - - return $items; - - }, [] ); - - } - - $response = rest_ensure_response( $data ); - - // check wheather we need to serve xml or json - if ( ! in_array( 'json', array_keys( $request->get_params() ) ) ) { - - /** - * Adds our response holding Civi data before dispatching. - * - * @since 0.1 - * @param WP_HTTP_Response $result Result to send to client - * @param WP_REST_Server $server The REST server - * @param WP_REST_Request $request The request - * @return WP_HTTP_Response $result Result to send to client - */ - add_filter( 'rest_post_dispatch', function( $result, $server, $request ) use ( $response ) { - - return $response; - - }, 10, 3 ); - - // serve xml - add_filter( 'rest_pre_serve_request', [ $this, 'serve_xml_response' ], 10, 4 ); - - } else { - - // return json - return $response; - - } - - } - - /** - * Get formatted api params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params - */ - public function get_formatted_api_params( $request ) { - - $args = $request->get_params(); - - $entity = $args['entity']; - $action = $args['action']; - - // unset unnecessary args - unset( $args['entity'], $args['action'], $args['key'], $args['api_key'] ); - - if ( ! isset( $args['json'] ) || is_numeric( $args['json'] ) ) { - - $params = $args; - - } else { - - $params = is_string( $args['json'] ) ? json_decode( $args['json'], true ) : []; - - } - - // ensure check permissions is enabled - $params['check_permissions'] = true; - - return [ $entity, $action, $params ]; - - } - - /** - * Matches the item data to the schema. - * - * @since 0.1 - * @param object $item - * @param WP_REST_Request $request - */ - public function prepare_item_for_response( $item, $request ) { - - return rest_ensure_response( $item ); - - } - - /** - * Serves XML response. - * - * @since 0.1 - * @param bool $served Whether the request has already been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - */ - public function serve_xml_response( $served, $result, $request, $server ) { - - // get xml from response - $xml = $this->get_xml_formatted_data( $result->get_data() ); - - // set content type header - $server->send_header( 'Content-Type', 'text/xml' ); - - echo $xml; - - return true; - - } - - /** - * Formats CiviCRM API result to XML. - * - * @since 0.1 - * @param array $data The CiviCRM api result - * @return string $xml The formatted xml - */ - protected function get_xml_formatted_data( array $data ) { - - // xml document - $xml = new \DOMDocument(); - - // result set element <ResultSet> - $result_set = $xml->createElement( 'ResultSet' ); - - // xmlns:xsi attribute - $result_set->setAttribute( 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance' ); - - // count attribute - if ( isset( $data['count'] ) ) $result_set->setAttribute( 'count', $data['count'] ); - - // build result from result => values - if ( isset( $data['values'] ) ) { - - array_map( function( $item ) use ( $result_set, $xml ) { - - // result element <Result> - $result = $xml->createElement( 'Result' ); - - // format item - $result = $this->get_xml_formatted_item( $item, $result, $xml ); - - // append result to result set - $result_set->appendChild( $result ); - - }, $data['values'] ); - - } else { - - // result element <Result> - $result = $xml->createElement( 'Result' ); - - // format item - $result = $this->get_xml_formatted_item( $data, $result, $xml ); - - // append result to result set - $result_set->appendChild( $result ); - - } - - // append result set - $xml->appendChild( $result_set ); - - return $xml->saveXML(); - - } - - /** - * Formats a single api result to xml. - * - * @since 0.1 - * @param array $item The single api result - * @param DOMElement $parent The parent element to append to - * @param DOMDocument $doc The document - * @return DOMElement $parent The parent element - */ - public function get_xml_formatted_item( array $item, \DOMElement $parent, \DOMDocument $doc ) { - - // build field => values - array_map( function( $field, $value ) use ( $parent, $doc ) { - - // entity field element - $element = $doc->createElement( $field ); - - // handle array values - if ( is_array( $value ) ) { - - array_map( function( $key, $val ) use ( $element, $doc ) { - - // child element, append underscore '_' otherwise createElement - // will throw an Invalid character exception as elements cannot start with a number - $child = $doc->createElement( '_' . $key, $val ); - - // append child - $element->appendChild( $child ); - - }, array_keys( $value ), $value ); - - } else { - - // assign value - $element->nodeValue = $value; - - } - - // append element - $parent->appendChild( $element ); - - }, array_keys( $item ), $item ); - - return $parent; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm/v3/rest', - 'description' => __( 'CiviCRM API3 WP rest endpoint wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'entity', 'action', 'params' ], - 'properties' => [ - 'is_error' => [ - 'type' => 'integer' - ], - 'version' => [ - 'type' => 'integer' - ], - 'count' => [ - 'type' => 'integer' - ], - 'values' => [ - 'type' => 'array' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'key' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return $this->is_valid_site_key(); - - } - ], - 'api_key' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return $this->is_valid_api_key( $request ); - - } - ], - 'entity' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ], - 'action' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ], - 'json' => [ - 'type' => ['integer', 'string', 'array'], - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ) || is_array( $value ) || $this->is_valid_json( $value ); - - } - ] - ]; - - } - - /** - * Checks if string is a valid json. - * - * @since 0.1 - * @param string $param - * @return bool - */ - protected function is_valid_json( $param ) { - - $param = json_decode( $param, true ); - - if ( ! is_array( $param ) ) return false; - - return ( json_last_error() == JSON_ERROR_NONE ); - - } - - /** - * Validates the site key. - * - * @since 0.1 - * @return bool $is_valid_site_key - */ - private function is_valid_site_key() { - - return \CRM_Utils_System::authenticateKey( false ); - - } - - /** - * Validates the api key. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return bool $is_valid_api_key - */ - private function is_valid_api_key( $request ) { - - $api_key = $request->get_param( 'api_key' ); - - if ( ! $api_key ) return false; - - $contact_id = \CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $api_key, 'id', 'api_key' ); - - // validate contact and login - if ( $contact_id ) { - - $wp_user = $this->get_wp_user( $contact_id ); - - $this->do_user_login( $wp_user ); - - return true; - - } - - return false; - - } - - /** - * Get WordPress user data. - * - * @since 0.1 - * @param int $contact_id The contact id - * @return bool|WP_User $user The WordPress user data - */ - protected function get_wp_user( int $contact_id ) { - - try { - - // Get CiviCRM domain group ID from constant, if set. - $domain_id = defined( 'CIVICRM_DOMAIN_ID' ) ? CIVICRM_DOMAIN_ID : 0; - - // If this fails, get it from config. - if ( $domain_id === 0 ) { - $domain_id = CRM_Core_Config::domainID(); - } - - // Call API. - $uf_match = civicrm_api3( 'UFMatch', 'getsingle', [ - 'contact_id' => $contact_id, - 'domain_id' => $domain_id, - ] ); - - } catch ( \CiviCRM_API3_Exception $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } - - $wp_user = get_userdata( $uf_match['uf_id'] ); - - return $wp_user; - - } - - /** - * Logs in the WordPress user, needed to respect CiviCRM ACL and permissions. - * - * @since 0.1 - * @param WP_User $user - */ - protected function do_user_login( \WP_User $user ) { - - if ( is_user_logged_in() ) return; - - wp_set_current_user( $user->ID, $user->user_login ); - - wp_set_auth_cookie( $user->ID ); - - do_action( 'wp_login', $user->user_login, $user ); - - } - -} diff --git a/wp-rest/Controller/Soap.php b/wp-rest/Controller/Soap.php deleted file mode 100644 index 17402cc579..0000000000 --- a/wp-rest/Controller/Soap.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** - * Soap controller class. - * - * Soap endpoint, replacement for CiviCRM's 'extern/soap.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Soap extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'soap'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/soap/params', $request->get_params(), $request ); - - // init soap server - $soap_server = new \SoapServer( - NULL, - [ - 'uri' => 'urn:civicrm', - 'soap_version' => SOAP_1_2, - ] - ); - - $crm_soap_server = new \CRM_Utils_SoapServer(); - - $soap_server->setClass( 'CRM_Utils_SoapServer', \CRM_Core_Config::singleton()->userFrameworkClass ); - $soap_server->setPersistence( SOAP_PERSISTENCE_SESSION ); - - /** - * Bypass WP and send request from Soap server. - */ - add_filter( 'rest_pre_serve_request', function( $served, $response, $request, $server ) use ( $soap_server ) { - - $soap_server->handle(); - - return true; - - }, 10, 4 ); - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Url.php b/wp-rest/Controller/Url.php deleted file mode 100644 index 9286856e7c..0000000000 --- a/wp-rest/Controller/Url.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * Url controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Url extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'url'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter formatted api params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/url/params', $this->get_formatted_params( $request ), $request ); - - // track url - $url = \CRM_Mailing_Event_BAO_TrackableURLOpen::track( $params['queue_id'], $params['url_id'] ); - - /** - * Filter url. - * - * @param string $url - * @param array $params - * @param WP_REST_Request $request - */ - $url = apply_filters( 'civi_wp_rest/controller/url/before_parse_url', $url, $params, $request ); - - // parse url - $url = $this->parse_url( $url, $params ); - - $this->do_redirect( $url ); - - } - - /** - * Get formatted api params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params - */ - protected function get_formatted_params( $request ) { - - $args = $request->get_params(); - - $params = [ - 'queue_id' => isset( $args['qid'] ) ? $args['qid'] ?? '' : $args['q'] ?? '', - 'url_id' => $args['u'] - ]; - - // unset unnecessary args - unset( $args['qid'], $args['u'], $args['q'] ); - - if ( ! empty( $args ) ) { - - $params['query'] = http_build_query( $args ); - - } - - return $params; - - } - - /** - * Parses the url. - * - * @since 0.1 - * @param string $url - * @param array $params - * @return string $url - */ - protected function parse_url( $url, $params ) { - - // CRM-18320 - Fix encoded ampersands - $url = str_replace( '&', '&', $url ); - - // CRM-7103 - Look for additional query variables and append them - if ( isset( $params['query'] ) && strpos( $url, '?' ) ) { - - $url .= '&' . $params['query']; - - } elseif ( isset( $params['query'] ) ) { - - $url .= '?' . $params['query']; - - } - - return apply_filters( 'civi_wp_rest/controller/url/parsed_url', $url, $params ); - - } - - /** - * Do redirect. - * - * @since 0.1 - * @param string $url - */ - protected function do_redirect( $url ) { - - wp_redirect( $url ); - - exit; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm_api3/v3/url', - 'description' => __( 'CiviCRM API3 wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'qid', 'u' ], - 'properties' => [ - 'qid' => [ - 'type' => 'integer' - ], - 'q' => [ - 'type' => 'integer' - ], - 'u' => [ - 'type' => 'integer' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'qid' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'q' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'u' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Controller/Widget.php b/wp-rest/Controller/Widget.php deleted file mode 100644 index 13fa1e2add..0000000000 --- a/wp-rest/Controller/Widget.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * Widget controller class. - * - * Widget endpoint, replacement for CiviCRM's 'extern/widget.php' - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Widget extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'widget'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get item. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter mandatory params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( - 'civi_wp_rest/controller/widget/params', - $this->get_mandatory_params( $request ), - $request - ); - - $jsonvar = 'jsondata'; - - if ( ! empty( $request->get_param( 'format' ) ) ) $jsonvar .= $request->get_param( 'cpageId' ); - - $data = \CRM_Contribute_BAO_Widget::getContributionPageData( ...$params ); - - $response = 'var ' . $jsonvar . ' = ' . json_encode( $data ) . ';'; - - /** - * Adds our response data before dispatching. - * - * @since 0.1 - * @param WP_HTTP_Response $result Result to send to client - * @param WP_REST_Server $server The REST server - * @param WP_REST_Request $request The request - * @return WP_HTTP_Response $result Result to send to client - */ - add_filter( 'rest_post_dispatch', function( $result, $server, $request ) use ( $response ) { - - return rest_ensure_response( $response ); - - }, 10, 3 ); - - // serve javascript - add_filter( 'rest_pre_serve_request', [ $this, 'serve_javascript' ], 10, 4 ); - - } - - /** - * Get mandatory params from request. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params The widget params - */ - protected function get_mandatory_params( $request ) { - - $args = $request->get_params(); - - return [ - $args['cpageId'], - $args['widgetId'], - $args['includePending'] ?? false - ]; - - } - - /** - * Serve jsondata response. - * - * @since 0.1 - * @param bool $served Whether the request has already been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - * @return bool $served - */ - public function serve_javascript( $served, $result, $request, $server ) { - - // set content type header - $server->send_header( 'Expires', gmdate( 'D, d M Y H:i:s \G\M\T', time() + 60 ) ); - $server->send_header( 'Content-Type', 'application/javascript' ); - $server->send_header( 'Cache-Control', 'max-age=60, public' ); - - echo $result->get_data(); - - return true; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm_api3/v3/widget', - 'description' => __( 'CiviCRM API3 wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'cpageId', 'widgetId' ], - 'properties' => [ - 'cpageId' => [ - 'type' => 'integer', - 'minimum' => 1 - ], - 'widgetId' => [ - 'type' => 'integer', - 'minimum' => 1 - ], - 'format' => [ - 'type' => 'integer' - ], - 'includePending' => [ - 'type' => 'boolean' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'cpageId' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'widgetId' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'format' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'includePending' => [ - 'type' => 'boolean', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Endpoint/Endpoint-Interface.php b/wp-rest/Endpoint/Endpoint-Interface.php deleted file mode 100644 index 9497cde509..0000000000 --- a/wp-rest/Endpoint/Endpoint-Interface.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * Endpoint Interface class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Endpoint; - -interface Endpoint_Interface { - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes(); - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema(); - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args(); - -} diff --git a/wp-rest/Plugin.php b/wp-rest/Plugin.php deleted file mode 100644 index 4038a56b1b..0000000000 --- a/wp-rest/Plugin.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** - * Main plugin class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST; - -use CiviCRM_WP_REST\Civi\Mailing_Hooks; - -class Plugin { - - /** - * Constructor. - * - * @since 0.1 - */ - public function __construct() { - - $this->register_hooks(); - - $this->setup_objects(); - - } - - /** - * Register hooks. - * - * @since 1.0 - */ - protected function register_hooks() { - - add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] ); - - add_filter( 'rest_pre_dispatch', [ $this, 'bootstrap_civi' ], 10, 3 ); - - add_filter( 'rest_post_dispatch', [ $this, 'maybe_reset_wp_timezone' ], 10, 3); - - } - - /** - * Bootstrap CiviCRM when hitting a the 'civicrm' namespace. - * - * @since 0.1 - * @param mixed $result - * @param WP_REST_Server $server REST server instance - * @param WP_REST_Request $request The request - * @return mixed $result - */ - public function bootstrap_civi( $result, $server, $request ) { - - if ( false !== strpos( $request->get_route(), 'civicrm' ) ) { - - $this->maybe_set_user_timezone( $request ); - - civi_wp()->initialize(); - - } - - return $result; - - } - - /** - * Setup objects. - * - * @since 0.1 - */ - private function setup_objects() { - - if ( CIVICRM_WP_REST_REPLACE_MAILING_TRACKING ) { - - // register mailing hooks - $mailing_hooks = ( new Mailing_Hooks )->register_hooks(); - - } - - } - - /** - * Registers Rest API routes. - * - * @since 0.1 - */ - public function register_rest_routes() { - - // rest endpoint - $rest_controller = new Controller\Rest; - $rest_controller->register_routes(); - - // url controller - $url_controller = new Controller\Url; - $url_controller->register_routes(); - - // open controller - $open_controller = new Controller\Open; - $open_controller->register_routes(); - - // authorizenet controller - $authorizeIPN_controller = new Controller\AuthorizeIPN; - $authorizeIPN_controller->register_routes(); - - // paypal controller - $paypalIPN_controller = new Controller\PayPalIPN; - $paypalIPN_controller->register_routes(); - - // pxpay controller - $paypalIPN_controller = new Controller\PxIPN; - $paypalIPN_controller->register_routes(); - - // civiconnect controller - $cxn_controller = new Controller\Cxn; - $cxn_controller->register_routes(); - - // widget controller - $widget_controller = new Controller\Widget; - $widget_controller->register_routes(); - - // soap controller - $soap_controller = new Controller\Soap; - $soap_controller->register_routes(); - - /** - * Opportunity to add more rest routes. - * - * @since 0.1 - */ - do_action( 'civi_wp_rest/plugin/rest_routes_registered' ); - - } - - /** - * Sets the timezone to the users timezone when - * calling the civicrm/v3/rest endpoint. - * - * @since 0.1 - * @param WP_REST_Request $request The request - */ - private function maybe_set_user_timezone( $request ) { - - if ( $request->get_route() != '/civicrm/v3/rest' ) return; - - $timezones = [ - 'wp_timezone' => date_default_timezone_get(), - 'user_timezone' => get_option( 'timezone_string', false ) - ]; - - // filter timezones - add_filter( 'civi_wp_rest/plugin/timezones', function() use ( $timezones ) { - - return $timezones; - - } ); - - if ( empty( $timezones['user_timezone'] ) ) return; - - /** - * CRM-12523 - * CRM-18062 - * CRM-19115 - */ - date_default_timezone_set( $timezones['user_timezone'] ); - \CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone(); - - } - - /** - * Resets the timezone to the original WP - * timezone after calling the civicrm/v3/rest endpoint. - * - * @since 0.1 - * @param mixed $result - * @param WP_REST_Server $server REST server instance - * @param WP_REST_Request $request The request - * @return mixed $result - */ - public function maybe_reset_wp_timezone( $result, $server, $request ) { - - if ( $request->get_route() != '/civicrm/v3/rest' ) return $result; - - $timezones = apply_filters( 'civi_wp_rest/plugin/timezones', null ); - - if ( empty( $timezones['wp_timezone'] ) ) return $result; - - // reset wp timezone - date_default_timezone_set( $timezones['wp_timezone'] ); - - return $result; - - } - -} diff --git a/wp-rest/README.md b/wp-rest/README.md deleted file mode 100644 index 77234de84a..0000000000 --- a/wp-rest/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# CiviCRM WP REST API Wrapper - -This is a WordPress plugin that aims to expose CiviCRM's [extern](https://github.com/civicrm/civicrm-core/tree/master/extern) scripts as WordPress REST endpoints. - -This plugin requires: - -- PHP 7.1+ -- WordPress 4.7+ -- CiviCRM to be installed and activated. - -### Endpoints - -1. `civicrm/v3/rest` - a wrapper around `civicrm_api3()` - - **Parameters**: - - - `key` - **required**, the site key - - `api_key` - **required**, the contact api key - - `entity` - **required**, the API entity - - `action` - **required**, the API action - - `json` - **optional**, json formatted string with the API parameters/argumets, or `1` as in `json=1` - - By default all calls to `civicrm/v3/rest` return XML formatted results, to get `json` formatted result pass `json=1` or a json formatted string with the API parameters, like in the example 2 below. - - **Examples**: - - 1. `https://example.com/wp-json/civicrm/v3/rest?entity=Contact&action=get&key=<site_key>&api_key=<api_key>&group=Administrators` - - 2. `https://example.com/wp-json/civicrm/v3/rest?entity=Contact&action=get&key=<site_key>&api_key=<api_key>&json={"group": "Administrators"}` - -2. `civicrm/v3/url` - a substition for `civicrm/extern/url.php` mailing tracking - -3. `civicrm/v3/open` - a substition for `civicrm/extern/open.php` mailing tracking - -4. `civicrm/v3/authorizeIPN` - a substition for `civicrm/extern/authorizeIPN.php` (for testing Authorize.net as per [docs](https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/authorize-net/#shell-script-testing-method)) - - **_Note_**: this endpoint has **not been tested** - -5. `civicrm/v3/ipn` - a substition for `civicrm/extern/ipn.php` (for PayPal Standard and Pro live transactions) - - **_Note_**: this endpoint has **not been tested** - -6. `civicrm/v3/cxn` - a substition for `civicrm/extern/cxn.php` - -7. `civicrm/v3/pxIPN` - a substition for `civicrm/extern/pxIPN.php` - - **_Note_**: this endpoint has **not been tested** - -8. `civicrm/v3/widget` - a substition for `civicrm/extern/widget.php` - -9. `civicrm/v3/soap` - a substition for `civicrm/extern/soap.php` - - **_Note_**: this endpoint has **not been tested** - -### Settings - -Set the `CIVICRM_WP_REST_REPLACE_MAILING_TRACKING` constant to `true` to replace mailing url and open tracking calls with their counterpart REST endpoints, `civicrm/v3/url` and `civicrm/v3/open`. - -_Note: use this setting with caution, it may affect performance on large mailings, see `CiviCRM_WP_REST\Civi\Mailing_Hooks` class._ -- GitLab