diff --git a/app/DataMapper/InvoiceItem.php b/app/DataMapper/InvoiceItem.php index e66b18f39c..96048850b0 100644 --- a/app/DataMapper/InvoiceItem.php +++ b/app/DataMapper/InvoiceItem.php @@ -51,10 +51,10 @@ class InvoiceItem public $custom_value4 = ''; - public $invoice_item_type_id = 1; //1 = product, 2 = service + public $line_item_type_id = 1; //1 = product, 2 = service, 3 unpaid gateway fee, 4 paid gateway fee public static $casts = [ - 'invoice_item_type_id' => 'string', + 'line_item_type_id' => 'string', 'quantity' => 'float', 'cost' => 'float', 'product_key' => 'string', diff --git a/app/Libraries/MultiDB.php b/app/Libraries/MultiDB.php index 9a2a56efc4..e2581f2b7d 100644 --- a/app/Libraries/MultiDB.php +++ b/app/Libraries/MultiDB.php @@ -59,12 +59,15 @@ class MultiDB //multi-db active foreach (self::$dbs as $db) { - if (Company::whereSubdomain($subdomain)->get()->count() >=1) { + + if (Company::on($db)->whereSubdomain($subdomain)->get()->count() >=1) { return false; } + } self::setDefaultDatabase(); + return true; } diff --git a/app/Transformers/InvoiceItemTransformer.php b/app/Transformers/InvoiceItemTransformer.php index 843a1880a3..8e706487f1 100644 --- a/app/Transformers/InvoiceItemTransformer.php +++ b/app/Transformers/InvoiceItemTransformer.php @@ -27,7 +27,7 @@ class InvoiceItemTransformer extends EntityTransformer 'tax_rate1' => (float) ($item->tax_rate1 ?: 0.0), 'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '', 'tax_rate2' => (float) ($item->tax_rate2 ?: 0.0), - 'invoice_item_type_id' => (string) $item->invoice_item_type_id ?: '', + 'line_item_type_id' => (string) $item->line_item_type_id ?: '', 'custom_value1' => $item->custom_value1 ?: '', 'custom_value2' => $item->custom_value2 ?: '', 'discount' => (float) $item->discount ?: '', diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index 1c6ba421d3..5e17400cc7 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -66,25 +66,25 @@ trait MockAccountData $cached_tables = config('ninja.cached_tables'); foreach ($cached_tables as $name => $class) { - if (! Cache::has($name)) { - // check that the table exists in case the migration is pending - if (! Schema::hasTable((new $class())->getTable())) { - continue; - } - if ($name == 'payment_terms') { - $orderBy = 'num_days'; - } elseif ($name == 'fonts') { - $orderBy = 'sort_order'; - } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) { - $orderBy = 'name'; - } else { - $orderBy = 'id'; - } - $tableData = $class::orderBy($orderBy)->get(); - if ($tableData->count()) { - Cache::forever($name, $tableData); - } + + // check that the table exists in case the migration is pending + if (! Schema::hasTable((new $class())->getTable())) { + continue; } + if ($name == 'payment_terms') { + $orderBy = 'num_days'; + } elseif ($name == 'fonts') { + $orderBy = 'sort_order'; + } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) { + $orderBy = 'name'; + } else { + $orderBy = 'id'; + } + $tableData = $class::orderBy($orderBy)->get(); + if ($tableData->count()) { + Cache::forever($name, $tableData); + } + }