mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #8998 from turbo124/v5-develop
Stubs for extensions.
This commit is contained in:
commit
fd86accec7
@ -14,4 +14,4 @@ namespace Illuminate\Contracts\Mail
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Factory\VendorContactFactory;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
|
@ -11,54 +11,53 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use stdClass;
|
||||
use Carbon\Carbon;
|
||||
use Faker\Factory;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Vendor;
|
||||
use App\DataMapper\ClientRegistrationFields;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Events\Invoice\InvoiceWasCreated;
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||
use App\Factory\GroupSettingFactory;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Factory\SubscriptionFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use App\Models\BankIntegration;
|
||||
use App\Models\BankTransaction;
|
||||
use App\Models\BankTransactionRule;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Country;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Gateway;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\TaxRate;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\VendorContact;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Models\BankIntegration;
|
||||
use App\Models\BankTransaction;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Models\BankTransactionRule;
|
||||
use App\Factory\GroupSettingFactory;
|
||||
use App\Factory\SubscriptionFactory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Models\TaxRate;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Events\Invoice\InvoiceWasCreated;
|
||||
use App\DataMapper\ClientRegistrationFields;
|
||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Carbon\Carbon;
|
||||
use Faker\Factory;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use stdClass;
|
||||
|
||||
class CreateSingleAccount extends Command
|
||||
{
|
||||
@ -508,7 +507,7 @@ class CreateSingleAccount extends Command
|
||||
|
||||
private function createTask($client)
|
||||
{
|
||||
$time_log = $this->createTimeLog(rand(1,20));
|
||||
$time_log = $this->createTimeLog(rand(1, 20));
|
||||
$status = TaskStatus::where('company_id', $client->company_id)->get()->random();
|
||||
|
||||
return Task::factory()->create([
|
||||
@ -517,8 +516,8 @@ class CreateSingleAccount extends Command
|
||||
'time_log' => $time_log,
|
||||
'description' => $this->faker->paragraph,
|
||||
'status_id' => $status->id ?? null,
|
||||
'number' => rand(10000,100000000),
|
||||
'rate' => rand(1,150),
|
||||
'number' => rand(10000, 100000000),
|
||||
'rate' => rand(1, 150),
|
||||
'client_id' => $client->id
|
||||
]);
|
||||
}
|
||||
@ -537,7 +536,7 @@ class CreateSingleAccount extends Command
|
||||
Carbon::now()->addSeconds($min)->timestamp,
|
||||
Carbon::now()->addSeconds($min += $rando)->timestamp,
|
||||
$this->faker->sentence,
|
||||
rand(0,1) === 0 ? false : true
|
||||
rand(0, 1) === 0 ? false : true
|
||||
];
|
||||
|
||||
$min += 300;
|
||||
@ -552,9 +551,9 @@ class CreateSingleAccount extends Command
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id,
|
||||
'client_id' => $client->id,
|
||||
'due_date' => now()->addSeconds(rand(100000,1000000))->format('Y-m-d'),
|
||||
'budgeted_hours' => rand(100,1000),
|
||||
'task_rate' => rand(1,200),
|
||||
'due_date' => now()->addSeconds(rand(100000, 1000000))->format('Y-m-d'),
|
||||
'budgeted_hours' => rand(100, 1000),
|
||||
'task_rate' => rand(1, 200),
|
||||
]);
|
||||
|
||||
for($x=0; $x < rand(2, 5); $x++) {
|
||||
|
@ -63,7 +63,7 @@ class MobileLocalization extends Command
|
||||
{
|
||||
$resources =(array)$this->getResources();
|
||||
|
||||
if(is_iterable($resources)){
|
||||
if(is_iterable($resources)) {
|
||||
foreach ($resources as $key => $val) {
|
||||
$transKey = "texts.{$key}";
|
||||
if (trans($transKey) == $transKey) {
|
||||
|
@ -219,7 +219,7 @@ class BaseRule implements RuleInterface
|
||||
|
||||
try {
|
||||
$this->invoice->saveQuietly();
|
||||
}catch(\Exception $e) {
|
||||
} catch(\Exception $e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -223,8 +223,8 @@ class Handler extends ExceptionHandler
|
||||
return response()->json(['message' => $exception->getMessage()], 500);
|
||||
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Too many requests'], 429);
|
||||
// } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
||||
// return response()->json(['message'=>'Fatal error'], 500); //@deprecated
|
||||
// } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
||||
// return response()->json(['message'=>'Fatal error'], 500); //@deprecated
|
||||
} elseif ($exception instanceof AuthorizationException && $request->expectsJson()) {
|
||||
return response()->json(['message'=> $exception->getMessage()], 401);
|
||||
} elseif ($exception instanceof TokenMismatchException) {
|
||||
|
@ -760,7 +760,7 @@ class BaseExport
|
||||
return $transformed_payment[$column];
|
||||
} elseif (array_key_exists(str_replace("payment.", "", $column), $transformed_payment)) {
|
||||
return $transformed_payment[$column];
|
||||
}
|
||||
}
|
||||
|
||||
// nlog("export: Could not resolve payment key: {$column}");
|
||||
|
||||
|
@ -11,17 +11,17 @@
|
||||
|
||||
namespace App\Export\CSV;
|
||||
|
||||
use App\Export\Decorators\Decorator;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Transformers\ClientContactTransformer;
|
||||
use App\Transformers\ClientTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Models\Client;
|
||||
use League\Csv\Writer;
|
||||
use App\Models\Company;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Export\Decorators\Decorator;
|
||||
use App\Transformers\ClientTransformer;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Transformers\ClientContactTransformer;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use League\Csv\Writer;
|
||||
|
||||
class ClientExport extends BaseExport
|
||||
{
|
||||
|
@ -11,15 +11,15 @@
|
||||
|
||||
namespace App\Export\CSV;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use League\Csv\Writer;
|
||||
use App\Export\Decorators\Decorator;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Models\Payment;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Transformers\PaymentTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Export\Decorators\Decorator;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use League\Csv\Writer;
|
||||
|
||||
class PaymentExport extends BaseExport
|
||||
{
|
||||
|
@ -21,10 +21,9 @@ class ClientDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
$client = false;
|
||||
|
||||
if($entity instanceof Client){
|
||||
if($entity instanceof Client) {
|
||||
$client = $entity;
|
||||
}
|
||||
elseif($entity->client) {
|
||||
} elseif($entity->client) {
|
||||
$client = $entity->client;
|
||||
}
|
||||
|
||||
@ -35,141 +34,192 @@ class ClientDecorator extends Decorator implements DecoratorInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
public function name(Client $client) {
|
||||
return $client->present()->name();
|
||||
}
|
||||
public function number(Client $client) {
|
||||
return $client->number ?? '';
|
||||
}
|
||||
public function user(Client $client) {
|
||||
return $client->user->present()->name();
|
||||
}
|
||||
public function assigned_user(Client $client) {
|
||||
return $client->assigned_user ? $client->user->present()->name() : '';
|
||||
}
|
||||
public function balance(Client $client) {
|
||||
return $client->balance ?? 0;
|
||||
}
|
||||
public function paid_to_date(Client $client) {
|
||||
return $client->paid_to_date ?? 0;
|
||||
}
|
||||
public function currency_id(Client $client) {
|
||||
return $client->currency() ? $client->currency()->code : $client->company->currency()->code;
|
||||
}
|
||||
public function website(Client $client) {
|
||||
return $client->website ?? '';
|
||||
}
|
||||
public function private_notes(Client $client) {
|
||||
return $client->private_notes ?? '';
|
||||
}
|
||||
public function industry_id(Client $client) {
|
||||
return $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
}
|
||||
public function size_id(Client $client) {
|
||||
return $client->size ? ctrans("texts.size_{$client->size->name}") : '';
|
||||
}
|
||||
public function phone(Client $client) {
|
||||
return $client->phone ?? '';
|
||||
}
|
||||
public function address1(Client $client) {
|
||||
return $client->address1 ?? '';
|
||||
}
|
||||
public function address2(Client $client) {
|
||||
return $client->address2 ?? '';
|
||||
}
|
||||
public function city(Client $client) {
|
||||
return $client->city ?? '';
|
||||
}
|
||||
public function state(Client $client) {
|
||||
return $client->state ?? '';
|
||||
}
|
||||
public function postal_code(Client $client) {
|
||||
return $client->postal_code ?? '';
|
||||
}
|
||||
public function country_id(Client $client) {
|
||||
return $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
}
|
||||
public function shipping_address1(Client $client) {
|
||||
return $client->shipping_address1 ?? '';
|
||||
}
|
||||
public function shipping_address2(Client $client) {
|
||||
return $client->shipping_address2 ?? '';
|
||||
}
|
||||
public function shipping_city(Client $client) {
|
||||
return $client->shipping_city ?? '';
|
||||
}
|
||||
public function shipping_state(Client $client) {
|
||||
return $client->shipping_state ?? '';
|
||||
}
|
||||
public function shipping_postal_code(Client $client) {
|
||||
return $client->shipping_postal_code ?? '';
|
||||
}
|
||||
public function shipping_country_id(Client $client) {
|
||||
return $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
|
||||
}
|
||||
public function payment_terms(Client $client) {
|
||||
return $client?->settings?->payment_terms ?? $client->company->settings->payment_terms;
|
||||
}
|
||||
public function vat_number(Client $client) {
|
||||
return $client->vat_number ?? '';
|
||||
}
|
||||
public function id_number(Client $client) {
|
||||
return $client->id_number ?? '';
|
||||
}
|
||||
public function public_notes(Client $client) {
|
||||
return $client->public_notes ?? '';
|
||||
}
|
||||
public function custom_value1(Client $client) {
|
||||
return $client->custom_value1 ?? '';
|
||||
}
|
||||
public function custom_value2(Client $client) {
|
||||
return $client->custom_value2 ?? '';
|
||||
}
|
||||
public function custom_value3(Client $client) {
|
||||
return $client->custom_value3 ?? '';
|
||||
}
|
||||
public function custom_value4(Client $client) {
|
||||
return $client->custom_value4 ?? '';
|
||||
}
|
||||
public function payment_balance(Client $client) {
|
||||
return $client->payment_balance ?? 0;
|
||||
}
|
||||
public function credit_balance(Client $client) {
|
||||
return $client->credit_balance ?? 0;
|
||||
}
|
||||
public function classification(Client $client) {
|
||||
ctrans("texts.{$client->classification}") ?? '';
|
||||
public function name(Client $client)
|
||||
{
|
||||
return $client->present()->name();
|
||||
}
|
||||
|
||||
public function number(Client $client)
|
||||
{
|
||||
return $client->number ?? '';
|
||||
}
|
||||
|
||||
public function user(Client $client)
|
||||
{
|
||||
return $client->user->present()->name();
|
||||
}
|
||||
|
||||
public function assigned_user(Client $client)
|
||||
{
|
||||
return $client->assigned_user ? $client->user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function balance(Client $client)
|
||||
{
|
||||
return $client->balance ?? 0;
|
||||
}
|
||||
|
||||
public function paid_to_date(Client $client)
|
||||
{
|
||||
return $client->paid_to_date ?? 0;
|
||||
}
|
||||
|
||||
public function currency_id(Client $client)
|
||||
{
|
||||
return $client->currency() ? $client->currency()->code : $client->company->currency()->code;
|
||||
}
|
||||
|
||||
public function website(Client $client)
|
||||
{
|
||||
return $client->website ?? '';
|
||||
}
|
||||
|
||||
public function private_notes(Client $client)
|
||||
{
|
||||
return $client->private_notes ?? '';
|
||||
}
|
||||
|
||||
public function industry_id(Client $client)
|
||||
{
|
||||
return $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
}
|
||||
|
||||
public function size_id(Client $client)
|
||||
{
|
||||
return $client->size ? ctrans("texts.size_{$client->size->name}") : '';
|
||||
}
|
||||
|
||||
public function phone(Client $client)
|
||||
{
|
||||
return $client->phone ?? '';
|
||||
}
|
||||
|
||||
public function address1(Client $client)
|
||||
{
|
||||
return $client->address1 ?? '';
|
||||
}
|
||||
|
||||
public function address2(Client $client)
|
||||
{
|
||||
return $client->address2 ?? '';
|
||||
}
|
||||
|
||||
public function city(Client $client)
|
||||
{
|
||||
return $client->city ?? '';
|
||||
}
|
||||
|
||||
public function state(Client $client)
|
||||
{
|
||||
return $client->state ?? '';
|
||||
}
|
||||
|
||||
public function postal_code(Client $client)
|
||||
{
|
||||
return $client->postal_code ?? '';
|
||||
}
|
||||
|
||||
public function country_id(Client $client)
|
||||
{
|
||||
return $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
}
|
||||
|
||||
public function shipping_address1(Client $client)
|
||||
{
|
||||
return $client->shipping_address1 ?? '';
|
||||
}
|
||||
|
||||
public function shipping_address2(Client $client)
|
||||
{
|
||||
return $client->shipping_address2 ?? '';
|
||||
}
|
||||
|
||||
public function shipping_city(Client $client)
|
||||
{
|
||||
return $client->shipping_city ?? '';
|
||||
}
|
||||
|
||||
public function shipping_state(Client $client)
|
||||
{
|
||||
return $client->shipping_state ?? '';
|
||||
}
|
||||
|
||||
public function shipping_postal_code(Client $client)
|
||||
{
|
||||
return $client->shipping_postal_code ?? '';
|
||||
}
|
||||
|
||||
public function shipping_country_id(Client $client)
|
||||
{
|
||||
return $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
|
||||
}
|
||||
|
||||
public function payment_terms(Client $client)
|
||||
{
|
||||
return $client?->settings?->payment_terms ?? $client->company->settings->payment_terms;
|
||||
}
|
||||
|
||||
public function vat_number(Client $client)
|
||||
{
|
||||
return $client->vat_number ?? '';
|
||||
}
|
||||
|
||||
public function id_number(Client $client)
|
||||
{
|
||||
return $client->id_number ?? '';
|
||||
}
|
||||
|
||||
public function public_notes(Client $client)
|
||||
{
|
||||
return $client->public_notes ?? '';
|
||||
}
|
||||
|
||||
public function custom_value1(Client $client)
|
||||
{
|
||||
return $client->custom_value1 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value2(Client $client)
|
||||
{
|
||||
return $client->custom_value2 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value3(Client $client)
|
||||
{
|
||||
return $client->custom_value3 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value4(Client $client)
|
||||
{
|
||||
return $client->custom_value4 ?? '';
|
||||
}
|
||||
|
||||
public function payment_balance(Client $client)
|
||||
{
|
||||
return $client->payment_balance ?? 0;
|
||||
}
|
||||
|
||||
public function credit_balance(Client $client)
|
||||
{
|
||||
return $client->credit_balance ?? 0;
|
||||
}
|
||||
|
||||
public function classification(Client $client)
|
||||
{
|
||||
ctrans("texts.{$client->classification}") ?? '';
|
||||
}
|
||||
|
||||
public function status(Client $client)
|
||||
{
|
||||
if ($client->is_deleted) {
|
||||
return ctrans('texts.deleted');
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////contact details/////////////////
|
||||
/*
|
||||
public function phone(Client $client) {
|
||||
|
||||
if ($client->deleted_at) {
|
||||
return ctrans('texts.archived');
|
||||
}
|
||||
public function first_name(Client $client) {
|
||||
|
||||
}
|
||||
public function last_name(Client $client) {
|
||||
|
||||
}
|
||||
public function email(Client $client) {
|
||||
|
||||
}
|
||||
public function custom_value1(Client $client) {
|
||||
|
||||
}
|
||||
public function custom_value2(Client $client) {
|
||||
|
||||
}
|
||||
public function custom_value3(Client $client) {
|
||||
|
||||
}
|
||||
public function custom_value4(Client $client) {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
return ctrans('texts.active');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,59 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\ClientContact;
|
||||
|
||||
class ContactDecorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$contact = false;
|
||||
|
||||
if($entity instanceof ClientContact) {
|
||||
$contact = $entity;
|
||||
} elseif($entity->contacts) {
|
||||
$contact = $entity->contacts()->first();
|
||||
}
|
||||
|
||||
if($contact && method_exists($this, $key)) {
|
||||
return $this->{$key}($contact);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function phone(ClientContact $contact)
|
||||
{
|
||||
return $contact->phone ?? '';
|
||||
}
|
||||
public function first_name(ClientContact $contact)
|
||||
{
|
||||
return $contact->first_name ?? '';
|
||||
}
|
||||
public function last_name(ClientContact $contact)
|
||||
{
|
||||
return $contact->last_name ?? '';
|
||||
}
|
||||
public function email(ClientContact $contact)
|
||||
{
|
||||
return $contact->email ?? '';
|
||||
}
|
||||
public function custom_value1(ClientContact $contact)
|
||||
{
|
||||
return $contact->custom_value1 ?? '';
|
||||
}
|
||||
public function custom_value2(ClientContact $contact)
|
||||
{
|
||||
return $contact->custom_value2 ?? '';
|
||||
}
|
||||
public function custom_value3(ClientContact $contact)
|
||||
{
|
||||
return $contact->custom_value3 ?? '';
|
||||
}
|
||||
public function custom_value4(ClientContact $contact)
|
||||
{
|
||||
return $contact->custom_value4 ?? '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,143 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Credit;
|
||||
|
||||
class CreditDecorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$credit = false;
|
||||
|
||||
if($entity instanceof Credit) {
|
||||
$credit = $entity;
|
||||
} elseif($entity->credit) {
|
||||
$credit = $entity->credit;
|
||||
}
|
||||
|
||||
if($credit && method_exists($this, $key)) {
|
||||
return $this->{$key}($credit);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function number(Credit $credit)
|
||||
{
|
||||
return $credit->number ?? '';
|
||||
}
|
||||
public function amount(Credit $credit)
|
||||
{
|
||||
return $credit->amount ?? 0;
|
||||
}
|
||||
public function balance(Credit $credit)
|
||||
{
|
||||
return $credit->balance ?? 0;
|
||||
}
|
||||
public function paid_to_date(Credit $credit)
|
||||
{
|
||||
return $credit->paid_to_date ?? 0;
|
||||
}
|
||||
public function po_number(Credit $credit)
|
||||
{
|
||||
return $credit->po_number ?? '';
|
||||
}
|
||||
public function date(Credit $credit)
|
||||
{
|
||||
return $credit->date ?? '';
|
||||
}
|
||||
public function due_date(Credit $credit)
|
||||
{
|
||||
return $credit->due_date ?? '';
|
||||
}
|
||||
public function terms(Credit $credit)
|
||||
{
|
||||
return $credit->terms ?? '';
|
||||
}
|
||||
public function discount(Credit $credit)
|
||||
{
|
||||
return $credit->discount ?? 0;
|
||||
}
|
||||
public function footer(Credit $credit)
|
||||
{
|
||||
return $credit->footer ?? '';
|
||||
}
|
||||
public function status(Credit $credit)
|
||||
{
|
||||
return $credit->stringStatus($credit->status_id);
|
||||
}
|
||||
public function public_notes(Credit $credit)
|
||||
{
|
||||
return $credit->public_notes ?? '';
|
||||
}
|
||||
public function private_notes(Credit $credit)
|
||||
{
|
||||
return $credit->private_notes ?? '';
|
||||
}
|
||||
public function uses_inclusive_taxes(Credit $credit)
|
||||
{
|
||||
return $credit->uses_inclusive_taxes ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
public function is_amount_discount(Credit $credit)
|
||||
{
|
||||
return $credit->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
public function partial(Credit $credit)
|
||||
{
|
||||
return $credit->partial ?? 0;
|
||||
}
|
||||
public function partial_due_date(Credit $credit)
|
||||
{
|
||||
return $credit->partial_due_date ?? '';
|
||||
}
|
||||
public function custom_surcharge1(Credit $credit)
|
||||
{
|
||||
return $credit->custom_surcharge1 ?? 0;
|
||||
}
|
||||
public function custom_surcharge2(Credit $credit)
|
||||
{
|
||||
return $credit->custom_surcharge2 ?? 0;
|
||||
}
|
||||
public function custom_surcharge3(Credit $credit)
|
||||
{
|
||||
return $credit->custom_surcharge3 ?? 0;
|
||||
}
|
||||
public function custom_surcharge4(Credit $credit)
|
||||
{
|
||||
return $credit->custom_surcharge4 ?? 0;
|
||||
}
|
||||
public function custom_value1(Credit $credit)
|
||||
{
|
||||
return $credit->custom_value1 ?? '';
|
||||
}
|
||||
public function custom_value2(Credit $credit)
|
||||
{
|
||||
return $credit->custom_value2 ?? '';
|
||||
}
|
||||
public function custom_value3(Credit $credit)
|
||||
{
|
||||
return $credit->custom_value3 ?? '';
|
||||
}
|
||||
public function custom_value4(Credit $credit)
|
||||
{
|
||||
return $credit->custom_value4 ?? '';
|
||||
}
|
||||
public function exchange_rate(Credit $credit)
|
||||
{
|
||||
return $credit->exchange_rate ?? 0;
|
||||
}
|
||||
public function total_taxes(Credit $credit)
|
||||
{
|
||||
return $credit->total_taxes ?? 0;
|
||||
}
|
||||
public function assigned_user_id(Credit $credit)
|
||||
{
|
||||
return $credit->assigned_user ? $credit->assigned_user->present()->name(): '';
|
||||
}
|
||||
public function user_id(Credit $credit)
|
||||
{
|
||||
return $credit->user ? $credit->user->present()->name(): '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,22 +11,8 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
|
||||
use App\Models\Task;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Export\Decorators\DecoratorInterface;
|
||||
|
||||
class Decorator implements DecoratorInterface{
|
||||
class Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
interface DecoratorInterface {
|
||||
interface DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed;
|
||||
}
|
||||
|
@ -11,10 +11,155 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Expense;
|
||||
|
||||
class ExpenseDecorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$expense = false;
|
||||
|
||||
if($entity instanceof Expense) {
|
||||
$expense = $entity;
|
||||
} elseif($entity->expense) {
|
||||
$expense = $entity->expense;
|
||||
}
|
||||
|
||||
if($expense && method_exists($this, $key)) {
|
||||
return $this->{$key}($expense);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function amount(Expense $expense)
|
||||
{
|
||||
return $expense->amount ?? 0;
|
||||
}
|
||||
public function category_id(Expense $expense)
|
||||
{
|
||||
return $expense->category ? $expense->category->name : '';
|
||||
}
|
||||
public function client_id(Expense $expense)
|
||||
{
|
||||
return $expense->client ? $expense->client->present()->name() : '';
|
||||
}
|
||||
public function custom_value1(Expense $expense)
|
||||
{
|
||||
return $expense->custom_value1 ?? '';
|
||||
}
|
||||
public function custom_value2(Expense $expense)
|
||||
{
|
||||
return $expense->custom_value2 ?? '';
|
||||
}
|
||||
public function custom_value3(Expense $expense)
|
||||
{
|
||||
return $expense->custom_value3 ?? '';
|
||||
}
|
||||
public function custom_value4(Expense $expense)
|
||||
{
|
||||
return $expense->custom_value4 ?? '';
|
||||
}
|
||||
public function currency_id(Expense $expense)
|
||||
{
|
||||
return $expense->currency ? $expense->currency->code : $expense->company->currency()->code;
|
||||
}
|
||||
public function date(Expense $expense)
|
||||
{
|
||||
return $expense->date ?? '';
|
||||
}
|
||||
public function exchange_rate(Expense $expense)
|
||||
{
|
||||
return $expense->exchange_rate ?? 0;
|
||||
}
|
||||
public function foreign_amount(Expense $expense)
|
||||
{
|
||||
return $expense->foreign_amount ?? 0;
|
||||
}
|
||||
public function invoice_currency_id(Expense $expense)
|
||||
{
|
||||
return $expense->invoice_currency ? $expense->invoice_currency->code : $expense->company->currency()->code;
|
||||
}
|
||||
public function payment_date(Expense $expense)
|
||||
{
|
||||
return $expense->payment_date ?? '';
|
||||
}
|
||||
public function number(Expense $expense)
|
||||
{
|
||||
return $expense->number ?? '';
|
||||
}
|
||||
public function payment_type_id(Expense $expense)
|
||||
{
|
||||
return $expense->payment_type ? $expense->payment_type->name : '';
|
||||
}
|
||||
public function private_notes(Expense $expense)
|
||||
{
|
||||
return $expense->private_notes ?? '';
|
||||
}
|
||||
public function project_id(Expense $expense)
|
||||
{
|
||||
return $expense->project ? $expense->project->name : '';
|
||||
}
|
||||
public function public_notes(Expense $expense)
|
||||
{
|
||||
return $expense->public_notes ?? '';
|
||||
}
|
||||
public function tax_amount1(Expense $expense)
|
||||
{
|
||||
return $expense->tax_amount1 ?? 0;
|
||||
}
|
||||
public function tax_amount2(Expense $expense)
|
||||
{
|
||||
return $expense->tax_amount2 ?? 0;
|
||||
}
|
||||
public function tax_amount3(Expense $expense)
|
||||
{
|
||||
return $expense->tax_amount3 ?? 0;
|
||||
}
|
||||
public function tax_name1(Expense $expense)
|
||||
{
|
||||
return $expense->tax_name1 ?? '';
|
||||
}
|
||||
public function tax_name2(Expense $expense)
|
||||
{
|
||||
return $expense->tax_name2 ?? '';
|
||||
}
|
||||
public function tax_name3(Expense $expense)
|
||||
{
|
||||
return $expense->tax_name3 ?? '';
|
||||
}
|
||||
public function tax_rate1(Expense $expense)
|
||||
{
|
||||
return $expense->tax_rate1 ?? 0;
|
||||
}
|
||||
public function tax_rate2(Expense $expense)
|
||||
{
|
||||
return $expense->tax_rate2 ?? 0;
|
||||
}
|
||||
public function tax_rate3(Expense $expense)
|
||||
{
|
||||
return $expense->tax_rate3 ?? 0;
|
||||
}
|
||||
public function transaction_reference(Expense $expense)
|
||||
{
|
||||
return $expense->transaction_reference ?? '';
|
||||
}
|
||||
public function vendor_id(Expense $expense)
|
||||
{
|
||||
return $expense->vendor ? $expense->vendor->name : '';
|
||||
}
|
||||
public function invoice_id(Expense $expense)
|
||||
{
|
||||
return $expense->invoice ? $expense->invoice->number : '';
|
||||
}
|
||||
public function user(Expense $expense)
|
||||
{
|
||||
return $expense->user ? $expense->user->present()->name() : '';
|
||||
}
|
||||
public function assigned_user(Expense $expense)
|
||||
{
|
||||
return $expense->assigned_user ? $expense->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,175 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Invoice;
|
||||
|
||||
class InvoiceDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$invoice = false;
|
||||
|
||||
if($entity instanceof Invoice) {
|
||||
$invoice = $entity;
|
||||
} elseif($entity->invoice) {
|
||||
$invoice = $entity->invoice;
|
||||
}
|
||||
|
||||
if($invoice && method_exists($this, $key)) {
|
||||
return $this->{$key}($invoice);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function number(Invoice $invoice)
|
||||
{
|
||||
return $invoice->number ?? '';
|
||||
}
|
||||
public function amount(Invoice $invoice)
|
||||
{
|
||||
return $invoice->amount ?? 0;
|
||||
}
|
||||
public function balance(Invoice $invoice)
|
||||
{
|
||||
return $invoice->balance ?? 0;
|
||||
}
|
||||
public function paid_to_date(Invoice $invoice)
|
||||
{
|
||||
return $invoice->paid_to_date ?? 0;
|
||||
}
|
||||
public function po_number(Invoice $invoice)
|
||||
{
|
||||
return $invoice->po_number ?? '';
|
||||
}
|
||||
public function date(Invoice $invoice)
|
||||
{
|
||||
return $invoice->date ?? '';
|
||||
}
|
||||
public function due_date(Invoice $invoice)
|
||||
{
|
||||
return $invoice->due_date ?? '';
|
||||
}
|
||||
public function terms(Invoice $invoice)
|
||||
{
|
||||
return $invoice->terms ?? '';
|
||||
}
|
||||
public function footer(Invoice $invoice)
|
||||
{
|
||||
return $invoice->footer ?? '';
|
||||
}
|
||||
public function status(Invoice $invoice)
|
||||
{
|
||||
return $invoice->stringStatus($invoice->status_id);
|
||||
}
|
||||
public function public_notes(Invoice $invoice)
|
||||
{
|
||||
return $invoice->public_notes ?? '';
|
||||
}
|
||||
public function private_notes(Invoice $invoice)
|
||||
{
|
||||
return $invoice->private_notes ?? '';
|
||||
}
|
||||
public function uses_inclusive_taxes(Invoice $invoice)
|
||||
{
|
||||
return $invoice->uses_inclusive_taxes ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
public function is_amount_discount(Invoice $invoice)
|
||||
{
|
||||
return $invoice->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
public function discount(Invoice $invoice)
|
||||
{
|
||||
return $invoice->discount ?? 0;
|
||||
}
|
||||
public function partial(Invoice $invoice)
|
||||
{
|
||||
return $invoice->partial ?? 0;
|
||||
}
|
||||
public function partial_due_date(Invoice $invoice)
|
||||
{
|
||||
return $invoice->partial_due_date ?? '';
|
||||
}
|
||||
public function custom_surcharge1(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_surcharge1 ?? 0;
|
||||
}
|
||||
public function custom_surcharge2(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_surcharge2 ?? 0;
|
||||
}
|
||||
public function custom_surcharge3(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_surcharge3 ?? 0;
|
||||
}
|
||||
public function custom_surcharge4(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_surcharge4 ?? 0;
|
||||
}
|
||||
public function exchange_rate(Invoice $invoice)
|
||||
{
|
||||
return $invoice->exchange_rate ?? 0;
|
||||
}
|
||||
public function total_taxes(Invoice $invoice)
|
||||
{
|
||||
return $invoice->total_taxes ?? 0;
|
||||
}
|
||||
public function assigned_user_id(Invoice $invoice)
|
||||
{
|
||||
return $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
|
||||
}
|
||||
public function user_id(Invoice $invoice)
|
||||
{
|
||||
return $invoice->user ? $invoice->user->present()->name(): '';
|
||||
}
|
||||
public function custom_value1(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_value1 ?? '';
|
||||
}
|
||||
public function custom_value2(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_value2 ?? '';
|
||||
}
|
||||
public function custom_value3(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_value3 ?? '';
|
||||
}
|
||||
public function custom_value4(Invoice $invoice)
|
||||
{
|
||||
return $invoice->custom_value4 ?? '';
|
||||
}
|
||||
public function tax_name1(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_name1 ?? '';
|
||||
}
|
||||
public function tax_name2(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_name2 ?? '';
|
||||
}
|
||||
public function tax_name3(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_name3 ?? '';
|
||||
}
|
||||
public function tax_rate1(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_rate1 ?? 0;
|
||||
}
|
||||
public function tax_rate2(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_rate2 ?? 0;
|
||||
}
|
||||
public function tax_rate3(Invoice $invoice)
|
||||
{
|
||||
return $invoice->tax_rate3 ?? 0;
|
||||
}
|
||||
public function recurring_id(Invoice $invoice)
|
||||
{
|
||||
return $invoice->recurring_invoice ? $invoice->recurring_invoice->number : '';
|
||||
}
|
||||
public function auto_bill_enabled(Invoice $invoice)
|
||||
{
|
||||
return $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Payment;
|
||||
|
||||
class PaymentDecorator extends Decorator implements DecoratorInterface{
|
||||
class PaymentDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
private $entity_key = 'payment';
|
||||
|
||||
@ -21,20 +22,17 @@ class PaymentDecorator extends Decorator implements DecoratorInterface{
|
||||
{
|
||||
$payment = false;
|
||||
|
||||
if($entity instanceof Payment){
|
||||
if($entity instanceof Payment) {
|
||||
$payment = $entity;
|
||||
}
|
||||
elseif($entity->payment) {
|
||||
} elseif($entity->payment) {
|
||||
$payment = $entity->payment;
|
||||
}
|
||||
|
||||
if($key == 'amount' && (!$entity instanceof Payment)){
|
||||
if($key == 'amount' && (!$entity instanceof Payment)) {
|
||||
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.amount') : ctrans('texts.unpaid');
|
||||
}
|
||||
elseif($key == 'refunded' && (!$entity instanceof Payment)) {
|
||||
} elseif($key == 'refunded' && (!$entity instanceof Payment)) {
|
||||
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.refunded') : '';
|
||||
}
|
||||
elseif($key == 'applied' && (!$entity instanceof Payment)) {
|
||||
} elseif($key == 'applied' && (!$entity instanceof Payment)) {
|
||||
$refunded = $entity->payments()->withoutTrashed()->sum('paymentables.refunded');
|
||||
$amount = $entity->payments()->withoutTrashed()->sum('paymentables.amount');
|
||||
return $entity->payments()->withoutTrashed()->exists() ? ($amount - $refunded) : '';
|
||||
@ -47,96 +45,119 @@ class PaymentDecorator extends Decorator implements DecoratorInterface{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function date(Payment $payment) {
|
||||
public function date(Payment $payment)
|
||||
{
|
||||
return $payment->date ?? '';
|
||||
}
|
||||
|
||||
public function amount(Payment $payment) {
|
||||
public function amount(Payment $payment)
|
||||
{
|
||||
return $payment->amount ?? '';
|
||||
}
|
||||
|
||||
public function refunded(Payment $payment) {
|
||||
public function refunded(Payment $payment)
|
||||
{
|
||||
return $payment->refunded ?? '';
|
||||
}
|
||||
|
||||
public function applied(Payment $payment) {
|
||||
public function applied(Payment $payment)
|
||||
{
|
||||
return $payment->applied ?? '';
|
||||
}
|
||||
public function transaction_reference(Payment $payment) {
|
||||
public function transaction_reference(Payment $payment)
|
||||
{
|
||||
return $payment->transaction_reference ?? '';
|
||||
}
|
||||
public function currency(Payment $payment) {
|
||||
public function currency(Payment $payment)
|
||||
{
|
||||
return $payment->currency()->exists() ? $payment->currency->code : $payment->company->currency()->code;
|
||||
}
|
||||
|
||||
public function exchange_rate(Payment $payment) {
|
||||
public function exchange_rate(Payment $payment)
|
||||
{
|
||||
return $payment->exchange_rate ?? 1;
|
||||
}
|
||||
|
||||
public function number(Payment $payment) {
|
||||
public function number(Payment $payment)
|
||||
{
|
||||
return $payment->number ?? '';
|
||||
}
|
||||
|
||||
public function method(Payment $payment) {
|
||||
public function method(Payment $payment)
|
||||
{
|
||||
return $payment->translatedType();
|
||||
}
|
||||
|
||||
public function status(Payment $payment) {
|
||||
public function status(Payment $payment)
|
||||
{
|
||||
return $payment->stringStatus($payment->status_id);
|
||||
}
|
||||
|
||||
public function private_notes(Payment $payment) {
|
||||
public function private_notes(Payment $payment)
|
||||
{
|
||||
return strip_tags($payment->private_notes) ?? '';
|
||||
}
|
||||
|
||||
public function custom_value1(Payment $payment) {
|
||||
public function custom_value1(Payment $payment)
|
||||
{
|
||||
return $payment->custom_value1 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value2(Payment $payment) {
|
||||
public function custom_value2(Payment $payment)
|
||||
{
|
||||
return $payment->custom_value2 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value3(Payment $payment) {
|
||||
public function custom_value3(Payment $payment)
|
||||
{
|
||||
return $payment->custom_value3 ?? '';
|
||||
}
|
||||
|
||||
public function custom_value4(Payment $payment) {
|
||||
public function custom_value4(Payment $payment)
|
||||
{
|
||||
return $payment->custom_value4 ?? '';
|
||||
}
|
||||
|
||||
public function user_id(Payment $payment) {
|
||||
public function user_id(Payment $payment)
|
||||
{
|
||||
return $payment->user ? $payment->user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function assigned_user_id(Payment $payment) {
|
||||
public function assigned_user_id(Payment $payment)
|
||||
{
|
||||
return $payment->assigned_user ? $payment->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function project_id(Payment $payment) {
|
||||
public function project_id(Payment $payment)
|
||||
{
|
||||
return $payment->project()->exists() ? $payment->project->name : '';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
public function vendor_id(Payment $payment){
|
||||
public function vendor_id(Payment $payment)
|
||||
{
|
||||
return $payment->vendor()->exists() ? $payment->vendor->name : '';
|
||||
}
|
||||
|
||||
public function exchange_currency(Payment $payment){
|
||||
public function exchange_currency(Payment $payment)
|
||||
{
|
||||
return $payment->exchange_currency()->exists() ? $payment->exchange_currency->code : '';
|
||||
}
|
||||
|
||||
public function gateway_type_id(Payment $payment) {
|
||||
public function gateway_type_id(Payment $payment)
|
||||
{
|
||||
return $payment->gateway_type ? $payment->gateway_type->name : 'Unknown Type';
|
||||
}
|
||||
|
||||
public function client_id(Payment $payment) {
|
||||
public function client_id(Payment $payment)
|
||||
{
|
||||
return $payment->client->present()->name();
|
||||
}
|
||||
|
||||
public function type_id(Payment $payment) {
|
||||
public function type_id(Payment $payment)
|
||||
{
|
||||
return $payment->translatedType();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,60 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Product;
|
||||
|
||||
class ProductDecorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$product = false;
|
||||
|
||||
if($entity instanceof Product) {
|
||||
$product = $entity;
|
||||
} elseif($entity->product) {
|
||||
$product = $entity->product;
|
||||
}
|
||||
|
||||
if($product && method_exists($this, $key)) {
|
||||
return $this->{$key}($product);
|
||||
} elseif($product->{$key}) {
|
||||
return $product->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public const PRODUCT_TYPE_PHYSICAL = 1;
|
||||
public const PRODUCT_TYPE_SERVICE = 2;
|
||||
public const PRODUCT_TYPE_DIGITAL = 3;
|
||||
public const PRODUCT_TYPE_SHIPPING = 4;
|
||||
public const PRODUCT_TYPE_EXEMPT = 5;
|
||||
public const PRODUCT_TYPE_REDUCED_TAX = 6;
|
||||
public const PRODUCT_TYPE_OVERRIDE_TAX = 7;
|
||||
public const PRODUCT_TYPE_ZERO_RATED = 8;
|
||||
public const PRODUCT_TYPE_REVERSE_TAX = 9;
|
||||
*/
|
||||
public function tax_category(Product $product)
|
||||
{
|
||||
|
||||
$category = ctrans('texts.physical_goods');
|
||||
|
||||
match($product->tax_id) {
|
||||
1 => $category = ctrans('texts.physical_goods'),
|
||||
2 => $category = ctrans('texts.services'),
|
||||
3 => $category = ctrans('texts.digital_products'),
|
||||
4 => $category = ctrans('texts.shipping'),
|
||||
5 => $category = ctrans('texts.tax_exempt'),
|
||||
6 => $category = ctrans('texts.reduced_tax'),
|
||||
7 => $category = ctrans('texts.override_tax'),
|
||||
8 => $category = ctrans('texts.zero_rated'),
|
||||
9 => $category = ctrans('texts.reverse_tax'),
|
||||
default => $category = ctrans('texts.physical_goods'),
|
||||
};
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,38 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\PurchaseOrder;
|
||||
|
||||
class PurchaseOrderDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$purchase_order = false;
|
||||
|
||||
if($entity instanceof PurchaseOrder) {
|
||||
$purchase_order = $entity;
|
||||
} elseif($entity->purchase_order) {
|
||||
$purchase_order = $entity->purchase_order;
|
||||
}
|
||||
|
||||
if($purchase_order && method_exists($this, $key)) {
|
||||
return $this->{$key}($purchase_order);
|
||||
} elseif($purchase_order->{$key}) {
|
||||
return $purchase_order->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function status(PurchaseOrder $purchase_order)
|
||||
{
|
||||
return $purchase_order->stringStatus($purchase_order->status_id);
|
||||
}
|
||||
|
||||
public function currency_id(PurchaseOrder $purchase_order)
|
||||
{
|
||||
return $purchase_order->currency ? $purchase_order->currency->code : $purchase_order->company->currency()->code;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,53 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Quote;
|
||||
|
||||
class QuoteDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$quote = false;
|
||||
|
||||
if($entity instanceof Quote) {
|
||||
$quote = $entity;
|
||||
} elseif($entity->quote) {
|
||||
$quote = $entity->quote;
|
||||
}
|
||||
|
||||
if($quote && method_exists($this, $key)) {
|
||||
return $this->{$key}($quote);
|
||||
} elseif($quote->{$key}) {
|
||||
return $quote->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function status(Quote $quote)
|
||||
{
|
||||
return $quote->stringStatus($quote->status_id);
|
||||
}
|
||||
|
||||
public function uses_inclusive_taxes(Quote $quote)
|
||||
{
|
||||
return $quote->uses_inclusive_taxes ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
public function is_amount_discount(Quote $quote)
|
||||
{
|
||||
return $quote->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
public function assigned_user_id(Quote $quote)
|
||||
{
|
||||
return $quote->assigned_user ? $quote->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function user_id(Quote $quote)
|
||||
{
|
||||
return $quote->user->present()->name();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,68 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\RecurringInvoice;
|
||||
|
||||
class RecurringInvoiceDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$recurring_invoice = false;
|
||||
|
||||
if($entity instanceof RecurringInvoice) {
|
||||
$recurring_invoice = $entity;
|
||||
} elseif($entity->recurring_invoice) {
|
||||
$recurring_invoice = $entity->recurring_invoice;
|
||||
}
|
||||
|
||||
if($recurring_invoice && method_exists($this, $key)) {
|
||||
return $this->{$key}($recurring_invoice);
|
||||
} elseif($recurring_invoice->{$key}) {
|
||||
return $recurring_invoice->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function status(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->stringStatus($recurring_invoice->status_id);
|
||||
}
|
||||
|
||||
public function uses_inclusive_taxes(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->uses_inclusive_taxes ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
public function is_amount_discount(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
public function assigned_user_id(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->assigned_user ? $recurring_invoice->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function user_id(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->user->present()->name() ?? '';
|
||||
}
|
||||
|
||||
public function frequency_id(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->frequency_id ? $recurring_invoice->frequencyForKey($recurring_invoice->frequency_id) : '';
|
||||
}
|
||||
|
||||
public function auto_bill(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->auto_bill ? ctrans("texts.{$recurring_invoice->auto_bill}") : '';
|
||||
}
|
||||
|
||||
public function auto_bill_enabled(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
return $recurring_invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,104 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\DateFormat;
|
||||
use App\Models\Task;
|
||||
use App\Models\Timezone;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$task = false;
|
||||
|
||||
if($entity instanceof Task) {
|
||||
$task = $entity;
|
||||
} elseif($entity->task) {
|
||||
$task = $entity->task;
|
||||
}
|
||||
|
||||
if($task && method_exists($this, $key)) {
|
||||
return $this->{$key}($task);
|
||||
} elseif($task->{$key}) {
|
||||
return $task->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function start_date(Task $task)
|
||||
{
|
||||
|
||||
$timezone = Timezone::find($task->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
}
|
||||
|
||||
$logs = json_decode($task->time_log, 1);
|
||||
|
||||
$date_format_default = 'Y-m-d';
|
||||
|
||||
$date_format = DateFormat::find($task->company->settings->date_format_id);
|
||||
|
||||
if ($date_format) {
|
||||
$date_format_default = $date_format->format;
|
||||
}
|
||||
|
||||
if(is_array($logs)) {
|
||||
$item = $logs[0];
|
||||
return Carbon::createFromTimeStamp($item[0])->setTimezone($timezone_name)->format($date_format_default);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function end_date(Task $task)
|
||||
{
|
||||
|
||||
$timezone = Timezone::find($task->company->settings->timezone_id);
|
||||
$timezone_name = 'US/Eastern';
|
||||
|
||||
if ($timezone) {
|
||||
$timezone_name = $timezone->name;
|
||||
}
|
||||
|
||||
$logs = json_decode($task->time_log, 1);
|
||||
|
||||
$date_format_default = 'Y-m-d';
|
||||
|
||||
$date_format = DateFormat::find($task->company->settings->date_format_id);
|
||||
|
||||
if ($date_format) {
|
||||
$date_format_default = $date_format->format;
|
||||
}
|
||||
|
||||
if(is_array($logs)) {
|
||||
$item = $logs[1];
|
||||
return Carbon::createFromTimeStamp($item[1])->setTimezone($timezone_name)->format($date_format_default);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
public function duration(Task $task)
|
||||
{
|
||||
return $task->calcDuration();
|
||||
}
|
||||
|
||||
public function status_id(Task $task)
|
||||
{
|
||||
return $task->status()->exists() ? $task->status->name : '';
|
||||
}
|
||||
|
||||
public function project_id(Task $task)
|
||||
{
|
||||
return $task->project()->exists() ? $task->project->name : '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,29 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\VendorContact;
|
||||
|
||||
class VendorContactDecorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$contact = false;
|
||||
|
||||
if($entity instanceof VendorContact) {
|
||||
$contact = $entity;
|
||||
} elseif($entity->contacts) {
|
||||
$contact = $entity->contacts()->first();
|
||||
}
|
||||
|
||||
if($contact && method_exists($this, $key)) {
|
||||
return $this->{$key}($contact);
|
||||
} elseif($contact->{$key}) {
|
||||
return $contact->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,10 +11,61 @@
|
||||
|
||||
namespace App\Export\Decorators;
|
||||
|
||||
use App\Models\Vendor;
|
||||
|
||||
class VendorDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
public function transform(string $key, mixed $entity): mixed
|
||||
{
|
||||
return 'Payment Decorator';
|
||||
$vendor = false;
|
||||
|
||||
if($entity instanceof Vendor) {
|
||||
$vendor = $entity;
|
||||
} elseif($entity->vendor) {
|
||||
$vendor = $entity->vendor;
|
||||
}
|
||||
|
||||
if($vendor && method_exists($this, $key)) {
|
||||
return $this->{$key}($vendor);
|
||||
} elseif($vendor->{$key}) {
|
||||
return $vendor->{$key} ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function country_id(Vendor $vendor)
|
||||
{
|
||||
return $vendor->country ? $vendor->country->name : '';
|
||||
}
|
||||
|
||||
public function name(Vendor $vendor)
|
||||
{
|
||||
return $vendor->present()->name();
|
||||
}
|
||||
|
||||
public function currency(Vendor $vendor)
|
||||
{
|
||||
return $vendor->currency_id ? $vendor->currency()->code : $vendor->company->currency()->code;
|
||||
}
|
||||
|
||||
public function classification(Vendor $vendor)
|
||||
{
|
||||
ctrans("texts.{$vendor->classification}") ?? '';
|
||||
}
|
||||
|
||||
public function status(Vendor $vendor)
|
||||
{
|
||||
if ($vendor->is_deleted) {
|
||||
return ctrans('texts.deleted');
|
||||
}
|
||||
|
||||
if ($vendor->deleted_at) {
|
||||
return ctrans('texts.archived');
|
||||
}
|
||||
|
||||
return ctrans('texts.active');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Company;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\DataMapper\Tax\TaxModel;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\ClientRegistrationFields;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\Tax\TaxModel;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class CompanyFactory
|
||||
{
|
||||
|
@ -107,13 +107,13 @@ class CreditFilters extends QueryFilters
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
return $this->builder->where(function ($query){
|
||||
$query->whereIn('status_id', [Credit::STATUS_SENT, Credit::STATUS_PARTIAL])
|
||||
->where('balance', '>', 0)
|
||||
->where(function ($q){
|
||||
$q->whereNull('due_date')->orWhere('due_date', '>', now());
|
||||
});
|
||||
});
|
||||
return $this->builder->where(function ($query) {
|
||||
$query->whereIn('status_id', [Credit::STATUS_SENT, Credit::STATUS_PARTIAL])
|
||||
->where('balance', '>', 0)
|
||||
->where(function ($q) {
|
||||
$q->whereNull('due_date')->orWhere('due_date', '>', now());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public function number(string $number = ''): Builder
|
||||
|
@ -97,6 +97,16 @@ class TaskFilters extends QueryFilters
|
||||
return $this->builder->where('project_id', $this->decodePrimaryKey($project));
|
||||
}
|
||||
|
||||
public function hash(string $hash = ''): Builder
|
||||
{
|
||||
if (strlen($hash) == 0) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
return $this->builder->where('hash', $hash);
|
||||
|
||||
}
|
||||
|
||||
public function number(string $number = ''): Builder
|
||||
{
|
||||
if (strlen($number) == 0) {
|
||||
|
@ -527,10 +527,9 @@ class LoginController extends BaseController
|
||||
|
||||
if (request()->has('id_token')) {
|
||||
$user = $google->getTokenResponse(request()->input('id_token'));
|
||||
}elseif(request()->has('access_token')){
|
||||
} elseif(request()->has('access_token')) {
|
||||
$user = $google->harvestUser(request()->input('access_token'));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return response()->json(['message' => 'Illegal request'], 403);
|
||||
}
|
||||
|
||||
|
@ -928,7 +928,11 @@ class BaseController extends Controller
|
||||
} //allows us to selective display bank integrations back to the user if they can view / create bank transactions but without the bank balance being present in the response
|
||||
elseif($this->entity_type == TaxRate::class && $user->hasIntersectPermissions(['create_invoice','edit_invoice','create_quote','edit_quote','create_purchase_order','edit_purchase_order'])) {
|
||||
// need to show tax rates if the user has the ability to create documents.
|
||||
} else {
|
||||
}
|
||||
elseif($this->entity_type == ExpenseCategory::class && $user->hasPermission('create_expense')) {
|
||||
// need to show expense categories if the user has the ability to create expenses.
|
||||
}
|
||||
else {
|
||||
$query->where('user_id', '=', $user->id);
|
||||
}
|
||||
} elseif (in_array($this->entity_type, [Design::class, GroupSetting::class, PaymentTerm::class, TaskStatus::class])) {
|
||||
|
@ -11,37 +11,37 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\SystemLog;
|
||||
use Postmark\PostmarkClient;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Filters\ClientFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Jobs\Client\UpdateTaxData;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Events\Client\ClientWasCreated;
|
||||
use App\Events\Client\ClientWasUpdated;
|
||||
use App\Transformers\ClientTransformer;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Jobs\PostMark\ProcessPostmarkWebhook;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Filters\ClientFilters;
|
||||
use App\Http\Requests\Client\BulkClientRequest;
|
||||
use App\Http\Requests\Client\EditClientRequest;
|
||||
use App\Http\Requests\Client\ShowClientRequest;
|
||||
use App\Http\Requests\Client\PurgeClientRequest;
|
||||
use App\Http\Requests\Client\StoreClientRequest;
|
||||
use App\Http\Requests\Client\CreateClientRequest;
|
||||
use App\Http\Requests\Client\DestroyClientRequest;
|
||||
use App\Http\Requests\Client\EditClientRequest;
|
||||
use App\Http\Requests\Client\PurgeClientRequest;
|
||||
use App\Http\Requests\Client\ReactivateClientEmailRequest;
|
||||
use App\Http\Requests\Client\ShowClientRequest;
|
||||
use App\Http\Requests\Client\StoreClientRequest;
|
||||
use App\Http\Requests\Client\UpdateClientRequest;
|
||||
use App\Http\Requests\Client\UploadClientRequest;
|
||||
use App\Http\Requests\Client\DestroyClientRequest;
|
||||
use App\Http\Requests\Client\ReactivateClientEmailRequest;
|
||||
use App\Jobs\Client\UpdateTaxData;
|
||||
use App\Jobs\PostMark\ProcessPostmarkWebhook;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Models\SystemLog;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\ClientTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Postmark\PostmarkClient;
|
||||
|
||||
/**
|
||||
* Class ClientController.
|
||||
@ -218,7 +218,7 @@ class ClientController extends BaseController
|
||||
$clients = Client::withTrashed()
|
||||
->company()
|
||||
->whereIn('id', $request->ids)
|
||||
->get();
|
||||
->get();
|
||||
|
||||
if($action == 'template' && $user->can('view', $clients->first())) {
|
||||
|
||||
@ -387,7 +387,7 @@ class ClientController extends BaseController
|
||||
/** @var \Postmark\Models\DynamicResponseModel $response */
|
||||
$response = $postmark->activateBounce((int)$bounce_id);
|
||||
|
||||
if($response && $response?->Message == 'OK' && !$response->Bounce->Inactive && $response->Bounce->Email){
|
||||
if($response && $response?->Message == 'OK' && !$response->Bounce->Inactive && $response->Bounce->Email) {
|
||||
|
||||
$email = $response->Bounce->Email;
|
||||
//remove email from quarantine. //@TODO
|
||||
|
@ -168,7 +168,7 @@ class InvitationController extends Controller
|
||||
set_time_limit(45);
|
||||
|
||||
// if (Ninja::isHosted()) {
|
||||
return $this->returnRawPdf($entity, $invitation_key);
|
||||
return $this->returnRawPdf($entity, $invitation_key);
|
||||
// }
|
||||
|
||||
// return redirect('client/'.$entity.'/'.$invitation_key.'/download_pdf');
|
||||
|
@ -30,7 +30,6 @@ use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
|
@ -201,15 +201,15 @@ class CompanyGatewayController extends BaseController
|
||||
$company_gateway->fill($request->all());
|
||||
$company_gateway->save();
|
||||
|
||||
/*Always ensure at least one fees and limits object is set per gateway*/
|
||||
/*Always ensure at least one fees and limits object is set per gateway*/
|
||||
$gateway_types = $company_gateway->driver(new Client)->getAvailableMethods();
|
||||
|
||||
$fees_and_limits = $company_gateway->fees_and_limits;
|
||||
|
||||
foreach($gateway_types as $key => $gateway_type)
|
||||
{
|
||||
if(!property_exists($fees_and_limits, $key))
|
||||
foreach($gateway_types as $key => $gateway_type) {
|
||||
if(!property_exists($fees_and_limits, $key)) {
|
||||
$fees_and_limits->{$key} = new FeesAndLimits;
|
||||
}
|
||||
}
|
||||
|
||||
$company_gateway->fees_and_limits = $fees_and_limits;
|
||||
|
@ -11,36 +11,36 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Account;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Factory\CreditFactory;
|
||||
use App\Filters\CreditFilters;
|
||||
use App\Jobs\Credit\ZipCredits;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Factory\CloneCreditFactory;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Repositories\CreditRepository;
|
||||
use App\Events\Credit\CreditWasCreated;
|
||||
use App\Events\Credit\CreditWasUpdated;
|
||||
use App\Transformers\CreditTransformer;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Factory\CloneCreditFactory;
|
||||
use App\Factory\CreditFactory;
|
||||
use App\Filters\CreditFilters;
|
||||
use App\Http\Requests\Credit\ActionCreditRequest;
|
||||
use App\Http\Requests\Credit\BulkCreditRequest;
|
||||
use App\Http\Requests\Credit\CreateCreditRequest;
|
||||
use App\Http\Requests\Credit\DestroyCreditRequest;
|
||||
use App\Http\Requests\Credit\EditCreditRequest;
|
||||
use App\Http\Requests\Credit\ShowCreditRequest;
|
||||
use App\Http\Requests\Credit\StoreCreditRequest;
|
||||
use App\Http\Requests\Credit\ActionCreditRequest;
|
||||
use App\Http\Requests\Credit\CreateCreditRequest;
|
||||
use App\Http\Requests\Credit\UpdateCreditRequest;
|
||||
use App\Http\Requests\Credit\UploadCreditRequest;
|
||||
use App\Http\Requests\Credit\DestroyCreditRequest;
|
||||
use App\Jobs\Credit\ZipCredits;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Repositories\CreditRepository;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\CreditTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class CreditController.
|
||||
|
@ -71,8 +71,9 @@ class EmailController extends BaseController
|
||||
|
||||
if ($request->cc_email && (Ninja::isSelfHost() || $user->account->isPaidHostedClient())) {
|
||||
|
||||
foreach($request->cc_email as $email)
|
||||
foreach($request->cc_email as $email) {
|
||||
$mo->cc[] = new Address($email);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,28 +11,28 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Account;
|
||||
use App\Models\Expense;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Factory\ExpenseFactory;
|
||||
use App\Filters\ExpenseFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Repositories\ExpenseRepository;
|
||||
use App\Transformers\ExpenseTransformer;
|
||||
use App\Events\Expense\ExpenseWasCreated;
|
||||
use App\Events\Expense\ExpenseWasUpdated;
|
||||
use App\Factory\ExpenseFactory;
|
||||
use App\Filters\ExpenseFilters;
|
||||
use App\Http\Requests\Expense\BulkExpenseRequest;
|
||||
use App\Http\Requests\Expense\CreateExpenseRequest;
|
||||
use App\Http\Requests\Expense\DestroyExpenseRequest;
|
||||
use App\Http\Requests\Expense\EditExpenseRequest;
|
||||
use App\Http\Requests\Expense\ShowExpenseRequest;
|
||||
use App\Http\Requests\Expense\StoreExpenseRequest;
|
||||
use App\Http\Requests\Expense\CreateExpenseRequest;
|
||||
use App\Http\Requests\Expense\UpdateExpenseRequest;
|
||||
use App\Http\Requests\Expense\UploadExpenseRequest;
|
||||
use App\Http\Requests\Expense\DestroyExpenseRequest;
|
||||
use App\Models\Account;
|
||||
use App\Models\Expense;
|
||||
use App\Repositories\ExpenseRepository;
|
||||
use App\Transformers\ExpenseTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Class ExpenseController.
|
||||
|
@ -528,7 +528,7 @@ class InvoiceController extends BaseController
|
||||
|
||||
$filename = $invoices->first()->getFileName();
|
||||
|
||||
return response()->streamDownload(function () use($invoices) {
|
||||
return response()->streamDownload(function () use ($invoices) {
|
||||
echo $invoices->first()->service()->getInvoicePdf();
|
||||
}, $filename, ['Content-Type' => 'application/pdf']);
|
||||
}
|
||||
|
@ -11,27 +11,27 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Account;
|
||||
use App\Models\Payment;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Events\Payment\PaymentWasUpdated;
|
||||
use App\Factory\PaymentFactory;
|
||||
use App\Filters\PaymentFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Repositories\PaymentRepository;
|
||||
use App\Transformers\PaymentTransformer;
|
||||
use App\Events\Payment\PaymentWasUpdated;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Http\Requests\Payment\BulkActionPaymentRequest;
|
||||
use App\Http\Requests\Payment\CreatePaymentRequest;
|
||||
use App\Http\Requests\Payment\DestroyPaymentRequest;
|
||||
use App\Http\Requests\Payment\EditPaymentRequest;
|
||||
use App\Http\Requests\Payment\RefundPaymentRequest;
|
||||
use App\Http\Requests\Payment\ShowPaymentRequest;
|
||||
use App\Http\Requests\Payment\StorePaymentRequest;
|
||||
use App\Http\Requests\Payment\CreatePaymentRequest;
|
||||
use App\Http\Requests\Payment\RefundPaymentRequest;
|
||||
use App\Http\Requests\Payment\UpdatePaymentRequest;
|
||||
use App\Http\Requests\Payment\UploadPaymentRequest;
|
||||
use App\Http\Requests\Payment\DestroyPaymentRequest;
|
||||
use App\Http\Requests\Payment\BulkActionPaymentRequest;
|
||||
use App\Models\Account;
|
||||
use App\Models\Payment;
|
||||
use App\Repositories\PaymentRepository;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\PaymentTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Class PaymentController.
|
||||
@ -519,7 +519,7 @@ class PaymentController extends BaseController
|
||||
if($action == 'template' && $user->can('view', $payments->first())) {
|
||||
|
||||
$hash_or_response = request()->boolean('send_email') ? 'email sent' : \Illuminate\Support\Str::uuid();
|
||||
nlog($payments->pluck('hashed_id')->toArray());
|
||||
nlog($payments->pluck('hashed_id')->toArray());
|
||||
TemplateAction::dispatch(
|
||||
$payments->pluck('hashed_id')->toArray(),
|
||||
$request->template_id,
|
||||
|
@ -11,33 +11,31 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Utils\HtmlEngine;
|
||||
use Twig\Error\SyntaxError;
|
||||
use App\Jobs\Util\PreviewPdf;
|
||||
use App\Models\ClientContact;
|
||||
use App\Services\Pdf\PdfMock;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Services\PdfMaker\Design;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use App\DataMapper\Analytics\LivePreview;
|
||||
use App\Services\Template\TemplateService;
|
||||
use App\Http\Requests\Preview\DesignPreviewRequest;
|
||||
use App\Services\PdfMaker\Design as PdfDesignModel;
|
||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||
use App\Http\Requests\Preview\PreviewInvoiceRequest;
|
||||
use App\Jobs\Util\PreviewPdf;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Services\Pdf\PdfMock;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Services\PdfMaker\Design;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use App\Services\Template\TemplateService;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use Twig\Error\SyntaxError;
|
||||
|
||||
class PreviewController extends BaseController
|
||||
{
|
||||
|
@ -11,33 +11,33 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Vendor;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Jobs\Util\PreviewPdf;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\VendorContact;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Services\PdfMaker\Design;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Factory\PurchaseOrderFactory;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use App\DataMapper\Analytics\LivePreview;
|
||||
use App\Factory\PurchaseOrderFactory;
|
||||
use App\Http\Requests\Preview\PreviewPurchaseOrderRequest;
|
||||
use App\Jobs\Util\PreviewPdf;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Repositories\PurchaseOrderRepository;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Services\PdfMaker\Design;
|
||||
use App\Services\PdfMaker\Design as PdfDesignModel;
|
||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||
use App\Http\Requests\Preview\PreviewPurchaseOrderRequest;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
|
||||
class PreviewPurchaseOrderController extends BaseController
|
||||
{
|
||||
|
@ -11,25 +11,25 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Factory\ProjectFactory;
|
||||
use App\Filters\ProjectFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Repositories\ProjectRepository;
|
||||
use App\Transformers\ProjectTransformer;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Http\Requests\Project\BulkProjectRequest;
|
||||
use App\Http\Requests\Project\CreateProjectRequest;
|
||||
use App\Http\Requests\Project\DestroyProjectRequest;
|
||||
use App\Http\Requests\Project\EditProjectRequest;
|
||||
use App\Http\Requests\Project\ShowProjectRequest;
|
||||
use App\Http\Requests\Project\StoreProjectRequest;
|
||||
use App\Http\Requests\Project\CreateProjectRequest;
|
||||
use App\Http\Requests\Project\UpdateProjectRequest;
|
||||
use App\Http\Requests\Project\UploadProjectRequest;
|
||||
use App\Http\Requests\Project\DestroyProjectRequest;
|
||||
use App\Http\Requests\Project\BulkProjectRequest;
|
||||
use App\Models\Account;
|
||||
use App\Models\Project;
|
||||
use App\Repositories\ProjectRepository;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\ProjectTransformer;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Class ProjectController.
|
||||
|
@ -11,34 +11,34 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Account;
|
||||
use App\Models\PurchaseOrder;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Factory\PurchaseOrderFactory;
|
||||
use App\Filters\PurchaseOrderFilters;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Jobs\PurchaseOrder\ZipPurchaseOrders;
|
||||
use App\Repositories\PurchaseOrderRepository;
|
||||
use App\Jobs\PurchaseOrder\PurchaseOrderEmail;
|
||||
use App\Transformers\PurchaseOrderTransformer;
|
||||
use App\Events\PurchaseOrder\PurchaseOrderWasCreated;
|
||||
use App\Events\PurchaseOrder\PurchaseOrderWasUpdated;
|
||||
use App\Factory\PurchaseOrderFactory;
|
||||
use App\Filters\PurchaseOrderFilters;
|
||||
use App\Http\Requests\PurchaseOrder\ActionPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\BulkPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\CreatePurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\DestroyPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\EditPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\ShowPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\StorePurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\ActionPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\CreatePurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\UpdatePurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\UploadPurchaseOrderRequest;
|
||||
use App\Http\Requests\PurchaseOrder\DestroyPurchaseOrderRequest;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Jobs\PurchaseOrder\PurchaseOrderEmail;
|
||||
use App\Jobs\PurchaseOrder\ZipPurchaseOrders;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Repositories\PurchaseOrderRepository;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\PurchaseOrderTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PurchaseOrderController extends BaseController
|
||||
{
|
||||
|
@ -11,41 +11,41 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Client;
|
||||
use App\Models\Account;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Factory\QuoteFactory;
|
||||
use App\Filters\QuoteFilters;
|
||||
use App\Jobs\Quote\ZipQuotes;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Factory\CloneQuoteFactory;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Events\Quote\QuoteWasCreated;
|
||||
use App\Events\Quote\QuoteWasUpdated;
|
||||
use App\Repositories\QuoteRepository;
|
||||
use App\Transformers\QuoteTransformer;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Transformers\InvoiceTransformer;
|
||||
use App\Transformers\ProjectTransformer;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Factory\CloneQuoteFactory;
|
||||
use App\Factory\CloneQuoteToInvoiceFactory;
|
||||
use App\Factory\QuoteFactory;
|
||||
use App\Filters\QuoteFilters;
|
||||
use App\Http\Requests\Quote\ActionQuoteRequest;
|
||||
use App\Http\Requests\Quote\BulkActionQuoteRequest;
|
||||
use App\Http\Requests\Quote\CreateQuoteRequest;
|
||||
use App\Http\Requests\Quote\DestroyQuoteRequest;
|
||||
use App\Http\Requests\Quote\EditQuoteRequest;
|
||||
use App\Http\Requests\Quote\ShowQuoteRequest;
|
||||
use App\Http\Requests\Quote\StoreQuoteRequest;
|
||||
use App\Http\Requests\Quote\ActionQuoteRequest;
|
||||
use App\Http\Requests\Quote\CreateQuoteRequest;
|
||||
use App\Http\Requests\Quote\UpdateQuoteRequest;
|
||||
use App\Http\Requests\Quote\UploadQuoteRequest;
|
||||
use App\Http\Requests\Quote\DestroyQuoteRequest;
|
||||
use App\Http\Requests\Quote\BulkActionQuoteRequest;
|
||||
use App\Jobs\Quote\ZipQuotes;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Project;
|
||||
use App\Models\Quote;
|
||||
use App\Repositories\QuoteRepository;
|
||||
use App\Services\PdfMaker\PdfMerge;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\InvoiceTransformer;
|
||||
use App\Transformers\ProjectTransformer;
|
||||
use App\Transformers\QuoteTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class QuoteController.
|
||||
@ -854,7 +854,7 @@ class QuoteController extends BaseController
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
}
|
||||
|
||||
return response()->streamDownload(function () use ($quote,$contact) {
|
||||
return response()->streamDownload(function () use ($quote, $contact) {
|
||||
echo $quote->service()->getQuotePdf($contact);
|
||||
}, $quote->getFileName(), $headers);
|
||||
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Services\Report\ARDetailReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\ARDetailReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class ARDetailReportController extends BaseController
|
||||
{
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Services\Report\ARSummaryReport;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\ARSummaryReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class ARSummaryReportController extends BaseController
|
||||
{
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Services\Report\ClientBalanceReport;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\ClientBalanceReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class ClientBalanceReportController extends BaseController
|
||||
{
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Services\Report\ClientSalesReport;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\ClientSalesReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class ClientSalesReportController extends BaseController
|
||||
{
|
||||
|
@ -11,14 +11,14 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Export\CSV\ProductSalesExport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Report\ProductSalesReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Models\Client;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProductSalesReportController extends BaseController
|
||||
{
|
||||
|
@ -11,14 +11,14 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Services\Report\ProfitLoss;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Report\ProfitLossRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Models\Client;
|
||||
use App\Services\Report\ProfitLoss;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProfitAndLossController extends BaseController
|
||||
{
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Services\Report\TaxSummaryReport;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\TaxSummaryReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class TaxSummaryReportController extends BaseController
|
||||
{
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Reports;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Services\Report\UserSalesReport;
|
||||
use App\Http\Requests\Report\GenericReportRequest;
|
||||
use App\Jobs\Report\PreviewReport;
|
||||
use App\Jobs\Report\SendToAdmin;
|
||||
use App\Services\Report\UserSalesReport;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class UserSalesReportController extends BaseController
|
||||
{
|
||||
|
@ -65,12 +65,10 @@ class SearchController extends Controller
|
||||
$client->contacts->each(function ($contact) {
|
||||
$this->client_contacts[] = [
|
||||
'name' => $contact->present()->search_display(),
|
||||
'type' => '/client_contact',
|
||||
'id' => $contact->hashed_id,
|
||||
'path' => "/clients/{$contact->hashed_id}"
|
||||
];
|
||||
|
||||
|
||||
'type' => '/client',
|
||||
'id' => $contact->client->hashed_id,
|
||||
'path' => "/clients/{$contact->client->hashed_id}"
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class SubdomainController extends BaseController
|
||||
public function index()
|
||||
{
|
||||
if (!MultiDB::checkDomainAvailable(request()->input('subdomain'))) {
|
||||
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
|
||||
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
|
||||
}
|
||||
|
||||
return response()->json(['message' => 'Domain available'], 200);
|
||||
|
@ -11,31 +11,31 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Task;
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Account;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Factory\TaskFactory;
|
||||
use App\Filters\TaskFilters;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Events\Task\TaskWasCreated;
|
||||
use App\Events\Task\TaskWasUpdated;
|
||||
use App\Repositories\TaskRepository;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Transformers\TaskTransformer;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Factory\TaskFactory;
|
||||
use App\Filters\TaskFilters;
|
||||
use App\Http\Requests\Task\BulkTaskRequest;
|
||||
use App\Http\Requests\Task\CreateTaskRequest;
|
||||
use App\Http\Requests\Task\DestroyTaskRequest;
|
||||
use App\Http\Requests\Task\EditTaskRequest;
|
||||
use App\Http\Requests\Task\ShowTaskRequest;
|
||||
use App\Http\Requests\Task\SortTaskRequest;
|
||||
use App\Http\Requests\Task\StoreTaskRequest;
|
||||
use App\Http\Requests\Task\CreateTaskRequest;
|
||||
use App\Http\Requests\Task\UpdateTaskRequest;
|
||||
use App\Http\Requests\Task\UploadTaskRequest;
|
||||
use App\Http\Requests\Task\DestroyTaskRequest;
|
||||
use App\Models\Account;
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Repositories\TaskRepository;
|
||||
use App\Services\Template\TemplateAction;
|
||||
use App\Transformers\TaskTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\BulkOptions;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Class TaskController.
|
||||
|
@ -11,23 +11,23 @@
|
||||
|
||||
namespace App\Http\Controllers\VendorPortal;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\View\View;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\Invoice\InjectSignature;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Events\Misc\InvitationWasViewed;
|
||||
use App\Events\PurchaseOrder\PurchaseOrderWasViewed;
|
||||
use App\Events\PurchaseOrder\PurchaseOrderWasAccepted;
|
||||
use App\Events\PurchaseOrder\PurchaseOrderWasViewed;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\VendorPortal\PurchaseOrders\ProcessPurchaseOrdersInBulkRequest;
|
||||
use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrderRequest;
|
||||
use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrdersRequest;
|
||||
use App\Http\Requests\VendorPortal\PurchaseOrders\ProcessPurchaseOrdersInBulkRequest;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Jobs\Invoice\InjectSignature;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PurchaseOrderController extends Controller
|
||||
{
|
||||
|
@ -67,9 +67,9 @@ class Locale
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
{
|
||||
/*LOCALE SET */
|
||||
if ($request->has('lang') && in_array($request->input('lang','en'), $this->locales) ) {
|
||||
if ($request->has('lang') && in_array($request->input('lang', 'en'), $this->locales)) {
|
||||
$locale = $request->input('lang');
|
||||
App::setLocale($locale);
|
||||
} elseif (auth()->guard('contact')->user()) {
|
||||
|
@ -17,48 +17,48 @@ use Illuminate\Support\Facades\App;
|
||||
|
||||
class VendorLocale
|
||||
{
|
||||
private array $locales = [
|
||||
'en',
|
||||
'it',
|
||||
'de',
|
||||
'fr',
|
||||
'pt_BR',
|
||||
'nl',
|
||||
'es',
|
||||
'nb_NO',
|
||||
'da',
|
||||
'ja',
|
||||
'sv',
|
||||
'es_ES',
|
||||
'fr_CA',
|
||||
'lt',
|
||||
'pl',
|
||||
'cs',
|
||||
'hr',
|
||||
'sq',
|
||||
'el',
|
||||
'en_GB',
|
||||
'pt_PT',
|
||||
'sl',
|
||||
'fi',
|
||||
'ro',
|
||||
'tr_TR',
|
||||
'th',
|
||||
'mk_MK',
|
||||
'zh_TW',
|
||||
'ru_RU',
|
||||
'ar',
|
||||
'fa',
|
||||
'lv_LV',
|
||||
'sr',
|
||||
'sk',
|
||||
'et',
|
||||
'bg',
|
||||
'he',
|
||||
'km_KH',
|
||||
'hu',
|
||||
'fr_CH',
|
||||
];
|
||||
private array $locales = [
|
||||
'en',
|
||||
'it',
|
||||
'de',
|
||||
'fr',
|
||||
'pt_BR',
|
||||
'nl',
|
||||
'es',
|
||||
'nb_NO',
|
||||
'da',
|
||||
'ja',
|
||||
'sv',
|
||||
'es_ES',
|
||||
'fr_CA',
|
||||
'lt',
|
||||
'pl',
|
||||
'cs',
|
||||
'hr',
|
||||
'sq',
|
||||
'el',
|
||||
'en_GB',
|
||||
'pt_PT',
|
||||
'sl',
|
||||
'fi',
|
||||
'ro',
|
||||
'tr_TR',
|
||||
'th',
|
||||
'mk_MK',
|
||||
'zh_TW',
|
||||
'ru_RU',
|
||||
'ar',
|
||||
'fa',
|
||||
'lv_LV',
|
||||
'sr',
|
||||
'sk',
|
||||
'et',
|
||||
'bg',
|
||||
'he',
|
||||
'km_KH',
|
||||
'hu',
|
||||
'fr_CH',
|
||||
];
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@ -74,7 +74,7 @@ class VendorLocale
|
||||
}
|
||||
|
||||
/*LOCALE SET */
|
||||
if ($request->has('lang') && in_array($request->input('lang','en'), $this->locales) ) {
|
||||
if ($request->has('lang') && in_array($request->input('lang', 'en'), $this->locales)) {
|
||||
$locale = $request->input('lang');
|
||||
App::setLocale($locale);
|
||||
} elseif (auth()->guard('vendor')->user()) {
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace App\Http\Requests\CompanyGateway;
|
||||
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||
use App\Models\Gateway;
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
namespace App\Http\Requests\Design;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Account;
|
||||
use App\Utils\Traits\ChecksEntityStatus;
|
||||
|
||||
class UpdateDesignRequest extends Request
|
||||
|
@ -74,12 +74,12 @@ class SendEmailRequest extends Request
|
||||
$input['entity'] = "App\Models\\".ucfirst(Str::camel($input['entity']));
|
||||
}
|
||||
|
||||
if(isset($input['cc_email'])){
|
||||
$input['cc_email'] = collect(explode(",", $input['cc_email']))->map(function($email){
|
||||
if(isset($input['cc_email'])) {
|
||||
$input['cc_email'] = collect(explode(",", $input['cc_email']))->map(function ($email) {
|
||||
return trim($email);
|
||||
})->filter(function($email){
|
||||
})->filter(function ($email) {
|
||||
return filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
})->slice(0,4)->toArray();
|
||||
})->slice(0, 4)->toArray();
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Http\Requests\Invoice;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Payment;
|
||||
|
||||
class BulkInvoiceRequest extends Request
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ class StorePaymentRequest extends Request
|
||||
}
|
||||
|
||||
if (! isset($input['idempotency_key'])) {
|
||||
$input['idempotency_key'] = substr(sha1(json_encode($input)).time()."{$input['date']}{$input['amount']}{$user->id}",0,64);
|
||||
$input['idempotency_key'] = substr(sha1(json_encode($input)).time()."{$input['date']}{$input['amount']}{$user->id}", 0, 64);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
namespace App\Http\Requests\Preview;
|
||||
|
||||
use App\Models\Vendor;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\Vendor;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class PreviewPurchaseOrderRequest extends Request
|
||||
{
|
||||
|
@ -54,10 +54,13 @@ class StoreTaskRequest extends Request
|
||||
$rules['project_id'] = 'bail|required|exists:projects,id,company_id,'.$user->company()->id.',is_deleted,0';
|
||||
}
|
||||
|
||||
$rules['hash'] = 'bail|sometimes|string|nullable';
|
||||
|
||||
$rules['time_log'] = ['bail',function ($attribute, $values, $fail) {
|
||||
|
||||
if(is_string($values))
|
||||
if(is_string($values)) {
|
||||
$values = json_decode($values, true);
|
||||
}
|
||||
|
||||
if(!is_array($values)) {
|
||||
$fail('The '.$attribute.' must be a valid array.');
|
||||
@ -119,7 +122,7 @@ class StoreTaskRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($input['time_log']) || empty($input['time_log']) || $input['time_log'] == '{}'){
|
||||
if(!isset($input['time_log']) || empty($input['time_log']) || $input['time_log'] == '{}') {
|
||||
$input['time_log'] = json_encode([]);
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ class UpdateTaskRequest extends Request
|
||||
$rules['project_id'] = 'bail|required|exists:projects,id,company_id,'.$user->company()->id.',is_deleted,0';
|
||||
}
|
||||
|
||||
$rules['hash'] = 'bail|sometimes|string|nullable';
|
||||
|
||||
$rules['time_log'] = ['bail', function ($attribute, $values, $fail) {
|
||||
|
||||
if(is_string($values)) {
|
||||
|
@ -77,7 +77,7 @@ class BaseTransformer
|
||||
}
|
||||
|
||||
public function getString($data, $field)
|
||||
{
|
||||
{
|
||||
return isset($data[$field]) && $data[$field] ? trim($data[$field]) : '';
|
||||
}
|
||||
|
||||
@ -677,8 +677,9 @@ class BaseTransformer
|
||||
*/
|
||||
public function getProjectId($name, $clientId = null)
|
||||
{
|
||||
if(strlen($name) == 0)
|
||||
if(strlen($name) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$project = Project::query()->where('company_id', $this->company->id)
|
||||
->where('is_deleted', false)
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
namespace App\Import\Transformer\Csv;
|
||||
|
||||
use App\Models\TaskStatus;
|
||||
use App\Import\Transformer\BaseTransformer;
|
||||
use App\Models\TaskStatus;
|
||||
|
||||
/**
|
||||
* Class TaskTransformer.
|
||||
@ -29,10 +29,11 @@ class TaskTransformer extends BaseTransformer
|
||||
{
|
||||
$this->stubbed_timestamp = time();
|
||||
|
||||
if(count($task_items_data) == count($task_items_data, COUNT_RECURSIVE))
|
||||
if(count($task_items_data) == count($task_items_data, COUNT_RECURSIVE)) {
|
||||
$task_data = $task_items_data;
|
||||
else
|
||||
} else {
|
||||
$task_data = reset($task_items_data);
|
||||
}
|
||||
|
||||
$clientId = $this->getClient(
|
||||
$this->getString($task_data, 'client.name'),
|
||||
@ -79,12 +80,13 @@ class TaskTransformer extends BaseTransformer
|
||||
|
||||
$notes = $item['task.notes'] ?? '';
|
||||
|
||||
if(isset($item['task.is_billable']) && is_string($item['task.is_billable']) && in_array($item['task.is_billable'], ['yes', 'true', '1']))
|
||||
if(isset($item['task.is_billable']) && is_string($item['task.is_billable']) && in_array($item['task.is_billable'], ['yes', 'true', '1'])) {
|
||||
$is_billable = true;
|
||||
elseif(isset($item['task.is_billable']) && is_bool($item['task.is_billable']))
|
||||
} elseif(isset($item['task.is_billable']) && is_bool($item['task.is_billable'])) {
|
||||
$is_billable = $item['task.is_billable'];
|
||||
else
|
||||
} else {
|
||||
$is_billable = false;
|
||||
}
|
||||
|
||||
if(isset($item['task.start_date']) &&
|
||||
isset($item['task.end_date'])) {
|
||||
@ -148,8 +150,7 @@ class TaskTransformer extends BaseTransformer
|
||||
|
||||
private function getTaskStatusId($item): ?int
|
||||
{
|
||||
if(isset($item['task.status']))
|
||||
{
|
||||
if(isset($item['task.status'])) {
|
||||
$name = strtolower(trim($item['task.status']));
|
||||
|
||||
$ts = TaskStatus::query()->where('company_id', $this->company->id)
|
||||
@ -159,9 +160,10 @@ class TaskTransformer extends BaseTransformer
|
||||
])
|
||||
->first();
|
||||
|
||||
if($ts)
|
||||
return $ts->id;
|
||||
}
|
||||
if($ts) {
|
||||
return $ts->id;
|
||||
}
|
||||
}
|
||||
|
||||
return TaskStatus::where('company_id', $this->company->id)
|
||||
->where('is_deleted', false)
|
||||
|
@ -63,8 +63,8 @@ class UpdateTaxData implements ShouldQueue
|
||||
|
||||
if (!$this->client->state && $this->client->postal_code) {
|
||||
|
||||
$this->client->state = USStates::getState($this->client->postal_code);
|
||||
$this->client->saveQuietly();
|
||||
$this->client->update(['state' => USStates::getState($this->client->postal_code)]);
|
||||
// $this->client->saveQuietly();
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ use App\Exceptions\NonExistingMigrationFile;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Jobs\Ninja\TaskScheduler;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\Import\CompanyImportFailure;
|
||||
use App\Mail\Import\ImportCompleted;
|
||||
@ -218,7 +217,7 @@ class CompanyImport implements ShouldQueue
|
||||
'baseline' => [],
|
||||
'5.7.35' => [
|
||||
Payment::class => [
|
||||
'refund_meta',
|
||||
'refund_meta',
|
||||
'category_id',
|
||||
],
|
||||
User::class => [
|
||||
@ -462,7 +461,7 @@ class CompanyImport implements ShouldQueue
|
||||
|
||||
$this->company->save();
|
||||
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function purgeCompanyData()
|
||||
@ -1367,8 +1366,9 @@ class CompanyImport implements ShouldQueue
|
||||
private function filterVersionProps($class, array $obj_array): array
|
||||
{
|
||||
|
||||
if($this->current_app_version == $this->import_version)
|
||||
if($this->current_app_version == $this->import_version) {
|
||||
return $obj_array;
|
||||
}
|
||||
|
||||
$version_index = 0;
|
||||
$index = 0;
|
||||
@ -1390,9 +1390,9 @@ class CompanyImport implements ShouldQueue
|
||||
return $collection->slice($version_index)->pluck($class)->filter();
|
||||
});
|
||||
|
||||
return collect($obj_array)->diffKeys($filters->flatten()->flip())->toArray();
|
||||
return collect($obj_array)->diffKeys($filters->flatten()->flip())->toArray();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function genericNewClassImport($class, $unset, $transforms, $object_property)
|
||||
{
|
||||
@ -1415,7 +1415,7 @@ class CompanyImport implements ShouldQueue
|
||||
$obj_array['gateway_key'] = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
}
|
||||
|
||||
if(!isset($obj_array['fees_and_limits'])){
|
||||
if(!isset($obj_array['fees_and_limits'])) {
|
||||
$obj_array['fees_and_limits'] = \json_encode([]);
|
||||
}
|
||||
}
|
||||
@ -1467,16 +1467,16 @@ class CompanyImport implements ShouldQueue
|
||||
/** @var \stdClass $parameters */
|
||||
$parameters = $obj_array['parameters'];
|
||||
|
||||
if(isset($parameters->clients)){
|
||||
if(isset($parameters->clients)) {
|
||||
|
||||
$parameters->clients =
|
||||
collect($parameters->clients)->map(function ($client_hash){
|
||||
collect($parameters->clients)->map(function ($client_hash) {
|
||||
return $this->encodePrimaryKey($this->transformId('clients', $client_hash));
|
||||
})->toArray();
|
||||
|
||||
}
|
||||
|
||||
if(isset($parameters->entity_id)){
|
||||
if(isset($parameters->entity_id)) {
|
||||
$parameters->entity_id = $this->encodePrimaryKey($this->transformId($parameters->entity."s", $parameters->entity_id));
|
||||
}
|
||||
|
||||
@ -1485,7 +1485,7 @@ class CompanyImport implements ShouldQueue
|
||||
|
||||
$new_obj = new $class();
|
||||
$new_obj->company_id = $this->company->id;
|
||||
$obj_array = $this->filterVersionProps($class,$obj_array);
|
||||
$obj_array = $this->filterVersionProps($class, $obj_array);
|
||||
|
||||
$new_obj->fill($obj_array);
|
||||
|
||||
|
@ -14,7 +14,6 @@ namespace App\Jobs\Company;
|
||||
use App\DataMapper\ClientRegistrationFields;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\Tax\TaxModel;
|
||||
use App\Factory\TaxRateFactory;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Models\Country;
|
||||
|
@ -79,9 +79,9 @@ class UpdateCalculatedFields
|
||||
|
||||
$project->tasks->each(function ($task) use (&$duration) {
|
||||
|
||||
if(is_iterable(json_decode($task->time_log) )) {
|
||||
if(is_iterable(json_decode($task->time_log))) {
|
||||
|
||||
foreach(json_decode($task->time_log) as $log) {
|
||||
foreach(json_decode($task->time_log) as $log) {
|
||||
|
||||
$start_time = $log[0];
|
||||
$end_time = $log[1] == 0 ? time() : $log[1];
|
||||
|
@ -11,23 +11,23 @@
|
||||
|
||||
namespace App\Jobs\Entity;
|
||||
|
||||
use App\Models\Quote;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Utils\Traits\Pdf\PdfMaker;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use App\Exceptions\FilePermissionsFailure;
|
||||
use App\Models\Credit;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\Quote;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\RecurringInvoiceInvitation;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use App\Utils\Traits\Pdf\PdfMaker;
|
||||
|
||||
class CreateRawPdf
|
||||
{
|
||||
@ -63,7 +63,7 @@ class CreateRawPdf
|
||||
} elseif ($invitation instanceof RecurringInvoiceInvitation) {
|
||||
$this->entity = $invitation->recurring_invoice;
|
||||
$this->entity_string = 'recurring_invoice';
|
||||
} elseif ($invitation instanceof PurchaseOrderInvitation){
|
||||
} elseif ($invitation instanceof PurchaseOrderInvitation) {
|
||||
$this->entity = $invitation->purchase_order;
|
||||
$this->entity_string = 'purchase_order';
|
||||
}
|
||||
@ -72,8 +72,9 @@ class CreateRawPdf
|
||||
|
||||
private function resolveType(): string
|
||||
{
|
||||
if($this->type)
|
||||
if($this->type) {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
$type = 'product';
|
||||
|
||||
|
@ -11,21 +11,21 @@
|
||||
|
||||
namespace App\Jobs\Expense;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Expense;
|
||||
use App\Models\VendorContact;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use App\Services\Email\Email;
|
||||
use App\Services\Email\EmailObject;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Activity;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\VendorContact;
|
||||
use App\Services\Email\Email;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Services\Email\EmailObject;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VendorExpenseNotify implements ShouldQueue
|
||||
{
|
||||
@ -41,9 +41,12 @@ class VendorExpenseNotify implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDB($this->db);
|
||||
|
||||
$this->expense->vendor->contacts->filter(function(VendorContact $contact){
|
||||
if(!$this->expense->vendor)
|
||||
return;
|
||||
|
||||
$this->expense->vendor->contacts->filter(function (VendorContact $contact) {
|
||||
return $contact->send_email && $contact->email;
|
||||
})->each(function(VendorContact $contact){
|
||||
})->each(function (VendorContact $contact) {
|
||||
$this->notify($contact);
|
||||
});
|
||||
}
|
||||
@ -96,4 +99,4 @@ class VendorExpenseNotify implements ShouldQueue
|
||||
$activity_repo->save($fields, $this->expense, Ninja::eventVars());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
|
||||
$company_ledger->balance = ($parent_ledger ? $parent_ledger->balance : 0) + $company_ledger->adjustment;
|
||||
$company_ledger->save();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// nlog("finished job {$uuid}");
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ namespace App\Jobs\Ledger;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\CompanyLedger;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
//@deprecated
|
||||
class UpdateLedger implements ShouldQueue
|
||||
@ -51,20 +51,21 @@ class UpdateLedger implements ShouldQueue
|
||||
|
||||
nlog($cl->company_ledgerable->company_ledger()->count());
|
||||
|
||||
if(!$cl)
|
||||
if(!$cl) {
|
||||
return;
|
||||
}
|
||||
|
||||
$entity = $cl->company_ledgerable;
|
||||
$balance = $entity->calc()->getBalance();
|
||||
$cl->adjustment = $ledger_item ? $balance : ($balance - $this->start_amount);
|
||||
|
||||
$parent_ledger = CompanyLedger::query()
|
||||
->where('id', '<', $cl->id)
|
||||
->where('company_id', $cl->company_id)
|
||||
->where('client_id', $cl->client_id)
|
||||
->where('balance', '!=', 0)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
$parent_ledger = CompanyLedger::query()
|
||||
->where('id', '<', $cl->id)
|
||||
->where('company_id', $cl->company_id)
|
||||
->where('client_id', $cl->client_id)
|
||||
->where('balance', '!=', 0)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
$cl->balance = ($parent_ledger ? $parent_ledger->balance : 0) + $cl->adjustment;
|
||||
$cl->save();
|
||||
|
@ -24,7 +24,6 @@ use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\SystemLog;
|
||||
use App\Models\User;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
|
@ -159,4 +159,4 @@ class SystemMaintenance implements ShouldQueue
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class EmailPayment implements ShouldQueue
|
||||
|
||||
$email_builder = (new PaymentEmailEngine($this->payment, $this->contact))->build();
|
||||
|
||||
if($this->settings->payment_email_all_contacts && $this->payment->invoices && $this->payment->invoices->count() >= 1) {
|
||||
if($this->payment->client->getSetting('payment_email_all_contacts') && $this->payment->invoices && $this->payment->invoices->count() >= 1) {
|
||||
$this->emailAllContacts($email_builder);
|
||||
return;
|
||||
}
|
||||
@ -111,7 +111,7 @@ class EmailPayment implements ShouldQueue
|
||||
|
||||
$invoice = $this->payment->invoices->first();
|
||||
|
||||
$invoice->invitations->each(function ($invite) use ($email_builder){
|
||||
$invoice->invitations->each(function ($invite) use ($email_builder) {
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new TemplateEmail($email_builder, $invite->contact, $invite);
|
||||
|
@ -11,21 +11,21 @@
|
||||
|
||||
namespace App\Jobs\PurchaseOrder;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Company;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Jobs\Util\UnlinkFile;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Jobs\Util\UnlinkFile;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\DownloadPurchaseOrders;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Company;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ZipPurchaseOrders implements ShouldQueue
|
||||
{
|
||||
|
@ -39,10 +39,11 @@ class PreviewReport implements ShouldQueue
|
||||
/** @var \App\Export\CSV\CreditExport $export */
|
||||
$export = new $this->report_class($this->company, $this->request);
|
||||
|
||||
if(isset($this->request['output']) && $this->request['output'] == 'json')
|
||||
if(isset($this->request['output']) && $this->request['output'] == 'json') {
|
||||
$report = $export->returnJson();
|
||||
else
|
||||
} else {
|
||||
$report = $export->run();
|
||||
}
|
||||
|
||||
// nlog($report);
|
||||
|
||||
|
@ -364,23 +364,27 @@ class Import implements ShouldQueue
|
||||
if (isset($data['plan_expires'])) {
|
||||
unset($data['plan_expires']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
if(isset($data['plan']))
|
||||
if(isset($data['plan'])) {
|
||||
$account->plan = $data['plan'];
|
||||
}
|
||||
|
||||
if (isset($data['plan_term']))
|
||||
if (isset($data['plan_term'])) {
|
||||
$account->plan_term = $data['plan_term'];
|
||||
}
|
||||
|
||||
if (isset($data['plan_paid']))
|
||||
if (isset($data['plan_paid'])) {
|
||||
$account->plan_paid = $data['plan_paid'];
|
||||
}
|
||||
|
||||
if (isset($data['plan_started']))
|
||||
if (isset($data['plan_started'])) {
|
||||
$account->plan_started = $data['plan_started'];
|
||||
}
|
||||
|
||||
if (isset($data['plan_expires']))
|
||||
if (isset($data['plan_expires'])) {
|
||||
$account->plan_expires = $data['plan_expires'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -11,20 +11,20 @@
|
||||
|
||||
namespace App\Jobs\Util;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\ClientContact;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Factory\VendorContactFactory;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Vendor;
|
||||
use App\Utils\Ninja;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class VersionCheck implements ShouldQueue
|
||||
{
|
||||
@ -81,7 +81,7 @@ class VersionCheck implements ShouldQueue
|
||||
$c->send_email = false;
|
||||
$c->saveQuietly();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
ClientContact::query()
|
||||
->whereNull('contact_key')
|
||||
@ -91,7 +91,7 @@ class VersionCheck implements ShouldQueue
|
||||
|
||||
Client::doesntHave('contacts')
|
||||
->cursor()
|
||||
->each(function ($client){
|
||||
->each(function ($client) {
|
||||
|
||||
$new_contact = ClientContactFactory::create($client->company_id, $client->user_id);
|
||||
$new_contact->client_id = $client->id;
|
||||
@ -104,14 +104,14 @@ class VersionCheck implements ShouldQueue
|
||||
|
||||
Vendor::doesntHave('contacts')
|
||||
->cursor()
|
||||
->each(function ($vendor){
|
||||
->each(function ($vendor) {
|
||||
|
||||
$new_contact = VendorContactFactory::create($vendor->company_id, $vendor->user_id);
|
||||
$new_contact->vendor_id = $vendor->id;
|
||||
$new_contact->contact_key = Str::random(40);
|
||||
$new_contact->is_primary = true;
|
||||
$new_contact->save();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
38
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
38
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
@ -11,29 +11,29 @@
|
||||
|
||||
namespace App\Jobs\Vendor;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Design;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\Traits\Pdf\PdfMaker;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use App\Exceptions\FilePermissionsFailure;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Design;
|
||||
use App\Services\Pdf\PdfService;
|
||||
use App\Services\PdfMaker\Design as PdfDesignModel;
|
||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||
use App\Services\PdfMaker\PdfMaker as PdfMakerService;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\PhantomJS\Phantom;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
use App\Utils\Traits\Pdf\PageNumbering;
|
||||
use App\Utils\Traits\Pdf\PdfMaker;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/** @deprecated 26-10-2023 5.7.30x */
|
||||
class CreatePurchaseOrderPdf implements ShouldQueue
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Libraries\OAuth\Providers;
|
||||
|
||||
use Google_Client;
|
||||
|
||||
class Google implements ProviderInterface
|
||||
{
|
||||
public function getTokenResponse($token)
|
||||
@ -38,8 +39,7 @@ class Google implements ProviderInterface
|
||||
|
||||
try {
|
||||
$userInfo = $oauth2->userinfo->get();
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -11,23 +11,15 @@
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\User\UserAdded;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Http\Client\Events\ResponseReceived;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class LogResponseReceived
|
||||
{
|
||||
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
|
@ -197,6 +197,8 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
$data = [];
|
||||
|
||||
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
|
||||
$data['$amount_paid'] = ['value' => '', 'label' => ctrans('texts.amount_paid')];
|
||||
$data['$refund'] = ['value' => '', 'label' => ctrans('texts.refund')];
|
||||
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
|
||||
$data['$number'] = ['value' => $this->payment->number ?: ' ', 'label' => ctrans('texts.payment_number')];
|
||||
$data['$payment.number'] = &$data['$number'];
|
||||
@ -207,6 +209,7 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
$data['$amount'] = &$data['$payment.amount'];
|
||||
$data['$payment.date'] = ['value' => $this->translateDate($this->payment->date, $this->client->date_format(), $this->client->locale()), 'label' => ctrans('texts.payment_date')];
|
||||
$data['$transaction_reference'] = ['value' => $this->payment->transaction_reference, 'label' => ctrans('texts.transaction_reference')];
|
||||
$data['$reference'] = ['value' => '', 'label' => ctrans('texts.reference')];
|
||||
$data['$public_notes'] = ['value' => $this->payment->public_notes, 'label' => ctrans('texts.notes')];
|
||||
|
||||
$data['$payment1'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'payment1', $this->payment->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'payment1')];
|
||||
|
@ -11,17 +11,17 @@
|
||||
|
||||
namespace App\Mail\Engine;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Models\Vendor;
|
||||
use App\DataMapper\EmailTemplateDefaults;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use App\Models\Account;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\Vendor;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\VendorHtmlEngine;
|
||||
use App\Jobs\Entity\CreateRawPdf;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use App\DataMapper\EmailTemplateDefaults;
|
||||
|
||||
class PurchaseOrderEmailEngine extends BaseEmailEngine
|
||||
{
|
||||
|
@ -11,22 +11,21 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Casts\EncryptedCast;
|
||||
use App\Models\VendorContact;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use App\Utils\Traits\CompanySettingsSaver;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use App\Models\Presenters\CompanyPresenter;
|
||||
use App\Services\Company\CompanyService;
|
||||
use App\Services\Notification\NotificationService;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use App\Utils\Traits\CompanySettingsSaver;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
|
||||
/**
|
||||
* App\Models\Company
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Document\WithTypeHelpers;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
@ -211,8 +210,9 @@ class Document extends BaseModel
|
||||
$image = $this->getFile();
|
||||
$catch_image = $image;
|
||||
|
||||
if(!extension_loaded('imagick'))
|
||||
if(!extension_loaded('imagick')) {
|
||||
return $catch_image;
|
||||
}
|
||||
|
||||
try {
|
||||
$file = base64_encode($image);
|
||||
@ -224,8 +224,7 @@ class Document extends BaseModel
|
||||
|
||||
return $img->getImageBlob();
|
||||
|
||||
}
|
||||
catch(\Exception $e){
|
||||
} catch(\Exception $e) {
|
||||
|
||||
nlog($e->getMessage());
|
||||
return $catch_image;
|
||||
|
@ -203,6 +203,11 @@ class Expense extends BaseModel
|
||||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
|
||||
public function invoice_currency(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
|
||||
public function category(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ExpenseCategory::class)->withTrashed();
|
||||
|
@ -90,7 +90,7 @@ class Gateway extends StaticModel
|
||||
|
||||
if ($this->id == 1) {
|
||||
$link = 'http://reseller.authorize.net/application/?id=5560364';
|
||||
} elseif (in_array($this->id,[15,60,61])) {
|
||||
} elseif (in_array($this->id, [15,60,61])) {
|
||||
$link = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run';
|
||||
} elseif ($this->id == 24) {
|
||||
$link = 'https://www.2checkout.com/referral?r=2c37ac2298';
|
||||
|
@ -269,6 +269,11 @@ class PurchaseOrder extends BaseModel
|
||||
return $this->belongsTo(Client::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function currency(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Currency::class);
|
||||
}
|
||||
|
||||
public function markInvitationsSent(): void
|
||||
{
|
||||
$this->invitations->each(function ($invitation) {
|
||||
|
@ -19,6 +19,8 @@ use Illuminate\Support\Carbon;
|
||||
* App\Models\Task
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $hash
|
||||
* @property object|null $meta
|
||||
* @property int $user_id
|
||||
* @property int|null $assigned_user_id
|
||||
* @property int $company_id
|
||||
@ -118,6 +120,15 @@ class Task extends BaseModel
|
||||
'number',
|
||||
'is_date_based',
|
||||
'status_order',
|
||||
'hash',
|
||||
'meta',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'meta' => 'object',
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
];
|
||||
|
||||
protected $touches = [];
|
||||
@ -164,11 +175,13 @@ class Task extends BaseModel
|
||||
|
||||
public function stringStatus()
|
||||
{
|
||||
if($this->invoice_id)
|
||||
if($this->invoice_id) {
|
||||
return '<h5><span class="badge badge-success">'.ctrans('texts.invoiced').'</span></h5>';
|
||||
}
|
||||
|
||||
if($this->status)
|
||||
if($this->status) {
|
||||
return '<h5><span class="badge badge-primary">' . $this->status?->name ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
@ -255,18 +268,20 @@ class Task extends BaseModel
|
||||
public function processLogs()
|
||||
{
|
||||
|
||||
return
|
||||
collect(json_decode($this->time_log,true))->map(function ($log){
|
||||
return
|
||||
collect(json_decode($this->time_log, true))->map(function ($log) {
|
||||
|
||||
$parent_entity = $this->client ?? $this->company;
|
||||
|
||||
if($log[0])
|
||||
if($log[0]) {
|
||||
$log[0] = Carbon::createFromTimestamp($log[0])->format($parent_entity->date_format().' H:i:s');
|
||||
}
|
||||
|
||||
if($log[1] && $log[1] != 0)
|
||||
if($log[1] && $log[1] != 0) {
|
||||
$log[1] = Carbon::createFromTimestamp($log[1])->format($parent_entity->date_format().' H:i:s');
|
||||
else
|
||||
} else {
|
||||
$log[1] = ctrans('texts.running');
|
||||
}
|
||||
|
||||
return $log;
|
||||
})->toArray();
|
||||
@ -276,28 +291,27 @@ class Task extends BaseModel
|
||||
public function processLogsExpandedNotation()
|
||||
{
|
||||
|
||||
return
|
||||
collect(json_decode($this->time_log,true))->map(function ($log){
|
||||
return
|
||||
collect(json_decode($this->time_log, true))->map(function ($log) {
|
||||
|
||||
$parent_entity = $this->client ?? $this->company;
|
||||
$logged = [];
|
||||
|
||||
if($log[0] && $log[1] !=0 ) {
|
||||
if($log[0] && $log[1] !=0) {
|
||||
$duration = $log[1] - $log[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$duration = 0;
|
||||
}
|
||||
|
||||
if($log[0])
|
||||
if($log[0]) {
|
||||
$logged['start_date_raw'] = $log[0];
|
||||
$logged['start_date'] = Carbon::createFromTimestamp($log[0])->setTimeZone($this->company->timezone()->name)->format($parent_entity->date_format().' H:i:s');
|
||||
}
|
||||
$logged['start_date'] = Carbon::createFromTimestamp($log[0])->setTimeZone($this->company->timezone()->name)->format($parent_entity->date_format().' H:i:s');
|
||||
|
||||
if($log[1] && $log[1] != 0) {
|
||||
$logged['end_date_raw'] = $log[1];
|
||||
$logged['end_date'] = Carbon::createFromTimestamp($log[1])->setTimeZone($this->company->timezone()->name)->format($parent_entity->date_format().' H:i:s');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$logged['end_date_raw'] = 0;
|
||||
$logged['end_date'] = ctrans('texts.running');
|
||||
}
|
||||
|
@ -71,4 +71,5 @@ class TaskStatus extends BaseModel
|
||||
'color',
|
||||
'status_order',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class AuthorizeCustomer
|
||||
$client = $client_gateway_token->client;
|
||||
} elseif ($client_contact = ClientContact::where('company_id', $company->id)->where('email', $profile['email'])->first()) {
|
||||
$client = $client_contact->client;
|
||||
// nlog("found client through contact");
|
||||
// nlog("found client through contact");
|
||||
} else {
|
||||
// nlog("creating client");
|
||||
|
||||
|
@ -749,19 +749,19 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices_string = str_replace(["*","<",">","'",'"'], "-", $invoices_string);
|
||||
|
||||
// 2023-11-02 - improve the statement descriptor for string
|
||||
// 2023-11-02 - improve the statement descriptor for string
|
||||
|
||||
$company_name = $this->client->company->present()->name();
|
||||
$company_name = str_replace(["*","<",">","'",'"'], "-", $company_name);
|
||||
$company_name = $this->client->company->present()->name();
|
||||
$company_name = str_replace(["*","<",">","'",'"'], "-", $company_name);
|
||||
|
||||
if(ctype_digit(substr($company_name, 0, 1))) {
|
||||
$company_name = "I" . $company_name;
|
||||
}
|
||||
if(ctype_digit(substr($company_name, 0, 1))) {
|
||||
$company_name = "I" . $company_name;
|
||||
}
|
||||
|
||||
$company_name = substr($company_name, 0, 11);
|
||||
$descriptor = "{$company_name} {$invoices_string}";
|
||||
$descriptor = substr($descriptor, 0, 22);
|
||||
return $descriptor;
|
||||
$company_name = substr($company_name, 0, 11);
|
||||
$descriptor = "{$company_name} {$invoices_string}";
|
||||
$descriptor = substr($descriptor, 0, 22);
|
||||
return $descriptor;
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -406,7 +406,7 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
|
||||
if(!in_array($mandate->status, ['pending_submission', 'submitted', 'active','pending_customer_approval'])) {
|
||||
|
||||
// if ($mandate->status !== 'active') {
|
||||
// if ($mandate->status !== 'active') {
|
||||
throw new \Exception(ctrans('texts.gocardless_mandate_not_ready'));
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
|
@ -21,7 +21,6 @@ use App\Models\SystemLog;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Omnipay\Omnipay;
|
||||
use Str;
|
||||
|
||||
class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
@ -65,7 +64,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
];
|
||||
|
||||
/**
|
||||
* Return an array of
|
||||
* Return an array of
|
||||
* enabled gateway payment methods
|
||||
*
|
||||
* @return array
|
||||
@ -74,9 +73,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
{
|
||||
|
||||
return collect($this->company_gateway->fees_and_limits)
|
||||
->filter(function ($fee){
|
||||
->filter(function ($fee) {
|
||||
return $fee->is_enabled;
|
||||
})->map(function ($fee, $key){
|
||||
})->map(function ($fee, $key) {
|
||||
return (int)$key;
|
||||
})->toArray();
|
||||
|
||||
@ -86,7 +85,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
{
|
||||
$method = PaymentType::PAYPAL;
|
||||
|
||||
match($gateway_type_id){
|
||||
match($gateway_type_id) {
|
||||
"1" => $method = PaymentType::CREDIT_CARD_OTHER,
|
||||
"3" => $method = PaymentType::PAYPAL,
|
||||
"25" => $method = PaymentType::VENMO,
|
||||
@ -132,7 +131,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
/**
|
||||
* Initialize the Paypal gateway.
|
||||
*
|
||||
*
|
||||
* Attempt to generate and return the access token.
|
||||
*
|
||||
* @return self
|
||||
@ -145,8 +144,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
$secret = config('ninja.paypal.secret');
|
||||
$client_id = config('ninja.paypal.client_id');
|
||||
|
||||
if($this->access_token && $this->token_expiry && $this->token_expiry->isFuture())
|
||||
if($this->access_token && $this->token_expiry && $this->token_expiry->isFuture()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$response = Http::withBasicAuth($client_id, $secret)
|
||||
->withHeaders(['Content-Type' => 'application/x-www-form-urlencoded'])
|
||||
@ -194,7 +194,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
private function checkPaymentsReceivable(): self
|
||||
{
|
||||
|
||||
if($this->company_gateway->getConfigField('status') != 'activated'){
|
||||
if($this->company_gateway->getConfigField('status') != 'activated') {
|
||||
|
||||
if (class_exists(\Modules\Admin\Services\PayPal\PayPalService::class)) {
|
||||
$pp = new \Modules\Admin\Services\PayPal\PayPalService($this->company_gateway->company, $this->company_gateway->user);
|
||||
@ -203,8 +203,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
$this->company_gateway = $this->company_gateway->fresh();
|
||||
$config = $this->company_gateway->getConfig();
|
||||
|
||||
if($config->status == 'activated')
|
||||
if($config->status == 'activated') {
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -241,8 +242,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
$r = $this->gatewayRequest('/v1/identity/generate-token', 'post', ['body' => '']);
|
||||
|
||||
if($r->successful())
|
||||
if($r->successful()) {
|
||||
return $r->json()['client_token'];
|
||||
}
|
||||
|
||||
throw new PaymentFailed('Unable to gain client token from Paypal. Check your configuration', 401);
|
||||
|
||||
@ -278,8 +280,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
} else {
|
||||
|
||||
if(isset($response['headers']) ?? false)
|
||||
if(isset($response['headers']) ?? false) {
|
||||
unset($response['headers']);
|
||||
}
|
||||
|
||||
SystemLogger::dispatch(
|
||||
['response' => $response],
|
||||
@ -360,7 +363,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
||||
|
||||
$description = collect($invoice->line_items)->map(function ($item){
|
||||
$description = collect($invoice->line_items)->map(function ($item) {
|
||||
return $item->notes;
|
||||
})->implode("\n");
|
||||
|
||||
@ -405,7 +408,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
];
|
||||
|
||||
|
||||
if($shipping = $this->getShippingAddress()){
|
||||
if($shipping = $this->getShippingAddress()) {
|
||||
$order['purchase_units'][0] = $shipping;
|
||||
}
|
||||
|
||||
@ -417,9 +420,9 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
private function getBillingAddress(): array
|
||||
private function getBillingAddress(): array
|
||||
{
|
||||
return
|
||||
return
|
||||
[
|
||||
"address_line_1" => $this->client->address1,
|
||||
"address_line_2" => $this->client->address2,
|
||||
@ -432,10 +435,10 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
private function getShippingAddress(): ?array
|
||||
{
|
||||
return $this->company_gateway->require_shipping_address ?
|
||||
return $this->company_gateway->require_shipping_address ?
|
||||
[
|
||||
"shipping" => [
|
||||
"address" =>
|
||||
"address" =>
|
||||
[
|
||||
"address_line_1" => $this->client->shipping_address1,
|
||||
"address_line_2" => $this->client->shipping_address2,
|
||||
@ -481,4 +484,4 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,16 @@
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Expense;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Factory\ExpenseFactory;
|
||||
use App\Jobs\Expense\VendorExpenseNotify;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use App\Models\Expense;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Database\QueryException;
|
||||
use App\Jobs\Expense\VendorExpenseNotify;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* ExpenseRepository.
|
||||
@ -48,8 +48,7 @@ class ExpenseRepository extends BaseRepository
|
||||
|
||||
if(isset($data['payment_date']) && $data['payment_date'] == $expense->payment_date) {
|
||||
//do nothing
|
||||
}
|
||||
elseif(isset($data['payment_date']) && strlen($data['payment_date']) > 1 && $user->company()->notify_vendor_when_paid && ($data['vendor_id'] || $expense->vendor_id)) {
|
||||
} elseif(isset($data['payment_date']) && strlen($data['payment_date']) > 1 && $user->company()->notify_vendor_when_paid && ($data['vendor_id'] || $expense->vendor_id)) {
|
||||
nlog("ping");
|
||||
$this->notify_vendor = true;
|
||||
}
|
||||
@ -62,16 +61,17 @@ class ExpenseRepository extends BaseRepository
|
||||
|
||||
if (empty($expense->number)) {
|
||||
$expense = $this->findAndSaveNumber($expense);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$expense->saveQuietly();
|
||||
}
|
||||
|
||||
if (array_key_exists('documents', $data)) {
|
||||
$this->saveDocuments($data['documents'], $expense);
|
||||
}
|
||||
|
||||
if($this->notify_vendor)
|
||||
if($this->notify_vendor) {
|
||||
VendorExpenseNotify::dispatch($expense, $expense->company->db);
|
||||
}
|
||||
|
||||
return $expense;
|
||||
}
|
||||
@ -188,13 +188,13 @@ class ExpenseRepository extends BaseRepository
|
||||
{
|
||||
$ec = ExpenseCategory::withTrashed()->find($category_id);
|
||||
|
||||
$expenses->when($ec)
|
||||
->each(function ($expense) use($ec){
|
||||
$expenses->when($ec)
|
||||
->each(function ($expense) use ($ec) {
|
||||
|
||||
$expense->category_id = $ec->id;
|
||||
$expense->save();
|
||||
$expense->category_id = $ec->id;
|
||||
$expense->save();
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class VendorRepository extends BaseRepository
|
||||
|
||||
if ($vendor->number == '' || ! $vendor->number) {
|
||||
$vendor->number = $this->getNextVendorNumber($vendor);
|
||||
}
|
||||
}
|
||||
|
||||
$vendor->saveQuietly();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user