1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-17 16:42:48 +01:00

Merge branch 'v5-develop' into v5-stable

This commit is contained in:
David Bomba 2021-04-30 12:54:36 +10:00
commit c29d0fff1f
23 changed files with 128316 additions and 128128 deletions

View File

@ -1,6 +1,9 @@
# Release notes # Release notes
## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop) ## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop)
- Add Cache-control: no-cache to prevent overaggressive caching of assets
## [v5.1.56-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.56-release)
## Fixed: ## Fixed:
- Fix User created/updated/deleted Actvity display format - Fix User created/updated/deleted Actvity display format
- Fix for Stripe autobill / token regression - Fix for Stripe autobill / token regression
@ -9,7 +12,7 @@
- Invoice / Quote / Credit created notifications - Invoice / Quote / Credit created notifications
- Logout route - deletes all auth tokens - Logout route - deletes all auth tokens
## [v5.1.54-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.50-release) ## [v5.1.54-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.54-release)
## Fixed: ## Fixed:
- Fixes for e-mails, encoding & parsing invalid HTML - Fixes for e-mails, encoding & parsing invalid HTML

View File

@ -1 +1 @@
5.1.56 5.1.57

View File

@ -283,6 +283,10 @@ class LoginController extends BaseController
} }
}); });
if($request->has('current_company') && $request->input('current_company') == 'true')
$cu->where("company_id", $company_token->company_id);
return $this->refreshResponse($cu); return $this->refreshResponse($cu);
} }

View File

@ -164,7 +164,7 @@ class InvoiceController extends Controller
if ($invoices->count() == 1) { if ($invoices->count() == 1) {
return response()->streamDownload(function () use ($invoices) { return response()->streamDownload(function () use ($invoices) {
echo file_get_contents($invoices->first()->pdf_file_path()); echo file_get_contents($invoices->first()->pdf_file_path());
}, basename($invoices->first()->pdf_file_path())); }, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
//return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($invoices->first()->pdf_file_path())); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($invoices->first()->pdf_file_path()));
} }

View File

@ -78,7 +78,7 @@ class QuoteController extends Controller
if ($quotes->count() == 1) { if ($quotes->count() == 1) {
return response()->streamDownload(function () use ($invoices) { return response()->streamDownload(function () use ($invoices) {
echo file_get_contents($invoices->first()->pdf_file_path()); echo file_get_contents($invoices->first()->pdf_file_path());
}, basename($invoices->first()->pdf_file_path())); }, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
//return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path())); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path()));
} }

View File

@ -538,7 +538,7 @@ class CreditController extends BaseController
case 'download': case 'download':
return response()->streamDownload(function () use ($credit) { return response()->streamDownload(function () use ($credit) {
echo file_get_contents($credit->pdf_file_path()); echo file_get_contents($credit->pdf_file_path());
}, basename($credit->pdf_file_path())); }, basename($credit->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
//return response()->download(TempFile::path($credit->pdf_file_path()), basename($credit->pdf_file_path())); //return response()->download(TempFile::path($credit->pdf_file_path()), basename($credit->pdf_file_path()));
break; break;
case 'archive': case 'archive':
@ -589,7 +589,7 @@ class CreditController extends BaseController
$file_path = $credit->service()->getCreditPdf($invitation); $file_path = $credit->service()->getCreditPdf($invitation);
return response()->download($file_path); return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']);
} }
/** /**

View File

@ -673,7 +673,7 @@ class InvoiceController extends BaseController
case 'download': case 'download':
return response()->streamDownload(function () use ($invoice) { return response()->streamDownload(function () use ($invoice) {
echo file_get_contents($invoice->pdf_file_path()); echo file_get_contents($invoice->pdf_file_path());
}, basename($invoice->pdf_file_path())); }, basename($invoice->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
//return response()->download(TempFile::path($invoice->pdf_file_path()), basename($invoice->pdf_file_path())); //return response()->download(TempFile::path($invoice->pdf_file_path()), basename($invoice->pdf_file_path()));
break; break;
case 'restore': case 'restore':
@ -795,7 +795,7 @@ class InvoiceController extends BaseController
$file_path = $invoice->service()->getInvoicePdf($contact); $file_path = $invoice->service()->getInvoicePdf($contact);
return response()->download($file_path, basename($file_path)); return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']);
} }
/** /**
@ -850,7 +850,7 @@ class InvoiceController extends BaseController
$file = public_path("storage/{$file_path}"); $file = public_path("storage/{$file_path}");
return response()->download($file, basename($file)); return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache']);
} catch (\Exception $e) { } catch (\Exception $e) {
return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500); return response(['message' => 'Oops, something went wrong. Make sure you have symlink to storage/ in public/ directory.'], 500);
} }

View File

@ -142,7 +142,7 @@ class PreviewController extends BaseController
//else //else
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company()); $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
return response()->download($file_path)->deleteFileAfterSend(true); return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true);
} }
return $this->blankEntity(); return $this->blankEntity();

View File

@ -677,7 +677,7 @@ class QuoteController extends BaseController
case 'download': case 'download':
return response()->streamDownload(function () use ($quote) { return response()->streamDownload(function () use ($quote) {
echo file_get_contents($quote->pdf_file_path()); echo file_get_contents($quote->pdf_file_path());
}, basename($quote->pdf_file_path())); }, basename($quote->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
//return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path())); //return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path()));
break; break;
case 'restore': case 'restore':
@ -730,7 +730,7 @@ class QuoteController extends BaseController
$file_path = $quote->service()->getQuotePdf($contact); $file_path = $quote->service()->getQuotePdf($contact);
return response()->download($file_path); return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']);
} }
/** /**

View File

@ -490,7 +490,7 @@ class RecurringInvoiceController extends BaseController
$file_path = $recurring_invoice->service()->getInvoicePdf($contact); $file_path = $recurring_invoice->service()->getInvoicePdf($contact);
return response()->download($file_path, basename($file_path)); return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache']);
} }
/** /**

View File

@ -21,6 +21,8 @@ class RecurringInvoicesCron
{ {
use Dispatchable; use Dispatchable;
public $tries = 1;
/** /**
* Create a new job instance. * Create a new job instance.
* *

View File

@ -60,6 +60,8 @@ class EmailEntity implements ShouldQueue
public $template_data; //The data to be merged into the template public $template_data; //The data to be merged into the template
public $tries = 1;
/** /**
* EmailEntity constructor. * EmailEntity constructor.
* *

View File

@ -94,7 +94,14 @@ class SendRecurring implements ShouldQueue
$invoice->invitations->each(function ($invitation) use ($invoice) { $invoice->invitations->each(function ($invitation) use ($invoice) {
if ($invitation->contact && strlen($invitation->contact->email) >=1) { if ($invitation->contact && strlen($invitation->contact->email) >=1) {
try{
EmailEntity::dispatch($invitation, $invoice->company); EmailEntity::dispatch($invitation, $invoice->company);
}
catch(\Exception $e) {
nlog($e->getMessage());
}
nlog("Firing email for invoice {$invoice->number}"); nlog("Firing email for invoice {$invoice->number}");
} }
}); });

View File

@ -47,6 +47,7 @@ class CompanyUser extends Pivot
'is_locked', 'is_locked',
'slack_webhook_url', 'slack_webhook_url',
'shop_restricted', 'shop_restricted',
'number_years_active',
]; ];
protected $touches = ['user']; protected $touches = ['user'];

View File

@ -395,9 +395,19 @@ class Invoice extends BaseModel
public function pdf_file_path($invitation = null, string $type = 'url') public function pdf_file_path($invitation = null, string $type = 'url')
{ {
if (! $invitation) { if (! $invitation) {
$invitation = $this->invitations->first();
if($this->invitations()->exists())
$invitation = $this->invitations()->first();
else{
$this->service()->createInvitations();
$invitation = $this->invitations()->first();
} }
}
if(!$invitation)
throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?');
$storage_path = Storage::$type($this->client->invoice_filepath().$this->numberFormatter().'.pdf'); $storage_path = Storage::$type($this->client->invoice_filepath().$this->numberFormatter().'.pdf');
if (! Storage::exists($this->client->invoice_filepath().$this->numberFormatter().'.pdf')) { if (! Storage::exists($this->client->invoice_filepath().$this->numberFormatter().'.pdf')) {

View File

@ -55,6 +55,16 @@ class CreateInvitations extends AbstractService
} }
}); });
if($this->invoice->invitations()->count() == 0) {
$contact = $this->createBlankContact();
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
$ii->invoice_id = $this->invoice->id;
$ii->client_contact_id = $contact->id;
$ii->save();
}
return $this->invoice; return $this->invoice;
} }
@ -65,5 +75,7 @@ class CreateInvitations extends AbstractService
$new_contact->contact_key = Str::random(40); $new_contact->contact_key = Str::random(40);
$new_contact->is_primary = true; $new_contact->is_primary = true;
$new_contact->save(); $new_contact->save();
return $new_contact;
} }
} }

View File

@ -51,6 +51,7 @@ class CompanyUserTransformer extends EntityTransformer
'archived_at' => (int) $company_user->deleted_at, 'archived_at' => (int) $company_user->deleted_at,
'created_at' => (int) $company_user->created_at, 'created_at' => (int) $company_user->created_at,
'permissions_updated_at' => (int) $company_user->permissions_updated_at, 'permissions_updated_at' => (int) $company_user->permissions_updated_at,
'number_years_active' => (int) $company_user->number_years_active,
]; ];
} }

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.1.56', 'app_version' => '5.1.57',
'app_tag' => '5.1.56-release', 'app_tag' => '5.1.57-release',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false), 'api_secret' => env('API_SECRET', false),

View File

@ -0,0 +1,37 @@
<?php
use App\Models\CompanyUser;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddNumberYearsActiveToCompanyUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('company_user', function (Blueprint $table) {
$table->unsignedInteger('number_years_active')->default(3);
});
CompanyUser::cursor()->each(function ($cu){
$cu->number_years_active = 3;
$cu->save();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -9,7 +9,7 @@ const RESOURCES = {
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed", "icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35", "icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
"manifest.json": "ce1b79950eb917ea619a0a30da27c6a3", "manifest.json": "ce1b79950eb917ea619a0a30da27c6a3",
"main.dart.js": "d314ade5d7821abc506cae06e529b6fd", "main.dart.js": "ca5bc685260a6de6833924b3bf0b6d9b",
"assets/NOTICES": "dcba058006722202a4906fb433998480", "assets/NOTICES": "dcba058006722202a4906fb433998480",
"assets/fonts/MaterialIcons-Regular.otf": "1288c9e28052e028aba623321f7826ac", "assets/fonts/MaterialIcons-Regular.otf": "1288c9e28052e028aba623321f7826ac",
"assets/AssetManifest.json": "659dcf9d1baf3aed3ab1b9c42112bf8f", "assets/AssetManifest.json": "659dcf9d1baf3aed3ab1b9c42112bf8f",

136913
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

119406
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long