civicrm-core.git
4 years agoMerge pull request #16425 from colemanw/markdown
Seamus Lee [Fri, 31 Jan 2020 05:34:21 +0000 (16:34 +1100)]
Merge pull request #16425 from colemanw/markdown

Use markdown in php docblocks & display in APIv4 Explorer

4 years agoMerge pull request #16098 from MegaphoneJon/event-23-correct
Seamus Lee [Fri, 31 Jan 2020 05:33:32 +0000 (16:33 +1100)]
Merge pull request #16098 from MegaphoneJon/event-23-correct

event#23 - don't count non-counted participants on Confirm Registrati…

4 years agoMerge pull request #16434 from eileenmcnaughton/cont_form_settings
Seamus Lee [Fri, 31 Jan 2020 03:45:06 +0000 (14:45 +1100)]
Merge pull request #16434 from eileenmcnaughton/cont_form_settings

[REF] Remove unused variable

4 years agoMerge pull request #16374 from colemanw/api4Delete
colemanw [Fri, 31 Jan 2020 00:23:28 +0000 (19:23 -0500)]
Merge pull request #16374 from colemanw/api4Delete

APIv4 - don't throw exception when updating/deleting 0 items

4 years agoMerge pull request #16432 from colemanw/comments
colemanw [Fri, 31 Jan 2020 00:20:14 +0000 (19:20 -0500)]
Merge pull request #16432 from colemanw/comments

Cleanup API_Exception usage

4 years agoevent#23 - don't count non-counted participants on Confirm Registration screen
Jon Goldberg [Thu, 12 Dec 2019 22:10:03 +0000 (17:10 -0500)]
event#23 - don't count non-counted participants on Confirm Registration screen

4 years agoRemove unused setting
eileen [Thu, 30 Jan 2020 23:02:10 +0000 (12:02 +1300)]
Remove unused setting

4 years agoUse markdown in php docblocks & display in APIv4 Explorer
Coleman Watts [Thu, 30 Jan 2020 01:34:49 +0000 (20:34 -0500)]
Use markdown in php docblocks & display in APIv4 Explorer

Reformats some docblocks to use markdown, and uses the marked.js library
to display them in the APIv4 Explorer.

4 years agoMerge pull request #16424 from eileenmcnaughton/cont_setting_handling
Eileen McNaughton [Thu, 30 Jan 2020 21:41:58 +0000 (10:41 +1300)]
Merge pull request #16424 from eileenmcnaughton/cont_setting_handling

dev/core#1558 Data conversion for non-standard setting.

4 years agoMerge pull request #16433 from eileenmcnaughton/fatal
Seamus Lee [Thu, 30 Jan 2020 21:38:42 +0000 (08:38 +1100)]
Merge pull request #16433 from eileenmcnaughton/fatal

dev/core#560 Replace fatal with exception

4 years agoAPIv4 - don't throw exception when updating 0 items
Coleman Watts [Thu, 30 Jan 2020 21:33:05 +0000 (16:33 -0500)]
APIv4 - don't throw exception when updating 0 items

4 years agoAPIv4 - don't throw exception when deleting 0 items
Coleman Watts [Fri, 24 Jan 2020 21:04:07 +0000 (16:04 -0500)]
APIv4 - don't throw exception when deleting 0 items

4 years agoMerge pull request #16431 from colemanw/explorerCss
Eileen McNaughton [Thu, 30 Jan 2020 21:28:59 +0000 (10:28 +1300)]
Merge pull request #16431 from colemanw/explorerCss

APIv4 Explorer css tweaks

4 years agodev/core#1558 Data conversion for non-standard setting.
eileen [Wed, 29 Jan 2020 21:49:16 +0000 (10:49 +1300)]
dev/core#1558 Data conversion for non-standard setting.

Per https://lab.civicrm.org/dev/core/issues/1558 the 'contribution_invoice_settings' 'setting'
does not follow our standard of one setting per key and this has led to all sorts of hacks in various places.

In trying to unravel this I eventually concluded we needed an interim step where the data would be
stored as the correct settings but set and get would still work on the deprecated settinng. The reason for
goinng this way is that I found more than one place where extension code is accessing these settings
and the amount of work to fix up all the places in core that access it and the settings form were too big
to deal with without a stepping stone.

With this merged the settinngs are correctly defined and a definition for the deprecated setting still exists.

Requesting the deprecated setting returns an array retrieved from the correct settings so is unchanged from calling
functions point of view. Saving the deprecated setting saves to the correct places. However, it's now also
possible to get & set the correct settings and once the core places are removed we will deprecate & remove the
deprecated setting.

Unit tests cover past & desired behaviour and the upgrade routine.

4 years agoReplace fatal with exception
eileen [Thu, 30 Jan 2020 20:30:48 +0000 (09:30 +1300)]
Replace fatal with exception

4 years agoMerge pull request #16365 from mattwire/civicontribute_disabled_devcore547
Eileen McNaughton [Thu, 30 Jan 2020 20:05:54 +0000 (09:05 +1300)]
Merge pull request #16365 from mattwire/civicontribute_disabled_devcore547

dev/core#547 If CiviContribute is not enabled don't crash when calling ContributionPage.getoptions or Event.getoptions

4 years agoMerge pull request #16392 from jaapjansma/dev_1522_tests
Eileen McNaughton [Thu, 30 Jan 2020 20:04:16 +0000 (09:04 +1300)]
Merge pull request #16392 from jaapjansma/dev_1522_tests

dev/core#1522 Handle space as thousand separator

4 years agoIf CiviContribute is not enabled don't crash when calling ContributionPage.getoptions...
Matthew Wire [Thu, 23 Jan 2020 22:53:16 +0000 (22:53 +0000)]
If CiviContribute is not enabled don't crash when calling ContributionPage.getoptions or Event.getoptions

4 years agoAPI Kernel - move params check to v3 where it's relevant
Coleman Watts [Thu, 30 Jan 2020 15:54:11 +0000 (10:54 -0500)]
API Kernel - move params check to v3 where it's relevant

4 years agoNFC - Comment & case cleanup
Coleman Watts [Fri, 24 May 2019 18:20:23 +0000 (14:20 -0400)]
NFC - Comment & case cleanup

4 years agoAPIv4 Explorer css tweaks
Coleman Watts [Thu, 30 Jan 2020 03:36:08 +0000 (22:36 -0500)]
APIv4 Explorer css tweaks

4 years agoIssue 1522: style formatting
Jaap Jansma [Thu, 30 Jan 2020 10:07:46 +0000 (11:07 +0100)]
Issue 1522: style formatting

4 years agoMerge pull request #16398 from eileenmcnaughton/pref_form
Seamus Lee [Thu, 30 Jan 2020 04:53:43 +0000 (15:53 +1100)]
Merge pull request #16398 from eileenmcnaughton/pref_form

dev/core#1558 [REF] Remove deprecated code from CRM_Admin_Form_Preferences

4 years agoMerge pull request #15842 from totten/master-config-backend
Seamus Lee [Thu, 30 Jan 2020 03:50:32 +0000 (14:50 +1100)]
Merge pull request #15842 from totten/master-config-backend

dev/core#1387 Continue removal of "config_backend"

4 years ago(dev/core#1387) ConfigSetting - Deprecation+guard for retrieve()/add()
Tim Otten [Wed, 13 Nov 2019 06:14:57 +0000 (22:14 -0800)]
(dev/core#1387) ConfigSetting - Deprecation+guard for retrieve()/add()

These functions were traditionally used for accessing `config_backend`,
which was (mostly) dropped in v4.7 and became inert. However, the
functions are still referenced in a couple oddball cases.

Note that the references to `$domain->config_backend` are liable to raise
warnings if evaluated - since the field no longer exists on the DAO class.
Consequently, the extra `$hasBackend` guard should reduce warnings.

4 years ago(dev/core#1387) Remove some lingering references to config_backend
Tim Otten [Wed, 13 Nov 2019 05:54:54 +0000 (21:54 -0800)]
(dev/core#1387) Remove some lingering references to config_backend

4 years ago(dev/core#1387) Remove config_backend from sample/dev setup
Tim Otten [Wed, 13 Nov 2019 05:54:12 +0000 (21:54 -0800)]
(dev/core#1387) Remove config_backend from sample/dev setup

4 years ago(dev/core#1387) FiveTwentyThree - Drop civicrm_domain.config_backend if it snuck in
Tim Otten [Wed, 13 Nov 2019 05:38:56 +0000 (21:38 -0800)]
(dev/core#1387) FiveTwentyThree - Drop civicrm_domain.config_backend if it snuck in

This column was dropped in 4.7.alpha1, but it was still created on new installs, so

* Sites originating with 4.7 - 5.22 should have an empty copy of the column today
  (because it was defined in xml schema - but never used by live code).
* Sites originating with <4.7 (and subsequently upgraded) should not have the column today
  (because FourSeven.php previously dropped it).
* Sites originating with <4.7 (and not yet upgraded) should have the column with some data
  (because FourSeven.php hasn't run yet).
* It is unexpected that any site currently on 4.7-5.22 would have any data in that column.

Note: `dropColumn` has a built-in guard so it only drops the column if it
exists.

4 years ago(dev/core#1387) Domain.xml - Drop config_backend
Tim Otten [Wed, 13 Nov 2019 05:19:04 +0000 (21:19 -0800)]
(dev/core#1387) Domain.xml - Drop config_backend

4 years agoMerge pull request #15760 from colemanw/iconPicker
Eileen McNaughton [Thu, 30 Jan 2020 02:15:11 +0000 (15:15 +1300)]
Merge pull request #15760 from colemanw/iconPicker

IconPicker widget improvements

4 years agoMerge pull request #16405 from totten/master-test-codegen
Eileen McNaughton [Thu, 30 Jan 2020 01:57:03 +0000 (14:57 +1300)]
Merge pull request #16405 from totten/master-test-codegen

Civi\Test - Allow `headless()->apply()` (etc) to execute without setup.sh

4 years agoMerge pull request #16403 from totten/master-relurl
Eileen McNaughton [Thu, 30 Jan 2020 01:52:27 +0000 (14:52 +1300)]
Merge pull request #16403 from totten/master-relurl

Allow most values of $civicrm_paths['XXX']['url'] to be relative

4 years agoMerge pull request #16407 from totten/master-altpkgs-basic
Eileen McNaughton [Thu, 30 Jan 2020 01:49:22 +0000 (14:49 +1300)]
Merge pull request #16407 from totten/master-altpkgs-basic

Fix loading with alternate packages path (system-level)

4 years agoMerge pull request #16406 from totten/master-menu-warn
Eileen McNaughton [Thu, 30 Jan 2020 01:39:48 +0000 (14:39 +1300)]
Merge pull request #16406 from totten/master-menu-warn

CRM_Core_Menu - Fix warnings during local test run (dev/core#742)

4 years agoMerge pull request #16409 from totten/master-altpkgs-ui
Eileen McNaughton [Thu, 30 Jan 2020 01:13:46 +0000 (14:13 +1300)]
Merge pull request #16409 from totten/master-altpkgs-ui

 Fix loading with alternate packages path (UI-level)

4 years agoMerge pull request #16411 from colemanw/api4EntityDoc
Eileen McNaughton [Thu, 30 Jan 2020 01:02:10 +0000 (14:02 +1300)]
Merge pull request #16411 from colemanw/api4EntityDoc

Api4 docs improvements

4 years agoMerge pull request #16423 from totten/master-setup04
Eileen McNaughton [Thu, 30 Jan 2020 00:59:03 +0000 (13:59 +1300)]
Merge pull request #16423 from totten/master-setup04

composer.json - Update civicrm-setup

4 years agoMerge pull request #16402 from eileenmcnaughton/part_test
Eileen McNaughton [Thu, 30 Jan 2020 00:56:41 +0000 (13:56 +1300)]
Merge pull request #16402 from eileenmcnaughton/part_test

[REF] Add test for line item, extract fn

4 years agoMerge pull request #16422 from seamuslee001/contribute_summary_report_stats_hook
Seamus Lee [Thu, 30 Jan 2020 00:44:28 +0000 (11:44 +1100)]
Merge pull request #16422 from seamuslee001/contribute_summary_report_stats_hook

[REF] Ensure that the from is correctly modified in both the main que…

4 years agoAdd test for line item, extract fn
eileen [Tue, 28 Jan 2020 21:41:38 +0000 (10:41 +1300)]
Add test for line item, extract fn

4 years agocomposer.json - Update civicrm-setup
Tim Otten [Wed, 29 Jan 2020 22:01:49 +0000 (14:01 -0800)]
composer.json - Update civicrm-setup

4 years agoMerge pull request #16421 from totten/master-config-php
Tim Otten [Wed, 29 Jan 2020 22:06:30 +0000 (14:06 -0800)]
Merge pull request #16421 from totten/master-config-php

composer.json - Explicitly set target PHP platform

4 years agoAdd in unit test of to verify the change
Seamus Lee [Wed, 29 Jan 2020 21:46:04 +0000 (08:46 +1100)]
Add in unit test of to verify the change

4 years ago[REF] Ensure that the from is correctly modified in both the main query and in the...
Seamus Lee [Wed, 29 Jan 2020 21:20:03 +0000 (08:20 +1100)]
[REF] Ensure that the from is correctly modified in both the main query and in the statistics section of the Contribute Summary Report

4 years agocomposer.json - Explicitly set target PHP platform
Tim Otten [Wed, 29 Jan 2020 20:12:47 +0000 (12:12 -0800)]
composer.json - Explicitly set target PHP platform

Overview
--------

This refines the way in which `composer` resolves dependencies - so as to
prefer packages that are compatible with Civi's declared minimum requirement.

https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/#tip-%2315%3A-specify-the-production-php-version-in-%60composer.json%60

Before
------

Suppose that:

* The current minimum declared is PHP 7.0. (That happens to be the case at time of writing.)
* You locally use PHP 7.4.
* You wish to add or update a package.

`composer` may grab a version of a package that works on PHP 7.4 -- but is
not available/compatible with PHP 7.0. Then you start developing things under
the false expectation that the library will be usable -- and only discover the
problem later.

After
-----

`composer` should grab packages that are compatible with the declared PHP version,
regardless of the local PHP version.

Comment
-------

* This is orthogonal to the question of *which* PHP version should be the
  platform for CiviCRM -- whatever version that is, this dynamic can play out.
  The patch doesn't change that.
* The value will undoubtedly change over time, which has a small maintenance
  issue to keep the PHP constants in sync with the composer metadata.
  KISS solution: add a comment!

4 years agoMerge pull request #16420 from civicrm/5.22
Eileen McNaughton [Wed, 29 Jan 2020 19:55:00 +0000 (08:55 +1300)]
Merge pull request #16420 from civicrm/5.22

5.22 to master

4 years agoMerge pull request #16417 from jmcclelland/1555b
Eileen McNaughton [Wed, 29 Jan 2020 19:54:18 +0000 (08:54 +1300)]
Merge pull request #16417 from jmcclelland/1555b

avoid undefined offset and uninitialized key errors on upgrade - dev/core#1555

4 years agoAPIv4 - Add docblocks to base classes
Coleman Watts [Wed, 29 Jan 2020 16:43:55 +0000 (11:43 -0500)]
APIv4 - Add docblocks to base classes

4 years agoMerge pull request #16419 from civicrm/5.22
Seamus Lee [Wed, 29 Jan 2020 14:39:27 +0000 (01:39 +1100)]
Merge pull request #16419 from civicrm/5.22

5.22

4 years agoMerge pull request #16418 from seamuslee001/5.22
Seamus Lee [Wed, 29 Jan 2020 14:37:45 +0000 (01:37 +1100)]
Merge pull request #16418 from seamuslee001/5.22

Add release-notes/5.21.2.md

4 years agoAdd release-notes/5.21.2.md
Tim Otten [Thu, 23 Jan 2020 23:58:31 +0000 (15:58 -0800)]
Add release-notes/5.21.2.md

4 years agoavoid undefined offset and uninitialized key errors on upgrade
Jamie McClelland [Tue, 28 Jan 2020 16:48:38 +0000 (11:48 -0500)]
avoid undefined offset and uninitialized key errors on upgrade

https://lab.civicrm.org/dev/core/issues/1555

4 years agoMerge pull request #16415 from eileenmcnaughton/fatal
Matthew Wire [Wed, 29 Jan 2020 11:00:39 +0000 (11:00 +0000)]
Merge pull request #16415 from eileenmcnaughton/fatal

[NFC] throw exceptions, single quotes, declare exceptions, remove unused param

4 years agoMerge pull request #16414 from eileenmcnaughton/acl
Matthew Wire [Wed, 29 Jan 2020 10:59:05 +0000 (10:59 +0000)]
Merge pull request #16414 from eileenmcnaughton/acl

[REF] Remove some unused variables

4 years agoMerge pull request #16412 from eileenmcnaughton/cont_settings
Matthew Wire [Wed, 29 Jan 2020 10:58:09 +0000 (10:58 +0000)]
Merge pull request #16412 from eileenmcnaughton/cont_settings

dev/core#1558 [REF] Remove unnecessary query, clean up silly function

4 years agoMerge pull request #16408 from totten/master-altpkgs-setupsh
Seamus Lee [Wed, 29 Jan 2020 08:41:18 +0000 (19:41 +1100)]
Merge pull request #16408 from totten/master-altpkgs-setupsh

setup.sh - Fixes for running in basic composer file-structure

4 years agoIssue 1522: missing comments
Jaap Jansma [Wed, 29 Jan 2020 07:14:00 +0000 (08:14 +0100)]
Issue 1522: missing comments

4 years ago[NFC] throw exceptions, single quotes, declare exceptions, remove unused param
eileen [Wed, 29 Jan 2020 06:48:11 +0000 (19:48 +1300)]
[NFC] throw exceptions, single quotes, declare exceptions, remove unused param

4 years agoRemove some unused variables
eileen [Wed, 29 Jan 2020 04:18:46 +0000 (17:18 +1300)]
Remove some unused variables

phpcs correctly found these

Eileens-MacBook-Pro:civicrm eileenmcnaughton$ phpcs --standard=DrupalPractice CRM/ACL

FILE: /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/ACL/Form/WordPress/Permissions.php
---------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 197 | WARNING | Unused global variable .
---------------------------------------------------------------------------------------------------------------------

FILE: /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/ACL/Form/ACL.php
---------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
 97 | WARNING | Unused variable .
---------------------------------------------------------------------------------------------------

FILE: /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/ACL/BAO/ACL.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
 171 | WARNING | Unused variable .
 172 | WARNING | Unused variable .
 296 | WARNING | Unused variable .
--------------------------------------------------------------------------------------------------

4 years ago[REF] spare a query
eileen [Wed, 29 Jan 2020 01:22:42 +0000 (14:22 +1300)]
[REF] spare a query

getInvoiceNumber returns NULL if the 'invoicing' setting is disabled, by checking slightly earlier
we can skip a query if it is not

Upgrade fix: Copy code to upgrade script rather than call a function.

The function will change as we fix the setting but we want the upgrade function to work off the old setting

Test fix: Use hard coded invoicePrefix

We know what it is - if it were not set right then the test would not pick it up because it is comparing
based on the assumption it is - using the string is more reliable

4 years agoApi4 Explorer - enable debug by default
Coleman Watts [Wed, 29 Jan 2020 01:34:45 +0000 (20:34 -0500)]
Api4 Explorer - enable debug by default

4 years agoApi4 Explorer - Add code styles and display in tabs
Coleman Watts [Wed, 29 Jan 2020 00:56:33 +0000 (19:56 -0500)]
Api4 Explorer - Add code styles and display in tabs

4 years agoMerge pull request #16410 from civicrm/5.22
Eileen McNaughton [Wed, 29 Jan 2020 00:42:11 +0000 (13:42 +1300)]
Merge pull request #16410 from civicrm/5.22

5.22 to master

4 years agoMerge pull request #16393 from demeritcowboy/activity-report-pager-crash
Eileen McNaughton [Wed, 29 Jan 2020 00:41:45 +0000 (13:41 +1300)]
Merge pull request #16393 from demeritcowboy/activity-report-pager-crash

dev/core#1552 Fatal error using pager on Activity Detail Report when Include Case Activities is Yes

4 years agoMerge pull request #16404 from totten/master-slashes
Eileen McNaughton [Wed, 29 Jan 2020 00:41:06 +0000 (13:41 +1300)]
Merge pull request #16404 from totten/master-slashes

Make $civicrm_paths less sensitive to trailing slashes. Add tests.

4 years agoCRM_Badge_Form_Layout - (Partially) Fix loading with alternate packages path
Tim Otten [Wed, 15 Jan 2020 21:48:58 +0000 (13:48 -0800)]
CRM_Badge_Form_Layout - (Partially) Fix loading with alternate packages path

This change should work as well as before, and it's more correct.  However,
it's not a full fix making the badge-editor work in D8 - the relevant code
probably needs more of a rethink. But... this is cleaner...

4 years agojs/*.js - Fix loading with alternate packages path
Tim Otten [Thu, 16 Jan 2020 09:24:35 +0000 (01:24 -0800)]
js/*.js - Fix loading with alternate packages path

4 years agoCRM_UF_Page_ProfileEditor - Fix loading with alternate packages path
Tim Otten [Thu, 16 Jan 2020 08:05:10 +0000 (00:05 -0800)]
CRM_UF_Page_ProfileEditor - Fix loading with alternate packages path

4 years agocrmResURL, crmResPath - Allow full path expressions
Tim Otten [Thu, 16 Jan 2020 09:21:20 +0000 (01:21 -0800)]
crmResURL, crmResPath - Allow full path expressions

Before
------

In Smarty, there is no way to request values from `Civi::paths()`.

After
-----

In Smarty, you can request values from `Civi::paths()` using these notations:

```
{crmResURL expr="[civicrm.root]/foo"}
{crmResPath expr="[civicrm.root]/foo"}
```

4 years agobin/setup.sh - Skip 'composer install' on D8
Tim Otten [Thu, 16 Jan 2020 01:38:50 +0000 (17:38 -0800)]
bin/setup.sh - Skip 'composer install' on D8

4 years agoGenCode - Allow execution when civicrm-packages is loaded higher up via composer
Tim Otten [Thu, 16 Jan 2020 01:22:33 +0000 (17:22 -0800)]
GenCode - Allow execution when civicrm-packages is loaded higher up via composer

4 years agoGenCode - Optionaly allow direct control over civicrm.config.php template
Tim Otten [Thu, 16 Jan 2020 01:22:05 +0000 (17:22 -0800)]
GenCode - Optionaly allow direct control over civicrm.config.php template

4 years agoCRM_Utils_String - Fix loading with alternate packages path
Tim Otten [Sat, 18 Jan 2020 06:02:38 +0000 (22:02 -0800)]
CRM_Utils_String - Fix loading with alternate packages path

4 years agoCRM_Core_ClassLoader - Fix loading with alternate packages path
Tim Otten [Wed, 15 Jan 2020 21:40:32 +0000 (13:40 -0800)]
CRM_Core_ClassLoader - Fix loading with alternate packages path

4 years agoCRM_Core_IDS - Fix loading with alternate packages path
Tim Otten [Wed, 15 Jan 2020 21:41:09 +0000 (13:41 -0800)]
CRM_Core_IDS - Fix loading with alternate packages path

4 years agoCRM_Core_Smarty - Fix loading with alternate packages path
Tim Otten [Wed, 15 Jan 2020 21:41:54 +0000 (13:41 -0800)]
CRM_Core_Smarty - Fix loading with alternate packages path

4 years agoCRM_Core_Resources - Fix loading with alternate packages path
Tim Otten [Wed, 15 Jan 2020 22:37:27 +0000 (14:37 -0800)]
CRM_Core_Resources - Fix loading with alternate packages path

4 years agoApi4 - add more debug output
Coleman Watts [Tue, 28 Jan 2020 22:12:29 +0000 (17:12 -0500)]
Api4 - add more debug output

4 years agoCRM_Core_Menu - Fix warnings during local test run (dev/core#742)
Tim Otten [Sat, 18 Jan 2020 07:44:18 +0000 (23:44 -0800)]
CRM_Core_Menu - Fix warnings during local test run (dev/core#742)

Before
------

In certain local OSX+D8 test environments, when running the full suite, I got a large number of warnings like this:

```
Warning: simplexml_load_file(): I/O warning : failed to load external entity "/Users/totten/bknix/build/drupal8-clean/web/vendor/civicrm/civicrm-core//CRM/Campaign/xml/Menu/Campaign.xml" in /Users/totten/bknix/build/drupal8-clean/web/vendor/civicrm/civicrm-core/CRM/Core/Menu.php on line 99
    ```

After
-----

Those warnings seem to have gone away.

The menu still seems to populate correctly.

Comments
--------

This smells a lot like dev/core#742 -- e.g.  it's the same warning and
(after adjusting for changes in line-numbering over the months) same line of
code.

4 years agoE2E_Core_LocalizedDataTest - Adaptation for composer/D8/git-style deployments
Tim Otten [Tue, 28 Jan 2020 01:13:10 +0000 (17:13 -0800)]
E2E_Core_LocalizedDataTest - Adaptation for composer/D8/git-style deployments

4 years agoCivi\Test - Allow `headless()->apply()` (etc) to execute without setup.sh
Tim Otten [Mon, 27 Jan 2020 23:59:41 +0000 (15:59 -0800)]
Civi\Test - Allow `headless()->apply()` (etc) to execute without setup.sh

Before
------

If you have a copy of the `git` codebase and wish to run any of the headless
test suites, you *must* run `setup.sh` aka `GenCode` beforehand.

This is because certain files - `sql/civicrm.mysql` and
`sql/civicrm_data.mysql` - are used in the headless suite.  As large
auto-generated files, they are not provided in git.

After
-----

The files `sql/civicrm.mysql` and `sql/civicrm_data.mysql` are no longer
required by the test suite -- the headless tests will directly use the
`GenCode` classes to produce the needful.

Comments
--------

The general thrust of this commit is to find spots which read an SQL file, e.g.

```php
\Civi\Test::execute(file_get_contents("foobar.mysql"));
```

and instead call the generator for that file, e.g.:

```php
$schema = new \CRM_Core_CodeGen_Schema(\Civi\Test::codeGen());
$result = $schema->generateFooBar();
\Civi\Test::execute($result['foobar.mysql']);
});
```

In doing so, we incorporate a couple tricks:

* The SQL content is cached for the duration of the test-run (`Civi\Test::$statics`).
  Generating the SQL is not super expensive... but `Civi\Test::headless()->...apply()`
  may be called thousands of times, so it could add-up. Just cache it.
* Most of the `generateFooBar()` functions depend in some fashion on `ts()`. This
  commit depends on a preceding commit to make `ts()` more amenable to execution
  during early stages of the test.
    * Related discussion: https://chat.civicrm.org/civicrm/pl/ehohytqkf7bd5prg9w75dq4qqw

4 years ago(REF) Civi\Test - Use de-minimis ts() while runnning installation
Tim Otten [Mon, 27 Jan 2020 23:50:52 +0000 (15:50 -0800)]
(REF) Civi\Test - Use de-minimis ts() while runnning installation

When running early-stage installation helpers like
`Civi\Test::headless()->...->apply()` or `Civi\Test:data()->...->populate()`
it can be hard to call `CRM_CodeGen_*` functionality - because that relies
on `ts()` which relies on other system services.

This change basically suspends/swaps some of the default `ts()` behavior
while the test system performs installation.

The change is in two sub-parts:

* Implement `asPreInstall()` (Files: `Civi/Test.php` and `CRM/Core/I18n.php`)
    * Add the helper `\Civi\Test::asPreInstall()`
    * Skip the use of "word replacements" during the pre-install phase
* Use `asPreInstall()` (Files: `Civi/Test/Data.php` and `Civi/Test/CiviEnvBuilder.php`)
    * Wrap existing code with the helper `\Civi\Test::asPreInstall(). These changes look big, but that's
      just whitespace -- inserting `asPreInstall()` changes the indentation.

This lays groundwork for another commit which will replace some references to `sql/civicrm*.mysql`
with references to `CRM_CodeGen_*`.

4 years ago(REF) CRM_Core_CodeGen_Schema - Allow generating SQL without making files
Tim Otten [Wed, 22 Jan 2020 22:46:55 +0000 (14:46 -0800)]
(REF) CRM_Core_CodeGen_Schema - Allow generating SQL without making files

Overview
--------

This is a refactoring to allow consumers of `CRM_Core_CodeGen_Schema` to
request the SQL without creating files.

Before
------

Calls to `CRM_Core_CodeGen_Schema::generateDropSql` (ad nauseum) create SQL files.

After
-----

Calls to `CRM_Core_CodeGen_Schema::generateDropSql` (ad nauseum) return SQL strings.

Comments
--------

To ensure that files are still generated consistently, you can use this procedure:

```
git checkout MY_BASE_BRANCH
./bin/setup.sh -g
cp -r sql sql.orig

git checkout MY_MODIFIED_BRANCH

rm sql/civicrm.mysql sql/civicrm_acl*mysql sql/civicrm_data*mysql sql/civicrm_drop.mysql sql/civicrm_navigation.mysql -f
./bin/setup.sh -g

colordiff -ru sql.orig sql
```

4 years agoMake $civicrm_paths less sensitive to trailing slashes. Add tests.
Tim Otten [Wed, 22 Jan 2020 05:14:28 +0000 (21:14 -0800)]
Make $civicrm_paths less sensitive to trailing slashes. Add tests.

Overview
--------

Recall that the default value of `imageUploadURL` is `[civicrm.files]/persist/contribute/`. Now, suppose you have one of these two configurations in `civicrm.settings.php`:

```php
// (1) Trailing slash configuration
$civicrm_paths['civicrm.files']['url'] = 'http://tmpd8-clean.bknix:8001/sites/default/files/civicrm/';
$civicrm_paths['civicrm.files']['path'] = '/Users/totten/bknix/build/tmpd8-clean/web/sites/default/files/civicrm/';

// (2) Trimmed slash configuration
$civicrm_paths['civicrm.files']['url'] = 'http://tmpd8-clean.bknix:8001/sites/default/files/civicrm';
$civicrm_paths['civicrm.files']['path'] = '/Users/totten/bknix/build/tmpd8-clean/web/sites/default/files/civicrm';
```

You could inspect to see if the URL is generated correctly by running these commands:

```
$ cv api setting.get return=imageUploadURL
$ cv url -c imageUploadURL
$ cv url -d "[civicrm.files]/persist/contribute/"
$ cv path -c imageUploadDir
$ cv path -d "[civicrm.files]/persist/contribute/"
```

Before
------

Under either configuration (trailing-slash or trimmed-slash), you'll find that paths are generated properly (`cv path ...` or `Civi::paths()->getPath(...)`).

For generating URLs (`cv url ...` or `Civi::paths()->getUrl(...)`), only the trailing-slash cfg works.  The trimmed-slash cfg leads to a bad URL with a missing slash.

```
[bknix-max:~/bknix/build/tmpd8prj-clean/web] cv api setting.get return=imageUploadURL
{
    "is_error": 0,
    "version": 3,
    "count": 1,
    "id": 1,
    "values": {
        "1": {
            "imageUploadURL": "[civicrm.files]/persist/contribute/"
        }
    }
}

[bknix-max:~/bknix/build/tmpd8prj-clean/web] cv url -c imageUploadURL
"http://tmpd8prj-clean.bknix:8001/sites/default/files/civicrmpersist/contribute"

[bknix-max:~/bknix/build/tmpd8prj-clean/web] cv url -d "[civicrm.files]/persist/contribute/"
"http://tmpd8prj-clean.bknix:8001/sites/default/files/civicrmpersist/contribute/"
```

This is surprising because the path expression (`[civicrm.files]/persist/contribute`) includes a slash...  but it disappears in the final computation.

After
-----

Both configurations work, for paths and for URLs.

4 years agoAdd E2E_Core_PathUrlTest to ensure that various path/URL lookups work
Tim Otten [Sat, 18 Jan 2020 02:10:22 +0000 (18:10 -0800)]
Add E2E_Core_PathUrlTest to ensure that various path/URL lookups work

This will allow E2E matrix to send a signal about whether the default
configurations produce valid URLs.

4 years agoThemesTest - Use more realistic expected-values
Tim Otten [Sat, 18 Jan 2020 06:00:06 +0000 (22:00 -0800)]
ThemesTest - Use more realistic expected-values

1. The expected value of `$civicrmBaseUrl` should not be blank. The old value was a fiction of
   the unit-test environment. Be more realistic.
2. The expected values for extension-generated URLs should abide the same `$civicrmBaseUrl` as others.

4 years agoAllow most values of $civicrm_paths['XXX']['url'] to be relative
Tim Otten [Thu, 16 Jan 2020 08:42:55 +0000 (00:42 -0800)]
Allow most values of $civicrm_paths['XXX']['url'] to be relative

Overview
--------

The `$civicrm_paths` variable allows a sysadmin to override various path and
URL computations.

```php
$civicrm_paths['civicrm.packages']['url'] = 'https://example.com/libraries/civicrm/packages';
```

The variable was originally tested with absolute URLs, and the subsequent
examples/docs use absolute URLs (https://docs.civicrm.org/dev/en/latest/framework/filesystem/).

These values are used to generate addresses, as in:

```php
$abs = Civi::paths()->getUrl('[civicrm.packages]/foo.js', 'absolute');
$rel = Civi::paths()->getUrl('[civicrm.packages]/foo.js', 'relative');
```

The patch allows more values in `$civicrm_paths` while ensuring that
`getUrl()` works as expected.

Before
------

The `getUrl()` requests only behave correctly if the override is an absolute URL - not if it's relative.

After
-----

The `getUrl()` requests behave correctly if the override is either an absolute URL or a relative URL.

```php
$civicrm_paths['civicrm.packages']['url'] = 'https://example.com/libraries/civicrm/packages';
$civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages';
```

Comments
--------

* `toAbsoluteUrl()` needs a base to prepend. I initially used `HTTP_HOST`
  but switched to `cms.root`, but correctly inferring scheme and host and port
  and httpd prefixes would be more complex - esp for background/CLI jobs.
  Using `cms.root` as the base is simpler.
* It's tempting to allow recursive variables. But it's not actually needed for
  my purposes, and it would add complexity/maintenance. If it's really needed,
  one could update `toAbsoluteUrl()` to quickly check for variables
  (`$url[0] === '['`) and then evaluate them. But for now... I think the
  simpler format is fine.

4 years agoMerge pull request #16388 from eileenmcnaughton/event_ref
Eileen McNaughton [Tue, 28 Jan 2020 20:10:06 +0000 (09:10 +1300)]
Merge pull request #16388 from eileenmcnaughton/event_ref

[REF] Extract & share code to determine revenue recognition date.

4 years agofatal error when using pager
demeritcowboy [Tue, 28 Jan 2020 19:14:31 +0000 (14:14 -0500)]
fatal error when using pager

4 years agoApi4 - Improve docblocks and their display in the Explorer
Coleman Watts [Tue, 28 Jan 2020 17:35:14 +0000 (12:35 -0500)]
Api4 - Improve docblocks and their display in the Explorer

4 years agoImprove code docs for Api4 Entity entity
Coleman Watts [Sat, 25 Jan 2020 15:49:28 +0000 (10:49 -0500)]
Improve code docs for Api4 Entity entity

4 years agoAPIv4 - Accept multiple fieldNames in Get helper fn
Coleman Watts [Tue, 28 Jan 2020 00:47:21 +0000 (19:47 -0500)]
APIv4 - Accept multiple fieldNames in Get helper fn

4 years agoMerge pull request #16390 from artfulrobot/tame-propbag-deprecation-logs
Matthew Wire [Tue, 28 Jan 2020 18:17:00 +0000 (18:17 +0000)]
Merge pull request #16390 from artfulrobot/tame-propbag-deprecation-logs

Prevent PropertBag from being so noisy about deprecation warnings

4 years ago[REF] Extract & share code to determine revenue recognition date.
eileen [Sun, 26 Jan 2020 22:05:22 +0000 (11:05 +1300)]
[REF] Extract & share code to determine revenue recognition date.

This also starts the process of consolidating building the 'contribution params' array

4 years agoMerge pull request #16395 from eileenmcnaughton/cont_setting
Seamus Lee [Tue, 28 Jan 2020 06:14:38 +0000 (17:14 +1100)]
Merge pull request #16395 from eileenmcnaughton/cont_setting

Finish removal of deferred_revenue_enabled from non-standard setting

4 years agoMerge pull request #16271 from mattwire/pcp_extractsupportertext
Eileen McNaughton [Tue, 28 Jan 2020 04:37:47 +0000 (17:37 +1300)]
Merge pull request #16271 from mattwire/pcp_extractsupportertext

REF Extract code to build pcp_supporter_text and enable translation

4 years agoMerge pull request #16396 from eileenmcnaughton/cont_setting2
Seamus Lee [Tue, 28 Jan 2020 04:13:22 +0000 (15:13 +1100)]
Merge pull request #16396 from eileenmcnaughton/cont_setting2

[REF] Remove unused variables

4 years agoMerge pull request #16394 from demeritcowboy/extdir-links
Eileen McNaughton [Tue, 28 Jan 2020 03:15:36 +0000 (16:15 +1300)]
Merge pull request #16394 from demeritcowboy/extdir-links

dev/core#1550 Invalid links to extension directory in popup help text

4 years ago[REF] Remove deprecated code from CRM_Admin_Form_Preferences
eileen [Tue, 28 Jan 2020 02:44:06 +0000 (15:44 +1300)]
[REF] Remove deprecated code from CRM_Admin_Form_Preferences

This form was cleaned up back in 2018 but all the stuff to handle ->_varNames was deprecated rather than
removed in case extensions were leveraging it in some way. I'm removing it now although I commented rather
than removed a few lines that I suspect can also go

4 years ago[REF] Remove unused variables
eileen [Tue, 28 Jan 2020 01:03:47 +0000 (14:03 +1300)]
[REF] Remove unused variables