Skip to content

Commit

Permalink
Merge 1.0.0-alpha3
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrebenchuk committed Jun 27, 2013
2 parents b50ba85 + 72a89f8 commit 0c2923d
Show file tree
Hide file tree
Showing 97 changed files with 14,956 additions and 1,504 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CHANGELOG for 1.0.0-alpha3
===================

This changelog references the relevant changes (new features, changes and bugs) done in 1.0.0-alpha3 versions.

* 1.0.0-alpha3 (2013-06-27)
* Placeholders
* Developer toolbar works with AJAX navigation requests
* Configuring hidden columns in a Grid
* Auto-complete form type
* Added Address Book
* Many-to-many relation between Contacts and Accounts
* Added ability to sort Contacts and Accounts by Phone and Email in a Grid
* Localized countries and regions
* Enhanced data change log with ability to save changes for collections
* Removed dependency on lib ICU

7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UPGRADE FROM 1.0.0-alpha2 to 1.0.0-alpha3
=======================

### General

* Upgrade to 1.0.0-alpha3 is not supported and full reinstall is required

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
}
}
}

4 changes: 1 addition & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

<testsuites>
<testsuite name="Project Unit Tests">
<directory suffix="Test.php">src/OroCRM/Bundle/AccountBundle/Tests/Unit</directory>
<directory suffix="Test.php">src/OroCRM/Bundle/ContactBundle/Tests/Unit</directory>
<directory suffix="Test.php">src/OroCRM/Bundle/DashboardBundle/Tests/Unit</directory>
<directory suffix="Test.php">src/*/Bundle/*Bundle/Tests/Unit</directory>
</testsuite>
</testsuites>

Expand Down
81 changes: 50 additions & 31 deletions src/OroCRM/Bundle/AccountBundle/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ORM\Query;

use OroCRM\Bundle\AccountBundle\Entity\Value\AccountValue;
use Oro\Bundle\FlexibleEntityBundle\Doctrine\ORM\FlexibleQueryBuilder;
use Oro\Bundle\FlexibleEntityBundle\Entity\Attribute;
use Oro\Bundle\FlexibleEntityBundle\Entity\Mapping\AbstractEntityAttribute;
Expand All @@ -23,21 +22,23 @@

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\Security\Acl\Exception\Exception;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Oro\Bundle\UserBundle\Annotation\Acl;
use Oro\Bundle\UserBundle\Annotation\AclAncestor;

use OroCRM\Bundle\AccountBundle\Entity\Account;
use OroCRM\Bundle\AccountBundle\Datagrid\AccountDatagridManager;
use OroCRM\Bundle\AccountBundle\Datagrid\AccountContactDatagridManager;
use OroCRM\Bundle\AccountBundle\Datagrid\AccountContactUpdateDatagridManager;

use Ddeboer\DataImport\Writer\CsvWriter;
use Ddeboer\DataImport\Reader\CsvReader;

/**
* @Acl(
* id="orocrm_account_account",
* id="orocrm_account",
* name="Account manipulation",
* description="Account manipulation",
* parent="root"
Expand All @@ -49,16 +50,26 @@ class AccountController extends Controller
* @Route("/view/{id}", name="orocrm_account_view", requirements={"id"="\d+"})
* @Template
* @Acl(
* id="orocrm_account_account_view",
* id="orocrm_account_view",
* name="View Account",
* description="View account",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
*/
public function viewAction(Account $account)
{
/** @var $contactDatagridManager AccountContactDatagridManager */
$contactDatagridManager = $this->get('orocrm_account.contact.view_datagrid_manager');
$contactDatagridManager->setAccount($account);
$datagridView = $contactDatagridManager->getDatagrid()->createView();

if ('json' == $this->getRequest()->getRequestFormat()) {
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
}

return array(
'account' => $account,
'entity' => $account,
'datagrid' => $datagridView,
);
}

Expand All @@ -68,17 +79,15 @@ public function viewAction(Account $account)
* @Route("/create", name="orocrm_account_create")
* @Template("OroCRMAccountBundle:Account:update.html.twig")
* @Acl(
* id="orocrm_account_account_create",
* id="orocrm_account_create",
* name="Create Account",
* description="Create account",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
*/
public function createAction()
{
/** @var Account $account */
$account = $this->getManager()->createEntity();
return $this->updateAction($account);
return $this->updateAction();
}

/**
Expand All @@ -87,14 +96,27 @@ public function createAction()
* @Route("/update/{id}", name="orocrm_account_update", requirements={"id"="\d+"}, defaults={"id"=0})
* @Template
* @Acl(
* id="orocrm_account_account_update",
* id="orocrm_account_update",
* name="Edit Account",
* description="Edit account",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
*/
public function updateAction(Account $entity)
public function updateAction(Account $entity = null)
{
if (!$entity) {
$entity = $this->getManager()->createEntity();
}

/** @var $contactDatagridManager AccountContactUpdateDatagridManager */
$contactDatagridManager = $this->get('orocrm_account.contact.update_datagrid_manager');
$contactDatagridManager->setAccount($entity);
$datagridView = $contactDatagridManager->getDatagrid()->createView();

if ('json' == $this->getRequest()->getRequestFormat()) {
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
}

$backUrl = $this->generateUrl('orocrm_account_index');

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

return array(
'form' => $this->get('orocrm_account.form.account')->createView(),
'form' => $this->get('orocrm_account.form.account')->createView(),
'datagrid' => $datagridView,
);
}

Expand All @@ -115,28 +138,24 @@ public function updateAction(Account $entity)
* defaults={"_format" = "html"}
* )
* @Acl(
* id="orocrm_account_account_list",
* id="orocrm_account_list",
* name="View List of Accounts",
* description="View list of accounts",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
* @Template
*/
public function indexAction(Request $request)
public function indexAction()
{
/** @var $gridManager AccountDatagridManager */
$gridManager = $this->get('orocrm_account.account.datagrid_manager');
$datagrid = $gridManager->getDatagrid();
$datagridView = $gridManager->getDatagrid()->createView();

if ('json' == $request->getRequestFormat()) {
$view = 'OroGridBundle:Datagrid:list.json.php';
} else {
$view = 'OroCRMAccountBundle:Account:index.html.twig';
if ('json' == $this->getRequest()->getRequestFormat()) {
return $this->get('oro_grid.renderer')->renderResultsJsonResponse($datagridView);
}

return $this->render(
$view,
array('datagrid' => $datagrid->createView())
);
return array('datagrid' => $datagridView);
}

/**
Expand All @@ -145,10 +164,10 @@ public function indexAction(Request $request)
* name="orocrm_account_export"
* )
* @Acl(
* id="orocrm_account_account_export",
* id="orocrm_account_export",
* name="Export Accounts",
* description="Export accounts",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
*/
public function exportAction()
Expand Down Expand Up @@ -244,10 +263,10 @@ protected function getAttributeDataByName($name)
* name="orocrm_account_import"
* )
* @Acl(
* id="orocrm_account_account_import",
* id="orocrm_account_import",
* name="Import Accounts",
* description="Import accounts",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
*/
public function importAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AccountController extends FlexibleRestController implements ClassResourceI
* description="Get all account items",
* resource=true
* )
* @AclAncestor("orocrm_account_account_list")
* @AclAncestor("orocrm_account_list")
* @return Response
*/
public function cgetAction()
Expand All @@ -48,7 +48,7 @@ public function cgetAction()
* description="Get account item",
* resource=true
* )
* @AclAncestor("orocrm_account_account_view")
* @AclAncestor("orocrm_account_view")
* @return Response
*/
public function getAction($id)
Expand All @@ -65,7 +65,7 @@ public function getAction($id)
* description="Update account",
* resource=true
* )
* @AclAncestor("orocrm_account_account_update")
* @AclAncestor("orocrm_account_update")
* @return Response
*/
public function putAction($id)
Expand All @@ -80,7 +80,7 @@ public function putAction($id)
* description="Create new account",
* resource=true
* )
* @AclAncestor("orocrm_account_account_create")
* @AclAncestor("orocrm_account_create")
*/
public function postAction()
{
Expand All @@ -97,10 +97,10 @@ public function postAction()
* resource=true
* )
* @Acl(
* id="orocrm_account_account_remove",
* id="orocrm_account_remove",
* name="Delete account",
* description="Delete account",
* parent="orocrm_account_account"
* parent="orocrm_account"
* )
* @return Response
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function load(ObjectManager $manager)
'searchable' => true
),
array(
'code' => 'phones',
'type' => 'oro_flexibleentity_phone_collection',
'label' => 'Phones'
'code' => 'phone',
'label' => 'Phone',
'searchable' => true
),
array(
'code' => 'email',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace OroCRM\Bundle\AccountBundle\Datagrid;

use Doctrine\ORM\QueryBuilder;

use Oro\Bundle\GridBundle\Datagrid\FlexibleDatagridManager;
use OroCRM\Bundle\AccountBundle\Entity\Account;
use OroCRM\Bundle\ContactBundle\Datagrid\ContactDatagridManager;
use Oro\Bundle\GridBundle\Datagrid\ProxyQueryInterface;

class AccountContactDatagridManager extends ContactDatagridManager
{
/**
* @var Account
*/
protected $account;

/**
* @param Account $account
*/
public function setAccount(Account $account)
{
$this->account = $account;
$this->routeGenerator->setRouteParameters(array('id' => $account->getId()));
}

/**
* @return Account
* @throws \LogicException
*/
public function getAccount()
{
if (!$this->account) {
throw new \LogicException('Datagrid manager has no configured Account entity');
}

return $this->account;
}

/**
* {@inheritDoc}
*/
protected function prepareQuery(ProxyQueryInterface $query)
{
$this->applyJoinWithAddressAndCountry($query);

$entityAlias = $query->getRootAlias();
$query->andWhere(":account MEMBER OF $entityAlias.accounts");
}

/**
* {@inheritDoc}
*/
protected function getQueryParameters()
{
return array('account' => $this->getAccount());
}

/**
* {@inheritDoc}
*/
protected function getProperties()
{
return array();
}

/**
* {@inheritdoc}
*/
protected function getRowActions()
{
return array();
}
}
Loading

0 comments on commit 0c2923d

Please sign in to comment.