diff --git a/app/Console/Commands/DemoMode.php b/app/Console/Commands/DemoMode.php index b80c6c5fd138..260895736c98 100644 --- a/app/Console/Commands/DemoMode.php +++ b/app/Console/Commands/DemoMode.php @@ -259,7 +259,6 @@ class DemoMode extends Command $client = $company->clients->random(); $this->createProject($client, $u2->id); - } } @@ -468,7 +467,6 @@ class DemoMode extends Command } $invoice->save(); - } private function createCredit($client, $assigned_user_id = null) diff --git a/app/Import/Definitions/InvoiceMap.php b/app/Import/Definitions/InvoiceMap.php index 8a3c34a08539..bacab67ffc1b 100644 --- a/app/Import/Definitions/InvoiceMap.php +++ b/app/Import/Definitions/InvoiceMap.php @@ -13,122 +13,121 @@ namespace App\Import\Definitions; class InvoiceMap { + public static function importable() + { + return [ + 0 => 'invoice.number', + 1 => 'invoice.user_id', + 2 => 'invoice.amount', + 3 => 'invoice.balance', + 4 => 'invoice.client_id', + 5 => 'invoice.discount', + 6 => 'invoice.po_number', + 7 => 'invoice.date', + 8 => 'invoice.due_date', + 9 => 'invoice.terms', + 10 => 'invoice.public_notes', + 11 => 'invoice.is_sent', + 12 => 'invoice.private_notes', + 13 => 'invoice.uses_inclusive_taxes', + 14 => 'invoice.tax_name1', + 15 => 'invoice.tax_rate1', + 16 => 'invoice.tax_name2', + 17 => 'invoice.tax_rate2', + 18 => 'invoice.tax_name3', + 19 => 'invoice.tax_rate3', + 20 => 'invoice.is_amount_discount', + 21 => 'invoice.footer', + 22 => 'invoice.partial', + 23 => 'invoice.partial_due_date', + 24 => 'invoice.custom_value1', + 25 => 'invoice.custom_value2', + 26 => 'invoice.custom_value3', + 27 => 'invoice.custom_value4', + 28 => 'invoice.custom_surcharge1', + 29 => 'invoice.custom_surcharge2', + 30 => 'invoice.custom_surcharge3', + 31 => 'invoice.custom_surcharge4', + 32 => 'invoice.exchange_rate', + 33 => 'payment.date', + 34 => 'payment.amount', + 35 => 'payment.transaction_reference', + 36 => 'item.quantity', + 37 => 'item.cost', + 38 => 'item.product_key', + 39 => 'item.notes', + 40 => 'item.discount', + 41 => 'item.is_amount_discount', + 42 => 'item.tax_name1', + 43 => 'item.tax_rate1', + 44 => 'item.tax_name2', + 45 => 'item.tax_rate2', + 46 => 'item.tax_name3', + 47 => 'item.tax_rate3', + 48 => 'item.custom_value1', + 49 => 'item.custom_value2', + 50 => 'item.custom_value3', + 51 => 'item.custom_value4', + 52 => 'item.type_id', + ]; + } - public static function importable() - { - return [ - 0 => 'invoice.number', - 1 => 'invoice.user_id', - 2 => 'invoice.amount', - 3 => 'invoice.balance', - 4 => 'invoice.client_id', - 5 => 'invoice.discount', - 6 => 'invoice.po_number', - 7 => 'invoice.date', - 8 => 'invoice.due_date', - 9 => 'invoice.terms', - 10 => 'invoice.public_notes', - 11 => 'invoice.is_sent', - 12 => 'invoice.private_notes', - 13 => 'invoice.uses_inclusive_taxes', - 14 => 'invoice.tax_name1', - 15 => 'invoice.tax_rate1', - 16 => 'invoice.tax_name2', - 17 => 'invoice.tax_rate2', - 18 => 'invoice.tax_name3', - 19 => 'invoice.tax_rate3', - 20 => 'invoice.is_amount_discount', - 21 => 'invoice.footer', - 22 => 'invoice.partial', - 23 => 'invoice.partial_due_date', - 24 => 'invoice.custom_value1', - 25 => 'invoice.custom_value2', - 26 => 'invoice.custom_value3', - 27 => 'invoice.custom_value4', - 28 => 'invoice.custom_surcharge1', - 29 => 'invoice.custom_surcharge2', - 30 => 'invoice.custom_surcharge3', - 31 => 'invoice.custom_surcharge4', - 32 => 'invoice.exchange_rate', - 33 => 'payment.date', - 34 => 'payment.amount', - 35 => 'payment.transaction_reference', - 36 => 'item.quantity', - 37 => 'item.cost', - 38 => 'item.product_key', - 39 => 'item.notes', - 40 => 'item.discount', - 41 => 'item.is_amount_discount', - 42 => 'item.tax_name1', - 43 => 'item.tax_rate1', - 44 => 'item.tax_name2', - 45 => 'item.tax_rate2', - 46 => 'item.tax_name3', - 47 => 'item.tax_rate3', - 48 => 'item.custom_value1', - 49 => 'item.custom_value2', - 50 => 'item.custom_value3', - 51 => 'item.custom_value4', - 52 => 'item.type_id', - ]; - } - - public static function import_keys() - { - return [ - 0 => 'texts.invoice_number', - 1 => 'texts.user', - 2 => 'texts.amount', - 3 => 'texts.balance', - 4 => 'texts.client', - 5 => 'texts.discount', - 6 => 'texts.po_number', - 7 => 'texts.date', - 8 => 'texts.due_date', - 9 => 'texts.terms', - 10 => 'texts.public_notes', - 11 => 'texts.sent', - 12 => 'texts.private_notes', - 13 => 'texts.uses_inclusive_taxes', - 14 => 'texts.tax_name', - 15 => 'texts.tax_rate', - 16 => 'texts.tax_name', - 17 => 'texts.tax_rate', - 18 => 'texts.tax_name', - 19 => 'texts.tax_rate', - 20 => 'texts.is_amount_discount', - 21 => 'texts.footer', - 22 => 'texts.partial', - 23 => 'texts.partial_due_date', - 24 => 'texts.custom_value1', - 25 => 'texts.custom_value2', - 26 => 'texts.custom_value3', - 27 => 'texts.custom_value4', - 28 => 'texts.surcharge', - 29 => 'texts.surcharge', - 30 => 'texts.surcharge', - 31 => 'texts.surcharge', - 32 => 'texts.exchange_rate', - 33 => 'texts.payment_date', - 34 => 'texts.payment_amount', - 35 => 'texts.transaction_reference', - 36 => 'texts.quantity', - 37 => 'texts.cost', - 38 => 'texts.product_key', - 39 => 'texts.notes', - 40 => 'texts.discount', - 41 => 'texts.is_amount_discount', - 42 => 'texts.tax_name', - 43 => 'texts.tax_rate', - 44 => 'texts.tax_name', - 45 => 'texts.tax_rate', - 46 => 'texts.tax_name', - 47 => 'texts.tax_rate', - 48 => 'texts.custom_value', - 49 => 'texts.custom_value', - 50 => 'texts.custom_value', - 51 => 'texts.custom_value', - 52 => 'texts.type', - ]; - } -} \ No newline at end of file + public static function import_keys() + { + return [ + 0 => 'texts.invoice_number', + 1 => 'texts.user', + 2 => 'texts.amount', + 3 => 'texts.balance', + 4 => 'texts.client', + 5 => 'texts.discount', + 6 => 'texts.po_number', + 7 => 'texts.date', + 8 => 'texts.due_date', + 9 => 'texts.terms', + 10 => 'texts.public_notes', + 11 => 'texts.sent', + 12 => 'texts.private_notes', + 13 => 'texts.uses_inclusive_taxes', + 14 => 'texts.tax_name', + 15 => 'texts.tax_rate', + 16 => 'texts.tax_name', + 17 => 'texts.tax_rate', + 18 => 'texts.tax_name', + 19 => 'texts.tax_rate', + 20 => 'texts.is_amount_discount', + 21 => 'texts.footer', + 22 => 'texts.partial', + 23 => 'texts.partial_due_date', + 24 => 'texts.custom_value1', + 25 => 'texts.custom_value2', + 26 => 'texts.custom_value3', + 27 => 'texts.custom_value4', + 28 => 'texts.surcharge', + 29 => 'texts.surcharge', + 30 => 'texts.surcharge', + 31 => 'texts.surcharge', + 32 => 'texts.exchange_rate', + 33 => 'texts.payment_date', + 34 => 'texts.payment_amount', + 35 => 'texts.transaction_reference', + 36 => 'texts.quantity', + 37 => 'texts.cost', + 38 => 'texts.product_key', + 39 => 'texts.notes', + 40 => 'texts.discount', + 41 => 'texts.is_amount_discount', + 42 => 'texts.tax_name', + 43 => 'texts.tax_rate', + 44 => 'texts.tax_name', + 45 => 'texts.tax_rate', + 46 => 'texts.tax_name', + 47 => 'texts.tax_rate', + 48 => 'texts.custom_value', + 49 => 'texts.custom_value', + 50 => 'texts.custom_value', + 51 => 'texts.custom_value', + 52 => 'texts.type', + ]; + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 26f9853a63ce..9d3d4c696de1 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -122,8 +122,8 @@ use App\Listeners\Invoice\InvoiceArchivedActivity; use App\Listeners\Invoice\InvoiceCancelledActivity; use App\Listeners\Invoice\InvoiceDeletedActivity; use App\Listeners\Invoice\InvoiceEmailActivity; -use App\Listeners\Invoice\InvoiceEmailFailedActivity; use App\Listeners\Invoice\InvoiceEmailedNotification; +use App\Listeners\Invoice\InvoiceEmailFailedActivity; use App\Listeners\Invoice\InvoicePaidActivity; use App\Listeners\Invoice\InvoiceReminderEmailActivity; use App\Listeners\Invoice\InvoiceRestoredActivity; @@ -131,8 +131,8 @@ use App\Listeners\Invoice\InvoiceReversedActivity; use App\Listeners\Invoice\InvoiceViewedActivity; use App\Listeners\Invoice\UpdateInvoiceActivity; use App\Listeners\Misc\InvitationViewedListener; -use App\Listeners\Payment\PaymentEmailFailureActivity; use App\Listeners\Payment\PaymentEmailedActivity; +use App\Listeners\Payment\PaymentEmailFailureActivity; use App\Listeners\Payment\PaymentNotification; use App\Listeners\Payment\PaymentRestoredActivity; use App\Listeners\Quote\QuoteApprovedActivity; diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index e86e503deec9..12cbac3de004 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -92,7 +92,7 @@ class HtmlEngine } $data = []; - $data['$global-margin'] = ['value' => config('ninja.experimental_pdf_engine') ? '0cm' : '1cm', 'label' => '']; + $data['$global_margin'] = ['value' => config('ninja.experimental_pdf_engine') ? '0cm' : '1cm', 'label' => '']; $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; diff --git a/composer.lock b/composer.lock index 4724319c9982..a3e25bf94666 100644 --- a/composer.lock +++ b/composer.lock @@ -210,12 +210,12 @@ "source": { "type": "git", "url": "https://github.com/beganovich/chromium-pdf.git", - "reference": "0f1641f0f8272b68aa4942307b85fba5596a90c3" + "reference": "f6f32bb99616a1c1b7108250ccc438210134a99f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beganovich/chromium-pdf/zipball/0f1641f0f8272b68aa4942307b85fba5596a90c3", - "reference": "0f1641f0f8272b68aa4942307b85fba5596a90c3", + "url": "https://api.github.com/repos/beganovich/chromium-pdf/zipball/f6f32bb99616a1c1b7108250ccc438210134a99f", + "reference": "f6f32bb99616a1c1b7108250ccc438210134a99f", "shasum": "" }, "require": { @@ -246,7 +246,7 @@ "issues": "https://github.com/beganovich/chromium-pdf/issues", "source": "https://github.com/beganovich/chromium-pdf/tree/master" }, - "time": "2020-12-14T15:49:17+00:00" + "time": "2020-12-15T10:16:36+00:00" }, { "name": "brick/math", diff --git a/database/migrations/2020_12_14_114722_task_fields.php b/database/migrations/2020_12_14_114722_task_fields.php index bcb861986bf0..440330421bf0 100644 --- a/database/migrations/2020_12_14_114722_task_fields.php +++ b/database/migrations/2020_12_14_114722_task_fields.php @@ -13,7 +13,6 @@ class TaskFields extends Migration */ public function up() { - Schema::table('tasks', function (Blueprint $table) { $table->boolean('is_date_based')->default(false); }); @@ -21,7 +20,6 @@ class TaskFields extends Migration Schema::table('companies', function (Blueprint $table) { $table->boolean('default_task_is_date_based')->default(false); }); - } /** diff --git a/resources/views/pdf-designs/bold.html b/resources/views/pdf-designs/bold.html index a3c4fd17847f..348016d03fe3 100644 --- a/resources/views/pdf-designs/bold.html +++ b/resources/views/pdf-designs/bold.html @@ -14,7 +14,7 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: Arial, Helvetica, sans-serif; - margin: "$global-margin"; + margin: $global_margin; } p { diff --git a/resources/views/pdf-designs/business.html b/resources/views/pdf-designs/business.html index f29891db96c3..9d4206ca81cf 100644 --- a/resources/views/pdf-designs/business.html +++ b/resources/views/pdf-designs/business.html @@ -12,7 +12,7 @@ } @page { - margin: "$global-margin"; + margin: $global_margin; } p { diff --git a/resources/views/pdf-designs/clean.html b/resources/views/pdf-designs/clean.html index 28cfeabcaf1f..7c7a0524c33e 100644 --- a/resources/views/pdf-designs/clean.html +++ b/resources/views/pdf-designs/clean.html @@ -9,7 +9,7 @@ -moz-osx-font-smoothing: grayscale; font-family: Arial, Helvetica, sans-serif; font-size: "$font_size"; - margin: "$global-margin"; + margin: $global_margin; } p { diff --git a/resources/views/pdf-designs/creative.html b/resources/views/pdf-designs/creative.html index 5aa384ccae97..a3f3124a5a44 100644 --- a/resources/views/pdf-designs/creative.html +++ b/resources/views/pdf-designs/creative.html @@ -30,7 +30,7 @@ } body { - margin: "$global-margin"; + margin: $global_margin; } .header-wrapper { diff --git a/resources/views/pdf-designs/elegant.html b/resources/views/pdf-designs/elegant.html index 7686f5f22547..a33e8f1e3ffb 100644 --- a/resources/views/pdf-designs/elegant.html +++ b/resources/views/pdf-designs/elegant.html @@ -17,7 +17,7 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: Arial, Helvetica, sans-serif; - margin: "$global-margin"; + margin: $global_margin; } .company-logo-wrapper { diff --git a/resources/views/pdf-designs/hipster.html b/resources/views/pdf-designs/hipster.html index 42b6322bff98..3942a0eedba8 100644 --- a/resources/views/pdf-designs/hipster.html +++ b/resources/views/pdf-designs/hipster.html @@ -20,7 +20,7 @@ } @page { - margin: "$global-margin"; + margin: $global_margin; } .header-wrapper { diff --git a/resources/views/pdf-designs/plain.html b/resources/views/pdf-designs/plain.html index c72398f9fc9a..f9aeca6d44ac 100644 --- a/resources/views/pdf-designs/plain.html +++ b/resources/views/pdf-designs/plain.html @@ -13,7 +13,7 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: Arial, Helvetica, sans-serif; - margin: "$global-margin"; + margin: $global_margin; } .header-wrapper { diff --git a/resources/views/pdf-designs/playful.html b/resources/views/pdf-designs/playful.html index 96516134d99e..f9c1d5e752e9 100644 --- a/resources/views/pdf-designs/playful.html +++ b/resources/views/pdf-designs/playful.html @@ -17,7 +17,7 @@ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: Arial, Helvetica, sans-serif; - margin: "$global-margin"; + margin: $global_margin; } .header-wrapper { diff --git a/tests/Feature/Export/ExportCsvTest.php b/tests/Feature/Export/ExportCsvTest.php index 2662b606358b..68ae53afc5ff 100644 --- a/tests/Feature/Export/ExportCsvTest.php +++ b/tests/Feature/Export/ExportCsvTest.php @@ -11,14 +11,9 @@ namespace Tests\Feature\Export; use App\Models\Invoice; -use App\Models\Product; use App\Utils\Traits\MakesHash; -use Illuminate\Database\Eloquent\Model; use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Support\Facades\Storage; -use Illuminate\Validation\ValidationException; -use League\Csv\Reader; -use League\Csv\Statement; use League\Csv\Writer; use Tests\MockAccountData; use Tests\TestCase; @@ -63,31 +58,24 @@ class ExportCsvTest extends TestCase $merged_values = array_merge($header_invoice_values, (array)$header_item_values); $merged_keys = array_merge($header_invoice_keys, (array)$header_item_keys); - info(print_r( $merged_keys,1)); - info(print_r( $merged_values,1)); + info(print_r($merged_keys, 1)); + info(print_r($merged_values, 1)); - foreach($merged_keys as &$key) { + foreach ($merged_keys as &$key) { $key = ctrans('texts.'.$key); } $csv->insertOne($merged_keys); - foreach(Invoice::take(10)->get() as $invoice){ - - foreach($invoice->line_items as $item) { - + foreach (Invoice::take(10)->get() as $invoice) { + foreach ($invoice->line_items as $item) { unset($invoice->line_items); $csv->insertOne(array_merge($invoice->toArray(), (array)$item)); - } - - } - Storage::put(base_path('invy.csv'), $csv->getContent()); - + Storage::put(base_path('invy.csv'), $csv->getContent()); } - -} \ No newline at end of file +} diff --git a/tests/Feature/Import/ImportCsvTest.php b/tests/Feature/Import/ImportCsvTest.php index 377d7fc1b22e..8d7fb687c662 100644 --- a/tests/Feature/Import/ImportCsvTest.php +++ b/tests/Feature/Import/ImportCsvTest.php @@ -10,11 +10,8 @@ */ namespace Tests\Feature\Import; -use App\Models\Product; use App\Utils\Traits\MakesHash; -use Illuminate\Database\Eloquent\Model; use Illuminate\Routing\Middleware\ThrottleRequests; -use Illuminate\Validation\ValidationException; use League\Csv\Reader; use League\Csv\Statement; use Tests\MockAccountData; @@ -54,7 +51,6 @@ class ImportCsvTest extends TestCase private function getCsvData($csvfile) { - if (! ini_get('auto_detect_line_endings')) { ini_set('auto_detect_line_endings', '1'); } @@ -79,4 +75,4 @@ class ImportCsvTest extends TestCase return $data; } -} \ No newline at end of file +}