Skip to content

Commit

Permalink
fix: PLANOS (3) e (4) - ajuste na edicao de planos importados
Browse files Browse the repository at this point in the history
  • Loading branch information
devbizcommerce committed Aug 14, 2024
1 parent a9ea172 commit 7ea1533
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Controller/Adminhtml/VindiPlan/ImportPlans.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
use Vindi\Payment\Model\VindiPlanFactory;
use Vindi\Payment\Model\VindiPlanRepository;
use Vindi\Payment\Model\Vindi\Plan;
use Vindi\Payment\Helper\Data;

/**
* Class ImportPlans
* @package Vindi\Payment\Controller\Adminhtml\VindiPlan
*/
class ImportPlans extends Action
{
Expand Down Expand Up @@ -95,6 +95,12 @@ public function execute()

$vindiplan = $this->vindiplanFactory->create();

$code = $planData['code'] ?? null;
if (empty($code)) {
$name = preg_replace('/[^\p{L}\p{N}\s]/u', '', $planData['name']);
$code = Data::sanitizeItemSku($name);
}

$vindiplan->setData([
'vindi_id' => $planData['id'],
'name' => $planData['name'],
Expand All @@ -104,7 +110,7 @@ public function execute()
'billing_trigger_type' => $planData['billing_trigger_type'],
'billing_trigger_day' => $planData['billing_trigger_day'],
'billing_cycles' => empty($planData['billing_cycles']) ? null : $planData['billing_cycles'],
'code' => $planData['code'],
'code' => $code,
'description' => $planData['description'],
'installments' => $planData['installments'],
'invoice_split' => $planData['invoice_split'],
Expand Down

0 comments on commit 7ea1533

Please sign in to comment.