mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:17:32 -05: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:
		
							parent
							
								
									f712b789ca
								
							
						
					
					
						commit
						c47bf76f48
					
				@ -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',
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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 ?: '',
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user