1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Change invoice_item_type_id to line_item_type_id (#3187)

* fix typo

* php-cs traits

* CS fixer pass

* Password protect User routes

* Implement checks to prevent editing a deleted record

* Clean up payment flows

* Fixes for tests

* Fix for missing

* Change invoice_item_type_id to line_item_type_id
This commit is contained in:
David Bomba 2020-01-02 10:09:34 +11:00 committed by GitHub
parent f712b789ca
commit c47bf76f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 22 deletions

View File

@ -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',

View File

@ -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;
}

View File

@ -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 ?: '',

View File

@ -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);
}
}