1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00

Merge pull request #9640 from turbo124/v5-develop

v5.9.6
This commit is contained in:
David Bomba 2024-06-16 08:31:35 +10:00 committed by GitHub
commit b4ab9a2e1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
380 changed files with 2868 additions and 2135 deletions

View File

@ -1 +1 @@
5.9.5
5.9.6

View File

@ -172,18 +172,18 @@ class CheckData extends Command
CompanyUser::query()->cursor()->each(function ($cu) {
if (CompanyToken::where('user_id', $cu->user_id)->where('company_id', $cu->company_id)->where('is_system', 1)->doesntExist()) {
if ($cu->company && $cu->user) {
$this->logMessage("Creating missing company token for user # {$cu->user_id} for company id # {$cu->company_id}");
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
}
}
if (!$cu->user) {
$this->logMessage("No user found for company user - removing company user");
$cu->forceDelete();
}
}
});
}
@ -477,14 +477,13 @@ class CheckData extends Command
}
} else {
$this->logMessage("No contact present, so cannot add invitation for {$entity_key} - {$entity->id}");
try{
try {
$entity->service()->createInvitations()->save();
}
catch(\Exception $e){
} catch(\Exception $e) {
}
}
try {
@ -949,12 +948,12 @@ class CheckData extends Command
});
Company::whereDoesntHave('company_users', function ($query){
$query->where('is_owner', 1);
Company::whereDoesntHave('company_users', function ($query) {
$query->where('is_owner', 1);
})
->cursor()
->when(Ninja::isHosted())
->each(function ($c){
->each(function ($c) {
$this->logMessage("Orphan Account # {$c->account_id}");
@ -963,8 +962,8 @@ class CheckData extends Command
CompanyUser::whereDoesntHave('tokens')
->cursor()
->when(Ninja::isHosted())
->each(function ($cu){
->each(function ($cu) {
$this->logMessage("Missing tokens for Company User # {$cu->id}");
});

View File

@ -1016,7 +1016,7 @@ class CreateSingleAccount extends Command
$cg->fees_and_limits = $fees_and_limits;
$cg->save();
}
if (config('ninja.testvars.eway') && ($this->gateway == 'all' || $this->gateway == 'eway')) {
$cg = new CompanyGateway();
$cg->company_id = $company->id;
@ -1038,12 +1038,12 @@ class CreateSingleAccount extends Command
$cg->save();
}
if (config('ninja.testvars.gocardless') && ($this->gateway == 'all' || $this->gateway == 'gocardless')) {
$c_settings = ClientSettings::defaults();
$c_settings->currency_id = '2';
$client = Client::factory()->create([
'user_id' => $user->id,
'company_id' => $company->id,

View File

@ -48,37 +48,37 @@ class ReactBuilder extends Command
{
if($this->option('type') == 'local') {
$includes = '';
$directoryIterator = false;
$includes = '';
try {
$directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\Exception $e) {
$this->error('React files not found');
return;
}
$directoryIterator = false;
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if ($file->getExtension() == 'js') {
if (str_contains($file->getFileName(), 'index-')) {
$includes .= '<script type="module" crossorigin src="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'"></script>'."\n";
} else {
$includes .= '<link rel="modulepreload" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
try {
$directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
} catch (\Exception $e) {
$this->error('React files not found');
return;
}
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
if ($file->getExtension() == 'js') {
if (str_contains($file->getFileName(), 'index-')) {
$includes .= '<script type="module" crossorigin src="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'"></script>'."\n";
} else {
$includes .= '<link rel="modulepreload" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
}
}
if (str_contains($file->getFileName(), '.css')) {
$includes .= '<link rel="stylesheet" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
}
}
if (str_contains($file->getFileName(), '.css')) {
$includes .= '<link rel="stylesheet" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
}
}
file_put_contents(resource_path('views/react/head.blade.php'), $includes);
file_put_contents(resource_path('views/react/head.blade.php'), $includes);
}
}
}

View File

@ -55,7 +55,7 @@ class DbQuery extends GenericMixedMetric
public $string_metric8 = 'client_version';
public $string_metric9 = 'platform';
/**
* The counter
* set to 1.

View File

@ -0,0 +1,61 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\Analytics;
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
class LoginMeta extends GenericMixedMetric
{
/**
* The type of Sample.
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'mixed_metric';
/**
* The name of the counter.
* @var string
*/
public $name = 'login.meta';
/**
* The datetime of the counter measurement.
*
* date("Y-m-d H:i:s")
*
*/
public $datetime;
/**
* The Class failure name
* set to 0.
*
* @var string
*/
public $string_metric5 = 'email';
public $string_metric6 = 'ip';
public $string_metric7 = 'result';
public $int_metric1 = 1;
public function __construct($string_metric5, $string_metric6, $string_metric7)
{
$this->string_metric7 = $string_metric7;
$this->string_metric6 = $string_metric6;
$this->string_metric5 = $string_metric5;
}
}

View File

@ -64,9 +64,9 @@ class InvoiceItem
public $task_id = '';
public $expense_id = '';
public $unit_code = 'C62';
public static $casts = [
'task_id' => 'string',
'expense_id' => 'string',

View File

@ -15,7 +15,6 @@ use App\DataMapper\InvoiceItem;
class PayPalBalanceAffecting
{
private array $key_map = [
'Date' => 'date',
'Time' => 'time',
@ -105,8 +104,10 @@ class PayPalBalanceAffecting
public $discount;
public $creditTransactionalFee;
public $originalInvoiceId;
public function __construct(private array $import_row){}
public function __construct(private array $import_row)
{
}
public function run(): self
{
@ -116,11 +117,11 @@ class PayPalBalanceAffecting
$prop = $this->key_map[$key] ?? false;
if($prop){
if($prop) {
echo "Setting {$prop} to {$value}".PHP_EOL;
$this->{$prop} = $value;
}
}
@ -130,7 +131,7 @@ class PayPalBalanceAffecting
private function cleanUp(): self
{
foreach($this->key_map as $value){
foreach($this->key_map as $value) {
echo "Setting {$value} to null".PHP_EOL;
$this->{$value} = null;
}
@ -154,7 +155,7 @@ class PayPalBalanceAffecting
public function getInvoice(): array
{
$item = new InvoiceItem;
$item = new InvoiceItem();
$item->cost = $this->gross ?? 0;
$item->product_key = $this->itemId ?? '';
$item->notes = $this->subject ?? $this->itemDetails;
@ -162,7 +163,7 @@ class PayPalBalanceAffecting
return [
'number' => trim($this->invoiceNumber ?? $this->transactionId),
'date' => str_replace('/','-', $this->date ?? ''),
'date' => str_replace('/', '-', $this->date ?? ''),
'line_items' => [$item],
'name' => $this->name ?? '',
'email' => $this->fromEmailAddress ?? '',
@ -174,12 +175,10 @@ class PayPalBalanceAffecting
{
$name_parts = explode(" ", $this->name ?? '');
if(count($name_parts) == 2)
{
if(count($name_parts) == 2) {
$contact['first_name'] = $name_parts[0];
$contact['last_name'] = $name_parts[1];
}
else {
} else {
$contact['first_name'] = $this->name ?? '';
}
@ -188,7 +187,7 @@ class PayPalBalanceAffecting
return $contact;
}
private function returnAddress(): array
{
return [
@ -203,13 +202,15 @@ class PayPalBalanceAffecting
private function returnShippingAddress(): array
{
if(strlen($this->shippingAddress ?? '') <3)
if(strlen($this->shippingAddress ?? '') < 3) {
return [];
}
$ship_parts = explode(",", $this->shippingAddress);
if(count($ship_parts) != 7)
if(count($ship_parts) != 7) {
return [];
}
return [
'shipping_address1' => $ship_parts[2],

View File

@ -838,12 +838,12 @@ class BaseExport
return '';
}
/**
* Apply Product Filters
*
* @param Builder $query
*
*
* @return Builder
*/
public function applyProductFilters(Builder $query): Builder
@ -863,13 +863,13 @@ class BaseExport
return $query;
}
/**
* Add Client Filter
*
* @param Builder $query
* @param mixed $clients
*
*
* @return Builder
*/
protected function addClientFilter(Builder $query, $clients): Builder
@ -886,13 +886,13 @@ class BaseExport
return $query;
}
/**
* Add Vendor Filter
*
* @param Builder $query
* @param string $vendors
*
*
* @return Builder
*/
protected function addVendorFilter(Builder$query, string $vendors): Builder
@ -910,13 +910,13 @@ class BaseExport
return $query;
}
/**
* AddProjectFilter
*
* @param Builder $query
* @param string $projects
*
*
* @return Builder
*/
protected function addProjectFilter(Builder $query, string $projects): Builder
@ -934,13 +934,13 @@ class BaseExport
return $query;
}
/**
* Add Category Filter
*
* @param Builder $query
* @param string $expense_categories
*
*
* @return Builder
*/
protected function addCategoryFilter(Builder $query, string $expense_categories): Builder
@ -959,13 +959,13 @@ class BaseExport
return $query;
}
/**
* Add Payment Status Filters
*
* @param Builder $query
* @param string $status
*
*
* @return Builder
*/
protected function addPaymentStatusFilters(Builder $query, string $status): Builder
@ -976,7 +976,7 @@ class BaseExport
if(in_array('all', $status_parameters) || count($status_parameters) == 0) {
return $query;
}
$query->where(function ($query) use ($status_parameters) {
$payment_filters = [];
@ -1016,13 +1016,13 @@ class BaseExport
return $query;
}
/**
* Add RecurringInvoice Status Filter
*
* @param Builder $query
* @param string $status
*
*
* @return Builder
*/
protected function addRecurringInvoiceStatusFilter(Builder $query, string $status): Builder
@ -1030,7 +1030,7 @@ class BaseExport
$status_parameters = explode(',', $status);
if (in_array('all', $status_parameters) || count($status_parameters) == 0){
if (in_array('all', $status_parameters) || count($status_parameters) == 0) {
return $query;
}
@ -1060,7 +1060,7 @@ class BaseExport
*
* @param Builder $query
* @param string $status
*
*
* @return Builder
*/
protected function addQuoteStatusFilter(Builder $query, string $status): Builder
@ -1126,12 +1126,12 @@ class BaseExport
*
* @param Builder $query
* @param string $status
*
*
* @return Builder
*/
protected function addPurchaseOrderStatusFilter(Builder $query, string $status): Builder
{
$status_parameters = explode(',', $status);
if (in_array('all', $status_parameters) || count($status_parameters) == 0) {
@ -1234,7 +1234,7 @@ class BaseExport
return $query;
}
/**
* Add Date Range
*
@ -1578,7 +1578,7 @@ class BaseExport
public function queueDocuments(Builder $query)
{
if($query->getModel() instanceof Document) {
$documents = $query->pluck('id')->toArray();
} else {

View File

@ -127,8 +127,9 @@ class ClientExport extends BaseExport
->withTrashed()
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false)
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}
$query = $this->addDateRange($query);

View File

@ -59,7 +59,7 @@ class ContactExport extends BaseExport
$query = ClientContact::query()
->where('company_id', $this->company->id)
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
});

View File

@ -102,7 +102,7 @@ class CreditExport extends BaseExport
$query = Credit::query()
->withTrashed()
->with('client')
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id)

View File

@ -83,9 +83,9 @@ class ExpenseExport extends BaseExport
->with('client')
->withTrashed()
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -57,13 +57,13 @@ class InvoiceExport extends BaseExport
$query = Invoice::query()
->withTrashed()
->with('client')
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -70,12 +70,12 @@ class InvoiceItemExport extends BaseExport
$query = Invoice::query()
->withTrashed()
->with('client')
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -56,7 +56,7 @@ class PaymentExport extends BaseExport
$query = Payment::query()
->withTrashed()
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id)
@ -71,7 +71,7 @@ class PaymentExport extends BaseExport
}
$query = $this->addPaymentStatusFilters($query, $this->input['status'] ?? '');
if($this->input['document_email_attachment'] ?? false) {
$this->queueDocuments($query);
}

View File

@ -74,9 +74,9 @@ class ProductExport extends BaseExport
$query = Product::query()
->withTrashed()
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -25,6 +25,7 @@ class ProductSalesExport extends BaseExport
{
public string $date_key = 'created_at';
/** @var Collection<\App\Models\Product> $products*/
protected Collection $products;
public Writer $csv;
@ -80,20 +81,20 @@ class ProductSalesExport extends BaseExport
public function filterByProducts($query)
{
$product_keys = &$this->input['product_key'];
if ($product_keys && !empty($this->input['product_key'])) {
$keys = explode(",", $product_keys);
$query->where(function ($q) use ($keys){
$query->where(function ($q) use ($keys) {
foreach($keys as $key) {
foreach($keys as $key) {
$q->orWhereJsonContains('line_items', ['product_key' => $key]);
}
});
}
return $query;
@ -121,7 +122,7 @@ class ProductSalesExport extends BaseExport
//insert the header
$query = Invoice::query()
->withTrashed()
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id)
@ -138,30 +139,29 @@ class ProductSalesExport extends BaseExport
$product_keys = &$this->input['product_key'];
if($product_keys){
if($product_keys) {
$product_keys = explode(",", $product_keys);
}
$query->cursor()
->each(function ($invoice) use($product_keys) {
->each(function ($invoice) use ($product_keys) {
foreach ($invoice->line_items as $item) {
if($product_keys)
{
if(in_array($item->product_key, $product_keys))
$this->csv->insertOne($this->buildRow($invoice, $item));
}
else {
$this->csv->insertOne($this->buildRow($invoice, $item));
}
if($product_keys) {
if(in_array($item->product_key, $product_keys)) {
$this->csv->insertOne($this->buildRow($invoice, $item));
}
} else {
$this->csv->insertOne($this->buildRow($invoice, $item));
}
}
});
$grouped = $this->sales->groupBy('product_key')->map(function ($key, $value) use($product_keys){
$grouped = $this->sales->groupBy('product_key')->map(function ($key, $value) use ($product_keys) {
if($product_keys && !in_array($value, $product_keys)){
if($product_keys && !in_array($value, $product_keys)) {
return false;
}
@ -185,7 +185,8 @@ class ProductSalesExport extends BaseExport
})->reject(function ($value) {
return $value === false;
});;
});
;
$this->csv->insertOne([]);
$this->csv->insertOne([]);
@ -327,9 +328,9 @@ class ProductSalesExport extends BaseExport
* getProduct
*
* @param string $product_key
* @return Product
* @return ?\Illuminate\Database\Eloquent\Model
*/
private function getProduct(string $product_key): ?Product
private function getProduct(string $product_key)
{
return $this->products->firstWhere('product_key', $product_key);
}

View File

@ -58,12 +58,12 @@ class PurchaseOrderExport extends BaseExport
$query = PurchaseOrder::query()
->withTrashed()
->with('vendor')
->whereHas('vendor', function ($q){
->whereHas('vendor', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}
@ -72,8 +72,9 @@ class PurchaseOrderExport extends BaseExport
$clients = &$this->input['client_id'];
if($clients)
if($clients) {
$query = $this->addClientFilter($query, $clients);
}
$query = $this->addPurchaseOrderStatusFilter($query, $this->input['status'] ?? '');

View File

@ -62,12 +62,12 @@ class PurchaseOrderItemExport extends BaseExport
$query = PurchaseOrder::query()
->withTrashed()
->whereHas('vendor', function ($q){
->whereHas('vendor', function ($q) {
$q->where('is_deleted', false);
})
->with('vendor')->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -64,12 +64,12 @@ class QuoteExport extends BaseExport
$query = Quote::query()
->withTrashed()
->with('client')
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -65,12 +65,12 @@ class QuoteItemExport extends BaseExport
$query = Quote::query()
->withTrashed()
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->with('client')->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -56,12 +56,12 @@ class RecurringInvoiceExport extends BaseExport
$query = RecurringInvoice::query()
->withTrashed()
->with('client')
->whereHas('client', function ($q){
->whereHas('client', function ($q) {
$q->where('is_deleted', false);
})
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -69,22 +69,24 @@ class TaskExport extends BaseExport
$query = Task::query()
->withTrashed()
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}
$query = $this->addDateRange($query);
$clients = &$this->input['client_id'];
if($clients)
if($clients) {
$query = $this->addClientFilter($query, $clients);
}
$document_attachments = &$this->input['document_email_attachment'];
if($document_attachments)
if($document_attachments) {
$this->queueDocuments($query);
}
return $query;
@ -224,7 +226,7 @@ class TaskExport extends BaseExport
}
}
/**
* Add Task Status Filter
*
@ -234,7 +236,7 @@ class TaskExport extends BaseExport
*/
protected function addTaskStatusFilter(Builder $query, string $status): Builder
{
$status_parameters = explode(',', $status);
if (in_array('all', $status_parameters) || count($status_parameters) == 0) {

View File

@ -63,8 +63,8 @@ class VendorExport extends BaseExport
$query = Vendor::query()->with('contacts')
->withTrashed()
->where('company_id', $this->company->id);
if(!$this->input['include_deleted'] ?? false){
if(!$this->input['include_deleted'] ?? false) {
$query->where('is_deleted', 0);
}

View File

@ -25,7 +25,7 @@ class ContactDecorator implements DecoratorInterface
$contact = $entity->contacts()->first();
} elseif($entity->client) {
$contact = $entity->client->primary_contact->first() ?? $entity->client->contacts()->whereNotNull('email')->first();
} elseif($entity->vendor) {
} elseif($entity->vendor) {
$contact = $entity->vendor->primary_contact->first() ?? $entity->vendor->contacts()->whereNotNull('email')->first();
}

View File

@ -23,14 +23,13 @@ class BankIntegrationFactory
$bank_integration->company_id = $company_id;
$bank_integration->provider_name = '';
$bank_integration->bank_account_id = '';
$bank_integration->bank_account_name = '';
$bank_integration->bank_account_number = '';
$bank_integration->bank_account_status = '';
$bank_integration->bank_account_type = '';
$bank_integration->balance = 0;
$bank_integration->currency = '';
$bank_integration->auto_sync = 1;
$bank_integration->auto_sync = true;
return $bank_integration;
}

View File

@ -29,7 +29,7 @@ class ClientFactory
$client->balance = 0;
$client->paid_to_date = 0;
$client->country_id = null;
$client->is_deleted = 0;
$client->is_deleted = false;
$client->client_hash = Str::random(40);
$client->settings = ClientSettings::defaults();
$client->classification = '';

View File

@ -33,7 +33,7 @@ class CloneQuoteToProjectFactory
$project->custom_value2 = '';
$project->custom_value3 = '';
$project->custom_value4 = '';
$project->is_deleted = 0;
$project->is_deleted = false;
return $project;
}

View File

@ -48,7 +48,7 @@ class CompanyFactory
$company->markdown_email_enabled = true;
$company->markdown_enabled = false;
$company->tax_data = new TaxModel();
$company->first_month_of_year = 1;
$company->first_month_of_year = '1';
$company->smtp_encryption = 'tls';
$company->smtp_host = '';
$company->smtp_local_domain = '';
@ -56,7 +56,7 @@ class CompanyFactory
$company->smtp_port = '';
$company->smtp_username = '';
$company->smtp_verify_peer = true;
return $company;
}
}

View File

@ -24,7 +24,7 @@ class CompanyGatewayFactory
$company_gateway->require_shipping_address = false;
$company_gateway->config = encrypt(json_encode(new \stdClass()));
$company_gateway->always_show_required_fields = true;
return $company_gateway;
}
}

View File

@ -52,7 +52,7 @@ class PurchaseOrderFactory
$purchase_order->exchange_rate = 1;
$purchase_order->total_taxes = 0;
$purchase_order->uses_inclusive_taxes = false;
return $purchase_order;
}
}

View File

@ -23,7 +23,7 @@ class SubscriptionFactory
$billing_subscription->company_id = $company_id;
$billing_subscription->user_id = $user_id;
$billing_subscription->steps = collect(Purchase::defaultSteps())
->map(fn($step) => StepService::mapClassNameToString($step))
->map(fn ($step) => StepService::mapClassNameToString($step))
->implode(',');
return $billing_subscription;

View File

@ -20,7 +20,7 @@ class TaxRateFactory
$tax_rate = new TaxRate();
$tax_rate->name = '';
$tax_rate->rate = '';
$tax_rate->rate = 0;
$tax_rate->company_id = $company_id;
$tax_rate->user_id = $user_id;

View File

@ -26,7 +26,7 @@ class VendorFactory
$vendor->private_notes = '';
$vendor->public_notes = '';
$vendor->country_id = 4;
$vendor->is_deleted = 0;
$vendor->is_deleted = false;
$vendor->vendor_hash = Str::random(40);
// $vendor->classification = '';

View File

@ -115,6 +115,29 @@ class BankTransactionFilters extends QueryFilters
return $this->builder;
}
/**
* Filters the list based on Bank Accounts.
*
* @param string $ids Comma Separated List of bank account ids
* @return Builder
*/
public function bank_integration_ids(string $ids = ''): Builder
{
if(strlen($ids) == 0) {
return $this->builder;
}
$ids = $this->transformKeys(explode(",", $ids));
$this->builder->where(function ($query) use ($ids) {
$query->whereIn('bank_integration_id', $ids);
});
return $this->builder;
}
/**
* Sorts the list based on $sort.
*

View File

@ -160,8 +160,9 @@ class ClientFilters extends QueryFilters
return $this->builder;
}
if($sort_col[0] == 'documents')
if($sort_col[0] == 'documents') {
return $this->builder;
}
if ($sort_col[0] == 'display_name') {
$sort_col[0] = 'name';

View File

@ -58,10 +58,11 @@ class DesignFilters extends QueryFilters
public function entities(string $entities = ''): Builder
{
if(stripos($entities, 'statement') !== false)
if(stripos($entities, 'statement') !== false) {
$entities = 'client';
}
if (strlen($entities) == 0 || str_contains($entities, ',')) {
return $this->builder;
}

View File

@ -49,22 +49,22 @@ class DocumentFilters extends QueryFilters
*/
public function client_id(string $client_id = ''): Builder
{
return $this->builder->where(function ($query) use ($client_id) {
$query->whereHasMorph('documentable', [
\App\Models\Invoice::class,
\App\Models\Quote::class,
\App\Models\Credit::class,
\App\Models\Expense::class,
\App\Models\Payment::class,
\App\Models\Invoice::class,
\App\Models\Quote::class,
\App\Models\Credit::class,
\App\Models\Expense::class,
\App\Models\Payment::class,
\App\Models\Task::class,
\App\Models\RecurringExpense::class,
\App\Models\RecurringInvoice::class,
\App\Models\Project::class,
], function ($q2) use ($client_id) {
$q2->where('client_id', $this->decodePrimaryKey($client_id));
})->orWhereHasMorph('documentable', [\App\Models\Client::class], function ($q3) use ($client_id) {
$q3->where('id', $this->decodePrimaryKey($client_id));
$q2->where('client_id', $this->decodePrimaryKey($client_id));
})->orWhereHasMorph('documentable', [\App\Models\Client::class], function ($q3) use ($client_id) {
$q3->where('id', $this->decodePrimaryKey($client_id));
});
});
@ -74,8 +74,7 @@ class DocumentFilters extends QueryFilters
{
$types = explode(',', $types);
foreach ($types as $type)
{
foreach ($types as $type) {
match($type) {
'private' => $this->builder->where('is_public', 0),
'public' => $this->builder->where('is_public', 1),
@ -87,7 +86,7 @@ class DocumentFilters extends QueryFilters
}
return $this->builder;
}
}
/**
* Sorts the list based on $sort.

View File

@ -111,8 +111,8 @@ class ExpenseFilters extends QueryFilters
});
}
if(in_array('uncategorized', $status_parameters)){
$query->orWhere(function ($query){
if(in_array('uncategorized', $status_parameters)) {
$query->orWhere(function ($query) {
$query->whereNull('category_id');
});
}

View File

@ -228,10 +228,9 @@ class InvoiceFilters extends QueryFilters
$date = Carbon::createFromTimestamp((int)$date);
} else {
try{
try {
$date = Carbon::parse($date);
}
catch(\Exception $e){
} catch(\Exception $e) {
return $this->builder;
}
}
@ -339,7 +338,7 @@ class InvoiceFilters extends QueryFilters
// return $this->builder->orderByRaw('CAST(number AS UNSIGNED), number ' . $dir);
// return $this->builder->orderByRaw("number REGEXP '^[A-Za-z]+$',CAST(number as SIGNED INTEGER),CAST(REPLACE(number,'-','')AS SIGNED INTEGER) ,number");
// return $this->builder->orderByRaw('ABS(number) ' . $dir);
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
}
return $this->builder->orderBy($sort_col[0], $dir);

View File

@ -133,7 +133,7 @@ class RecurringInvoiceFilters extends QueryFilters
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
}
if($sort_col[0] == 'next_send_datetime'){
if($sort_col[0] == 'next_send_datetime') {
$sort_col[0] = 'next_send_date';
}

View File

@ -100,7 +100,7 @@ class Nordigen
} catch (\Exception $e) {
nlog("Nordigen getAccount() failed => {$account_id} => " . $e->getMessage());
return false;
}
@ -151,9 +151,10 @@ class Nordigen
public function disabledAccountEmail(BankIntegration $bank_integration): void
{
$cache_key = "email_quota:{$bank_integration->company->company_key}:{$bank_integration->id}";
if(Cache::has($cache_key))
if(Cache::has($cache_key)) {
return;
}
App::setLocale($bank_integration->company->getLocale());
@ -168,7 +169,7 @@ class Nordigen
$mo->email_template_subject = 'nordigen_requisition_subject';
Email::dispatch($mo, $bank_integration->company);
Cache::put($cache_key, true, 60 * 60 * 24);
}

View File

@ -71,7 +71,7 @@ class TransactionTransformer implements BankRevenueInterface
private Company $company;
function __construct(Company $company)
public function __construct(Company $company)
{
$this->company = $company;
}
@ -192,7 +192,7 @@ class TransactionTransformer implements BankRevenueInterface
}
try {
return Carbon::createFromFormat("d-m-Y", $input)->setTimezone($timezone_name)->format($date_format_default) ?? $input;
return Carbon::createFromFormat("d-m-Y", $input)->setTimezone($timezone_name)->format($date_format_default) ?? $input;
} catch (\Exception $e) {
return $input;
}

View File

@ -105,7 +105,7 @@ class EpcQrGenerator
return implode("\n", $data);
}
// substr("{$this->invoice->number} {$this->invoice->client->number}", 0,139),

View File

@ -27,7 +27,7 @@ trait CustomValuer
public function valuerTax($custom_value, $has_custom_invoice_taxes)
{
if (isset($custom_value) && is_numeric($custom_value) && $has_custom_invoice_taxes !== false) {
return round($custom_value * ($this->invoice->tax_rate1 / 100), 2) + round($custom_value * ($this->invoice->tax_rate2 / 100), 2) + round($custom_value * ($this->invoice->tax_rate3 / 100), 2);
}
@ -35,17 +35,18 @@ trait CustomValuer
return 0;
}
public function multiInclusiveTax($custom_value, $has_custom_invoice_taxes) {
public function multiInclusiveTax($custom_value, $has_custom_invoice_taxes)
{
if (isset($custom_value) && is_numeric($custom_value) && $has_custom_invoice_taxes !== false) {
$tax = 0;
$tax = 0;
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate1 / 100))), 2);
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate2 / 100))), 2);
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate3 / 100))), 2);
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate1 / 100))), 2);
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate2 / 100))), 2);
$tax += $this->formatValue($custom_value - ($custom_value / (1 + ($this->invoice->tax_rate3 / 100))), 2);
return round($tax,2);
return round($tax, 2);
}
return 0;

View File

@ -182,7 +182,7 @@ class InvoiceItemSum
$class = "App\DataMapper\Tax\\".$this->client->company->country()->iso_3166_2."\\Rule";
$this->rule = new $class();
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2)) {
return $this;
}

View File

@ -229,7 +229,7 @@ class InvoiceSum
{
// $this->invoice->amount = $this->formatValue($this->getTotal(), $this->precision);
// $this->invoice->total_taxes = $this->getTotalTaxes();
$this->setCalculatedAttributes();
$this->invoice->balance = $this->invoice->amount;
$this->invoice->saveQuietly();
@ -245,10 +245,9 @@ class InvoiceSum
*/
private function setCalculatedAttributes(): self
{
if($this->invoice->status_id == Invoice::STATUS_CANCELLED){
if($this->invoice->status_id == Invoice::STATUS_CANCELLED) {
$this->invoice->balance = 0;
}
elseif ($this->invoice->status_id != Invoice::STATUS_DRAFT) {
} elseif ($this->invoice->status_id != Invoice::STATUS_DRAFT) {
if ($this->invoice->amount != $this->invoice->balance) {
$this->invoice->balance = Number::roundValue($this->getTotal(), $this->precision) - $this->invoice->paid_to_date; //21-02-2024 cannot use the calculated $paid_to_date here as it could send the balance backward.
} else {
@ -258,7 +257,7 @@ class InvoiceSum
/* Set new calculated total */
$this->invoice->amount = $this->formatValue($this->getTotal(), $this->precision);
if($this->rappen_rounding){
if($this->rappen_rounding) {
$this->invoice->amount = $this->roundRappen($this->invoice->amount);
$this->invoice->balance = $this->roundRappen($this->invoice->balance);
}
@ -269,7 +268,7 @@ class InvoiceSum
}
function roundRappen($value): float
public function roundRappen($value): float
{
return round($value / .05, 0) * .05;
}

View File

@ -171,7 +171,7 @@ class InvoiceSumInclusive
$this->total_taxes += $tax;
$this->total_tax_map[] = ['name' => $this->invoice->tax_name3.' '.floatval($this->invoice->tax_rate3).'%', 'total' => $tax];
}
return $this;
}
@ -279,10 +279,9 @@ class InvoiceSumInclusive
private function setCalculatedAttributes()
{
/* If amount != balance then some money has been paid on the invoice, need to subtract this difference from the total to set the new balance */
if($this->invoice->status_id == Invoice::STATUS_CANCELLED){
if($this->invoice->status_id == Invoice::STATUS_CANCELLED) {
$this->invoice->balance = 0;
}
elseif ($this->invoice->status_id != Invoice::STATUS_DRAFT) {
} elseif ($this->invoice->status_id != Invoice::STATUS_DRAFT) {
if ($this->invoice->amount != $this->invoice->balance) {
$this->invoice->balance = $this->formatValue($this->getTotal(), $this->precision) - $this->invoice->paid_to_date;
} else {
@ -302,8 +301,8 @@ class InvoiceSumInclusive
return $this;
}
function roundRappen($value): float
public function roundRappen($value): float
{
return round($value / .05, 0) * .05;
}
@ -373,7 +372,7 @@ class InvoiceSumInclusive
$this->total_taxes += $total_line_tax;
}
return $this;
}

View File

@ -34,7 +34,7 @@ class GmailTransport extends AbstractTransport
$message = MessageConverter::toEmail($message->getOriginalMessage());
/** @phpstan-ignore-next-line **/
$token = $message->getHeaders()->get('gmailtoken')->getValue();
$token = $message->getHeaders()->get('gmailtoken')->getValue(); // @phpstan-ignore-line
$message->getHeaders()->remove('gmailtoken');
$client = new Client();
@ -53,9 +53,8 @@ class GmailTransport extends AbstractTransport
if ($bccs) {
$bcc_list = 'Bcc: ';
foreach ($bccs->getAddresses() as $address) {
/** @phpstan-ignore-next-line **/
foreach ($bccs->getAddresses() as $address) {
$bcc_list .= $address->getAddress() .',';
}
@ -65,18 +64,18 @@ class GmailTransport extends AbstractTransport
$body->setRaw($this->base64_encode($bcc_list.$message->toString()));
// try {
$service->users_messages->send('me', $body, []);
$service->users_messages->send('me', $body, []);
// } catch(\Google\Service\Exception $e) {
// /* Need to slow down */
// if ($e->getCode() == '429') {
// nlog("429 google - retrying ");
// sleep(rand(3,8));
// try {
// $service->users_messages->send('me', $body, []);
// } catch(\Google\Service\Exception $e) {
// }
// }

View File

@ -54,17 +54,17 @@ class Office365MailTransport extends AbstractTransport
->setReturnType(\Microsoft\Graph\Model\Message::class)
->execute();
} catch (\Exception $e) {
sleep(rand(5,10));
sleep(rand(5, 10));
try {
$graphMessage = $graph->createRequest('POST', '/users/'.$symfony_message->getFrom()[0]->getAddress().'/sendmail')
->attachBody(base64_encode($bcc_list.$message->toString()))
->addHeaders(['Content-Type' => 'text/plain'])
->setReturnType(\Microsoft\Graph\Model\Message::class)
->execute();
$graphMessage = $graph->createRequest('POST', '/users/'.$symfony_message->getFrom()[0]->getAddress().'/sendmail')
->attachBody(base64_encode($bcc_list.$message->toString()))
->addHeaders(['Content-Type' => 'text/plain'])
->setReturnType(\Microsoft\Graph\Model\Message::class)
->execute();
} catch (\Exception $e) {
}
}

View File

@ -61,7 +61,7 @@ class AccountController extends BaseController
* Store a newly created resource in storage.
*
* @param CreateAccountRequest $request
* @return Response
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*/
public function store(CreateAccountRequest $request)

View File

@ -105,6 +105,14 @@ class ActivityController extends BaseController
}
/**
* downloadHistoricalEntity
*
* @param DownloadHistoricalEntityRequest $request
* @param Activity $activity
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
*/
public function downloadHistoricalEntity(DownloadHistoricalEntityRequest $request, Activity $activity)
{
$backup = $activity->backup;

View File

@ -166,7 +166,7 @@ class ContactLoginController extends Controller
private function setRedirectPath()
{
if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) {
$this->redirectTo = '/client/dashboard';
$this->redirectTo = '/client/dashboard';
} elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) {
$this->redirectTo = '/client/invoices';
} elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) {

View File

@ -50,7 +50,7 @@ class ContactRegisterController extends Controller
public function register(RegisterRequest $request)
{
$request->merge(['company' => $request->company()]);
$service = new ClientRegisterService(
company: $request->company(),
);

View File

@ -46,7 +46,7 @@ class ForgotPasswordController extends Controller
/**
* @param Request $request
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
* @throws \Illuminate\Validation\ValidationException
*/
public function sendResetLinkEmail(Request $request)

View File

@ -13,6 +13,7 @@
namespace App\Http\Controllers\Auth;
use App\DataMapper\Analytics\LoginFailure;
use App\DataMapper\Analytics\LoginMeta;
use App\DataMapper\Analytics\LoginSuccess;
use App\Events\User\UserLoggedIn;
use App\Http\Controllers\BaseController;
@ -111,6 +112,9 @@ class LoginController extends BaseController
->increment()
->batch();
LightLogs::create(new LoginMeta($request->email, $request->ip, 'success'))
->batch();
/** @var \App\Models\User $user */
$user = $this->guard()->user();
@ -159,6 +163,9 @@ class LoginController extends BaseController
->increment()
->batch();
LightLogs::create(new LoginMeta($request->email, $request->ip, 'failure'))
->batch();
$this->incrementLoginAttempts($request);
return response()
@ -172,7 +179,7 @@ class LoginController extends BaseController
* Refreshes the data feed with the current Company User.
*
* @param Request $request
* @return Response|JsonResponse
* @return \Illuminate\Http\Response|JsonResponse
*/
public function refresh(Request $request)
{
@ -391,8 +398,8 @@ class LoginController extends BaseController
$truth->setCompany($set_company);
//21-03-2024
$cu->each(function ($cu){
if(CompanyToken::where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()){
$cu->each(function ($cu) {
if(CompanyToken::where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) {
(new CreateCompanyToken($cu->company, $cu->user, request()->server('HTTP_USER_AGENT')))->handle();
}
});
@ -481,7 +488,7 @@ class LoginController extends BaseController
* send login response to oauthed users
*
* @param \App\Models\User $existing_user
* @return Response | JsonResponse
* @return Response| \Illuminate\Http\JsonResponse | JsonResponse
*/
private function existingOauthUser($existing_user)
{
@ -651,7 +658,9 @@ class LoginController extends BaseController
}
if(request()->hasHeader('X-REACT') || request()->query('react')) {
Cache::put("react_redir:".auth()->user()?->account->key, 'true', 300);
/**@var \App\Models\User $user */
$user = auth()->user();
Cache::put("react_redir:".$user?->account->key, 'true', 300);
}
if (request()->has('code')) {

View File

@ -78,7 +78,7 @@ class ResetPasswordController extends Controller
* Reset the given user's password.
*
* @param Request $request
* @return RedirectResponse|JsonResponse
* @return \Illuminate\Http\RedirectResponse | \Illuminate\Http\RedirectResponse|JsonResponse
* @throws \Illuminate\Validation\ValidationException
*/
public function reset(Request $request)

View File

@ -310,7 +310,7 @@ class YodleeController extends BaseController
private function transformSummary($summary): array
{
$dto = new \stdClass;
$dto = new \stdClass();
$dto->id = $summary['id'] ?? 0;
$dto->account_type = $summary['CONTAINER'] ?? '';

View File

@ -55,7 +55,7 @@ class BankIntegrationController extends BaseController
/**
* @param BankIntegrationFilters $filters
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function index(BankIntegrationFilters $filters)
{
@ -69,7 +69,7 @@ class BankIntegrationController extends BaseController
*
* @param ShowBankIntegrationRequest $request
* @param BankIntegration $bank_integration
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function show(ShowBankIntegrationRequest $request, BankIntegration $bank_integration)
@ -83,7 +83,7 @@ class BankIntegrationController extends BaseController
*
* @param EditBankIntegrationRequest $request
* @param BankIntegration $bank_integration
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function edit(EditBankIntegrationRequest $request, BankIntegration $bank_integration)
@ -96,7 +96,7 @@ class BankIntegrationController extends BaseController
*
* @param UpdateBankIntegrationRequest $request
* @param BankIntegration $bank_integration
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function update(UpdateBankIntegrationRequest $request, BankIntegration $bank_integration)
@ -111,7 +111,7 @@ class BankIntegrationController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateBankIntegrationRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*/
@ -130,7 +130,7 @@ class BankIntegrationController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreBankIntegrationRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function store(StoreBankIntegrationRequest $request)
@ -150,7 +150,7 @@ class BankIntegrationController extends BaseController
*
* @param DestroyBankIntegrationRequest $request
* @param BankIntegration $bank_integration
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @throws \Exception
*/
@ -165,7 +165,7 @@ class BankIntegrationController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function bulk(BulkBankIntegrationRequest $request)
@ -295,7 +295,7 @@ class BankIntegrationController extends BaseController
* Return the remote list of accounts stored on the third party provider
* and update our local cache.
*
* @return Response | JsonResponse
* @return Response| \Illuminate\Http\JsonResponse | JsonResponse
*
*/

View File

@ -85,7 +85,7 @@ class BankTransactionRuleController extends BaseController
* ),
* )
* @param BankTransactionRuleFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(BankTransactionRuleFilters $filters)
{
@ -99,7 +99,7 @@ class BankTransactionRuleController extends BaseController
*
* @param ShowBankTransactionRuleRequest $request
* @param BankTransactionRule $bank_transaction_rule
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|\Illuminate\Http\Response
*
*
* @OA\Get(
@ -154,7 +154,7 @@ class BankTransactionRuleController extends BaseController
*
* @param EditBankTransactionRuleRequest $request
* @param BankTransactionRule $bank_transaction_rule
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
* @OA\Get(
@ -208,7 +208,7 @@ class BankTransactionRuleController extends BaseController
*
* @param UpdateBankTransactionRuleRequest $request
* @param BankTransactionRule $bank_transaction_rule
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
*
@ -269,7 +269,7 @@ class BankTransactionRuleController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateBankTransactionRuleRequest $request
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
*
@ -317,7 +317,7 @@ class BankTransactionRuleController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreBankTransactionRuleRequest $request
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
*
@ -369,7 +369,7 @@ class BankTransactionRuleController extends BaseController
*
* @param DestroyBankTransactionRuleRequest $request
* @param BankTransactionRule $bank_transaction_rule
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
* @throws \Exception
@ -424,7 +424,7 @@ class BankTransactionRuleController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @OA\Post(
* path="/api/v1/bank_transation_rules/bulk",

View File

@ -262,7 +262,7 @@ class BaseController extends Controller
/**
* 404 for the client portal.
* @return Response 404 response
* @return Response| \Illuminate\Http\JsonResponse 404 response
*/
public function notFoundClient()
{
@ -279,7 +279,7 @@ class BaseController extends Controller
*
* @param string|array $message The return error message
* @param int $httpErrorCode 404/401/403 etc
* @return Response The JSON response
* @return Response| \Illuminate\Http\JsonResponse The JSON response
* @throws BindingResolutionException
*/
protected function errorResponse($message, $httpErrorCode = 400)
@ -297,7 +297,7 @@ class BaseController extends Controller
* Refresh API response with latest cahnges
*
* @param Builder $query
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
protected function refreshResponse($query)
{
@ -460,7 +460,7 @@ class BaseController extends Controller
}
},
'company.tasks' => function ($query) use ($updated_at, $user) {
$query->where('updated_at', '>=', $updated_at)->with('project','documents');
$query->where('updated_at', '>=', $updated_at)->with('project', 'documents');
if (! $user->hasPermission('view_task')) {
$query->whereNested(function ($query) use ($user) {
@ -798,7 +798,7 @@ class BaseController extends Controller
}
},
'company.tasks' => function ($query) use ($created_at, $user) {
$query->where('created_at', '>=', $created_at)->with('project.documents','documents');
$query->where('created_at', '>=', $created_at)->with('project.documents', 'documents');
if (! $user->hasPermission('view_task')) {
$query->whereNested(function ($query) use ($user) {
@ -969,7 +969,7 @@ class BaseController extends Controller
* Sorts the response by keys
*
* @param mixed $response
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
protected function response($response)
{
@ -995,7 +995,7 @@ class BaseController extends Controller
$response_data = Statics::company($user->getCompany()->getLocale());
if(request()->has('einvoice')){
if(request()->has('einvoice')) {
$ro = new Schema();
$response_data['einvoice_schema'] = $ro('Peppol');
@ -1003,7 +1003,7 @@ class BaseController extends Controller
}
$response['static'] = $response_data;
}
}
@ -1020,7 +1020,7 @@ class BaseController extends Controller
* Item Response
*
* @param mixed $item
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
protected function itemResponse($item)
{

View File

@ -89,7 +89,7 @@ class ClientController extends BaseController
/**
*
* @param ClientFilters $filters
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function index(ClientFilters $filters)
@ -106,7 +106,7 @@ class ClientController extends BaseController
*
* @param ShowClientRequest $request
* @param Client $client
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function show(ShowClientRequest $request, Client $client)
@ -119,7 +119,7 @@ class ClientController extends BaseController
*
* @param EditClientRequest $request
* @param Client $client
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function edit(EditClientRequest $request, Client $client)
@ -132,7 +132,7 @@ class ClientController extends BaseController
*
* @param UpdateClientRequest $request
* @param Client $client
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function update(UpdateClientRequest $request, Client $client)
@ -157,7 +157,7 @@ class ClientController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateClientRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function create(CreateClientRequest $request)
@ -174,7 +174,7 @@ class ClientController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreClientRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function store(StoreClientRequest $request)
@ -203,7 +203,7 @@ class ClientController extends BaseController
*
* @param DestroyClientRequest $request
* @param Client $client
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @throws \Exception
*/
@ -217,7 +217,7 @@ class ClientController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function bulk(BulkClientRequest $request)
@ -250,22 +250,22 @@ class ClientController extends BaseController
return response()->json(['message' => $hash_or_response], 200);
}
if($action == 'assign_group' && $user->can('edit', $clients->first())){
if($action == 'assign_group' && $user->can('edit', $clients->first())) {
$this->client_repo->assignGroup($clients, $request->group_settings_id);
return $this->listResponse(Client::query()->withTrashed()->company()->whereIn('id', $request->ids));
}
if($action == 'bulk_update' && $user->can('edit', $clients->first())){
if($action == 'bulk_update' && $user->can('edit', $clients->first())) {
$clients = Client::withTrashed()
->company()
->whereIn('id', $request->ids);
$this->client_repo->bulkUpdate($clients, $request->column, $request->new_value);
return $this->listResponse(Client::query()->withTrashed()->company()->whereIn('id', $request->ids));
}
@ -284,7 +284,7 @@ class ClientController extends BaseController
*
* @param UploadClientRequest $request
* @param Client $client
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function upload(UploadClientRequest $request, Client $client)
@ -305,7 +305,7 @@ class ClientController extends BaseController
*
* @param PurgeClientRequest $request
* @param Client $client
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*/
public function purge(PurgeClientRequest $request, Client $client)
@ -333,7 +333,7 @@ class ClientController extends BaseController
* @param PurgeClientRequest $request
* @param Client $client
* @param string $mergeable_client
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*/
@ -351,9 +351,10 @@ class ClientController extends BaseController
return response()->json(['message' => "Client not found"], 400);
}
if($m_client->id == $client->id)
if($m_client->id == $client->id) {
return response()->json(['message' => "Attempting to merge the same client is not possible."], 400);
}
$merged_client = $client->service()->merge($m_client)->save();
return $this->itemResponse($merged_client);
@ -364,7 +365,7 @@ class ClientController extends BaseController
*
* @param PurgeClientRequest $request
* @param Client $client
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function updateTaxData(PurgeClientRequest $request, Client $client)
{
@ -380,7 +381,7 @@ class ClientController extends BaseController
*
* @param ReactivateClientEmailRequest $request
* @param string $bounce_id //could also be the invitationId
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function reactivateEmail(ReactivateClientEmailRequest $request, string $bounce_id)
{

View File

@ -89,7 +89,7 @@ class ClientGatewayTokenController extends BaseController
* ),
* )
* @param ListClientGatewayTokenRequest $request
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(ListClientGatewayTokenRequest $request)
{
@ -103,7 +103,7 @@ class ClientGatewayTokenController extends BaseController
*
* @param ShowClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -157,7 +157,7 @@ class ClientGatewayTokenController extends BaseController
*
* @param EditClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -211,7 +211,7 @@ class ClientGatewayTokenController extends BaseController
*
* @param UpdateClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -267,7 +267,7 @@ class ClientGatewayTokenController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateClientGatewayTokenRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -317,7 +317,7 @@ class ClientGatewayTokenController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreClientGatewayTokenRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -369,7 +369,7 @@ class ClientGatewayTokenController extends BaseController
*
* @param DestroyClientGatewayTokenRequest $request
* @param ClientGatewayToken $client_gateway_token
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception

View File

@ -21,7 +21,7 @@ class ContactHashLoginController extends Controller
/**
* Logs a user into the client portal using their contact_key
* @param string $contact_key The contact key
* @return Redirect
* @return \Illuminate\Http\RedirectResponse
*/
public function login(string $contact_key)
{
@ -50,7 +50,7 @@ class ContactHashLoginController extends Controller
/**
* Generic error page for client portal.
*
* @return void
* @return \Illuminate\View\View
*/
public function errorPage()
{

View File

@ -21,7 +21,7 @@ class DashboardController extends Controller
{
if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === false) {
return redirect()->route('client.invoices.index');
}
}
$total_invoices = Invoice::withTrashed()
->where('client_id', auth()->guard('contact')->user()->client_id)

View File

@ -103,7 +103,7 @@ class PaymentController extends Controller
* and invoice ids for reference.
*
* @param Request $request
* @return RedirectResponse|mixed
* @return \Illuminate\Http\RedirectResponse|mixed
*/
public function process(Request $request)
{
@ -157,7 +157,7 @@ class PaymentController extends Controller
* Pay for invoice/s using credits only.
*
* @param Request $request The request object
* @return \Response The response view
* @return \Illuminate\Http\RedirectResponse The response view
*/
public function credit_response(Request $request)
{

View File

@ -127,7 +127,7 @@ class PaymentMethodController extends Controller
* Remove the specified resource from storage.
*
* @param ClientGatewayToken $payment_method
* @return RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(ClientGatewayToken $payment_method)
{

View File

@ -108,7 +108,7 @@ class PrePaymentController extends Controller
return $invoice;
});
$variables = false;
if(($invitation = $invoices->first()->invitations()->first() ?? false) && $invoice->client->getSetting('show_accept_invoice_terms')) {

View File

@ -38,7 +38,7 @@ class ProfileController extends Controller
*
* @param UpdateContactRequest $request
* @param ClientContact $client_contact
* @return RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateContactRequest $request, ClientContact $client_contact)
{

View File

@ -178,7 +178,7 @@ class QuoteController extends Controller
->where('client_id', auth()->guard('contact')->user()->client->id)
->where('company_id', auth()->guard('contact')->user()->client->company_id)
->whereIn('status_id', [Quote::STATUS_DRAFT, Quote::STATUS_SENT])
->where(function ($q){
->where(function ($q) {
$q->whereNull('due_date')->orWhere('due_date', '>=', now());
})
->withTrashed()

View File

@ -66,7 +66,7 @@ class RecurringInvoiceController extends Controller
* @param RequestCancellationRequest $request [description]
* @param RecurringInvoice $recurring_invoice [description]
*
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function requestCancellation(RequestCancellationRequest $request, RecurringInvoice $recurring_invoice)
{

View File

@ -13,14 +13,13 @@ namespace App\Http\Controllers\ClientPortal;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redirect;
class TempRouteController extends Controller
{
/**
* Logs a user into the client portal using their contact_key
* @param string $hash The hash
* @return Redirect
* @return \Illuminate\View\View
*/
public function index(string $hash)
{

View File

@ -26,7 +26,7 @@ class UploadController extends Controller
* Main logic behind uploading the files.
*
* @param StoreUploadRequest $request
* @return Response|ResponseFactory
* @return Response| \Illuminate\Http\JsonResponse|ResponseFactory
*/
public function __invoke(StoreUploadRequest $request)
{

View File

@ -33,7 +33,7 @@ class ClientStatementController extends BaseController
* Update the specified resource in storage.
*
* @param CreateStatementRequest $request
* @return Response
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
*/
public function statement(CreateStatementRequest $request)
{

View File

@ -78,7 +78,7 @@ class CompanyController extends BaseController
/**
* Display a listing of the resource.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/companies",
@ -136,7 +136,7 @@ class CompanyController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateCompanyRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -186,7 +186,7 @@ class CompanyController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreCompanyRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -272,7 +272,7 @@ class CompanyController extends BaseController
*
* @param ShowCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -326,7 +326,7 @@ class CompanyController extends BaseController
*
* @param EditCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -380,7 +380,7 @@ class CompanyController extends BaseController
*
* @param UpdateCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -457,7 +457,7 @@ class CompanyController extends BaseController
*
* @param DestroyCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -573,7 +573,7 @@ class CompanyController extends BaseController
*
* @param UploadCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -636,7 +636,7 @@ class CompanyController extends BaseController
*
* @param DefaultCompanyRequest $request
* @param Company $company
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -706,6 +706,11 @@ class CompanyController extends BaseController
return $this->itemResponse($company->fresh());
}
/**
*
*
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
*/
public function logo()
{
@ -715,18 +720,16 @@ class CompanyController extends BaseController
$logo = strlen($company->settings->company_logo) > 5 ? $company->settings->company_logo : 'https://pdf.invoicing.co/favicon-v2.png';
$headers = ['Content-Disposition' => 'inline'];
try{
try {
$response = \Illuminate\Support\Facades\Http::get($logo);
if ($response->successful()) {
$logo = $response->body();
}
else {
} else {
$logo = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=');
}
}
catch(\Exception $e){
} catch(\Exception $e) {
$logo = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=');

View File

@ -72,7 +72,7 @@ class CompanyGatewayController extends BaseController
/**
* Display a listing of the resource.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -119,7 +119,7 @@ class CompanyGatewayController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateCompanyGatewayRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -168,7 +168,7 @@ class CompanyGatewayController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreCompanyGatewayRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -232,7 +232,7 @@ class CompanyGatewayController extends BaseController
} elseif($company_gateway->gateway_key == $this->checkout_key) {
CheckoutSetupWebhook::dispatch($company_gateway->company->company_key, $company_gateway->id);
} elseif($company_gateway->gateway_key == $this->forte_key) {
dispatch(function () use ($company_gateway) {
MultiDB::setDb($company_gateway->company->db);
$company_gateway->driver()->updateFees();
@ -248,7 +248,7 @@ class CompanyGatewayController extends BaseController
*
* @param ShowCompanyGatewayRequest $request
* @param CompanyGateway $company_gateway
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -302,7 +302,7 @@ class CompanyGatewayController extends BaseController
*
* @param EditCompanyGatewayRequest $request
* @param CompanyGateway $company_gateway
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -356,7 +356,7 @@ class CompanyGatewayController extends BaseController
*
* @param UpdateCompanyGatewayRequest $request
* @param CompanyGateway $company_gateway
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -420,8 +420,8 @@ class CompanyGatewayController extends BaseController
if($company_gateway->gateway_key == $this->checkout_key) {
CheckoutSetupWebhook::dispatch($company_gateway->company->company_key, $company_gateway->fresh()->id);
}elseif($company_gateway->gateway_key == $this->forte_key){
} elseif($company_gateway->gateway_key == $this->forte_key) {
dispatch(function () use ($company_gateway) {
MultiDB::setDb($company_gateway->company->db);
$company_gateway->driver()->updateFees();
@ -437,7 +437,7 @@ class CompanyGatewayController extends BaseController
*
* @param DestroyCompanyGatewayRequest $request
* @param CompanyGateway $company_gateway
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -494,7 +494,7 @@ class CompanyGatewayController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -565,12 +565,13 @@ class CompanyGatewayController extends BaseController
public function importCustomers(TestCompanyGatewayRequest $request, CompanyGateway $company_gateway)
{
//Throttle here
if (Cache::has("throttle_polling:import_customers:{$company_gateway->company->company_key}:{$company_gateway->hashed_id}"))
return response()->json(['message' => 'Please wait whilst your previous attempts complete.'], 200);
dispatch(function () use($company_gateway) {
//Throttle here
if (Cache::has("throttle_polling:import_customers:{$company_gateway->company->company_key}:{$company_gateway->hashed_id}")) {
return response()->json(['message' => 'Please wait whilst your previous attempts complete.'], 200);
}
dispatch(function () use ($company_gateway) {
MultiDB::setDb($company_gateway->company->db);
$company_gateway->driver()->importCustomers();
})->afterResponse();

View File

@ -31,7 +31,7 @@ class CompanyLedgerController extends BaseController
* Store a newly created resource in storage.
*
* @param ShowCompanyLedgerRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/company_ledger",

View File

@ -107,7 +107,7 @@ class CompanyUserController extends BaseController
* )
* @param UpdateCompanyUserRequest $request
* @param User $user
* @return Response|mixed|void
* @return Response| \Illuminate\Http\JsonResponse|mixed|void
*/
public function update(UpdateCompanyUserRequest $request, User $user)
{

View File

@ -38,7 +38,7 @@ class ConnectedAccountController extends BaseController
* Connect an OAuth account to a regular email/password combination account
*
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
*
* @OA\Post(

View File

@ -36,7 +36,7 @@ class InvoiceController extends BaseController
*
* @param InvoiceFilters $filters The filters
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function index(InvoiceFilters $filters)
{

View File

@ -58,7 +58,7 @@ class LoginController extends BaseController
*
* @param Request $request The request
*
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
* @throws \Illuminate\Validation\ValidationException
*/
public function apiLogin(Request $request)
@ -86,7 +86,7 @@ class LoginController extends BaseController
* Redirect the user to the provider authentication page.
*
* @param string $provider
* @return void
* @return mixed
*/
public function redirectToProvider(string $provider)
{

View File

@ -69,7 +69,7 @@ class CreditController extends BaseController
*
* @param CreditFilters $filters The filters
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/credits",
@ -115,7 +115,7 @@ class CreditController extends BaseController
*
* @param CreateCreditRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -164,7 +164,7 @@ class CreditController extends BaseController
*
* @param StoreCreditRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -226,7 +226,7 @@ class CreditController extends BaseController
* @param ShowCreditRequest $request The request
* @param Credit $credit The credit
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -281,7 +281,7 @@ class CreditController extends BaseController
* @param EditCreditRequest $request The request
* @param Credit $credit The credit
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/credits/{id}/edit",
@ -334,7 +334,7 @@ class CreditController extends BaseController
*
* @param UpdateCreditRequest $request The request
* @param Credit $credit
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \ReflectionException
@ -458,7 +458,7 @@ class CreditController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return \Illuminate\Support\Collection
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
*
* @OA\Post(
* path="/api/v1/credits/bulk",
@ -700,7 +700,7 @@ class CreditController extends BaseController
* ),
* )
* @param $invitation_key
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
public function downloadPdf($invitation_key)
{
@ -801,7 +801,7 @@ class CreditController extends BaseController
*
* @param UploadCreditRequest $request
* @param Credit $credit
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*

View File

@ -82,7 +82,7 @@ class DesignController extends BaseController
* ),
* )
* @param DesignFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(DesignFilters $filters)
{
@ -96,7 +96,7 @@ class DesignController extends BaseController
*
* @param ShowDesignRequest $request
* @param Design $design
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -150,7 +150,7 @@ class DesignController extends BaseController
*
* @param EditDesignRequest $request
* @param Design $design
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -204,7 +204,7 @@ class DesignController extends BaseController
*
* @param UpdateDesignRequest $request
* @param Design $design
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -265,7 +265,7 @@ class DesignController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateDesignRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -313,7 +313,7 @@ class DesignController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreDesignRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -415,7 +415,7 @@ class DesignController extends BaseController
*
* @param DestroyDesignRequest $request
* @param Design $design
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -473,7 +473,7 @@ class DesignController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(

View File

@ -70,7 +70,7 @@ class DocumentController extends BaseController
* ),
* )
* @param DocumentFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(DocumentFilters $filters)
{
@ -105,7 +105,7 @@ class DocumentController extends BaseController
*
* @param ShowDocumentRequest $request
* @param Document $document
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function show(ShowDocumentRequest $request, Document $document)
{
@ -131,7 +131,7 @@ class DocumentController extends BaseController
*
* @param EditDocumentRequest $request
* @param Document $document
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function edit(EditDocumentRequest $request, Document $document)
{
@ -143,7 +143,7 @@ class DocumentController extends BaseController
*
* @param UpdateDocumentRequest $request
* @param Document $document
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function update(UpdateDocumentRequest $request, Document $document)
{
@ -158,7 +158,7 @@ class DocumentController extends BaseController
*
* @param DestroyDocumentRequest $request
* @param Document $document
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function destroy(DestroyDocumentRequest $request, Document $document)
{

View File

@ -78,7 +78,7 @@ class ExpenseCategoryController extends BaseController
*
* Display a listing of the resource.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*/
public function index(ExpenseCategoryFilters $filters)
{
@ -93,7 +93,7 @@ class ExpenseCategoryController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateExpenseCategoryRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -142,7 +142,7 @@ class ExpenseCategoryController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreExpenseCategoryRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -192,7 +192,7 @@ class ExpenseCategoryController extends BaseController
*
* @param ShowExpenseCategoryRequest $request
* @param ExpenseCategory $expense_category
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -245,7 +245,7 @@ class ExpenseCategoryController extends BaseController
*
* @param EditExpenseCategoryRequest $request
* @param ExpenseCategory $expense_category
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -298,7 +298,7 @@ class ExpenseCategoryController extends BaseController
*
* @param UpdateExpenseCategoryRequest $request
* @param ExpenseCategory $expense_category
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -355,7 +355,7 @@ class ExpenseCategoryController extends BaseController
*
* @param DestroyExpenseCategoryRequest $request
* @param ExpenseCategory $expense_category
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -410,7 +410,7 @@ class ExpenseCategoryController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(

View File

@ -98,7 +98,7 @@ class ExpenseController extends BaseController
* ),
* )
* @param ExpenseFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(ExpenseFilters $filters)
{
@ -112,7 +112,7 @@ class ExpenseController extends BaseController
*
* @param ShowExpenseRequest $request
* @param Expense $expense
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -166,7 +166,7 @@ class ExpenseController extends BaseController
*
* @param EditExpenseRequest $request
* @param Expense $expense
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -220,7 +220,7 @@ class ExpenseController extends BaseController
*
* @param UpdateExpenseRequest $request
* @param Expense $expense
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -286,7 +286,7 @@ class ExpenseController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateExpenseRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -334,7 +334,7 @@ class ExpenseController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreExpenseRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -387,7 +387,7 @@ class ExpenseController extends BaseController
*
* @param DestroyExpenseRequest $request
* @param Expense $expense
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -441,7 +441,7 @@ class ExpenseController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -524,7 +524,7 @@ class ExpenseController extends BaseController
*
* @param UploadExpenseRequest $request
* @param Expense $expense
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*

View File

@ -55,7 +55,7 @@ class GroupSettingController extends BaseController
* Show the form for creating a new resource.
*
* @param GroupSettingFilters $filters
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function index(GroupSettingFilters $filters)
@ -69,7 +69,7 @@ class GroupSettingController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateGroupSettingRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function create(CreateGroupSettingRequest $request)
@ -86,7 +86,7 @@ class GroupSettingController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreGroupSettingRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function store(StoreGroupSettingRequest $request)
@ -108,7 +108,7 @@ class GroupSettingController extends BaseController
*
* @param ShowGroupSettingRequest $request
* @param GroupSetting $group_setting
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function show(ShowGroupSettingRequest $request, GroupSetting $group_setting)
@ -121,7 +121,7 @@ class GroupSettingController extends BaseController
*
* @param EditGroupSettingRequest $request
* @param GroupSetting $group_setting
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function edit(EditGroupSettingRequest $request, GroupSetting $group_setting)
@ -134,7 +134,7 @@ class GroupSettingController extends BaseController
*
* @param UpdateGroupSettingRequest $request
* @param GroupSetting $group_setting
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function update(UpdateGroupSettingRequest $request, GroupSetting $group_setting)
@ -158,7 +158,7 @@ class GroupSettingController extends BaseController
*
* @param DestroyGroupSettingRequest $request
* @param GroupSetting $group_setting
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -173,7 +173,7 @@ class GroupSettingController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function bulk()
@ -210,7 +210,7 @@ class GroupSettingController extends BaseController
*
* @param UploadGroupSettingRequest $request
* @param GroupSetting $group_setting
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*/
public function upload(UploadGroupSettingRequest $request, GroupSetting $group_setting)

View File

@ -27,7 +27,7 @@ class ImportController extends Controller
*
* @param PreImportRequest $request
*
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*
* @OA\Post(
* path="/api/v1/preimport",
@ -276,7 +276,7 @@ class ImportController extends Controller
return $data;
}
/**
* Returns the best delimiter
@ -302,7 +302,7 @@ class ImportController extends Controller
}
}
/** @phpstan-ignore-next-line **/
return $bestDelimiter ?? ',';

View File

@ -81,7 +81,7 @@ class InvoiceController extends BaseController
*
* @param InvoiceFilters $filters The filters
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/invoices",
@ -128,7 +128,7 @@ class InvoiceController extends BaseController
*
* @param CreateInvoiceRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -176,7 +176,7 @@ class InvoiceController extends BaseController
*
* @param StoreInvoiceRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -248,7 +248,7 @@ class InvoiceController extends BaseController
* @param ShowInvoiceRequest $request The request
* @param Invoice $invoice The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -303,7 +303,7 @@ class InvoiceController extends BaseController
* @param EditInvoiceRequest $request The request
* @param Invoice $invoice The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/invoices/{id}/edit",
@ -357,7 +357,7 @@ class InvoiceController extends BaseController
* @param UpdateInvoiceRequest $request The request
* @param Invoice $invoice The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -954,7 +954,7 @@ class InvoiceController extends BaseController
*
* @param UploadInvoiceRequest $request
* @param Invoice $invoice
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*

View File

@ -28,7 +28,7 @@ class LicenseController extends BaseController
/**
* Claim a white label license.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/claim_license",

View File

@ -52,7 +52,7 @@ class LogoutController extends BaseController
* ),
* )
* @param Request $request
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(Request $request)
{
@ -64,11 +64,11 @@ class LogoutController extends BaseController
->tokens()
->where('is_system', true)
->cursor()
->each(function ($ct){
->each(function ($ct) {
$ct->token = \Illuminate\Support\Str::random(64);
$ct->save();
});
return response()->json(['message' => 'All tokens deleted'], 200);
}
}

View File

@ -80,7 +80,7 @@ class MigrationController extends BaseController
* ),
* )
* @param Company $company
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
* @throws \Exception
*/
public function purgeCompany(Company $company)
@ -171,7 +171,7 @@ class MigrationController extends BaseController
* )
* @param Request $request
* @param Company $company
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function purgeCompanySaveSettings(Request $request, Company $company)
{
@ -255,7 +255,7 @@ class MigrationController extends BaseController
* ),
* )
* @param Request $request
* @return \Illuminate\Http\JsonResponse|void
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|void
*/
public function startMigration(Request $request)
{

View File

@ -34,7 +34,7 @@ class OneTimeTokenController extends BaseController
* Store a newly created resource in storage.
*
* @param OneTimeTokenRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Post(
* path="/api/v1/one_time_token",

View File

@ -67,7 +67,7 @@ class PaymentController extends BaseController
*
* @param PaymentFilters $filters The filters
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -115,7 +115,7 @@ class PaymentController extends BaseController
*
* @param CreatePaymentRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -165,7 +165,7 @@ class PaymentController extends BaseController
*
* @param StorePaymentRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -222,7 +222,7 @@ class PaymentController extends BaseController
* @param ShowPaymentRequest $request The request
* @param Payment $payment The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -277,7 +277,7 @@ class PaymentController extends BaseController
* @param EditPaymentRequest $request The request
* @param Payment $payment The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -332,7 +332,7 @@ class PaymentController extends BaseController
* @param UpdatePaymentRequest $request The request
* @param Payment $payment The invoice
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -454,7 +454,7 @@ class PaymentController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -667,7 +667,7 @@ class PaymentController extends BaseController
*
* @param RefundPaymentRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -720,7 +720,7 @@ class PaymentController extends BaseController
*
* @param UploadPaymentRequest $request
* @param Payment $payment
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*

View File

@ -94,7 +94,7 @@ class PaymentTermController extends BaseController
*
* @param CreatePaymentTermRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -142,7 +142,7 @@ class PaymentTermController extends BaseController
*
* @param StorePaymentTermRequest $request The request
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -236,7 +236,7 @@ class PaymentTermController extends BaseController
* )
* @param ShowPaymentTermRequest $request
* @param PaymentTerm $payment_term
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function show(ShowPaymentTermRequest $request, PaymentTerm $payment_term)
{
@ -286,7 +286,7 @@ class PaymentTermController extends BaseController
* )
* @param EditPaymentTermRequest $request
* @param PaymentTerm $payment_term
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function edit(EditPaymentTermRequest $request, PaymentTerm $payment_term)
{
@ -299,7 +299,7 @@ class PaymentTermController extends BaseController
* @param UpdatePaymentTermRequest $request The request
* @param PaymentTerm $payment_term The payment term
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -411,7 +411,7 @@ class PaymentTermController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
*
* @OA\Post(

View File

@ -20,7 +20,7 @@ class PingController extends BaseController
/**
* Get a ping response from the system.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/ping",
@ -55,7 +55,7 @@ class PingController extends BaseController
/**
* Get a health check of the system.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/health_check",

View File

@ -146,8 +146,7 @@ class PreviewController extends BaseController
if (request()->has('entity') &&
request()->has('entity_id') &&
! empty(request()->input('entity')) &&
! empty(request()->input('entity_id')))
{
! empty(request()->input('entity_id'))) {
$design_object = json_decode(json_encode(request()->input('design')));
@ -172,10 +171,9 @@ class PreviewController extends BaseController
App::setLocale($entity_obj->client->preferredLocale());
$t->replace(Ninja::transformTranslations($entity_obj->client->getMergedSettings()));
if($entity_obj->client){
if($entity_obj->client) {
$html = new HtmlEngine($entity_obj->invitations()->first());
}
else {
} else {
$html = new VendorHtmlEngine($entity_obj->invitations()->first());
}

View File

@ -83,7 +83,7 @@ class ProductController extends BaseController
* ),
* )
* @param ProductFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(ProductFilters $filters)
{
@ -96,7 +96,7 @@ class ProductController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateProductRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -145,7 +145,7 @@ class ProductController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreProductRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -195,7 +195,7 @@ class ProductController extends BaseController
*
* @param ShowProductRequest $request
* @param Product $product
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -249,7 +249,7 @@ class ProductController extends BaseController
*
* @param EditProductRequest $request
* @param Product $product
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Get(
* path="/api/v1/products/{id}/edit",
@ -302,7 +302,7 @@ class ProductController extends BaseController
*
* @param UpdateProductRequest $request
* @param Product $product
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Put(
@ -362,7 +362,7 @@ class ProductController extends BaseController
*
* @param DestroyProductRequest $request
* @param Product $product
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -416,7 +416,7 @@ class ProductController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -498,7 +498,7 @@ class ProductController extends BaseController
*
* @param UploadProductRequest $request
* @param Product $product
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*

View File

@ -88,7 +88,7 @@ class ProjectController extends BaseController
* ),
* )
* @param ProjectFilters $filters
* @return Response|mixed
* @return Response| \Illuminate\Http\JsonResponse|mixed
*/
public function index(ProjectFilters $filters)
{
@ -102,7 +102,7 @@ class ProjectController extends BaseController
*
* @param ShowProjectRequest $request
* @param Project $project
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -156,7 +156,7 @@ class ProjectController extends BaseController
*
* @param EditProjectRequest $request
* @param Project $project
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Get(
@ -210,7 +210,7 @@ class ProjectController extends BaseController
*
* @param UpdateProjectRequest $request
* @param Project $project
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -278,7 +278,7 @@ class ProjectController extends BaseController
* Show the form for creating a new resource.
*
* @param CreateProjectRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -326,7 +326,7 @@ class ProjectController extends BaseController
* Store a newly created resource in storage.
*
* @param StoreProjectRequest $request
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
*
@ -388,7 +388,7 @@ class ProjectController extends BaseController
*
* @param DestroyProjectRequest $request
* @param Project $project
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @throws \Exception
@ -445,7 +445,7 @@ class ProjectController extends BaseController
/**
* Perform bulk actions on the list view.
*
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
*
* @OA\Post(
@ -535,7 +535,7 @@ class ProjectController extends BaseController
*
* @param UploadProjectRequest $request
* @param Project $project
* @return Response
* @return Response| \Illuminate\Http\JsonResponse
*
* @OA\Put(
* path="/api/v1/projects/{id}/upload",

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