mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 07:14:36 -04:00
Minor fixes
This commit is contained in:
parent
3f5b338846
commit
c8cf4aca42
@ -25,6 +25,7 @@ return new class extends Migration
|
||||
->cursor()
|
||||
->each(function (Invoice $invoice) {
|
||||
|
||||
$hit = false;
|
||||
|
||||
$line_items = $invoice->line_items;
|
||||
|
||||
@ -35,15 +36,19 @@ return new class extends Migration
|
||||
|
||||
if($product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first())
|
||||
{
|
||||
if((property_exists($item, 'product_cost') && $item->product_cost == 0) || !property_exists($item, 'product_cost'))
|
||||
if((property_exists($item, 'product_cost') && $item->product_cost == 0) || !property_exists($item, 'product_cost')){
|
||||
$hit = true;
|
||||
$line_items[$key]->product_cost = (float)$product->cost;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($hit){
|
||||
$invoice->line_items = $line_items;
|
||||
$invoice->saveQuietly();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user