From 0545f736284f79ad6b9f1b4fe3b86d4f4d85c8bf Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Nov 2017 10:15:55 +0200 Subject: [PATCH 1/5] Set default client potal table sorting --- app/Http/Controllers/ClientPortalController.php | 6 ++++++ resources/views/public_list.blade.php | 1 + 2 files changed, 7 insertions(+) diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index e98bc428d629..6d0d5b1ad0cd 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -347,6 +347,7 @@ class ClientPortalController extends BaseController 'title' => trans('texts.recurring_invoices'), 'entityType' => ENTITY_RECURRING_INVOICE, 'columns' => Utils::trans($columns), + 'sortColumn' => 1, ]; return response()->view('public_list', $data); @@ -374,6 +375,7 @@ class ClientPortalController extends BaseController 'title' => trans('texts.invoices'), 'entityType' => ENTITY_INVOICE, 'columns' => Utils::trans(['invoice_number', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status']), + 'sortColumn' => 1, ]; return response()->view('public_list', $data); @@ -418,6 +420,7 @@ class ClientPortalController extends BaseController 'entityType' => ENTITY_PAYMENT, 'title' => trans('texts.payments'), 'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date', 'status']), + 'sortColumn' => 4, ]; return response()->view('public_list', $data); @@ -502,6 +505,7 @@ class ClientPortalController extends BaseController 'title' => trans('texts.quotes'), 'entityType' => ENTITY_QUOTE, 'columns' => Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date', 'status']), + 'sortColumn' => 1, ]; return response()->view('public_list', $data); @@ -537,6 +541,7 @@ class ClientPortalController extends BaseController 'title' => trans('texts.credits'), 'entityType' => ENTITY_CREDIT, 'columns' => Utils::trans(['credit_date', 'credit_amount', 'credit_balance', 'notes']), + 'sortColumn' => 0, ]; return response()->view('public_list', $data); @@ -572,6 +577,7 @@ class ClientPortalController extends BaseController 'title' => trans('texts.documents'), 'entityType' => ENTITY_DOCUMENT, 'columns' => Utils::trans(['invoice_number', 'name', 'document_date', 'document_size']), + 'sortColumn' => 2, ]; return response()->view('public_list', $data); diff --git a/resources/views/public_list.blade.php b/resources/views/public_list.blade.php index d535ab1bdf47..970280fb9050 100644 --- a/resources/views/public_list.blade.php +++ b/resources/views/public_list.blade.php @@ -54,6 +54,7 @@ ->addColumn($columns) ->setUrl(route('api.client.' . $entityType . 's')) ->setOptions('sPaginationType', 'bootstrap') + ->setOptions('aaSorting', [[$sortColumn, 'desc']]) ->render('datatable') !!} From 90d5494e39ee8a4dc0d6e25382adf4c9f31aee19 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Nov 2017 10:40:46 +0200 Subject: [PATCH 2/5] Add fast option to check data --- app/Console/Commands/CheckData.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index cdafc27f70dc..9520dce7e0b6 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -42,6 +42,10 @@ Options: By default the script only checks for errors, adding this option makes the script apply the fixes. +--fast=true + + Skip using phantomjs + */ /** @@ -144,7 +148,7 @@ class CheckData extends Command return; } - if ($this->option('fix') == 'true') { + if ($this->option('fix') == 'true' || $this->option('fast') == 'true') { return; } @@ -792,6 +796,7 @@ class CheckData extends Command { return [ ['fix', null, InputOption::VALUE_OPTIONAL, 'Fix data', null], + ['fast', null, InputOption::VALUE_OPTIONAL, 'Fast', null], ['client_id', null, InputOption::VALUE_OPTIONAL, 'Client id', null], ['database', null, InputOption::VALUE_OPTIONAL, 'Database', null], ]; From a4a62ad3723b521398183fedfb23cc2a47eb4b01 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Nov 2017 10:46:00 +0200 Subject: [PATCH 3/5] update docs --- docs/developer_guide.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/developer_guide.rst b/docs/developer_guide.rst index 78b9fbf3c555..155e4e66fcb6 100644 --- a/docs/developer_guide.rst +++ b/docs/developer_guide.rst @@ -12,11 +12,11 @@ We try to follow the `PSR-2 `_ style guidelin Code """" -When setting up the app you can choose to either use the self hosted zip or checkout the code from GitHub. The zip includes all third party libraries, whereas checking out the code from GitHub requires using Composer and Bower. +When setting up the app you can choose to either use the self hosted zip or checkout the code from GitHub. The zip includes all third party libraries, whereas checking out the code from GitHub requires using Composer. -We use Gulp to concatenate the JavasScript and CSS files. After making any changes you need to run gulp to re-generate the files. +We use Gulp to concatenate the JavasScript and CSS files. You can download the source files with Bower. After making any changes you need to run ``gulp`` to re-generate the built files. -Most of the system tables are cached (ie, currencies, languages, etc). If you make any changes you need to clear the cache either by loading any page with ?clear_cache=true added at the end of the URL. +Most of the system tables are cached (ie, currencies, languages, etc). If you make any changes you need to run ``php artisan db:seed --class=UpdateSeeder`` and then load any page with ?clear_cache=true added at the end of the URL. Database """""""" From e1bbab028f682668ec1e51db25784265820e8416 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Nov 2017 10:55:45 +0200 Subject: [PATCH 4/5] update docs --- docs/update.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/update.rst b/docs/update.rst index abe29b6e3a9a..c8af0f37d3d7 100644 --- a/docs/update.rst +++ b/docs/update.rst @@ -7,7 +7,7 @@ To update the app you just need to copy over the latest code. The app tracks the https://download.invoiceninja.com -.. TIP:: You can use this `shell script `_ to automate the update process, consider running it as a daily cron to automatically keep your app up to date. +.. TIP:: We recommend using this `shell script `_ to automate the update process, run it as a daily cron to automatically keep your app up to date. If you're moving servers make sure to copy over the .env file. From 7889350fd8455866a9506c977198ca639e17ab9f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Nov 2017 12:56:42 +0200 Subject: [PATCH 5/5] Improve invoice getPDFString --- app/Models/Invoice.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 1cc9e9022665..9c1aa6832d26 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1203,7 +1203,7 @@ class Invoice extends EntityModel implements BalanceAffecting } $invitation = $this->invitations[0]; - $link = $invitation->getLink('view', true); + $link = $invitation->getLink('view', true, true); $pdfString = false; $phantomjsSecret = env('PHANTOMJS_SECRET'); $phantomjsLink = $link . "?phantomjs=true&phantomjs_secret={$phantomjsSecret}"; @@ -1213,8 +1213,10 @@ class Invoice extends EntityModel implements BalanceAffecting // we see occasional 408 errors for ($i=1; $i<=5; $i++) { $pdfString = CurlUtils::phantom('GET', $phantomjsLink); - if ($pdfString) { + if (strpos($pdfString, 'data') === 0) { break; + } else { + $pdfString = false; } } } @@ -1239,7 +1241,7 @@ class Invoice extends EntityModel implements BalanceAffecting if ($pdf = Utils::decodePDF($pdfString)) { return $pdf; } else { - Utils::logError("PhantomJS - Unable to decode {$phantomjsLink}: {$pdfString}"); + Utils::logError("PhantomJS - Unable to decode {$phantomjsLink}"); return false; } } else {