Zip export check if gmp is here #1902

This commit is contained in:
Hillel Coren 2018-02-21 15:49:18 +02:00
parent 64378e901a
commit a4d4b2b96c
6 changed files with 21 additions and 0 deletions

View File

@ -46,6 +46,10 @@ class DownloadInvoices extends Job
*/
public function handle(UserMailer $userMailer)
{
if (! extension_loaded('GMP')) {
die(trans('texts.gmp_required'));
}
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoice_pdfs')));
foreach ($this->invoices as $invoice) {

View File

@ -51,6 +51,10 @@ class DocumentReport extends AbstractReport
}
if ($this->isExport && $exportFormat == 'zip') {
if (! extension_loaded('GMP')) {
die(trans('texts.gmp_required'));
}
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.documents')));
foreach ($records as $record) {
foreach ($record->documents as $document) {

View File

@ -49,6 +49,10 @@ class ExpenseReport extends AbstractReport
->where('expense_date', '<=', $this->endDate);
if ($this->isExport && $exportFormat == 'zip') {
if (! extension_loaded('GMP')) {
die(trans('texts.gmp_required'));
}
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.expense_documents')));
foreach ($expenses->get() as $expense) {
foreach ($expense->documents as $document) {

View File

@ -67,6 +67,10 @@ class InvoiceReport extends AbstractReport
if ($this->isExport && $exportFormat == 'zip') {
if (! extension_loaded('GMP')) {
die(trans('texts.gmp_required'));
}
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoice_documents')));
foreach ($clients->get() as $client) {
foreach ($client->invoices as $invoice) {

View File

@ -58,6 +58,10 @@ class QuoteReport extends AbstractReport
}]);
if ($this->isExport && $exportFormat == 'zip') {
if (! extension_loaded('GMP')) {
die(trans('texts.gmp_required'));
}
$zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.quote_documents')));
foreach ($clients->get() as $client) {
foreach ($client->invoices as $invoice) {

View File

@ -2750,6 +2750,7 @@ $LANG = array(
'email_address_changed_message' => 'The email address for your account has been changed from :old_email to :new_email.',
'test' => 'Test',
'beta' => 'Beta',
'gmp_required' => 'Exporting to ZIP requires the GMP extension',
);