Skip to content

Commit 1a06418

Browse files
committed
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
2 parents 3bcec01 + 8b270da commit 1a06418

File tree

16 files changed

+136
-73
lines changed

16 files changed

+136
-73
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\AccountBundle\Datagrid;
4+
5+
use Oro\Bundle\DataGridBundle\Extension\GridViews\AbstractViewsList;
6+
use Oro\Bundle\DataGridBundle\Extension\GridViews\View;
7+
use Oro\Bundle\FilterBundle\Form\Type\Filter\BooleanFilterType;
8+
9+
class AccountsViewList extends AbstractViewsList
10+
{
11+
/**
12+
* {@inheritdoc}
13+
*/
14+
protected function getViewsList()
15+
{
16+
return [
17+
(new View(
18+
'oro_account.duplicities',
19+
['duplicate' => ['value' => BooleanFilterType::TYPE_YES]],
20+
['name' => 'ASC']
21+
))
22+
->setLabel($this->translator->trans(
23+
'oro.datagrid.gridview.duplicate.label',
24+
['%entity%' => $this->translator->trans('orocrm.account.entity_label')]
25+
))
26+
];
27+
}
28+
}

Diff for: src/OroCRM/Bundle/AccountBundle/Resources/config/datagrid.yml

+5
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ datagrid:
191191
updatedAt:
192192
type: datetime
193193
data_name: a.updatedAt
194+
duplicate:
195+
type: duplicate
196+
data_name: a.name
197+
visible: false
194198
actions:
195199
view:
196200
type: navigate
@@ -224,6 +228,7 @@ datagrid:
224228
entityHint: account
225229
export: true
226230
entity_pagination: true
231+
views_list: '@orocrm_account.accounts_view_list'
227232

228233
base-account-contacts-grid:
229234
extended_entity_name: %orocrm_contact.entity.class%

Diff for: src/OroCRM/Bundle/AccountBundle/Resources/config/services.yml

+5
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,8 @@ services:
103103
- 'owner'
104104
tags:
105105
- { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.dashboard-my-accounts-activity-grid, method: onResultBefore }
106+
107+
orocrm_account.accounts_view_list:
108+
class: OroCRM\Bundle\AccountBundle\Datagrid\AccountsViewList
109+
arguments:
110+
- @translator
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\ContactBundle\Datagrid;
4+
5+
use Oro\Bundle\DataGridBundle\Extension\GridViews\AbstractViewsList;
6+
use Oro\Bundle\DataGridBundle\Extension\GridViews\View;
7+
use Oro\Bundle\FilterBundle\Form\Type\Filter\BooleanFilterType;
8+
9+
class ContactsViewList extends AbstractViewsList
10+
{
11+
/**
12+
* {@inheritdoc}
13+
*/
14+
protected function getViewsList()
15+
{
16+
return [
17+
(new View(
18+
'oro_contact.duplicities',
19+
['duplicate' => ['value' => BooleanFilterType::TYPE_YES]],
20+
['email' => 'ASC']
21+
))
22+
->setLabel($this->translator->trans(
23+
'oro.datagrid.gridview.duplicate.label',
24+
['%entity%' => $this->translator->trans('orocrm.contact.entity_label')]
25+
))
26+
];
27+
}
28+
}

Diff for: src/OroCRM/Bundle/ContactBundle/Resources/config/datagrid.yml

+5
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ datagrid:
519519
type: choice-business-unit
520520
data_name: c.owner
521521
className: 'Oro\Bundle\OrganizationBundle\Entity\BusinessUnit'
522+
duplicate:
523+
type: duplicate
524+
data_name: email.email
525+
visible: false
522526
actions:
523527
view:
524528
type: navigate
@@ -548,6 +552,7 @@ datagrid:
548552
entityHint: contact
549553
export: true
550554
entity_pagination: true
555+
views_list: '@orocrm_contact.contacts_view_list'
551556

552557
# assigned accounts grid
553558
contact-accounts-grid:

Diff for: src/OroCRM/Bundle/ContactBundle/Resources/config/oro/entity.yml

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ oro_entity:
1818
left:
1919
- { join: entity.phones, alias: phones, conditionType: 'WITH', condition: 'phones.primary = true' }
2020

21+
virtual_relations:
22+
OroCRM\Bundle\ContactBundle\Entity\Contact:
23+
primaryAddr:
24+
relation_type: oneToMany
25+
related_entity_name: OroCRM\Bundle\ContactBundle\Entity\ContactAddress
26+
label: orocrm.contact.primary_addr.label
27+
query:
28+
join:
29+
left:
30+
- { join: entity.addresses, alias: addresses, conditionType: 'WITH', condition: 'addresses.primary = true' }
31+
2132
entity_aliases:
2233
OroCRM\Bundle\ContactBundle\Entity\Group:
2334
alias: contactgroup

Diff for: src/OroCRM/Bundle/ContactBundle/Resources/config/services.yml

+5
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,8 @@ services:
321321
- 'owner'
322322
tags:
323323
- { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before.dashboard-my-contacts-activity-grid, method: onResultBefore }
324+
325+
orocrm_contact.contacts_view_list:
326+
class: OroCRM\Bundle\ContactBundle\Datagrid\ContactsViewList
327+
arguments:
328+
- @translator

Diff for: src/OroCRM/Bundle/ContactBundle/Resources/translations/messages.en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ orocrm:
7575
phones.label: Phones
7676
primary_email.label: Primary Email
7777
primary_phone.label: Primary Phone
78+
primary_addr.label: Primary Address
7879
skype.label: Skype
7980
social.label: Social
8081
source.label: Source

Diff for: src/OroCRM/Bundle/MagentoBundle/ImportExport/Serializer/Normalizer/PaymentDetailsNormalizer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function supportsNormalization($data, $format = null, array $context = []
3333
*/
3434
public function denormalize($data, $class, $format = null, array $context = [])
3535
{
36-
if (!empty($data['paymentDetails'])) {
36+
if (isset($data['paymentDetails'])) {
3737
$data['paymentDetails'] = $this->denormalizePaymentDetails($data['paymentDetails']);
3838
}
3939

Diff for: src/OroCRM/Bundle/MagentoBundle/Resources/config/oro/entity.yml

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
oro_entity:
2+
virtual_relations:
3+
OroCRM\Bundle\MagentoBundle\Entity\Customer:
4+
primaryAddr:
5+
relation_type: oneToMany
6+
related_entity_name: OroCRM\Bundle\MagentoBundle\Entity\Address
7+
label: orocrm.magento.customer.primary_addr.label
8+
query:
9+
join:
10+
left:
11+
- { join: entity.addresses, alias: addresses, conditionType: 'WITH', condition: 'addresses.primary = true' }
12+
213
entity_aliases:
314
OroCRM\Bundle\MagentoBundle\Entity\Address:
415
alias: magentoaddress

Diff for: src/OroCRM/Bundle/MagentoBundle/Resources/translations/messages.en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ orocrm:
176176
contact.label: Contact
177177
account.label: Account
178178
addresses.label: Addresses
179+
primary_addr.label: Primary Address
179180
carts.label: Carts
180181
channel.label: Integration
181182
data_channel.label: Channel

Diff for: src/OroCRM/Bundle/ReportBundle/EventListener/ReportGridListener.php

+20-11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class ReportGridListener
2121
* Event: oro_datagrid.datagrid.build.before.orocrm_report-opportunities-won_by_period
2222
*
2323
* @param BuildBefore $event
24+
*
25+
* @SuppressWarnings(PHPMD.NPathComplexity)
2426
*/
2527
public function onBuildBefore(BuildBefore $event)
2628
{
@@ -66,24 +68,31 @@ public function onBuildBefore(BuildBefore $event)
6668

6769
// and setup separate sorting column, used as well in grouping, but not affecting grouping result
6870
// period will be always the first column, unless changed in datagrid.yml
71+
// Use sorters configuration from datagrids.yml for "Period" = "All", not apply period sorting and grouping
72+
$groupAlias = '';
73+
$sortAlias = '';
6974
if ($period == 'yearPeriod') {
7075
$groupAlias = $period;
7176
$sortAlias = $period;
72-
} else {
77+
} elseif ($period !== '') {
7378
$groupAlias = $period;
7479
$sortAlias = sprintf('%sSorting', $period);
7580
}
7681

77-
$config->offsetSetByPath('[source][query][groupBy]', $groupAlias);
82+
if ($groupAlias) {
83+
$config->offsetSetByPath('[source][query][groupBy]', $groupAlias);
84+
}
7885

79-
$config->offsetSetByPath(
80-
sprintf(
81-
'%s[%s][%s]',
82-
OrmSorterConfiguration::COLUMNS_PATH,
83-
self::PERIOD_COLUMN_NAME,
84-
PropertyInterface::DATA_NAME_KEY
85-
),
86-
$sortAlias
87-
);
86+
if ($sortAlias) {
87+
$config->offsetSetByPath(
88+
sprintf(
89+
'%s[%s][%s]',
90+
OrmSorterConfiguration::COLUMNS_PATH,
91+
self::PERIOD_COLUMN_NAME,
92+
PropertyInterface::DATA_NAME_KEY
93+
),
94+
$sortAlias
95+
);
96+
}
8897
}
8998
}

Diff for: src/OroCRM/Bundle/SalesBundle/Entity/Repository/OpportunityRepository.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,12 @@ public function createOpportunitiesCountQb(\DateTime $start = null, \DateTime $e
394394
$qb->select('COUNT(o.id)');
395395
if ($start) {
396396
$qb
397-
->andWhere('o.createdAt > :start')
397+
->andWhere('o.createdAt >= :start')
398398
->setParameter('start', $start);
399399
}
400400
if ($end) {
401401
$qb
402-
->andWhere('o.createdAt < :end')
402+
->andWhere('o.createdAt <= :end')
403403
->setParameter('end', $end);
404404
}
405405

Diff for: src/OroCRM/Bundle/SalesBundle/ImportExport/Strategy/B2bConfigurableAddOrReplaceStrategy.php

-59
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,20 @@
99

1010
class B2bConfigurableAddOrReplaceStrategy extends ConfigurableAddOrReplaceStrategy
1111
{
12-
/**
13-
* Save state about exists Billing Address value in entity or not.
14-
* Value is updated in function beforeProcessEntity and used
15-
* in function afterProcessEntity
16-
*
17-
* @var bool
18-
*/
19-
protected $isBillingAddress = true;
20-
21-
/**
22-
* Save state about exists Shipping Address value in entity or not.
23-
* Value is updated in function beforeProcessEntity and used
24-
* in function afterProcessEntity
25-
*
26-
* @var bool
27-
*/
28-
protected $isShippingAddress = true;
29-
30-
/**
31-
* {@inheritdoc}
32-
*/
33-
protected function beforeProcessEntity($entity)
34-
{
35-
/** @var B2bCustomer $entity */
36-
$entity = parent::beforeProcessEntity($entity);
37-
$this->checkEmptyAddresses($entity);
38-
39-
return $entity;
40-
}
41-
4212
/**
4313
* {@inheritdoc}
4414
*/
4515
protected function afterProcessEntity($entity)
4616
{
4717
/** @var B2bCustomer $entity */
4818
$entity = parent::afterProcessEntity($entity);
49-
$this->clearEmptyAddresses($entity);
5019

5120
$this->guessRegion($entity->getBillingAddress());
5221
$this->guessRegion($entity->getShippingAddress());
5322

5423
return $entity;
5524
}
5625

57-
/**
58-
* @param B2bCustomer $entity
59-
*/
60-
protected function checkEmptyAddresses(B2bCustomer $entity)
61-
{
62-
if (!$entity->getBillingAddress()) {
63-
$this->isBillingAddress = false;
64-
}
65-
66-
if (!$entity->getShippingAddress()) {
67-
$this->isShippingAddress = false;
68-
}
69-
}
70-
71-
/**
72-
* @param B2bCustomer $entity
73-
*/
74-
protected function clearEmptyAddresses(B2bCustomer $entity)
75-
{
76-
if (!$this->isBillingAddress) {
77-
$entity->setBillingAddress(null);
78-
}
79-
80-
if (!$this->isShippingAddress) {
81-
$entity->setShippingAddress(null);
82-
}
83-
}
84-
8526
/**
8627
* @param Address $address
8728
*/

Diff for: src/OroCRM/Bundle/SalesBundle/Resources/config/oro/entity.yml

+12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ oro_entity:
3434
join:
3535
left:
3636
- { join: entity.phones, alias: phones, conditionType: 'WITH', condition: 'phones.primary = true' }
37+
38+
virtual_relations:
39+
OroCRM\Bundle\SalesBundle\Entity\Lead:
40+
primaryAddr:
41+
relation_type: oneToMany
42+
related_entity_name: OroCRM\Bundle\SalesBundle\Entity\LeadAddress
43+
label: orocrm.sales.lead.primary_addr.label
44+
query:
45+
join:
46+
left:
47+
- { join: entity.addresses, alias: addresses, conditionType: 'WITH', condition: 'addresses.primary = true' }
48+
3749
entity_aliases:
3850
Extend\Entity\EV_Opportunity_Status:
3951
alias: salesopportunitystatus

Diff for: src/OroCRM/Bundle/SalesBundle/Resources/translations/messages.en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ orocrm:
242242
assigned.label: Assigned
243243
primary_phone.label: Primary Phone
244244
primary_email.label: Primary Email
245+
primary_addr.label: Primary Address
245246
source:
246247
unclassified: No source
247248
others: Others

0 commit comments

Comments
 (0)