mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Rename ScheduleEntity -> EmailRecord
This commit is contained in:
parent
4f9db0124e
commit
8fff97ac4b
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\DataMapper\Schedule;
|
||||
|
||||
class ScheduleEntity
|
||||
{
|
||||
/**
|
||||
* Defines the template name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $template = 'schedule_entity';
|
||||
|
||||
/**
|
||||
* Defines the template name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $entity = ''; // invoice, credit, quote, purchase_order
|
||||
|
||||
/**
|
||||
* Defines the template name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $entity_id = '';
|
||||
}
|
@ -739,7 +739,9 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$invoices_string = \implode(', ', collect($this->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(),
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Services\Scheduler;
|
||||
|
||||
use App\Models\Scheduler;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class ScheduleEntity
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
public function __construct(public Scheduler $scheduler)
|
||||
{
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$class = 'App\\Models\\' . Str::camel($this->scheduler->parameters['entity']);
|
||||
|
||||
$class::find($this->decodePrimaryKey($this->scheduler->parameters['entity_id']))->service()->sendEmail();
|
||||
|
||||
$this->scheduler->forceDelete();
|
||||
}
|
||||
}
|
@ -38,9 +38,9 @@ class SchedulerService
|
||||
}
|
||||
}
|
||||
|
||||
private function schedule_entity()
|
||||
private function email_record()
|
||||
{
|
||||
(new ScheduleEntity($this->scheduler))->run();
|
||||
(new EmailRecord($this->scheduler))->run();
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
|
||||
namespace App\Services\Tax;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
|
||||
|
||||
class TaxService
|
||||
{
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user