import rules not applicable in map

This commit is contained in:
denisdulici
2020-02-25 14:56:48 +03:00
parent 695a3ed0b1
commit 34c339ca8d
13 changed files with 82 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ class BillHistories extends Import
{
public function model(array $row)
{
// @todo remove after 3.2 release
// @todo remove after laravel-excel 3.2 release
if ($row['bill_number'] == $this->empty_field) {
return null;
}
@@ -21,9 +21,13 @@ class BillHistories extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['bill_id'] = Bill::number($row['bill_number'])->pluck('id')->first();
$row['bill_id'] = (int) Bill::number($row['bill_number'])->pluck('id')->first();
$row['notify'] = (int) $row['notify'];

View File

@@ -13,7 +13,7 @@ class BillItemTaxes extends Import
{
public function model(array $row)
{
// @todo remove after 3.2 release
// @todo remove after laravel-excel 3.2 release
if ($row['bill_number'] == $this->empty_field) {
return null;
}
@@ -23,9 +23,13 @@ class BillItemTaxes extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['bill_id'] = Bill::number($row['bill_number'])->pluck('id')->first();
$row['bill_id'] = (int) Bill::number($row['bill_number'])->pluck('id')->first();
if (empty($row['invoice_item_id']) && !empty($row['item_name'])) {
$item_id = Item::name($row['item_name'])->pluck('id')->first();

View File

@@ -16,9 +16,13 @@ class BillItems extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['bill_id'] = Bill::number($row['bill_number'])->pluck('id')->first();
$row['bill_id'] = (int) Bill::number($row['bill_number'])->pluck('id')->first();
if (empty($row['item_id']) && !empty($row['item_name'])) {
$row['item_id'] = $this->getItemIdFromName($row);

View File

@@ -16,9 +16,13 @@ class BillTotals extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['bill_id'] = Bill::number($row['bill_number'])->pluck('id')->first();
$row['bill_id'] = (int) Bill::number($row['bill_number'])->pluck('id')->first();
return $row;
}

View File

@@ -15,6 +15,10 @@ class BillTransactions extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['type'] = 'expense';

View File

@@ -15,6 +15,10 @@ class Bills extends Import
public function map($row): array
{
if ($this->isEmpty($row, 'bill_number')) {
return [];
}
$row = parent::map($row);
$row['category_id'] = $this->getCategoryId($row, 'expense');