mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-03-03 02:57:01 +00:00
5
.github/workflows/react_release.yml
vendored
5
.github/workflows/react_release.yml
vendored
@@ -16,10 +16,11 @@ jobs:
|
||||
extensions: mysql, mysqlnd, sqlite3, bcmath, gd, curl, zip, openssl, mbstring, xml
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v1
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: v5-develop
|
||||
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Copy .env file
|
||||
run: |
|
||||
cp .env.example .env
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.10.55
|
||||
5.10.56
|
||||
@@ -42,6 +42,7 @@ class SearchController extends Controller
|
||||
$user = auth()->user();
|
||||
|
||||
$this->clientMap($user);
|
||||
|
||||
$this->invoiceMap($user);
|
||||
|
||||
return response()->json([
|
||||
@@ -63,7 +64,7 @@ class SearchController extends Controller
|
||||
$elastic = ClientBuilder::fromConfig(config('elastic.client.connections.default'));
|
||||
|
||||
$params = [
|
||||
'index' => 'clients,invoices,client_contacts',
|
||||
'index' => 'clients,invoices,client_contacts,quotes,expenses,credits,recurring_invoices,vendors,vendor_contacts,purchase_orders',
|
||||
'body' => [
|
||||
'query' => [
|
||||
'bool' => [
|
||||
@@ -93,6 +94,7 @@ class SearchController extends Controller
|
||||
'clients' => $this->clients,
|
||||
'client_contacts' => $this->client_contacts,
|
||||
'invoices' => $this->invoices,
|
||||
'quotes' => $this->quotes,
|
||||
'settings' => $this->settingsMap(),
|
||||
], 200);
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ class ProcessMailgunWebhook implements ShouldQueue
|
||||
|
||||
$bounce = new EmailBounce(
|
||||
$this->request['event-data']['tags'][0],
|
||||
$this->request['event-data']['envelope']['sender'] ?? $this->request['event-data']['envelope']['from'],
|
||||
$this->request['event-data']['message']['headers']['from'] ?? $this->request['event-data']['message']['headers']['to'],
|
||||
$this->message_id
|
||||
);
|
||||
|
||||
@@ -374,11 +374,11 @@ class ProcessMailgunWebhook implements ShouldQueue
|
||||
|
||||
$event = [
|
||||
'bounce_id' => $this->request['event-data']['id'],
|
||||
'recipient' => $this->request['event-data']['recipient'] ?? '',
|
||||
'recipient' => $this->request['event-data']['message']['headers']['to'] ?? '',
|
||||
'status' => $this->request['event-data']['event'] ?? '',
|
||||
'delivery_message' => $this->request['event-data']['delivery-status']['description'] ?? $this->request['event-data']['delivery-status']['message'] ?? '',
|
||||
'server' => $this->request['event-data']['delivery-status']['mx-host'] ?? '',
|
||||
'server_ip' => $this->request['event-data']['envelope']['sending-ip'] ?? '',
|
||||
'delivery_message' => $this->request['event-data']['delivery-status']['message'] ?? $this->request['event-data']['delivery-status']['bounce-code'] ?? '',
|
||||
'server' => $this->request['event-data']['delivery-status']['message'] ?? '',
|
||||
'server_ip' => '',
|
||||
'date' => \Carbon\Carbon::parse($this->request['event-data']['timestamp'])->format('Y-m-d H:i:s') ?? '',
|
||||
];
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ namespace App\Models;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Jobs\Util\WebhookHandler;
|
||||
use App\Models\Traits\Excludable;
|
||||
use App\Services\EDocument\Jobes\SendEDocument;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
use App\Services\EDocument\Jobes\SendEDocument;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||
|
||||
@@ -80,6 +81,7 @@ class BaseModel extends Model
|
||||
use UserSessionAttributes;
|
||||
use HasFactory;
|
||||
use Excludable;
|
||||
use MakesDates;
|
||||
|
||||
public int $max_attachment_size = 3000000;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ use Laravel\Scout\Searchable;
|
||||
use App\DataMapper\ClientSync;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Models\Traits\Excludable;
|
||||
use App\DataMapper\ClientSettings;
|
||||
@@ -120,7 +119,6 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
{
|
||||
use PresentableTrait;
|
||||
use MakesHash;
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
use GeneratesCounter;
|
||||
@@ -251,6 +249,7 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'hashed_id' => $this->hashed_id,
|
||||
@@ -286,10 +285,10 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getScoutKeyName()
|
||||
{
|
||||
return 'hashed_id';
|
||||
}
|
||||
// public function getScoutKeyName()
|
||||
// {
|
||||
// return 'hashed_id';
|
||||
// }
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
|
||||
@@ -171,6 +171,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->present()->search_display(),
|
||||
'hashed_id' => $this->client->hashed_id,
|
||||
'email' => $this->email,
|
||||
@@ -190,10 +191,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getScoutKeyName()
|
||||
{
|
||||
return 'hashed_id';
|
||||
}
|
||||
/*
|
||||
V2 type of scope
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
*/
|
||||
class ClientGatewayToken extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -11,18 +11,20 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Number;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Models\Presenters\CreditPresenter;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use App\Services\Credit\CreditService;
|
||||
use App\Services\Ledger\LedgerService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceValues;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Models\Presenters\CreditPresenter;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* App\Models\Credit
|
||||
@@ -128,12 +130,12 @@ class Credit extends BaseModel
|
||||
{
|
||||
use MakesHash;
|
||||
use Filterable;
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use PresentableTrait;
|
||||
use MakesInvoiceValues;
|
||||
use MakesReminders;
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $presenter = CreditPresenter::class;
|
||||
|
||||
protected $fillable = [
|
||||
@@ -194,6 +196,35 @@ class Credit extends BaseModel
|
||||
|
||||
public const STATUS_APPLIED = 4;
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$locale = $this->company->locale();
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.credit') . " " . $this->number . " | " . $this->client->present()->name() . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'amount' => (float) $this->amount,
|
||||
'balance' => (float) $this->balance,
|
||||
'due_date' => $this->due_date,
|
||||
'date' => $this->date,
|
||||
'custom_value1' => (string)$this->custom_value1,
|
||||
'custom_value2' => (string)$this->custom_value2,
|
||||
'custom_value3' => (string)$this->custom_value3,
|
||||
'custom_value4' => (string)$this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
'po_number' => (string)$this->po_number,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -76,7 +75,6 @@ use Illuminate\Support\Carbon;
|
||||
*/
|
||||
class CreditInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Inviteable;
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Number;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
@@ -95,7 +98,8 @@ class Expense extends BaseModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $fillable = [
|
||||
'client_id',
|
||||
'assigned_user_id',
|
||||
@@ -161,6 +165,33 @@ class Expense extends BaseModel
|
||||
|
||||
protected $touches = [];
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$locale = $this->company->locale();
|
||||
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.expense') . " " . $this->number . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'amount' => (float) $this->amount,
|
||||
'date' => $this->date,
|
||||
'custom_value1' => (string)$this->custom_value1,
|
||||
'custom_value2' => (string)$this->custom_value2,
|
||||
'custom_value3' => (string)$this->custom_value3,
|
||||
'custom_value4' => (string)$this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
|
||||
@@ -15,7 +15,6 @@ use App\Utils\Ninja;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\DataMapper\InvoiceSync;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
@@ -143,7 +142,6 @@ class Invoice extends BaseModel
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
use NumberFormatter;
|
||||
use MakesDates;
|
||||
use PresentableTrait;
|
||||
use MakesInvoiceValues;
|
||||
use MakesReminders;
|
||||
@@ -249,6 +247,7 @@ class Invoice extends BaseModel
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.invoice') . " " . $this->number . " | " . $this->client->present()->name() . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
@@ -271,11 +270,6 @@ class Invoice extends BaseModel
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getScoutKeyName()
|
||||
{
|
||||
return 'hashed_id';
|
||||
}
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -77,7 +76,6 @@ use Illuminate\Support\Carbon;
|
||||
*/
|
||||
class InvoiceInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Inviteable;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ use App\Services\Payment\PaymentService;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Payment\Refundable;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -97,7 +96,6 @@ class Payment extends BaseModel
|
||||
{
|
||||
use MakesHash;
|
||||
use Filterable;
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Refundable;
|
||||
use Inviteable;
|
||||
|
||||
@@ -39,4 +39,9 @@ class VendorContactPresenter extends EntityPresenter
|
||||
{
|
||||
return $this->entity->last_name ?: '';
|
||||
}
|
||||
|
||||
public function search_display()
|
||||
{
|
||||
return strlen($this->entity->email ?? '') > 2 ? $this->name().' <'.$this->entity->email.'>' : $this->name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Services\PurchaseOrder\PurchaseOrderService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Utils\Number;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Services\PurchaseOrder\PurchaseOrderService;
|
||||
|
||||
/**
|
||||
* App\Models\PurchaseOrder
|
||||
@@ -117,8 +119,8 @@ class PurchaseOrder extends BaseModel
|
||||
{
|
||||
use Filterable;
|
||||
use SoftDeletes;
|
||||
use MakesDates;
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'private_notes',
|
||||
@@ -197,6 +199,36 @@ class PurchaseOrder extends BaseModel
|
||||
public const STATUS_RECEIVED = 4;
|
||||
public const STATUS_CANCELLED = 5;
|
||||
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$locale = $this->company->locale();
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.purchase_order') . " " . $this->number . " | " . $this->vendor->present()->name() . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'amount' => (float) $this->amount,
|
||||
'balance' => (float) $this->balance,
|
||||
'due_date' => $this->due_date,
|
||||
'date' => $this->date,
|
||||
'custom_value1' => (string)$this->custom_value1,
|
||||
'custom_value2' => (string)$this->custom_value2,
|
||||
'custom_value3' => (string)$this->custom_value3,
|
||||
'custom_value4' => (string)$this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
'po_number' => (string)$this->po_number,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public static function stringStatus(int $status)
|
||||
{
|
||||
switch ($status) {
|
||||
@@ -214,7 +246,6 @@ class PurchaseOrder extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function badgeForStatus(int $status)
|
||||
{
|
||||
switch ($status) {
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace App\Models;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -76,7 +75,6 @@ use Illuminate\Support\Str;
|
||||
*/
|
||||
class PurchaseOrderInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Inviteable;
|
||||
|
||||
|
||||
@@ -11,17 +11,19 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Models\Presenters\QuotePresenter;
|
||||
use App\Services\Quote\QuoteService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceValues;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Utils\Number;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Services\Quote\QuoteService;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use App\Utils\Traits\MakesInvoiceValues;
|
||||
use App\Models\Presenters\QuotePresenter;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* App\Models\Quote
|
||||
@@ -113,12 +115,12 @@ use Laracasts\Presenter\PresentableTrait;
|
||||
class Quote extends BaseModel
|
||||
{
|
||||
use MakesHash;
|
||||
use MakesDates;
|
||||
use Filterable;
|
||||
use SoftDeletes;
|
||||
use MakesReminders;
|
||||
use PresentableTrait;
|
||||
use MakesInvoiceValues;
|
||||
use Searchable;
|
||||
|
||||
protected $presenter = QuotePresenter::class;
|
||||
|
||||
@@ -187,6 +189,35 @@ class Quote extends BaseModel
|
||||
|
||||
public const STATUS_EXPIRED = -1;
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$locale = $this->company->locale();
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.quote') . " " . $this->number . " | " . $this->client->present()->name() . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'amount' => (float) $this->amount,
|
||||
'balance' => (float) $this->balance,
|
||||
'due_date' => $this->due_date,
|
||||
'date' => $this->date,
|
||||
'custom_value1' => (string)$this->custom_value1,
|
||||
'custom_value2' => (string)$this->custom_value2,
|
||||
'custom_value3' => (string)$this->custom_value3,
|
||||
'custom_value4' => (string)$this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
'po_number' => (string)$this->po_number,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
@@ -197,16 +228,6 @@ class Quote extends BaseModel
|
||||
return $this->dateMutator($value);
|
||||
}
|
||||
|
||||
// public function getDueDateAttribute($value)
|
||||
// {
|
||||
// return $value ? $this->dateMutator($value) : null;
|
||||
// }
|
||||
|
||||
// public function getPartialDueDateAttribute($value)
|
||||
// {
|
||||
// return $this->dateMutator($value);
|
||||
// }
|
||||
|
||||
public function getStatusIdAttribute($value)
|
||||
{
|
||||
if ($this->due_date && ! $this->is_deleted && $value == self::STATUS_SENT && Carbon::parse($this->due_date)->lte(now()->startOfDay())) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -57,7 +56,6 @@ use Illuminate\Support\Carbon;
|
||||
*/
|
||||
class QuoteInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use Inviteable;
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
@@ -11,16 +11,18 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Models\Presenters\RecurringInvoicePresenter;
|
||||
use App\Services\Recurring\RecurringService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Number;
|
||||
use Laravel\Scout\Searchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Services\Recurring\RecurringService;
|
||||
use App\Utils\Traits\Recurring\HasRecurrence;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Models\Presenters\RecurringInvoicePresenter;
|
||||
|
||||
/**
|
||||
* Class for Recurring Invoices.
|
||||
@@ -129,10 +131,10 @@ class RecurringInvoice extends BaseModel
|
||||
use MakesHash;
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
use MakesDates;
|
||||
use HasRecurrence;
|
||||
use PresentableTrait;
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $presenter = RecurringInvoicePresenter::class;
|
||||
|
||||
/**
|
||||
@@ -261,6 +263,35 @@ class RecurringInvoice extends BaseModel
|
||||
'footer',
|
||||
];
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
$locale = $this->company->locale();
|
||||
App::setLocale($locale);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => ctrans('texts.recurring_invoice') . " " . $this->number . " | " . $this->client->present()->name() . ' | ' . Number::formatMoney($this->amount, $this->company) . ' | ' . $this->translateDate($this->date, $this->company->date_format(), $locale),
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'amount' => (float) $this->amount,
|
||||
'balance' => (float) $this->balance,
|
||||
'due_date' => $this->due_date,
|
||||
'date' => $this->date,
|
||||
'custom_value1' => (string)$this->custom_value1,
|
||||
'custom_value2' => (string)$this->custom_value2,
|
||||
'custom_value3' => (string)$this->custom_value3,
|
||||
'custom_value4' => (string)$this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
'po_number' => (string)$this->po_number,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -73,7 +72,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
*/
|
||||
class RecurringInvoiceInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Inviteable;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Models\Presenters\RecurringQuotePresenter;
|
||||
use App\Services\Recurring\RecurringService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Recurring\HasRecurrence;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -125,7 +124,6 @@ class RecurringQuote extends BaseModel
|
||||
use MakesHash;
|
||||
use SoftDeletes;
|
||||
use Filterable;
|
||||
use MakesDates;
|
||||
use HasRecurrence;
|
||||
use PresentableTrait;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\Inviteable;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -73,7 +72,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
*/
|
||||
class RecurringQuoteInvitation extends BaseModel
|
||||
{
|
||||
use MakesDates;
|
||||
use SoftDeletes;
|
||||
use Inviteable;
|
||||
|
||||
|
||||
@@ -11,14 +11,16 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Models\Presenters\VendorPresenter;
|
||||
use App\Services\Vendor\VendorService;
|
||||
use Laravel\Scout\Searchable;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Services\Vendor\VendorService;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Models\Presenters\VendorPresenter;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* App\Models\Vendor
|
||||
@@ -92,7 +94,8 @@ class Vendor extends BaseModel
|
||||
use GeneratesCounter;
|
||||
use PresentableTrait;
|
||||
use AppSetup;
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'assigned_user_id',
|
||||
@@ -137,6 +140,49 @@ class Vendor extends BaseModel
|
||||
'contacts.company',
|
||||
];
|
||||
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
|
||||
$locale = $this->locale();
|
||||
App::setLocale($locale);
|
||||
|
||||
$name = ctrans('texts.vendor') . " | " . $this->present()->name();
|
||||
|
||||
if (strlen($this->vat_number ?? '') > 1) {
|
||||
$name .= " | ". $this->vat_number;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $name,
|
||||
'is_deleted' => $this->is_deleted,
|
||||
'hashed_id' => $this->hashed_id,
|
||||
'number' => $this->number,
|
||||
'id_number' => $this->id_number,
|
||||
'vat_number' => $this->vat_number,
|
||||
'phone' => $this->phone,
|
||||
'address1' => $this->address1,
|
||||
'address2' => $this->address2,
|
||||
'city' => $this->city,
|
||||
'state' => $this->state,
|
||||
'postal_code' => $this->postal_code,
|
||||
'website' => $this->website,
|
||||
'private_notes' => $this->private_notes,
|
||||
'public_notes' => $this->public_notes,
|
||||
'custom_value1' => $this->custom_value1,
|
||||
'custom_value2' => $this->custom_value2,
|
||||
'custom_value3' => $this->custom_value3,
|
||||
'custom_value4' => $this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
protected $presenter = VendorPresenter::class;
|
||||
|
||||
public function getEntityType()
|
||||
|
||||
@@ -11,17 +11,18 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Laravel\Scout\Searchable;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Presenters\VendorContactPresenter;
|
||||
use App\Notifications\ClientContactResetPassword;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
|
||||
/**
|
||||
* App\Models\VendorContact
|
||||
@@ -85,7 +86,8 @@ class VendorContact extends Authenticatable implements HasLocalePreference
|
||||
use PresentableTrait;
|
||||
use SoftDeletes;
|
||||
use HasFactory;
|
||||
|
||||
use Searchable;
|
||||
|
||||
/* Used to authenticate a vendor */
|
||||
protected $guard = 'vendor';
|
||||
|
||||
@@ -123,6 +125,29 @@ class VendorContact extends Authenticatable implements HasLocalePreference
|
||||
'send_email',
|
||||
];
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->present()->search_display(),
|
||||
'hashed_id' => $this->vendor ->hashed_id,
|
||||
'email' => $this->email,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'phone' => $this->phone,
|
||||
'custom_value1' => $this->custom_value1,
|
||||
'custom_value2' => $this->custom_value2,
|
||||
'custom_value3' => $this->custom_value3,
|
||||
'custom_value4' => $this->custom_value4,
|
||||
'company_key' => $this->company->company_key,
|
||||
];
|
||||
}
|
||||
|
||||
public function getScoutKey()
|
||||
{
|
||||
return $this->hashed_id;
|
||||
}
|
||||
|
||||
public function avatar()
|
||||
{
|
||||
if ($this->avatar) {
|
||||
|
||||
@@ -31,10 +31,10 @@ class SendEmail
|
||||
public function run()
|
||||
{
|
||||
|
||||
$this->reminder_template = $this->reminder_template ? "email_template_{$this->reminder_template}" : "email_template_".$this->quote->calculateTemplate('quote');
|
||||
// if (! $this->reminder_template) {
|
||||
// $this->reminder_template = $this->quote->calculateTemplate('quote');
|
||||
// }
|
||||
if(in_array($this->reminder_template, ["email_quote_template_reminder1","reminder1"]))
|
||||
$this->reminder_template = "email_quote_template_reminder1";
|
||||
else
|
||||
$this->reminder_template = "email_template_".$this->quote->calculateTemplate('quote');
|
||||
|
||||
$this->quote->service()->markSent()->save();
|
||||
|
||||
|
||||
@@ -64,6 +64,23 @@ return [
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'debian_docker' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public/storage'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'permissions' => [
|
||||
'file' => [
|
||||
'public' => 0664,
|
||||
'private' => 0600,
|
||||
],
|
||||
'dir' => [
|
||||
'public' => 0775,
|
||||
'private' => 0700,
|
||||
],
|
||||
],
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => public_path('storage'),
|
||||
|
||||
@@ -17,8 +17,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => env('APP_VERSION', '5.10.55'),
|
||||
'app_tag' => env('APP_TAG', '5.10.55'),
|
||||
'app_version' => env('APP_VERSION', '5.10.56'),
|
||||
'app_tag' => env('APP_TAG', '5.10.56'),
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
||||
@@ -3147,7 +3147,23 @@ paths:
|
||||
template:
|
||||
description: "The template required"
|
||||
type: string
|
||||
example: invoice,quote,credit,purchase_order,payment,payment_partial,reminder1,reminder2,reminder3,reminder_endless
|
||||
enum:
|
||||
- invoice
|
||||
- quote
|
||||
- credit
|
||||
- payment
|
||||
- payment_partial
|
||||
- statement
|
||||
- reminder1
|
||||
- reminder2
|
||||
- reminder3
|
||||
- reminder_endless
|
||||
- custom1
|
||||
- custom2
|
||||
- custom3
|
||||
- purchase_order
|
||||
- email_quote_template_reminder1
|
||||
example: invoice
|
||||
type: object
|
||||
responses:
|
||||
200:
|
||||
|
||||
@@ -3064,7 +3064,23 @@ paths:
|
||||
template:
|
||||
description: "The template required"
|
||||
type: string
|
||||
example: invoice,quote,credit,purchase_order,payment,payment_partial,reminder1,reminder2,reminder3,reminder_endless
|
||||
enum:
|
||||
- invoice
|
||||
- quote
|
||||
- credit
|
||||
- payment
|
||||
- payment_partial
|
||||
- statement
|
||||
- reminder1
|
||||
- reminder2
|
||||
- reminder3
|
||||
- reminder_endless
|
||||
- custom1
|
||||
- custom2
|
||||
- custom3
|
||||
- purchase_order
|
||||
- email_quote_template_reminder1
|
||||
example: invoice
|
||||
type: object
|
||||
responses:
|
||||
200:
|
||||
|
||||
@@ -11,16 +11,18 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use Tests\TestCase;
|
||||
use App\Models\SystemLog;
|
||||
use Tests\MockAccountData;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use Illuminate\Support\Facades\Bus;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Bus;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Http\Requests\Email\SendEmailRequest;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -46,7 +48,35 @@ class InvoiceEmailTest extends TestCase
|
||||
|
||||
$this->makeTestData();
|
||||
|
||||
// $this->withoutExceptionHandling();
|
||||
}
|
||||
|
||||
public function testEmailTemplateValidation()
|
||||
{
|
||||
$this->user->setCompany($this->company);
|
||||
$this->actingAs($this->user);
|
||||
|
||||
$request = new SendEmailRequest();
|
||||
|
||||
collect($request->templates)->filter(function ($template){
|
||||
return stripos($template, 'quote') === false;
|
||||
})->each(function ($template) use($request){
|
||||
|
||||
|
||||
$data = [
|
||||
"body" => "hey what's up",
|
||||
"entity" => 'App\Models\Invoice',
|
||||
"entity_id" => $this->invoice->id,
|
||||
"subject" => 'Reminder $number',
|
||||
"template" => $template
|
||||
];
|
||||
|
||||
$request->initialize($data);
|
||||
$validator = Validator::make($data, $request->rules());
|
||||
|
||||
$this->assertTrue($validator->passes());
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user