diff --git a/app/DataMapper/Schedule/ScheduleEntity.php b/app/DataMapper/Schedule/ScheduleEntity.php deleted file mode 100644 index 649360f4354cc..0000000000000 --- a/app/DataMapper/Schedule/ScheduleEntity.php +++ /dev/null @@ -1,36 +0,0 @@ -payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null; $amount = Number::formatMoney($this->payment_hash?->amount_with_fee() ?: 0, $this->client); - if ($abbreviated || ! $invoices_string) { + if($abbreviated && $invoices_string){ + return $invoices_string; + } elseif ($abbreviated || ! $invoices_string) { return ctrans('texts.gateway_payment_text_no_invoice', [ 'amount' => $amount, 'client' => $this->client->present()->name(), diff --git a/app/Services/Scheduler/ScheduleEntity.php b/app/Services/Scheduler/ScheduleEntity.php deleted file mode 100644 index b7a93bd8f1e72..0000000000000 --- a/app/Services/Scheduler/ScheduleEntity.php +++ /dev/null @@ -1,34 +0,0 @@ -scheduler->parameters['entity']); - - $class::find($this->decodePrimaryKey($this->scheduler->parameters['entity_id']))->service()->sendEmail(); - - $this->scheduler->forceDelete(); - } -} diff --git a/app/Services/Scheduler/SchedulerService.php b/app/Services/Scheduler/SchedulerService.php index 7a670ada6ab82..1533d26a7485b 100644 --- a/app/Services/Scheduler/SchedulerService.php +++ b/app/Services/Scheduler/SchedulerService.php @@ -38,9 +38,9 @@ class SchedulerService } } - private function schedule_entity() + private function email_record() { - (new ScheduleEntity($this->scheduler))->run(); + (new EmailRecord($this->scheduler))->run(); } diff --git a/app/Services/Tax/TaxService.php b/app/Services/Tax/TaxService.php index 36623162ca016..8d29eb2991299 100644 --- a/app/Services/Tax/TaxService.php +++ b/app/Services/Tax/TaxService.php @@ -11,6 +11,9 @@ namespace App\Services\Tax; +use App\Models\Client; +use App\Models\Company; + class TaxService { diff --git a/tests/Feature/Scheduler/ScheduleEntityTest.php b/tests/Feature/Scheduler/ScheduleEntityTest.php index 76a4ddb025220..f60a71ea1b47a 100644 --- a/tests/Feature/Scheduler/ScheduleEntityTest.php +++ b/tests/Feature/Scheduler/ScheduleEntityTest.php @@ -30,7 +30,7 @@ use Illuminate\Routing\Middleware\ThrottleRequests; /** * @test - * @covers App\Services\Scheduler\SchedulerEntity + * @covers App\Services\Scheduler\EmailRecord */ class ScheduleEntityTest extends TestCase { @@ -62,7 +62,7 @@ class ScheduleEntityTest extends TestCase 'name' => 'A test entity email scheduler', 'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY, 'next_run' => now()->format('Y-m-d'), - 'template' => 'schedule_entity', + 'template' => 'email_record', 'parameters' => [ 'entity' => 'invoice', 'entity_id' => $this->invoice->hashed_id, @@ -86,7 +86,7 @@ class ScheduleEntityTest extends TestCase 'name' => 'A test entity email scheduler', 'frequency_id' => 0, 'next_run' => now()->format('Y-m-d'), - 'template' => 'schedule_entity', + 'template' => 'email_record', 'parameters' => [ 'entity' => 'invoice', 'entity_id' => $this->invoice->hashed_id, @@ -108,7 +108,7 @@ class ScheduleEntityTest extends TestCase $data = [ 'name' => 'A test entity email scheduler', 'next_run' => now()->format('Y-m-d'), - 'template' => 'schedule_entity', + 'template' => 'email_record', 'parameters' => [ 'entity' => 'invoice', 'entity_id' => $this->invoice->hashed_id,