Skip to content

Commit

Permalink
Merge branch '3.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
24198 committed Feb 14, 2020
2 parents dcb7aa4 + 2a921f8 commit e6c6ba1
Show file tree
Hide file tree
Showing 1,097 changed files with 41,683 additions and 5,206 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Marello
========================
[![GitHub release](https://img.shields.io/github/release/marellocommerce/marello.svg)](https://github.com/marellocommerce/marello/releases)

What is Marello?
-----------
Expand All @@ -25,7 +24,7 @@ Use as dependency in composer
Run unit tests
--------------

Please make sure you have at least phpunit 6.5 or above.
Please make sure you have at least phpunit 7.5 or above.
To run unit tests of any bundles:

```bash
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
},
"require": {
"php": ">=7.1.26",
"oro/platform": "~3.1.1",
"oro/platform-serialised-fields": "~3.1.1",
"oro/calendar-bundle": "~3.1.1"
"oro/platform": "4.1.*",
"oro/platform-serialised-fields": "4.1.*",
"oro/calendar-bundle": "4.1.*",
"mpdf/mpdf": "^7.1"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
Expand Down
10 changes: 10 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<ruleset name="Marello">
<description>PSR2 ruleset with Marello configuration</description>
<rule ref="PSR2"/>
<exclude-pattern>*/marellocommerce/*/*/*/*/*/Tests/*</exclude-pattern>
<exclude-pattern>*/marellocommerce/*/*/*/*/*/Migrations/Schema/*</exclude-pattern>

<arg name="extensions" value="php"/>
<arg name="report" value="checkstyle"/>
</ruleset>
8 changes: 5 additions & 3 deletions src/Marello/Bundle/AddressBundle/Entity/MarelloAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

use Doctrine\ORM\Mapping as ORM;
use Marello\Bundle\AddressBundle\Model\ExtendMarelloAddress;
use Marello\Bundle\OrderBundle\Entity\Customer;
use Marello\Bundle\CustomerBundle\Entity\Customer;
use Oro\Bundle\EntityConfigBundle\Metadata\Annotation as Oro;

/**
* @ORM\Entity
* @ORM\Entity(
* repositoryClass="Marello\Bundle\AddressBundle\Entity\Repository\MarelloAddressRepository"
* )
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="marello_address")
* @ORM\AssociationOverrides({
Expand Down Expand Up @@ -62,7 +64,7 @@ class MarelloAddress extends ExtendMarelloAddress
protected $company;

/**
* @ORM\ManyToOne(targetEntity="Marello\Bundle\OrderBundle\Entity\Customer", inversedBy="addresses",
* @ORM\ManyToOne(targetEntity="Marello\Bundle\CustomerBundle\Entity\Customer", inversedBy="addresses",
* cascade={"persist"})
* @ORM\JoinColumn(onDelete="SET NULL", nullable=true)
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace Marello\Bundle\AddressBundle\Entity\Repository;

use Doctrine\ORM\EntityRepository;
use Marello\Bundle\AddressBundle\Entity\MarelloAddress;
use MarelloEnterprise\Bundle\AddressBundle\Entity\MarelloEnterpriseAddress;
use Oro\Bundle\SecurityBundle\ORM\Walker\AclHelper;

class MarelloAddressRepository extends EntityRepository
{
/**
* @var AclHelper
*/
private $aclHelper;

/**
* @param AclHelper $aclHelper
*/
public function setAclHelper(AclHelper $aclHelper)
{
$this->aclHelper = $aclHelper;
}

/**
* @param MarelloAddress $address
*
* @return MarelloEnterpriseAddress[]
*/
public function findByAddressParts(MarelloAddress $address)
{
$qb = $this->createQueryBuilder('addr');
$qb
->innerJoin('addr.country', 'country')
->andWhere($qb->expr()->eq('country.iso2Code', ':countryIso2'))
->andWhere($qb->expr()->eq('addr.city', ':city'))
->andWhere($qb->expr()->eq('addr.street', ':street'))
->setParameter('countryIso2', $address->getCountryIso2())
->setParameter('city', $address->getCity())
->setParameter('street', $address->getStreet());

if ($address->getRegion() === null) {
$qb->andWhere('addr.region IS NULL');
} else {
$qb
->innerJoin('addr.region', 'region')
->andWhere($qb->expr()->eq('region.code', ':regionCode'))
->setParameter('regionCode', $address->getRegionCode());
}
if ($address->getRegionText() === null) {
$qb->andWhere('addr.regionText IS NULL');
} else {
$qb
->andWhere($qb->expr()->eq('addr.regionText', ':regionText'))
->setParameter('regionText', $address->getRegionText());
}
if ($address->getStreet2() === null) {
$qb->andWhere('addr.street2 IS NULL');
} else {
$qb
->andWhere($qb->expr()->eq('addr.street2', ':street2'))
->setParameter('street2', $address->getStreet2());
}
if ($address->getPostalCode() === null) {
$qb->andWhere('addr.postalCode IS NULL');
} else {
$qb
->andWhere($qb->expr()->eq('addr.postalCode', ':postalCode'))
->setParameter('postalCode', $address->getPostalCode());
}

return $this->aclHelper->apply($qb)->getResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function up(Schema $schema, QueryBag $queries)
* Update marello_address table
*
* @param Schema $schema
* @param QueryBag $queries
*/
protected function updateDatetimeMarelloAddressTable(Schema $schema, QueryBag $queries)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dynamic-imports:
marelloaddress:
- marelloaddress/js/address
- marelloaddress/js/app/components/address-component
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
placeholders:
placeholders:
marello_address_map:
items:
marello_address_item_map:
order: 100

items:
marello_address_item_map:
template: MarelloAddressBundle:Address:addressMap.html.twig

This file was deleted.

11 changes: 9 additions & 2 deletions src/Marello/Bundle/AddressBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

services:
marello_address.formatter.address:
class: Marello\Bundle\AddressBundle\Formatter\AddressFormatter
Expand All @@ -13,4 +12,12 @@ services:
arguments:
- '@marello_address.formatter.address'
tags:
- { name: twig.extension }
- { name: twig.extension }

marello_address.repository.marelloaddress:
class: 'Marello\Bundle\AddressBundle\Entity\Repository\MarelloAddressRepository'
parent: oro_entity.abstract_repository
arguments:
- 'Marello\Bundle\AddressBundle\Entity\MarelloAddress'
calls:
- [setAclHelper, ['@oro_security.acl_helper']]
21 changes: 10 additions & 11 deletions src/Marello/Bundle/AddressBundle/Resources/public/js/address.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
define([
'underscore',
'backbone',
'oroui/js/app/views/base/view',
'orotranslation/js/translator',
'oroui/js/mediator',
'oroui/js/messenger',
'oro/dialog-widget',
'oroaddress/js/address/view'
'oro/dialog-widget'
], function(
_,
Backbone,
BaseView,
__,
mediator,
messenger,
DialogWidget,
AddressView
DialogWidget
) {
'use strict';

var $ = Backbone.$;

/**
* @export marelloaddress/js/address
* @class marelloaddress.Address
* @extends Backbone.View
*/
return Backbone.View.extend({
const AddressView = BaseView.extend({
options: {
'addressUpdateUrl': null,
'addressUpdateUrl': null
},

initialize: function(options) {
Expand Down Expand Up @@ -77,6 +73,7 @@ define([
}
}, this)
);

this.addressEditDialog.on('formSave', _.bind(function() {
this.addressEditDialog.remove();
messenger.notificationFlashMessage('success', __('Address saved'));
Expand All @@ -87,6 +84,8 @@ define([

reloadAddress: function() {
this.getAddressWidget().render();
},
}
});

return AddressView;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
define(function(require) {
'use strict';

const BaseComponent = require('oroui/js/app/components/base/component');
const widgetManager = require('oroui/js/widget-manager');
const Address = require('marelloaddress/js/address');
const routing = require('routing');
const _ = require('underscore');

const AddressWidgetComponent = BaseComponent.extend({
optionNames: BaseComponent.prototype.optionNames.concat([
'wid', 'addressCreateUrl', 'addressUpdateRoute', 'addressDeleteRoute'
]),

options: null,

/**
* @inheritDoc
*/
constructor: function AddressWidgetComponent(options) {
AddressWidgetComponent.__super__.constructor.call(this, options);
},

/**
* @inheritDoc
*/
initialize: function(options) {
this.options = options;
AddressWidgetComponent.__super__.initialize.call(this, options);
widgetManager.getWidgetInstance(this.wid, this._initializeAddress.bind(this));
},

_initializeAddress: function(widget) {
const options = this.options;
return new Address({
el: this.options.el,
addressId: this.options.addressId,
addressUpdateUrl: function() {
return routing.generate(options.addressUpdateRoute.route, {'id': options.addressUpdateRoute.id })
},
widget: widget
});
}

});

return AddressWidgetComponent;
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set apiKey = oro_config_value('oro_google_integration.google_api_key') %}
{% if apiKey is not empty%}
{% if apiKey is not empty and address is not null %}
<div class="map-visual-frame"
data-page-component-module="oroui/js/app/components/view-component"
data-page-component-options="{{ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;

use Oro\Bundle\OrganizationBundle\Entity\Organization;

use Marello\Bundle\OrderBundle\Entity\Customer;
use Marello\Bundle\AddressBundle\Entity\MarelloAddress;

class LoadAddressData extends AbstractFixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Marello\Bundle\AddressBundle\Tests\Functional\Api;

use Marello\Bundle\AddressBundle\Entity\MarelloAddress;
use Marello\Bundle\CoreBundle\Tests\Functional\RestJsonApiTestCase;
use Marello\Bundle\AddressBundle\Tests\Functional\Api\DataFixtures\LoadAddressData;
use Marello\Bundle\CoreBundle\Tests\Functional\RestJsonApiTestCase;

class MarelloAddressJsonApiTest extends RestJsonApiTestCase
{
Expand Down
6 changes: 4 additions & 2 deletions src/Marello/Bundle/AddressBundle/Twig/AddressExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use Oro\Bundle\LocaleBundle\Formatter\AddressFormatter;
use Oro\Bundle\LocaleBundle\Model\AddressInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

class AddressExtension extends \Twig_Extension
class AddressExtension extends AbstractExtension
{
/**
* @var AddressFormatter
Expand All @@ -26,7 +28,7 @@ public function __construct(AddressFormatter $addressFormatter)
public function getFilters()
{
return [
new \Twig_SimpleFilter(
new TwigFilter(
'marello_format_address',
[$this, 'formatAddress'],
['is_safe' => ['html']]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Marello\Bundle\BankTransferBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class MarelloBankTransferExtension extends Extension
{
const ALIAS = 'marello_bank_transfer';

/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('payment.yml');
$loader->load('integration.yml');
$loader->load('factory.yml');
$loader->load('services.yml');
}

/**
* {@inheritDoc}
*/
public function getAlias()
{
return self::ALIAS;
}
}
Loading

0 comments on commit e6c6ba1

Please sign in to comment.