Skip to content

Commit 0c2923d

Browse files
committed
Merge 1.0.0-alpha3
2 parents b50ba85 + 72a89f8 commit 0c2923d

File tree

97 files changed

+14956
-1504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+14956
-1504
lines changed

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CHANGELOG for 1.0.0-alpha3
2+
===================
3+
4+
This changelog references the relevant changes (new features, changes and bugs) done in 1.0.0-alpha3 versions.
5+
6+
* 1.0.0-alpha3 (2013-06-27)
7+
* Placeholders
8+
* Developer toolbar works with AJAX navigation requests
9+
* Configuring hidden columns in a Grid
10+
* Auto-complete form type
11+
* Added Address Book
12+
* Many-to-many relation between Contacts and Accounts
13+
* Added ability to sort Contacts and Accounts by Phone and Email in a Grid
14+
* Localized countries and regions
15+
* Enhanced data change log with ability to save changes for collections
16+
* Removed dependency on lib ICU
17+

Diff for: UPGRADE.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPGRADE FROM 1.0.0-alpha2 to 1.0.0-alpha3
2+
=======================
3+
4+
### General
5+
6+
* Upgrade to 1.0.0-alpha3 is not supported and full reinstall is required
7+

Diff for: composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@
2323
}
2424
}
2525
}
26-

Diff for: phpunit.xml.dist

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
<testsuites>
1717
<testsuite name="Project Unit Tests">
18-
<directory suffix="Test.php">src/OroCRM/Bundle/AccountBundle/Tests/Unit</directory>
19-
<directory suffix="Test.php">src/OroCRM/Bundle/ContactBundle/Tests/Unit</directory>
20-
<directory suffix="Test.php">src/OroCRM/Bundle/DashboardBundle/Tests/Unit</directory>
18+
<directory suffix="Test.php">src/*/Bundle/*Bundle/Tests/Unit</directory>
2119
</testsuite>
2220
</testsuites>
2321

Diff for: src/OroCRM/Bundle/AccountBundle/Controller/AccountController.php

+50-31
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Doctrine\Common\Util\ClassUtils;
1010
use Doctrine\ORM\Query;
1111

12-
use OroCRM\Bundle\AccountBundle\Entity\Value\AccountValue;
1312
use Oro\Bundle\FlexibleEntityBundle\Doctrine\ORM\FlexibleQueryBuilder;
1413
use Oro\Bundle\FlexibleEntityBundle\Entity\Attribute;
1514
use Oro\Bundle\FlexibleEntityBundle\Entity\Mapping\AbstractEntityAttribute;
@@ -23,21 +22,23 @@
2322

2423
use Symfony\Component\HttpFoundation\Response;
2524
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
26-
use Symfony\Component\Security\Acl\Exception\Exception;
2725

2826
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
2927
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
3028
use Oro\Bundle\UserBundle\Annotation\Acl;
29+
use Oro\Bundle\UserBundle\Annotation\AclAncestor;
3130

3231
use OroCRM\Bundle\AccountBundle\Entity\Account;
3332
use OroCRM\Bundle\AccountBundle\Datagrid\AccountDatagridManager;
33+
use OroCRM\Bundle\AccountBundle\Datagrid\AccountContactDatagridManager;
34+
use OroCRM\Bundle\AccountBundle\Datagrid\AccountContactUpdateDatagridManager;
3435

3536
use Ddeboer\DataImport\Writer\CsvWriter;
3637
use Ddeboer\DataImport\Reader\CsvReader;
3738

3839
/**
3940
* @Acl(
40-
* id="orocrm_account_account",
41+
* id="orocrm_account",
4142
* name="Account manipulation",
4243
* description="Account manipulation",
4344
* parent="root"
@@ -49,16 +50,26 @@ class AccountController extends Controller
4950
* @Route("/view/{id}", name="orocrm_account_view", requirements={"id"="\d+"})
5051
* @Template
5152
* @Acl(
52-
* id="orocrm_account_account_view",
53+
* id="orocrm_account_view",
5354
* name="View Account",
5455
* description="View account",
55-
* parent="orocrm_account_account"
56+
* parent="orocrm_account"
5657
* )
5758
*/
5859
public function viewAction(Account $account)
5960
{
61+
/** @var $contactDatagridManager AccountContactDatagridManager */
62+
$contactDatagridManager = $this->get('orocrm_account.contact.view_datagrid_manager');
63+
$contactDatagridManager->setAccount($account);
64+
$datagridView = $contactDatagridManager->getDatagrid()->createView();
65+
66+
if ('json' == $this->getRequest()->getRequestFormat()) {
67+
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
68+
}
69+
6070
return array(
61-
'account' => $account,
71+
'entity' => $account,
72+
'datagrid' => $datagridView,
6273
);
6374
}
6475

@@ -68,17 +79,15 @@ public function viewAction(Account $account)
6879
* @Route("/create", name="orocrm_account_create")
6980
* @Template("OroCRMAccountBundle:Account:update.html.twig")
7081
* @Acl(
71-
* id="orocrm_account_account_create",
82+
* id="orocrm_account_create",
7283
* name="Create Account",
7384
* description="Create account",
74-
* parent="orocrm_account_account"
85+
* parent="orocrm_account"
7586
* )
7687
*/
7788
public function createAction()
7889
{
79-
/** @var Account $account */
80-
$account = $this->getManager()->createEntity();
81-
return $this->updateAction($account);
90+
return $this->updateAction();
8291
}
8392

8493
/**
@@ -87,14 +96,27 @@ public function createAction()
8796
* @Route("/update/{id}", name="orocrm_account_update", requirements={"id"="\d+"}, defaults={"id"=0})
8897
* @Template
8998
* @Acl(
90-
* id="orocrm_account_account_update",
99+
* id="orocrm_account_update",
91100
* name="Edit Account",
92101
* description="Edit account",
93-
* parent="orocrm_account_account"
102+
* parent="orocrm_account"
94103
* )
95104
*/
96-
public function updateAction(Account $entity)
105+
public function updateAction(Account $entity = null)
97106
{
107+
if (!$entity) {
108+
$entity = $this->getManager()->createEntity();
109+
}
110+
111+
/** @var $contactDatagridManager AccountContactUpdateDatagridManager */
112+
$contactDatagridManager = $this->get('orocrm_account.contact.update_datagrid_manager');
113+
$contactDatagridManager->setAccount($entity);
114+
$datagridView = $contactDatagridManager->getDatagrid()->createView();
115+
116+
if ('json' == $this->getRequest()->getRequestFormat()) {
117+
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
118+
}
119+
98120
$backUrl = $this->generateUrl('orocrm_account_index');
99121

100122
if ($this->get('orocrm_account.form.handler.account')->process($entity)) {
@@ -103,7 +125,8 @@ public function updateAction(Account $entity)
103125
}
104126

105127
return array(
106-
'form' => $this->get('orocrm_account.form.account')->createView(),
128+
'form' => $this->get('orocrm_account.form.account')->createView(),
129+
'datagrid' => $datagridView,
107130
);
108131
}
109132

@@ -115,28 +138,24 @@ public function updateAction(Account $entity)
115138
* defaults={"_format" = "html"}
116139
* )
117140
* @Acl(
118-
* id="orocrm_account_account_list",
141+
* id="orocrm_account_list",
119142
* name="View List of Accounts",
120143
* description="View list of accounts",
121-
* parent="orocrm_account_account"
144+
* parent="orocrm_account"
122145
* )
146+
* @Template
123147
*/
124-
public function indexAction(Request $request)
148+
public function indexAction()
125149
{
126150
/** @var $gridManager AccountDatagridManager */
127151
$gridManager = $this->get('orocrm_account.account.datagrid_manager');
128-
$datagrid = $gridManager->getDatagrid();
152+
$datagridView = $gridManager->getDatagrid()->createView();
129153

130-
if ('json' == $request->getRequestFormat()) {
131-
$view = 'OroGridBundle:Datagrid:list.json.php';
132-
} else {
133-
$view = 'OroCRMAccountBundle:Account:index.html.twig';
154+
if ('json' == $this->getRequest()->getRequestFormat()) {
155+
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
134156
}
135157

136-
return $this->render(
137-
$view,
138-
array('datagrid' => $datagrid->createView())
139-
);
158+
return array('datagrid' => $datagridView);
140159
}
141160

142161
/**
@@ -145,10 +164,10 @@ public function indexAction(Request $request)
145164
* name="orocrm_account_export"
146165
* )
147166
* @Acl(
148-
* id="orocrm_account_account_export",
167+
* id="orocrm_account_export",
149168
* name="Export Accounts",
150169
* description="Export accounts",
151-
* parent="orocrm_account_account"
170+
* parent="orocrm_account"
152171
* )
153172
*/
154173
public function exportAction()
@@ -244,10 +263,10 @@ protected function getAttributeDataByName($name)
244263
* name="orocrm_account_import"
245264
* )
246265
* @Acl(
247-
* id="orocrm_account_account_import",
266+
* id="orocrm_account_import",
248267
* name="Import Accounts",
249268
* description="Import accounts",
250-
* parent="orocrm_account_account"
269+
* parent="orocrm_account"
251270
* )
252271
*/
253272
public function importAction()

Diff for: src/OroCRM/Bundle/AccountBundle/Controller/Api/Rest/AccountController.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AccountController extends FlexibleRestController implements ClassResourceI
3131
* description="Get all account items",
3232
* resource=true
3333
* )
34-
* @AclAncestor("orocrm_account_account_list")
34+
* @AclAncestor("orocrm_account_list")
3535
* @return Response
3636
*/
3737
public function cgetAction()
@@ -48,7 +48,7 @@ public function cgetAction()
4848
* description="Get account item",
4949
* resource=true
5050
* )
51-
* @AclAncestor("orocrm_account_account_view")
51+
* @AclAncestor("orocrm_account_view")
5252
* @return Response
5353
*/
5454
public function getAction($id)
@@ -65,7 +65,7 @@ public function getAction($id)
6565
* description="Update account",
6666
* resource=true
6767
* )
68-
* @AclAncestor("orocrm_account_account_update")
68+
* @AclAncestor("orocrm_account_update")
6969
* @return Response
7070
*/
7171
public function putAction($id)
@@ -80,7 +80,7 @@ public function putAction($id)
8080
* description="Create new account",
8181
* resource=true
8282
* )
83-
* @AclAncestor("orocrm_account_account_create")
83+
* @AclAncestor("orocrm_account_create")
8484
*/
8585
public function postAction()
8686
{
@@ -97,10 +97,10 @@ public function postAction()
9797
* resource=true
9898
* )
9999
* @Acl(
100-
* id="orocrm_account_account_remove",
100+
* id="orocrm_account_remove",
101101
* name="Delete account",
102102
* description="Delete account",
103-
* parent="orocrm_account_account"
103+
* parent="orocrm_account"
104104
* )
105105
* @return Response
106106
*/

Diff for: src/OroCRM/Bundle/AccountBundle/DataFixtures/ORM/LoadAccountAttrData.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function load(ObjectManager $manager)
4949
'searchable' => true
5050
),
5151
array(
52-
'code' => 'phones',
53-
'type' => 'oro_flexibleentity_phone_collection',
54-
'label' => 'Phones'
52+
'code' => 'phone',
53+
'label' => 'Phone',
54+
'searchable' => true
5555
),
5656
array(
5757
'code' => 'email',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
namespace OroCRM\Bundle\AccountBundle\Datagrid;
4+
5+
use Doctrine\ORM\QueryBuilder;
6+
7+
use Oro\Bundle\GridBundle\Datagrid\FlexibleDatagridManager;
8+
use OroCRM\Bundle\AccountBundle\Entity\Account;
9+
use OroCRM\Bundle\ContactBundle\Datagrid\ContactDatagridManager;
10+
use Oro\Bundle\GridBundle\Datagrid\ProxyQueryInterface;
11+
12+
class AccountContactDatagridManager extends ContactDatagridManager
13+
{
14+
/**
15+
* @var Account
16+
*/
17+
protected $account;
18+
19+
/**
20+
* @param Account $account
21+
*/
22+
public function setAccount(Account $account)
23+
{
24+
$this->account = $account;
25+
$this->routeGenerator->setRouteParameters(array('id' => $account->getId()));
26+
}
27+
28+
/**
29+
* @return Account
30+
* @throws \LogicException
31+
*/
32+
public function getAccount()
33+
{
34+
if (!$this->account) {
35+
throw new \LogicException('Datagrid manager has no configured Account entity');
36+
}
37+
38+
return $this->account;
39+
}
40+
41+
/**
42+
* {@inheritDoc}
43+
*/
44+
protected function prepareQuery(ProxyQueryInterface $query)
45+
{
46+
$this->applyJoinWithAddressAndCountry($query);
47+
48+
$entityAlias = $query->getRootAlias();
49+
$query->andWhere(":account MEMBER OF $entityAlias.accounts");
50+
}
51+
52+
/**
53+
* {@inheritDoc}
54+
*/
55+
protected function getQueryParameters()
56+
{
57+
return array('account' => $this->getAccount());
58+
}
59+
60+
/**
61+
* {@inheritDoc}
62+
*/
63+
protected function getProperties()
64+
{
65+
return array();
66+
}
67+
68+
/**
69+
* {@inheritdoc}
70+
*/
71+
protected function getRowActions()
72+
{
73+
return array();
74+
}
75+
}

0 commit comments

Comments
 (0)