diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index f35a75f510..d4870fb568 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -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, ]; } diff --git a/database/migrations/2022_07_29_091235_correction_for_companies_table_types.php b/database/migrations/2022_07_29_091235_correction_for_companies_table_types.php new file mode 100644 index 0000000000..45564710b6 --- /dev/null +++ b/database/migrations/2022_07_29_091235_correction_for_companies_table_types.php @@ -0,0 +1,38 @@ +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() + { + // + } +};