Fixes for adjust product inventory

This commit is contained in:
David Bomba 2023-04-03 23:40:57 +10:00
parent 4bbd4c9393
commit 8ed37fb2d7
3 changed files with 6 additions and 7 deletions

View File

@ -13,7 +13,7 @@ namespace App\DataMapper\Tax;
class TaxModel class TaxModel
{ {
public string $seller_region = 'US'; // public string $seller_region = 'US';
public string $seller_subregion = 'CA'; public string $seller_subregion = 'CA';
@ -45,7 +45,7 @@ class TaxModel
private function usRegion(): self private function usRegion(): self
{ {
$this->regions->US->has_sales_above_threshold = false; $this->regions->US->has_sales_above_threshold = false;
$this->regions->US->tax_all = false; $this->regions->US->tax_all_subregions = false;
$this->usSubRegions(); $this->usSubRegions();
return $this; return $this;

View File

@ -115,9 +115,9 @@ class AdjustProductInventory implements ShouldQueue
$p->in_stock_quantity -= $i->quantity; $p->in_stock_quantity -= $i->quantity;
$p->saveQuietly(); $p->saveQuietly();
nlog($p->stock_notification_threshold); nlog("threshold ".$p->stock_notification_threshold);
nlog($p->in_stock_quantity); nlog("stock q".$p->in_stock_quantity);
nlog($p->stock_notification_threshold); nlog("p stock not".$p->stock_notification_threshold);
if ($this->company->stock_notification && $p->stock_notification && $p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold) { if ($this->company->stock_notification && $p->stock_notification && $p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold) {
$this->notifyStockLevels($p, 'product'); $this->notifyStockLevels($p, 'product');
@ -131,7 +131,7 @@ class AdjustProductInventory implements ShouldQueue
private function existingInventoryAdjustment() private function existingInventoryAdjustment()
{ {
collect($this->invoice->line_items)->filter(function ($item) { collect($this->old_invoice)->filter(function ($item) {
return $item->type_id == '1'; return $item->type_id == '1';
})->each(function ($i) { })->each(function ($i) {
$p = Product::where('product_key', $i->product_key)->where('company_id', $this->company->id)->first(); $p = Product::where('product_key', $i->product_key)->where('company_id', $this->company->id)->first();

View File

@ -114,7 +114,6 @@ class Product extends BaseModel
use SoftDeletes; use SoftDeletes;
use Filterable; use Filterable;
public const PRODUCT_TYPE_PHYSICAL = 1; public const PRODUCT_TYPE_PHYSICAL = 1;
public const PRODUCT_TYPE_SERVICE = 2; public const PRODUCT_TYPE_SERVICE = 2;
public const PRODUCT_TYPE_DIGITAL = 3; public const PRODUCT_TYPE_DIGITAL = 3;