mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
fixes for company table types
This commit is contained in:
parent
9731054125
commit
b4dfabd684
@ -177,7 +177,7 @@ class CompanyTransformer extends EntityTransformer
|
||||
'inventory_notification_threshold' => (int) $company->inventory_notification_threshold,
|
||||
'track_inventory' => (bool) $company->track_inventory,
|
||||
'enable_applying_payments' => (bool) $company->enable_applying_payments,
|
||||
'enabled_expense_tax_rates' => (bool) $company->enabled_expense_tax_rates,
|
||||
'enabled_expense_tax_rates' => (int) $company->enabled_expense_tax_rates,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
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()
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->unsignedInteger('enabled_expense_tax_rates')->default(0)->change();
|
||||
});
|
||||
|
||||
Company::query()->where('enabled_item_tax_rates', true)->cursor()->each(function ($company){
|
||||
|
||||
$company->enabled_expense_tax_rates = $company->enabled_item_tax_rates;
|
||||
$company->save();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user