Merge pull request #6365 from turbo124/v5-develop

fixes for live preview - flutter
This commit is contained in:
David Bomba 2021-07-30 17:38:16 +10:00 committed by GitHub
commit 75b2fcbc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 21 deletions

View File

@ -185,7 +185,10 @@ class InvoiceController extends Controller
$zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options); $zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options);
foreach ($invoices as $invoice) { foreach ($invoices as $invoice) {
$zip->addFileFromPath(basename($invoice->pdf_file_path()), TempFile::path($invoice->pdf_file_path()));
#add it to the zip
$zip->addFile(basename($invoice->pdf_file_path()), file_get_contents($invoice->pdf_file_path(null, 'url', true)));
} }
// finish the zip stream // finish the zip stream

View File

@ -107,7 +107,9 @@ class QuoteController extends Controller
$zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options); $zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options);
foreach ($quotes as $quote) { foreach ($quotes as $quote) {
$zip->addFileFromPath(basename($quote->pdf_file_path()), TempFile::path($quote->pdf_file_path())); $zip->addFile(basename($quote->pdf_file_path()), file_get_contents($quote->pdf_file_path(null, 'url', true)));
// $zip->addFileFromPath(basename($quote->pdf_file_path()), TempFile::path($quote->pdf_file_path()));
} }
// finish the zip stream // finish the zip stream

View File

@ -54,12 +54,19 @@ class CompanyPresenter extends EntityPresenter
$settings = $this->entity->settings; $settings = $this->entity->settings;
} }
$context_options =array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
if(strlen($settings->company_logo) >= 1 && (strpos($settings->company_logo, 'http') !== false)) if(strlen($settings->company_logo) >= 1 && (strpos($settings->company_logo, 'http') !== false))
return "data:image/png;base64, ". base64_encode(file_get_contents($settings->company_logo)); return "data:image/png;base64, ". base64_encode(file_get_contents($settings->company_logo, false, stream_context_create($context_options)));
else if(strlen($settings->company_logo) >= 1) else if(strlen($settings->company_logo) >= 1)
return "data:image/png;base64, ". base64_encode(file_get_contents(url('') . $settings->company_logo)); return "data:image/png;base64, ". base64_encode(file_get_contents(url('') . $settings->company_logo, false, stream_context_create($context_options)));
else else
return "data:image/png;base64, ". base64_encode(file_get_contents(asset('images/new_logo.png'))); return "data:image/png;base64, ". base64_encode(file_get_contents(asset('images/new_logo.png'), false, stream_context_create($context_options)));
} }

View File

@ -100,6 +100,11 @@ class PaymentMigrationRepository extends BaseRepository
$payment->deleted_at = $data['deleted_at'] ?: null; $payment->deleted_at = $data['deleted_at'] ?: null;
$payment->save(); $payment->save();
if(array_key_exists('currency_id', $data) && $data['currency_id'] == 0){
$payment->currency_id = $payment->company->settings->currency_id;
$payment->save();
}
/*Ensure payment number generated*/ /*Ensure payment number generated*/
if (! $payment->number || strlen($payment->number) == 0) { if (! $payment->number || strlen($payment->number) == 0) {
$payment->number = $payment->client->getNextPaymentNumber($payment->client); $payment->number = $payment->client->getNextPaymentNumber($payment->client);

View File

@ -108,10 +108,12 @@ class MarkInvoiceDeleted extends AbstractService
->where('paymentable_type', '=', 'invoices') ->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id) ->where('paymentable_id', $this->invoice->id)
->sum(DB::raw('amount')); ->sum(DB::raw('amount'));
//->sum(DB::raw('amount - refunded'));
} }
$this->total_payments = $this->invoice->payments->sum('amount'); $this->total_payments = $this->invoice->payments->sum('amount');
// $this->total_payments = $this->invoice->payments->sum('amount - refunded');
return $this; return $this;
} }

22
public/js/pdf.min.js vendored Normal file

File diff suppressed because one or more lines are too long

22
public/js/pdf.worker.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,10 @@
<title>Invoice Ninja</title> <title>Invoice Ninja</title>
<meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}"> <meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
<link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}"> <link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}">
<script src="{{ asset('js/pdf.min.js') }}"></script>
<script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "{{ asset('js/pdf.worker.min.js') }}";
</script>
</head> </head>
<body style="background-color:#888888;"> <body style="background-color:#888888;">

View File

@ -30,15 +30,14 @@
</script> </script>
@endif @endif
<!-- Title --> <!-- Title -->
@auth() @if(isset($account) && !$account->isPaid())
<title>@yield('meta_title', '') {{ auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja' }}</title> <title>@yield('meta_title', '') Invoice Ninja</title>
@endauth @elseif(isset($company) && !is_null($company))
<title>@yield('meta_title', '') {{ $company->present()->name() }}</title>
@guest @else
<title>@yield('meta_title', '') {{ config('app.name') }}</title> <title>@yield('meta_title', '')</title>
@endguest @endif
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -31,13 +31,13 @@
@endif @endif
<!-- Title --> <!-- Title -->
@auth() @if(isset($account) && !$account->isPaid())
<title>@yield('meta_title', '') {{ auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja' }}</title> <title>@yield('meta_title', '') Invoice Ninja</title>
@endauth @elseif(isset($company) && !is_null($company))
<title>@yield('meta_title', '') {{ $company->present()->name() }}</title>
@guest @else
<title>@yield('meta_title', '') {{ config('app.name') }}</title> <title>@yield('meta_title', '')</title>
@endguest @endif
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -172,10 +172,11 @@ class DeleteInvoiceTest extends TestCase
$client_hash_id = $arr['data']['id']; $client_hash_id = $arr['data']['id'];
$client = Client::find($this->decodePrimaryKey($client_hash_id)); $client = Client::find($this->decodePrimaryKey($client_hash_id));
//new client
$this->assertEquals($client->balance, 0); $this->assertEquals($client->balance, 0);
$this->assertEquals($client->paid_to_date, 0); $this->assertEquals($client->paid_to_date, 0);
//create new invoice.
//create new invoice.
$line_items = []; $line_items = [];
$item = InvoiceItemFactory::create(); $item = InvoiceItemFactory::create();