-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/MAR10001-880' into merge-service-points-30
- Loading branch information
Showing
159 changed files
with
5,924 additions
and
630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Marello/Bundle/CatalogBundle/Migrations/Schema/v1_2/MarelloCatalogBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\CatalogBundle\Migrations\Schema\v1_2; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD.TooManyMethods) | ||
*/ | ||
class MarelloCatalogBundle implements Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$this->changeMarelloCatalogCategoryUniqueIndex($schema); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
*/ | ||
protected function changeMarelloCatalogCategoryUniqueIndex(Schema $schema) | ||
{ | ||
$table = $schema->getTable('marello_catalog_category'); | ||
$table->dropIndex('marello_catalog_category_codeidx'); | ||
$table->addUniqueIndex(['code', 'organization_id'], 'marello_catalog_category_codeorgidx'); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/Marello/Bundle/CatalogBundle/Resources/config/validation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
src/Marello/Bundle/DataGridBundle/Extension/Totals/OrmTotalsExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\DataGridBundle\Extension\Totals; | ||
|
||
use Oro\Bundle\DataGridBundle\Extension\Formatter\Property\PropertyInterface; | ||
use Oro\Bundle\DataGridBundle\Extension\Totals\Configuration; | ||
use Oro\Bundle\DataGridBundle\Extension\Totals\OrmTotalsExtension as BaseOrmTotalsExtension; | ||
|
||
class OrmTotalsExtension extends BaseOrmTotalsExtension | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getTotalData($rowConfig, $data) | ||
{ | ||
if (empty($data)) { | ||
return []; | ||
} | ||
|
||
$columns = []; | ||
foreach ($rowConfig['columns'] as $field => $total) { | ||
$column = []; | ||
if (isset($data[$field])) { | ||
$totalValue = $data[$field]; | ||
if (isset($total[Configuration::TOTALS_DIVISOR_KEY])) { | ||
$divisor = (int) $total[Configuration::TOTALS_DIVISOR_KEY]; | ||
if ($divisor != 0) { | ||
$totalValue = $totalValue / $divisor; | ||
} | ||
} | ||
if (isset($total[Configuration::TOTALS_FORMATTER_KEY])) { | ||
if ($total[Configuration::TOTALS_FORMATTER_KEY] === 'currency' && isset($data['currency'])) { | ||
$totalValue = $this->applyFrontendFormatting( | ||
[$totalValue, $data['currency']], | ||
$total[Configuration::TOTALS_FORMATTER_KEY] | ||
); | ||
} else { | ||
$totalValue = $this->applyFrontendFormatting( | ||
$totalValue, | ||
$total[Configuration::TOTALS_FORMATTER_KEY] | ||
); | ||
} | ||
} | ||
$column['total'] = $totalValue; | ||
} | ||
if (isset($total[Configuration::TOTALS_LABEL_KEY])) { | ||
$column[Configuration::TOTALS_LABEL_KEY] = | ||
$this->translator->trans($total[Configuration::TOTALS_LABEL_KEY]); | ||
} | ||
$columns[$field] = $column; | ||
}; | ||
|
||
return ['columns' => $columns]; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function applyFrontendFormatting($val = null, $formatter = null) | ||
{ | ||
if (null === $formatter) { | ||
return $val; | ||
} | ||
|
||
switch ($formatter) { | ||
case PropertyInterface::TYPE_DATE: | ||
$val = $this->dateTimeFormatter->formatDate($val); | ||
break; | ||
case PropertyInterface::TYPE_DATETIME: | ||
$val = $this->dateTimeFormatter->format($val); | ||
break; | ||
case PropertyInterface::TYPE_TIME: | ||
$val = $this->dateTimeFormatter->formatTime($val); | ||
break; | ||
case PropertyInterface::TYPE_DECIMAL: | ||
$val = $this->numberFormatter->formatDecimal($val); | ||
break; | ||
case PropertyInterface::TYPE_INTEGER: | ||
$val = $this->numberFormatter->formatDecimal($val); | ||
break; | ||
case PropertyInterface::TYPE_PERCENT: | ||
$val = $this->numberFormatter->formatPercent($val); | ||
break; | ||
case PropertyInterface::TYPE_CURRENCY: | ||
$val = is_array($val) ? | ||
$this->numberFormatter->formatCurrency($val[0], $val[1]) : | ||
$this->numberFormatter->formatCurrency($val); | ||
break; | ||
} | ||
|
||
return $val; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Marello/Bundle/DemoDataBundle/Migrations/Data/Demo/ORM/LoadSalesChannelTypesData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\DemoDataBundle\Migrations\Data\Demo\ORM; | ||
|
||
use Marello\Bundle\SalesBundle\Migrations\Data\ORM\LoadSalesChannelTypesData as BaseLoadSalesChannelTypesData; | ||
|
||
class LoadSalesChannelTypesData extends BaseLoadSalesChannelTypesData | ||
{ | ||
/** @var array */ | ||
protected $data = [ | ||
'pos' => 'Pos', | ||
'webshop' => 'Webshop', | ||
'marketplace' => 'Marketplace' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...rello/Bundle/InventoryBundle/Migrations/Schema/v2_5/UpdateInventoryLevelLogForeignKey.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Marello\Bundle\InventoryBundle\Migrations\Schema\v2_5; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\OrderedMigrationInterface; | ||
|
||
class UpdateInventoryLevelLogForeignKey implements Migration | ||
{ | ||
const INVENTORY_LEVEL_LOG_TABLE_NAME = 'marello_inventory_level_log'; | ||
const INVENTORY_LEVEL_TABLE_NAME = 'marello_inventory_level'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$this->updateInventoryLevelLogForeignKeyConstraint($schema, $queries); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* @param Schema $schema | ||
* @param QueryBag $queries | ||
* @throws \Doctrine\DBAL\Schema\SchemaException | ||
*/ | ||
protected function updateInventoryLevelLogForeignKeyConstraint(Schema $schema, $queries) | ||
{ | ||
$table = $schema->getTable(self::INVENTORY_LEVEL_LOG_TABLE_NAME); | ||
$table->addIndex(['inventory_level_id']); | ||
$table->addForeignKeyConstraint( | ||
$schema->getTable(self::INVENTORY_LEVEL_TABLE_NAME), | ||
['inventory_level_id'], | ||
['id'], | ||
['onDelete' => 'SET NULL', 'onUpdate' => null] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.