mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 12:24:30 -04:00
Fixes for migration
This commit is contained in:
parent
40e078b4e1
commit
974b342333
@ -1 +1 @@
|
||||
5.8.5
|
||||
5.8.6
|
@ -17,8 +17,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => env('APP_VERSION', '5.8.5'),
|
||||
'app_tag' => env('APP_TAG', '5.8.5'),
|
||||
'app_version' => env('APP_VERSION', '5.8.6'),
|
||||
'app_tag' => env('APP_TAG', '5.8.6'),
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
@ -31,10 +31,12 @@ return new class extends Migration
|
||||
foreach ($line_items as $key => $item)
|
||||
{
|
||||
|
||||
if($item?->product_cost == 0 && $product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first())
|
||||
if($product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first())
|
||||
{
|
||||
$line_items[$key]->product_cost = $product->cost;
|
||||
if((property_exists($item, 'product_cost') && $item->product_cost == 0) || !property_exists($item, 'product_cost'))
|
||||
$line_items[$key]->product_cost = $product->cost;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$invoice->line_items = $line_items;
|
||||
|
@ -95,19 +95,22 @@ class ProductTest extends TestCase
|
||||
->cursor()
|
||||
->each(function (Invoice $invoice) {
|
||||
|
||||
|
||||
$line_items = $invoice->line_items;
|
||||
|
||||
foreach ($line_items as $key => $item) {
|
||||
|
||||
if(property_exists($item, 'product_cost') && $item->product_cost == 0 && $product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first()) {
|
||||
$line_items[$key]->product_cost = $product->cost;
|
||||
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')) {
|
||||
$line_items[$key]->product_cost = $product->cost;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$invoice->line_items = $line_items;
|
||||
$invoice->saveQuietly();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user