Commit Graph

317 Commits

Author SHA1 Message Date
Pavel Dohnal
c5d994dbf0 Make the segment work with ALL condition
[MAILPOET-3955]
2021-12-16 14:46:16 +01:00
Pavel Dohnal
d541edc865 Make the segment work with NONE condition
[MAILPOET-3955]
2021-12-16 14:46:16 +01:00
Pavel Dohnal
6d5d5ccfda Make the segment work with ANY condition
[MAILPOET-3955]
2021-12-16 14:46:16 +01:00
Pavel Dohnal
c2e841fd3d Make role always array
[MAILPOET-3955]
2021-12-16 14:46:16 +01:00
Rodrigo Primo
d39d09dd72 Remove calls to Subscriber::setError() from ConfirmationEmailMailer
This commit is part of a task to replace Paris with Doctrine in the
class ConfirmationEmailMailer. Specifically, it removes two calls to
Subscriber::setError() inside ConfirmationEmailMailer::sendConfirmationEmail().

setError() was used to define an error message that was used only in one
of the instances where sendConfirmationEmail() is called
(API::subscribeToLists()). setError() was replaced with code that throws
an exception when there is an error. Thus it was necessary to change all
the places where ConfirmationEmailMailer::sendConfirmationEmail() is
called to handle the exception.

In some cases, there are some oddities as sendConfirmationEmail() can
return false or throw an exception in case of an error and calling code
must account for both. I decided to settle with this approach as
refactoring the rest of this method to use exceptions instead of
returning false seemed outside of the scope of this task.

[MAILPOET-3815]
2021-12-13 16:03:07 +01:00
Rodrigo Primo
6c05b3eaf0 Pass SubscriberEntity to sendConfirmationEmail() and sendConfirmationEmailOnce()
This commit changes the methods sendConfirmationEmail() and
sendConfirmationEmailOnce() to accept as the first parameter an instance
of SubscriberEntity instead of the old model Subscriber. It also updates
all the places where those two methods are called.

[MAILPOET-3815]
2021-12-13 16:03:07 +01:00
Rodrigo Primo
1c195789ba Fix "# number of machine opens" segment
There was a bug that was making the code use the wrong filter
and thus the wrong SQL query for the "# number of machine opens"
segment. Resulting in the wrong subscribers being associated with this
segment.

The email() method of the FilterFactory was using the wrong check to
decide which filter to use for this segment (the filter should be
EmailOpensAbsoluteCountAction and the factory was using EmailAction).
This commit fixes this problem.

[MAILPOET-4011]
2021-12-13 13:54:17 +01:00
Rostislav Wolny
2b4f8de61a Fix segment selections
PHP8.1 fixed a PDO bug (https://bugs.php.net/bug.php?id=80808) that was causing
that integer columns were fetched as strings.
[MAILPOET-3980]
2021-12-13 09:36:43 +01:00
Jan Lysý
a3cd53e9c2 Use lower batchSize and move constant
[MAILPOET-3954]
2021-12-06 14:52:34 +01:00
Jan Lysý
14731a46fa Refactor inserting from orders
[MAILPOET-3954]
2021-12-06 14:52:34 +01:00
Jan Lysý
565abbf897 Ensure collation is set
[MAILPOET-3954]
2021-12-06 14:52:34 +01:00
Jan Lysý
9bd6cb159c Sync subscribers sequentially from orders
[MAILPOET-3954]
2021-12-06 14:52:34 +01:00
Jan Lysý
c0c7e23b0e Remove the rest of the old model usage
[MAILPOET-3753]
2021-12-06 14:52:34 +01:00
Jan Lysý
2ada3c8b75 Change behavior to update names in batch
[MAILPOET-3753]
2021-12-06 14:52:34 +01:00
Jan Lysý
d3ee546518 Add support for more product ids in filter
[MAILPOET-3954]
2021-12-01 09:13:20 +01:00
Pavel Dohnal
e2aef203d2 Make sure segment id is always number
[MAILPOET-3502]
2021-11-30 12:33:38 +01:00
Pavel Dohnal
f759057fa8 Add filter
[MAILPOET-3502]
2021-11-30 12:33:38 +01:00
Pavel Dohnal
ec390b2131 Add list segment to data mapper
[MAILPOET-3502]
2021-11-30 12:33:38 +01:00
Pavel Dohnal
5fc8d51720 Add a filter for lists dynamic segment
[MAILPOET-3502]
2021-11-30 12:33:38 +01:00
wxa
aa4ecb2645 Add subscriber score segment back-end
[MAILPOET-3607]
2021-11-29 13:02:49 +01:00
Rodrigo Primo
120aa74511 Fix query to get subscribers of the "has WC subscription" segment
There was an issue in the old query used to get subscribers of the "has WooCommerce subscription" segment. When getting the IDs of the users
that purchased a given subscription, it would get all the entries from wp_woocommerce_order_items without checking the value of ordem_item_type.

The problem is that wp_woocommerce_order_items contains entries for the purchased product, but also other things like shipping and tax information. The WooCommerce Subscriptions extension uses wp_woocommerce_order_items to store data when a user switches from one subscription to another. This was causing users to be included in the "has WooCommerce subscription" segment even after they had switched from the subscription that belonged to the segment to another one.

This problem was fixed by adding another condition to the part of the query that joins with wp_woocommerce_order_items to get only entries that have the value 'line_item' for the field 'order_item_type'. This excludes entries where the value of 'order_item_type' is 'line_item_switched', which is what WC Subscriptions uses to track subscriptions that a user used to have before switching to something else.

[MAILPOET-3898]
2021-11-22 12:53:39 +01:00
Rostislav Wolny
4a76827a77 Fix fetching count of segments with multiple filters
We needed to get number of rows which meet the condition.
I couldn't use DQL since it doesn't allow a subquery in FROM
so I rewrote the query using DBAL level query builder.
[MAILPOET-3922]
2021-11-08 11:34:56 +01:00
Jan Lysý
e828546fa9 Fix getting segment count with multiple filters for empty table
Method getSingleScalarResult throws an exception when a query returns no rows.
I used the method getOneOrNullResult instead.
[MAILPOET-3902]
2021-11-02 09:07:42 +01:00
Rostislav Wolny
73a9bed483 Replace deprecated doctrine methods in lib directory
[MAILPOET-3889]
2021-10-28 15:44:18 +02:00
Jan Lysý
8f7ef3aa51 Rename method for getting count of segments with more filters
[MAILPOET-3427]
2021-10-27 15:45:17 +02:00
Jan Lysý
6e6ba3e7a1 Use new signature of the dynamicSegmentFilterData constructor
[MAILPOET-3427]
2021-10-27 15:45:17 +02:00
Jan Lysý
cc05b945b4 Use new properties in repository
[MAILPOET-3427]
2021-10-27 15:45:17 +02:00
Jan Lysý
0af5f111be Add new function for getting count of segments with more filters
[MAILPOET-3427]
2021-10-27 15:45:17 +02:00
Jan Lysý
02ad7c9c8e Add repository for DynamicSegmentFilters
[MAILPOET-3427]
2021-10-27 15:45:17 +02:00
Brezo Cordero
ff372667c2 Do not subscribe on synchronizeGuestCustomer
[MAILPOET-3598]
2021-10-18 13:12:14 +02:00
Brezo Cordero
683c5fa01f Fix subscribe on Order Pay form
[MAILPOET-3598]
2021-10-18 13:12:14 +02:00
wxa
08364b81e1 Fix collation detection for subscriber engagement calculation
[MAILPOET-3851]
2021-10-18 12:42:18 +02:00
Pavel Dohnal
21839fc30b Fix indentation of multiline function declarations
[MAILPOET-3732]
2021-09-17 12:17:36 +02:00
Pavel Dohnal
cdda3480ca Make all constructor signatures multiline
[MAILPOET-3732]
2021-09-16 14:19:40 +02:00
Pavel Dohnal
b0b6f1ff35 Remove unnecessary check
[MAILPOET-3737]
2021-09-08 14:38:41 +02:00
Pavel Dohnal
d1b2458227 Add # of machine opens segment
[MAILPOET-3737]
2021-09-08 14:38:41 +02:00
Pavel Dohnal
2ab5f04f46 Add segment for machine opens
[MAILPOET-3737]
2021-09-08 14:38:41 +02:00
Pavel Dohnal
cdd3ff5178 Use only non-machine opens for segment # open
[MAILPOET-3737]
2021-09-08 14:38:41 +02:00
Pavel Dohnal
49c9dd5f79 Use only non-machine opens for segment open
[MAILPOET-3737]
2021-09-08 14:38:41 +02:00
Rostislav Wolny
aa4312dd3c Fix incorrect counts in dynamic segments form
[MAILPOET-3761]
2021-09-08 12:02:26 +02:00
Brezo Cordero
b2857cbf40 Refactor code that checks for list deletion with form
Move segment deletion to new function doTrash to avoid calling methods twice on individual segment deletion. Refactor acceptance test.

[MAILPOET-3661]
2021-08-16 09:42:08 +02:00
Brezo Cordero
d9186e4230 Prevent deleting a list if attached to a form
[MAILPOET-3661]
2021-08-16 09:42:08 +02:00
Rostislav Wolny
47ef8944f8 Do not set status in sync of registered customer
Subscriber status is already handled when the user is added to
WordPress Users list.
[MAILPOET-3657]
2021-08-09 16:51:27 +02:00
Rostislav Wolny
12c9019939 Mark customers without optin as unsubscribed
[MAILPOET-3657]
2021-08-09 16:51:27 +02:00
Rodrigo Primo
e59992cc16 Fix checkGenericClassInNonGenericObjectType PHPStan errors
This commit removes the checkGenericClassInNonGenericObjectType flag
from PHPStan configuration files and fixes all associated errors in our
code base.

[MAILPOET-3236]
2021-08-09 12:58:56 +02:00
Rostislav Wolny
c182e953ef Prevent trashing customer users when WP segment is inactive
[MAILPOET-3695]
2021-08-09 12:36:29 +02:00
Jan Lysý
ef1a3072c7 Return zero when sum is null
[MAILPOET-3646]
2021-07-12 11:51:39 +02:00
Jan Lysý
a6dc552cdc Use new controller with subscribers counts
[MAILPOET-3646]
2021-07-12 11:51:39 +02:00
Jan Lysý
036f110953 Unify stats queries
[MAILPOET-3646]
2021-07-12 11:51:39 +02:00
Jan Lysý
40a511c641 Use transient cache for count of subscribers in lists
[MAILPOET-3646]
2021-07-12 11:51:39 +02:00