Skip to content

Commit 59dae12

Browse files
committed
Merge remote-tracking branch 'remotes/dev/2.0' into 2.0
2 parents 6e7c26d + efee1dd commit 59dae12

File tree

8 files changed

+96
-11
lines changed

8 files changed

+96
-11
lines changed

Diff for: src/Oro/Bundle/MagentoBundle/Migrations/Data/ORM/LoadShoppingCartStatusData.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LoadShoppingCartStatusData extends AbstractFixture implements
2020
protected $dataV0 = array(
2121
'open' => 'Open',
2222
'lost' => 'Lost',
23-
'converted_to_opportunity' => 'Converted to opportunity',
23+
'converted_to_opportunity' => 'Converted to Opportunity',
2424
);
2525

2626
/** @var array */

Diff for: src/Oro/Bundle/MagentoBundle/Migrations/Schema/OroMagentoBundleInstaller.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function setExtendExtension(ExtendExtension $extendExtension)
7272
*/
7373
public function getMigrationVersion()
7474
{
75-
return 'v1_46_1';
75+
return 'v1_46_2';
7676
}
7777

7878
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Oro\Bundle\MagentoBundle\Migrations\Schema\v1_46_2;
4+
5+
use Doctrine\DBAL\Schema\Schema;
6+
7+
use Oro\Bundle\MigrationBundle\Migration\Migration;
8+
use Oro\Bundle\MigrationBundle\Migration\ParametrizedSqlMigrationQuery;
9+
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
10+
11+
class RenameMagentoCartStatusLabel implements Migration
12+
{
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
public function up(Schema $schema, QueryBag $queries)
17+
{
18+
$sql = 'UPDATE orocrm_magento_cart_status' .
19+
' SET label = :label' .
20+
' WHERE name = :name';
21+
22+
$queries->addQuery(
23+
new ParametrizedSqlMigrationQuery(
24+
$sql,
25+
['label' => 'Converted to Opportunity', 'name' => 'converted_to_opportunity']
26+
)
27+
);
28+
}
29+
}

Diff for: src/Oro/Bundle/MagentoBundle/Resources/doc/reference/workflows.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ that can be used to contact customer;
5353
* **Abandoned** - processing of shopping cart was stopped due to some reason and it should not be processed
5454
until reopen;
5555
* **Converted** - shopping cart was successfully converted;
56-
* **Converted to opportunity** - shopping cart was successfully converted and new opportunity was created
56+
* **Converted to Opportunity** - shopping cart was successfully converted and new opportunity was created
5757
(it can be processed separately using B2B flow).
5858

5959
### Transitions
@@ -74,7 +74,7 @@ until reopen;
7474
* **Abandon** - shopping cart must have status "Open" to allow this transition:
7575
* open form with Notes attribute;
7676
* set shopping cart status to "lost";
77-
* **Reopen** - shopping cart must have status "Converted", "Converted to opportunity" or "Abandoned" to allow this transition:
77+
* **Reopen** - shopping cart must have status "Converted", "Converted to Opportunity" or "Abandoned" to allow this transition:
7878
* open form with Notes attribute;
7979
* set shopping cart status to "open";
8080
* reset all attributes related to call, email and opportunity.

Diff for: src/Oro/Bundle/MagentoBundle/Resources/translations/workflows.en.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ oro:
77
abandoned:
88
label: Abandoned
99
converted_to_opportunity:
10-
label: 'Converted to opportunity'
10+
label: 'Converted to Opportunity'
1111
converted:
1212
label: Converted
1313
attribute:
@@ -29,7 +29,7 @@ oro:
2929
place_order:
3030
label: 'Place an order'
3131
convert_to_opportunity:
32-
label: 'Convert to opportunity'
32+
label: 'Convert to Opportunity'
3333
abandon:
3434
label: Abandon
3535
warning_message: 'You are going to abandon this shopping cart.'

Diff for: src/Oro/Bundle/SalesBundle/Migrations/Schema/v1_31/Query/MigrateB2bCustomersQuery.php

+42
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,48 @@ public function execute(LoggerInterface $logger)
4545
*/
4646
protected function doExecute(LoggerInterface $logger, $dryRun = false)
4747
{
48+
$query = 'SELECT id, name, user_owner_id, organization_id, name, createdAt, updatedAt '.
49+
'FROM orocrm_sales_b2bcustomer WHERE account_id IS NULL';
50+
$customersWithoutAccount = $this->connection->fetchAll($query);
51+
foreach ($customersWithoutAccount as $customer) {
52+
$query = 'INSERT INTO orocrm_account SET user_owner_id = :user_owner_id, '.
53+
'organization_id = :organization_id, name = :name, createdAt = :createdAt, '.
54+
'updatedAt = :updatedAt, serialized_data = :serialized_data';
55+
$this->connection->executeQuery(
56+
$query,
57+
[
58+
'user_owner_id' => $customer['user_owner_id'],
59+
'organization_id' => $customer['organization_id'],
60+
'name' => $customer['name'],
61+
'createdAt' => $customer['createdAt'],
62+
'updatedAt' => $customer['updatedAt'],
63+
'serialized_data' => base64_encode(serialize(null)),
64+
],
65+
[
66+
'user_owner_id' => 'integer',
67+
'organization_id' => 'integer',
68+
'name' => 'string',
69+
'createdAt' => 'integer',
70+
'updatedAt' => 'integer',
71+
'serialized_data' => 'string',
72+
]
73+
);
74+
$accountId = $this->connection->lastInsertId();
75+
76+
$query = 'UPDATE orocrm_sales_b2bcustomer SET account_id = :account_id WHERE id = :id';
77+
$this->connection->executeQuery(
78+
$query,
79+
[
80+
'account_id' => $accountId,
81+
'id' => $customer['id'],
82+
],
83+
[
84+
'account_id' => 'integer',
85+
'id' => 'integer',
86+
]
87+
);
88+
}
89+
4890
$query = 'INSERT INTO orocrm_sales_customer (account_id, ' . $this->customerColumnName . ') '
4991
. ' SELECT account_id, id FROM orocrm_sales_b2bcustomer';
5092

Diff for: src/Oro/Bundle/SalesBundle/Provider/Customer/ConfigProvider.php

+17-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class ConfigProvider
1414
/** @var ConfigManager */
1515
protected $configManager;
1616

17+
/** @var string */
18+
private $customerClasses;
19+
1720
/**
1821
* @param ConfigManager $configManager
1922
*/
@@ -33,20 +36,29 @@ public function isCustomerClass($objectOrClass)
3336
return false;
3437
}
3538

36-
$class = is_object($objectOrClass) ? ClassUtils::getClass($objectOrClass) : $objectOrClass;
39+
if (is_object($objectOrClass)) {
40+
$objectOrClass = ClassUtils::getClass($objectOrClass);
41+
}
3742

38-
return in_array($class, $this->getAssociatedCustomerClasses(), true);
43+
return in_array($objectOrClass, $this->getCustomerClasses(), true);
3944
}
4045

46+
/**
47+
* @return string[]
48+
*/
4149
public function getCustomerClasses()
4250
{
43-
return $this->getAssociatedCustomerClasses();
51+
if (null === $this->customerClasses) {
52+
$this->customerClasses = $this->getAssociatedCustomerClasses();
53+
}
54+
55+
return $this->customerClasses;
4456
}
4557

4658
/**
4759
* @return array
4860
* [
49-
* className => customer class with _ instead of \,
61+
* className => FQCN of a customer,
5062
* label => entity label,
5163
* icon => entity icon,
5264
* gridName => customer grid name
@@ -121,7 +133,7 @@ protected function getRouteCreate($entityClass)
121133
}
122134

123135
/**
124-
* @return array
136+
* @return string[]
125137
*/
126138
protected function getAssociatedCustomerClasses()
127139
{

Diff for: src/Oro/Bundle/SalesBundle/Resources/config/oro/datagrids.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ datagrids:
10771077
lifetime:
10781078
label: oro.sales.b2bcustomer.lifetime.label
10791079
frontend_type: currency
1080+
inline_editing:
1081+
enable: false
10801082
createdAt:
10811083
label: oro.ui.created_at
10821084
frontend_type: datetime

0 commit comments

Comments
 (0)