1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
This commit is contained in:
David Bomba 2023-06-30 15:43:28 +10:00
parent 8017b589c2
commit 2f49bc8382
14 changed files with 73 additions and 25 deletions

View File

@ -1 +1 @@
5.6.4
5.6.5

View File

@ -137,7 +137,7 @@ class ApplyPayment
->updateBalance($this->amount_applied * -1)
->updatePaidToDate($this->amount_applied)
->updateStatus()
->touchPdf()
->deletePdf()
->save();
$this->credit
@ -147,7 +147,7 @@ class ApplyPayment
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
if ((int) $this->invoice->balance == 0) {
$this->invoice->service()->touchPdf();
$this->invoice->service()->deletePdf();
$this->invoice = $this->invoice->fresh();
event(new InvoiceWasPaid($this->invoice, $this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}

View File

@ -11,15 +11,17 @@
namespace App\Services\Credit;
use App\Factory\PaymentFactory;
use App\Jobs\Entity\CreateEntityPdf;
use App\Jobs\Util\UnlinkFile;
use App\Utils\Ninja;
use App\Models\Credit;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Jobs\Util\UnlinkFile;
use App\Factory\PaymentFactory;
use App\Utils\Traits\MakesHash;
use App\Jobs\Entity\CreateEntityPdf;
use App\Repositories\CreditRepository;
use App\Repositories\PaymentRepository;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Storage;
class CreditService
{
@ -235,7 +237,24 @@ class CreditService
public function deletePdf()
{
$this->credit->invitations->each(function ($invitation) {
(new UnlinkFile(config('filesystems.default'), $this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf'))->handle();
// (new UnlinkFile(config('filesystems.default'), $this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf'))->handle();
//30-06-2023
try {
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
Storage::disk(config('filesystems.default'))->delete($this->credit->client->credit_filepath($invitation).$this->credit->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->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf');
}
} catch (\Exception $e) {
nlog($e->getMessage());
}
});
return $this;

View File

@ -42,7 +42,7 @@ class MarkSent
->setStatus(Credit::STATUS_SENT)
->applyNumber()
->adjustBalance($this->credit->amount)
->touchPdf()
->deletePdf()
->save();
$this->client

View File

@ -92,7 +92,7 @@ class ApplyPayment extends AbstractService
}
});
$this->invoice->service()->applyNumber()->workFlow()->touchPdf()->save();
$this->invoice->service()->applyNumber()->workFlow()->deletePdf()->save();
return $this->invoice;
}

View File

@ -338,7 +338,7 @@ class InvoiceService
return $item;
})->toArray();
$this->touchPdf();
$this->deletePdf();
return $this;
}
@ -405,7 +405,7 @@ class InvoiceService
})->toArray();
$this->invoice = $this->invoice->calc()->getInvoice();
$this->touchPdf();
$this->deletePdf();
/* 24-03-2022 */
$new_balance = $this->invoice->balance;

View File

@ -102,7 +102,7 @@ class MarkPaid extends AbstractService
$this->invoice
->service()
->applyNumber()
->touchPdf()
->deletePdf()
->save();
$payment->ledger()

View File

@ -79,7 +79,7 @@ class UpdateInvoicePayment
$invoice = $invoice->service()
->clearPartial()
->updateStatus()
->touchPdf()
->deletePdf()
->workFlow()
->save();

View File

@ -43,10 +43,6 @@ class TriggeredActions extends AbstractService
$this->purchase_order = $this->purchase_order->service()->markSent()->touchPdf()->save();
}
// if ($this->request->has('cancel') && $this->request->input('cancel') == 'true') {
// $this->purchase_order = $this->purchase_order->service()->handleCancellation()->save();
// }
if ($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') {
$company = $this->purchase_order->company;
$settings = $company->settings;

View File

@ -47,7 +47,7 @@ class MarkSent
->service()
->setStatus(Quote::STATUS_SENT)
->applyNumber()
->touchPdf()
->deletePdf()
->save();
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -19,6 +19,7 @@ use App\Exceptions\QuoteConversion;
use App\Jobs\Entity\CreateEntityPdf;
use App\Repositories\QuoteRepository;
use App\Events\Quote\QuoteWasApproved;
use Illuminate\Support\Facades\Storage;
class QuoteService
{
@ -115,7 +116,7 @@ class QuoteService
$this->invoice
->service()
->markSent()
->touchPdf()
->deletePdf()
->save();
}
@ -224,7 +225,22 @@ class QuoteService
public function deletePdf()
{
$this->quote->invitations->each(function ($invitation) {
(new UnlinkFile(config('filesystems.default'), $this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf'))->handle();
// (new UnlinkFile(config('filesystems.default'), $this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf'))->handle();
//30-06-2023
try {
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
Storage::disk(config('filesystems.default'))->delete($this->quote->client->quote_filepath($invitation).$this->quote->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->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf');
}
} catch (\Exception $e) {
nlog($e->getMessage());
}
});
return $this;

View File

@ -11,11 +11,13 @@
namespace App\Services\Recurring;
use App\Utils\Ninja;
use App\Jobs\Util\UnlinkFile;
use App\Models\RecurringQuote;
use Illuminate\Support\Carbon;
use App\Models\RecurringExpense;
use App\Models\RecurringInvoice;
use Illuminate\Support\Facades\Storage;
use App\Jobs\RecurringInvoice\SendRecurring;
class RecurringService
@ -88,7 +90,22 @@ class RecurringService
public function deletePdf()
{
$this->recurring_entity->invitations->each(function ($invitation) {
(new UnlinkFile(config('filesystems.default'), $this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf'))->handle();
// (new UnlinkFile(config('filesystems.default'), $this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf'))->handle();
//30-06-2023
try {
Storage::disk(config('filesystems.default'))->delete($this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf');
// if (Storage::disk(config('filesystems.default'))->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')) {
Storage::disk('public')->delete($this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf');
if (Ninja::isHosted()) {
}
} catch (\Exception $e) {
nlog($e->getMessage());
}
});

View File

@ -188,7 +188,7 @@ class SubscriptionService
//update the invoice and attach to the recurring invoice!!!!!
$invoice->recurring_id = $recurring_invoice->id;
$invoice->is_proforma = false;
$invoice->service()->touchPdf();
$invoice->service()->deletePdf();
$invoice->save();
$contact = $invoice->client->contacts()->whereNotNull('email')->first();

View File

@ -15,8 +15,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.6.4',
'app_tag' => '5.6.4',
'app_version' => '5.6.5',
'app_tag' => '5.6.5',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),