mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 15:44:33 -04:00
commit
13b24cc03e
@ -1 +1 @@
|
|||||||
5.10.24
|
5.10.25
|
@ -1169,10 +1169,10 @@ class CheckData extends Command
|
|||||||
->whereNull('exchange_rate')
|
->whereNull('exchange_rate')
|
||||||
->orWhere('exchange_rate', 0)
|
->orWhere('exchange_rate', 0)
|
||||||
->cursor()
|
->cursor()
|
||||||
->each(function ($expense){
|
->each(function ($expense) {
|
||||||
$expense->exchange_rate = 1;
|
$expense->exchange_rate = 1;
|
||||||
$expense->saveQuietly();
|
$expense->saveQuietly();
|
||||||
|
|
||||||
$this->logMessage("Fixing - exchange rate for expense :: {$expense->id}");
|
$this->logMessage("Fixing - exchange rate for expense :: {$expense->id}");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1116,7 +1116,7 @@ class CreateSingleAccount extends Command
|
|||||||
|
|
||||||
private function countryClients($company, $user)
|
private function countryClients($company, $user)
|
||||||
{
|
{
|
||||||
|
|
||||||
Client::unguard();
|
Client::unguard();
|
||||||
|
|
||||||
Client::create([
|
Client::create([
|
||||||
|
@ -67,7 +67,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
/* Checks Rotessa Transactions */
|
/* Checks Rotessa Transactions */
|
||||||
$schedule->job(new TransactionReport())->dailyAt('01:48')->withoutOverlapping()->name('rotessa-transaction-report')->onOneServer();
|
$schedule->job(new TransactionReport())->dailyAt('01:48')->withoutOverlapping()->name('rotessa-transaction-report')->onOneServer();
|
||||||
|
|
||||||
/* Stale Invoice Cleanup*/
|
/* Stale Invoice Cleanup*/
|
||||||
$schedule->job(new CleanStaleInvoiceOrder())->hourlyAt(30)->withoutOverlapping()->name('stale-invoice-job')->onOneServer();
|
$schedule->job(new CleanStaleInvoiceOrder())->hourlyAt(30)->withoutOverlapping()->name('stale-invoice-job')->onOneServer();
|
||||||
|
|
||||||
|
@ -515,10 +515,11 @@ class CompanySettings extends BaseSettings
|
|||||||
public $quote_schedule_reminder1 = ''; //before_valid_until_date,after_valid_until_date,after_quote_date
|
public $quote_schedule_reminder1 = ''; //before_valid_until_date,after_valid_until_date,after_quote_date
|
||||||
public $quote_late_fee_amount1 = 0;
|
public $quote_late_fee_amount1 = 0;
|
||||||
public $quote_late_fee_percent1 = 0;
|
public $quote_late_fee_percent1 = 0;
|
||||||
|
|
||||||
|
|
||||||
|
public string $payment_flow = 'default'; //smooth
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'payment_flow' => 'string',
|
||||||
'enable_quote_reminder1' => 'bool',
|
'enable_quote_reminder1' => 'bool',
|
||||||
'quote_num_days_reminder1' => 'int',
|
'quote_num_days_reminder1' => 'int',
|
||||||
'quote_schedule_reminder1' => 'string',
|
'quote_schedule_reminder1' => 'string',
|
||||||
|
@ -120,7 +120,7 @@ class EmailTemplateDefaults
|
|||||||
|
|
||||||
case 'email_quote_subject_reminder1':
|
case 'email_quote_subject_reminder1':
|
||||||
return self::emailQuoteReminder1Subject();
|
return self::emailQuoteReminder1Subject();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return self::emailInvoiceTemplate();
|
return self::emailInvoiceTemplate();
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class EmailTemplateDefaults
|
|||||||
{
|
{
|
||||||
return ctrans('texts.quote_reminder_subject', ['quote' => '$number', 'company' => '$company.name']);
|
return ctrans('texts.quote_reminder_subject', ['quote' => '$number', 'company' => '$company.name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailQuoteReminder1Body()
|
public static function emailQuoteReminder1Body()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ class EmailTemplateDefaults
|
|||||||
return $invoice_message;
|
return $invoice_message;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function emailVendorNotificationSubject()
|
public static function emailVendorNotificationSubject()
|
||||||
{
|
{
|
||||||
return self::transformText('vendor_notification_subject');
|
return self::transformText('vendor_notification_subject');
|
||||||
|
@ -131,7 +131,8 @@ class BaseRule implements RuleInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldCalcTax(): bool {
|
public function shouldCalcTax(): bool
|
||||||
|
{
|
||||||
return $this->should_calc_tax && $this->checkIfInvoiceLocked();
|
return $this->should_calc_tax && $this->checkIfInvoiceLocked();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -404,9 +405,10 @@ class BaseRule implements RuleInterface
|
|||||||
{
|
{
|
||||||
$lock_invoices = $this->client->getSetting('lock_invoices');
|
$lock_invoices = $this->client->getSetting('lock_invoices');
|
||||||
|
|
||||||
if($this->invoice instanceof RecurringInvoice)
|
if($this->invoice instanceof RecurringInvoice) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($lock_invoices) {
|
switch ($lock_invoices) {
|
||||||
case 'off':
|
case 'off':
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,7 +107,7 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
*/
|
*/
|
||||||
public function taxReduced($item): self
|
public function taxReduced($item): self
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->tax_name1 = $this->tax_name;
|
$this->tax_name1 = $this->tax_name;
|
||||||
$this->tax_rate1 = $this->reduced_tax_rate;
|
$this->tax_rate1 = $this->reduced_tax_rate;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
*/
|
*/
|
||||||
public function zeroRated($item): self
|
public function zeroRated($item): self
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->tax_name1 = $this->tax_name;
|
$this->tax_name1 = $this->tax_name;
|
||||||
$this->tax_rate1 = 0;
|
$this->tax_rate1 = 0;
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
$this->tax_rate = 0;
|
$this->tax_rate = 0;
|
||||||
$this->reduced_tax_rate = 0;
|
$this->reduced_tax_rate = 0;
|
||||||
} elseif($this->client_subregion != $this->client->company->tax_data->seller_subregion && in_array($this->client_subregion, $this->eu_country_codes) && $this->client->vat_number && $this->client->has_valid_vat_number && $this->eu_business_tax_exempt) {
|
} elseif($this->client_subregion != $this->client->company->tax_data->seller_subregion && in_array($this->client_subregion, $this->eu_country_codes) && $this->client->vat_number && $this->client->has_valid_vat_number && $this->eu_business_tax_exempt) {
|
||||||
// nlog("euro zone and tax exempt");
|
// nlog("euro zone and tax exempt");
|
||||||
$this->tax_rate = 0;
|
$this->tax_rate = 0;
|
||||||
$this->reduced_tax_rate = 0;
|
$this->reduced_tax_rate = 0;
|
||||||
} elseif(!in_array($this->client_subregion, $this->eu_country_codes) && ($this->foreign_consumer_tax_exempt || $this->foreign_business_tax_exempt)) { //foreign + tax exempt
|
} elseif(!in_array($this->client_subregion, $this->eu_country_codes) && ($this->foreign_consumer_tax_exempt || $this->foreign_business_tax_exempt)) { //foreign + tax exempt
|
||||||
@ -251,8 +251,7 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
$this->reduced_tax_rate = 0;
|
$this->reduced_tax_rate = 0;
|
||||||
} elseif(!in_array($this->client_subregion, $this->eu_country_codes)) {
|
} elseif(!in_array($this->client_subregion, $this->eu_country_codes)) {
|
||||||
$this->defaultForeign();
|
$this->defaultForeign();
|
||||||
} elseif(in_array($this->client_subregion, $this->eu_country_codes) && ((strlen($this->client->vat_number ?? '') == 1) || $this->client->has_valid_vat_number)) { //eu country / no valid vat
|
} elseif(in_array($this->client_subregion, $this->eu_country_codes) && ((strlen($this->client->vat_number ?? '') == 1) || !$this->client->has_valid_vat_number)) { //eu country / no valid vat
|
||||||
// if(($this->client->company->tax_data->seller_subregion != $this->client_subregion) && $this->client->company->tax_data->regions->EU->has_sales_above_threshold) {
|
|
||||||
if($this->client->company->tax_data->seller_subregion != $this->client_subregion) {
|
if($this->client->company->tax_data->seller_subregion != $this->client_subregion) {
|
||||||
// nlog("eu zone with sales above threshold");
|
// nlog("eu zone with sales above threshold");
|
||||||
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->country->iso_3166_2}->tax_rate ?? 0;
|
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->country->iso_3166_2}->tax_rate ?? 0;
|
||||||
|
@ -34,10 +34,10 @@ class TaxModel
|
|||||||
if(!$model) {
|
if(!$model) {
|
||||||
$this->regions = $this->init();
|
$this->regions = $this->init();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//@phpstan-ignore-next-line
|
//@phpstan-ignore-next-line
|
||||||
foreach($model as $key => $value) {
|
foreach($model as $key => $value) {
|
||||||
$this->{$key} = $value;
|
$this->{$key} = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -48,8 +48,7 @@ class TaxModel
|
|||||||
public function migrate(): self
|
public function migrate(): self
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->version == 'alpha')
|
if($this->version == 'alpha') {
|
||||||
{
|
|
||||||
$this->regions->EU->subregions->PL = new \stdClass();
|
$this->regions->EU->subregions->PL = new \stdClass();
|
||||||
$this->regions->EU->subregions->PL->tax_rate = 23;
|
$this->regions->EU->subregions->PL->tax_rate = 23;
|
||||||
$this->regions->EU->subregions->PL->tax_name = 'VAT';
|
$this->regions->EU->subregions->PL->tax_name = 'VAT';
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
namespace App\DataProviders;
|
namespace App\DataProviders;
|
||||||
|
|
||||||
final class CAProvinces {
|
final class CAProvinces
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* The provinces and territories of Canada
|
* The provinces and territories of Canada
|
||||||
*
|
*
|
||||||
@ -39,7 +40,8 @@ final class CAProvinces {
|
|||||||
* @param string $abbreviation
|
* @param string $abbreviation
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getName($abbreviation) {
|
public static function getName($abbreviation)
|
||||||
|
{
|
||||||
return self::$provinces[$abbreviation];
|
return self::$provinces[$abbreviation];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +50,8 @@ final class CAProvinces {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function get() {
|
public static function get()
|
||||||
|
{
|
||||||
return self::$provinces;
|
return self::$provinces;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +61,8 @@ final class CAProvinces {
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getAbbreviation($name) {
|
public static function getAbbreviation($name)
|
||||||
|
{
|
||||||
return array_search(ucwords($name), self::$provinces);
|
return array_search(ucwords($name), self::$provinces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class ClientWasArchived implements ShouldBroadcast
|
|||||||
|
|
||||||
public function broadcastWith()
|
public function broadcastWith()
|
||||||
{
|
{
|
||||||
|
|
||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$class = sprintf('App\\Transformers\\%sTransformer', class_basename($this->client));
|
$class = sprintf('App\\Transformers\\%sTransformer', class_basename($this->client));
|
||||||
@ -79,7 +79,7 @@ class ClientWasArchived implements ShouldBroadcast
|
|||||||
*/
|
*/
|
||||||
public function broadcastOn()
|
public function broadcastOn()
|
||||||
{
|
{
|
||||||
|
|
||||||
return [
|
return [
|
||||||
new PrivateChannel("company-{$this->company->company_key}"),
|
new PrivateChannel("company-{$this->company->company_key}"),
|
||||||
];
|
];
|
||||||
|
@ -39,6 +39,6 @@ class DuplicatePaymentException extends Exception
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Duplicate request',
|
'message' => 'Duplicate request',
|
||||||
], 400);
|
], 400);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ class ActivityExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($entity) {
|
->each(function ($entity) {
|
||||||
|
|
||||||
/** @var \App\Models\Activity $entity */
|
/** @var \App\Models\Activity $entity */
|
||||||
|
|
||||||
$this->buildRow($entity);
|
$this->buildRow($entity);
|
||||||
});
|
});
|
||||||
|
@ -1041,7 +1041,7 @@ class BaseExport
|
|||||||
|
|
||||||
$recurring_filters = [];
|
$recurring_filters = [];
|
||||||
|
|
||||||
if($this->company->getSetting('report_include_drafts')){
|
if($this->company->getSetting('report_include_drafts')) {
|
||||||
$recurring_filters[] = RecurringInvoice::STATUS_DRAFT;
|
$recurring_filters[] = RecurringInvoice::STATUS_DRAFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1189,7 +1189,7 @@ class BaseExport
|
|||||||
*/
|
*/
|
||||||
protected function addInvoiceStatusFilter(Builder $query, string $status): Builder
|
protected function addInvoiceStatusFilter(Builder $query, string $status): Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var array $status_parameters */
|
/** @var array $status_parameters */
|
||||||
$status_parameters = explode(',', $status);
|
$status_parameters = explode(',', $status);
|
||||||
|
|
||||||
@ -1270,7 +1270,7 @@ class BaseExport
|
|||||||
$custom_start_date = now()->startOfYear();
|
$custom_start_date = now()->startOfYear();
|
||||||
$custom_end_date = now();
|
$custom_end_date = now();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($date_range) {
|
switch ($date_range) {
|
||||||
case 'all':
|
case 'all':
|
||||||
$this->start_date = 'All available data';
|
$this->start_date = 'All available data';
|
||||||
@ -1616,10 +1616,10 @@ class BaseExport
|
|||||||
ZipDocuments::dispatch($documents, $this->company, $user);
|
ZipDocuments::dispatch($documents, $this->company, $user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that the column exists
|
* Tests that the column exists
|
||||||
* on the table prior to adding it to
|
* on the table prior to adding it to
|
||||||
* the query builder
|
* the query builder
|
||||||
*
|
*
|
||||||
* @param string $table
|
* @param string $table
|
||||||
|
@ -102,7 +102,7 @@ class ClientExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($client) {
|
->map(function ($client) {
|
||||||
|
|
||||||
/** @var \App\Models\Client $client */
|
/** @var \App\Models\Client $client */
|
||||||
$row = $this->buildRow($client);
|
$row = $this->buildRow($client);
|
||||||
return $this->processMetaData($row, $client);
|
return $this->processMetaData($row, $client);
|
||||||
@ -133,7 +133,7 @@ class ClientExport extends BaseExport
|
|||||||
$query->where('is_deleted', 0);
|
$query->where('is_deleted', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $this->addDateRange($query,' clients');
|
$query = $this->addDateRange($query, ' clients');
|
||||||
|
|
||||||
if($this->input['document_email_attachment'] ?? false) {
|
if($this->input['document_email_attachment'] ?? false) {
|
||||||
$this->queueDocuments($query);
|
$this->queueDocuments($query);
|
||||||
@ -156,8 +156,8 @@ class ClientExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($client) {
|
->each(function ($client) {
|
||||||
|
|
||||||
/** @var \App\Models\Client $client */
|
/** @var \App\Models\Client $client */
|
||||||
$this->csv->insertOne($this->buildRow($client));
|
$this->csv->insertOne($this->buildRow($client));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class CreditExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($credit) {
|
->map(function ($credit) {
|
||||||
|
|
||||||
/** @var \App\Models\Credit $credit */
|
/** @var \App\Models\Credit $credit */
|
||||||
$row = $this->buildRow($credit);
|
$row = $this->buildRow($credit);
|
||||||
return $this->processMetaData($row, $credit);
|
return $this->processMetaData($row, $credit);
|
||||||
|
@ -54,7 +54,7 @@ class DocumentExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($document) {
|
->map(function ($document) {
|
||||||
|
|
||||||
/** @var \App\Models\Document $document */
|
/** @var \App\Models\Document $document */
|
||||||
$row = $this->buildRow($document);
|
$row = $this->buildRow($document);
|
||||||
return $this->processMetaData($row, $document);
|
return $this->processMetaData($row, $document);
|
||||||
@ -101,7 +101,7 @@ class DocumentExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($entity) {
|
->each(function ($entity) {
|
||||||
/** @var mixed $entity */
|
/** @var mixed $entity */
|
||||||
$this->csv->insertOne($this->buildRow($entity));
|
$this->csv->insertOne($this->buildRow($entity));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class ExpenseExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Expense $resource */
|
/** @var \App\Models\Expense $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -134,7 +134,7 @@ class ExpenseExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($expense) {
|
->each(function ($expense) {
|
||||||
|
|
||||||
/** @var \App\Models\Expense $expense */
|
/** @var \App\Models\Expense $expense */
|
||||||
$this->csv->insertOne($this->buildRow($expense));
|
$this->csv->insertOne($this->buildRow($expense));
|
||||||
});
|
});
|
||||||
@ -266,11 +266,10 @@ class ExpenseExport extends BaseExport
|
|||||||
if($expense->calculate_tax_by_amount) {
|
if($expense->calculate_tax_by_amount) {
|
||||||
|
|
||||||
$total_tax_amount = round($expense->tax_amount1 + $expense->tax_amount2 + $expense->tax_amount3, $precision);
|
$total_tax_amount = round($expense->tax_amount1 + $expense->tax_amount2 + $expense->tax_amount3, $precision);
|
||||||
|
|
||||||
if($expense->uses_inclusive_taxes) {
|
if($expense->uses_inclusive_taxes) {
|
||||||
$entity['expense.net_amount'] = round($expense->amount, $precision) - $total_tax_amount;
|
$entity['expense.net_amount'] = round($expense->amount, $precision) - $total_tax_amount;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$entity['expense.net_amount'] = round($expense->amount, $precision);
|
$entity['expense.net_amount'] = round($expense->amount, $precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class InvoiceExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Invoice $resource */
|
/** @var \App\Models\Invoice $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -121,7 +121,7 @@ class InvoiceExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($invoice) {
|
->each(function ($invoice) {
|
||||||
|
|
||||||
/** @var \App\Models\Invoice $invoice */
|
/** @var \App\Models\Invoice $invoice */
|
||||||
$this->csv->insertOne($this->buildRow($invoice));
|
$this->csv->insertOne($this->buildRow($invoice));
|
||||||
});
|
});
|
||||||
|
@ -113,7 +113,7 @@ class InvoiceItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($resource) {
|
->each(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Invoice $resource */
|
/** @var \App\Models\Invoice $resource */
|
||||||
$this->iterateItems($resource);
|
$this->iterateItems($resource);
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ class InvoiceItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($invoice) {
|
->each(function ($invoice) {
|
||||||
|
|
||||||
/** @var \App\Models\Invoice $invoice */
|
/** @var \App\Models\Invoice $invoice */
|
||||||
$this->iterateItems($invoice);
|
$this->iterateItems($invoice);
|
||||||
});
|
});
|
||||||
@ -262,9 +262,9 @@ class InvoiceItemExport extends BaseExport
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('invoice.project', $this->input['report_keys'])) {
|
if (in_array('invoice.project', $this->input['report_keys'])) {
|
||||||
$entity['invoice.project'] = $invoice->project ? $invoice->project->name : '';// @phpstan-ignore-line
|
$entity['invoice.project'] = $invoice->project ? $invoice->project->name : '';// @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class PaymentExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Payment $resource */
|
/** @var \App\Models\Payment $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -114,8 +114,8 @@ class PaymentExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($entity) {
|
->each(function ($entity) {
|
||||||
|
|
||||||
/** @var \App\Models\Payment $entity */
|
/** @var \App\Models\Payment $entity */
|
||||||
$this->csv->insertOne($this->buildRow($entity));
|
$this->csv->insertOne($this->buildRow($entity));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class ProductExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Product $resource */
|
/** @var \App\Models\Product $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -106,8 +106,8 @@ class ProductExport extends BaseExport
|
|||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($entity) {
|
->each(function ($entity) {
|
||||||
|
|
||||||
/** @var \App\Models\Product $entity */
|
/** @var \App\Models\Product $entity */
|
||||||
$this->csv->insertOne($this->buildRow($entity));
|
$this->csv->insertOne($this->buildRow($entity));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->csv->toString();
|
return $this->csv->toString();
|
||||||
|
@ -98,7 +98,7 @@ class PurchaseOrderExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\PurchaseOrder $resource */
|
/** @var \App\Models\PurchaseOrder $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -121,9 +121,9 @@ class PurchaseOrderExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($purchase_order) {
|
->each(function ($purchase_order) {
|
||||||
|
|
||||||
/** @var \App\Models\PurchaseOrder $purchase_order */
|
/** @var \App\Models\PurchaseOrder $purchase_order */
|
||||||
$this->csv->insertOne($this->buildRow($purchase_order));
|
$this->csv->insertOne($this->buildRow($purchase_order));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->csv->toString();
|
return $this->csv->toString();
|
||||||
|
@ -101,15 +101,15 @@ class PurchaseOrderItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($resource) {
|
->each(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\PurchaseOrder $resource */
|
|
||||||
$this->iterateItems($resource);
|
|
||||||
|
|
||||||
foreach($this->storage_array as $row) {
|
/** @var \App\Models\PurchaseOrder $resource */
|
||||||
$this->storage_item_array[] = $this->processItemMetaData($row, $resource);
|
$this->iterateItems($resource);
|
||||||
}
|
|
||||||
|
|
||||||
$this->storage_array = [];
|
foreach($this->storage_array as $row) {
|
||||||
|
$this->storage_item_array[] = $this->processItemMetaData($row, $resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->storage_array = [];
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -129,9 +129,9 @@ class PurchaseOrderItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($purchase_order) {
|
->each(function ($purchase_order) {
|
||||||
|
|
||||||
/** @var \App\Models\PurchaseOrder $purchase_order */
|
/** @var \App\Models\PurchaseOrder $purchase_order */
|
||||||
$this->iterateItems($purchase_order);
|
$this->iterateItems($purchase_order);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->csv->insertAll($this->storage_array);
|
$this->csv->insertAll($this->storage_array);
|
||||||
|
@ -127,7 +127,7 @@ class QuoteExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($quote) {
|
->each(function ($quote) {
|
||||||
|
|
||||||
/** @var \App\Models\Quote $quote */
|
/** @var \App\Models\Quote $quote */
|
||||||
$this->csv->insertOne($this->buildRow($quote));
|
$this->csv->insertOne($this->buildRow($quote));
|
||||||
});
|
});
|
||||||
|
@ -104,7 +104,7 @@ class QuoteItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($resource) {
|
->each(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Quote $resource */
|
/** @var \App\Models\Quote $resource */
|
||||||
$this->iterateItems($resource);
|
$this->iterateItems($resource);
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class QuoteItemExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($quote) {
|
->each(function ($quote) {
|
||||||
|
|
||||||
/** @var \App\Models\Quote $quote */
|
/** @var \App\Models\Quote $quote */
|
||||||
$this->iterateItems($quote);
|
$this->iterateItems($quote);
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@ class RecurringInvoiceExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($invoice) {
|
->each(function ($invoice) {
|
||||||
|
|
||||||
/** @var \App\Models\RecurringInvoice $invoice */
|
/** @var \App\Models\RecurringInvoice $invoice */
|
||||||
$this->csv->insertOne($this->buildRow($invoice));
|
$this->csv->insertOne($this->buildRow($invoice));
|
||||||
});
|
});
|
||||||
@ -114,7 +114,7 @@ class RecurringInvoiceExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\RecurringInvoice $resource */
|
/** @var \App\Models\RecurringInvoice $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
|
@ -106,9 +106,9 @@ class TaskExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($entity) {
|
->each(function ($entity) {
|
||||||
|
|
||||||
/** @var \App\Models\Task $entity*/
|
/** @var \App\Models\Task $entity*/
|
||||||
$this->buildRow($entity);
|
$this->buildRow($entity);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->csv->insertAll($this->storage_array);
|
$this->csv->insertAll($this->storage_array);
|
||||||
@ -209,7 +209,7 @@ class TaskExport extends BaseExport
|
|||||||
$entity['task.duration_words'] = $seconds > 86400 ? CarbonInterval::seconds($seconds)->locale($this->company->locale())->cascade()->forHumans() : now()->startOfDay()->addSeconds($seconds)->format('H:i:s');
|
$entity['task.duration_words'] = $seconds > 86400 ? CarbonInterval::seconds($seconds)->locale($this->company->locale())->cascade()->forHumans() : now()->startOfDay()->addSeconds($seconds)->format('H:i:s');
|
||||||
|
|
||||||
$entity['task.time_log'] = (isset($item[1]) && $item[1] != 0) ? $item[1] - $item[0] : ctrans('texts.is_running');
|
$entity['task.time_log'] = (isset($item[1]) && $item[1] != 0) ? $item[1] - $item[0] : ctrans('texts.is_running');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('task.billable', $this->input['report_keys']) || in_array('billable', $this->input['report_keys'])) {
|
if (in_array('task.billable', $this->input['report_keys']) || in_array('billable', $this->input['report_keys'])) {
|
||||||
|
@ -90,7 +90,7 @@ class VendorExport extends BaseExport
|
|||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
|
|
||||||
/** @var \App\Models\Vendor $resource */
|
/** @var \App\Models\Vendor $resource */
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
return $this->processMetaData($row, $resource);
|
return $this->processMetaData($row, $resource);
|
||||||
@ -109,9 +109,9 @@ class VendorExport extends BaseExport
|
|||||||
|
|
||||||
$query->cursor()
|
$query->cursor()
|
||||||
->each(function ($vendor) {
|
->each(function ($vendor) {
|
||||||
|
|
||||||
/** @var \App\Models\Vendor $vendor */
|
/** @var \App\Models\Vendor $vendor */
|
||||||
$this->csv->insertOne($this->buildRow($vendor));
|
$this->csv->insertOne($this->buildRow($vendor));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->csv->toString();
|
return $this->csv->toString();
|
||||||
|
@ -96,7 +96,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
|||||||
return '';
|
return '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* billable
|
* billable
|
||||||
*
|
*
|
||||||
@ -106,7 +106,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
|||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* items_notes
|
* items_notes
|
||||||
* @todo
|
* @todo
|
||||||
@ -115,7 +115,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
|||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function duration(Task $task)
|
public function duration(Task $task)
|
||||||
{
|
{
|
||||||
return $task->calcDuration();
|
return $task->calcDuration();
|
||||||
|
@ -149,43 +149,43 @@ class RecurringExpenseToExpenseFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if (Str::contains($match, '|')) {
|
// if (Str::contains($match, '|')) {
|
||||||
$parts = explode('|', $match); // [ '[MONTH', 'MONTH+2]' ]
|
$parts = explode('|', $match); // [ '[MONTH', 'MONTH+2]' ]
|
||||||
|
|
||||||
$left = substr($parts[0], 1); // 'MONTH'
|
$left = substr($parts[0], 1); // 'MONTH'
|
||||||
$right = substr($parts[1], 0, -1); // MONTH+2
|
$right = substr($parts[1], 0, -1); // MONTH+2
|
||||||
|
|
||||||
// If left side is not part of replacements, skip.
|
// If left side is not part of replacements, skip.
|
||||||
if (! array_key_exists($left, $replacements['ranges'])) {
|
if (! array_key_exists($left, $replacements['ranges'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_left = Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F Y');
|
$_left = Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F Y');
|
||||||
$_right = '';
|
$_right = '';
|
||||||
|
|
||||||
// If right side doesn't have any calculations, replace with raw ranges keyword.
|
// If right side doesn't have any calculations, replace with raw ranges keyword.
|
||||||
if (! Str::contains($right, ['-', '+', '/', '*'])) {
|
if (! Str::contains($right, ['-', '+', '/', '*'])) {
|
||||||
$_right = Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F Y');
|
$_right = Carbon::createFromDate(now()->year, now()->month)->translatedFormat('F Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If right side contains one of math operations, calculate.
|
// If right side contains one of math operations, calculate.
|
||||||
if (Str::contains($right, ['+'])) {
|
if (Str::contains($right, ['+'])) {
|
||||||
$operation = preg_match_all('/(?!^-)[+*\/-](\s?-)?/', $right, $_matches);
|
$operation = preg_match_all('/(?!^-)[+*\/-](\s?-)?/', $right, $_matches);
|
||||||
|
|
||||||
$_operation = array_shift($_matches)[0]; // + -
|
$_operation = array_shift($_matches)[0]; // + -
|
||||||
|
|
||||||
$_value = explode($_operation, $right); // [MONTHYEAR, 4]
|
$_value = explode($_operation, $right); // [MONTHYEAR, 4]
|
||||||
|
|
||||||
$_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line
|
$_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
$replacement = sprintf('%s to %s', $_left, $_right);
|
$replacement = sprintf('%s to %s', $_left, $_right);
|
||||||
|
|
||||||
$value = preg_replace(
|
$value = preg_replace(
|
||||||
sprintf('/%s/', preg_quote($match)),
|
sprintf('/%s/', preg_quote($match)),
|
||||||
$replacement,
|
$replacement,
|
||||||
$value,
|
$value,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class CreditFilters extends QueryFilters
|
|||||||
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
||||||
), '$[*]')
|
), '$[*]')
|
||||||
) LIKE ?", ['%'.$filter.'%']);
|
) LIKE ?", ['%'.$filter.'%']);
|
||||||
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +162,9 @@ class ExpenseFilters extends QueryFilters
|
|||||||
{
|
{
|
||||||
$categories_exploded = explode(",", $categories);
|
$categories_exploded = explode(",", $categories);
|
||||||
|
|
||||||
if(empty($categories) || count(array_filter($categories_exploded)) == 0)
|
if(empty($categories) || count(array_filter($categories_exploded)) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
$categories_keys = $this->transformKeys($categories_exploded);
|
$categories_keys = $this->transformKeys($categories_exploded);
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
||||||
), '$[*]')
|
), '$[*]')
|
||||||
) LIKE ?", ['%'.$filter.'%']);
|
) LIKE ?", ['%'.$filter.'%']);
|
||||||
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class QuoteFilters extends QueryFilters
|
|||||||
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
||||||
), '$[*]')
|
), '$[*]')
|
||||||
) LIKE ?", ['%'.$filter.'%']);
|
) LIKE ?", ['%'.$filter.'%']);
|
||||||
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
// ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||||||
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].product_key'))
|
||||||
), '$[*]')
|
), '$[*]')
|
||||||
) LIKE ?", ['%'.$filter.'%']);
|
) LIKE ?", ['%'.$filter.'%']);
|
||||||
//->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
//->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||||||
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
|
return $this->builder->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sort_col[0] == 'status_id'){
|
if($sort_col[0] == 'status_id') {
|
||||||
return $this->builder->orderBy('status_id', $dir)->orderBy('last_sent_date', $dir);
|
return $this->builder->orderBy('status_id', $dir)->orderBy('last_sent_date', $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class TransactionTransformer implements BankRevenueInterface
|
|||||||
|
|
||||||
/** @var \App\Models\Currency $currency */
|
/** @var \App\Models\Currency $currency */
|
||||||
return $currency ? $currency->id : 1; //@phpstan-ignore-line
|
return $currency ? $currency->id : 1; //@phpstan-ignore-line
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatDate(string $input)
|
private function formatDate(string $input)
|
||||||
|
@ -61,7 +61,7 @@ class EpcQrGenerator
|
|||||||
} catch(\Throwable $e) {
|
} catch(\Throwable $e) {
|
||||||
nlog("EPC QR failure => ".$e->getMessage());
|
nlog("EPC QR failure => ".$e->getMessage());
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class InvoiceSumInclusive
|
|||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->client = $invoice->client ?? $invoice->vendor;
|
$this->client = $invoice->client ?? $invoice->vendor;
|
||||||
|
|
||||||
$this->precision = $this->client->currency()->precision;
|
$this->precision = $this->client->currency()->precision;
|
||||||
$this->rappen_rounding = $this->client->getSetting('enable_rappen_rounding');
|
$this->rappen_rounding = $this->client->getSetting('enable_rappen_rounding');
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class GmailTransport extends AbstractTransport
|
|||||||
if ($bccs) {
|
if ($bccs) {
|
||||||
$bcc_list = 'Bcc: ';
|
$bcc_list = 'Bcc: ';
|
||||||
|
|
||||||
foreach ($bccs->getAddresses() as $address) {
|
foreach ($bccs->getAddresses() as $address) {
|
||||||
|
|
||||||
$bcc_list .= $address->getAddress() .',';
|
$bcc_list .= $address->getAddress() .',';
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class ActivityController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* downloadHistoricalEntity
|
* downloadHistoricalEntity
|
||||||
*
|
*
|
||||||
@ -204,7 +204,7 @@ class ActivityController extends BaseController
|
|||||||
$activity->user_id = $user->id;
|
$activity->user_id = $user->id;
|
||||||
$activity->ip = $request->ip();
|
$activity->ip = $request->ip();
|
||||||
$activity->activity_type_id = Activity::USER_NOTE;
|
$activity->activity_type_id = Activity::USER_NOTE;
|
||||||
|
|
||||||
switch (get_class($entity)) {
|
switch (get_class($entity)) {
|
||||||
case Invoice::class:
|
case Invoice::class:
|
||||||
$activity->invoice_id = $entity->id;
|
$activity->invoice_id = $entity->id;
|
||||||
@ -254,17 +254,20 @@ class ActivityController extends BaseController
|
|||||||
$activity->client_id = $entity->client_id;
|
$activity->client_id = $entity->client_id;
|
||||||
$activity->project_id = $entity->project_id;
|
$activity->project_id = $entity->project_id;
|
||||||
$activity->vendor_id = $entity->vendor_id;
|
$activity->vendor_id = $entity->vendor_id;
|
||||||
|
// no break
|
||||||
case Task::class:
|
case Task::class:
|
||||||
$activity->task_id = $entity->id;
|
$activity->task_id = $entity->id;
|
||||||
$activity->expense_id = $entity->id;
|
$activity->expense_id = $entity->id;
|
||||||
$activity->client_id = $entity->client_id;
|
$activity->client_id = $entity->client_id;
|
||||||
$activity->project_id = $entity->project_id;
|
$activity->project_id = $entity->project_id;
|
||||||
$activity->vendor_id = $entity->vendor_id;
|
$activity->vendor_id = $entity->vendor_id;
|
||||||
|
// no break
|
||||||
case Payment::class:
|
case Payment::class:
|
||||||
$activity->payment_id = $entity->id;
|
$activity->payment_id = $entity->id;
|
||||||
$activity->expense_id = $entity->id;
|
$activity->expense_id = $entity->id;
|
||||||
$activity->client_id = $entity->client_id;
|
$activity->client_id = $entity->client_id;
|
||||||
$activity->project_id = $entity->project_id;
|
$activity->project_id = $entity->project_id;
|
||||||
|
// no break
|
||||||
default:
|
default:
|
||||||
# code...
|
# code...
|
||||||
break;
|
break;
|
||||||
|
@ -41,9 +41,10 @@ class ContactLoginController extends Controller
|
|||||||
$company = false;
|
$company = false;
|
||||||
$account = false;
|
$account = false;
|
||||||
|
|
||||||
if($request->query('intended'))
|
if($request->query('intended')) {
|
||||||
$request->session()->put('url.intended', $request->query('intended'));
|
$request->session()->put('url.intended', $request->query('intended'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->session()->has('company_key')) {
|
if ($request->session()->has('company_key')) {
|
||||||
MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
|
MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
|
||||||
$company = Company::where('company_key', $request->session()->get('company_key'))->first();
|
$company = Company::where('company_key', $request->session()->get('company_key'))->first();
|
||||||
@ -141,9 +142,10 @@ class ContactLoginController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->setRedirectPath();
|
$this->setRedirectPath();
|
||||||
|
|
||||||
if($intended)
|
if($intended) {
|
||||||
$this->redirectTo = $intended;
|
$this->redirectTo = $intended;
|
||||||
|
}
|
||||||
|
|
||||||
return $request->wantsJson()
|
return $request->wantsJson()
|
||||||
? new JsonResponse([], 204)
|
? new JsonResponse([], 204)
|
||||||
|
@ -399,8 +399,8 @@ class LoginController extends BaseController
|
|||||||
$truth->setCompany($set_company);
|
$truth->setCompany($set_company);
|
||||||
|
|
||||||
//21-03-2024
|
//21-03-2024
|
||||||
|
|
||||||
|
|
||||||
$cu->each(function ($cu) {
|
$cu->each(function ($cu) {
|
||||||
/** @var \App\Models\CompanyUser $cu */
|
/** @var \App\Models\CompanyUser $cu */
|
||||||
if(CompanyToken::query()->where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) {
|
if(CompanyToken::query()->where('company_id', $cu->company_id)->where('user_id', $cu->user_id)->where('is_system', true)->doesntExist()) {
|
||||||
|
@ -217,7 +217,7 @@ class BankIntegrationController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $user_account->isEnterprisePaidClient()))) {
|
if (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key') && (Ninja::isSelfHost() || (Ninja::isHosted() && $user_account->isEnterprisePaidClient()))) {
|
||||||
$user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) {
|
$user_account->bank_integrations->where("integration_type", BankIntegration::INTEGRATION_TYPE_NORDIGEN)->each(function ($bank_integration) {
|
||||||
/** @var \App\Models\BankIntegration $bank_integration */
|
/** @var \App\Models\BankIntegration $bank_integration */
|
||||||
ProcessBankTransactionsNordigen::dispatch($bank_integration);
|
ProcessBankTransactionsNordigen::dispatch($bank_integration);
|
||||||
});
|
});
|
||||||
|
@ -934,7 +934,7 @@ class BaseController extends Controller
|
|||||||
} elseif (in_array($this->entity_type, [Design::class, GroupSetting::class, PaymentTerm::class, TaskStatus::class])) {
|
} elseif (in_array($this->entity_type, [Design::class, GroupSetting::class, PaymentTerm::class, TaskStatus::class])) {
|
||||||
// nlog($this->entity_type);
|
// nlog($this->entity_type);
|
||||||
} else {
|
} else {
|
||||||
$query->where(function ($q) use ($user){ //grouping these together improves query performance significantly)
|
$query->where(function ($q) use ($user) { //grouping these together improves query performance significantly)
|
||||||
$q->where('user_id', '=', $user->id)->orWhere('assigned_user_id', $user->id);
|
$q->where('user_id', '=', $user->id)->orWhere('assigned_user_id', $user->id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -996,7 +996,7 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
if(request()->has('einvoice')) {
|
if(request()->has('einvoice')) {
|
||||||
|
|
||||||
if(class_exists(Schema::class)){
|
if(class_exists(Schema::class)) {
|
||||||
$ro = new Schema();
|
$ro = new Schema();
|
||||||
$response_data['einvoice_schema'] = $ro('Peppol');
|
$response_data['einvoice_schema'] = $ro('Peppol');
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class BrevoController extends BaseController
|
class BrevoController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ class ChartController extends BaseController
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$cs = new ChartService($user->company(), $user, $user->isAdmin());
|
$cs = new ChartService($user->company(), $user, $user->isAdmin());
|
||||||
$result = $cs->getCalculatedField($request->all());
|
$result = $cs->getCalculatedField($request->all());
|
||||||
|
|
||||||
return response()->json($result, 200);
|
return response()->json($result, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,8 +114,8 @@ class InvitationController extends Controller
|
|||||||
'invitation_key' => $invitation_key
|
'invitation_key' => $invitation_key
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!auth()->guard('contact')->check()){
|
if(!auth()->guard('contact')->check()) {
|
||||||
$this->middleware('auth:contact');
|
$this->middleware('auth:contact');
|
||||||
return redirect()->route('client.login', ['intended' => route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key}), 'silent' => $is_silent])]);
|
return redirect()->route('client.login', ['intended' => route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key}), 'silent' => $is_silent])]);
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ class InvitationController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function fireEntityViewedEvent($invitation, $entity_string)
|
private function fireEntityViewedEvent($invitation, $entity_string)
|
||||||
{
|
{
|
||||||
switch ($entity_string) {
|
switch ($entity_string) {
|
||||||
|
@ -62,6 +62,7 @@ class InvoiceController extends Controller
|
|||||||
|
|
||||||
$invitation = $invoice->invitations()->where('client_contact_id', auth()->guard('contact')->user()->id)->first();
|
$invitation = $invoice->invitations()->where('client_contact_id', auth()->guard('contact')->user()->id)->first();
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
if ($invitation && auth()->guard('contact') && ! session()->get('is_silent') && ! $invitation->viewed_date) {
|
if ($invitation && auth()->guard('contact') && ! session()->get('is_silent') && ! $invitation->viewed_date) {
|
||||||
$invitation->markViewed();
|
$invitation->markViewed();
|
||||||
|
|
||||||
@ -77,13 +78,17 @@ class InvoiceController extends Controller
|
|||||||
'key' => $invitation ? $invitation->key : false,
|
'key' => $invitation ? $invitation->key : false,
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
'variables' => $variables,
|
'variables' => $variables,
|
||||||
|
'invoices' => [$invoice->hashed_id],
|
||||||
|
'db' => $invoice->company->db,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($request->query('mode') === 'fullscreen') {
|
if ($request->query('mode') === 'fullscreen') {
|
||||||
return render('invoices.show-fullscreen', $data);
|
return render('invoices.show-fullscreen', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('invoices.show', $data);
|
return auth()->guard('contact')->user()->client->getSetting('payment_flow') == 'default' ? $this->render('invoices.show', $data) : $this->render('invoices.show_smooth', $data);
|
||||||
|
|
||||||
|
// return $this->render('invoices.show_smooth', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showBlob($hash)
|
public function showBlob($hash)
|
||||||
@ -235,9 +240,12 @@ class InvoiceController extends Controller
|
|||||||
'hashed_ids' => $invoices->pluck('hashed_id'),
|
'hashed_ids' => $invoices->pluck('hashed_id'),
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'variables' => $variables,
|
'variables' => $variables,
|
||||||
|
'invitation' => $invitation,
|
||||||
|
'db' => $invitation->company->db,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->render('invoices.payment', $data);
|
// return $this->render('invoices.payment', $data);
|
||||||
|
return auth()->guard('contact')->user()->client->getSetting('payment_flow') === 'default' ? $this->render('invoices.payment', $data) : $this->render('invoices.show_smooth_multi', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +80,7 @@ class NinjaPlanController extends Controller
|
|||||||
|
|
||||||
$data['intent'] = $setupIntent;
|
$data['intent'] = $setupIntent;
|
||||||
$data['client'] = Auth::guard('contact')->user()->client;
|
$data['client'] = Auth::guard('contact')->user()->client;
|
||||||
|
|
||||||
return $this->render('plan.trial', $data);
|
return $this->render('plan.trial', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class PaymentController extends Controller
|
|||||||
// if($payment_hash)
|
// if($payment_hash)
|
||||||
$invoice = $payment_hash->fee_invoice;
|
$invoice = $payment_hash->fee_invoice;
|
||||||
// else
|
// else
|
||||||
// $invoice = Invoice::with('client')->where('id',$payment_hash->fee_invoice_id)->orderBy('id','desc')->first();
|
// $invoice = Invoice::with('client')->where('id',$payment_hash->fee_invoice_id)->orderBy('id','desc')->first();
|
||||||
|
|
||||||
// $invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
|
// $invoice = Invoice::with('client')->find($payment_hash->fee_invoice_id);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class SubscriptionPurchaseController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function setLocale(string $locale): string
|
private function setLocale(string $locale): string
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Language> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Language> */
|
||||||
$languages = app('languages');
|
$languages = app('languages');
|
||||||
|
|
||||||
@ -104,6 +104,6 @@ class SubscriptionPurchaseController extends Controller
|
|||||||
});
|
});
|
||||||
|
|
||||||
return $record ? $record->locale : 'en';
|
return $record ? $record->locale : 'en';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,7 +707,7 @@ class CompanyController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
|
* @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@ -615,7 +615,7 @@ class CreditController extends BaseController
|
|||||||
return response()->streamDownload(function () use ($file) {
|
return response()->streamDownload(function () use ($file) {
|
||||||
echo $file;
|
echo $file;
|
||||||
}, $credit->numberFormatter() . '.pdf', ['Content-Type' => 'application/pdf']);
|
}, $credit->numberFormatter() . '.pdf', ['Content-Type' => 'application/pdf']);
|
||||||
|
|
||||||
case 'archive':
|
case 'archive':
|
||||||
$this->credit_repository->archive($credit);
|
$this->credit_repository->archive($credit);
|
||||||
|
|
||||||
|
@ -593,6 +593,6 @@ class ExpenseController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['message' => 'Processing....'], 200);
|
return response()->json(['message' => 'Processing....'], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Requests\Quickbooks\AuthorizedQuickbooksRequest;
|
use App\Http\Requests\Quickbooks\AuthorizedQuickbooksRequest;
|
||||||
use \Closure;
|
use Closure;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
@ -19,7 +19,6 @@ use App\Services\Import\Quickbooks\QuickbooksService;
|
|||||||
|
|
||||||
class ImportQuickbooksController extends BaseController
|
class ImportQuickbooksController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
private array $import_entities = [
|
private array $import_entities = [
|
||||||
'client' => 'Customer',
|
'client' => 'Customer',
|
||||||
'invoice' => 'Invoice',
|
'invoice' => 'Invoice',
|
||||||
@ -29,7 +28,7 @@ class ImportQuickbooksController extends BaseController
|
|||||||
|
|
||||||
public function onAuthorized(AuthorizedQuickbooksRequest $request)
|
public function onAuthorized(AuthorizedQuickbooksRequest $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
|
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
|
||||||
$company = $request->getCompany();
|
$company = $request->getCompany();
|
||||||
$qb = new QuickbooksService($company);
|
$qb = new QuickbooksService($company);
|
||||||
@ -39,18 +38,17 @@ class ImportQuickbooksController extends BaseController
|
|||||||
nlog($access_token_object); //OAuth2AccessToken
|
nlog($access_token_object); //OAuth2AccessToken
|
||||||
$company->quickbooks = $access_token_object;
|
$company->quickbooks = $access_token_object;
|
||||||
$company->save();
|
$company->save();
|
||||||
|
|
||||||
return response()->json(['message' => 'Success'], 200); //todo swapout for redirect to UI
|
return response()->json(['message' => 'Success'], 200); //todo swapout for redirect to UI
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function authorizeQuickbooks(AuthQuickbooksRequest $request, string $token)
|
public function authorizeQuickbooks(AuthQuickbooksRequest $request, string $token)
|
||||||
{
|
{
|
||||||
|
|
||||||
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
|
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
|
||||||
$company = $request->getCompany();
|
$company = $request->getCompany();
|
||||||
$qb = new QuickbooksService($company);
|
$qb = new QuickbooksService($company);
|
||||||
@ -65,7 +63,7 @@ class ImportQuickbooksController extends BaseController
|
|||||||
|
|
||||||
public function preimport(string $type, string $hash)
|
public function preimport(string $type, string $hash)
|
||||||
{
|
{
|
||||||
// Check for authorization otherwise
|
// Check for authorization otherwise
|
||||||
// Create a reference
|
// Create a reference
|
||||||
$data = [
|
$data = [
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
@ -74,17 +72,19 @@ class ImportQuickbooksController extends BaseController
|
|||||||
$this->getData($data);
|
$this->getData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getData($data) {
|
protected function getData($data)
|
||||||
|
{
|
||||||
|
|
||||||
$entity = $this->import_entities[$data['type']];
|
$entity = $this->import_entities[$data['type']];
|
||||||
$cache_name = "{$data['hash']}-{$data['type']}";
|
$cache_name = "{$data['hash']}-{$data['type']}";
|
||||||
// TODO: Get or put cache or DB?
|
// TODO: Get or put cache or DB?
|
||||||
if(! Cache::has($cache_name) )
|
if(! Cache::has($cache_name)) {
|
||||||
{
|
|
||||||
$contents = call_user_func([$this->service, "fetch{$entity}s"]);
|
$contents = call_user_func([$this->service, "fetch{$entity}s"]);
|
||||||
if($contents->isEmpty()) return;
|
if($contents->isEmpty()) {
|
||||||
|
return;
|
||||||
Cache::put($cache_name, base64_encode( $contents->toJson()), 600);
|
}
|
||||||
|
|
||||||
|
Cache::put($cache_name, base64_encode($contents->toJson()), 600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,20 +117,19 @@ class ImportQuickbooksController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function import(Request $request)
|
public function import(Request $request)
|
||||||
{
|
{
|
||||||
$hash = Str::random(32);
|
// $hash = Str::random(32);
|
||||||
foreach($request->input('import_types') as $type)
|
// foreach($request->input('import_types') as $type) {
|
||||||
{
|
// $this->preimport($type, $hash);
|
||||||
$this->preimport($type, $hash);
|
// }
|
||||||
}
|
// /** @var \App\Models\User $user */
|
||||||
/** @var \App\Models\User $user */
|
// // $user = auth()->user() ?? Auth::loginUsingId(60);
|
||||||
// $user = auth()->user() ?? Auth::loginUsingId(60);
|
// $data = ['import_types' => $request->input('import_types') ] + compact('hash');
|
||||||
$data = ['import_types' => $request->input('import_types') ] + compact('hash');
|
// if (Ninja::isHosted()) {
|
||||||
if (Ninja::isHosted()) {
|
// QuickbooksIngest::dispatch($data, $user->company());
|
||||||
QuickbooksIngest::dispatch( $data , $user->company() );
|
// } else {
|
||||||
} else {
|
// QuickbooksIngest::dispatch($data, $user->company());
|
||||||
QuickbooksIngest::dispatch($data, $user->company() );
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Processing'], 200);
|
// return response()->json(['message' => 'Processing'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
|
$invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
|
||||||
|
|
||||||
if ($invoices->count() == 0 ) {
|
if ($invoices->count() == 0) {
|
||||||
return response()->json(['message' => 'No Invoices Found']);
|
return response()->json(['message' => 'No Invoices Found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class MailgunWebhookController extends BaseController
|
class MailgunWebhookController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -35,7 +34,7 @@ class MailgunWebhookController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(\hash_equals(\hash_hmac('sha256', $input['signature']['timestamp'] . $input['signature']['token'], config('services.mailgun.webhook_signing_key')), $input['signature']['signature'])) {
|
if(\hash_equals(\hash_hmac('sha256', $input['signature']['timestamp'] . $input['signature']['token'], config('services.mailgun.webhook_signing_key')), $input['signature']['signature'])) {
|
||||||
ProcessMailgunWebhook::dispatch($request->all())->delay(rand(2,10));
|
ProcessMailgunWebhook::dispatch($request->all())->delay(rand(2, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['message' => 'Success.'], 200);
|
return response()->json(['message' => 'Success.'], 200);
|
||||||
|
@ -22,7 +22,6 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class OneTimeTokenController extends BaseController
|
class OneTimeTokenController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -25,7 +25,7 @@ class PaymentNotificationWebhookController extends Controller
|
|||||||
{
|
{
|
||||||
/** @var \App\Models\CompanyGateway $company_gateway */
|
/** @var \App\Models\CompanyGateway $company_gateway */
|
||||||
$company_gateway = CompanyGateway::find($this->decodePrimaryKey($company_gateway_id));
|
$company_gateway = CompanyGateway::find($this->decodePrimaryKey($company_gateway_id));
|
||||||
|
|
||||||
/** @var \App\Models\Client $client */
|
/** @var \App\Models\Client $client */
|
||||||
$client = Client::find($this->decodePrimaryKey($client_hash));
|
$client = Client::find($this->decodePrimaryKey($client_hash));
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class PostMarkController extends BaseController
|
class PostMarkController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -297,8 +297,7 @@ class PreviewController extends BaseController
|
|||||||
->setTemplate($design_object)
|
->setTemplate($design_object)
|
||||||
->mock();
|
->mock();
|
||||||
} catch(SyntaxError $e) {
|
} catch(SyntaxError $e) {
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
catch(\Exception $e) {
|
|
||||||
return response()->json(['message' => 'invalid data access', 'errors' => ['design.design.body' => $e->getMessage()]], 422);
|
return response()->json(['message' => 'invalid data access', 'errors' => ['design.design.body' => $e->getMessage()]], 422);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ class SearchController extends Controller
|
|||||||
// ->whereHas('client', function ($q) {
|
// ->whereHas('client', function ($q) {
|
||||||
// $q->where('is_deleted', 0);
|
// $q->where('is_deleted', 0);
|
||||||
// })
|
// })
|
||||||
|
|
||||||
->leftJoin('clients', function ($join) {
|
->leftJoin('clients', function ($join) {
|
||||||
$join->on('invoices.client_id', '=', 'clients.id')
|
$join->on('invoices.client_id', '=', 'clients.id')
|
||||||
->where('clients.is_deleted', 0);
|
->where('clients.is_deleted', 0);
|
||||||
})
|
})
|
||||||
|
|
||||||
->when(!$user->hasPermission('view_all') || !$user->hasPermission('view_invoice'), function ($query) use ($user) {
|
->when(!$user->hasPermission('view_all') || !$user->hasPermission('view_invoice'), function ($query) use ($user) {
|
||||||
$query->where('invoices.user_id', $user->id);
|
$query->where('invoices.user_id', $user->id);
|
||||||
})
|
})
|
||||||
|
@ -181,8 +181,9 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
public function checkVersion()
|
public function checkVersion()
|
||||||
{
|
{
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted()) {
|
||||||
return '5.10.SaaS';
|
return '5.10.SaaS';
|
||||||
|
}
|
||||||
|
|
||||||
return trim(file_get_contents(config('ninja.version_url')));
|
return trim(file_get_contents(config('ninja.version_url')));
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ class PurchaseOrderController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
event(new PurchaseOrderWasAccepted($purchase_order, auth()->guard('vendor')->user(), $purchase_order->company, Ninja::eventVars()));
|
event(new PurchaseOrderWasAccepted($purchase_order, auth()->guard('vendor')->user(), $purchase_order->company, Ninja::eventVars()));
|
||||||
|
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_ACCEPTED_PURCHASE_ORDER, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
|
WebhookHandler::dispatch(Webhook::EVENT_ACCEPTED_PURCHASE_ORDER, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ class VendorContactHashLoginController extends Controller
|
|||||||
{
|
{
|
||||||
return redirect($this->setRedirectPath());
|
return redirect($this->setRedirectPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* errorPage
|
* errorPage
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@ class ThrottleRequestsWithPredis extends \Illuminate\Routing\Middleware\Throttle
|
|||||||
* Create a new request throttler.
|
* Create a new request throttler.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @phpstan-ignore-next-line */
|
/** @phpstan-ignore-next-line */
|
||||||
public function __construct(RateLimiter $limiter, Redis $redis)
|
public function __construct(RateLimiter $limiter, Redis $redis)
|
||||||
{
|
{
|
||||||
@ -85,7 +85,10 @@ class ThrottleRequestsWithPredis extends \Illuminate\Routing\Middleware\Throttle
|
|||||||
protected function tooManyAttempts($key, $maxAttempts, $decaySeconds)
|
protected function tooManyAttempts($key, $maxAttempts, $decaySeconds)
|
||||||
{
|
{
|
||||||
$limiter = new DurationLimiter(
|
$limiter = new DurationLimiter(
|
||||||
$this->getRedisConnection(), $key, $maxAttempts, $decaySeconds
|
$this->getRedisConnection(),
|
||||||
|
$key,
|
||||||
|
$maxAttempts,
|
||||||
|
$decaySeconds
|
||||||
);
|
);
|
||||||
|
|
||||||
return tap(! $limiter->acquire(), function () use ($key, $limiter) {
|
return tap(! $limiter->acquire(), function () use ($key, $limiter) {
|
||||||
|
@ -68,11 +68,12 @@ class StoreNoteRequest extends Request
|
|||||||
|
|
||||||
public function getEntity()
|
public function getEntity()
|
||||||
{
|
{
|
||||||
if(!$this->entity)
|
if(!$this->entity) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$class = "\\App\\Models\\".ucfirst(Str::camel(rtrim($this->entity, 's')));
|
$class = "\\App\\Models\\".ucfirst(Str::camel(rtrim($this->entity, 's')));
|
||||||
return $class::withTrashed()->find(is_string($this->entity_id) ? $this->decodePrimaryKey($this->entity_id) : $this->entity_id);
|
return $class::withTrashed()->find(is_string($this->entity_id) ? $this->decodePrimaryKey($this->entity_id) : $this->entity_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,7 @@ class ShowCalculatedFieldRequest extends Request
|
|||||||
$input['end_date'] = now()->format('Y-m-d');
|
$input['end_date'] = now()->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($input['period']) && $input['period'] == 'previous')
|
if(isset($input['period']) && $input['period'] == 'previous') {
|
||||||
{
|
|
||||||
$dates = $this->calculatePreviousPeriodStartAndEndDates($input, $user->company());
|
$dates = $this->calculatePreviousPeriodStartAndEndDates($input, $user->company());
|
||||||
$input['start_date'] = $dates[0];
|
$input['start_date'] = $dates[0];
|
||||||
$input['end_date'] = $dates[1];
|
$input['end_date'] = $dates[1];
|
||||||
|
@ -200,7 +200,7 @@ class StoreClientRequest extends Request
|
|||||||
|
|
||||||
private function getCountryCode(string $country_code)
|
private function getCountryCode(string $country_code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
||||||
$countries = app('countries');
|
$countries = app('countries');
|
||||||
|
|
||||||
@ -209,12 +209,12 @@ class StoreClientRequest extends Request
|
|||||||
});
|
});
|
||||||
|
|
||||||
return $country ? (string) $country->id : '';
|
return $country ? (string) $country->id : '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCurrencyCode($code)
|
private function getCurrencyCode($code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Currency> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Currency> */
|
||||||
$currencies = app('currencies');
|
$currencies = app('currencies');
|
||||||
|
|
||||||
@ -223,6 +223,6 @@ class StoreClientRequest extends Request
|
|||||||
});
|
});
|
||||||
|
|
||||||
return $currency ? (string)$currency->id : '';
|
return $currency ? (string)$currency->id : '';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class UpdateClientRequest extends Request
|
|||||||
|
|
||||||
private function getCountryCode($country_code)
|
private function getCountryCode($country_code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
||||||
$countries = app('countries');
|
$countries = app('countries');
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ class UpdateClientRequest extends Request
|
|||||||
|
|
||||||
private function getLanguageId($language_code)
|
private function getLanguageId($language_code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Language> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Language> */
|
||||||
$languages = app('languages');
|
$languages = app('languages');
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class ShowCreditRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return ! $this->credit->is_deleted
|
return ! $this->credit->is_deleted
|
||||||
&& (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
|
&& (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
|
||||||
|
@ -19,7 +19,7 @@ class ProcessInvoicesInBulkRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
|
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
|
||||||
|
@ -23,7 +23,7 @@ class ShowInvoiceRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (int) auth()->guard('contact')->user()->client_id === (int) $this->invoice->client_id
|
return (int) auth()->guard('contact')->user()->client_id === (int) $this->invoice->client_id
|
||||||
|
@ -19,7 +19,7 @@ class ShowInvoicesRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
|
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
|
||||||
|
@ -18,7 +18,7 @@ class CreatePaymentMethodRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
||||||
$query->without('gateway_tokens', 'documents', 'contacts.company', 'contacts'); // Exclude 'grandchildren' relation of 'client'
|
$query->without('gateway_tokens', 'documents', 'contacts.company', 'contacts'); // Exclude 'grandchildren' relation of 'client'
|
||||||
}]);
|
}]);
|
||||||
|
@ -15,7 +15,7 @@ class StorePrePaymentRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
||||||
|
@ -21,7 +21,7 @@ class ProcessQuotesInBulkRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
|
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
|
||||||
|
@ -19,7 +19,7 @@ class ShowQuoteRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (int)auth()->guard('contact')->user()->client->id === (int) $this->quote->client_id
|
return (int)auth()->guard('contact')->user()->client->id === (int) $this->quote->client_id
|
||||||
|
@ -19,7 +19,7 @@ class ShowQuotesRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
|
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
|
||||||
|
@ -9,7 +9,7 @@ class RequestCancellationRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
auth()->guard('contact')->user()->loadMissing(['company']);
|
auth()->guard('contact')->user()->loadMissing(['company']);
|
||||||
|
|
||||||
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES);
|
return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES);
|
||||||
|
@ -22,7 +22,7 @@ class StoreUploadRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @phpstan-ignore-next-line **/
|
/** @phpstan-ignore-next-line **/
|
||||||
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
auth()->guard('contact')->user()->loadMissing(['client' => function ($query) {
|
||||||
$query->without('gateway_tokens', 'documents', 'contacts.company', 'contacts'); // Exclude 'grandchildren' relation of 'client'
|
$query->without('gateway_tokens', 'documents', 'contacts.company', 'contacts'); // Exclude 'grandchildren' relation of 'client'
|
||||||
|
@ -64,7 +64,7 @@ class StoreCreditRequest extends Request
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
|
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
|
||||||
|
|
||||||
$rules['invitations'] = 'sometimes|bail|array';
|
$rules['invitations'] = 'sometimes|bail|array';
|
||||||
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class UpdateCreditRequest extends Request
|
|||||||
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('credits')->where('company_id', $user->company()->id)->ignore($this->credit->id)];
|
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('credits')->where('company_id', $user->company()->id)->ignore($this->credit->id)];
|
||||||
|
|
||||||
$rules['client_id'] = ['bail', 'sometimes',Rule::in([$this->credit->client_id])];
|
$rules['client_id'] = ['bail', 'sometimes',Rule::in([$this->credit->client_id])];
|
||||||
|
|
||||||
$rules['invitations'] = 'sometimes|bail|array';
|
$rules['invitations'] = 'sometimes|bail|array';
|
||||||
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class UpdateExpenseRequest extends Request
|
|||||||
$rules['invoice_id'] = 'bail|sometimes|nullable|exists:invoices,id,company_id,'.$user->company()->id;
|
$rules['invoice_id'] = 'bail|sometimes|nullable|exists:invoices,id,company_id,'.$user->company()->id;
|
||||||
$rules['documents'] = 'bail|sometimes|array';
|
$rules['documents'] = 'bail|sometimes|array';
|
||||||
$rules['amount'] = ['sometimes', 'bail', 'nullable', 'numeric', 'max:99999999999999'];
|
$rules['amount'] = ['sometimes', 'bail', 'nullable', 'numeric', 'max:99999999999999'];
|
||||||
|
|
||||||
return $this->globalRules($rules);
|
return $this->globalRules($rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,12 @@ class BulkInvoiceRequest extends Request
|
|||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if(\Illuminate\Support\Facades\Cache::has($this->ip()."|".$this->input('action', 0)."|".$user->company()->company_key))
|
if(\Illuminate\Support\Facades\Cache::has($this->ip()."|".$this->input('action', 0)."|".$user->company()->company_key)) {
|
||||||
throw new DuplicatePaymentException('Duplicate request.', 429);
|
throw new DuplicatePaymentException('Duplicate request.', 429);
|
||||||
|
}
|
||||||
|
|
||||||
\Illuminate\Support\Facades\Cache::put(($this->ip()."|".$this->input('action', 0)."|".$user->company()->company_key), true, 1);
|
\Illuminate\Support\Facades\Cache::put(($this->ip()."|".$this->input('action', 0)."|".$user->company()->company_key), true, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class StoreInvoiceRequest extends Request
|
|||||||
|
|
||||||
public function prepareForValidation()
|
public function prepareForValidation()
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class StoreInvoiceRequest extends Request
|
|||||||
}
|
}
|
||||||
if(isset($input['partial']) && $input['partial'] == 0) {
|
if(isset($input['partial']) && $input['partial'] == 0) {
|
||||||
$input['partial_due_date'] = null;
|
$input['partial_due_date'] = null;
|
||||||
}
|
}
|
||||||
if (!isset($input['tax_rate1'])) {
|
if (!isset($input['tax_rate1'])) {
|
||||||
$input['tax_rate1'] = 0;
|
$input['tax_rate1'] = 0;
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,12 @@ class StorePaymentRequest extends Request
|
|||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if(\Illuminate\Support\Facades\Cache::has($this->ip()."|".$this->input('amount', 0)."|".$this->input('client_id', '')."|".$user->company()->company_key))
|
if(\Illuminate\Support\Facades\Cache::has($this->ip()."|".$this->input('amount', 0)."|".$this->input('client_id', '')."|".$user->company()->company_key)) {
|
||||||
throw new DuplicatePaymentException('Duplicate request.', 429);
|
throw new DuplicatePaymentException('Duplicate request.', 429);
|
||||||
|
}
|
||||||
|
|
||||||
\Illuminate\Support\Facades\Cache::put(($this->ip()."|".$this->input('amount', 0)."|".$this->input('client_id', '')."|".$user->company()->company_key), true, 1);
|
\Illuminate\Support\Facades\Cache::put(($this->ip()."|".$this->input('amount', 0)."|".$this->input('client_id', '')."|".$user->company()->company_key), true, 1);
|
||||||
|
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
$invoices_total = 0;
|
$invoices_total = 0;
|
||||||
|
@ -74,7 +74,7 @@ class PaymentWebhookRequest extends Request
|
|||||||
public function getCompany(): ?Company
|
public function getCompany(): ?Company
|
||||||
{
|
{
|
||||||
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
MultiDB::findAndSetDbByCompanyKey($this->company_key);
|
||||||
|
|
||||||
/** @var \App\Models\Company */
|
/** @var \App\Models\Company */
|
||||||
return Company::where('company_key', $this->company_key)->firstOrFail();
|
return Company::where('company_key', $this->company_key)->firstOrFail();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class PreviewInvoiceRequest extends Request
|
|||||||
public function resolveInvitation()
|
public function resolveInvitation()
|
||||||
{
|
{
|
||||||
$invitation = false;
|
$invitation = false;
|
||||||
|
|
||||||
/** @phpstan-ignore-next-line */
|
/** @phpstan-ignore-next-line */
|
||||||
if(! $this->entity_id ?? false) {
|
if(! $this->entity_id ?? false) {
|
||||||
return $this->stubInvitation();
|
return $this->stubInvitation();
|
||||||
|
@ -46,7 +46,7 @@ class StoreProjectRequest extends Request
|
|||||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
|
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
|
||||||
$rules['budgeted_hours'] = 'sometimes|numeric';
|
$rules['budgeted_hours'] = 'sometimes|numeric';
|
||||||
$rules['task_rate'] = 'required|bail|numeric';
|
$rules['task_rate'] = 'required|bail|numeric';
|
||||||
|
|
||||||
if (isset($this->number)) {
|
if (isset($this->number)) {
|
||||||
$rules['number'] = Rule::unique('projects')->where('company_id', $user->company()->id);
|
$rules['number'] = Rule::unique('projects')->where('company_id', $user->company()->id);
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ class StoreProjectRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input['task_rate'] = (isset($input['task_rate']) && floatval($input['task_rate']) >= 0) ? $input['task_rate'] : 0;
|
$input['task_rate'] = (isset($input['task_rate']) && floatval($input['task_rate']) >= 0) ? $input['task_rate'] : 0;
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class StorePurchaseOrderRequest extends Request
|
|||||||
|
|
||||||
$rules['number'] = ['nullable', Rule::unique('purchase_orders')->where('company_id', $user->company()->id)];
|
$rules['number'] = ['nullable', Rule::unique('purchase_orders')->where('company_id', $user->company()->id)];
|
||||||
|
|
||||||
|
|
||||||
$rules['invitations'] = 'sometimes|bail|array';
|
$rules['invitations'] = 'sometimes|bail|array';
|
||||||
$rules['invitations.*.vendor_contact_id'] = 'bail|required|distinct';
|
$rules['invitations.*.vendor_contact_id'] = 'bail|required|distinct';
|
||||||
|
|
||||||
|
@ -64,6 +64,6 @@ class AuthQuickbooksRequest extends FormRequest
|
|||||||
|
|
||||||
public function getCompany(): ?Company
|
public function getCompany(): ?Company
|
||||||
{
|
{
|
||||||
return Company::where('company_key', $this->getTokenContent()['company_key'])->firstOrFail();
|
return Company::query()->where('company_key', $this->getTokenContent()['company_key'])->firstOrFail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ class AuthorizedQuickbooksRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'code' => 'required|string',
|
'code' => 'required|string',
|
||||||
'state' => 'required|string',
|
'state' => 'required|string',
|
||||||
'realmId' => 'required|string',
|
'realmId' => 'required|string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class StoreQuoteRequest extends Request
|
|||||||
|
|
||||||
$rules = [];
|
$rules = [];
|
||||||
|
|
||||||
$rules['client_id'] = ['required', 'bail', Rule::exists('clients', 'id')->where('company_id', $user->company()->id)->where('is_deleted',0)];
|
$rules['client_id'] = ['required', 'bail', Rule::exists('clients', 'id')->where('company_id', $user->company()->id)->where('is_deleted', 0)];
|
||||||
|
|
||||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||||
$rules['documents.*'] = $this->fileValidation();
|
$rules['documents.*'] = $this->fileValidation();
|
||||||
@ -61,7 +61,7 @@ class StoreQuoteRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rules['number'] = ['bail','nullable', Rule::unique('quotes')->where('company_id', $user->company()->id)];
|
$rules['number'] = ['bail','nullable', Rule::unique('quotes')->where('company_id', $user->company()->id)];
|
||||||
|
|
||||||
$rules['invitations'] = 'sometimes|bail|array';
|
$rules['invitations'] = 'sometimes|bail|array';
|
||||||
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class UpdateQuoteRequest extends Request
|
|||||||
} elseif ($this->file('file')) {
|
} elseif ($this->file('file')) {
|
||||||
$rules['file'] = $this->fileValidation();
|
$rules['file'] = $this->fileValidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
$rules['invitations'] = 'sometimes|bail|array';
|
$rules['invitations'] = 'sometimes|bail|array';
|
||||||
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
$rules['invitations.*.client_contact_id'] = 'bail|required|distinct';
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class BulkRecurringExpenseRequest extends Request
|
|||||||
|
|
||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
return $user->can('edit', RecurringExpense::class);
|
return $user->can('edit', RecurringExpense::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ use Illuminate\Auth\Access\AuthorizationException;
|
|||||||
|
|
||||||
class GenericReportRequest extends Request
|
class GenericReportRequest extends Request
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
|
@ -155,7 +155,7 @@ class StoreShopClientRequest extends Request
|
|||||||
|
|
||||||
private function getCountryCode($country_code)
|
private function getCountryCode($country_code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
||||||
$countries = app('countries');
|
$countries = app('countries');
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class StoreShopClientRequest extends Request
|
|||||||
|
|
||||||
private function getCurrencyCode($code)
|
private function getCurrencyCode($code)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
/** @var \Illuminate\Support\Collection<\App\Models\Country> */
|
||||||
$currencies = app('currencies');
|
$currencies = app('currencies');
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class UpdateTaskRequest extends Request
|
|||||||
if(is_string($values)) {
|
if(is_string($values)) {
|
||||||
$values = json_decode($values, true);
|
$values = json_decode($values, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($values)) {
|
if(!is_array($values)) {
|
||||||
$fail('The '.$attribute.' must be a valid array.');
|
$fail('The '.$attribute.' must be a valid array.');
|
||||||
return;
|
return;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user