civicrm-core.git
3 years agoImprove tearDown cleanup of domain contacts
Eileen McNaughton [Tue, 11 May 2021 06:14:20 +0000 (18:14 +1200)]
Improve tearDown cleanup of domain contacts

    Fixes to ensure the domain contacts from addresses are re-instated

3 years agoMerge pull request #18969 from seamuslee001/dev_core_2187
Seamus Lee [Tue, 11 May 2021 23:08:01 +0000 (09:08 +1000)]
Merge pull request #18969 from seamuslee001/dev_core_2187

dev/core#2187 Allow sites to customise the default number of rows ret…

3 years ago(REF) dev/core#2601 - Cleanup stale parameter
Tim Otten [Tue, 11 May 2021 21:52:46 +0000 (14:52 -0700)]
(REF) dev/core#2601 - Cleanup stale parameter

Overview
--------

This cleans up a parameter that became unused/unnecessary in #20256.

History
-------

This revision is a little bouncy. Instead of before/after, here's a history:

* `<= v5.36`: `getAllModulePermissions($descriptions = FALSE)`
* `=  v5.37.0`: `getAllModulePermissions($descriptions = FALSE, &$permissions)`
* `>= v.37.1`: `getAllModulePermissions($descriptions = FALSE)`

I grepped `universe` to confirm that no other repos were using the intermediate signature.

3 years agodev/core#2187 Allow sites to customsie the default number of rows returned from Quick...
Seamus Lee [Fri, 13 Nov 2020 21:31:08 +0000 (08:31 +1100)]
dev/core#2187 Allow sites to customsie the default number of rows returned from QuickForm Searches

3 years agounused function
demeritcowboy [Tue, 11 May 2021 20:39:47 +0000 (16:39 -0400)]
unused function

3 years agoMerge pull request #20204 from eileenmcnaughton/freeze
colemanw [Tue, 11 May 2021 13:54:31 +0000 (09:54 -0400)]
Merge pull request #20204 from eileenmcnaughton/freeze

Freeze readonly fields

3 years agoMerge pull request #20260 from agileware/CIVICRM-1733
Seamus Lee [Tue, 11 May 2021 09:47:28 +0000 (19:47 +1000)]
Merge pull request #20260 from agileware/CIVICRM-1733

CiviCRM Scheduled Reminders, Subject field missing Token selector - users must copy Token from Body field to Subject

3 years agoCIVICRM-1734 Change the help text for Message Templates and Scheduled Reminders to...
Justin Freeman [Tue, 11 May 2021 04:52:51 +0000 (14:52 +1000)]
CIVICRM-1734 Change the help text for Message Templates and Scheduled Reminders to include link to CiviCRM Token Documentation page

3 years agoMerge pull request #20265 from mattwire/api4customgroupdelete
Seamus Lee [Tue, 11 May 2021 01:52:28 +0000 (11:52 +1000)]
Merge pull request #20265 from mattwire/api4customgroupdelete

Fix delete customgroup using API4 so it removes data table

3 years agoMerge pull request #20266 from civicrm/5.38
Seamus Lee [Mon, 10 May 2021 22:43:39 +0000 (08:43 +1000)]
Merge pull request #20266 from civicrm/5.38

5.38

3 years agoAPIv4 - Add test to ensure custom tables are deleted
Coleman Watts [Mon, 10 May 2021 21:18:58 +0000 (17:18 -0400)]
APIv4 - Add test to ensure custom tables are deleted

3 years agoMerge pull request #20256 from eileenmcnaughton/538
Seamus Lee [Mon, 10 May 2021 20:51:20 +0000 (06:51 +1000)]
Merge pull request #20256 from eileenmcnaughton/538

dev/core#2601 fix joomla permission regression

3 years agoFix delete customgroup using API4 so it removes data table
Matthew Wire [Mon, 10 May 2021 16:43:35 +0000 (17:43 +0100)]
Fix delete customgroup using API4 so it removes data table

3 years agoMerge pull request #20254 from seamuslee001/fix_d9_install
colemanw [Mon, 10 May 2021 17:44:04 +0000 (13:44 -0400)]
Merge pull request #20254 from seamuslee001/fix_d9_install

Make APIv4 Subscribers Public to fix D9 install

3 years agoMerge pull request #20261 from eileenmcnaughton/tt2
demeritcowboy [Mon, 10 May 2021 14:41:19 +0000 (10:41 -0400)]
Merge pull request #20261 from eileenmcnaughton/tt2

fix missing parent tearDown

3 years agoMerge pull request #20262 from eileenmcnaughton/tt3
demeritcowboy [Mon, 10 May 2021 14:39:38 +0000 (10:39 -0400)]
Merge pull request #20262 from eileenmcnaughton/tt3

Fix missing parent tearDown

3 years agoAfform - Drag & drop fixes
Coleman Watts [Mon, 10 May 2021 12:53:52 +0000 (08:53 -0400)]
Afform - Drag & drop fixes

The drag-drop validation broke when af-gui-field was changed from a directive to
a component, as the jQuery was looking for the wrong markup.

Additionally, this attempts to fix a hard-to-reproduce bug where the styling
gets stuck in a "dragging" state after something has been dropped.

3 years agoFix missing parent tearDown
Your Name [Mon, 10 May 2021 10:57:47 +0000 (22:57 +1200)]
Fix missing parent tearDown

3 years agofix missing parent tearDown
Your Name [Mon, 10 May 2021 09:53:08 +0000 (21:53 +1200)]
fix missing parent tearDown

3 years agoCIVICRM-1733 CiviCRM Scheduled Reminders, Subject field missing Token selector field
Justin Freeman [Mon, 10 May 2021 05:34:07 +0000 (15:34 +1000)]
CIVICRM-1733 CiviCRM Scheduled Reminders, Subject field missing Token selector field

3 years agoMerge pull request #20257 from eileenmcnaughton/v3test
Seamus Lee [Mon, 10 May 2021 02:17:45 +0000 (12:17 +1000)]
Merge pull request #20257 from eileenmcnaughton/v3test

[NFC] Test - fix to use v3 api on postAsserts

3 years agoMerge pull request #20242 from eileenmcnaughton/group
colemanw [Mon, 10 May 2021 01:35:57 +0000 (21:35 -0400)]
Merge pull request #20242 from eileenmcnaughton/group

[REF] Extract code determining list of groups requiring a refresh

3 years ago[NFC] Test - fix to use v3 api on postAsserts
Your Name [Mon, 10 May 2021 00:05:35 +0000 (12:05 +1200)]
[NFC] Test - fix to use v3 api on postAsserts

3 years agoMerge pull request #20253 from eileenmcnaughton/cont_test
Seamus Lee [Sun, 9 May 2021 23:52:44 +0000 (09:52 +1000)]
Merge pull request #20253 from eileenmcnaughton/cont_test

[Test] Improve cleanup of domain contacts

3 years agoMerge pull request #20255 from demeritcowboy/mysql-compare
Seamus Lee [Sun, 9 May 2021 23:50:51 +0000 (09:50 +1000)]
Merge pull request #20255 from demeritcowboy/mysql-compare

dev/core#2602 - Installer doesn't check mysql version properly

3 years agodev/core#2601 fix joomla permission regression
Your Name [Sun, 9 May 2021 22:48:43 +0000 (10:48 +1200)]
dev/core#2601 fix joomla permission regression

This was a change we ultimately decided to, but forgot to, revert. It gave
extensions the ability to modify already-defined-permissons but
was brought out of scope of the change as it required more
consideration that simply adding the new super duper permission

In the meantime it caused a Joomla! regression
https://lab.civicrm.org/dev/core/-/issues/2601

3 years ago[Test] Improve cleanup of domain contacts
Your Name [Sat, 8 May 2021 21:20:29 +0000 (09:20 +1200)]
[Test] Improve cleanup of domain contacts

This fixes a situation where the domain contact may not have an email (or exist) if this
test is run in combination with certain others. The last test in the suite relies on the
domain contact having an email. This test was not following the practice
of having a tearDown but the tearDown was also flawed in recreating the domain
contacts but not their emails

3 years agofix comparison
demeritcowboy [Sun, 9 May 2021 17:52:12 +0000 (13:52 -0400)]
fix comparison

3 years agoMake APIv4 Subscribers Public to fix D9 install
Seamus Lee [Sat, 8 May 2021 23:03:10 +0000 (09:03 +1000)]
Make APIv4 Subscribers Public to fix D9 install

3 years agoMerge pull request #20121 from colemanw/l10nJs
colemanw [Sat, 8 May 2021 18:39:47 +0000 (14:39 -0400)]
Merge pull request #20121 from colemanw/l10nJs

Switch l10n.js from ajax callback to assetBuilder

3 years agoMerge pull request #20250 from eileenmcnaughton/in
demeritcowboy [Sat, 8 May 2021 16:24:59 +0000 (12:24 -0400)]
Merge pull request #20250 from eileenmcnaughton/in

Test fix - assertion fails when run with other tests (sometimes)

3 years agoTest fix - assertion fails when run with other tests (sometimes)
Your Name [Sat, 8 May 2021 03:52:45 +0000 (15:52 +1200)]
Test fix - assertion fails when run with other tests (sometimes)

The assertion that invoice_number = INV_ + contribution_id is wrong. In fact
it is calculated as INV_ + (MAX(contribution_id)+1) prior to the contribution
being saved. This means that if the table has not been truncated the contribution
id might be 3 but the invoice_number would still be 0+1 - ie INV_1

- we could argue about whether the calculation method is flawed but this at least
makes the test more reliable and no-one has complained in practice about the
code behaviour

3 years agoMerge pull request #20248 from eileenmcnaughton/tes
Eileen McNaughton [Fri, 7 May 2021 16:00:17 +0000 (04:00 +1200)]
Merge pull request #20248 from eileenmcnaughton/tes

Improve cleanup on contact test

3 years agoImprove cleanup on contact test
Your Name [Fri, 7 May 2021 12:08:34 +0000 (00:08 +1200)]
Improve cleanup on contact test

We are not deleting all financial entities, when created, meaning this
test can cause other tests to fail depending on the combo

3 years agoMerge pull request #20238 from colemanw/civiCaseSave
Matthew Wire [Fri, 7 May 2021 10:02:38 +0000 (11:02 +0100)]
Merge pull request #20238 from colemanw/civiCaseSave

APIv4 - CiviCase API: Fix openening a case with current user as creator

3 years agoMerge pull request #20247 from civicrm/dependabot/npm_and_yarn/lodash-4.17.21
Eileen McNaughton [Fri, 7 May 2021 05:27:37 +0000 (17:27 +1200)]
Merge pull request #20247 from civicrm/dependabot/npm_and_yarn/lodash-4.17.21

Bump lodash from 4.17.19 to 4.17.21

3 years ago[REF] Fix function signature to actually-used variables
Your Name [Fri, 7 May 2021 02:22:12 +0000 (14:22 +1200)]
[REF] Fix function signature to actually-used variables

ids used to hold a whole lotta stuff. Now it just holds contributionRecurID.

This gets rid of ids as a param & just passes contributionRecurID

3 years agoBump lodash from 4.17.19 to 4.17.21
dependabot[bot] [Fri, 7 May 2021 03:27:37 +0000 (03:27 +0000)]
Bump lodash from 4.17.19 to 4.17.21

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoMerge pull request #20144 from eileenmcnaughton/never
Eileen McNaughton [Fri, 7 May 2021 03:25:15 +0000 (15:25 +1200)]
Merge pull request #20144 from eileenmcnaughton/never

hook_managed - do not try to disable managed entities if is_active is not available to api3.create

3 years agoSet version to 5.39.alpha1
CiviCRM [Fri, 7 May 2021 02:35:16 +0000 (02:35 +0000)]
Set version to 5.39.alpha1

3 years agoSet version to 5.38.beta1
CiviCRM [Fri, 7 May 2021 02:28:08 +0000 (02:28 +0000)]
Set version to 5.38.beta1

3 years agoMerge pull request #20152 from colemanw/resetLocationProviderHashPrefix
Tim Otten [Fri, 7 May 2021 02:26:37 +0000 (16:26 -1000)]
Merge pull request #20152 from colemanw/resetLocationProviderHashPrefix

Globally reset angular hashPrefix

3 years ago(NFC) Add comments about keeping two items sync'd
Tim Otten [Fri, 7 May 2021 02:24:41 +0000 (16:24 -1000)]
(NFC) Add comments about keeping two items sync'd

3 years agoMerge pull request #20245 from eileenmcnaughton/ft
Seamus Lee [Fri, 7 May 2021 02:11:37 +0000 (12:11 +1000)]
Merge pull request #20245 from eileenmcnaughton/ft

dev/core#2575 remove / improve indexes

3 years agoManagedEntities - Only set `is_active` if entity supports it
Tim Otten [Fri, 7 May 2021 01:52:29 +0000 (15:52 -1000)]
ManagedEntities - Only set `is_active` if entity supports it

3 years ago(REF) Extract method ManagedEntities::isActivationSupported()
Tim Otten [Fri, 7 May 2021 01:52:13 +0000 (15:52 -1000)]
(REF) Extract method ManagedEntities::isActivationSupported()

3 years agoMerge pull request #20244 from eileenmcnaughton/pp
Eileen McNaughton [Fri, 7 May 2021 01:21:03 +0000 (13:21 +1200)]
Merge pull request #20244 from eileenmcnaughton/pp

dev/core#2593 [REF] Stop passing membership id into recur notify

3 years agodev/core#2575 remove / improve indexes
eileen [Fri, 7 May 2021 00:11:58 +0000 (12:11 +1200)]
dev/core#2575 remove / improve indexes

This removes a couple of indexes on the id field as they duplicate the primary key
as pointed out in https://lab.civicrm.org/dev/core/-/issues/2575

In addition a couple of other indexes are removed as duplicates but the
originals are fixed to be more meaningful. It's important that in a combined
key the field with the lowest cardinality is the first as the combined key is
searched for a complete match so on something like line_item we see the
key is

civicrm_contribution1
civicrm_contribution10
civicrm_contribution1111
civicrm_membership1

In this case there are only 3 possible variants for the first chunk of
characters so we get a much more effective key by reversing them.
(arguably the entity_table actually adds no value due to it's low
cardinality).

The original post
https://civicrm.stackexchange.com/questions/39409/redundant-indexes
also suggests that

is_deleted_sort_name_id duplicates the id index

That is not the case - this query would only ever be
used if is_deleted is a filter. If it IS used then the id
index would NOT be used as only one index is used per table.

However, note that the id part of the filter would only be used if
is_deleted and sort_name were too - so the id part is of little value
as the last parameter & it's likely mysql would chose to use the
primary key instead.

However, I would argue the index as a whole is of little value. The
cardinality of is_deleted is super low and so preceding sort_name
with it is probably inferior to just leaving the
sort_name index to be used. However, this would need testing on
a site with enough data to get results.

On the queue index - it's hard to imagine that having more than the
queue name in the index adds any value at all. However, this is also such a small
table that probably the index has almost no size and the query probably takes
almost no time to run so the time we would spend testing index changes on
this table we would likely never get back.

Note changing these indexes will only affect new sites - or existing sites if they
run the System.updateIndexes api. We do have a ticket open
https://lab.civicrm.org/dev/core/-/issues/2279 with a proposal to
allow sites to define their own indexes which would work in conjunction with the
above api call (since indexes are not 1 size fits all - for example we
have removed indexes on things like contribution_status_id due to
low cardinality). We don't pro-actively run index updates on upgrade
due to not wanting to alter custom index config until 2279 is resolved
and also because some old DBs hit issues that we never diagnosed (and stopped
trying to once we stopped pro-actively notifying them about them)

3 years ago[REF] Stop passing membership id into recur notify
eileen [Thu, 6 May 2021 23:34:33 +0000 (11:34 +1200)]
[REF] Stop passing membership id into recur notify

The membership id resolves to a boolean template parameter of whether a membership is attached to the relevant
recurring record. The classes that call this function do a lot of work
to determine this so it's better to calculate it in-function and
simplify those classes

3 years agoAPIv4 - CiviCase API: Fix openening a case with current user as creator
Coleman Watts [Wed, 5 May 2021 21:33:28 +0000 (17:33 -0400)]
APIv4 - CiviCase API: Fix openening a case with current user as creator

The DAOActionTrait::writeObjects function was formatting values but not by reference,
so the CiviCase writeObjects function was using unformatted values to open the case,
which would contain the raw string `user_contact_id` instead of the processed value.

3 years ago[REF] Extract code determining list of groups requiring a refresh
eileen [Thu, 6 May 2021 06:45:35 +0000 (18:45 +1200)]
[REF] Extract code determining list of groups requiring a refresh

3 years agoMerge pull request #20145 from colemanw/afformRouteParams
Eileen McNaughton [Thu, 6 May 2021 05:59:10 +0000 (17:59 +1200)]
Merge pull request #20145 from colemanw/afformRouteParams

Afform - Fix loading entities from url args

3 years agoMerge pull request #20240 from eileenmcnaughton/actnfc
Seamus Lee [Thu, 6 May 2021 04:28:54 +0000 (14:28 +1000)]
Merge pull request #20240 from eileenmcnaughton/actnfc

[NFC] Code cleanup, docblocks, strict comparison, type hints

3 years agoMerge pull request #20237 from eileenmcnaughton/nfc
Eileen McNaughton [Thu, 6 May 2021 04:27:48 +0000 (16:27 +1200)]
Merge pull request #20237 from eileenmcnaughton/nfc

[NFC] code cleanups in test class

3 years agoMerge pull request #20233 from eileenmcnaughton/order_tax
Seamus Lee [Thu, 6 May 2021 02:47:17 +0000 (12:47 +1000)]
Merge pull request #20233 from eileenmcnaughton/order_tax

Extract sales tax test config to a trait

3 years ago[NFC] code cleanups
eileen [Thu, 6 May 2021 00:29:58 +0000 (12:29 +1200)]
[NFC] code cleanups

3 years ago[NFC] Code cleanup, docblocks, strict comparison, type hints
eileen [Thu, 6 May 2021 02:37:26 +0000 (14:37 +1200)]
[NFC] Code cleanup, docblocks, strict comparison, type hints

3 years agoMerge pull request #20125 from colemanw/searchContactRef
Seamus Lee [Thu, 6 May 2021 01:58:00 +0000 (11:58 +1000)]
Merge pull request #20125 from colemanw/searchContactRef

SearchKit - Fix updating Entity Ref fields

3 years agoMerge pull request #20235 from seamuslee001/master
Seamus Lee [Thu, 6 May 2021 01:36:10 +0000 (11:36 +1000)]
Merge pull request #20235 from seamuslee001/master

(5.37  merge into master) dev/core#2586 fix failure to null thank you

3 years agodev/core#2586 fix failure to null thank you
eileen [Wed, 5 May 2021 06:43:00 +0000 (18:43 +1200)]
dev/core#2586 fix failure to null thank you

5.35 regression from this

https://github.com/civicrm/civicrm-core/commit/aa9e580fd8ce5824d627bdaf797a3ccd6732f1a0

3 years agoExtract sales tax config to a trait
eileen [Wed, 5 May 2021 23:57:06 +0000 (11:57 +1200)]
Extract sales tax config to a trait

3 years agoMerge pull request #20232 from totten/merge-master-5.37
Seamus Lee [Wed, 5 May 2021 22:32:28 +0000 (08:32 +1000)]
Merge pull request #20232 from totten/merge-master-5.37

Merge forward (5.37 => master)

3 years agoMerge pull request #20228 from colemanw/afformBlockDefault
Eileen McNaughton [Wed, 5 May 2021 21:07:43 +0000 (09:07 +1200)]
Merge pull request #20228 from colemanw/afformBlockDefault

Afform - Set default position for contact layout editor

3 years ago5.37.0.md - Add 20222 and 20227
Tim Otten [Wed, 5 May 2021 19:50:04 +0000 (09:50 -1000)]
5.37.0.md - Add 20222 and 20227

3 years ago5.37.0.md - Minor copy-edits
Tim Otten [Wed, 5 May 2021 19:38:03 +0000 (09:38 -1000)]
5.37.0.md - Minor copy-edits

3 years ago5.37.0 release notes: added late changes
Andrew Hunt [Wed, 5 May 2021 18:19:47 +0000 (14:19 -0400)]
5.37.0 release notes: added late changes

3 years agofailing test for PR 20222
demeritcowboy [Wed, 5 May 2021 11:09:46 +0000 (07:09 -0400)]
failing test for PR 20222

3 years agofix what happens on 3rd iteration
demeritcowboy [Wed, 5 May 2021 04:20:47 +0000 (00:20 -0400)]
fix what happens on 3rd iteration

3 years agoMerge pull request #20221 from totten/master-subscribers
Tim Otten [Wed, 5 May 2021 19:24:51 +0000 (12:24 -0700)]
Merge pull request #20221 from totten/master-subscribers

Api4 Services - Lazy-load subscriber-objects

3 years agoActivate user when no activation is required
Pradeep Nayak [Wed, 5 May 2021 13:58:23 +0000 (14:58 +0100)]
Activate user when no activation is required

3 years agoAfform - Set default position for contact layout editor
Coleman Watts [Wed, 5 May 2021 13:20:18 +0000 (09:20 -0400)]
Afform - Set default position for contact layout editor

This makes afform blocks appear in their default positions on the
system default layout in contactlayout 2.0+

It's backward-compatible with earlier versions of the extension

3 years agoMerge pull request #20199 from kartik1000/altering_recaptcha_form
Matthew Wire [Wed, 5 May 2021 09:27:38 +0000 (10:27 +0100)]
Merge pull request #20199 from kartik1000/altering_recaptcha_form

dev/core#2571: Add form function of utils/Recaptcha has been altered to avoid checking variable "isCaptcha"

3 years agoMerge pull request #20219 from colemanw/campaignComponent
Seamus Lee [Wed, 5 May 2021 09:21:25 +0000 (19:21 +1000)]
Merge pull request #20219 from colemanw/campaignComponent

APIv4 - Don't show campaign_id in getFields if campaign component disabled

3 years agoMerge pull request #20224 from agileware/CIVICRM-1729
Matthew Wire [Wed, 5 May 2021 09:15:31 +0000 (10:15 +0100)]
Merge pull request #20224 from agileware/CIVICRM-1729

Set the smarty variables for mem_status and mem_join_date for back-end membership renewals

3 years agoMerge pull request #20226 from civicrm/5.37
Seamus Lee [Wed, 5 May 2021 09:00:31 +0000 (19:00 +1000)]
Merge pull request #20226 from civicrm/5.37

5.37

3 years agoMerge pull request #20223 from JMAConsulting/backoffice-xfer
Seamus Lee [Wed, 5 May 2021 09:00:17 +0000 (19:00 +1000)]
Merge pull request #20223 from JMAConsulting/backoffice-xfer

allow event transfer on backend when self-service transfer is disabled

3 years agoCIVICRM-1729 Set the smarty variables for mem_status and mem_join_date for back-end...
Justin Freeman [Wed, 5 May 2021 06:16:42 +0000 (16:16 +1000)]
CIVICRM-1729 Set the smarty variables for mem_status and mem_join_date for back-end membership renewals

3 years agoallow event transfer on backend when self-service transfer is disabled
Jon Goldberg [Mon, 26 Apr 2021 19:09:34 +0000 (15:09 -0400)]
allow event transfer on backend when self-service transfer is disabled

3 years agoDo not error on view contribution recur if not displaying contributions
eileen [Mon, 3 May 2021 03:27:22 +0000 (15:27 +1200)]
Do not error on view contribution recur if not displaying contributions

3 years agoOnly attempt to disable entity if v3 create+is_active is an option
eileen [Wed, 5 May 2021 01:57:18 +0000 (13:57 +1200)]
Only attempt to disable entity if v3 create+is_active is an option

3 years agoUse order api when creating a recurring membership from the Membership backoffice...
eileen [Fri, 16 Apr 2021 00:16:16 +0000 (12:16 +1200)]
Use order api when creating a recurring membership from the Membership backoffice form

This removes the need for some 'magic' code from the membership BAO that was really only
there to support the fact that this code was doing some particularly convoluted
manoevering in order to share code with the front end form (since unshared).

Not this adds a feature Matt requested - the created membership id is returned. This
is only done for memberships at the moment but could be other entities too as
test cover is added (the membership tests fail without the change in this
PR so it has cover in the context it is added

3 years agoAPIv4 - Don't show campaign_id in getFields if campaign component disabled
Coleman Watts [Wed, 5 May 2021 01:13:09 +0000 (21:13 -0400)]
APIv4 - Don't show campaign_id in getFields if campaign component disabled

3 years agoMerge pull request #20150 from MegaphoneJon/backoffice-xfer
Monish Deb [Wed, 5 May 2021 03:17:49 +0000 (08:47 +0530)]
Merge pull request #20150 from MegaphoneJon/backoffice-xfer

allow event transfer on backend when self-service transfer is disabled

3 years agoMerge pull request #20218 from seamuslee001/pear_log_drupal9_fix
Seamus Lee [Wed, 5 May 2021 02:20:53 +0000 (12:20 +1000)]
Merge pull request #20218 from seamuslee001/pear_log_drupal9_fix

REF Update Pear/log to fix issues with install CiviCRM on Drupal 9.2

3 years agoMerge pull request #20146 from eileenmcnaughton/log
Seamus Lee [Wed, 5 May 2021 01:56:40 +0000 (11:56 +1000)]
Merge pull request #20146 from eileenmcnaughton/log

Fix enotice when Log service is swapped out

3 years agoApi4 Services - Lazy-load subscriber-objects
Tim Otten [Tue, 4 May 2021 20:36:48 +0000 (13:36 -0700)]
Api4 Services - Lazy-load subscriber-objects

This refines the way in which `Civi/Api4/Event/Subscriber/**.php` are loaded.
This makes it safer (from a performance POV) to continue adding more
subscribers/listeners without worrying that it will impact the quantity of
files/classes/opcodes/SLOC loaded in a typical page-view.

A good way to visualize this change is to skim `getDispatcherService()`
(`[civicrm.compile]/CachedCiviContainer.*.php`) before and after the patch.
(Examples included below.)

Before
------

During every page-load, you need to register event-listeners.  For
subscriber-objects (like `Civi/Api4/Event/Subscriber/**.php`), you get the list
of subscriptions by calling `getSubscribedEvents()`.  Therefore, on every
page-load, you must load/process the subscriber (regardless of whether it will
actually be used) on the chance it that may be needed.

In `CachedCiviContainer.*.php`, you will see snippets like:

```php
    protected function getDispatcherService()
    {
        ...
        $instance->addSubscriber(${($_ = isset($this->services['Civi_Api4_Event_Subscriber_ActivityPreCreationSubscriber']) ? $this->services['Civi_Api4_Event_Subscriber_ActivityPreCreationSubscriber'] : ($this->services['Civi_Api4_Event_Subscriber_ActivityPreCreationSubscriber'] = new \Civi\Api4\Event\Subscriber\ActivityPreCreationSubscriber())) && false ?: '_'});
        $instance->addSubscriber(${($_ = isset($this->services['Civi_Api4_Event_Subscriber_ActivitySchemaMapSubscriber']) ? $this->services['Civi_Api4_Event_Subscriber_ActivitySchemaMapSubscriber'] : ($this->services['Civi_Api4_Event_Subscriber_ActivitySchemaMapSubscriber'] = new \Civi\Api4\Event\Subscriber\ActivitySchemaMapSubscriber())) && false ?: '_'});
        ...
```

Observe that it instantiates `ActivitySchemaMapSubscriber` then passes the instance to `addSubscriber()`.

After
-----

You only need to instantiate service-objects if (a) you are building a fresh container or (b) actually running an event.

This works by calling `getSubscribedEvents()` when building the container.  The
list of events is cached in the container.

In `CachedCiviContainer.*.php`, you will see snippets like:

```php
    protected function getDispatcherService()
    {
        ...

        $instance->addSubscriberServiceMap('Civi_Api4_Event_Subscriber_ActivityPreCreationSubscriber', ['civi.api.prepare' => 'onApiPrepare']);
        $instance->addSubscriberServiceMap('Civi_Api4_Event_Subscriber_ActivitySchemaMapSubscriber', ['api.schema_map.build' => 'onSchemaBuild']);
        ...
```

Observe that it alludes to `ActivityPreCreationSubscriber` symbolically but
does not need an actual instance.

Comments
-----------------

1.  To see that this is equivalent, I used `cv debug:event-dispatcher` before
and after the patch.  This requires an updated version of `cv`, and the
formatting is a little a different, but it does show the same list of
listeners.

2.  There could be some concern like, "What happens if you're upgrading and
have a cached list of subscription events?" Well, note that
`CRM_Api4_Services::hook_container` already puts a cached list of subscribers
in the container.  It also registers the `FileResource`.  Thus, if a file
`Civi/Api4/Event/Subscriber/**.php` changes, it already makes the decision to
recompile based on `filemtime()`.

3. There should already be a lot of test-coverage which hits code-paths for these listeners.
   (If this were generally non-functional, you'd see massive failures.)

4. For `r-run`, I picked an arbitary subscriber (`ActivitySchemaMapSubscriber`), then:

   * At the start of the file, add a statement to log whenever the file is read.
     ```php
     file_put_contents('/tmp/parselog.txt', sprintf("%s: %s: %s\n\n",date('Y-m-d H:i:s'), __FILE__, \CRM_Core_Error::formatBacktrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 15))), FILE_APPEND);
     ```
   * In a separate window, do a `tail -f /tmp/parselog.txt`.
   * Edit the file to add/remove listeners (like `hook_civicrm_alterContent`)
   * Request some Civi page (`curl 'http://dmaster.127.0.0.1.nip.io:8001/civicrm/admin?reset=1'`). It's not important that it actually runs the full page...
     just that we boot up Civi to look for the page.
   * Alternately repeat the past few steps. Observe thta it only parses the file if there has been a change or if the relevant event(s) actually fire.

3 years ago(REF) CiviEventDispatcher - Move service-listener stub to standalone class
Tim Otten [Tue, 4 May 2021 20:31:51 +0000 (13:31 -0700)]
(REF) CiviEventDispatcher - Move service-listener stub to standalone class

This change makes it easier for reflective tools (e.g.  `cv
debug:event-dispatcher`) to recognize service-based listeners.

Before: `addListenerServce()` creates a stub for the target service+method.
The stub is an anonymous `function`.

After: `addListenerService()` creates a staub for the target service+method.
The stub is based on invokable class.

3 years agoREF Update Pear/log to fix issues with install CiviCRM on Drupal 9.2
Seamus Lee [Wed, 5 May 2021 01:03:26 +0000 (11:03 +1000)]
REF Update Pear/log to fix issues with install CiviCRM on Drupal 9.2

3 years agoMerge pull request #20191 from colemanw/apiSettingsFixes
Eileen McNaughton [Wed, 5 May 2021 00:41:14 +0000 (12:41 +1200)]
Merge pull request #20191 from colemanw/apiSettingsFixes

APIv4 - Setting api misc fixes & tests

3 years agoFix enotice when Log service is swapped out
eileen [Mon, 26 Apr 2021 05:23:13 +0000 (17:23 +1200)]
Fix enotice when Log service is swapped out

This function is calling a property on the psr_log service that may not exist. If the
service is swapped out there is no reason the replacement should have this property.

3 years agoMerge pull request #20215 from colemanw/campaignRef
Eileen McNaughton [Tue, 4 May 2021 22:24:20 +0000 (10:24 +1200)]
Merge pull request #20215 from colemanw/campaignRef

Set html type of campaign fields

3 years agoAPIv4 - Add `readonly` property to settings getFields
Coleman Watts [Mon, 3 May 2021 14:06:32 +0000 (10:06 -0400)]
APIv4 - Add `readonly` property to settings getFields

3 years agoAPIv4 - Setting api misc fixes & tests
Coleman Watts [Thu, 29 Apr 2021 15:32:39 +0000 (11:32 -0400)]
APIv4 - Setting api misc fixes & tests

Fixes the setting api to correctly handle pseudoconstants & field suffixes

3 years agoSet html type of campaign fields
Coleman Watts [Tue, 4 May 2021 13:25:49 +0000 (09:25 -0400)]
Set html type of campaign fields

Afform needs to know that these are fields of type EntityRef.
Otherwise, this metadata is currently unused.

3 years agoMerge pull request #20063 from christianwach/lab-wp-93
Eileen McNaughton [Mon, 3 May 2021 21:33:22 +0000 (09:33 +1200)]
Merge pull request #20063 from christianwach/lab-wp-93

Fix PayPal IPN URL and WordPress URLs when Permalinks are set to "Plain"

3 years agoMerge pull request #20123 from jaapjansma/dev_2505
Eileen McNaughton [Mon, 3 May 2021 19:44:11 +0000 (07:44 +1200)]
Merge pull request #20123 from jaapjansma/dev_2505

Fixed dev/core#2505  fix formatting of numbers in civireport

3 years agoMerge pull request #20188 from eileenmcnaughton/contto
demeritcowboy [Mon, 3 May 2021 17:29:33 +0000 (13:29 -0400)]
Merge pull request #20188 from eileenmcnaughton/contto

dev/core#2568 Enotice fix + test

3 years agoFixed dev/core#2505
Jaap Jansma [Thu, 22 Apr 2021 13:05:39 +0000 (15:05 +0200)]
Fixed dev/core#2505

Fixed failing test

Fixed issue with wrong parameters in comment section

Improved settings of NumberFormatter

removed unused function

3 years ago[REF] Move ACLPermission Trait into Civi Folder so that it can be accessed by Extensions
Seamus Lee [Mon, 3 May 2021 03:25:58 +0000 (13:25 +1000)]
[REF] Move ACLPermission Trait into Civi Folder so that it can be accessed by Extensions

3 years agoMerge pull request #20156 from colemanw/searchKitExcludeSerializedFromAutoJoins
Seamus Lee [Mon, 3 May 2021 09:09:33 +0000 (19:09 +1000)]
Merge pull request #20156 from colemanw/searchKitExcludeSerializedFromAutoJoins

SearchKit - Exclude serialized fields from implicit join selection