diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index cdafc27f70..9520dce7e0 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], ]; diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index e98bc428d6..6d0d5b1ad0 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/app/Models/Invoice.php b/app/Models/Invoice.php index 1cc9e90226..9c1aa6832d 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 { diff --git a/docs/developer_guide.rst b/docs/developer_guide.rst index 78b9fbf3c5..155e4e66fc 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 """""""" diff --git a/docs/update.rst b/docs/update.rst index abe29b6e3a..c8af0f37d3 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. diff --git a/resources/views/public_list.blade.php b/resources/views/public_list.blade.php index d535ab1bdf..970280fb90 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') !!}