mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactor to use vendor currencies for purchase orders
This commit is contained in:
parent
e595105f69
commit
d61620bcf6
@ -991,7 +991,7 @@ class CheckData extends Command
|
|||||||
if ($this->option('fix') == 'true')
|
if ($this->option('fix') == 'true')
|
||||||
{
|
{
|
||||||
|
|
||||||
Vendor::query()->whereNull('currency_id')->cursor()->each(function ($vendor){
|
Vendor::query()->whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor){
|
||||||
|
|
||||||
$vendor->currency_id = $vendor->company->settings->currency_id;
|
$vendor->currency_id = $vendor->company->settings->currency_id;
|
||||||
$vendor->save();
|
$vendor->save();
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Vendor;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Vendor::query()->whereNull('currency_id')->orWhere('currency_id', '')->cursor()->each(function ($vendor){
|
||||||
|
|
||||||
|
$vendor->currency_id = $vendor->company->settings->currency_id;
|
||||||
|
$vendor->save();
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user