mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 15:24:36 -04: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;
|
$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);
|
$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', [
|
return ctrans('texts.gateway_payment_text_no_invoice', [
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'client' => $this->client->present()->name(),
|
'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;
|
namespace App\Services\Tax;
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\Company;
|
||||||
|
|
||||||
|
|
||||||
class TaxService
|
class TaxService
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ use Illuminate\Routing\Middleware\ThrottleRequests;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @covers App\Services\Scheduler\SchedulerEntity
|
* @covers App\Services\Scheduler\EmailRecord
|
||||||
*/
|
*/
|
||||||
class ScheduleEntityTest extends TestCase
|
class ScheduleEntityTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@ class ScheduleEntityTest extends TestCase
|
|||||||
'name' => 'A test entity email scheduler',
|
'name' => 'A test entity email scheduler',
|
||||||
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
||||||
'next_run' => now()->format('Y-m-d'),
|
'next_run' => now()->format('Y-m-d'),
|
||||||
'template' => 'schedule_entity',
|
'template' => 'email_record',
|
||||||
'parameters' => [
|
'parameters' => [
|
||||||
'entity' => 'invoice',
|
'entity' => 'invoice',
|
||||||
'entity_id' => $this->invoice->hashed_id,
|
'entity_id' => $this->invoice->hashed_id,
|
||||||
@ -86,7 +86,7 @@ class ScheduleEntityTest extends TestCase
|
|||||||
'name' => 'A test entity email scheduler',
|
'name' => 'A test entity email scheduler',
|
||||||
'frequency_id' => 0,
|
'frequency_id' => 0,
|
||||||
'next_run' => now()->format('Y-m-d'),
|
'next_run' => now()->format('Y-m-d'),
|
||||||
'template' => 'schedule_entity',
|
'template' => 'email_record',
|
||||||
'parameters' => [
|
'parameters' => [
|
||||||
'entity' => 'invoice',
|
'entity' => 'invoice',
|
||||||
'entity_id' => $this->invoice->hashed_id,
|
'entity_id' => $this->invoice->hashed_id,
|
||||||
@ -108,7 +108,7 @@ class ScheduleEntityTest extends TestCase
|
|||||||
$data = [
|
$data = [
|
||||||
'name' => 'A test entity email scheduler',
|
'name' => 'A test entity email scheduler',
|
||||||
'next_run' => now()->format('Y-m-d'),
|
'next_run' => now()->format('Y-m-d'),
|
||||||
'template' => 'schedule_entity',
|
'template' => 'email_record',
|
||||||
'parameters' => [
|
'parameters' => [
|
||||||
'entity' => 'invoice',
|
'entity' => 'invoice',
|
||||||
'entity_id' => $this->invoice->hashed_id,
|
'entity_id' => $this->invoice->hashed_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user