civicrm-core.git
5 years agoMerge pull request #13533 from eileenmcnaughton/prev_next
Eileen McNaughton [Tue, 5 Feb 2019 04:18:40 +0000 (17:18 +1300)]
Merge pull request #13533 from eileenmcnaughton/prev_next

Prev next

5 years agoDisable full group by mode whe groupContacts is TRUE
eileen [Tue, 5 Feb 2019 01:58:53 +0000 (14:58 +1300)]
Disable full group by mode whe groupContacts is TRUE

This prevents an error when using the cache and allows us to move
past this without untangling the messy way other tables are joined back in
for now.

Note it became necessary due to query changes off the cache but the query is no
different in accuracy

5 years agodev/core#695 - Make custom searches slightly less fragile
Aidan Saunders [Mon, 4 Feb 2019 17:50:30 +0000 (17:50 +0000)]
dev/core#695 - Make custom searches slightly less fragile

5 years agodev/core#679 fix loss of search results when including tags or groups.
eileen [Mon, 4 Feb 2019 23:59:51 +0000 (12:59 +1300)]
dev/core#679 fix loss of search results when including tags or groups.

The bug as described was a bit tricksy to replicate as it is inconsistent and the
code is not actually outputting the tags/ groups. I think these are pre-existing issues

I was able to replicate by having 2 search profiles - one with only tags & one one with only groups & switching back & and force on output -  once I replicated I found that there was a regression due to

https://github.com/eileenmcnaughton/civicrm-core/commit/2ca46d4d5a8cd15929ac0939ca2bb380a3de027e#diff-e54381bfdf51e31cab376c71ca0d66ffR4967

whereby the groupBy had been dropped, causing the results to be squashed into a single row

5 years agoMerge pull request #12834 from pradpnayak/preRelHook
Eileen McNaughton [Mon, 4 Feb 2019 23:55:21 +0000 (12:55 +1300)]
Merge pull request #12834 from pradpnayak/preRelHook

Respect pre hook for relationship to alter id in $params

5 years agoMerge pull request #13526 from yashodha/number_widget
Eileen McNaughton [Mon, 4 Feb 2019 23:53:11 +0000 (12:53 +1300)]
Merge pull request #13526 from yashodha/number_widget

use number widget for weight and other numeric fields in more forms

5 years agoMerge pull request #13530 from pradpnayak/FieldLength-Activity
Eileen McNaughton [Mon, 4 Feb 2019 23:52:29 +0000 (12:52 +1300)]
Merge pull request #13530 from pradpnayak/FieldLength-Activity

Used field name defined in DAO file for Activity Subject

5 years agoMerge pull request #13532 from pradpnayak/xmlChanges
Eileen McNaughton [Mon, 4 Feb 2019 23:52:07 +0000 (12:52 +1300)]
Merge pull request #13532 from pradpnayak/xmlChanges

Add html type for civicrm_note.privacy field

5 years agoMerge pull request #13489 from totten/master-ro-cache
Eileen McNaughton [Mon, 4 Feb 2019 23:51:31 +0000 (12:51 +1300)]
Merge pull request #13489 from totten/master-ro-cache

(dev/core#635) Deprecate CRM_Core_BAO_Cache for I/O. Optionally redirect I/O to Redis or Memcache.

5 years agoMerge pull request #13522 from eileenmcnaughton/activity
colemanw [Mon, 4 Feb 2019 22:03:13 +0000 (17:03 -0500)]
Merge pull request #13522 from eileenmcnaughton/activity

Performance fix for alternate getActivity listing function

5 years agoRemove redundant css class from activity subject field
colemanw [Mon, 4 Feb 2019 21:38:42 +0000 (16:38 -0500)]
Remove redundant css class from activity subject field

This is now being automatically assigned thanks to the change in 6e9c7c7

5 years agoMerge pull request #13527 from JMAConsulting/core-693
colemanw [Mon, 4 Feb 2019 21:33:45 +0000 (16:33 -0500)]
Merge pull request #13527 from JMAConsulting/core-693

dev/core#693 : On contact summary page, on submitting a 'New Case' form doesn't redirect to 'Manage Case' screen

5 years agoCRM_Core_BAO_Cache - When delegating to an adapter, don't expect it to return a reference
Tim Otten [Mon, 4 Feb 2019 21:27:09 +0000 (16:27 -0500)]
CRM_Core_BAO_Cache - When delegating to an adapter, don't expect it to return a reference

This is following up on the code-review comments from
https://github.com/civicrm/civicrm-core/pull/13489#discussion_r252070543

5 years agouse name and label to retrive ID
Pradeep Nayak [Mon, 4 Feb 2019 21:04:56 +0000 (21:04 +0000)]
use name and label to retrive ID

5 years agoMerge pull request #13525 from civicrm/5.10
Eileen McNaughton [Mon, 4 Feb 2019 20:19:44 +0000 (09:19 +1300)]
Merge pull request #13525 from civicrm/5.10

5.10

5 years agoAdd html type for civicrm_note.privacy field
Pradeep Nayak [Mon, 4 Feb 2019 19:33:39 +0000 (19:33 +0000)]
Add html type for civicrm_note.privacy field

5 years agoDonot show group until refresh result
Pradeep Nayak [Mon, 4 Feb 2019 18:43:24 +0000 (18:43 +0000)]
Donot show group until refresh result

5 years agoAdded api test to support fix
Pradeep Nayak [Fri, 4 Jan 2019 12:56:59 +0000 (12:56 +0000)]
Added api test to support fix

5 years agoUsed buildoptions function to get all groups
Pradeep Nayak [Wed, 19 Dec 2018 23:55:30 +0000 (23:55 +0000)]
Used buildoptions function to get all groups

5 years agoUsed field name defined in DAO file for Activity Subject
Pradeep Nayak [Mon, 4 Feb 2019 16:33:21 +0000 (16:33 +0000)]
Used field name defined in DAO file for Activity Subject

5 years agodev/core#690 - Civi\API - Fix entity permission check for trusted calls
Patrick Figel [Mon, 4 Feb 2019 15:00:03 +0000 (16:00 +0100)]
dev/core#690 - Civi\API - Fix entity permission check for trusted calls

This changes the permission check in DynamicFKAuthorization to
short-circuit on trusted API calls (check_permissions = 0) so that
no exception is thrown when it's used with entities that are not
allowed delegates.

5 years agodev/core#693 : On contact summary page, on submitting a 'New Case' form doesn't redir...
Monish Deb [Mon, 4 Feb 2019 08:42:46 +0000 (14:12 +0530)]
dev/core#693 : On contact summary page, on submitting a 'New Case' form doesn't redirect to 'Manage Case' screen

5 years agouse number widget for weight fields in more forms
yashodha [Mon, 4 Feb 2019 08:23:59 +0000 (13:53 +0530)]
use number widget for weight fields in more forms

5 years agoMerge pull request #13524 from eileenmcnaughton/search_rc
Seamus Lee [Mon, 4 Feb 2019 07:37:07 +0000 (23:37 -0800)]
Merge pull request #13524 from eileenmcnaughton/search_rc

Revert fix causing unreleased regression

5 years agoRevert "Assign the translated formValues to itself"
eileen [Mon, 4 Feb 2019 05:03:49 +0000 (18:03 +1300)]
Revert "Assign the translated formValues to itself"

This reverts commit e8ef090642f0ff5639166b847a31f4e50eec3dd6.

5 years agoRevert "Rewrite testHiddenSmartGroup"
eileen [Mon, 4 Feb 2019 04:39:41 +0000 (17:39 +1300)]
Revert "Rewrite testHiddenSmartGroup"

This reverts commit 7810fa53a7f5d8be82ebda7fde122d0fd349d358.

5 years agoPerformance fix for alternate getActivity listing function
eileen [Mon, 4 Feb 2019 00:10:44 +0000 (13:10 +1300)]
Performance fix for alternate getActivity listing function

We have an alternate function to render the activiy listing on the contact tab. It is
getActivities whereas the other is deprecatedGetActivities.

It was developed in order to replace the other and we have tests that compare the results of the 2. It is better in that it
1) performs better (on a  WMF contact with many activities this is 'snappy' while the current deprecated one gives a  white screen time out) and
2) calls the selectWhereClause hook, allowing hook alteration and respecting preferred architecture.

However, we didn't go live with it in core because it
1) has a remnant performance bugs (this PR fixes the last of these)
2) implements ACLs differently - it uses generic functions whereas the deprecated one
applies more limited permissioning. This is something to clarify & resolve separately.

This PR fixes the last remaining performance issue - best described as
'When one of the activities to be displayed has many targets the activity listing is slow to load'

The reason for the slowness is that when 'target_contact_name' is passed to the api
the api does a call for each contact to fetch the contact's sort_name. For a bulk mailing that went to 50,000 people that equates to 50,000 extra queries.

However the actual display shows the first contact name and then gives a number for how many more should be retrieved. This PR hence does not ask the api for the display name, but rather does the check itself, but
only for 1 target contact rather than ALL

Note that a similar logic might be considered for assignee - I left that out of scope as I'm not
aware of situations where a large number of assignees would be assigned to a single activity.

The unit test ensures the output matches the deprecated function.

5 years agoMerge pull request #13401 from PeaceWorksTechnologySolutions/master
Eileen McNaughton [Fri, 1 Feb 2019 20:10:31 +0000 (09:10 +1300)]
Merge pull request #13401 from PeaceWorksTechnologySolutions/master

dev/mail#32 - Further checks - making mailing test email non-case-sensitive

5 years agoOptimize CRM_Core_BAO_FinancialTrxn::getTotalPayment
Monish Deb [Fri, 30 Nov 2018 09:39:40 +0000 (15:09 +0530)]
Optimize CRM_Core_BAO_FinancialTrxn::getTotalPayment

5 years agoMerge pull request #1 from civicrm/master
Martin [Fri, 4 Jan 2019 15:49:08 +0000 (10:49 -0500)]
Merge pull request #1 from civicrm/master

Update master from upstream

5 years agoMerge pull request #13520 from yashodha/number_widget
colemanw [Fri, 1 Feb 2019 12:37:18 +0000 (07:37 -0500)]
Merge pull request #13520 from yashodha/number_widget

use number widget for weight fields in all forms

5 years agouse number wiget for weight fields in all forms
yashodha [Fri, 1 Feb 2019 10:01:28 +0000 (15:31 +0530)]
use number wiget for weight fields in all forms

5 years agoMerge pull request #13518 from colemanw/l10n.js
Eileen McNaughton [Fri, 1 Feb 2019 00:59:49 +0000 (13:59 +1300)]
Merge pull request #13518 from colemanw/l10n.js

l10n.js - Reload when logging in as new user

5 years agoMerge pull request #13498 from francescbassas/patch-18
Seamus Lee [Thu, 31 Jan 2019 22:36:26 +0000 (14:36 -0800)]
Merge pull request #13498 from francescbassas/patch-18

dev/core#682 Add basic contact filters to Summary Contributions Report

5 years agol10n.js - Reload when logging in as new user
Coleman Watts [Thu, 31 Jan 2019 19:30:43 +0000 (14:30 -0500)]
l10n.js - Reload when logging in as new user

5 years agoMerge pull request #13507 from twomice/lab686_membership_stats_columns
colemanw [Thu, 31 Jan 2019 19:05:19 +0000 (14:05 -0500)]
Merge pull request #13507 from twomice/lab686_membership_stats_columns

Fix for dev/core#686: Make "amount statistics" columns optional

5 years agoMerge pull request #13502 from colemanw/shortcode
colemanw [Thu, 31 Jan 2019 18:39:20 +0000 (13:39 -0500)]
Merge pull request #13502 from colemanw/shortcode

Fix shortcode button when popup setting is disabled

5 years agoFixing column/headers line up when searching for soft credits
Alice Frumin [Thu, 31 Jan 2019 17:02:06 +0000 (12:02 -0500)]
Fixing column/headers line up when searching for soft credits

5 years agoMerge pull request #13488 from colemanw/helpOverride
colemanw [Thu, 31 Jan 2019 15:03:49 +0000 (10:03 -0500)]
Merge pull request #13488 from colemanw/helpOverride

Allow help text to be overridden from an .extra.hlp file

5 years agoMerge pull request #13506 from colemanw/profileCreate
Eileen McNaughton [Thu, 31 Jan 2019 01:23:58 +0000 (14:23 +1300)]
Merge pull request #13506 from colemanw/profileCreate

Fix permission checks on contact create popups

5 years agoMerge pull request #13512 from eileenmcnaughton/cont_annual_speed
Joe Murray [Wed, 30 Jan 2019 21:37:25 +0000 (16:37 -0500)]
Merge pull request #13512 from eileenmcnaughton/cont_annual_speed

Speed up loading of contribution tab on contacts with large number of contributions in a large database

5 years agoMerge pull request #13513 from colemanw/Fix
Eileen McNaughton [Wed, 30 Jan 2019 20:25:56 +0000 (09:25 +1300)]
Merge pull request #13513 from colemanw/Fix

Fix undefined throwing error in CRM.checkPerm

5 years agoMerge pull request #13514 from totten/master-nack-rev
Eileen McNaughton [Wed, 30 Jan 2019 20:24:56 +0000 (09:24 +1300)]
Merge pull request #13514 from totten/master-nack-rev

(dev/core#635) CRM_Utils_Cache::nack() - Fix format

5 years agoMerge pull request #13298 from colemanw/extCompat
Tim Otten [Wed, 30 Jan 2019 07:42:06 +0000 (23:42 -0800)]
Merge pull request #13298 from colemanw/extCompat

Add extension compatibility list

5 years ago(dev/core#635) CRM_Utils_Cache::nack() - Fix format
Tim Otten [Wed, 30 Jan 2019 05:08:23 +0000 (21:08 -0800)]
(dev/core#635) CRM_Utils_Cache::nack() - Fix format

This is a follow-up to #13500.

Before
------

* `CRM_Utils_Cache::nack()` returns an array with a value named `nack`.
* The value returned is somewhat unique -- a random value is generated once per page-view.
* There is no explicit/direct unit-test.

After
-----

* `CRM_Utils_Cache::nack()` returns a string.
* The value returned is more unique -- combining that random value (per page-view) and an offset (per invocation).
* There is an explicit/direct unit-test.

Comments
--------

* The code was originally written with the intent of returning a string.
  However, there was a slight copy-paste error which caused it to return an
  array (which contained that string).  Functionally, that worked (because
  it was serializable and met the same minimum uniqueness constraint),
  but it's weird to read/inspect, and we should change quickly before
  something else locks-in the odd structure.

* The more unique the nack-value is, the more correct the nack-checking
  pattern is.  Appending a static-counter is a simple, fast way to provide
  stronger uniqueness within a page-view.

* There may be some obscure edge-cases in which the previous pattern was not
  sufficiently unique -- e.g.  combining tiers-of-tiers or
  decorators-of-decorators.  I haven't verified that, but it seems
  unimportant given that the static-counter is so straightforward.

* In `NaiveHasTrait`, the extra `ht` suffix was an attempt to increase the
  uniquness.  However, the static-counter seems better.

5 years agoCRM_Core_BAO_Cache - Make some IDE's happier about inline assignment
Tim Otten [Wed, 30 Jan 2019 03:36:08 +0000 (19:36 -0800)]
CRM_Core_BAO_Cache - Make some IDE's happier about inline assignment

5 years agoCRM_Core_BAO_Cache - Deprecate getItems(), getItem(), setItem(), deleteGroup()
Tim Otten [Thu, 24 Jan 2019 00:11:42 +0000 (16:11 -0800)]
CRM_Core_BAO_Cache - Deprecate getItems(), getItem(), setItem(), deleteGroup()

These interfaces predate PSR-16 -- which is more flexible and complete.
PSR-16 supports TTLs, default-values, multi-key operations, etc.  PSR-16
drivers can be extended/decorated/replaced.  There are third-party
implementations of PSR-16.  And (personally) I find the code which consumes
PSR-16 to be more readable+writeable (e.g. `$cache->get($key)` vs
`CRM_Core_BAO_Cache::getItem($group, $item)`).

However, `CRM_Core_BAO_Cache` has been around forever.  I currently count
ten distinct cache-groups which rely on it (5 from `civicrm-core` and 5 from
`universe`). So we shouldn't remove it outright.

5 years agoAllow rerouting CRM_Core_BAO_Cache::{set,get}Item(s) to PSR-16 drivers
Tim Otten [Mon, 21 Jan 2019 11:06:50 +0000 (03:06 -0800)]
Allow rerouting CRM_Core_BAO_Cache::{set,get}Item(s) to PSR-16 drivers

Before
----------------------------------------

* Requests for `CRM_Core_BAO_Cache` (`setItem($data,$group,$path)`,
  `getItem($group,$path)`, `getItems($group)`, `deleteGroup($group,$path)`)
  are *always* served by two tiers: (1) an in-memory array (`static::$cache`) and (2)
  an SQL table.

After
----------------------------------------

* There is a config option `define('CIVICRM_BAO_CACHE_ADAPTER',
  'CRM_Core_BAO_Cache_Psr16');`.
    * When disabled (default), `CRM_Core_BAO_Cache` continues using the old code.
    * When enabled, `CRM_Core_BAO_Cache` changes behavior. Each `$group` is mapped to
      a PSR-16 object.

* The class/implementation for each `$group` depends on the configuration:
    * In a typical (non-Redis/non-Memcache) deployment, the implementation
      is `CRM_Utils_Cache_SqlGroup`, which has the same 2-tier structure
      (in-memory+SQL).
    * In Redis/Memcache deployment, the implementation combines
      `FastArrayDecorator` with `CRM_Utils_Cache_Redis` or
      `CRM_Utils_Cache_Memcache`.  This gives a similar 2-tier structure
      (e.g. in-memory+Redis).

5 years agoFix undefined throwing error in CRM.checkPerm
Coleman Watts [Wed, 30 Jan 2019 02:36:00 +0000 (21:36 -0500)]
Fix undefined throwing error in CRM.checkPerm

5 years agoFix permission checks on contact create popups
Coleman Watts [Fri, 25 Jan 2019 21:28:35 +0000 (16:28 -0500)]
Fix permission checks on contact create popups

5 years agoMerge pull request #13496 from totten/master-cache-tier
Eileen McNaughton [Wed, 30 Jan 2019 02:20:55 +0000 (15:20 +1300)]
Merge pull request #13496 from totten/master-cache-tier

(dev/core#635) Implement local array-cache for use with Redis/Memcache

5 years agoCRM_Utils_Cache::create() - Accept new option `withArray`
Tim Otten [Mon, 21 Jan 2019 10:26:23 +0000 (02:26 -0800)]
CRM_Utils_Cache::create() - Accept new option `withArray`

This adds and documents a new config option which can be passed into the cache factory.

The option, `withArray`, indicates that we prefer to have a thread-local
array acting as an extra cache-tier.

5 years agoImplement CRM_Utils_Cache_FastArrayDecorator
Tim Otten [Mon, 21 Jan 2019 11:06:10 +0000 (03:06 -0800)]
Implement CRM_Utils_Cache_FastArrayDecorator

5 years agoImplement CRM_Utils_Cache_ArrayDecorator
Tim Otten [Mon, 21 Jan 2019 10:06:21 +0000 (02:06 -0800)]
Implement CRM_Utils_Cache_ArrayDecorator

This allows you to put a static array in front of another cache.  It is the
same basic idea as CRM_Utils_Cache_Tiered, but it's optimized for a typical case
where you only want one front-cache.

Based on some naive benchmarking (performing several trials with a few
thousand duplicate reads over the same cached data), this basically cut the
read-time in half.  The following is pretty representative of the results:

```
Redis-only cache               write=0.1044s   read=1.3266s
2-Tier (ArrayCache+Redis)      write=0.1189s   read=0.3765s
Decorated-Redis cache          write=0.1105s   read=0.1505s
```

See also: https://gist.github.com/totten/6d6524be115c193e0704ff3cf250336d

Note: To ensure that TTL data is respected consistently regardless of how
the tiers behave and the order in which they are used, the TTL/expiration
must be stored extra times.

5 years agoImplement CRM_Utils_Cache_Tiered
Tim Otten [Mon, 21 Jan 2019 09:59:48 +0000 (01:59 -0800)]
Implement CRM_Utils_Cache_Tiered

Before
------
* No way to daisy-chain caches to form a cache hierarchy
* ArrayCache::reobjectify() would fail to reobjectify objects in an array, which seems against the spirit of PSR-16

After
-----
* You can create a cache hierarchy with `new CRM_Utils_Cache_Tiered([$fastCache, $mediumCache, $slowCache])`
* ArrayCache::reobjectify() will reobjectify if it detects an object directly in an array

Note: To ensure that TTL data is respected consistently regardless of how
the tiers behave and the order in which they are used, the TTL/expiration
must be stored extra times.

5 years agoArrayCache::getExpires() - Add helper for unit testing
Tim Otten [Wed, 23 Jan 2019 03:20:26 +0000 (19:20 -0800)]
ArrayCache::getExpires() - Add helper for unit testing

5 years agoMerge pull request #13500 from totten/master-nack
Eileen McNaughton [Wed, 30 Jan 2019 00:42:46 +0000 (13:42 +1300)]
Merge pull request #13500 from totten/master-nack

(REF) Add CRM_Utils_Cache::nack(). Use it for NaiveHasTrait.

5 years agoMerge pull request #13511 from greenpeace-cee/optimize-creditnote
Eileen McNaughton [Tue, 29 Jan 2019 23:32:43 +0000 (12:32 +1300)]
Merge pull request #13511 from greenpeace-cee/optimize-creditnote

CRM/Contribute - Add query optimization for creditnote_id

5 years agoAlter the query used to render the yearly totals on the contact contribution tab...
eileen [Tue, 29 Jan 2019 23:14:22 +0000 (12:14 +1300)]
Alter the query used to render the yearly totals on the contact contribution tab to make a better index choice.

This PR restructures the  annual query to use HAVING clause for contribution_status_id in order to
avoid the (edge case) situation where it uses a combined index resulting in a slow query. When a contribution is entered
the screen loaded on-close is the contribution tab so when this is slow the data entry process is much slowed.

Mmsql index merge optimisation is a default enabled setting which can choose to use 'merged indexes' rather than
just one. In this query the best index is contact_id because even when a contact has a relatively large number of
contributions they are still trivial compared to the overall DB. By contrast contribution_status_id is not a good
choice as it has fairly low variability and when used in combination with contact_id adds very little as trade off for the time
it takes to construct a merge index

What we are seeing is that the index choice on this query is
index_contribution_status,received_date,FK_civicrm_contribution_contact_id,contact_id_contribution_status | FK_civicrm_contribution_contact_id,index_contribution_status

which results in a query that takes around 6 seconds on a contact with 18k contributions in a DB of around 30 million contributions.

If we restructure the query so that it looks like

```
     SELECT COUNT(*) as count,
             SUM(total_amount) as amount,
             AVG(total_amount) as average,
             currency
      FROM civicrm_contribution  b

      WHERE b.contact_id IN (72) AND b.receive_date >= 20180701 AND b.receive_date <  20190701
      GROUP BY currency, contribution_status_id
      HAVING contribution_status_id = 1;
```

the selected index is  FK_civicrm_contribution_contact_id and the query takes .05 seconds.

This restructure achieves much the same as using an index hint but as there is some index naming inconsistency
'in the wild' changing the query structure like this makes more sense.

 Note that I ALSO tested this
1) on the same database on a contact with a negligible number of contributions
2) on a much smaller database (~400k contributions) on a contact with 122 contributions.

In both cases it made no difference to which key was chosen as the merge index appears to only be chosen by mysql
when more than a certain number of on contributions adhere to a single contact.

In the latter case the query time for both versions was recorded as 0.00 so I couldn't see any difference.

In the former case the query change sped up the query from 0.02 to 0.00 so there is some additional efficiency
in the new query beyond the index choice

Links on index merge optimisation
https://www.percona.com/blog/2012/12/14/the-optimization-that-often-isnt-index-merge-intersection/
http://gobitcan.com/blog/2014-12-03-what-to-do-when-mysql-ignores-your-index
http://mysqlopt.blogspot.com/2013/05/mysql-slow-query-example-of-index-merge.html
https://www.percona.com/blog/2012/12/14/the-optimization-that-often-isnt-index-merge-intersection/
https://stackoverflow.com/questions/16283472/why-is-mysql-showing-index-merge-on-this-query
https://mariadb.com/kb/en/library/fair-choice-between-range-and-index_merge-optimizations/
https://dba.stackexchange.com/questions/178286/mysql-on-rds-avoiding-index-merge
https://mariadb.com/kb/en/library/index_merge-sort_intersection/
https://stackoverflow.com/questions/47943755/mysql-optimizing-subquery-with-index-merge
https://dev.mysql.com/doc/refman/8.0/en/index-merge-optimization.html

5 years agoCRM/Contribute - Add query optimization for creditnote_id
Patrick Figel [Tue, 29 Jan 2019 21:10:12 +0000 (22:10 +0100)]
CRM/Contribute - Add query optimization for creditnote_id

This adds a minor query optimization to createCreditNoteId() that
should significantly improve performance when contributions are
cancelled or refunded in environments with many contributions.

5 years agoFix bug in Annual summary query (on contact dashboard) whereby a left join gives...
eileen [Wed, 16 Jan 2019 00:50:14 +0000 (13:50 +1300)]
Fix bug in Annual summary query (on contact dashboard) whereby a left join gives the wrong results

    As demonstrated in the test the left join does not do any filtering but it DOES join in as many line items as match the
    permitted types - resulting in too many rows & the sum calculated on them being incorrect.

    As this doesn't work it should be removed - I would aniticpate that sites with the financialreportacls extensions
    would get this adequately added through CRM_Financial_BAO_FinancialType::addACLClausesToWhereClauses
    but regardless this should go as it causes a bug without achieving it's intended result and adding a test prevents
    a later fix from re-breaking

5 years agoMerge pull request #13509 from ixiam/dev-duplicateCreateCreditNote
Monish Deb [Tue, 29 Jan 2019 19:01:26 +0000 (00:31 +0530)]
Merge pull request #13509 from ixiam/dev-duplicateCreateCreditNote

remove duplicated call to createCreditNoteId()

5 years agoremove duplicate call to createCreditNoteId()
Luciano Spiegel [Tue, 29 Jan 2019 17:10:18 +0000 (18:10 +0100)]
remove duplicate call to createCreditNoteId()

5 years agoMerge pull request #13319 from eileenmcnaughton/cont_queries
Eileen McNaughton [Mon, 28 Jan 2019 23:36:57 +0000 (12:36 +1300)]
Merge pull request #13319 from eileenmcnaughton/cont_queries

Add selectWhere hook call to the query that generates the 'annual' query - the 'amount this year' on a contact dash

5 years agoAdd ACL hook call and test to financial ACLs
eileen [Wed, 19 Dec 2018 05:29:23 +0000 (18:29 +1300)]
Add ACL hook call and test to financial ACLs

If the hook call changes the where cause we will not implement the
core pseudo-hook-code for financial type acls.

This allows us to not conflict with reportfinancialacls extension
Eventually we will not have any of this in core other than the hook.

5 years agoMerge pull request #13501 from civicrm/5.10
Eileen McNaughton [Sun, 27 Jan 2019 21:57:35 +0000 (10:57 +1300)]
Merge pull request #13501 from civicrm/5.10

5.10

5 years agoMerge pull request #13505 from mattwire/caseview_fatalerror
Eileen McNaughton [Sun, 27 Jan 2019 21:57:07 +0000 (10:57 +1300)]
Merge pull request #13505 from mattwire/caseview_fatalerror

Display error instead of fatal error when trying to view a case that you don't have permission to access

5 years agoFix for dev/core#686: Make "amount statistics" columns optional
Allen Shaw [Fri, 25 Jan 2019 23:03:00 +0000 (17:03 -0600)]
Fix for dev/core#686: Make "amount statistics" columns optional

5 years agoMerge pull request #13460 from mattwire/case_getlabel_pseudoconstant
colemanw [Fri, 25 Jan 2019 22:28:02 +0000 (17:28 -0500)]
Merge pull request #13460 from mattwire/case_getlabel_pseudoconstant

Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for cases

5 years agoConvert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for case
Matthew Wire (MJW Consulting) [Tue, 15 Jan 2019 11:18:30 +0000 (11:18 +0000)]
Convert deprecated OptionGroup::getLabel to PseudoConstant::getLabel for case

5 years agoMerge pull request #13485 from colemanw/grantTaskDate
colemanw [Fri, 25 Jan 2019 14:58:36 +0000 (09:58 -0500)]
Merge pull request #13485 from colemanw/grantTaskDate

dev/core#561 - Convert grant task form to datepicker

5 years agoMerge pull request #13497 from jitendrapurohit/core-681
colemanw [Fri, 25 Jan 2019 14:54:54 +0000 (09:54 -0500)]
Merge pull request #13497 from jitendrapurohit/core-681

dev/core#681 - Fatal Error on submitting "Change Case Status" activit…

5 years agoMerge pull request #13491 from colemanw/campaign
colemanw [Fri, 25 Jan 2019 14:40:25 +0000 (09:40 -0500)]
Merge pull request #13491 from colemanw/campaign

Convert Campaign widgets to entityRef

5 years agoMerge pull request #13493 from colemanw/entityRefFilters
colemanw [Fri, 25 Jan 2019 14:26:07 +0000 (09:26 -0500)]
Merge pull request #13493 from colemanw/entityRefFilters

dev/core#677 EntityRef filters fixes

5 years agoShow error popup and return to dashboard instead of showing fatal error page when...
Matthew Wire (MJW Consulting) [Fri, 25 Jan 2019 11:58:35 +0000 (11:58 +0000)]
Show error popup and return to dashboard instead of showing fatal error page when trying to access case that you do not have permission for

5 years agodev/core#682 Add basic contact filters to Summary Contributions Report
Francesc Bassas i Bullich [Fri, 25 Jan 2019 09:39:25 +0000 (10:39 +0100)]
dev/core#682 Add basic contact filters to Summary Contributions Report

5 years agoMerge pull request #13503 from colemanw/numberWidget
Joe Murray [Thu, 24 Jan 2019 19:28:04 +0000 (14:28 -0500)]
Merge pull request #13503 from colemanw/numberWidget

Survey form - use number widget for number fields

5 years agodev/core#561 - Convert grant task form to datepicker
Coleman Watts [Thu, 17 Jan 2019 19:10:00 +0000 (14:10 -0500)]
dev/core#561 - Convert grant task form to datepicker

5 years agoSurvey form - use number widget for number fields
Coleman Watts [Tue, 22 Jan 2019 14:46:41 +0000 (09:46 -0500)]
Survey form - use number widget for number fields

5 years agoMerge pull request #13421 from chamilwijesooriya/issue-650
colemanw [Thu, 24 Jan 2019 17:34:45 +0000 (12:34 -0500)]
Merge pull request #13421 from chamilwijesooriya/issue-650

dev/core#650 Use popups for links

5 years agoMerge pull request #13490 from colemanw/Fix
Joe Murray [Thu, 24 Jan 2019 17:03:30 +0000 (12:03 -0500)]
Merge pull request #13490 from colemanw/Fix

Fix broken date fields in survey response form

5 years agoFix shortcode button when popup setting is disabled
Coleman Watts [Thu, 24 Jan 2019 15:21:43 +0000 (10:21 -0500)]
Fix shortcode button when popup setting is disabled

5 years agoDon't pass $ids by reference in add function
colemanw [Thu, 24 Jan 2019 00:55:19 +0000 (19:55 -0500)]
Don't pass $ids by reference in add function

5 years agoMerge pull request #12647 from compucorp/fix-case-type-issues
colemanw [Thu, 24 Jan 2019 00:14:14 +0000 (19:14 -0500)]
Merge pull request #12647 from compucorp/fix-case-type-issues

Case type management fixes

5 years agoMerge pull request #13478 from pradpnayak/eventRegression
colemanw [Wed, 23 Jan 2019 22:02:25 +0000 (17:02 -0500)]
Merge pull request #13478 from pradpnayak/eventRegression

dev/core/issues/653, fixed regression on creating new event using event template

5 years agoNaiveHasTrait - Reduce roundtrips in `has()`
Tim Otten [Wed, 23 Jan 2019 20:52:58 +0000 (12:52 -0800)]
NaiveHasTrait - Reduce roundtrips in `has()`

The `NaiveHasTrait` is a generic implementation of PSR-16 `has()` which
builds on the logic of PSR-16 `get()`.  This reduces I/O for `has()`.

Before
------
* Each call to `has()` triggers two calls to `get()`.

After
-----
* Each call to `has()` triggers one call to `get()`.

Comments
--------

The correctness of this stems from the uniqueness of the `$nack` value.  To
wit: if you always use the same constant (e.g.  `NULL` or `0` or `''` or
`'no-value'`) to signify a cache-miss, then it's trivial to produce a
collision/incorrect-result.  (Simply store that constant.) But if the value
is a sufficiently unique nonce, then it becomes impractical to produce a
collision/incorrect-result.

5 years agoCRM_Utils_Cache::nack() - Add helper for combining get()+has() calls in PSR-16
Tim Otten [Wed, 23 Jan 2019 20:49:21 +0000 (12:49 -0800)]
CRM_Utils_Cache::nack() - Add helper for combining get()+has() calls in PSR-16

5 years agoMerge pull request #13480 from pradpnayak/AdvanceSearch
Monish Deb [Wed, 23 Jan 2019 10:26:21 +0000 (15:56 +0530)]
Merge pull request #13480 from pradpnayak/AdvanceSearch

dev/core/issues/506, Fatal error on advance search when using cases from display results as

5 years agodev/core#681 - Fatal Error on submitting "Change Case Status" activity form
Jitendra Purohit [Wed, 23 Jan 2019 09:54:23 +0000 (15:24 +0530)]
dev/core#681 - Fatal Error on submitting "Change Case Status" activity form

5 years agodev/core/issues/653, fixed regression on creating new event using event template
Pradeep Nayak [Wed, 16 Jan 2019 23:16:48 +0000 (23:16 +0000)]
dev/core/issues/653, fixed regression on creating new event using event template

Use core function to over-ride values

5 years agoMerge pull request #13495 from seamuslee001/lab_core_676
Tim Otten [Wed, 23 Jan 2019 00:46:02 +0000 (16:46 -0800)]
Merge pull request #13495 from seamuslee001/lab_core_676

dev/core#676 Disable GeoCoding Tests for PR jobs and re-enable Mailin…

5 years agodev/core#676 Disable GeoCoding Tests for PR jobs and re-enable Mailing Test jobs...
Seamus Lee [Tue, 22 Jan 2019 19:25:53 +0000 (06:25 +1100)]
dev/core#676 Disable GeoCoding Tests for PR jobs and re-enable Mailing Test jobs for PRs previously disabled now fixed

5 years agoMerge pull request #13492 from pradpnayak/typoErrors
Seamus Lee [Tue, 22 Jan 2019 19:16:27 +0000 (11:16 -0800)]
Merge pull request #13492 from pradpnayak/typoErrors

Removed '>' from comment

5 years agoMerge pull request #13461 from christianwach/lab-666
colemanw [Tue, 22 Jan 2019 18:33:24 +0000 (13:33 -0500)]
Merge pull request #13461 from christianwach/lab-666

Fix trailing ampersands when empty array passed as query param

5 years agoHide gender & deceased filters for non-individual entityRef
Coleman Watts [Tue, 22 Jan 2019 17:35:13 +0000 (12:35 -0500)]
Hide gender & deceased filters for non-individual entityRef

5 years agoFix entityRef contact type filter
Coleman Watts [Tue, 22 Jan 2019 17:02:25 +0000 (12:02 -0500)]
Fix entityRef contact type filter

5 years agoRemoved '>' from comment
Pradeep Nayak [Tue, 22 Jan 2019 17:08:48 +0000 (17:08 +0000)]
Removed '>' from comment

5 years agoConvert addCampaignToComponent widget to entityRef
Coleman Watts [Tue, 22 Jan 2019 14:39:43 +0000 (09:39 -0500)]
Convert addCampaignToComponent widget to entityRef

5 years agoCampaign entityRef improvements
Coleman Watts [Tue, 22 Jan 2019 14:39:39 +0000 (09:39 -0500)]
Campaign entityRef improvements

5 years agoUse entityRef for campaigns on Survey & Petition forms
Coleman Watts [Tue, 22 Jan 2019 01:13:09 +0000 (20:13 -0500)]
Use entityRef for campaigns on Survey & Petition forms