mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 08:07:33 -04:00 
			
		
		
		
	Working on custom fields
This commit is contained in:
		
							parent
							
								
									ab99ef0739
								
							
						
					
					
						commit
						7067ae72bf
					
				| @ -158,7 +158,7 @@ if (! defined('APP_NAME')) { | ||||
|     define('MAX_DOCUMENT_SIZE', env('MAX_DOCUMENT_SIZE', 10000)); // KB
 | ||||
|     define('MAX_EMAIL_DOCUMENTS_SIZE', env('MAX_EMAIL_DOCUMENTS_SIZE', 10000)); // Total KB
 | ||||
|     define('MAX_ZIP_DOCUMENTS_SIZE', env('MAX_EMAIL_DOCUMENTS_SIZE', 30000)); // Total KB (uncompressed)
 | ||||
|     define('MAX_EMAILS_SENT_PER_DAY', 200); | ||||
|     define('MAX_EMAILS_SENT_PER_DAY', 300); | ||||
|     define('DOCUMENT_PREVIEW_SIZE', env('DOCUMENT_PREVIEW_SIZE', 300)); // pixels
 | ||||
|     define('DEFAULT_FONT_SIZE', 9); | ||||
|     define('DEFAULT_HEADER_FONT', 1); // Roboto
 | ||||
|  | ||||
| @ -72,22 +72,12 @@ class Account extends Eloquent | ||||
|         'work_phone', | ||||
|         'work_email', | ||||
|         'language_id', | ||||
|         'custom_label1', | ||||
|         'custom_value1', | ||||
|         'custom_label2', | ||||
|         'custom_value2', | ||||
|         'custom_client_label1', | ||||
|         'custom_client_label2', | ||||
|         'fill_products', | ||||
|         'update_products', | ||||
|         'primary_color', | ||||
|         'secondary_color', | ||||
|         'hide_quantity', | ||||
|         'hide_paid_to_date', | ||||
|         'custom_invoice_label1', | ||||
|         'custom_invoice_label2', | ||||
|         'custom_invoice_taxes1', | ||||
|         'custom_invoice_taxes2', | ||||
|         'vat_number', | ||||
|         'invoice_number_prefix', | ||||
|         'invoice_number_counter', | ||||
| @ -112,8 +102,6 @@ class Account extends Eloquent | ||||
|         'num_days_reminder1', | ||||
|         'num_days_reminder2', | ||||
|         'num_days_reminder3', | ||||
|         'custom_invoice_text_label1', | ||||
|         'custom_invoice_text_label2', | ||||
|         'tax_name1', | ||||
|         'tax_rate1', | ||||
|         'tax_name2', | ||||
| @ -142,8 +130,6 @@ class Account extends Eloquent | ||||
|         'show_currency_code', | ||||
|         'enable_portal_password', | ||||
|         'send_portal_password', | ||||
|         'custom_invoice_item_label1', | ||||
|         'custom_invoice_item_label2', | ||||
|         'recurring_invoice_number_prefix', | ||||
|         'enable_client_portal', | ||||
|         'invoice_fields', | ||||
|  | ||||
							
								
								
									
										32
									
								
								app/Models/AccountCustomSettings.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Models/AccountCustomSettings.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Models; | ||||
| 
 | ||||
| use Eloquent; | ||||
| 
 | ||||
| /** | ||||
|  * Class Account. | ||||
|  */ | ||||
| class AccountCustomSettings extends Eloquent | ||||
| { | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $fillable = [ | ||||
|         'custom_label1', | ||||
|         'custom_value1', | ||||
|         'custom_label2', | ||||
|         'custom_value2', | ||||
|         'custom_client_label1', | ||||
|         'custom_client_label2', | ||||
|         'custom_invoice_label1', | ||||
|         'custom_invoice_label2', | ||||
|         'custom_invoice_taxes1', | ||||
|         'custom_invoice_taxes2', | ||||
|         'custom_invoice_text_label1', | ||||
|         'custom_invoice_text_label2', | ||||
|         'custom_invoice_item_label1', | ||||
|         'custom_invoice_item_label2',         | ||||
|     ]; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,99 @@ | ||||
| <?php | ||||
| 
 | ||||
| use Illuminate\Support\Facades\Schema; | ||||
| use Illuminate\Database\Schema\Blueprint; | ||||
| use Illuminate\Database\Migrations\Migration; | ||||
| 
 | ||||
| class AddMoreCustomFields extends Migration | ||||
| { | ||||
|     /** | ||||
|      * Run the migrations. | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function up() | ||||
|     { | ||||
|         Schema::create('account_custom_settings', function ($table) { | ||||
|             $table->increments('id'); | ||||
|             $table->unsignedInteger('account_id')->index(); | ||||
|             $table->timestamps(); | ||||
| 
 | ||||
|             $table->string('custom_account_label1')->nullable(); | ||||
|             $table->string('custom_account_value1')->nullable(); | ||||
|             $table->string('custom_account_label2')->nullable(); | ||||
|             $table->string('custom_account_value2')->nullable(); | ||||
|             $table->string('custom_client_label1')->nullable(); | ||||
|             $table->string('custom_client_label2')->nullable(); | ||||
|             $table->string('custom_invoice_label1')->nullable(); | ||||
|             $table->string('custom_invoice_label2')->nullable(); | ||||
|             $table->string('custom_invoice_taxes1')->nullable(); | ||||
|             $table->string('custom_invoice_taxes2')->nullable(); | ||||
|             $table->string('custom_invoice_text_label1')->nullable(); | ||||
|             $table->string('custom_invoice_text_label2')->nullable(); | ||||
|             $table->string('custom_product_label1')->nullable(); | ||||
|             $table->string('custom_product_label2')->nullable(); | ||||
| 
 | ||||
|             $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); | ||||
|         }); | ||||
| 
 | ||||
|         DB::statement('insert into account_custom_settings (account_id, | ||||
|                 custom_account_label1, | ||||
|                 custom_account_value1, | ||||
|                 custom_account_label2, | ||||
|                 custom_account_value2, | ||||
|                 custom_client_label1, | ||||
|                 custom_client_label2, | ||||
|                 custom_invoice_label1, | ||||
|                 custom_invoice_label2, | ||||
|                 custom_invoice_taxes1, | ||||
|                 custom_invoice_taxes2, | ||||
|                 custom_invoice_text_label1, | ||||
|                 custom_invoice_text_label2, | ||||
|                 custom_product_label1, | ||||
|                 custom_product_label2 | ||||
|             ) | ||||
|             select id, | ||||
|                 custom_label1, | ||||
|                 custom_value1, | ||||
|                 custom_label2, | ||||
|                 custom_value2, | ||||
|                 custom_client_label1, | ||||
|                 custom_client_label2, | ||||
|                 custom_invoice_label1, | ||||
|                 custom_invoice_label2, | ||||
|                 custom_invoice_taxes1, | ||||
|                 custom_invoice_taxes2, | ||||
|                 custom_invoice_text_label1, | ||||
|                 custom_invoice_text_label2, | ||||
|                 custom_invoice_item_label1, | ||||
|                 custom_invoice_item_label2 | ||||
|             from accounts;'); | ||||
| 
 | ||||
|         Schema::table('accounts', function ($table) { | ||||
|             $table->dropColumn('custom_label1'); | ||||
|             $table->dropColumn('custom_value1'); | ||||
|             $table->dropColumn('custom_label2'); | ||||
|             $table->dropColumn('custom_value2'); | ||||
|             $table->dropColumn('custom_client_label1'); | ||||
|             $table->dropColumn('custom_client_label2'); | ||||
|             $table->dropColumn('custom_invoice_label1'); | ||||
|             $table->dropColumn('custom_invoice_label2'); | ||||
|             $table->dropColumn('custom_invoice_taxes1'); | ||||
|             $table->dropColumn('custom_invoice_taxes2'); | ||||
|             $table->dropColumn('custom_invoice_text_label1'); | ||||
|             $table->dropColumn('custom_invoice_text_label2'); | ||||
|             $table->dropColumn('custom_invoice_item_label1'); | ||||
|             $table->dropColumn('custom_invoice_item_label2'); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Reverse the migrations. | ||||
|      * | ||||
|      * @return void | ||||
|      */ | ||||
|     public function down() | ||||
|     { | ||||
|         //
 | ||||
|     } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user