1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

PHP CS Fixer

This commit is contained in:
David Bomba 2023-11-26 18:41:42 +11:00
parent 9b4382b451
commit f7340d6114
271 changed files with 3072 additions and 3060 deletions

View File

@ -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;

View File

@ -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++) {

View File

@ -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) {

View File

@ -219,7 +219,7 @@ class BaseRule implements RuleInterface
try {
$this->invoice->saveQuietly();
}catch(\Exception $e) {
} catch(\Exception $e) {
}
}

View File

@ -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
{

View File

@ -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
{

View File

@ -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,109 +34,178 @@ class ClientDecorator extends Decorator implements DecoratorInterface
return '';
}
public function name(Client $client) {
public function name(Client $client)
{
return $client->present()->name();
}
public function number(Client $client) {
public function number(Client $client)
{
return $client->number ?? '';
}
public function user(Client $client) {
public function user(Client $client)
{
return $client->user->present()->name();
}
public function assigned_user(Client $client) {
public function assigned_user(Client $client)
{
return $client->assigned_user ? $client->user->present()->name() : '';
}
public function balance(Client $client) {
public function balance(Client $client)
{
return $client->balance ?? 0;
}
public function paid_to_date(Client $client) {
public function paid_to_date(Client $client)
{
return $client->paid_to_date ?? 0;
}
public function currency_id(Client $client) {
public function currency_id(Client $client)
{
return $client->currency() ? $client->currency()->code : $client->company->currency()->code;
}
public function website(Client $client) {
public function website(Client $client)
{
return $client->website ?? '';
}
public function private_notes(Client $client) {
public function private_notes(Client $client)
{
return $client->private_notes ?? '';
}
public function industry_id(Client $client) {
public function industry_id(Client $client)
{
return $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
}
public function size_id(Client $client) {
public function size_id(Client $client)
{
return $client->size ? ctrans("texts.size_{$client->size->name}") : '';
}
public function phone(Client $client) {
public function phone(Client $client)
{
return $client->phone ?? '';
}
public function address1(Client $client) {
public function address1(Client $client)
{
return $client->address1 ?? '';
}
public function address2(Client $client) {
public function address2(Client $client)
{
return $client->address2 ?? '';
}
public function city(Client $client) {
public function city(Client $client)
{
return $client->city ?? '';
}
public function state(Client $client) {
public function state(Client $client)
{
return $client->state ?? '';
}
public function postal_code(Client $client) {
public function postal_code(Client $client)
{
return $client->postal_code ?? '';
}
public function country_id(Client $client) {
public function country_id(Client $client)
{
return $client->country ? ctrans("texts.country_{$client->country->name}") : '';
}
public function shipping_address1(Client $client) {
public function shipping_address1(Client $client)
{
return $client->shipping_address1 ?? '';
}
public function shipping_address2(Client $client) {
public function shipping_address2(Client $client)
{
return $client->shipping_address2 ?? '';
}
public function shipping_city(Client $client) {
public function shipping_city(Client $client)
{
return $client->shipping_city ?? '';
}
public function shipping_state(Client $client) {
public function shipping_state(Client $client)
{
return $client->shipping_state ?? '';
}
public function shipping_postal_code(Client $client) {
public function shipping_postal_code(Client $client)
{
return $client->shipping_postal_code ?? '';
}
public function shipping_country_id(Client $client) {
public function shipping_country_id(Client $client)
{
return $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
}
public function payment_terms(Client $client) {
public function payment_terms(Client $client)
{
return $client?->settings?->payment_terms ?? $client->company->settings->payment_terms;
}
public function vat_number(Client $client) {
public function vat_number(Client $client)
{
return $client->vat_number ?? '';
}
public function id_number(Client $client) {
public function id_number(Client $client)
{
return $client->id_number ?? '';
}
public function public_notes(Client $client) {
public function public_notes(Client $client)
{
return $client->public_notes ?? '';
}
public function custom_value1(Client $client) {
public function custom_value1(Client $client)
{
return $client->custom_value1 ?? '';
}
public function custom_value2(Client $client) {
public function custom_value2(Client $client)
{
return $client->custom_value2 ?? '';
}
public function custom_value3(Client $client) {
public function custom_value3(Client $client)
{
return $client->custom_value3 ?? '';
}
public function custom_value4(Client $client) {
public function custom_value4(Client $client)
{
return $client->custom_value4 ?? '';
}
public function payment_balance(Client $client) {
public function payment_balance(Client $client)
{
return $client->payment_balance ?? 0;
}
public function credit_balance(Client $client) {
public function credit_balance(Client $client)
{
return $client->credit_balance ?? 0;
}
public function classification(Client $client) {
public function classification(Client $client)
{
ctrans("texts.{$client->classification}") ?? '';
}
@ -154,7 +222,4 @@ class ClientDecorator extends Decorator implements DecoratorInterface
return ctrans('texts.active');
}
}

View File

@ -33,28 +33,36 @@ class ContactDecorator implements DecoratorInterface
}
public function phone(ClientContact $contact) {
public function phone(ClientContact $contact)
{
return $contact->phone ?? '';
}
public function first_name(ClientContact $contact) {
public function first_name(ClientContact $contact)
{
return $contact->first_name ?? '';
}
public function last_name(ClientContact $contact) {
public function last_name(ClientContact $contact)
{
return $contact->last_name ?? '';
}
public function email(ClientContact $contact) {
public function email(ClientContact $contact)
{
return $contact->email ?? '';
}
public function custom_value1(ClientContact $contact) {
public function custom_value1(ClientContact $contact)
{
return $contact->custom_value1 ?? '';
}
public function custom_value2(ClientContact $contact) {
public function custom_value2(ClientContact $contact)
{
return $contact->custom_value2 ?? '';
}
public function custom_value3(ClientContact $contact) {
public function custom_value3(ClientContact $contact)
{
return $contact->custom_value3 ?? '';
}
public function custom_value4(ClientContact $contact) {
public function custom_value4(ClientContact $contact)
{
return $contact->custom_value4 ?? '';
}

View File

@ -33,91 +33,120 @@ class CreditDecorator implements DecoratorInterface
}
public function number(Credit $credit ) {
public function number(Credit $credit)
{
return $credit->number ?? '';
}
public function amount(Credit $credit ) {
public function amount(Credit $credit)
{
return $credit->amount ?? 0;
}
public function balance(Credit $credit ) {
public function balance(Credit $credit)
{
return $credit->balance ?? 0;
}
public function paid_to_date(Credit $credit ) {
public function paid_to_date(Credit $credit)
{
return $credit->paid_to_date ?? 0;
}
public function po_number(Credit $credit ) {
public function po_number(Credit $credit)
{
return $credit->po_number ?? '';
}
public function date(Credit $credit ) {
public function date(Credit $credit)
{
return $credit->date ?? '';
}
public function due_date(Credit $credit ) {
public function due_date(Credit $credit)
{
return $credit->due_date ?? '';
}
public function terms(Credit $credit ) {
public function terms(Credit $credit)
{
return $credit->terms ?? '';
}
public function discount(Credit $credit ) {
public function discount(Credit $credit)
{
return $credit->discount ?? 0;
}
public function footer(Credit $credit ) {
public function footer(Credit $credit)
{
return $credit->footer ?? '';
}
public function status(Credit $credit ) {
public function status(Credit $credit)
{
return $credit->stringStatus($credit->status_id);
}
public function public_notes(Credit $credit ) {
public function public_notes(Credit $credit)
{
return $credit->public_notes ?? '';
}
public function private_notes(Credit $credit ) {
public function private_notes(Credit $credit)
{
return $credit->private_notes ?? '';
}
public function uses_inclusive_taxes(Credit $credit ) {
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 ) {
public function is_amount_discount(Credit $credit)
{
return $credit->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
}
public function partial(Credit $credit ) {
public function partial(Credit $credit)
{
return $credit->partial ?? 0;
}
public function partial_due_date(Credit $credit ) {
public function partial_due_date(Credit $credit)
{
return $credit->partial_due_date ?? '';
}
public function custom_surcharge1(Credit $credit ) {
public function custom_surcharge1(Credit $credit)
{
return $credit->custom_surcharge1 ?? 0;
}
public function custom_surcharge2(Credit $credit ) {
public function custom_surcharge2(Credit $credit)
{
return $credit->custom_surcharge2 ?? 0;
}
public function custom_surcharge3(Credit $credit ) {
public function custom_surcharge3(Credit $credit)
{
return $credit->custom_surcharge3 ?? 0;
}
public function custom_surcharge4(Credit $credit ) {
public function custom_surcharge4(Credit $credit)
{
return $credit->custom_surcharge4 ?? 0;
}
public function custom_value1(Credit $credit ) {
public function custom_value1(Credit $credit)
{
return $credit->custom_value1 ?? '';
}
public function custom_value2(Credit $credit ) {
public function custom_value2(Credit $credit)
{
return $credit->custom_value2 ?? '';
}
public function custom_value3(Credit $credit ) {
public function custom_value3(Credit $credit)
{
return $credit->custom_value3 ?? '';
}
public function custom_value4(Credit $credit ) {
public function custom_value4(Credit $credit)
{
return $credit->custom_value4 ?? '';
}
public function exchange_rate(Credit $credit ) {
public function exchange_rate(Credit $credit)
{
return $credit->exchange_rate ?? 0;
}
public function total_taxes(Credit $credit ) {
public function total_taxes(Credit $credit)
{
return $credit->total_taxes ?? 0;
}
public function assigned_user_id(Credit $credit ) {
public function assigned_user_id(Credit $credit)
{
return $credit->assigned_user ? $credit->assigned_user->present()->name(): '';
}
public function user_id(Credit $credit ) {
public function user_id(Credit $credit)
{
return $credit->user ? $credit->user->present()->name(): '';
}

View File

@ -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()
{

View File

@ -11,6 +11,7 @@
namespace App\Export\Decorators;
interface DecoratorInterface {
interface DecoratorInterface
{
public function transform(string $key, mixed $entity): mixed;
}

View File

@ -33,100 +33,132 @@ class ExpenseDecorator implements DecoratorInterface
}
public function amount(Expense $expense) {
public function amount(Expense $expense)
{
return $expense->amount ?? 0;
}
public function category_id(Expense $expense) {
public function category_id(Expense $expense)
{
return $expense->category ? $expense->category->name : '';
}
public function client_id(Expense $expense) {
public function client_id(Expense $expense)
{
return $expense->client ? $expense->client->present()->name() : '';
}
public function custom_value1(Expense $expense) {
public function custom_value1(Expense $expense)
{
return $expense->custom_value1 ?? '';
}
public function custom_value2(Expense $expense) {
public function custom_value2(Expense $expense)
{
return $expense->custom_value2 ?? '';
}
public function custom_value3(Expense $expense) {
public function custom_value3(Expense $expense)
{
return $expense->custom_value3 ?? '';
}
public function custom_value4(Expense $expense) {
public function custom_value4(Expense $expense)
{
return $expense->custom_value4 ?? '';
}
public function currency_id(Expense $expense) {
public function currency_id(Expense $expense)
{
return $expense->currency ? $expense->currency->code : $expense->company->currency()->code;
}
public function date(Expense $expense) {
public function date(Expense $expense)
{
return $expense->date ?? '';
}
public function exchange_rate(Expense $expense) {
public function exchange_rate(Expense $expense)
{
return $expense->exchange_rate ?? 0;
}
public function foreign_amount(Expense $expense) {
public function foreign_amount(Expense $expense)
{
return $expense->foreign_amount ?? 0;
}
public function invoice_currency_id(Expense $expense) {
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) {
public function payment_date(Expense $expense)
{
return $expense->payment_date ?? '';
}
public function number(Expense $expense) {
public function number(Expense $expense)
{
return $expense->number ?? '';
}
public function payment_type_id(Expense $expense) {
public function payment_type_id(Expense $expense)
{
return $expense->payment_type ? $expense->payment_type->name : '';
}
public function private_notes(Expense $expense) {
public function private_notes(Expense $expense)
{
return $expense->private_notes ?? '';
}
public function project_id(Expense $expense) {
public function project_id(Expense $expense)
{
return $expense->project ? $expense->project->name : '';
}
public function public_notes(Expense $expense) {
public function public_notes(Expense $expense)
{
return $expense->public_notes ?? '';
}
public function tax_amount1(Expense $expense) {
public function tax_amount1(Expense $expense)
{
return $expense->tax_amount1 ?? 0;
}
public function tax_amount2(Expense $expense) {
public function tax_amount2(Expense $expense)
{
return $expense->tax_amount2 ?? 0;
}
public function tax_amount3(Expense $expense) {
public function tax_amount3(Expense $expense)
{
return $expense->tax_amount3 ?? 0;
}
public function tax_name1(Expense $expense) {
public function tax_name1(Expense $expense)
{
return $expense->tax_name1 ?? '';
}
public function tax_name2(Expense $expense) {
public function tax_name2(Expense $expense)
{
return $expense->tax_name2 ?? '';
}
public function tax_name3(Expense $expense) {
public function tax_name3(Expense $expense)
{
return $expense->tax_name3 ?? '';
}
public function tax_rate1(Expense $expense) {
public function tax_rate1(Expense $expense)
{
return $expense->tax_rate1 ?? 0;
}
public function tax_rate2(Expense $expense) {
public function tax_rate2(Expense $expense)
{
return $expense->tax_rate2 ?? 0;
}
public function tax_rate3(Expense $expense) {
public function tax_rate3(Expense $expense)
{
return $expense->tax_rate3 ?? 0;
}
public function transaction_reference(Expense $expense) {
public function transaction_reference(Expense $expense)
{
return $expense->transaction_reference ?? '';
}
public function vendor_id(Expense $expense) {
public function vendor_id(Expense $expense)
{
return $expense->vendor ? $expense->vendor->name : '';
}
public function invoice_id(Expense $expense) {
public function invoice_id(Expense $expense)
{
return $expense->invoice ? $expense->invoice->number : '';
}
public function user(Expense $expense) {
public function user(Expense $expense)
{
return $expense->user ? $expense->user->present()->name() : '';
}
public function assigned_user(Expense $expense) {
public function assigned_user(Expense $expense)
{
return $expense->assigned_user ? $expense->assigned_user->present()->name() : '';
}

View File

@ -33,119 +33,153 @@ class InvoiceDecorator extends Decorator implements DecoratorInterface
}
public function number(Invoice $invoice) {
public function number(Invoice $invoice)
{
return $invoice->number ?? '';
}
public function amount(Invoice $invoice) {
public function amount(Invoice $invoice)
{
return $invoice->amount ?? 0;
}
public function balance(Invoice $invoice) {
public function balance(Invoice $invoice)
{
return $invoice->balance ?? 0;
}
public function paid_to_date(Invoice $invoice) {
public function paid_to_date(Invoice $invoice)
{
return $invoice->paid_to_date ?? 0;
}
public function po_number(Invoice $invoice) {
public function po_number(Invoice $invoice)
{
return $invoice->po_number ?? '';
}
public function date(Invoice $invoice) {
public function date(Invoice $invoice)
{
return $invoice->date ?? '';
}
public function due_date(Invoice $invoice) {
public function due_date(Invoice $invoice)
{
return $invoice->due_date ?? '';
}
public function terms(Invoice $invoice) {
public function terms(Invoice $invoice)
{
return $invoice->terms ?? '';
}
public function footer(Invoice $invoice) {
public function footer(Invoice $invoice)
{
return $invoice->footer ?? '';
}
public function status(Invoice $invoice) {
public function status(Invoice $invoice)
{
return $invoice->stringStatus($invoice->status_id);
}
public function public_notes(Invoice $invoice) {
public function public_notes(Invoice $invoice)
{
return $invoice->public_notes ?? '';
}
public function private_notes(Invoice $invoice) {
public function private_notes(Invoice $invoice)
{
return $invoice->private_notes ?? '';
}
public function uses_inclusive_taxes(Invoice $invoice) {
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) {
public function is_amount_discount(Invoice $invoice)
{
return $invoice->is_amount_discount ? ctrans('texts.yes') : ctrans('texts.no');
}
public function discount(Invoice $invoice) {
public function discount(Invoice $invoice)
{
return $invoice->discount ?? 0;
}
public function partial(Invoice $invoice) {
public function partial(Invoice $invoice)
{
return $invoice->partial ?? 0;
}
public function partial_due_date(Invoice $invoice) {
public function partial_due_date(Invoice $invoice)
{
return $invoice->partial_due_date ?? '';
}
public function custom_surcharge1(Invoice $invoice) {
public function custom_surcharge1(Invoice $invoice)
{
return $invoice->custom_surcharge1 ?? 0;
}
public function custom_surcharge2(Invoice $invoice) {
public function custom_surcharge2(Invoice $invoice)
{
return $invoice->custom_surcharge2 ?? 0;
}
public function custom_surcharge3(Invoice $invoice) {
public function custom_surcharge3(Invoice $invoice)
{
return $invoice->custom_surcharge3 ?? 0;
}
public function custom_surcharge4(Invoice $invoice) {
public function custom_surcharge4(Invoice $invoice)
{
return $invoice->custom_surcharge4 ?? 0;
}
public function exchange_rate(Invoice $invoice) {
public function exchange_rate(Invoice $invoice)
{
return $invoice->exchange_rate ?? 0;
}
public function total_taxes(Invoice $invoice) {
public function total_taxes(Invoice $invoice)
{
return $invoice->total_taxes ?? 0;
}
public function assigned_user_id(Invoice $invoice) {
public function assigned_user_id(Invoice $invoice)
{
return $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
}
public function user_id(Invoice $invoice) {
public function user_id(Invoice $invoice)
{
return $invoice->user ? $invoice->user->present()->name(): '';
}
public function custom_value1(Invoice $invoice) {
public function custom_value1(Invoice $invoice)
{
return $invoice->custom_value1 ?? '';
}
public function custom_value2(Invoice $invoice) {
public function custom_value2(Invoice $invoice)
{
return $invoice->custom_value2 ?? '';
}
public function custom_value3(Invoice $invoice) {
public function custom_value3(Invoice $invoice)
{
return $invoice->custom_value3 ?? '';
}
public function custom_value4(Invoice $invoice) {
public function custom_value4(Invoice $invoice)
{
return $invoice->custom_value4 ?? '';
}
public function tax_name1(Invoice $invoice) {
public function tax_name1(Invoice $invoice)
{
return $invoice->tax_name1 ?? '';
}
public function tax_name2(Invoice $invoice) {
public function tax_name2(Invoice $invoice)
{
return $invoice->tax_name2 ?? '';
}
public function tax_name3(Invoice $invoice) {
public function tax_name3(Invoice $invoice)
{
return $invoice->tax_name3 ?? '';
}
public function tax_rate1(Invoice $invoice) {
public function tax_rate1(Invoice $invoice)
{
return $invoice->tax_rate1 ?? 0;
}
public function tax_rate2(Invoice $invoice) {
public function tax_rate2(Invoice $invoice)
{
return $invoice->tax_rate2 ?? 0;
}
public function tax_rate3(Invoice $invoice) {
public function tax_rate3(Invoice $invoice)
{
return $invoice->tax_rate3 ?? 0;
}
public function recurring_id(Invoice $invoice) {
public function recurring_id(Invoice $invoice)
{
return $invoice->recurring_invoice ? $invoice->recurring_invoice->number : '';
}
public function auto_bill_enabled(Invoice $invoice) {
public function auto_bill_enabled(Invoice $invoice)
{
return $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
}
}

View File

@ -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,95 +45,118 @@ 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();
}

View File

@ -27,9 +27,9 @@ class ProductDecorator implements DecoratorInterface
if($product && method_exists($this, $key)) {
return $this->{$key}($product);
}
elseif($product->{$key})
} elseif($product->{$key}) {
return $product->{$key} ?? '';
}
return '';
@ -46,11 +46,12 @@ class ProductDecorator implements DecoratorInterface
public const PRODUCT_TYPE_ZERO_RATED = 8;
public const PRODUCT_TYPE_REVERSE_TAX = 9;
*/
public function tax_category(Product $product) {
public function tax_category(Product $product)
{
$category = ctrans('texts.physical_goods');
match($product->tax_id){
match($product->tax_id) {
1 => $category = ctrans('texts.physical_goods'),
2 => $category = ctrans('texts.services'),
3 => $category = ctrans('texts.digital_products'),
@ -67,6 +68,3 @@ class ProductDecorator implements DecoratorInterface
}
}

View File

@ -27,19 +27,21 @@ class PurchaseOrderDecorator extends Decorator implements DecoratorInterface
if($purchase_order && method_exists($this, $key)) {
return $this->{$key}($purchase_order);
}
elseif($purchase_order->{$key})
} elseif($purchase_order->{$key}) {
return $purchase_order->{$key} ?? '';
}
return '';
}
public function status(PurchaseOrder $purchase_order) {
public function status(PurchaseOrder $purchase_order)
{
return $purchase_order->stringStatus($purchase_order->status_id);
}
public function currency_id(PurchaseOrder $purchase_order) {
public function currency_id(PurchaseOrder $purchase_order)
{
return $purchase_order->currency ? $purchase_order->currency->code : $purchase_order->company->currency()->code;
}

View File

@ -35,21 +35,29 @@ class QuoteDecorator extends Decorator implements DecoratorInterface
}
public function status(Quote $quote) {
public function status(Quote $quote)
{
return $quote->stringStatus($quote->status_id);
}
public function uses_inclusive_taxes(Quote $quote) {
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) {
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) {
public function assigned_user_id(Quote $quote)
{
return $quote->assigned_user ? $quote->assigned_user->present()->name() : '';
}
public function user_id(Quote $quote) {
public function user_id(Quote $quote)
{
return $quote->user->present()->name();
}
}

View File

@ -35,28 +35,43 @@ class RecurringInvoiceDecorator extends Decorator implements DecoratorInterface
}
public function status(RecurringInvoice $recurring_invoice) {
public function status(RecurringInvoice $recurring_invoice)
{
return $recurring_invoice->stringStatus($recurring_invoice->status_id);
}
public function uses_inclusive_taxes(RecurringInvoice $recurring_invoice) {
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) {
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) {
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) {
public function user_id(RecurringInvoice $recurring_invoice)
{
return $recurring_invoice->user->present()->name() ?? '';
}
public function frequency_id(RecurringInvoice $recurring_invoice) {
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) {
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) {
public function auto_bill_enabled(RecurringInvoice $recurring_invoice)
{
return $recurring_invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
}

View File

@ -11,10 +11,10 @@
namespace App\Export\Decorators;
use Carbon\Carbon;
use App\Models\DateFormat;
use App\Models\Task;
use App\Models\Timezone;
use App\Models\DateFormat;
use Carbon\Carbon;
class TaskDecorator extends Decorator implements DecoratorInterface
{
@ -38,7 +38,8 @@ class TaskDecorator extends Decorator implements DecoratorInterface
}
public function start_date(Task $task){
public function start_date(Task $task)
{
$timezone = Timezone::find($task->company->settings->timezone_id);
$timezone_name = 'US/Eastern';
@ -57,7 +58,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
$date_format_default = $date_format->format;
}
if(is_array($logs)){
if(is_array($logs)) {
$item = $logs[0];
return Carbon::createFromTimeStamp($item[0])->setTimezone($timezone_name)->format($date_format_default);
}
@ -66,7 +67,8 @@ class TaskDecorator extends Decorator implements DecoratorInterface
}
public function end_date(Task $task){
public function end_date(Task $task)
{
$timezone = Timezone::find($task->company->settings->timezone_id);
$timezone_name = 'US/Eastern';
@ -93,13 +95,18 @@ class TaskDecorator extends Decorator implements DecoratorInterface
return '';
}
public function duration(Task $task){
public function duration(Task $task)
{
return $task->calcDuration();
}
public function status_id(Task $task){
public function status_id(Task $task)
{
return $task->status()->exists() ? $task->status->name : '';
}
public function project_id(Task $task){
public function project_id(Task $task)
{
return $task->project()->exists() ? $task->project->name : '';
}

View File

@ -27,9 +27,9 @@ class VendorContactDecorator implements DecoratorInterface
if($contact && method_exists($this, $key)) {
return $this->{$key}($contact);
}
elseif($contact->{$key})
} elseif($contact->{$key}) {
return $contact->{$key} ?? '';
}
return '';

View File

@ -35,16 +35,23 @@ class VendorDecorator extends Decorator implements DecoratorInterface
}
public function country_id(Vendor $vendor){
public function country_id(Vendor $vendor)
{
return $vendor->country ? $vendor->country->name : '';
}
public function name(Vendor $vendor){
public function name(Vendor $vendor)
{
return $vendor->present()->name();
}
public function currency(Vendor $vendor){
public function currency(Vendor $vendor)
{
return $vendor->currency_id ? $vendor->currency()->code : $vendor->company->currency()->code;
}
public function classification(Vendor $vendor) {
public function classification(Vendor $vendor)
{
ctrans("texts.{$vendor->classification}") ?? '';
}

View File

@ -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
{

View File

@ -107,10 +107,10 @@ class CreditFilters extends QueryFilters
return $this->builder;
}
return $this->builder->where(function ($query){
return $this->builder->where(function ($query) {
$query->whereIn('status_id', [Credit::STATUS_SENT, Credit::STATUS_PARTIAL])
->where('balance', '>', 0)
->where(function ($q){
->where(function ($q) {
$q->whereNull('due_date')->orWhere('due_date', '>', now());
});
});

View File

@ -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);
}

View File

@ -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.
@ -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

View File

@ -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

View File

@ -206,11 +206,11 @@ class CompanyGatewayController extends BaseController
$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;
$company_gateway->save();

View File

@ -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.

View File

@ -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);
}
}

View File

@ -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.

View File

@ -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']);
}

View File

@ -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,

View File

@ -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
{

View File

@ -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
{

View File

@ -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.

View File

@ -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
{

View File

@ -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);

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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.

View File

@ -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
{

View File

@ -69,7 +69,7 @@ class Locale
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()) {

View File

@ -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()) {

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -12,7 +12,6 @@
namespace App\Http\Requests\Invoice;
use App\Http\Requests\Request;
use App\Models\Payment;
class BulkInvoiceRequest extends Request
{

View File

@ -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);

View File

@ -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
{

View File

@ -56,8 +56,9 @@ class StoreTaskRequest extends Request
$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 +120,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([]);
}

View File

@ -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)

View File

@ -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)
if($ts) {
return $ts->id;
}
}
return TaskStatus::where('company_id', $this->company->id)
->where('is_deleted', false)

View File

@ -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;
@ -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;
@ -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);

View File

@ -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;

View File

@ -79,7 +79,7 @@ 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) {

View File

@ -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';

View File

@ -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,9 @@ class VendorExpenseNotify implements ShouldQueue
{
MultiDB::setDB($this->db);
$this->expense->vendor->contacts->filter(function(VendorContact $contact){
$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);
});
}

View File

@ -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,8 +51,9 @@ class UpdateLedger implements ShouldQueue
nlog($cl->company_ledgerable->company_ledger()->count());
if(!$cl)
if(!$cl) {
return;
}
$entity = $cl->company_ledgerable;
$balance = $entity->calc()->getBalance();

View File

@ -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;

View File

@ -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);

View File

@ -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
{

View File

@ -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);

View File

@ -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'];
}
}

View File

@ -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
{
@ -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,7 +104,7 @@ 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;

View File

@ -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

View File

@ -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;
}

View File

@ -11,18 +11,10 @@
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
{

View File

@ -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
{

View File

@ -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

View File

@ -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;

View File

@ -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';

View File

@ -164,11 +164,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 '';
@ -256,17 +258,19 @@ class Task extends BaseModel
{
return
collect(json_decode($this->time_log,true))->map(function ($log){
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();
@ -277,27 +281,26 @@ class Task extends BaseModel
{
return
collect(json_decode($this->time_log,true))->map(function ($log){
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');
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');
}

View File

@ -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))) {
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;
}
/**

View File

@ -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
@ -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,
@ -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;
}

View File

@ -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;
}
@ -189,7 +189,7 @@ class ExpenseRepository extends BaseRepository
$ec = ExpenseCategory::withTrashed()->find($category_id);
$expenses->when($ec)
->each(function ($expense) use($ec){
->each(function ($expense) use ($ec) {
$expense->category_id = $ec->id;
$expense->save();

View File

@ -11,17 +11,16 @@
namespace App\Services\Client;
use Carbon\Carbon;
use App\Utils\Number;
use App\Models\Client;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\Payment;
use App\Services\Email\Email;
use App\Utils\Traits\MakesDates;
use Illuminate\Support\Facades\DB;
use App\Services\Email\EmailObject;
use App\Utils\Number;
use App\Utils\Traits\MakesDates;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Support\Facades\DB;
class ClientService
{

View File

@ -434,12 +434,11 @@ class Statement
->where('balance', '>', 0)
->where('is_deleted', 0);
if($range == '0'){
$query->where(function ($q) use($to, $from){
if($range == '0') {
$query->where(function ($q) use ($to, $from) {
$q->whereBetween('due_date', [$to, $from])->orWhereNull('due_date');
});
}
else {
} else {
$query->whereBetween('due_date', [$to, $from]);
}

View File

@ -11,11 +11,12 @@
namespace App\Services\Company;
use App\Models\User;
use App\Models\Company;
use App\Factory\TaxRateFactory;
use App\Models\Company;
use App\Models\User;
class CompanyService{
class CompanyService
{
public function __construct(public Company $company)
{
@ -67,7 +68,7 @@ class CompanyService{
$tax_rate->save();
}
}catch(\Exception $e){
} catch(\Exception $e) {
nlog($e->getMessage());
}

View File

@ -293,7 +293,7 @@ class EmailDefaults
}
/** Purchase Order / Invoice / Credit / Quote PDF */
if ($this->email->email_object->settings->pdf_email_attachment){
if ($this->email->email_object->settings->pdf_email_attachment) {
$pdf = ((new CreateRawPdf($this->email->email_object->invitation))->handle());
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
}

View File

@ -74,7 +74,7 @@ class HandleCancellation extends AbstractService
$this->invoice->client->service()->updateBalance($adjustment)->save();
$this->invoice->client->service()->calculateBalance();
$this->invoice->client->service()->calculateBalance();
/* Pop the cancellation out of the backup*/

View File

@ -11,11 +11,10 @@
namespace App\Services\Ledger;
use App\Models\Activity;
use App\Models\CompanyLedger;
use App\Jobs\Ledger\UpdateLedger;
use App\Factory\CompanyLedgerFactory;
use App\Jobs\Ledger\ClientLedgerBalanceUpdate;
use App\Models\Activity;
use App\Models\CompanyLedger;
class LedgerService
{
@ -45,8 +44,9 @@ class LedgerService
public function updateInvoiceBalance($adjustment, $notes = '')
{
if($adjustment == 0)
if($adjustment == 0) {
return $this;
}
// $timestamp = \Carbon\Carbon::createFromTimestamp($this->entity->updated_at)->format('ymdhhmmssSS');
// $hash = sha1($adjustment.$notes.$this->entity->status_id.$this->entity->client_id.$this->entity->amount.$this->entity->balance.$this->entity->company_id.Activity::UPDATE_INVOICE);

View File

@ -11,20 +11,20 @@
namespace App\Services\Pdf;
use App\Models\Company;
use App\Models\Invoice;
use App\Utils\HtmlEngine;
use App\Models\QuoteInvitation;
use App\Utils\VendorHtmlEngine;
use App\Models\CreditInvitation;
use App\Utils\PhantomJS\Phantom;
use App\Models\InvoiceInvitation;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\Traits\Pdf\PdfMaker;
use App\Jobs\Invoice\CreateEInvoice;
use App\Models\Company;
use App\Models\CreditInvitation;
use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Models\PurchaseOrderInvitation;
use App\Utils\Traits\Pdf\PageNumbering;
use App\Models\QuoteInvitation;
use App\Models\RecurringInvoiceInvitation;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\HtmlEngine;
use App\Utils\PhantomJS\Phantom;
use App\Utils\Traits\Pdf\PageNumbering;
use App\Utils\Traits\Pdf\PdfMaker;
use App\Utils\VendorHtmlEngine;
use horstoeko\zugferd\ZugferdDocumentPdfBuilder;
class PdfService
@ -179,8 +179,9 @@ class PdfService
*/
private function checkEInvoice(string $pdf): string
{
if(!$this->config->entity instanceof Invoice)
if(!$this->config->entity instanceof Invoice) {
return $pdf;
}
$e_invoice_type = $this->config->settings->e_invoice_type;

View File

@ -85,8 +85,9 @@ class TaxSummaryReport extends BaseExport
$this->csv->insertOne([ctrans('texts.tax_summary')]);
$this->csv->insertOne([ctrans('texts.created_on'),' ',$this->translateDate(now()->format('Y-m-d'), $this->company->date_format(), $this->company->locale())]);
if($this->input['date_range'] != 'all')
if($this->input['date_range'] != 'all') {
$this->csv->insertOne([ctrans('texts.date_range'),' ',$this->translateDate($this->start_date, $this->company->date_format(), $this->company->locale()),' - ',$this->translateDate($this->end_date, $this->company->date_format(), $this->company->locale())]);
}

View File

@ -11,32 +11,32 @@
namespace App\Services\Template;
use App\Models\User;
use App\Models\Quote;
use App\Utils\Number;
use Twig\Error\Error;
use App\Models\Client;
use App\Models\Company;
use App\Models\Credit;
use App\Models\Design;
use App\Models\Vendor;
use App\Models\Company;
use App\Models\Invoice;
use App\Models\Payment;
use App\Models\Project;
use App\Utils\HtmlEngine;
use Twig\Error\LoaderError;
use Twig\Error\SyntaxError;
use Twig\Error\RuntimeError;
use App\Models\PurchaseOrder;
use App\Utils\VendorHtmlEngine;
use Twig\Sandbox\SecurityError;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Models\User;
use App\Models\Vendor;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\HtmlEngine;
use App\Utils\Number;
use App\Utils\PaymentHtmlEngine;
use App\Utils\Traits\MakesDates;
use App\Utils\HostedPDF\NinjaPdf;
use App\Utils\Traits\Pdf\PdfMaker;
use Twig\Extra\Intl\IntlExtension;
use App\Utils\VendorHtmlEngine;
use League\CommonMark\CommonMarkConverter;
use Twig\Error\Error;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
use Twig\Extra\Intl\IntlExtension;
use Twig\Sandbox\SecurityError;
class TemplateService
{
@ -104,8 +104,9 @@ class TemplateService
$filter = new \Twig\TwigFilter('sum', function (?array $array, ?string $column) {
if(!is_array($array))
if(!is_array($array)) {
return 0;
}
return array_sum(array_column($array, $column));
});

View File

@ -32,9 +32,9 @@ return [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY',''),
'secret' => env('PUSHER_APP_SECRET',''),
'app_id' => env('PUSHER_APP_ID',''),
'key' => env('PUSHER_APP_KEY', ''),
'secret' => env('PUSHER_APP_SECRET', ''),
'app_id' => env('PUSHER_APP_ID', ''),
'options' => [
'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
'port' => env('PUSHER_PORT', 443),

View File

@ -1,19 +1,19 @@
<?php
use Imdhemy\Purchases\Events\AppStore\Refund;
use Imdhemy\Purchases\Events\AppStore\DidRenew;
use Imdhemy\Purchases\Events\AppStore\DidFailToRenew;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPaused;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionExpired;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRevoked;
use Imdhemy\Purchases\Events\AppStore\DidChangeRenewalStatus;
use Imdhemy\Purchases\Events\AppStore\DidFailToRenew;
use Imdhemy\Purchases\Events\AppStore\DidRenew;
use Imdhemy\Purchases\Events\AppStore\InitialBuy;
use Imdhemy\Purchases\Events\AppStore\InteractiveRenewal;
use Imdhemy\Purchases\Events\AppStore\Refund;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionCanceled;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionExpired;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPaused;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPurchased;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRecovered;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRestarted;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRevoked;
return [
/*

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION','5.7.54'),
'app_tag' => env('APP_TAG','5.7.54'),
'app_version' => env('APP_VERSION', '5.7.54'),
'app_tag' => env('APP_TAG', '5.7.54'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),
@ -197,7 +197,7 @@ return [
'ninja_default_company_gateway_id' => env('NINJA_COMPANY_GATEWAY_ID', null),
'ninja_hosted_secret' => env('NINJA_HOSTED_SECRET', ''),
'ninja_hosted_header' =>env('NINJA_HEADER', ''),
'ninja_connect_secret' => env('NINJA_CONNECT_SECRET',''),
'ninja_connect_secret' => env('NINJA_CONNECT_SECRET', ''),
'internal_queue_enabled' => env('INTERNAL_QUEUE_ENABLED', true),
'ninja_apple_api_key' => env('APPLE_API_KEY', false),
'ninja_apple_private_key' => env('APPLE_PRIVATE_KEY', false),
@ -218,7 +218,7 @@ return [
'dev_mode' => env("YODLEE_DEV_MODE", false),
'config_name' => env("YODLEE_CONFIG_NAME", false),
],
'licenses' => env('LICENSES',false),
'licenses' => env('LICENSES', false),
'google_application_credentials' => env("GOOGLE_APPLICATION_CREDENTIALS", false),
'shopify' => [
'client_id' => env('SHOPIFY_CLIENT_ID', null),

View File

@ -11,9 +11,9 @@
namespace Database\Factories;
use App\Utils\Traits\MakesHash;
use App\DataMapper\Tax\TaxModel;
use App\DataMapper\CompanySettings;
use App\DataMapper\Tax\TaxModel;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Factories\Factory;
class CompanyFactory extends Factory

View File

@ -37,8 +37,8 @@ class InvoiceFactory extends Factory
//'tax_rate3' => 5,
'custom_value1' => $this->faker->date(),
'custom_value2' => rand(0, 1) ? 'yes' : 'no',
'custom_value3' => $this->faker->numberBetween(1,4),
'custom_value4' => $this->faker->numberBetween(1,4),
'custom_value3' => $this->faker->numberBetween(1, 4),
'custom_value4' => $this->faker->numberBetween(1, 4),
'is_deleted' => false,
'po_number' => $this->faker->text(10),
'date' => $this->faker->date(),

View File

@ -11,8 +11,8 @@
namespace Database\Factories;
use App\Models\Quote;
use App\Factory\InvoiceItemFactory;
use App\Models\Quote;
use Illuminate\Database\Eloquent\Factories\Factory;
class QuoteFactory extends Factory

View File

@ -3,8 +3,6 @@
use App\Models\GatewayType;
use App\Models\PaymentType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
@ -16,8 +14,7 @@ return new class extends Migration {
{
$pt = PaymentType::find(49);
if(!$pt)
{
if(!$pt) {
$type = new PaymentType();
$type->id = 49;
$type->name = 'BACS';
@ -27,8 +24,7 @@ return new class extends Migration {
$gt = GatewayType::find(24);
if(!$gt)
{
if(!$gt) {
$type = new GatewayType();
$type->id = 24;
$type->alias = 'bacs';

View File

@ -1,11 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*

View File

@ -2,12 +2,9 @@
use App\DataMapper\ClientRegistrationFields;
use App\Models\Company;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -15,7 +12,7 @@ return new class extends Migration
*/
public function up()
{
Company::query()->cursor()->each(function ($company){
Company::query()->cursor()->each(function ($company) {
$crfs = $company->client_registration_fields;
@ -23,8 +20,7 @@ return new class extends Migration
$crfs = ClientRegistrationFields::generate();
}
foreach($crfs as $key => $crf)
{
foreach($crfs as $key => $crf) {
$crfs[$key]['visible'] = $crfs[$key]['required'];
}

View File

@ -1,12 +1,11 @@
<?php
use App\Models\Company;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*
@ -25,8 +24,9 @@ return new class extends Migration
$settings = $company->settings;
if(!property_exists($settings, 'show_task_item_description'))
if(!property_exists($settings, 'show_task_item_description')) {
$company->saveSettings((array)$company->settings, $company);
}
});

Some files were not shown because too many files have changed in this diff Show More