mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-21 12:00:55 -04:00
Add default tax rates to check data
This commit is contained in:
parent
33c51091b8
commit
fa9b68063d
@ -248,6 +248,7 @@ class CheckData extends Command
|
|||||||
],
|
],
|
||||||
'products' => [
|
'products' => [
|
||||||
ENTITY_USER,
|
ENTITY_USER,
|
||||||
|
ENTITY_TAX_RATE,
|
||||||
],
|
],
|
||||||
'vendors' => [
|
'vendors' => [
|
||||||
ENTITY_USER,
|
ENTITY_USER,
|
||||||
@ -262,14 +263,28 @@ class CheckData extends Command
|
|||||||
ENTITY_USER,
|
ENTITY_USER,
|
||||||
ENTITY_CLIENT,
|
ENTITY_CLIENT,
|
||||||
],
|
],
|
||||||
|
'accounts' => [
|
||||||
|
ENTITY_TAX_RATE,
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($tables as $table => $entityTypes) {
|
foreach ($tables as $table => $entityTypes) {
|
||||||
foreach ($entityTypes as $entityType) {
|
foreach ($entityTypes as $entityType) {
|
||||||
$tableName = Utils::pluralizeEntityType($entityType);
|
$tableName = Utils::pluralizeEntityType($entityType);
|
||||||
|
if ($entityType == ENTITY_TAX_RATE) {
|
||||||
|
$field = 'default_' . $entityType;
|
||||||
|
} else {
|
||||||
|
$field = $entityType;
|
||||||
|
}
|
||||||
|
if ($table == 'accounts') {
|
||||||
|
$accountId = 'id';
|
||||||
|
} else {
|
||||||
|
$accountId = 'account_id';
|
||||||
|
}
|
||||||
|
|
||||||
$records = DB::table($table)
|
$records = DB::table($table)
|
||||||
->join($tableName, "{$tableName}.id", '=', "{$table}.{$entityType}_id")
|
->join($tableName, "{$tableName}.id", '=', "{$table}.{$field}_id")
|
||||||
->where("{$table}.account_id", '!=', DB::raw("{$tableName}.account_id"))
|
->where("{$table}.{$accountId}", '!=', DB::raw("{$tableName}.account_id"))
|
||||||
->get(["{$table}.id"]);
|
->get(["{$table}.id"]);
|
||||||
|
|
||||||
if (count($records)) {
|
if (count($records)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user