Skip to content

Commit 63f5e48

Browse files
committed
Squashed 'package/marello/' changes from e2134fd..0bc0152
0bc0152 - added additional check on order view to make sure a customer exists on the order before trying to render properties of the customer 633f259 MM-42: Test and fix functionality (#66) 6d656f8 MM-42: Test and fix functionality (#65) a62f4b7 MM-40: Test and fix import order functionality (#63) 49b6550 MM-38: Implement sync processors (#61) 1d6be06 MM-35: Fix issue 'Removed special product price won't sync on Magento side' (#58) d0d640d - added non proxy class of the Marello Product Unit as without this it can cause issues when the 'normal' class is used to send templates instead of the Proxy class of the product unit ad177b0 - Added default value for $data property as in most cases it will expect an array even if the data is not set on an Entity 4ce14c7 - updated email templates with name variable for ProductUnit - updated migration version for the application to load the new templates 0a23414 - added ProductUnit variable provider for rendering the product unit in the email templates as this is an enum field which is behaving as an extended entity with a proxy class that wasn't allowed in the email templates f230508 - Added the shipping origin based on WFA rules back for shipping methods that use the origin to determine shipping costs, the addres of the warehouse remains an estimation 1f44fe2 - updated field to check for available inventory, it used the balanced inventory instead of the inventory qty which is the qty that is left from the balanced inventory 224ba34 - removed check that was going through the WFA rules that wasn't necessary for either Payment methods and Shipping methods on the Order creation a287a3a - fixed renaming email templates for Order and Invoice notifications 361a765 - Updated email templates with new style 88337f5 - updated WorkflowstartListener test to check new behaviour of the OrderWorkflowStart 87716bd - Fixed issue with WorkflowStartListener where only the last order id (which came in batches) was getting a workflow start 1f318b4 - Removed statuses that are NULL from the OrderItemStatus dashboard widget as they cannot be displayed correctly 04a60f8 - added Order status to Order which will serve as preparation for the next step in the Order Management - currently no critical parts are relying on the new Order status as of yet, it's also not visibile in the current implementation 3d51851 - renamed table alias as the datagrid was confused which one was the actual table and which one was the column of the ProductUnit in the InventoryItem grid 8b9df75 - split the SalesBundle migrations as v1_3 was already released... 36e9e92 Merge branch 'task/ZON20001-0-update-m2-bundle' into maintenance/3.0 0442000 Merge branch 'feature/magento2-integr' into task/ZON20001-0-update-m2-bundle 9ac3f06 MM-29: Add functionality to map relation between website and sales_channel on the integration form (#54) git-subtree-dir: package/marello git-subtree-split: 0bc0152
1 parent 7d530c8 commit 63f5e48

File tree

82 files changed

+2913
-1887
lines changed

Some content is hidden

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

82 files changed

+2913
-1887
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace Marello\Bundle\CoreBundle\EventListener;
4+
5+
use Doctrine\Common\Util\ClassUtils;
6+
use Doctrine\ORM\Event\OnClearEventArgs;
7+
use Oro\Bundle\SecurityBundle\Authentication\Token\OrganizationAwareTokenInterface;
8+
use Oro\Bundle\SecurityBundle\EventListener\RefreshContextListener as ParentListener;
9+
use ProxyManager\Proxy\VirtualProxyInterface;
10+
11+
/**
12+
* Fix issue with "Proxy interface given instead of class manager",
13+
* it occurs because EntityManager was made as lazy in https://github.com/doctrine/DoctrineBundle/pull/559
14+
*/
15+
class RefreshContextListener extends ParentListener
16+
{
17+
/**
18+
* @param OnClearEventArgs $event
19+
* @param OrganizationAwareTokenInterface $token
20+
*/
21+
protected function checkOrganization(OnClearEventArgs $event, OrganizationAwareTokenInterface $token)
22+
{
23+
$organization = $token->getOrganization();
24+
if (!is_object($organization)) {
25+
return;
26+
}
27+
$organizationClass = ClassUtils::getClass($organization);
28+
if ($event->getEntityClass() && $event->getEntityClass() !== $organizationClass) {
29+
return;
30+
}
31+
/**
32+
* Start customization
33+
*/
34+
$em = $event->getEntityManager();
35+
$classEm = $this->doctrine->getManagerForClass($organizationClass);
36+
if ($classEm instanceof VirtualProxyInterface) {
37+
$classEm = $classEm->getWrappedValueHolderValue();
38+
}
39+
if ($em !== $classEm) {
40+
return;
41+
}
42+
/**
43+
* End customization
44+
*/
45+
$organization = $this->refreshEntity($organization, $organizationClass, $em);
46+
if (!$organization) {
47+
return;
48+
}
49+
$token->setOrganization($organization);
50+
}
51+
}

src/Marello/Bundle/CoreBundle/Resources/config/services.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,9 @@ services:
7575
arguments:
7676
- '@oro_entity.doctrine_helper'
7777
tags:
78-
- { name: twig.extension }
78+
- { name: twig.extension }
79+
80+
marello_core.event_listener.refresh_context:
81+
class: Marello\Bundle\CoreBundle\EventListener\RefreshContextListener
82+
decorates: oro_security.listener.refresh_context_listener
83+
parent: oro_security.listener.refresh_context_listener

src/Marello/Bundle/InventoryBundle/Provider/AvailableInventoryProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private function getAvailableBalancedInventory(Product $product, SalesChannel $s
4949
$salesChannelGroup = $salesChannel->getGroup();
5050
$result = $this->getBalancedInventoryLevel($product, $salesChannelGroup);
5151

52-
return ($result) ? $result->getBalancedInventoryQty() : 0;
52+
return ($result) ? $result->getInventoryQty() : 0;
5353
}
5454

5555
/**

src/Marello/Bundle/InventoryBundle/Resources/config/oro/datagrids.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ datagrids:
88
- p.denormalizedDefaultName as productName
99
- p.sku as productSku
1010
- i.enableBatchInventory as enableBatchInventory
11-
- productUnit.name as productUnit
11+
- pu.name as productUnit
1212
- COALESCE(SUM(il.inventory), 0) AS inventoryQty
1313
- COALESCE(SUM(il.allocatedInventory), 0) AS allocatedInventoryQty
1414
- COALESCE(SUM(il.inventory - il.allocatedInventory), 0) AS virtualInventoryQty
@@ -18,7 +18,7 @@ datagrids:
1818
left:
1919
- { join: i.product, alias: p }
2020
- { join: i.inventoryLevels, alias: il }
21-
- { join: i.productUnit, alias: productUnit }
21+
- { join: i.productUnit, alias: pu }
2222
groupBy: i.id
2323
columns:
2424
productSku:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Marello\Bundle\InvoiceBundle\Migrations\Data\ORM;
4+
5+
use Doctrine\Common\Persistence\ObjectManager;
6+
7+
use Oro\Bundle\EmailBundle\Migrations\Data\ORM\AbstractEmailFixture;
8+
use Oro\Bundle\MigrationBundle\Fixture\VersionedFixtureInterface;
9+
10+
class UpdateEmailTemplates extends AbstractEmailFixture implements
11+
VersionedFixtureInterface
12+
{
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
protected function findExistingTemplate(ObjectManager $manager, array $template)
17+
{
18+
$name = $template['params']['name'];
19+
if (empty($name)) {
20+
return null;
21+
}
22+
23+
return $manager->getRepository('OroEmailBundle:EmailTemplate')->findOneBy([
24+
'name' => $template['params']['name'],
25+
'entityName' => 'Marello\Bundle\InvoiceBundle\Entity\Invoice'
26+
]);
27+
}
28+
29+
/**
30+
* Return path to email templates
31+
*
32+
* @return string
33+
*/
34+
public function getEmailsDir()
35+
{
36+
return $this->container
37+
->get('kernel')
38+
->locateResource('@MarelloInvoiceBundle/Migrations/Data/ORM/data/email_templates');
39+
}
40+
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
public function getVersion()
45+
{
46+
return '1.2';
47+
}
48+
}

0 commit comments

Comments
 (0)