Skip to content

Commit e5bcfbf

Browse files
committed
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
2 parents a517a77 + 929b5aa commit e5bcfbf

File tree

5 files changed

+80
-14
lines changed

5 files changed

+80
-14
lines changed

src/OroCRM/Bundle/CaseBundle/Entity/CaseMailboxProcessSettings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
use Doctrine\Common\Collections\Collection;
77
use Doctrine\ORM\Mapping as ORM;
88

9-
use Oro\Bundle\EmailBundle\Entity\MailboxProcessSettings;
109
use Oro\Bundle\UserBundle\Entity\User;
1110
use Oro\Bundle\TagBundle\Entity\Taggable;
11+
use OroCRM\Bundle\CaseBundle\Model\ExtendCaseMailboxProcessSettings;
1212

1313
/**
1414
* @ORM\Entity
1515
*/
16-
class CaseMailboxProcessSettings extends MailboxProcessSettings implements Taggable
16+
class CaseMailboxProcessSettings extends ExtendCaseMailboxProcessSettings implements Taggable
1717
{
1818
/**
1919
* @var User
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\CaseBundle\Model;
4+
5+
use Oro\Bundle\EmailBundle\Entity\MailboxProcessSettings;
6+
7+
abstract class ExtendCaseMailboxProcessSettings extends MailboxProcessSettings
8+
{
9+
/**
10+
* Constructor
11+
*
12+
* The real implementation of this method is auto generated.
13+
*
14+
* IMPORTANT: If the derived class has own constructor it must call parent constructor.
15+
*/
16+
public function __construct()
17+
{
18+
}
19+
}

src/OroCRM/Bundle/SalesBundle/Entity/LeadMailboxProcessSettings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Doctrine\ORM\Mapping as ORM;
66

7-
use Oro\Bundle\EmailBundle\Entity\MailboxProcessSettings;
87
use Oro\Bundle\UserBundle\Entity\User;
98

109
use OroCRM\Bundle\ChannelBundle\Entity\Channel;
10+
use OroCRM\Bundle\SalesBundle\Model\ExtendLeadMailboxProcessSettings;
1111

1212
/**
1313
* @ORM\Entity
1414
*/
15-
class LeadMailboxProcessSettings extends MailboxProcessSettings
15+
class LeadMailboxProcessSettings extends ExtendLeadMailboxProcessSettings
1616
{
1717
/**
1818
* @var User

src/OroCRM/Bundle/SalesBundle/Migrations/Schema/v1_23/UpdateWorkflowItemStepData.php

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ protected function doExecute(LoggerInterface $logger, $dryRun = false)
5151
*/
5252
protected function updateWorkflowName(LoggerInterface $logger, $dryRun)
5353
{
54+
$workflowFields = implode(',', $this->getWorkflowFieldsByWorkflow($logger, 'b2b_flow_sales', ['name']));
55+
5456
$params = [
5557
'old_workflow_name' => 'b2b_flow_sales',
5658
'new_workflow_name' => 'opportunity_flow'
@@ -63,16 +65,9 @@ protected function updateWorkflowName(LoggerInterface $logger, $dryRun)
6365

6466
$queries = [
6567
// Copy workflow definition for new opportunity flow
66-
'INSERT INTO oro_workflow_definition ' .
68+
'INSERT INTO oro_workflow_definition (name,' . $workflowFields . ')' .
6769
' SELECT ' .
68-
':new_workflow_name as name,' .
69-
'start_step_id,' .
70-
'label,' .
71-
'related_entity,' .
72-
'entity_attribute_name,' .
73-
'steps_display_ordered,' .
74-
'system, configuration,' .
75-
'created_at, updated_at' .
70+
':new_workflow_name as name,' . $workflowFields .
7671
' FROM oro_workflow_definition WHERE name = :old_workflow_name',
7772

7873
'UPDATE oro_workflow_step SET workflow_name = :new_workflow_name WHERE workflow_name = :old_workflow_name',
@@ -108,27 +103,35 @@ protected function updateWorkflowSteps(LoggerInterface $logger, $dryRun)
108103
[
109104
'old_name' => 'qualify',
110105
'new_name' => 'open',
106+
'new_label' => 'Open',
107+
'final' => false,
111108
'workflow_name' => 'opportunity_flow',
112109
],
113110
[
114111
'old_name' => 'develop',
115112
'new_name' => 'won',
113+
'new_label' => 'Won',
114+
'final' => true,
116115
'workflow_name' => 'opportunity_flow',
117116
],
118117
[
119118
'old_name' => 'close',
120119
'new_name' => 'lost',
120+
'new_label' => 'Lost',
121+
'final' => true,
121122
'workflow_name' => 'opportunity_flow',
122123
],
123124
];
124125

125126
$types = [
126127
'old_name' => Type::STRING,
127128
'new_name' => Type::STRING,
129+
'new_label' => Type::STRING,
130+
'final' => Type::BOOLEAN,
128131
'workflow_name' => Type::STRING,
129132
];
130133

131-
$sql = 'UPDATE oro_workflow_step SET name = :new_name' .
134+
$sql = 'UPDATE oro_workflow_step SET name = :new_name, label = :new_label, is_final = :final' .
132135
' WHERE workflow_name = :workflow_name AND name = :old_name';
133136
foreach ($params as $param) {
134137
$this->logQuery($logger, $sql, $param, $types);
@@ -139,6 +142,8 @@ protected function updateWorkflowSteps(LoggerInterface $logger, $dryRun)
139142
/**
140143
* @param LoggerInterface $logger
141144
* @param bool $dryRun
145+
*
146+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
142147
*/
143148
protected function updateWorkflowTransitionLogs(LoggerInterface $logger, $dryRun)
144149
{
@@ -332,4 +337,27 @@ protected function getWorkflowSteps(LoggerInterface $logger)
332337

333338
return $this->connection->fetchAll($sql, $params, $types);
334339
}
340+
341+
/**
342+
* @param LoggerInterface $logger
343+
* @param string $name
344+
* @param array $exclude
345+
* @return array
346+
*/
347+
protected function getWorkflowFieldsByWorkflow(LoggerInterface $logger, $name, array $exclude)
348+
{
349+
$params = ['workflow_name' => $name];
350+
$types = ['workflow_name' => Type::STRING];
351+
352+
$sql = 'SELECT * FROM oro_workflow_definition WHERE name = :workflow_name LIMIT 1';
353+
$this->logQuery($logger, $sql, $params, $types);
354+
355+
$fields = $this->connection->executeQuery($sql, $params, $types)->fetch();
356+
357+
foreach ($exclude as $field) {
358+
unset($fields[$field]);
359+
}
360+
361+
return array_keys($fields);
362+
}
335363
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\SalesBundle\Model;
4+
5+
use Oro\Bundle\EmailBundle\Entity\MailboxProcessSettings;
6+
7+
abstract class ExtendLeadMailboxProcessSettings extends MailboxProcessSettings
8+
{
9+
/**
10+
* Constructor
11+
*
12+
* The real implementation of this method is auto generated.
13+
*
14+
* IMPORTANT: If the derived class has own constructor it must call parent constructor.
15+
*/
16+
public function __construct()
17+
{
18+
}
19+
}

0 commit comments

Comments
 (0)