diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index 5f3fbe52..05d4b6da 100644 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -3,9 +3,9 @@ namespace Pagarme\Pagarme\Setup; use Magento\Framework\DB\Ddl\Table; -use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\Framework\Setup\UpgradeSchemaInterface; class UpgradeSchema implements UpgradeSchemaInterface { @@ -14,9 +14,10 @@ class UpgradeSchema implements UpgradeSchemaInterface * {@inheritdoc} */ public function upgrade( - SchemaSetupInterface $setup, + SchemaSetupInterface $setup, ModuleContextInterface $context - ) { + ) + { $setup->startSetup(); $version = $context->getVersion(); $installSchema = new InstallSchema(); @@ -27,41 +28,53 @@ public function upgrade( if (version_compare($version, '2.2.5', '<')) { $connection = $setup->getConnection(); - $connection->addColumn( - $setup->getTable('pagarme_module_core_recurrence_products_plan'), - 'apply_discount_in_all_product_cycles', - [ - 'type' => Table::TYPE_SMALLINT, - 'length' => 1, - 'nullable' => true, - 'comment' => 'Apply products cycle to discount' - ] - ); + if ($connection->tableColumnExists( + 'pagarme_module_core_recurrence_products_plan', + 'apply_discount_in_all_product_cycles' + ) === false) { + $connection->addColumn( + $setup->getTable('pagarme_module_core_recurrence_products_plan'), + 'apply_discount_in_all_product_cycles', + [ + 'type' => Table::TYPE_SMALLINT, + 'length' => 1, + 'nullable' => true, + 'comment' => 'Apply products cycle to discount' + ] + ); + } - $connection->addColumn( - $setup->getTable('pagarme_module_core_recurrence_products_subscription'), - 'apply_discount_in_all_product_cycles', - [ - 'type' => Table::TYPE_SMALLINT, - 'length' => 1, - 'nullable' => true, - 'comment' => 'Apply products cycle to discount' - ] - ); + if ($connection->tableColumnExists( + 'pagarme_module_core_recurrence_products_subscription', + 'apply_discount_in_all_product_cycles' + ) === false) { + $connection->addColumn( + $setup->getTable('pagarme_module_core_recurrence_products_subscription'), + 'apply_discount_in_all_product_cycles', + [ + 'type' => Table::TYPE_SMALLINT, + 'length' => 1, + 'nullable' => true, + 'comment' => 'Apply products cycle to discount' + ] + ); + } } if (version_compare($context->getVersion(), '2.5.0', '<')) { - $setup->getConnection()->changeColumn( - $setup->getTable('pagarme_module_core_recipients'), - 'document_type', - 'type', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => 11, - 'nullable' => 'false', - 'comment' => 'Recipient document type: individual (CPF) or corporation (CNPJ)' - ] - ); + if ($setup->getConnection()->tableColumnExists('pagarme_module_core_recipients', 'type') === false) { + $setup->getConnection()->changeColumn( + $setup->getTable('pagarme_module_core_recipients'), + 'document_type', + 'type', + [ + 'type' => Table::TYPE_TEXT, + 'length' => 11, + 'nullable' => 'false', + 'comment' => 'Recipient document type: individual (CPF) or corporation (CNPJ)' + ] + ); + } } $setup->endSetup(); diff --git a/view/adminhtml/web/css/pagarme_style.css b/view/adminhtml/web/css/pagarme_style.css index cf754e42..35bbf85e 100644 --- a/view/adminhtml/web/css/pagarme_style.css +++ b/view/adminhtml/web/css/pagarme_style.css @@ -175,7 +175,8 @@ table.table-cycles { .data-grid td .recipient-status-disapproved, .data-grid td .recipient-status-suspended, .data-grid td .recipient-status-blocked, -.data-grid td .recipient-status-inactive { +.data-grid td .recipient-status-inactive, +.data-grid td .recipient-status-refused { background-color: #f9d4d4; border-color: #e22626; color: #e22626; diff --git a/view/adminhtml/web/js/grid/columns/recipientStatus.js b/view/adminhtml/web/js/grid/columns/recipientStatus.js index e813628a..634718c3 100644 --- a/view/adminhtml/web/js/grid/columns/recipientStatus.js +++ b/view/adminhtml/web/js/grid/columns/recipientStatus.js @@ -55,6 +55,9 @@ define([ case 'blocked': statusLabel = 'Bloqueado' break; + case 'refused': + statusLabel = 'Recusado' + break; case 'inactive': statusLabel = 'Inativo' break;