Skip to content

Commit 8e75d7b

Browse files
committed
Merge pull request #161 from laboro/fix/CRM-545
CRM-545: Demo data for CRM is broken because of workflow changes
2 parents 6fc0a83 + b9ac90e commit 8e75d7b

File tree

1 file changed

+27
-37
lines changed

1 file changed

+27
-37
lines changed

src/OroCRM/Bundle/DemoDataBundle/DataFixtures/LoadLeadsData.php

+27-37
Original file line numberDiff line numberDiff line change
@@ -98,55 +98,45 @@ public function loadLeads()
9898

9999
$workFlow = $this->workflowManager->startWorkflow('sales_lead', $lead, 'qualify');
100100
if ((bool)rand(0, 1)) {
101-
/** @var WorkflowItem $opportunityFlow */
102-
$opportunityFlow = $workFlow->getResult()->get('workflowItem');
101+
/** @var WorkflowItem $salesFlow */
102+
$salesFlow = $workFlow->getResult()->get('workflowItem');
103103
$this->transit(
104104
$this->workflowManager,
105-
$opportunityFlow,
106-
'develop',
105+
$salesFlow,
106+
'close',
107107
array(
108108
'budget_amount' => rand(10, 10000),
109-
'probability' => round(rand(5, 75) / 100.00, 2)
109+
'customer_need' => rand(10, 10000),
110+
'proposed_solution' => rand(10, 10000),
111+
'probability' => round(rand(50, 85) / 100.00, 2)
110112
)
111113
);
112114
if ((bool)rand(0, 1)) {
115+
$reason = $this->em->find('OroCRMSalesBundle:OpportunityCloseReason', 'won');
113116
$this->transit(
114117
$this->workflowManager,
115-
$opportunityFlow,
116-
'close',
118+
$salesFlow,
119+
'close_as_won',
117120
array(
118-
'customer_need' => rand(10, 10000),
119-
'proposed_solution' => rand(10, 10000),
120-
'probability' => round(rand(50, 85) / 100.00, 2)
121+
'close_reason' => $reason,
122+
'close_revenue' => rand(100, 1000),
123+
'close_date' => new \DateTime('now'),
124+
'probability' => 1
125+
)
126+
);
127+
} elseif ((bool)rand(0, 1)) {
128+
$reason = $this->em->find('OroCRMSalesBundle:OpportunityCloseReason', 'cancelled');
129+
$this->transit(
130+
$this->workflowManager,
131+
$salesFlow,
132+
'close_as_lost',
133+
array(
134+
'close_reason' => $reason,
135+
'close_revenue' => rand(100, 1000),
136+
'close_date' => new \DateTime('now'),
137+
'probability' => 0.0
121138
)
122139
);
123-
if ((bool)rand(0, 1)) {
124-
$reason = $this->em->find('OroCRMSalesBundle:OpportunityCloseReason', 'won');
125-
$this->transit(
126-
$this->workflowManager,
127-
$opportunityFlow,
128-
'close_as_won',
129-
array(
130-
'close_reason' => $reason,
131-
'close_revenue' => rand(100, 1000),
132-
'close_date' => new \DateTime('now'),
133-
'probability' => 1
134-
)
135-
);
136-
} elseif ((bool)rand(0, 1)) {
137-
$reason = $this->em->find('OroCRMSalesBundle:OpportunityCloseReason', 'cancelled');
138-
$this->transit(
139-
$this->workflowManager,
140-
$opportunityFlow,
141-
'close_as_lost',
142-
array(
143-
'close_reason' => $reason,
144-
'close_revenue' => rand(100, 1000),
145-
'close_date' => new \DateTime('now'),
146-
'probability' => 0.0
147-
)
148-
);
149-
}
150140
}
151141
}
152142
}

0 commit comments

Comments
 (0)