mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improvements for disk handling
This commit is contained in:
parent
974aabe87e
commit
5b4232f7e3
@ -307,9 +307,6 @@ class EmailDefaults
|
|||||||
|
|
||||||
$xinvoice_path = $this->email->email_object->entity->service()->getEInvoice();
|
$xinvoice_path = $this->email->email_object->entity->service()->getEInvoice();
|
||||||
|
|
||||||
// $xinvoice_path = (new CreateEInvoice($this->email->email_object->entity, true, stream_get_meta_data($tempfile)['uri']))->handle();
|
|
||||||
// $this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
|
|
||||||
|
|
||||||
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_path))
|
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_path))
|
||||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode(Storage::get($xinvoice_path)), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-xinvoice.xml"]]);
|
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode(Storage::get($xinvoice_path)), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-xinvoice.xml"]]);
|
||||||
|
|
||||||
|
@ -115,7 +115,6 @@ class InvoiceService
|
|||||||
*/
|
*/
|
||||||
public function applyPayment(Payment $payment, float $payment_amount)
|
public function applyPayment(Payment $payment, float $payment_amount)
|
||||||
{
|
{
|
||||||
// $this->deletePdf();
|
|
||||||
$this->invoice = $this->markSent()->save();
|
$this->invoice = $this->markSent()->save();
|
||||||
|
|
||||||
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
|
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
|
||||||
@ -348,13 +347,15 @@ class InvoiceService
|
|||||||
{
|
{
|
||||||
$this->invoice->load('invitations');
|
$this->invoice->load('invitations');
|
||||||
|
|
||||||
|
//30-06-2023
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
try {
|
try {
|
||||||
if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -371,11 +372,12 @@ class InvoiceService
|
|||||||
|
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
try {
|
try {
|
||||||
if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
||||||
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
Storage::disk('public')->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
Storage::disk('public')->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user