Skip to content

Commit 3bcec01

Browse files
committed
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
2 parents 2f7bc57 + e153437 commit 3bcec01

File tree

11 files changed

+137
-20
lines changed

11 files changed

+137
-20
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ datagrid:
211211
label: oro.grid.action.delete
212212
icon: trash
213213
link: delete_link
214+
defaultMessages:
215+
confirm_content: oro.ui.delete_confirm_cascade
216+
confirm_content_params:
217+
entity_label: '@translator->trans(oro.account.entity_label)'
214218
mass_actions:
215219
merge:
216220
type: merge

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

+14
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@ datagrid:
116116
field_options:
117117
class: OroCRMCaseBundle:CaseSource
118118
property: label
119+
owner:
120+
type: choice-tree
121+
label: oro.user.owner.label
122+
data_name: caseEntity.owner
123+
autocomplete_alias: users
124+
renderedPropertyName: 'fullName'
125+
className: 'Oro\Bundle\UserBundle\Entity\User'
126+
enabled: false
127+
businessUnitId:
128+
label: oro.business_unit.label
129+
type: choice-business-unit
130+
data_name: caseEntity.owner
131+
className: 'Oro\Bundle\OrganizationBundle\Entity\BusinessUnit'
132+
enabled: false
119133
properties:
120134
id: ~
121135
view_link:

Diff for: src/OroCRM/Bundle/MagentoBundle/Entity/Cart.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
* @ORM\Table(name="orocrm_magento_cart",
3131
* indexes={
3232
* @ORM\Index(name="magecart_origin_idx", columns={"origin_id"}),
33-
* @ORM\Index(name="magecart_updated_idx",columns={"updatedAt"})
33+
* @ORM\Index(name="magecart_updated_idx", columns={"updatedAt"}),
34+
* @ORM\Index(name="magecart_payment_details_idx", columns={"payment_details"}),
35+
* @ORM\Index(name="status_name_items_qty_idx", columns={"status_name", "items_qty"})
3436
* },
3537
* uniqueConstraints={
3638
* @ORM\UniqueConstraint(name="unq_cart_origin_id_channel_id", columns={"origin_id", "channel_id"})

Diff for: src/OroCRM/Bundle/MagentoBundle/Entity/Customer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class Customer extends ExtendCustomer implements
304304
* @var Account
305305
*
306306
* @ORM\ManyToOne(targetEntity="OroCRM\Bundle\AccountBundle\Entity\Account")
307-
* @ORM\JoinColumn(name="account_id", referencedColumnName="id", onDelete="SET NULL")
307+
* @ORM\JoinColumn(name="account_id", referencedColumnName="id", onDelete="CASCADE")
308308
* @ConfigField(
309309
* defaultValues={
310310
* "importexport"={

Diff for: src/OroCRM/Bundle/MagentoBundle/Migrations/Schema/OroCRMMagentoBundleInstaller.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function setVisitEventAssociationExtension(VisitEventAssociationExtension
110110
*/
111111
public function getMigrationVersion()
112112
{
113-
return 'v1_41_2';
113+
return 'v1_41_4';
114114
}
115115

116116
/**
@@ -715,6 +715,8 @@ protected function createOrocrmMagentoCartTable(Schema $schema)
715715
$table->setPrimaryKey(['id']);
716716
$table->addIndex(['origin_id'], 'magecart_origin_idx', []);
717717
$table->addIndex(['updatedAt'], 'magecart_updated_idx', []);
718+
$table->addIndex(['payment_details'], 'magecart_payment_details_idx', []);
719+
$table->addIndex(['status_name', 'items_qty'], 'status_name_items_qty_idx', []);
718720
$table->addUniqueIndex(['origin_id', 'channel_id'], 'unq_cart_origin_id_channel_id');
719721
}
720722

@@ -1025,7 +1027,7 @@ protected function addOrocrmMagentoCustomerForeignKeys(Schema $schema)
10251027
$schema->getTable('orocrm_account'),
10261028
['account_id'],
10271029
['id'],
1028-
['onDelete' => 'SET NULL']
1030+
['onDelete' => 'CASCADE']
10291031
);
10301032
$table->addForeignKeyConstraint(
10311033
$schema->getTable('oro_user'),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\MagentoBundle\Migrations\Schema\v1_41_3;
4+
5+
use Doctrine\DBAL\Schema\Schema;
6+
7+
use Oro\Bundle\MigrationBundle\Migration\Migration;
8+
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
9+
10+
class UpdateCartIndexes implements Migration
11+
{
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function up(Schema $schema, QueryBag $queries)
16+
{
17+
$table = $schema->getTable('orocrm_magento_cart');
18+
if (!$table->hasIndex('magecart_payment_details_idx')) {
19+
$table->addIndex(['payment_details'], 'magecart_payment_details_idx', []);
20+
}
21+
if (!$table->hasIndex('status_name_items_qty_idx')) {
22+
$table->addIndex(['status_name', 'items_qty'], 'status_name_items_qty_idx', []);
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\MagentoBundle\Migrations\Schema\v1_41_4;
4+
5+
use Doctrine\DBAL\Schema\Schema;
6+
use Oro\Bundle\MigrationBundle\Migration\Migration;
7+
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
8+
9+
class OroCRMMagentoBundle implements Migration
10+
{
11+
/**
12+
* Changes account_id to onDelete=CASCADE
13+
*
14+
* {@inheritdoc}
15+
*/
16+
public function up(Schema $schema, QueryBag $queries)
17+
{
18+
$this->changeOnDeleteToCascade(
19+
$schema,
20+
[
21+
'orocrm_magento_customer' => ['account_id'],
22+
]
23+
);
24+
}
25+
26+
/**
27+
* @param Schema $schema
28+
* @param array $data
29+
* [
30+
* table name => [column name, ...],
31+
* ...
32+
* ]
33+
*/
34+
protected function changeOnDeleteToCascade(Schema $schema, array $data)
35+
{
36+
foreach ($data as $tableName => $columns) {
37+
$table = $schema->getTable($tableName);
38+
foreach ($columns as $column) {
39+
$foreignKeys = $table->getForeignKeys();
40+
foreach ($foreignKeys as $foreignKey) {
41+
$foreignKeyColumns = $foreignKey->getUnquotedLocalColumns();
42+
if ($foreignKeyColumns === [$column]) {
43+
if ($foreignKey->getOption('onDelete') !== 'CASCADE') {
44+
$table->removeForeignKey($foreignKey->getName());
45+
$table->addForeignKeyConstraint(
46+
$foreignKey->getUnqualifiedForeignTableName(),
47+
$foreignKeyColumns,
48+
$foreignKey->getUnquotedForeignColumns(),
49+
['onDelete' => 'CASCADE', 'onUpdate' => $foreignKey->getOption('onUpdate')]
50+
);
51+
}
52+
53+
break;
54+
}
55+
}
56+
}
57+
}
58+
}
59+
}

Diff for: src/OroCRM/Bundle/MarketingListBundle/Datagrid/Extension/MarketingListExtension.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function visitDatasource(DatagridConfiguration $config, DatasourceInterfa
9797
if (!is_string($part)) {
9898
$part = $qb->expr()->orX(
9999
$part,
100-
$this->createItemsFunc($qb)
100+
$this->createItemsExpr($qb)
101101
);
102102

103103
$addParameter = true;
@@ -129,19 +129,18 @@ public function getPriority()
129129
/**
130130
* @param QueryBuilder $qb
131131
*
132-
* @return Func
132+
* @return mixed
133133
*/
134-
protected function createItemsFunc(QueryBuilder $qb)
134+
protected function createItemsExpr(QueryBuilder $qb)
135135
{
136136
$itemsQb = clone $qb;
137137
$itemsQb->resetDQLParts();
138138

139139
$itemsQb
140140
->select('item.entityId')
141141
->from('OroCRMMarketingListBundle:MarketingListItem', 'item')
142-
->andWhere('item.marketingList = :marketingListId')
143-
->andWhere('item.entityId = ' . $qb->getRootAliases()[0]);
142+
->andWhere('item.marketingList = :marketingListId');
144143

145-
return new Func('EXISTS', $itemsQb->getDQL());
144+
return $itemsQb->expr()->in($qb->getRootAliases()[0], $itemsQb->getDQL());
146145
}
147146
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ protected function createLeadsCountQb(
201201

202202
if ($start) {
203203
$qb
204-
->andWhere('l.createdAt > :start')
204+
->andWhere('l.createdAt >= :start')
205205
->setParameter('start', $start);
206206
}
207207
if ($end) {
208208
$qb
209-
->andWhere('l.createdAt < :end')
209+
->andWhere('l.createdAt <= :end')
210210
->setParameter('end', $end);
211211
}
212212

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

+14-8
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,13 @@ public function getWonOpportunitiesToDateAmount(
633633
*/
634634
protected function setCreationPeriod(QueryBuilder $qb, \DateTime $start = null, \DateTime $end = null)
635635
{
636-
$qb
637-
->andWhere($qb->expr()->between('o.createdAt', ':dateStart', ':dateEnd'))
638-
->setParameter('dateStart', $start)
639-
->setParameter('dateEnd', $end);
636+
if ($start) {
637+
$qb->andWhere('o.createdAt >= :dateStart')->setParameter('dateStart', $start);
638+
}
639+
640+
if ($end) {
641+
$qb->andWhere('o.createdAt <= :dateEnd')->setParameter('dateEnd', $end);
642+
}
640643
}
641644

642645
/**
@@ -646,10 +649,13 @@ protected function setCreationPeriod(QueryBuilder $qb, \DateTime $start = null,
646649
*/
647650
protected function setClosedPeriod(QueryBuilder $qb, \DateTime $start = null, \DateTime $end = null)
648651
{
649-
$qb
650-
->andWhere($qb->expr()->between('o.closeDate', ':dateStart', ':dateEnd'))
651-
->setParameter('dateStart', $start)
652-
->setParameter('dateEnd', $end);
652+
if ($start) {
653+
$qb->andWhere('o.closedAt >= :dateStart')->setParameter('dateStart', $start);
654+
}
655+
656+
if ($end) {
657+
$qb->andWhere('o.closedAt <= :dateEnd')->setParameter('dateEnd', $end);
658+
}
653659
}
654660

655661
/**

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

+6
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,12 @@ datagrid:
12881288
autocomplete_alias: users
12891289
renderedPropertyName: 'fullName'
12901290
className: 'Oro\Bundle\UserBundle\Entity\User'
1291+
businessUnitId:
1292+
label: oro.business_unit.label
1293+
type: choice-business-unit
1294+
data_name: c.owner
1295+
className: 'Oro\Bundle\OrganizationBundle\Entity\BusinessUnit'
1296+
enabled: false
12911297
accountName:
12921298
type: string
12931299
data_name: accountName

0 commit comments

Comments
 (0)