diff --git a/app/Models/Account.php b/app/Models/Account.php index e50c0d36fcc7..3e415e65dfa6 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -332,6 +332,14 @@ class Account extends Eloquent return $this->hasMany('App\Models\Product'); } + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function defaultDocuments() + { + return $this->hasMany('App\Models\Document')->whereIsDefault(true); + } + /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ diff --git a/app/Models/Document.php b/app/Models/Document.php index f1f83436fbf3..90de300f5b81 100644 --- a/app/Models/Document.php +++ b/app/Models/Document.php @@ -24,6 +24,7 @@ class Document extends EntityModel protected $fillable = [ 'invoice_id', 'expense_id', + 'is_default', ]; /** diff --git a/database/migrations/2017_07_18_124150_add_late_fees.php b/database/migrations/2017_07_18_124150_add_late_fees.php index b5fe0f4be135..51aa1ae096f3 100644 --- a/database/migrations/2017_07_18_124150_add_late_fees.php +++ b/database/migrations/2017_07_18_124150_add_late_fees.php @@ -20,6 +20,10 @@ class AddLateFees extends Migration $table->decimal('late_fee3_amount', 13, 2)->nullable(); $table->decimal('late_fee3_percent', 13, 3)->nullable(); }); + + Schema::table('documents', function ($table) { + $table->boolean('is_default')->default(false)->nullable(); + }); } /** @@ -37,5 +41,9 @@ class AddLateFees extends Migration $table->dropColumn('late_fee3_amount'); $table->dropColumn('late_fee3_percent'); }); + + Schema::table('documents', function ($table) { + $table->dropColumn('is_default'); + }); } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 7541afc8e2b4..15a9c76fbc33 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1043,7 +1043,7 @@ $LANG = array( 'invoice_item_fields' => 'Invoice Item Fields', 'custom_invoice_item_fields_help' => 'Add a field when creating an invoice item and display the label and value on the PDF.', 'recurring_invoice_number' => 'Recurring Number', - 'recurring_invoice_number_prefix_help' => 'Speciy a prefix to be added to the invoice number for recurring invoices. The default value is \'R\'.', + 'recurring_invoice_number_prefix_help' => 'Speciy a prefix to be added to the invoice number for recurring invoices.', // Client Passwords 'enable_portal_password' => 'Password Protect Invoices', @@ -2316,6 +2316,7 @@ $LANG = array( 'downloaded_invoices' => 'An email will be sent with the invoice PDFs', 'downloaded_quotes' => 'An email will be sent with the quote PDFs', 'clone_expense' => 'Clone Expense', + 'default_documents' => 'Default Documents', ); diff --git a/resources/views/accounts/invoice_settings.blade.php b/resources/views/accounts/invoice_settings.blade.php index 2826bd0d60ad..65ec0bc27579 100644 --- a/resources/views/accounts/invoice_settings.blade.php +++ b/resources/views/accounts/invoice_settings.blade.php @@ -328,7 +328,7 @@