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) ->updateBalance($this->amount_applied * -1)
->updatePaidToDate($this->amount_applied) ->updatePaidToDate($this->amount_applied)
->updateStatus() ->updateStatus()
->touchPdf() ->deletePdf()
->save(); ->save();
$this->credit $this->credit
@ -147,7 +147,7 @@ class ApplyPayment
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
if ((int) $this->invoice->balance == 0) { if ((int) $this->invoice->balance == 0) {
$this->invoice->service()->touchPdf(); $this->invoice->service()->deletePdf();
$this->invoice = $this->invoice->fresh(); $this->invoice = $this->invoice->fresh();
event(new InvoiceWasPaid($this->invoice, $this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); 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; namespace App\Services\Credit;
use App\Factory\PaymentFactory; use App\Utils\Ninja;
use App\Jobs\Entity\CreateEntityPdf;
use App\Jobs\Util\UnlinkFile;
use App\Models\Credit; use App\Models\Credit;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentType; 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\CreditRepository;
use App\Repositories\PaymentRepository; use App\Repositories\PaymentRepository;
use App\Utils\Traits\MakesHash; use Illuminate\Support\Facades\Storage;
class CreditService class CreditService
{ {
@ -235,7 +237,24 @@ class CreditService
public function deletePdf() public function deletePdf()
{ {
$this->credit->invitations->each(function ($invitation) { $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; return $this;

View File

@ -42,7 +42,7 @@ class MarkSent
->setStatus(Credit::STATUS_SENT) ->setStatus(Credit::STATUS_SENT)
->applyNumber() ->applyNumber()
->adjustBalance($this->credit->amount) ->adjustBalance($this->credit->amount)
->touchPdf() ->deletePdf()
->save(); ->save();
$this->client $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; return $this->invoice;
} }

View File

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

View File

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

View File

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

View File

@ -43,10 +43,6 @@ class TriggeredActions extends AbstractService
$this->purchase_order = $this->purchase_order->service()->markSent()->touchPdf()->save(); $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') { if ($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') {
$company = $this->purchase_order->company; $company = $this->purchase_order->company;
$settings = $company->settings; $settings = $company->settings;

View File

@ -47,7 +47,7 @@ class MarkSent
->service() ->service()
->setStatus(Quote::STATUS_SENT) ->setStatus(Quote::STATUS_SENT)
->applyNumber() ->applyNumber()
->touchPdf() ->deletePdf()
->save(); ->save();
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); 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\Jobs\Entity\CreateEntityPdf;
use App\Repositories\QuoteRepository; use App\Repositories\QuoteRepository;
use App\Events\Quote\QuoteWasApproved; use App\Events\Quote\QuoteWasApproved;
use Illuminate\Support\Facades\Storage;
class QuoteService class QuoteService
{ {
@ -115,7 +116,7 @@ class QuoteService
$this->invoice $this->invoice
->service() ->service()
->markSent() ->markSent()
->touchPdf() ->deletePdf()
->save(); ->save();
} }
@ -224,7 +225,22 @@ class QuoteService
public function deletePdf() public function deletePdf()
{ {
$this->quote->invitations->each(function ($invitation) { $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; return $this;

View File

@ -11,11 +11,13 @@
namespace App\Services\Recurring; namespace App\Services\Recurring;
use App\Utils\Ninja;
use App\Jobs\Util\UnlinkFile; use App\Jobs\Util\UnlinkFile;
use App\Models\RecurringQuote; use App\Models\RecurringQuote;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use App\Models\RecurringExpense; use App\Models\RecurringExpense;
use App\Models\RecurringInvoice; use App\Models\RecurringInvoice;
use Illuminate\Support\Facades\Storage;
use App\Jobs\RecurringInvoice\SendRecurring; use App\Jobs\RecurringInvoice\SendRecurring;
class RecurringService class RecurringService
@ -88,7 +90,22 @@ class RecurringService
public function deletePdf() public function deletePdf()
{ {
$this->recurring_entity->invitations->each(function ($invitation) { $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!!!!! //update the invoice and attach to the recurring invoice!!!!!
$invoice->recurring_id = $recurring_invoice->id; $invoice->recurring_id = $recurring_invoice->id;
$invoice->is_proforma = false; $invoice->is_proforma = false;
$invoice->service()->touchPdf(); $invoice->service()->deletePdf();
$invoice->save(); $invoice->save();
$contact = $invoice->client->contacts()->whereNotNull('email')->first(); $contact = $invoice->client->contacts()->whereNotNull('email')->first();

View File

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