import rules not applicable in map
This commit is contained in:
		@@ -11,7 +11,7 @@ class InvoiceHistories extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        // @todo remove after 3.2 release
 | 
			
		||||
        // @todo remove after laravel-excel 3.2 release
 | 
			
		||||
        if ($row['invoice_number'] == $this->empty_field) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
@@ -21,9 +21,13 @@ class InvoiceHistories extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['invoice_id'] = Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
        $row['invoice_id'] = (int) Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
 | 
			
		||||
        $row['notify'] = (int) $row['notify'];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ class InvoiceItemTaxes extends Import
 | 
			
		||||
{
 | 
			
		||||
    public function model(array $row)
 | 
			
		||||
    {
 | 
			
		||||
        // @todo remove after 3.2 release
 | 
			
		||||
        // @todo remove after laravel-excel 3.2 release
 | 
			
		||||
        if ($row['invoice_number'] == $this->empty_field) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
@@ -23,9 +23,13 @@ class InvoiceItemTaxes extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['invoice_id'] = Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
        $row['invoice_id'] = (int) Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
 | 
			
		||||
        if (empty($row['invoice_item_id']) && !empty($row['item_name'])) {
 | 
			
		||||
            $item_id = Item::name($row['item_name'])->pluck('id')->first();
 | 
			
		||||
 
 | 
			
		||||
@@ -16,9 +16,13 @@ class InvoiceItems extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['invoice_id'] = Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
        $row['invoice_id'] = (int) Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
 | 
			
		||||
        if (empty($row['item_id']) && !empty($row['item_name'])) {
 | 
			
		||||
            $row['item_id'] = $this->getItemIdFromName($row);
 | 
			
		||||
 
 | 
			
		||||
@@ -16,9 +16,13 @@ class InvoiceTotals extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['invoice_id'] = Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
        $row['invoice_id'] = (int) Invoice::number($row['invoice_number'])->pluck('id')->first();
 | 
			
		||||
 | 
			
		||||
        return $row;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,10 @@ class InvoiceTransactions extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['type'] = 'income';
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,10 @@ class Invoices extends Import
 | 
			
		||||
 | 
			
		||||
    public function map($row): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->isEmpty($row, 'invoice_number')) {
 | 
			
		||||
            return [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $row = parent::map($row);
 | 
			
		||||
 | 
			
		||||
        $row['category_id'] = $this->getCategoryId($row, 'income');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user