- Change $global-margin to $global_margin to keep consistency

- Update designs accordingly
- Update ChromiumPdf version
- Apply php-cs-fixer
This commit is contained in:
Benjamin Beganović 2020-12-15 11:45:04 +01:00
parent 3b5c592f25
commit 7ccd10adf9
16 changed files with 140 additions and 161 deletions

View File

@ -259,7 +259,6 @@ class DemoMode extends Command
$client = $company->clients->random(); $client = $company->clients->random();
$this->createProject($client, $u2->id); $this->createProject($client, $u2->id);
} }
} }
@ -468,7 +467,6 @@ class DemoMode extends Command
} }
$invoice->save(); $invoice->save();
} }
private function createCredit($client, $assigned_user_id = null) private function createCredit($client, $assigned_user_id = null)

View File

@ -13,122 +13,121 @@ namespace App\Import\Definitions;
class InvoiceMap 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() public static function import_keys()
{ {
return [ return [
0 => 'invoice.number', 0 => 'texts.invoice_number',
1 => 'invoice.user_id', 1 => 'texts.user',
2 => 'invoice.amount', 2 => 'texts.amount',
3 => 'invoice.balance', 3 => 'texts.balance',
4 => 'invoice.client_id', 4 => 'texts.client',
5 => 'invoice.discount', 5 => 'texts.discount',
6 => 'invoice.po_number', 6 => 'texts.po_number',
7 => 'invoice.date', 7 => 'texts.date',
8 => 'invoice.due_date', 8 => 'texts.due_date',
9 => 'invoice.terms', 9 => 'texts.terms',
10 => 'invoice.public_notes', 10 => 'texts.public_notes',
11 => 'invoice.is_sent', 11 => 'texts.sent',
12 => 'invoice.private_notes', 12 => 'texts.private_notes',
13 => 'invoice.uses_inclusive_taxes', 13 => 'texts.uses_inclusive_taxes',
14 => 'invoice.tax_name1', 14 => 'texts.tax_name',
15 => 'invoice.tax_rate1', 15 => 'texts.tax_rate',
16 => 'invoice.tax_name2', 16 => 'texts.tax_name',
17 => 'invoice.tax_rate2', 17 => 'texts.tax_rate',
18 => 'invoice.tax_name3', 18 => 'texts.tax_name',
19 => 'invoice.tax_rate3', 19 => 'texts.tax_rate',
20 => 'invoice.is_amount_discount', 20 => 'texts.is_amount_discount',
21 => 'invoice.footer', 21 => 'texts.footer',
22 => 'invoice.partial', 22 => 'texts.partial',
23 => 'invoice.partial_due_date', 23 => 'texts.partial_due_date',
24 => 'invoice.custom_value1', 24 => 'texts.custom_value1',
25 => 'invoice.custom_value2', 25 => 'texts.custom_value2',
26 => 'invoice.custom_value3', 26 => 'texts.custom_value3',
27 => 'invoice.custom_value4', 27 => 'texts.custom_value4',
28 => 'invoice.custom_surcharge1', 28 => 'texts.surcharge',
29 => 'invoice.custom_surcharge2', 29 => 'texts.surcharge',
30 => 'invoice.custom_surcharge3', 30 => 'texts.surcharge',
31 => 'invoice.custom_surcharge4', 31 => 'texts.surcharge',
32 => 'invoice.exchange_rate', 32 => 'texts.exchange_rate',
33 => 'payment.date', 33 => 'texts.payment_date',
34 => 'payment.amount', 34 => 'texts.payment_amount',
35 => 'payment.transaction_reference', 35 => 'texts.transaction_reference',
36 => 'item.quantity', 36 => 'texts.quantity',
37 => 'item.cost', 37 => 'texts.cost',
38 => 'item.product_key', 38 => 'texts.product_key',
39 => 'item.notes', 39 => 'texts.notes',
40 => 'item.discount', 40 => 'texts.discount',
41 => 'item.is_amount_discount', 41 => 'texts.is_amount_discount',
42 => 'item.tax_name1', 42 => 'texts.tax_name',
43 => 'item.tax_rate1', 43 => 'texts.tax_rate',
44 => 'item.tax_name2', 44 => 'texts.tax_name',
45 => 'item.tax_rate2', 45 => 'texts.tax_rate',
46 => 'item.tax_name3', 46 => 'texts.tax_name',
47 => 'item.tax_rate3', 47 => 'texts.tax_rate',
48 => 'item.custom_value1', 48 => 'texts.custom_value',
49 => 'item.custom_value2', 49 => 'texts.custom_value',
50 => 'item.custom_value3', 50 => 'texts.custom_value',
51 => 'item.custom_value4', 51 => 'texts.custom_value',
52 => 'item.type_id', 52 => 'texts.type',
]; ];
} }
}
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',
];
}
}

View File

@ -122,8 +122,8 @@ use App\Listeners\Invoice\InvoiceArchivedActivity;
use App\Listeners\Invoice\InvoiceCancelledActivity; use App\Listeners\Invoice\InvoiceCancelledActivity;
use App\Listeners\Invoice\InvoiceDeletedActivity; use App\Listeners\Invoice\InvoiceDeletedActivity;
use App\Listeners\Invoice\InvoiceEmailActivity; use App\Listeners\Invoice\InvoiceEmailActivity;
use App\Listeners\Invoice\InvoiceEmailFailedActivity;
use App\Listeners\Invoice\InvoiceEmailedNotification; use App\Listeners\Invoice\InvoiceEmailedNotification;
use App\Listeners\Invoice\InvoiceEmailFailedActivity;
use App\Listeners\Invoice\InvoicePaidActivity; use App\Listeners\Invoice\InvoicePaidActivity;
use App\Listeners\Invoice\InvoiceReminderEmailActivity; use App\Listeners\Invoice\InvoiceReminderEmailActivity;
use App\Listeners\Invoice\InvoiceRestoredActivity; use App\Listeners\Invoice\InvoiceRestoredActivity;
@ -131,8 +131,8 @@ use App\Listeners\Invoice\InvoiceReversedActivity;
use App\Listeners\Invoice\InvoiceViewedActivity; use App\Listeners\Invoice\InvoiceViewedActivity;
use App\Listeners\Invoice\UpdateInvoiceActivity; use App\Listeners\Invoice\UpdateInvoiceActivity;
use App\Listeners\Misc\InvitationViewedListener; use App\Listeners\Misc\InvitationViewedListener;
use App\Listeners\Payment\PaymentEmailFailureActivity;
use App\Listeners\Payment\PaymentEmailedActivity; use App\Listeners\Payment\PaymentEmailedActivity;
use App\Listeners\Payment\PaymentEmailFailureActivity;
use App\Listeners\Payment\PaymentNotification; use App\Listeners\Payment\PaymentNotification;
use App\Listeners\Payment\PaymentRestoredActivity; use App\Listeners\Payment\PaymentRestoredActivity;
use App\Listeners\Quote\QuoteApprovedActivity; use App\Listeners\Quote\QuoteApprovedActivity;

View File

@ -92,7 +92,7 @@ class HtmlEngine
} }
$data = []; $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['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];

8
composer.lock generated
View File

@ -210,12 +210,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/beganovich/chromium-pdf.git", "url": "https://github.com/beganovich/chromium-pdf.git",
"reference": "0f1641f0f8272b68aa4942307b85fba5596a90c3" "reference": "f6f32bb99616a1c1b7108250ccc438210134a99f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/beganovich/chromium-pdf/zipball/0f1641f0f8272b68aa4942307b85fba5596a90c3", "url": "https://api.github.com/repos/beganovich/chromium-pdf/zipball/f6f32bb99616a1c1b7108250ccc438210134a99f",
"reference": "0f1641f0f8272b68aa4942307b85fba5596a90c3", "reference": "f6f32bb99616a1c1b7108250ccc438210134a99f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -246,7 +246,7 @@
"issues": "https://github.com/beganovich/chromium-pdf/issues", "issues": "https://github.com/beganovich/chromium-pdf/issues",
"source": "https://github.com/beganovich/chromium-pdf/tree/master" "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", "name": "brick/math",

View File

@ -13,7 +13,6 @@ class TaskFields extends Migration
*/ */
public function up() public function up()
{ {
Schema::table('tasks', function (Blueprint $table) { Schema::table('tasks', function (Blueprint $table) {
$table->boolean('is_date_based')->default(false); $table->boolean('is_date_based')->default(false);
}); });
@ -21,7 +20,6 @@ class TaskFields extends Migration
Schema::table('companies', function (Blueprint $table) { Schema::table('companies', function (Blueprint $table) {
$table->boolean('default_task_is_date_based')->default(false); $table->boolean('default_task_is_date_based')->default(false);
}); });
} }
/** /**

View File

@ -14,7 +14,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
margin: "$global-margin"; margin: $global_margin;
} }
p { p {

View File

@ -12,7 +12,7 @@
} }
@page { @page {
margin: "$global-margin"; margin: $global_margin;
} }
p { p {

View File

@ -9,7 +9,7 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: "$font_size"; font-size: "$font_size";
margin: "$global-margin"; margin: $global_margin;
} }
p { p {

View File

@ -30,7 +30,7 @@
} }
body { body {
margin: "$global-margin"; margin: $global_margin;
} }
.header-wrapper { .header-wrapper {

View File

@ -17,7 +17,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
margin: "$global-margin"; margin: $global_margin;
} }
.company-logo-wrapper { .company-logo-wrapper {

View File

@ -20,7 +20,7 @@
} }
@page { @page {
margin: "$global-margin"; margin: $global_margin;
} }
.header-wrapper { .header-wrapper {

View File

@ -13,7 +13,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
margin: "$global-margin"; margin: $global_margin;
} }
.header-wrapper { .header-wrapper {

View File

@ -17,7 +17,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
margin: "$global-margin"; margin: $global_margin;
} }
.header-wrapper { .header-wrapper {

View File

@ -11,14 +11,9 @@
namespace Tests\Feature\Export; namespace Tests\Feature\Export;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Product;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Validation\ValidationException;
use League\Csv\Reader;
use League\Csv\Statement;
use League\Csv\Writer; use League\Csv\Writer;
use Tests\MockAccountData; use Tests\MockAccountData;
use Tests\TestCase; use Tests\TestCase;
@ -63,31 +58,24 @@ class ExportCsvTest extends TestCase
$merged_values = array_merge($header_invoice_values, (array)$header_item_values); $merged_values = array_merge($header_invoice_values, (array)$header_item_values);
$merged_keys = array_merge($header_invoice_keys, (array)$header_item_keys); $merged_keys = array_merge($header_invoice_keys, (array)$header_item_keys);
info(print_r( $merged_keys,1)); info(print_r($merged_keys, 1));
info(print_r( $merged_values,1)); info(print_r($merged_values, 1));
foreach($merged_keys as &$key) { foreach ($merged_keys as &$key) {
$key = ctrans('texts.'.$key); $key = ctrans('texts.'.$key);
} }
$csv->insertOne($merged_keys); $csv->insertOne($merged_keys);
foreach(Invoice::take(10)->get() as $invoice){ foreach (Invoice::take(10)->get() as $invoice) {
foreach ($invoice->line_items as $item) {
foreach($invoice->line_items as $item) {
unset($invoice->line_items); unset($invoice->line_items);
$csv->insertOne(array_merge($invoice->toArray(), (array)$item)); $csv->insertOne(array_merge($invoice->toArray(), (array)$item));
} }
} }
Storage::put(base_path('invy.csv'), $csv->getContent()); Storage::put(base_path('invy.csv'), $csv->getContent());
} }
}
}

View File

@ -10,11 +10,8 @@
*/ */
namespace Tests\Feature\Import; namespace Tests\Feature\Import;
use App\Models\Product;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Validation\ValidationException;
use League\Csv\Reader; use League\Csv\Reader;
use League\Csv\Statement; use League\Csv\Statement;
use Tests\MockAccountData; use Tests\MockAccountData;
@ -54,7 +51,6 @@ class ImportCsvTest extends TestCase
private function getCsvData($csvfile) private function getCsvData($csvfile)
{ {
if (! ini_get('auto_detect_line_endings')) { if (! ini_get('auto_detect_line_endings')) {
ini_set('auto_detect_line_endings', '1'); ini_set('auto_detect_line_endings', '1');
} }
@ -79,4 +75,4 @@ class ImportCsvTest extends TestCase
return $data; return $data;
} }
} }