Fixes for bulk invoice downloads

This commit is contained in:
David Bomba 2021-07-30 10:37:32 +10:00
parent 055e40ccc6
commit c298ab40fa
3 changed files with 17 additions and 5 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);
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

View File

@ -107,7 +107,9 @@ class QuoteController extends Controller
$zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options);
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

View File

@ -54,12 +54,19 @@ class CompanyPresenter extends EntityPresenter
$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))
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)
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
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)));
}