Skip to content

Commit

Permalink
exclude "last_seen" from touching
Browse files Browse the repository at this point in the history
  • Loading branch information
theKalash committed Jan 10, 2023
1 parent deada2d commit 0aeba56
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/AlsoImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,21 @@ protected function importLine()
$this->writeLog(($productSupplier->id ? 'update' : 'create').' price of: "'.$product->id.' - '.$product->name);

$productSupplier->supplier_product_id = $this->line['ProductID'];
$productSupplier->last_seen = now();
$productSupplier->save();
$productSupplier->setLastSeen();

$vat = Vat::where('rate', $this->line['VatRate'])->first();

if (!$vat)
throw new Exception('Tax Rate "'.$this->line['VatRate'].'"" not found', 1);

if ($productSupplier->prices->last())
if ($productSupplier->prices->last()->amount == $this->line['NetPrice'])
if ($productSupplier->prices->last()) {
if ($productSupplier->prices->last()->amount == $this->line['NetPrice']) {
return $this;
}
}

$price = Price::create([
Price::create([
'product_supplier_id' => $productSupplier->id,
'amount' => $this->line['NetPrice'],
'vat_id' => $vat->id,
Expand Down

0 comments on commit 0aeba56

Please sign in to comment.