From d0bd49e0a620cc874bbe59e113b40b4685c4e765 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 12 Jan 2018 15:15:58 +0200 Subject: [PATCH] Working on UBL --- app/Jobs/ConvertInvoiceToUbl.php | 4 ++-- app/Models/Account.php | 1 + composer.json | 2 +- composer.lock | 14 +++++++------- .../2018_01_10_073825_add_subscription_format.php | 8 ++++++++ resources/lang/en/texts.php | 3 ++- resources/views/accounts/email_settings.blade.php | 5 +++++ 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/Jobs/ConvertInvoiceToUbl.php b/app/Jobs/ConvertInvoiceToUbl.php index 96ff8ebe7d57..b0b742082dc8 100644 --- a/app/Jobs/ConvertInvoiceToUbl.php +++ b/app/Jobs/ConvertInvoiceToUbl.php @@ -106,7 +106,7 @@ class ConvertInvoiceToUbl extends Job if ($item->tax_name1 || $item->tax_rate1) { $taxtotal = (new TaxTotal()) ->setTaxAmount(10) - ->setTaxSubTotal((new TaxSubTotal()) + ->addTaxSubTotal((new TaxSubTotal()) ->setTaxAmount(10) ->setTaxableAmount(100) ->setTaxCategory((new TaxCategory()) @@ -124,7 +124,7 @@ class ConvertInvoiceToUbl extends Job if ($invoice->tax_name1 || $invoice->tax_rate1) { $taxtotal = (new TaxTotal()) ->setTaxAmount(10) - ->setTaxSubTotal((new TaxSubTotal()) + ->addTaxSubTotal((new TaxSubTotal()) ->setTaxAmount(10) ->setTaxableAmount(100) ->setTaxCategory((new TaxCategory()) diff --git a/app/Models/Account.php b/app/Models/Account.php index a0bfc05c4137..e5590d49191a 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -146,6 +146,7 @@ class Account extends Eloquent 'invoice_fields', 'invoice_embed_documents', 'document_email_attachment', + 'ubl_email_attachment', 'enable_client_portal_dashboard', 'page_size', 'live_preview', diff --git a/composer.json b/composer.json index dad99cc83b06..bc1e8c41de40 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "barryvdh/laravel-ide-helper": "~2.2", "cerdic/css-tidy": "~v1.5", "chumper/datatable": "dev-develop#04ef2bf", - "cleverit/ubl_invoice": "^0.1.1", + "cleverit/ubl_invoice": "1.*", "codedge/laravel-selfupdater": "5.x-dev", "collizo4sky/omnipay-wepay": "dev-address-fix", "digitickets/omnipay-gocardlessv2": "dev-payment-fix", diff --git a/composer.lock b/composer.lock index 800176ca7fe9..ca297c177f6d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a0b0eb9c2d63d3d2cbd24eb98f18f001", - "content-hash": "231a35f4b2351f92f781e063b965e861", + "hash": "cb8a64c60286537ef9f496d1fb7b17d6", + "content-hash": "b74be03e96ee322cbf4ddf19ed15686d", "packages": [ { "name": "abdala/omnipay-pagseguro", @@ -1085,16 +1085,16 @@ }, { "name": "cleverit/ubl_invoice", - "version": "v0.1.1", + "version": "v1.0", "source": { "type": "git", "url": "https://github.com/CleverIT/UBL_invoice.git", - "reference": "81931c88732393cef78afa78c8c33fc7a9024843" + "reference": "3c4ec1dd8dc826d6c8302e191565b8ac1a947022" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CleverIT/UBL_invoice/zipball/81931c88732393cef78afa78c8c33fc7a9024843", - "reference": "81931c88732393cef78afa78c8c33fc7a9024843", + "url": "https://api.github.com/repos/CleverIT/UBL_invoice/zipball/3c4ec1dd8dc826d6c8302e191565b8ac1a947022", + "reference": "3c4ec1dd8dc826d6c8302e191565b8ac1a947022", "shasum": "" }, "require": { @@ -1133,7 +1133,7 @@ "xml", "xml invoice" ], - "time": "2017-01-17 09:08:26" + "time": "2018-01-11 19:26:20" }, { "name": "codedge/laravel-selfupdater", diff --git a/database/migrations/2018_01_10_073825_add_subscription_format.php b/database/migrations/2018_01_10_073825_add_subscription_format.php index 922cd5816d54..3b8d77ea177a 100644 --- a/database/migrations/2018_01_10_073825_add_subscription_format.php +++ b/database/migrations/2018_01_10_073825_add_subscription_format.php @@ -16,6 +16,10 @@ class AddSubscriptionFormat extends Migration Schema::table('subscriptions', function ($table) { $table->enum('format', ['JSON', 'UBL'])->default('JSON'); }); + + Schema::table('accounts', function ($table) { + $table->boolean('ubl_email_attachment')->default(false); + }); } /** @@ -28,5 +32,9 @@ class AddSubscriptionFormat extends Migration Schema::table('subscriptions', function ($table) { $table->dropColumn('format'); }); + + Schema::table('accounts', function ($table) { + $table->dropColumn('ubl_email_attachment'); + }); } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index ba884ab30e42..08702d5e61e2 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -186,7 +186,7 @@ $LANG = array( 'clients_will_create' => 'clients will be created', 'email_settings' => 'Email Settings', 'client_view_styling' => 'Client View Styling', - 'pdf_email_attachment' => 'Attach Invoice', + 'pdf_email_attachment' => 'Attach PDF', 'custom_css' => 'Custom CSS', 'import_clients' => 'Import Client Data', 'csv_file' => 'CSV file', @@ -1104,6 +1104,7 @@ $LANG = array( 'invoice_embed_documents' => 'Embed Documents', 'invoice_embed_documents_help' => 'Include attached images in the invoice.', 'document_email_attachment' => 'Attach Documents', + 'ubl_email_attachment' => 'Attach UBL', 'download_documents' => 'Download Documents (:size)', 'documents_from_expenses' => 'From Expenses:', 'dropzone_default_message' => 'Drop files or click to upload', diff --git a/resources/views/accounts/email_settings.blade.php b/resources/views/accounts/email_settings.blade.php index 2120174980a6..cc5a9b33251a 100644 --- a/resources/views/accounts/email_settings.blade.php +++ b/resources/views/accounts/email_settings.blade.php @@ -24,6 +24,7 @@ {{ Former::populate($account) }} {{ Former::populateField('pdf_email_attachment', intval($account->pdf_email_attachment)) }} + {{ Former::populateField('ubl_email_attachment', intval($account->ubl_email_attachment)) }} {{ Former::populateField('document_email_attachment', intval($account->document_email_attachment)) }} {{ Former::populateField('enable_email_markup', intval($account->enable_email_markup)) }} {{ Former::populateField('bcc_email', $account->account_email_settings->bcc_email) }} @@ -52,6 +53,10 @@ 'link_docs' => link_to('http://docs.invoiceninja.com/en/latest/configure.html#phantomjs', 'PhantomJS', ['target' => '_blank']) ])) : false) !!} + {!! Former::checkbox('ubl_email_attachment') + ->text(trans('texts.enable')) + ->value(1) !!} + {!! Former::checkbox('document_email_attachment') ->text(trans('texts.enable')) ->value(1) !!}