Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrebenchuk committed Sep 28, 2016
2 parents f870907 + 387a522 commit 3705531
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 39 deletions.
19 changes: 15 additions & 4 deletions src/OroCRM/Bundle/CaseBundle/Entity/CaseEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,21 @@ public function addComment(CaseComment $comment)
}

/**
* @param \DateTime $createdAt
* @param CaseComment $comment
* @return CaseEntity
*/
public function removeComment(CaseComment $comment)
{
$this->comments->removeElement($comment);

return $this;
}

/**
* @param \DateTime|null $createdAt
* @return CaseEntity
*/
public function setCreatedAt(\DateTime $createdAt)
public function setCreatedAt(\DateTime $createdAt = null)
{
$this->createdAt = $createdAt;

Expand All @@ -563,10 +574,10 @@ public function getCreatedAt()
}

/**
* @param \DateTime $updatedAt
* @param \DateTime|null $updatedAt
* @return CaseEntity
*/
public function setUpdatedAt(\DateTime $updatedAt)
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;

Expand Down
41 changes: 35 additions & 6 deletions src/OroCRM/Bundle/MagentoBundle/Entity/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,35 @@ public function setCartItems(Collection $cartItems)
$this->cartItems = $cartItems;
}

/**
* @param CartItem $cartItem
*
* @return $this
*/
public function addCartItem(CartItem $cartItem)
{
if (!$this->cartItems->contains($cartItem)) {
$this->cartItems->add($cartItem);
$cartItem->setCart($this);
}

return $this;
}

/**
* @param CartItem $cartItem
*
* @return $this
*/
public function removeCartItem(CartItem $cartItem)
{
if ($this->cartItems->contains($cartItem)) {
$this->cartItems->removeElement($cartItem);
}

return $this;
}

/**
* @param Store $store
*/
Expand Down Expand Up @@ -824,10 +853,10 @@ public function getSyncedAt()
}

/**
* @param \DateTime $syncedAt
* @return Customer
* @param \DateTime|null $syncedAt
* @return Cart
*/
public function setSyncedAt(\DateTime $syncedAt)
public function setSyncedAt(\DateTime $syncedAt = null)
{
$this->syncedAt = $syncedAt;

Expand All @@ -843,10 +872,10 @@ public function getImportedAt()
}

/**
* @param \DateTime $importedAt
* @return Customer
* @param \DateTime|null $importedAt
* @return Cart
*/
public function setImportedAt(\DateTime $importedAt)
public function setImportedAt(\DateTime $importedAt = null)
{
$this->importedAt = $importedAt;

Expand Down
8 changes: 4 additions & 4 deletions src/OroCRM/Bundle/MagentoBundle/Entity/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -944,10 +944,10 @@ public function getSyncedAt()
}

/**
* @param \DateTime $syncedAt
* @param \DateTime|null $syncedAt
* @return Customer
*/
public function setSyncedAt(\DateTime $syncedAt)
public function setSyncedAt(\DateTime $syncedAt = null)
{
$this->syncedAt = $syncedAt;

Expand All @@ -963,10 +963,10 @@ public function getImportedAt()
}

/**
* @param \DateTime $importedAt
* @param \DateTime|null $importedAt
* @return Customer
*/
public function setImportedAt(\DateTime $importedAt)
public function setImportedAt(\DateTime $importedAt = null)
{
$this->importedAt = $importedAt;

Expand Down
12 changes: 6 additions & 6 deletions src/OroCRM/Bundle/MagentoBundle/Entity/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,10 @@ public function getSyncedAt()
}

/**
* @param \DateTime $syncedAt
* @return Customer
* @param \DateTime|null $syncedAt
* @return Order
*/
public function setSyncedAt(\DateTime $syncedAt)
public function setSyncedAt(\DateTime $syncedAt = null)
{
$this->syncedAt = $syncedAt;

Expand All @@ -769,10 +769,10 @@ public function getImportedAt()
}

/**
* @param \DateTime $importedAt
* @return Customer
* @param \DateTime|null $importedAt
* @return Order
*/
public function setImportedAt(\DateTime $importedAt)
public function setImportedAt(\DateTime $importedAt = null)
{
$this->importedAt = $importedAt;

Expand Down
19 changes: 18 additions & 1 deletion src/OroCRM/Bundle/MagentoBundle/Resources/config/oro/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ oro_api:
OroCRM\Bundle\MagentoBundle\Entity\Cart: ~
OroCRM\Bundle\MagentoBundle\Entity\CartAddress: ~
OroCRM\Bundle\MagentoBundle\Entity\CartItem: ~
OroCRM\Bundle\MagentoBundle\Entity\Customer: ~
OroCRM\Bundle\MagentoBundle\Entity\Customer:
fields:
orders:
exclude: true
carts:
exclude: true
subresources:
orders:
actions:
update_relationship: false
add_relationship: false
delete_relationship: false
carts:
actions:
update_relationship: false
add_relationship: false
delete_relationship: false

# OroCRM\Bundle\MagentoBundle\Entity\CustomerGroup: ~
# OroCRM\Bundle\MagentoBundle\Entity\MagentoSoapTransport: ~
# OroCRM\Bundle\MagentoBundle\Entity\NewsletterSubscriber: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@

{% if entity.addresses is not empty %}
{% for orderAddress in entity.addresses %}
{% set title = orderAddress.types.first and orderAddress.types.first.name == 'billing'
? 'orocrm.magento.cart.billing_address.label'|trans
: 'orocrm.magento.cart.shipping_address.label'|trans %}
{% if orderAddress.types is not empty and orderAddress.types.first is not empty and orderAddress.types.first.name == 'billing' %}
{% set title = 'orocrm.magento.cart.billing_address.label'|trans %}
{% else %}
{% set title = 'orocrm.magento.cart.shipping_address.label'|trans %}
{% endif %}
{{ ui.renderHtmlProperty(title, address.renderAddress(orderAddress)) }}
{% endfor %}
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions src/OroCRM/Bundle/SalesBundle/Entity/B2bCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,9 @@ public function getCreatedAt()
}

/**
* @param \DateTime $createdAt
* @param \DateTime|null $createdAt
*/
public function setCreatedAt(\DateTime $createdAt)
public function setCreatedAt(\DateTime $createdAt = null)
{
$this->createdAt = $createdAt;
}
Expand All @@ -542,9 +542,9 @@ public function getUpdatedAt()
}

/**
* @param \DateTime $updatedAt
* @param \DateTime|null $updatedAt
*/
public function setUpdatedAt(\DateTime $updatedAt)
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function setAttachmentExtension(AttachmentExtension $attachmentExtension)
*/
public function getMigrationVersion()
{
return 'v1_25_2';
return 'v1_25_3';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,29 @@ protected function updateWorkflowTransitionLogs(LoggerInterface $logger, $dryRun
$params = [
'transition' => 'close_won',
'current_step_id' => $this->getStepIdByName($logger, 'won'),
'workflow_name' => 'opportunity_flow'
];
$types = [
'transition' => Type::STRING,
'current_step_id' => Type::INTEGER,
'workflow_name' => Type::STRING
];
$sql = 'UPDATE oro_workflow_item SET current_step_id = :current_step_id WHERE id IN(' .
' SELECT workflow_item_id FROM oro_workflow_transition_log WHERE id IN(' .
' SELECT MAX(id) FROM oro_workflow_transition_log ' .
' GROUP BY workflow_item_id' .
') AND transition = :transition' .
')';
$sql = <<<SQL
UPDATE oro_workflow_item
SET current_step_id = :current_step_id
WHERE id IN (
SELECT
tl.workflow_item_id
FROM
oro_workflow_transition_log tl
WHERE tl.id =
(
SELECT MAX(id)
FROM oro_workflow_transition_log
WHERE tl.workflow_item_id = workflow_item_id
) AND tl.transition = :transition
) AND workflow_name = :workflow_name
SQL;
$this->logQuery($logger, $sql, $params, $types);
if (!$dryRun) {
$this->connection->executeUpdate($sql, $params, $types);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function getOrder()
*/
public function up(Schema $schema, QueryBag $queries)
{
/** Tables generation **/
$table = $schema->getTable('orocrm_sales_lead');
if ($table->hasColumn('email')) {
$table->dropColumn('email');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function up(Schema $schema, QueryBag $queries)

$leadForeignKeyList = $table->getForeignKeys();
foreach ($leadForeignKeyList as $foreignKey) {
$foreingKeyColumns = $foreignKey->getUnquotedLocalColumns();
if (in_array($statusColumnName, $foreingKeyColumns, true)) {
$foreignKeyColumns = $foreignKey->getUnquotedLocalColumns();
if (in_array($statusColumnName, $foreignKeyColumns, true)) {
$table->removeForeignKey($foreignKey->getName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function getOrder()
*/
public function up(Schema $schema, QueryBag $queries)
{
/** Tables generation **/
$table = $schema->getTable('orocrm_sales_lead');
if ($table->hasColumn('phone_number')) {
$table->dropColumn('phone_number');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace OroCRM\Bundle\SalesBundle\Migrations\Schema\v1_25_3;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;

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

class RemoveOldEntityConfigs implements Migration
{
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$class = 'OroCRM\Bundle\SalesBundle\Entity\Lead';
$fields = ['email', 'phoneNumber'];

$queries->addPostQuery(
new ParametrizedSqlMigrationQuery(
'DELETE FROM oro_entity_config_field WHERE field_name IN (:fields)
AND entity_id IN (SELECT id FROM oro_entity_config WHERE class_name = :class)',
['class' => $class, 'fields' => $fields],
['class' => Type::STRING, 'fields' => Connection::PARAM_STR_ARRAY]
)
);
}
}

0 comments on commit 3705531

Please sign in to comment.