mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Cleanup for emails
This commit is contained in:
parent
3cb4585880
commit
e3f0493c48
@ -128,7 +128,11 @@ class EmailController extends BaseController
|
|||||||
'body' => $body
|
'body' => $body
|
||||||
];
|
];
|
||||||
|
|
||||||
EmailEntity::dispatchNow($invitation, $invitation->company, $template, $data);
|
$entity_obj->service()->markSent()->save();
|
||||||
|
|
||||||
|
//@TODO why is this dispatchNow instead of just dispatch?
|
||||||
|
//update - changing to dispatch and see if something breaks.
|
||||||
|
EmailEntity::dispatch($invitation, $invitation->company, $template, $data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -108,7 +108,6 @@ class CreateEntityPdf implements ShouldQueue
|
|||||||
$entity_design_id = 'credit_design_id';
|
$entity_design_id = 'credit_design_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$file_path = $path.$this->entity->number.'.pdf';
|
$file_path = $path.$this->entity->number.'.pdf';
|
||||||
|
|
||||||
$entity_design_id = $this->entity->design_id ? $this->entity->design_id : $this->decodePrimaryKey($this->entity->client->getSetting($entity_design_id));
|
$entity_design_id = $this->entity->design_id ? $this->entity->design_id : $this->decodePrimaryKey($this->entity->client->getSetting($entity_design_id));
|
||||||
@ -145,10 +144,6 @@ class CreateEntityPdf implements ShouldQueue
|
|||||||
->design($template)
|
->design($template)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
|
|
||||||
//nlog("make dir => {$path}");
|
|
||||||
//Storage::makeDirectory($path, 0775);
|
|
||||||
|
|
||||||
$pdf = null;
|
$pdf = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -110,15 +110,11 @@ class EmailEntity extends BaseMailerJob implements ShouldQueue
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// $this->failed($e);
|
|
||||||
$this->entityEmailFailed($e->getMessage());
|
$this->entityEmailFailed($e->getMessage());
|
||||||
$this->logMailError($e->getMessage(), $this->entity->client);
|
$this->logMailError($e->getMessage(), $this->entity->client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (count(Mail::failures()) == 0) {
|
|
||||||
// $this->entityEmailSucceeded();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* Mark entity sent */
|
/* Mark entity sent */
|
||||||
$this->entity->service()->markSent()->save();
|
$this->entity->service()->markSent()->save();
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use App\Jobs\Entity\CreateEntityPdf;
|
|||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Services\AbstractService;
|
use App\Services\AbstractService;
|
||||||
|
use App\Utils\TempFile;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class GetInvoicePdf extends AbstractService
|
class GetInvoicePdf extends AbstractService
|
||||||
@ -46,6 +47,10 @@ class GetInvoicePdf extends AbstractService
|
|||||||
$file_path = CreateEntityPdf::dispatchNow($invitation);
|
$file_path = CreateEntityPdf::dispatchNow($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Storage::disk($disk)->path($file_path);
|
|
||||||
|
return TempFile::path(Storage::disk($disk)->url($file_path));
|
||||||
|
|
||||||
|
// return Storage::disk($disk)->url($file_path);
|
||||||
|
// return Storage::disk($disk)->path($file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class TempFile
|
|||||||
{
|
{
|
||||||
public static function path($url) :string
|
public static function path($url) :string
|
||||||
{
|
{
|
||||||
$temp_path = tempnam(sys_get_temp_dir(), basename($url));
|
$temp_path = @tempnam(sys_get_temp_dir() . '/' . sha1(time()), basename($url));
|
||||||
copy($url, $temp_path);
|
copy($url, $temp_path);
|
||||||
|
|
||||||
return $temp_path;
|
return $temp_path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user