Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dev/1.7' into 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Banin committed Aug 14, 2015
2 parents 9c8f230 + 3c48b8c commit 9fc9e59
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 3 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
CHANGELOG for 1.7.6
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.6 versions.
* 1.7.6 (2015-08-14)
* Magento order items are now organization-aware
* Fixed validation errors in REST API controller for Accounts

CHANGELOG for 1.7.5
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.5 versions.
* 1.7.5 (2015-07-29)
* Role entity is now extendable
* Data types for Data Audit may now be added by developers
* Fixed issues with date & time queries in Reports

CHANGELOG for 1.7.4
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.4 versions.
* 1.7.4 (2015-07-08)
This release fixes a major security issue - a so-called Open Redirect that might be exploited to redirect users to third-party servers in an underhand way, and may potentially lead to steal of user's login and password.
Also fixed minor security issues.

CHANGELOG for 1.7.3
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.3 versions.
* 1.7.3 (2015-07-03)
Oro Platform 1.7.3 dependency update

CHANGELOG for 1.7.2
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.2 versions.
* 1.7.2 (2015-06-17)
* Fixed issue Magento cart items during sync
* Fixed email html code visibility

CHANGELOG for 1.7.1
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.1 versions.
* 1.7.1 (2015-06-15)
Guest Magento customer profiles
With this feature we introduce a new type of Magento Customer – guest customers, i.e. those who for some reasons decided not to register in your Magento store but made a purchase anyway. Information collected during the guest check-out will be used to create Magento customer profiles that will look and behave exactly the same way as regular Magento customers except they won't be synced via integration and they won't have a current shopping cart.
If, at some later point in time, this customer chooses to register, his existing guest profile will be automatically connected to his Magento account and then kept in sync by the integration. If a customer deletes an account in Magento, the Magento customer profile in Oro will remain, but turns into a guest one.
Guest orders placed by registered customers will also be recognized and appended to their accounts, giving you the full picture of their purchases.
This feature may be disabled in Magento integration settings. It is turned on by default.

Items removed from Magento cart will be recorded in OroCRM
Shopping carts in OroCRM will now contain the entire history of what has been put into the cart and what has been removed from it, giving you more data for marketing segmentation and campaigning. It will now be possible to set filtering conditions on item state like:
* filter all customers who do have item X in the cart
* filter all customers who have ever added item X to their carts
* filter all customers who have added but then removed item X from their carts

List of improvements and fixed bugs
* Changed Oro Bridge detection to use soap getFunctions method
* Improved Magento Region connector
* Fixed "Create Magento Customer" is available for Organization without Magento Channel
* Fixed Delete Marketing list provokes errors
* Fixed error if add duplicate columns in Marketing list
* Fixed import B2B Customer which is related to existing Lead
* Fixed memory leak Sales Process

CHANGELOG for 1.7.0
===================
This changelog references the relevant changes (new features, changes and bugs) done in 1.7.0 versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getManager()
*/
public function getForm()
{
return $this->get('orocrm_account.form.type.account.api');
return $this->get('orocrm_account.form.account.api');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function getManager()
*/
public function getForm()
{
return $this->get('orocrm_case.form.type.comment.api');
return $this->get('orocrm_case.form.comment.api');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ protected function generateOrderItem(ObjectManager $om, Order $order, Cart $cart
$orderItem->setPrice($cartItem->getPrice());
$orderItem->setOriginalPrice($cartItem->getPrice());
$orderItem->setName($cartItem->getName());
$orderItem->setOwner($order->getOrganization());
$orderItems[] = $orderItem;

$om->persist($orderItem);
Expand Down Expand Up @@ -415,6 +416,7 @@ protected function generateShoppingCartItem(ObjectManager $om, Cart $cart)
$cartItem->setUpdatedAt(new \DateTime('now'));
$cartItem->setOriginId($origin);
$cartItem->setCart($cart);
$cartItem->setOwner($cart->getOrganization());
$cart->getCartItems()->add($cartItem);
$cart->setItemsQty($i+1);
$cart->setItemsCount($i+1);
Expand Down
38 changes: 38 additions & 0 deletions src/OroCRM/Bundle/MagentoBundle/Entity/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\ORM\Mapping as ORM;

use Oro\Bundle\OrganizationBundle\Entity\Organization;
use OroCRM\Bundle\MagentoBundle\Model\ExtendCartItem;
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config;

Expand All @@ -21,6 +22,11 @@
* "entity"={
* "icon"="icon-shopping-cart"
* },
* "ownership"={
* "owner_type"="ORGANIZATION",
* "owner_field_name"="owner",
* "owner_column_name"="owner_id"
* },
* "security"={
* "type"="ACL",
* "group_name"=""
Expand Down Expand Up @@ -154,6 +160,14 @@ class CartItem extends ExtendCartItem implements OriginAwareInterface, Integrati
*/
protected $removed = false;

/**
* @var Organization
*
* @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization")
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id", onDelete="SET NULL")
*/
protected $owner;

/**
* @param float $customPrice
*
Expand Down Expand Up @@ -453,4 +467,28 @@ public function setRemoved($removed)

return $this;
}

/**
* Set owner
*
* @param Organization $owner
*
* @return $this
*/
public function setOwner(Organization $owner = null)
{
$this->owner = $owner;

return $this;
}

/**
* Get owner
*
* @return Organization
*/
public function getOwner()
{
return $this->owner;
}
}
38 changes: 38 additions & 0 deletions src/OroCRM/Bundle/MagentoBundle/Entity/OrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config;

use Oro\Bundle\OrganizationBundle\Entity\Organization;
use OroCRM\Bundle\MagentoBundle\Model\ExtendOrderItem;

/**
Expand All @@ -16,6 +17,11 @@
* "entity"={
* "icon"="icon-list-alt"
* },
* "ownership"={
* "owner_type"="ORGANIZATION",
* "owner_field_name"="owner",
* "owner_column_name"="owner_id"
* },
* "security"={
* "type"="ACL",
* "group_name"=""
Expand Down Expand Up @@ -79,6 +85,14 @@ class OrderItem extends ExtendOrderItem implements IntegrationAwareInterface, Or
*/
protected $discountPercent;

/**
* @var Organization
*
* @ORM\ManyToOne(targetEntity="Oro\Bundle\OrganizationBundle\Entity\Organization")
* @ORM\JoinColumn(name="owner_id", referencedColumnName="id", onDelete="SET NULL")
*/
protected $owner;

/** Do not needed in magento order item, because magento api does not bring it up */
protected $cost;

Expand Down Expand Up @@ -181,4 +195,28 @@ public function getDiscountPercent()
{
return $this->discountPercent;
}

/**
* Set owner
*
* @param Organization $owner
*
* @return OrderItem
*/
public function setOwner(Organization $owner = null)
{
$this->owner = $owner;

return $this;
}

/**
* Get owner
*
* @return Organization
*/
public function getOwner()
{
return $this->owner;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ protected function updateCustomer(Cart $cart)
protected function updateCartItems(Cart $cart)
{
foreach ($cart->getCartItems() as $cartItem) {
$cartItem->setOwner($cart->getOrganization());
$cartItem->setCart($cart);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ protected function processCart(Order $entity)
protected function processItems(Order $order)
{
foreach ($order->getItems() as $item) {
$item->setOwner($order->getOrganization());
$item->setOrder($order);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function setVisitEventAssociationExtension(VisitEventAssociationExtension
*/
public function getMigrationVersion()
{
return 'v1_34';
return 'v1_35';
}

/**
Expand Down Expand Up @@ -451,7 +451,9 @@ protected function createOrocrmMagentoCartItemTable(Schema $schema)
$table->addColumn('origin_id', 'integer', ['notnull' => false, 'precision' => 0, 'unsigned' => true]);
$table->addColumn('channel_id', 'integer', ['notnull' => false]);
$table->addColumn('is_removed', 'boolean', ['notnull' => true, 'default' => false]);
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['cart_id'], 'IDX_A73DC8621AD5CDBF', []);
$table->addIndex(['owner_id'], 'IDX_A73DC8627E3C61F9', []);
$table->setPrimaryKey(['id']);
$table->addIndex(['origin_id'], 'magecartitem_origin_idx', []);
$table->addIndex(['sku'], 'magecartitem_sku_idx', []);
Expand Down Expand Up @@ -800,7 +802,9 @@ protected function createOrocrmMagentoOrderItemsTable(Schema $schema)
$table->addColumn('row_total', 'money', ['notnull' => false, 'precision' => 0, 'comment' => '(DC2Type:money)']);
$table->addColumn('origin_id', 'integer', ['notnull' => false, 'precision' => 0, 'unsigned' => true]);
$table->addColumn('channel_id', 'integer', ['notnull' => false]);
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['order_id'], 'IDX_3135EFF68D9F6D38', []);
$table->addIndex(['owner_id'], 'IDX_3135EFF67E3C61F9', []);
$table->setPrimaryKey(['id']);
}

Expand Down Expand Up @@ -1086,6 +1090,12 @@ protected function addOrocrmMagentoCartItemForeignKeys(Schema $schema)
['id'],
['onDelete' => 'SET NULL']
);
$table->addForeignKeyConstraint(
$schema->getTable('oro_organization'),
['owner_id'],
['id'],
['onDelete' => 'SET NULL']
);
}

/**
Expand Down Expand Up @@ -1438,6 +1448,12 @@ protected function addOrocrmMagentoOrderItemsForeignKeys(Schema $schema)
['id'],
['onDelete' => 'SET NULL']
);
$table->addForeignKeyConstraint(
$schema->getTable('oro_organization'),
['owner_id'],
['id'],
['onDelete' => 'SET NULL']
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace OroCRM\Bundle\MagentoBundle\Migrations\Schema\v1_35;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class ItemsOrganizationOwner implements Migration
{
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('orocrm_magento_order_items');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id'], 'IDX_3135EFF67E3C61F9', []);
$table->addForeignKeyConstraint(
$schema->getTable('oro_organization'),
['owner_id'],
['id'],
['onDelete' => 'SET NULL']
);

$queries->addPostQuery(
'UPDATE orocrm_magento_order_items itm '.
'SET owner_id = (SELECT organization_id FROM orocrm_magento_order WHERE itm.order_id = id)'
);

$table = $schema->getTable('orocrm_magento_cart_item');
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addIndex(['owner_id'], 'IDX_A73DC8627E3C61F9', []);
$table->addForeignKeyConstraint(
$schema->getTable('oro_organization'),
['owner_id'],
['id'],
['onDelete' => 'SET NULL']
);

$queries->addPostQuery(
'UPDATE orocrm_magento_cart_item itm '.
'SET owner_id = (SELECT organization_id FROM orocrm_magento_cart WHERE itm.cart_id = id)'
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ orocrm:
product_url.label: Product URL
channel.label: Channel
removed.label: Removed
owner.label: Owner

cartstatus:
entity_label: Magento Shopping Cart Status
Expand Down Expand Up @@ -319,6 +320,7 @@ orocrm:
tax_percent.label: Tax percent
weight.label: Weight
channel.label: Channel
owner.label: Owner

magentosoaptransport:
entity_label: Magento Integration Channel Transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ protected function createCartItem()
$cartItem->setTaxPercent(0);
$cartItem->setCreatedAt(new \DateTime('now'));
$cartItem->setUpdatedAt(new \DateTime('now'));
$cartItem->setOwner($this->organization);

$this->em->persist($cartItem);

Expand Down Expand Up @@ -513,6 +514,7 @@ protected function createBaseOrderItem(Order $order)
$orderItem->setDiscountPercent(4);
$orderItem->setDiscountAmount(0);
$orderItem->setRowTotal(234);
$orderItem->setOwner($this->organization);

$this->em->persist($orderItem);

Expand Down

0 comments on commit 9fc9e59

Please sign in to comment.