mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:34:31 -04:00
commit
e078b9637b
@ -1 +1 @@
|
|||||||
5.7.33
|
5.7.34
|
@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Backup;
|
use App\Models\Backup;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Models\GroupSetting;
|
use App\Models\GroupSetting;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
@ -56,8 +56,9 @@ class BackupUpdate extends Command
|
|||||||
{
|
{
|
||||||
//always return state to first DB
|
//always return state to first DB
|
||||||
|
|
||||||
if(Ninja::isSelfHost())
|
if(Ninja::isSelfHost()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
|
|
||||||
|
@ -12,38 +12,37 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use Exception;
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Credit;
|
|
||||||
use App\Models\Vendor;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\Contact;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Models\CompanyUser;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use App\Models\CompanyToken;
|
|
||||||
use App\Models\ClientContact;
|
|
||||||
use App\Models\CompanyLedger;
|
|
||||||
use App\Models\PurchaseOrder;
|
|
||||||
use App\Models\VendorContact;
|
|
||||||
use App\Models\BankTransaction;
|
|
||||||
use App\Models\QuoteInvitation;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Models\CreditInvitation;
|
|
||||||
use App\Models\RecurringInvoice;
|
|
||||||
use App\Models\InvoiceInvitation;
|
|
||||||
use App\DataMapper\ClientSettings;
|
use App\DataMapper\ClientSettings;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use App\Factory\ClientContactFactory;
|
use App\Factory\ClientContactFactory;
|
||||||
use App\Factory\VendorContactFactory;
|
use App\Factory\VendorContactFactory;
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\BankTransaction;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientContact;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\CompanyLedger;
|
||||||
|
use App\Models\CompanyToken;
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Models\Contact;
|
||||||
|
use App\Models\Credit;
|
||||||
|
use App\Models\CreditInvitation;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\InvoiceInvitation;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\PurchaseOrder;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use App\Models\QuoteInvitation;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
use App\Models\RecurringInvoiceInvitation;
|
use App\Models\RecurringInvoiceInvitation;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Vendor;
|
||||||
|
use App\Models\VendorContact;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -185,8 +184,7 @@ class CheckData extends Command
|
|||||||
|
|
||||||
if ($cu->company && $cu->user) {
|
if ($cu->company && $cu->user) {
|
||||||
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
|
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// $cu->forceDelete();
|
// $cu->forceDelete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ use App\Models\Account;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyToken;
|
use App\Models\CompanyToken;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Repositories\InvoiceRepository;
|
|
||||||
use App\Utils\Traits\GeneratesCounter;
|
use App\Utils\Traits\GeneratesCounter;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
@ -36,6 +36,7 @@ use App\Models\CompanyToken;
|
|||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
|
use App\Models\Invoice;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\Quote;
|
use App\Models\Quote;
|
||||||
@ -303,6 +304,62 @@ class CreateSingleAccount extends Command
|
|||||||
$this->createGateways($company, $user);
|
$this->createGateways($company, $user);
|
||||||
|
|
||||||
$this->createSubsData($company, $user);
|
$this->createSubsData($company, $user);
|
||||||
|
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\TaskRepository();
|
||||||
|
|
||||||
|
Task::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\ExpenseRepository();
|
||||||
|
|
||||||
|
Expense::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\VendorRepository(new \App\Repositories\VendorContactRepository());
|
||||||
|
Vendor::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\ClientRepository(new \App\Repositories\ClientContactRepository());
|
||||||
|
Client::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\RecurringInvoiceRepository();
|
||||||
|
RecurringInvoice::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\InvoiceRepository();
|
||||||
|
Invoice::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\QuoteRepository();
|
||||||
|
Quote::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
$repo = new \App\Repositories\CreditRepository();
|
||||||
|
Credit::query()->cursor()->each(function ($t) use ($repo) {
|
||||||
|
$repo->save([], $t);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Project::query()->with('client')->whereNotNull('client_id')->cursor()->each(function ($p) {
|
||||||
|
|
||||||
|
if($p && $p->client && !isset($p->number)) {
|
||||||
|
$p->number = $this->getNextProjectNumber($p);
|
||||||
|
$p->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->info("finished");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createSubsData($company, $user)
|
private function createSubsData($company, $user)
|
||||||
@ -885,11 +942,11 @@ class CreateSingleAccount extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createRecurringInvoice($client)
|
private function createRecurringInvoice(Client $client)
|
||||||
{
|
{
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
|
|
||||||
$invoice = RecurringInvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
|
$invoice = RecurringInvoiceFactory::create($client->company_id, $client->user_id); //stub the company and user_id
|
||||||
$invoice->client_id = $client->id;
|
$invoice->client_id = $client->id;
|
||||||
$dateable = Carbon::now()->subDays(rand(0, 90));
|
$dateable = Carbon::now()->subDays(rand(0, 90));
|
||||||
$invoice->date = $dateable;
|
$invoice->date = $dateable;
|
||||||
|
@ -18,7 +18,6 @@ use App\Exceptions\ProcessingMigrationArchiveFailed;
|
|||||||
use App\Exceptions\ResourceDependencyMissing;
|
use App\Exceptions\ResourceDependencyMissing;
|
||||||
use App\Exceptions\ResourceNotAvailableForMigration;
|
use App\Exceptions\ResourceNotAvailableForMigration;
|
||||||
use App\Jobs\Util\Import;
|
use App\Jobs\Util\Import;
|
||||||
use App\Jobs\Util\StartMigration;
|
|
||||||
use App\Mail\MigrationFailed;
|
use App\Mail\MigrationFailed;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
@ -52,8 +52,7 @@ class ReactBuilder extends Command
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
$directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
}
|
} catch (\Exception $e) {
|
||||||
catch (\Exception $e) {
|
|
||||||
$this->error('React files not found');
|
$this->error('React files not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -61,14 +60,14 @@ class ReactBuilder extends Command
|
|||||||
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
|
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
|
||||||
if ($file->getExtension() == 'js') {
|
if ($file->getExtension() == 'js') {
|
||||||
if (str_contains($file->getFileName(), 'index-')) {
|
if (str_contains($file->getFileName(), 'index-')) {
|
||||||
$includes .= '<script type="module" crossorigin src="/react/'.$file->getFileName().'"></script>'."\n";
|
$includes .= '<script type="module" crossorigin src="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'"></script>'."\n";
|
||||||
} else {
|
} else {
|
||||||
$includes .= '<link rel="modulepreload" href="/react/'.$file->getFileName().'">'."\n";
|
$includes .= '<link rel="modulepreload" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_contains($file->getFileName(), '.css')) {
|
if (str_contains($file->getFileName(), '.css')) {
|
||||||
$includes .= '<link rel="stylesheet" href="/react/'.$file->getFileName().'">'."\n";
|
$includes .= '<link rel="stylesheet" href="/react/v'.config('ninja.app_version').'/'.$file->getFileName().'">'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,17 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Faker\Factory;
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Mail\TestMailServer;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
|
||||||
use App\DataMapper\CompanySettings;
|
|
||||||
use App\DataMapper\DefaultSettings;
|
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
use App\Mail\Migration\MaxCompanies;
|
use App\Mail\TestMailServer;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class SendTestEmails extends Command
|
class SendTestEmails extends Command
|
||||||
|
@ -11,29 +11,29 @@
|
|||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Jobs\Ninja\QueueSize;
|
|
||||||
use App\Jobs\Util\DiskCleanup;
|
|
||||||
use App\Jobs\Util\ReminderJob;
|
|
||||||
use App\Jobs\Cron\AutoBillCron;
|
use App\Jobs\Cron\AutoBillCron;
|
||||||
use App\Jobs\Util\VersionCheck;
|
|
||||||
use App\Jobs\Ninja\TaskScheduler;
|
|
||||||
use App\Jobs\Util\SchedulerCheck;
|
|
||||||
use App\Jobs\Ninja\CheckACHStatus;
|
|
||||||
use App\Jobs\Cron\SubscriptionCron;
|
|
||||||
use App\Jobs\Ninja\AdjustEmailQuota;
|
|
||||||
use App\Jobs\Ninja\CompanySizeCheck;
|
|
||||||
use App\Jobs\Ninja\SystemMaintenance;
|
|
||||||
use App\Jobs\Quote\QuoteCheckExpired;
|
|
||||||
use App\Jobs\Util\UpdateExchangeRates;
|
|
||||||
use App\Jobs\Ninja\BankTransactionSync;
|
|
||||||
use App\Jobs\Cron\RecurringExpensesCron;
|
use App\Jobs\Cron\RecurringExpensesCron;
|
||||||
use App\Jobs\Cron\RecurringInvoicesCron;
|
use App\Jobs\Cron\RecurringInvoicesCron;
|
||||||
|
use App\Jobs\Cron\SubscriptionCron;
|
||||||
use App\Jobs\Cron\UpdateCalculatedFields;
|
use App\Jobs\Cron\UpdateCalculatedFields;
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use App\Jobs\Invoice\InvoiceCheckLateWebhook;
|
use App\Jobs\Invoice\InvoiceCheckLateWebhook;
|
||||||
|
use App\Jobs\Ninja\AdjustEmailQuota;
|
||||||
|
use App\Jobs\Ninja\BankTransactionSync;
|
||||||
|
use App\Jobs\Ninja\CheckACHStatus;
|
||||||
|
use App\Jobs\Ninja\CompanySizeCheck;
|
||||||
|
use App\Jobs\Ninja\QueueSize;
|
||||||
|
use App\Jobs\Ninja\SystemMaintenance;
|
||||||
|
use App\Jobs\Ninja\TaskScheduler;
|
||||||
|
use App\Jobs\Quote\QuoteCheckExpired;
|
||||||
use App\Jobs\Subscription\CleanStaleInvoiceOrder;
|
use App\Jobs\Subscription\CleanStaleInvoiceOrder;
|
||||||
|
use App\Jobs\Util\DiskCleanup;
|
||||||
|
use App\Jobs\Util\ReminderJob;
|
||||||
|
use App\Jobs\Util\SchedulerCheck;
|
||||||
|
use App\Jobs\Util\UpdateExchangeRates;
|
||||||
|
use App\Jobs\Util\VersionCheck;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
|
@ -481,9 +481,22 @@ class CompanySettings extends BaseSettings
|
|||||||
|
|
||||||
public $enable_e_invoice = false;
|
public $enable_e_invoice = false;
|
||||||
|
|
||||||
public $classification = ''; // individual, company, partnership, trust, charity, government, other
|
public $delivery_note_design_id = '';
|
||||||
|
|
||||||
|
public $statement_design_id = '';
|
||||||
|
|
||||||
|
public $payment_receipt_design_id = '';
|
||||||
|
|
||||||
|
public $payment_refund_design_id = '';
|
||||||
|
|
||||||
|
public $classification = ''; // individual, business, partnership, trust, charity, government, other
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'statement_design_id' => 'string',
|
||||||
|
'delivery_note_design_id' => 'string',
|
||||||
|
'payment_receipt_design_id' => 'string',
|
||||||
|
'payment_refund_design_id' => 'string',
|
||||||
|
'classification' => 'string',
|
||||||
'enable_e_invoice' => 'bool',
|
'enable_e_invoice' => 'bool',
|
||||||
'classification' => 'string',
|
'classification' => 'string',
|
||||||
'default_expense_payment_type_id' => 'string',
|
'default_expense_payment_type_id' => 'string',
|
||||||
@ -768,6 +781,8 @@ class CompanySettings extends BaseSettings
|
|||||||
'quote_design_id',
|
'quote_design_id',
|
||||||
'credit_design_id',
|
'credit_design_id',
|
||||||
'purchase_order_design_id',
|
'purchase_order_design_id',
|
||||||
|
'statement_design_id',
|
||||||
|
'delivery_note_design_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
@ -999,6 +1014,15 @@ class CompanySettings extends BaseSettings
|
|||||||
'$total',
|
'$total',
|
||||||
'$credit.balance',
|
'$credit.balance',
|
||||||
],
|
],
|
||||||
|
'statement_details' => [
|
||||||
|
'$statement_date',
|
||||||
|
'$balance'
|
||||||
|
],
|
||||||
|
'delivery_note_columns' => [
|
||||||
|
'$product.item',
|
||||||
|
'$product.description',
|
||||||
|
'$product.quantity',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return json_decode(json_encode($variables));
|
return json_decode(json_encode($variables));
|
||||||
|
@ -355,7 +355,7 @@ class SettingsData
|
|||||||
|
|
||||||
public string $email = ''; //@implemented
|
public string $email = ''; //@implemented
|
||||||
|
|
||||||
public string $country_id; //@implemented
|
public string $country_id = ''; //@implemented
|
||||||
|
|
||||||
public string $vat_number = ''; //@implemented
|
public string $vat_number = ''; //@implemented
|
||||||
|
|
||||||
@ -469,21 +469,22 @@ class SettingsData
|
|||||||
|
|
||||||
public function cast(mixed $object)
|
public function cast(mixed $object)
|
||||||
{
|
{
|
||||||
if(is_array($object))
|
if(is_array($object)) {
|
||||||
$object = (object)$object;
|
$object = (object)$object;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_object($object)) {
|
if (is_object($object)) {
|
||||||
foreach ($object as $key => $value) {
|
foreach ($object as $key => $value) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
settype($object->{$key}, gettype($this->{$key}));
|
settype($object->{$key}, gettype($this->{$key}));
|
||||||
}
|
} catch(\Exception | \Error | \Throwable $e) {
|
||||||
catch(\Exception | \Error | \Throwable $e){
|
|
||||||
|
|
||||||
if(property_exists($this, $key))
|
if(property_exists($this, $key)) {
|
||||||
$object->{$key} = $this->{$key};
|
$object->{$key} = $this->{$key};
|
||||||
else
|
} else {
|
||||||
unset($object->{$key});
|
unset($object->{$key});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
namespace App\DataMapper\Tax;
|
namespace App\DataMapper\Tax;
|
||||||
|
|
||||||
|
use App\DataMapper\Tax\ZipTax\Response;
|
||||||
|
use App\DataProviders\USStates;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\DataProviders\USStates;
|
|
||||||
use App\DataMapper\Tax\ZipTax\Response;
|
|
||||||
|
|
||||||
class BaseRule implements RuleInterface
|
class BaseRule implements RuleInterface
|
||||||
{
|
{
|
||||||
@ -147,8 +147,9 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
$this->resolveRegions();
|
$this->resolveRegions();
|
||||||
|
|
||||||
if(!$this->isTaxableRegion())
|
if(!$this->isTaxableRegion()) {
|
||||||
return $this;
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$this->configTaxData();
|
$this->configTaxData();
|
||||||
|
|
||||||
@ -173,8 +174,9 @@ class BaseRule implements RuleInterface
|
|||||||
/** Harvest the client_region */
|
/** Harvest the client_region */
|
||||||
|
|
||||||
/** If the tax data is already set and the invoice is marked as sent, do not adjust the rates */
|
/** If the tax data is already set and the invoice is marked as sent, do not adjust the rates */
|
||||||
if($this->invoice->tax_data && $this->invoice->status_id > 1)
|
if($this->invoice->tax_data && $this->invoice->status_id > 1) {
|
||||||
return $this;
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Origin - Company Tax Data
|
* Origin - Company Tax Data
|
||||||
@ -190,8 +192,7 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
/** If no company tax data has been configured, lets do that now. */
|
/** If no company tax data has been configured, lets do that now. */
|
||||||
/** We should never encounter this scenario */
|
/** We should never encounter this scenario */
|
||||||
if(!$company->origin_tax_data)
|
if(!$company->origin_tax_data) {
|
||||||
{
|
|
||||||
$this->should_calc_tax = false;
|
$this->should_calc_tax = false;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -201,8 +202,7 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
$tax_data = $company->origin_tax_data;
|
$tax_data = $company->origin_tax_data;
|
||||||
|
|
||||||
}
|
} elseif($this->client->tax_data) {
|
||||||
elseif($this->client->tax_data){
|
|
||||||
|
|
||||||
$tax_data = $this->client->tax_data;
|
$tax_data = $this->client->tax_data;
|
||||||
|
|
||||||
@ -215,9 +215,10 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
$this->invoice->tax_data = $tax_data;
|
$this->invoice->tax_data = $tax_data;
|
||||||
|
|
||||||
if(\DB::transactionLevel() == 0)
|
if(\DB::transactionLevel() == 0) {
|
||||||
$this->invoice->saveQuietly();
|
$this->invoice->saveQuietly();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
@ -251,8 +252,9 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
$states = USStates::$states;
|
$states = USStates::$states;
|
||||||
|
|
||||||
if(isset($states[$this->client->state]))
|
if(isset($states[$this->client->state])) {
|
||||||
return $this->client->state;
|
return $this->client->state;
|
||||||
|
}
|
||||||
|
|
||||||
return USStates::getState(strlen($this->client->postal_code) > 1 ? $this->client->postal_code : $this->client->shipping_postal_code);
|
return USStates::getState(strlen($this->client->postal_code) > 1 ? $this->client->postal_code : $this->client->shipping_postal_code);
|
||||||
|
|
||||||
@ -277,8 +279,7 @@ class BaseRule implements RuleInterface
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
}
|
} elseif($this->client_region == 'AU') { //these are defaults and are only stubbed out for now, for AU we can actually remove these
|
||||||
elseif($this->client_region == 'AU'){ //these are defaults and are only stubbed out for now, for AU we can actually remove these
|
|
||||||
|
|
||||||
$this->tax_rate1 = $this->client->company->tax_data->regions->AU->subregions->AU->tax_rate;
|
$this->tax_rate1 = $this->client->company->tax_data->regions->AU->subregions->AU->tax_rate;
|
||||||
$this->tax_name1 = $this->client->company->tax_data->regions->AU->subregions->AU->tax_name;
|
$this->tax_name1 = $this->client->company->tax_data->regions->AU->subregions->AU->tax_name;
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
namespace App\DataMapper\Tax\DE;
|
namespace App\DataMapper\Tax\DE;
|
||||||
|
|
||||||
use App\Models\Product;
|
|
||||||
use App\DataMapper\Tax\BaseRule;
|
use App\DataMapper\Tax\BaseRule;
|
||||||
use App\DataMapper\Tax\RuleInterface;
|
use App\DataMapper\Tax\RuleInterface;
|
||||||
|
use App\Models\Product;
|
||||||
|
|
||||||
class Rule extends BaseRule implements RuleInterface
|
class Rule extends BaseRule implements RuleInterface
|
||||||
{
|
{
|
||||||
@ -220,39 +220,28 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
// nlog("tax exempt");
|
// nlog("tax exempt");
|
||||||
$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->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->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->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->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
|
|
||||||
{
|
|
||||||
// nlog("foreign and tax exempt");
|
// nlog("foreign 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)) {
|
||||||
elseif(!in_array($this->client_subregion, $this->eu_country_codes))
|
|
||||||
{
|
|
||||||
$this->defaultForeign();
|
$this->defaultForeign();
|
||||||
}
|
} elseif(in_array($this->client_subregion, $this->eu_country_codes) && !$this->client->vat_number) { //eu country / no valid vat
|
||||||
elseif(in_array($this->client_subregion, $this->eu_country_codes) && !$this->client->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) && $this->client->company->tax_data->regions->EU->has_sales_above_threshold)
|
|
||||||
{
|
|
||||||
// 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;
|
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->country->iso_3166_2}->tax_rate;
|
||||||
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->country->iso_3166_2}->reduced_tax_rate;
|
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->country->iso_3166_2}->reduced_tax_rate;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// nlog("EU with intra-community supply ie DE to DE");
|
// nlog("EU with intra-community supply ie DE to DE");
|
||||||
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
||||||
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate;
|
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// nlog("default tax");
|
// nlog("default tax");
|
||||||
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
$this->tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->tax_rate;
|
||||||
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate;
|
$this->reduced_tax_rate = $this->client->company->tax_data->regions->EU->subregions->{$this->client->company->country()->iso_3166_2}->reduced_tax_rate;
|
||||||
|
@ -32,10 +32,11 @@ class TaxModel
|
|||||||
public function __construct(public ?TaxModel $model = null)
|
public function __construct(public ?TaxModel $model = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$this->model)
|
if(!$this->model) {
|
||||||
$this->regions = $this->init();
|
$this->regions = $this->init();
|
||||||
else
|
} else {
|
||||||
$this->regions = $model;
|
$this->regions = $model;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +119,7 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
{
|
{
|
||||||
if(in_array($this->tax_data?->txbService, ['Y','L'])) {
|
if(in_array($this->tax_data?->txbService, ['Y','L'])) {
|
||||||
$this->default($item);
|
$this->default($item);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->taxExempt($item);
|
$this->taxExempt($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,4 +114,3 @@ class Response
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33868,18 +33868,21 @@ class USStates
|
|||||||
|
|
||||||
public static function getState(?string $zip = '90210'): string
|
public static function getState(?string $zip = '90210'): string
|
||||||
{
|
{
|
||||||
if(isset(self::$zip_code_map[$zip]))
|
if(isset(self::$zip_code_map[$zip])) {
|
||||||
return self::$zip_code_map[$zip];
|
return self::$zip_code_map[$zip];
|
||||||
|
}
|
||||||
|
|
||||||
$prefix_state = self::getStateFromThreeDigitPrefix($zip);
|
$prefix_state = self::getStateFromThreeDigitPrefix($zip);
|
||||||
|
|
||||||
if($prefix_state)
|
if($prefix_state) {
|
||||||
return $prefix_state;
|
return $prefix_state;
|
||||||
|
}
|
||||||
|
|
||||||
$zippo_response = self::getStateFromZippo($zip);
|
$zippo_response = self::getStateFromZippo($zip);
|
||||||
|
|
||||||
if($zippo_response)
|
if($zippo_response) {
|
||||||
return $zippo_response;
|
return $zippo_response;
|
||||||
|
}
|
||||||
|
|
||||||
throw new \Exception('Zip code not found');
|
throw new \Exception('Zip code not found');
|
||||||
}
|
}
|
||||||
@ -33905,8 +33908,9 @@ class USStates
|
|||||||
|
|
||||||
$response = Http::get("https://api.zippopotam.us/us/{$zip}");
|
$response = Http::get("https://api.zippopotam.us/us/{$zip}");
|
||||||
|
|
||||||
if($response->failed())
|
if($response->failed()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$data = $response->object();
|
$data = $response->object();
|
||||||
|
|
||||||
|
@ -12,11 +12,9 @@
|
|||||||
namespace App\Events\Account;
|
namespace App\Events\Account;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Broadcasting\Channel;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class StripeConnectFailure.
|
* Class StripeConnectFailure.
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Client;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ namespace App\Events\Company;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ namespace App\Events\Contact;
|
|||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\Design;
|
use App\Models\Design;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Events\Design;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Design;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use App\Models\Design;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DesignWasCreated.
|
* Class DesignWasCreated.
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Events\Design;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Design;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use App\Models\Design;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DesignWasDeleted.
|
* Class DesignWasDeleted.
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Events\Design;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Design;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use App\Models\Design;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DesignWasRestored.
|
* Class DesignWasRestored.
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Events\Design;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Design;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use App\Models\Design;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DesignWasUpdated.
|
* Class DesignWasUpdated.
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\Document;
|
use App\Models\Document;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\ClientGatewayToken;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
namespace App\Events\Payment;
|
namespace App\Events\Payment;
|
||||||
|
|
||||||
|
use App\Models\ClientContact;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\ClientContact;
|
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PaymentWasEmailed.
|
* Class PaymentWasEmailed.
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace App\Events\PurchaseOrder;
|
namespace App\Events\PurchaseOrder;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\PurchaseOrder;
|
|
||||||
use App\Models\PurchaseOrderInvitation;
|
use App\Models\PurchaseOrderInvitation;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
namespace App\Events\Quote;
|
namespace App\Events\Quote;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Models\QuoteInvitation;
|
use App\Models\QuoteInvitation;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ namespace App\Events\Subscription;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ use App\Models\Company;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Broadcasting\PrivateChannel;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
4
app/Events/Vendor/VendorContactLoggedIn.php
vendored
4
app/Events/Vendor/VendorContactLoggedIn.php
vendored
@ -14,9 +14,9 @@ namespace App\Events\Vendor;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\VendorContact;
|
use App\Models\VendorContact;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Queue\SerializesModels;
|
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class VendorContactLoggedIn.
|
* Class VendorContactLoggedIn.
|
||||||
|
@ -11,31 +11,31 @@
|
|||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use PDOException;
|
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use Sentry\State\Scope;
|
|
||||||
use Illuminate\Support\Arr;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use Sentry\Laravel\Integration;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Aws\Exception\CredentialsException;
|
use Aws\Exception\CredentialsException;
|
||||||
use GuzzleHttp\Exception\ConnectException;
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use League\Flysystem\UnableToCreateDirectory;
|
|
||||||
use Illuminate\Session\TokenMismatchException;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Illuminate\Queue\MaxAttemptsExceededException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||||
use Symfony\Component\Process\Exception\RuntimeException;
|
|
||||||
use Illuminate\Database\Eloquent\RelationNotFoundException;
|
use Illuminate\Database\Eloquent\RelationNotFoundException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Illuminate\Http\Exceptions\ThrottleRequestsException;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Queue\MaxAttemptsExceededException;
|
||||||
|
use Illuminate\Session\TokenMismatchException;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use League\Flysystem\UnableToCreateDirectory;
|
||||||
|
use PDOException;
|
||||||
|
use Sentry\Laravel\Integration;
|
||||||
|
use Sentry\State\Scope;
|
||||||
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
use Symfony\Component\Process\Exception\RuntimeException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class PaymentRefundFailed extends Exception
|
class PaymentRefundFailed extends Exception
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class QuoteConversion extends Exception
|
class QuoteConversion extends Exception
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class YodleeApiException extends Exception
|
class YodleeApiException extends Exception
|
||||||
{
|
{
|
||||||
|
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Models\Task;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\DateFormat;
|
use App\Models\DateFormat;
|
||||||
|
use App\Models\Task;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use League\Csv\Writer;
|
||||||
use App\Transformers\ActivityTransformer;
|
|
||||||
|
|
||||||
class ActivityExport extends BaseExport
|
class ActivityExport extends BaseExport
|
||||||
{
|
{
|
||||||
|
@ -11,30 +11,28 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Credit;
|
use App\Models\ClientContact;
|
||||||
use App\Utils\Helpers;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Models\Credit;
|
||||||
|
use App\Models\Document;
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\Document;
|
|
||||||
use League\Fractal\Manager;
|
|
||||||
use App\Models\ClientContact;
|
|
||||||
use App\Models\PurchaseOrder;
|
|
||||||
use App\Models\RecurringInvoice;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Transformers\TaskTransformer;
|
|
||||||
use App\Transformers\PaymentTransformer;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
|
use App\Models\PurchaseOrder;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\Vendor;
|
use App\Models\Vendor;
|
||||||
|
use App\Transformers\PaymentTransformer;
|
||||||
|
use App\Transformers\TaskTransformer;
|
||||||
|
use App\Utils\Helpers;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use League\Fractal\Manager;
|
||||||
|
use League\Fractal\Serializer\ArraySerializer;
|
||||||
|
|
||||||
class BaseExport
|
class BaseExport
|
||||||
{
|
{
|
||||||
@ -446,8 +444,7 @@ class BaseExport
|
|||||||
$client = Client::withTrashed()->find($this->input['client_id']);
|
$client = Client::withTrashed()->find($this->input['client_id']);
|
||||||
$this->client_description = $client->present()->name;
|
$this->client_description = $client->present()->name;
|
||||||
return $query->where('client_id', $this->input['client_id']);
|
return $query->where('client_id', $this->input['client_id']);
|
||||||
}
|
} elseif(isset($this->input['clients']) && count($this->input['clients']) > 0) {
|
||||||
elseif(isset($this->input['clients']) && count($this->input['clients']) > 0) {
|
|
||||||
|
|
||||||
$this->client_description = 'Multiple Clients';
|
$this->client_description = 'Multiple Clients';
|
||||||
return $query->whereIn('client_id', $this->input['clients']);
|
return $query->whereIn('client_id', $this->input['clients']);
|
||||||
@ -459,8 +456,9 @@ class BaseExport
|
|||||||
{
|
{
|
||||||
$parts = explode(".", $key);
|
$parts = explode(".", $key);
|
||||||
|
|
||||||
if(!is_array($parts) || count($parts) < 2)
|
if(!is_array($parts) || count($parts) < 2) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$value = '';
|
$value = '';
|
||||||
|
|
||||||
@ -497,8 +495,9 @@ class BaseExport
|
|||||||
|
|
||||||
private function resolveVendorContactKey($column, $entity, $transformer)
|
private function resolveVendorContactKey($column, $entity, $transformer)
|
||||||
{
|
{
|
||||||
if(!$entity->vendor)
|
if(!$entity->vendor) {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
$primary_contact = $entity->vendor->primary_contact()->first() ?? $entity->vendor->contacts()->first();
|
$primary_contact = $entity->vendor->primary_contact()->first() ?? $entity->vendor->contacts()->first();
|
||||||
|
|
||||||
@ -510,18 +509,21 @@ class BaseExport
|
|||||||
private function resolveExpenseKey($column, $entity, $transformer)
|
private function resolveExpenseKey($column, $entity, $transformer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($column == 'user' && $entity?->expense?->user)
|
if($column == 'user' && $entity?->expense?->user) {
|
||||||
return $entity->expense->user->present()->name() ?? ' ';
|
return $entity->expense->user->present()->name() ?? ' ';
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'assigned_user' && $entity?->expense?->assigned_user)
|
if($column == 'assigned_user' && $entity?->expense?->assigned_user) {
|
||||||
return $entity->expense->assigned_user->present()->name() ?? ' ';
|
return $entity->expense->assigned_user->present()->name() ?? ' ';
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'category' && $entity->expense) {
|
if($column == 'category' && $entity->expense) {
|
||||||
return $entity->expense->category?->name ?? ' ';
|
return $entity->expense->category?->name ?? ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($entity instanceof Expense)
|
if($entity instanceof Expense) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$transformed_entity = $transformer->includeExpense($entity);
|
$transformed_entity = $transformer->includeExpense($entity);
|
||||||
|
|
||||||
@ -529,11 +531,13 @@ class BaseExport
|
|||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$transformed_entity = $manager->createData($transformed_entity)->toArray();
|
$transformed_entity = $manager->createData($transformed_entity)->toArray();
|
||||||
|
|
||||||
if(array_key_exists($column, $transformed_entity))
|
if(array_key_exists($column, $transformed_entity)) {
|
||||||
return $transformed_entity[$column];
|
return $transformed_entity[$column];
|
||||||
|
}
|
||||||
|
|
||||||
if(property_exists($entity, $column))
|
if(property_exists($entity, $column)) {
|
||||||
return $entity?->{$column} ?? '';
|
return $entity?->{$column} ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
nlog("export: Could not resolve expense key: {$column}");
|
nlog("export: Could not resolve expense key: {$column}");
|
||||||
|
|
||||||
@ -560,8 +564,9 @@ class BaseExport
|
|||||||
private function resolveVendorKey($column, $entity, $transformer)
|
private function resolveVendorKey($column, $entity, $transformer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$entity->vendor)
|
if(!$entity->vendor) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$transformed_entity = $transformer->includeVendor($entity);
|
$transformed_entity = $transformer->includeVendor($entity);
|
||||||
|
|
||||||
@ -569,24 +574,29 @@ class BaseExport
|
|||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$transformed_entity = $manager->createData($transformed_entity)->toArray();
|
$transformed_entity = $manager->createData($transformed_entity)->toArray();
|
||||||
|
|
||||||
if($column == 'name')
|
if($column == 'name') {
|
||||||
return $entity->vendor->present()->name() ?: '';
|
return $entity->vendor->present()->name() ?: '';
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'user_id')
|
if($column == 'user_id') {
|
||||||
return $entity->vendor->user->present()->name() ?: '';
|
return $entity->vendor->user->present()->name() ?: '';
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'country_id')
|
if($column == 'country_id') {
|
||||||
return $entity->vendor->country ? ctrans("texts.country_{$entity->vendor->country->name}") : '';
|
return $entity->vendor->country ? ctrans("texts.country_{$entity->vendor->country->name}") : '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($column == 'currency_id') {
|
if ($column == 'currency_id') {
|
||||||
return $entity->vendor->currency() ? $entity->vendor->currency()->code : $entity->company->currency()->code;
|
return $entity->vendor->currency() ? $entity->vendor->currency()->code : $entity->company->currency()->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($column == 'status')
|
if($column == 'status') {
|
||||||
return $entity->stringStatus($entity->status_id) ?: '';
|
return $entity->stringStatus($entity->status_id) ?: '';
|
||||||
|
}
|
||||||
|
|
||||||
if(array_key_exists($column, $transformed_entity))
|
if(array_key_exists($column, $transformed_entity)) {
|
||||||
return $transformed_entity[$column];
|
return $transformed_entity[$column];
|
||||||
|
}
|
||||||
|
|
||||||
// nlog("export: Could not resolve vendor key: {$column}");
|
// nlog("export: Could not resolve vendor key: {$column}");
|
||||||
|
|
||||||
@ -598,8 +608,9 @@ class BaseExport
|
|||||||
private function resolveClientKey($column, $entity, $transformer)
|
private function resolveClientKey($column, $entity, $transformer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$entity->client)
|
if(!$entity->client) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$transformed_client = $transformer->includeClient($entity);
|
$transformed_client = $transformer->includeClient($entity);
|
||||||
|
|
||||||
@ -607,36 +618,46 @@ class BaseExport
|
|||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$transformed_client = $manager->createData($transformed_client)->toArray();
|
$transformed_client = $manager->createData($transformed_client)->toArray();
|
||||||
|
|
||||||
if(in_array($column, ['client.name', 'name']))
|
if(in_array($column, ['client.name', 'name'])) {
|
||||||
return $transformed_client['display_name'];
|
return $transformed_client['display_name'];
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.user_id', 'user_id']))
|
if(in_array($column, ['client.user_id', 'user_id'])) {
|
||||||
return $entity->client->user->present()->name();
|
return $entity->client->user->present()->name();
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.assigned_user_id', 'assigned_user_id']))
|
if(in_array($column, ['client.assigned_user_id', 'assigned_user_id'])) {
|
||||||
return $entity->client->assigned_user->present()->name();
|
return $entity->client->assigned_user->present()->name();
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.country_id', 'country_id']))
|
if(in_array($column, ['client.country_id', 'country_id'])) {
|
||||||
return $entity->client->country ? ctrans("texts.country_{$entity->client->country->name}") : '';
|
return $entity->client->country ? ctrans("texts.country_{$entity->client->country->name}") : '';
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.shipping_country_id', 'shipping_country_id']))
|
if(in_array($column, ['client.shipping_country_id', 'shipping_country_id'])) {
|
||||||
return $entity->client->shipping_country ? ctrans("texts.country_{$entity->client->shipping_country->name}") : '';
|
return $entity->client->shipping_country ? ctrans("texts.country_{$entity->client->shipping_country->name}") : '';
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.size_id', 'size_id']))
|
if(in_array($column, ['client.size_id', 'size_id'])) {
|
||||||
return $entity->client->size?->name ?? '';
|
return $entity->client->size?->name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['client.industry_id', 'industry_id']))
|
if(in_array($column, ['client.industry_id', 'industry_id'])) {
|
||||||
return $entity->client->industry?->name ?? '';
|
return $entity->client->industry?->name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($column, ['client.currency_id', 'currency_id']))
|
if (in_array($column, ['client.currency_id', 'currency_id'])) {
|
||||||
return $entity->client->currency() ? $entity->client->currency()->code : $entity->company->currency()->code;
|
return $entity->client->currency() ? $entity->client->currency()->code : $entity->company->currency()->code;
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($column, ['payment_terms', 'client.payment_terms']))
|
if(in_array($column, ['payment_terms', 'client.payment_terms'])) {
|
||||||
return $entity->client->getSetting('payment_terms');
|
return $entity->client->getSetting('payment_terms');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(array_key_exists($column, $transformed_client))
|
if(array_key_exists($column, $transformed_client)) {
|
||||||
return $transformed_client[$column];
|
return $transformed_client[$column];
|
||||||
|
}
|
||||||
|
|
||||||
// nlog("export: Could not resolve client key: {$column}");
|
// nlog("export: Could not resolve client key: {$column}");
|
||||||
|
|
||||||
@ -650,8 +671,9 @@ class BaseExport
|
|||||||
|
|
||||||
$transformed_entity = $transformer->transform($entity);
|
$transformed_entity = $transformer->transform($entity);
|
||||||
|
|
||||||
if($column == 'status')
|
if($column == 'status') {
|
||||||
return $entity->stringStatus($entity->status_id);
|
return $entity->stringStatus($entity->status_id);
|
||||||
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -682,16 +704,19 @@ class BaseExport
|
|||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$transformed_invoices = $manager->createData($transformed_invoices)->toArray();
|
$transformed_invoices = $manager->createData($transformed_invoices)->toArray();
|
||||||
|
|
||||||
if(!isset($transformed_invoices['App\\Models\\Invoice']))
|
if(!isset($transformed_invoices['App\\Models\\Invoice'])) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$transformed_invoices = $transformed_invoices['App\\Models\\Invoice'];
|
$transformed_invoices = $transformed_invoices['App\\Models\\Invoice'];
|
||||||
|
|
||||||
if(count($transformed_invoices) == 1 && array_key_exists($column, $transformed_invoices[0]))
|
if(count($transformed_invoices) == 1 && array_key_exists($column, $transformed_invoices[0])) {
|
||||||
return $transformed_invoices[0][$column];
|
return $transformed_invoices[0][$column];
|
||||||
|
}
|
||||||
|
|
||||||
if(count($transformed_invoices) > 1 && array_key_exists($column, $transformed_invoices[0]))
|
if(count($transformed_invoices) > 1 && array_key_exists($column, $transformed_invoices[0])) {
|
||||||
return implode(', ', array_column($transformed_invoices, $column));
|
return implode(', ', array_column($transformed_invoices, $column));
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@ -700,8 +725,9 @@ class BaseExport
|
|||||||
if($transformer instanceof TaskTransformer && ($entity->invoice ?? false)) {
|
if($transformer instanceof TaskTransformer && ($entity->invoice ?? false)) {
|
||||||
$transformed_invoice = $transformer->includeInvoice($entity);
|
$transformed_invoice = $transformer->includeInvoice($entity);
|
||||||
|
|
||||||
if(!$transformed_invoice)
|
if(!$transformed_invoice) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
@ -737,8 +763,9 @@ class BaseExport
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($column == 'amount')
|
if($column == 'amount') {
|
||||||
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.amount') : ctrans('texts.unpaid');
|
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.amount') : ctrans('texts.unpaid');
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'refunded') {
|
if($column == 'refunded') {
|
||||||
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.refunded') : '';
|
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.refunded') : '';
|
||||||
@ -753,14 +780,17 @@ class BaseExport
|
|||||||
|
|
||||||
$payment = $entity->payments()->withoutTrashed()->first();
|
$payment = $entity->payments()->withoutTrashed()->first();
|
||||||
|
|
||||||
if(!$payment)
|
if(!$payment) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'method')
|
if($column == 'method') {
|
||||||
return $payment->translatedType();
|
return $payment->translatedType();
|
||||||
|
}
|
||||||
|
|
||||||
if($column == 'currency')
|
if($column == 'currency') {
|
||||||
return $payment?->currency?->code ?? '';
|
return $payment?->currency?->code ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
$payment_transformer = new PaymentTransformer();
|
$payment_transformer = new PaymentTransformer();
|
||||||
$transformed_payment = $payment_transformer->transform($payment);
|
$transformed_payment = $payment_transformer->transform($payment);
|
||||||
@ -769,8 +799,9 @@ class BaseExport
|
|||||||
return $payment->stringStatus($transformed_payment['status_id']);
|
return $payment->stringStatus($transformed_payment['status_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists($column, $transformed_payment))
|
if(array_key_exists($column, $transformed_payment)) {
|
||||||
return $transformed_payment[$column];
|
return $transformed_payment[$column];
|
||||||
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
@ -782,8 +813,9 @@ class BaseExport
|
|||||||
$status_parameters = explode(',', $status);
|
$status_parameters = explode(',', $status);
|
||||||
|
|
||||||
|
|
||||||
if(in_array('all', $status_parameters))
|
if(in_array('all', $status_parameters)) {
|
||||||
return $query;
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
$query->where(function ($nested) use ($status_parameters) {
|
$query->where(function ($nested) use ($status_parameters) {
|
||||||
|
|
||||||
@ -884,8 +916,9 @@ class BaseExport
|
|||||||
$first_month_of_year = $this->company->getSetting('first_month_of_year') ?? 1;
|
$first_month_of_year = $this->company->getSetting('first_month_of_year') ?? 1;
|
||||||
$fin_year_start = now()->createFromDate(now()->year, $first_month_of_year, 1);
|
$fin_year_start = now()->createFromDate(now()->year, $first_month_of_year, 1);
|
||||||
|
|
||||||
if(now()->lt($fin_year_start))
|
if(now()->lt($fin_year_start)) {
|
||||||
$fin_year_start->subYearNoOverflow();
|
$fin_year_start->subYearNoOverflow();
|
||||||
|
}
|
||||||
|
|
||||||
$this->start_date = $fin_year_start->format('Y-m-d');
|
$this->start_date = $fin_year_start->format('Y-m-d');
|
||||||
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
||||||
@ -896,8 +929,9 @@ class BaseExport
|
|||||||
$fin_year_start = now()->createFromDate(now()->year, $first_month_of_year, 1);
|
$fin_year_start = now()->createFromDate(now()->year, $first_month_of_year, 1);
|
||||||
$fin_year_start->subYearNoOverflow();
|
$fin_year_start->subYearNoOverflow();
|
||||||
|
|
||||||
if(now()->subYear()->lt($fin_year_start))
|
if(now()->subYear()->lt($fin_year_start)) {
|
||||||
$fin_year_start->subYearNoOverflow();
|
$fin_year_start->subYearNoOverflow();
|
||||||
|
}
|
||||||
|
|
||||||
$this->start_date = $fin_year_start->format('Y-m-d');
|
$this->start_date = $fin_year_start->format('Y-m-d');
|
||||||
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
$this->end_date = $fin_year_start->copy()->addYear()->subDay()->format('Y-m-d');
|
||||||
@ -979,9 +1013,10 @@ class BaseExport
|
|||||||
$prefix = ctrans('texts.expense')." ";
|
$prefix = ctrans('texts.expense')." ";
|
||||||
$key = array_search($value, $this->expense_report_keys);
|
$key = array_search($value, $this->expense_report_keys);
|
||||||
|
|
||||||
if(!$key && $value == 'expense.category')
|
if(!$key && $value == 'expense.category') {
|
||||||
$key = 'category';
|
$key = 'category';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!$key) {
|
if(!$key) {
|
||||||
$prefix = ctrans('texts.task')." ";
|
$prefix = ctrans('texts.task')." ";
|
||||||
@ -1024,8 +1059,7 @@ class BaseExport
|
|||||||
$key = str_replace('product.', '', $key);
|
$key = str_replace('product.', '', $key);
|
||||||
$key = str_replace('task.', '', $key);
|
$key = str_replace('task.', '', $key);
|
||||||
|
|
||||||
if(stripos($value, 'custom_value') !== false)
|
if(stripos($value, 'custom_value') !== false) {
|
||||||
{
|
|
||||||
$parts = explode(".", $value);
|
$parts = explode(".", $value);
|
||||||
|
|
||||||
if(count($parts) == 2 && in_array($parts[0], ['credit','quote','invoice','purchase_order','recurring_invoice'])) {
|
if(count($parts) == 2 && in_array($parts[0], ['credit','quote','invoice','purchase_order','recurring_invoice'])) {
|
||||||
@ -1034,32 +1068,27 @@ class BaseExport
|
|||||||
$fallback = "custom_value".substr($parts[1], -1);
|
$fallback = "custom_value".substr($parts[1], -1);
|
||||||
$custom_field_label = $helper->makeCustomField($this->company->custom_fields, $entity);
|
$custom_field_label = $helper->makeCustomField($this->company->custom_fields, $entity);
|
||||||
|
|
||||||
if(strlen($custom_field_label) > 1)
|
if(strlen($custom_field_label) > 1) {
|
||||||
$header[] = $custom_field_label;
|
$header[] = $custom_field_label;
|
||||||
else {
|
} else {
|
||||||
$header[] = $prefix . " ". ctrans("texts.{$fallback}");
|
$header[] = $prefix . " ". ctrans("texts.{$fallback}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} elseif(count($parts) == 2 && (stripos($parts[0], 'vendor_contact') !== false || stripos($parts[0], 'contact') !== false)) {
|
||||||
elseif(count($parts) == 2 && (stripos($parts[0], 'vendor_contact') !== false || stripos($parts[0], 'contact') !== false)) {
|
|
||||||
$parts[0] = str_replace('vendor_contact', 'contact', $parts[0]);
|
$parts[0] = str_replace('vendor_contact', 'contact', $parts[0]);
|
||||||
|
|
||||||
$entity = "contact".substr($parts[1], -1);
|
$entity = "contact".substr($parts[1], -1);
|
||||||
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, $entity)) > 1 ? $helper->makeCustomField($this->company->custom_fields, $entity) : ctrans("texts.{$parts[1]}");
|
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, $entity)) > 1 ? $helper->makeCustomField($this->company->custom_fields, $entity) : ctrans("texts.{$parts[1]}");
|
||||||
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
|
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
|
||||||
|
|
||||||
}
|
} elseif(count($parts) == 2 && in_array(substr($original_key, 0, -1), ['credit','quote','invoice','purchase_order','recurring_invoice','task'])) {
|
||||||
elseif(count($parts) == 2 && in_array(substr($original_key, 0, -1), ['credit','quote','invoice','purchase_order','recurring_invoice','task'])){
|
|
||||||
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, "product".substr($original_key, -1))) > 1 ? $helper->makeCustomField($this->company->custom_fields, "product".substr($original_key, -1)) : ctrans("texts.{$parts[1]}");
|
$custom_field_string = strlen($helper->makeCustomField($this->company->custom_fields, "product".substr($original_key, -1))) > 1 ? $helper->makeCustomField($this->company->custom_fields, "product".substr($original_key, -1)) : ctrans("texts.{$parts[1]}");
|
||||||
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
|
$header[] = ctrans("texts.{$parts[0]}") . " " . $custom_field_string;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$header[] = "{$prefix}" . ctrans("texts.{$key}");
|
$header[] = "{$prefix}" . ctrans("texts.{$key}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$header[] = "{$prefix}" . ctrans("texts.{$key}");
|
$header[] = "{$prefix}" . ctrans("texts.{$key}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1146,11 +1175,13 @@ class BaseExport
|
|||||||
|
|
||||||
$column_key = $value;
|
$column_key = $value;
|
||||||
|
|
||||||
if($value == 'type_id' || $value == 'item.type_id')
|
if($value == 'type_id' || $value == 'item.type_id') {
|
||||||
$column_key = 'type';
|
$column_key = 'type';
|
||||||
|
}
|
||||||
|
|
||||||
if($value == 'tax_id' || $value == 'item.tax_id')
|
if($value == 'tax_id' || $value == 'item.tax_id') {
|
||||||
$column_key = 'tax_category';
|
$column_key = 'tax_category';
|
||||||
|
}
|
||||||
|
|
||||||
$clean_row[$key]['entity'] = $report_keys[0];
|
$clean_row[$key]['entity'] = $report_keys[0];
|
||||||
$clean_row[$key]['id'] = $report_keys[1] ?? $report_keys[0];
|
$clean_row[$key]['id'] = $report_keys[1] ?? $report_keys[0];
|
||||||
|
@ -11,16 +11,16 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Transformers\ClientContactTransformer;
|
||||||
|
use App\Transformers\ClientTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use App\Models\Client;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Transformers\ClientTransformer;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use App\Transformers\ClientContactTransformer;
|
use Illuminate\Support\Facades\App;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
class ClientExport extends BaseExport
|
class ClientExport extends BaseExport
|
||||||
{
|
{
|
||||||
@ -191,10 +191,11 @@ class ClientExport extends BaseExport
|
|||||||
$clean_row[$key]['value'] = $row[$column_key];
|
$clean_row[$key]['value'] = $row[$column_key];
|
||||||
$clean_row[$key]['identifier'] = $value;
|
$clean_row[$key]['identifier'] = $value;
|
||||||
|
|
||||||
if(in_array($clean_row[$key]['id'], ['paid_to_date', 'balance', 'credit_balance','payment_balance']))
|
if(in_array($clean_row[$key]['id'], ['paid_to_date', 'balance', 'credit_balance','payment_balance'])) {
|
||||||
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $resource);
|
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $resource);
|
||||||
else
|
} else {
|
||||||
$clean_row[$key]['display_value'] = $row[$column_key];
|
$clean_row[$key]['display_value'] = $row[$column_key];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Credit;
|
||||||
|
use App\Transformers\CreditTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use App\Models\Credit;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Transformers\CreditTransformer;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
class CreditExport extends BaseExport
|
class CreditExport extends BaseExport
|
||||||
{
|
{
|
||||||
@ -70,10 +70,11 @@ class CreditExport extends BaseExport
|
|||||||
$clean_row[$key]['value'] = $row[$column_key];
|
$clean_row[$key]['value'] = $row[$column_key];
|
||||||
$clean_row[$key]['identifier'] = $value;
|
$clean_row[$key]['identifier'] = $value;
|
||||||
|
|
||||||
if(in_array($clean_row[$key]['id'], ['paid_to_date','total_taxes','amount', 'balance', 'partial', 'refunded', 'applied','unit_cost','cost','price']))
|
if(in_array($clean_row[$key]['id'], ['paid_to_date','total_taxes','amount', 'balance', 'partial', 'refunded', 'applied','unit_cost','cost','price'])) {
|
||||||
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $resource->client);
|
$clean_row[$key]['display_value'] = Number::formatMoney($row[$column_key], $resource->client);
|
||||||
else
|
} else {
|
||||||
$clean_row[$key]['display_value'] = $row[$column_key];
|
$clean_row[$key]['display_value'] = $row[$column_key];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +142,7 @@ class CreditExport extends BaseExport
|
|||||||
$entity[$keyval] = $transformed_credit[$keyval];
|
$entity[$keyval] = $transformed_credit[$keyval];
|
||||||
} elseif(isset($transformed_credit[$searched_credit_key])) {
|
} elseif(isset($transformed_credit[$searched_credit_key])) {
|
||||||
$entity[$keyval] = $transformed_credit[$searched_credit_key];
|
$entity[$keyval] = $transformed_credit[$searched_credit_key];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$entity[$keyval] = $this->resolveKey($keyval, $credit, $this->credit_transformer);
|
$entity[$keyval] = $this->resolveKey($keyval, $credit, $this->credit_transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,16 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
use App\Libraries\MultiDB;
|
||||||
use App\Utils\Number;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Export\CSV\BaseExport;
|
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Transformers\InvoiceTransformer;
|
use App\Transformers\InvoiceTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
class InvoiceExport extends BaseExport
|
class InvoiceExport extends BaseExport
|
||||||
{
|
{
|
||||||
|
@ -139,16 +139,17 @@ class InvoiceItemExport extends BaseExport
|
|||||||
|
|
||||||
$tmp_key = str_replace("item.", "", $key);
|
$tmp_key = str_replace("item.", "", $key);
|
||||||
|
|
||||||
if($tmp_key == 'type_id')
|
if($tmp_key == 'type_id') {
|
||||||
$tmp_key = 'type';
|
$tmp_key = 'type';
|
||||||
|
}
|
||||||
|
|
||||||
if($tmp_key == 'tax_id')
|
if($tmp_key == 'tax_id') {
|
||||||
$tmp_key = 'tax_category';
|
$tmp_key = 'tax_category';
|
||||||
|
}
|
||||||
|
|
||||||
if (property_exists($item, $tmp_key)) {
|
if (property_exists($item, $tmp_key)) {
|
||||||
$item_array[$key] = $item->{$tmp_key};
|
$item_array[$key] = $item->{$tmp_key};
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$item_array[$key] = '';
|
$item_array[$key] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,15 +175,15 @@ class InvoiceItemExport extends BaseExport
|
|||||||
|
|
||||||
$parts = explode('.', $key);
|
$parts = explode('.', $key);
|
||||||
|
|
||||||
if(is_array($parts) && $parts[0] == 'item')
|
if(is_array($parts) && $parts[0] == 'item') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($parts) && $parts[0] == 'invoice' && array_key_exists($parts[1], $transformed_invoice)) {
|
if (is_array($parts) && $parts[0] == 'invoice' && array_key_exists($parts[1], $transformed_invoice)) {
|
||||||
$entity[$key] = $transformed_invoice[$parts[1]];
|
$entity[$key] = $transformed_invoice[$parts[1]];
|
||||||
} elseif (array_key_exists($key, $transformed_invoice)) {
|
} elseif (array_key_exists($key, $transformed_invoice)) {
|
||||||
$entity[$key] = $transformed_invoice[$key];
|
$entity[$key] = $transformed_invoice[$key];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$entity[$key] = $this->resolveKey($key, $invoice, $this->invoice_transformer);
|
$entity[$key] = $this->resolveKey($key, $invoice, $this->invoice_transformer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,6 @@ class PaymentExport extends BaseExport
|
|||||||
return ['identifier' => $key, 'display_value' => $headerdisplay[$value]];
|
return ['identifier' => $key, 'display_value' => $headerdisplay[$value]];
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
nlog($header);
|
|
||||||
|
|
||||||
$report = $query->cursor()
|
$report = $query->cursor()
|
||||||
->map(function ($resource) {
|
->map(function ($resource) {
|
||||||
$row = $this->buildRow($resource);
|
$row = $this->buildRow($resource);
|
||||||
|
@ -11,15 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Transformers\PurchaseOrderTransformer;
|
use App\Transformers\PurchaseOrderTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
class PurchaseOrderExport extends BaseExport
|
class PurchaseOrderExport extends BaseExport
|
||||||
{
|
{
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use League\Csv\Writer;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use App\Transformers\PurchaseOrderTransformer;
|
use App\Transformers\PurchaseOrderTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use League\Csv\Writer;
|
||||||
|
|
||||||
class PurchaseOrderItemExport extends BaseExport
|
class PurchaseOrderItemExport extends BaseExport
|
||||||
{
|
{
|
||||||
|
@ -135,16 +135,17 @@ class QuoteItemExport extends BaseExport
|
|||||||
|
|
||||||
$tmp_key = str_replace("item.", "", $key);
|
$tmp_key = str_replace("item.", "", $key);
|
||||||
|
|
||||||
if($tmp_key == 'type_id')
|
if($tmp_key == 'type_id') {
|
||||||
$tmp_key = 'type';
|
$tmp_key = 'type';
|
||||||
|
}
|
||||||
|
|
||||||
if($tmp_key == 'tax_id')
|
if($tmp_key == 'tax_id') {
|
||||||
$tmp_key = 'tax_category';
|
$tmp_key = 'tax_category';
|
||||||
|
}
|
||||||
|
|
||||||
if (property_exists($item, $tmp_key)) {
|
if (property_exists($item, $tmp_key)) {
|
||||||
$item_array[$key] = $item->{$tmp_key};
|
$item_array[$key] = $item->{$tmp_key};
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$item_array[$key] = '';
|
$item_array[$key] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,8 +110,7 @@ class TaskExport extends BaseExport
|
|||||||
|
|
||||||
$this->buildRow($resource);
|
$this->buildRow($resource);
|
||||||
|
|
||||||
foreach($this->storage_array as $row)
|
foreach($this->storage_array as $row) {
|
||||||
{
|
|
||||||
$this->storage_item_array[] = $this->processMetaData($row, $resource);
|
$this->storage_item_array[] = $this->processMetaData($row, $resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
namespace App\Export\CSV;
|
namespace App\Export\CSV;
|
||||||
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Vendor;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Models\Vendor;
|
||||||
use App\Transformers\VendorContactTransformer;
|
use App\Transformers\VendorContactTransformer;
|
||||||
use App\Transformers\VendorTransformer;
|
use App\Transformers\VendorTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Factory;
|
namespace App\Factory;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\DataMapper\Tax\TaxModel;
|
|
||||||
use App\DataMapper\CompanySettings;
|
|
||||||
use App\DataMapper\ClientRegistrationFields;
|
use App\DataMapper\ClientRegistrationFields;
|
||||||
|
use App\DataMapper\CompanySettings;
|
||||||
|
use App\DataMapper\Tax\TaxModel;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class CompanyFactory
|
class CompanyFactory
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,8 @@ class DesignFactory
|
|||||||
$design->is_active = true;
|
$design->is_active = true;
|
||||||
$design->is_custom = true;
|
$design->is_custom = true;
|
||||||
$design->name = '';
|
$design->name = '';
|
||||||
|
$design->is_template = false;
|
||||||
|
$design->entities = '';
|
||||||
$design->design = new DesignBlocks();
|
$design->design = new DesignBlocks();
|
||||||
|
|
||||||
return $design;
|
return $design;
|
||||||
|
@ -63,7 +63,7 @@ class InvoiceItemFactory
|
|||||||
$item->line_total = $item->quantity * $item->cost;
|
$item->line_total = $item->quantity * $item->cost;
|
||||||
$item->is_amount_discount = true;
|
$item->is_amount_discount = true;
|
||||||
$item->discount = $faker->numberBetween(1, 10);
|
$item->discount = $faker->numberBetween(1, 10);
|
||||||
$item->notes = $faker->realText(50);
|
$item->notes = str_replace(['"',"'"], ['',""], $faker->realText(20));
|
||||||
$item->product_key = $faker->word();
|
$item->product_key = $faker->word();
|
||||||
// $item->custom_value1 = $faker->realText(10);
|
// $item->custom_value1 = $faker->realText(10);
|
||||||
// $item->custom_value2 = $faker->realText(10);
|
// $item->custom_value2 = $faker->realText(10);
|
||||||
|
@ -54,6 +54,19 @@ class DesignFilters extends QueryFilters
|
|||||||
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function entities(string $entities = ''): Builder
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strlen($entities) == 0 || str_contains($entities, ',')) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder
|
||||||
|
->where('is_template', true)
|
||||||
|
->whereRaw('FIND_IN_SET( ? ,entities)', [trim($entities)]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the query by the users company ID.
|
* Filters the query by the users company ID.
|
||||||
*
|
*
|
||||||
@ -69,6 +82,17 @@ class DesignFilters extends QueryFilters
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function template(string $template = 'false'): Builder
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strlen($template) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bool_val = $template == 'true' ? true : false;
|
||||||
|
|
||||||
|
return $this->builder->where('is_template', $bool_val);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Filter the designs by `is_custom` column.
|
* Filter the designs by `is_custom` column.
|
||||||
*
|
*
|
||||||
|
@ -11,14 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Filters;
|
namespace App\Filters;
|
||||||
|
|
||||||
use RuntimeException;
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Filters\QueryFilters;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InvoiceFilters.
|
* InvoiceFilters.
|
||||||
@ -247,9 +246,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
$end_date = Carbon::parse($parts[2]);
|
$end_date = Carbon::parse($parts[2]);
|
||||||
|
|
||||||
return $this->builder->whereBetween($parts[0], [$start_date, $end_date]);
|
return $this->builder->whereBetween($parts[0], [$start_date, $end_date]);
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
|
|
||||||
catch(\Exception $e){
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
namespace App\Filters;
|
namespace App\Filters;
|
||||||
|
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder as EloquentBuilder;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentFilters.
|
* PaymentFilters.
|
||||||
@ -196,9 +195,7 @@ class PaymentFilters extends QueryFilters
|
|||||||
$end_date = Carbon::parse($parts[2]);
|
$end_date = Carbon::parse($parts[2]);
|
||||||
|
|
||||||
return $this->builder->whereBetween($parts[0], [$start_date, $end_date]);
|
return $this->builder->whereBetween($parts[0], [$start_date, $end_date]);
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
|
|
||||||
catch(\Exception $e){
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,9 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Bank\Yodlee\DTO;
|
namespace App\Helpers\Bank\Yodlee\DTO;
|
||||||
|
|
||||||
use Spatie\LaravelData\Data;
|
|
||||||
use Spatie\LaravelData\Attributes\MapInputName;
|
|
||||||
use Spatie\LaravelData\Attributes\MapOutputName;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Spatie\LaravelData\Attributes\MapInputName;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [
|
* [
|
||||||
|
@ -88,8 +88,7 @@ class AccountTransformer implements AccountTransformerInterface
|
|||||||
if(property_exists($account, 'currentBalance')) {
|
if(property_exists($account, 'currentBalance')) {
|
||||||
$current_balance = $account->currentBalance->amount ?? 0;
|
$current_balance = $account->currentBalance->amount ?? 0;
|
||||||
$account_currency = $account->currentBalance->currency ?? '';
|
$account_currency = $account->currentBalance->currency ?? '';
|
||||||
}
|
} elseif(property_exists($account, 'balance')) {
|
||||||
elseif(property_exists($account, 'balance')){
|
|
||||||
$current_balance = $account->balance->amount ?? 0;
|
$current_balance = $account->balance->amount ?? 0;
|
||||||
$account_currency = $account->balance->currency ?? '';
|
$account_currency = $account->balance->currency ?? '';
|
||||||
}
|
}
|
||||||
@ -129,8 +128,7 @@ class AccountTransformer implements AccountTransformerInterface
|
|||||||
|
|
||||||
if($status && $update) {
|
if($status && $update) {
|
||||||
$account_status = $status . ' - ' . $update;
|
$account_status = $status . ' - ' . $update;
|
||||||
}
|
} elseif($update) {
|
||||||
elseif($update){
|
|
||||||
$account_status = $update;
|
$account_status = $update;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,12 +127,14 @@ class IncomeTransformer implements BankRevenueInterface
|
|||||||
|
|
||||||
foreach ($transaction->transaction as $transaction) {
|
foreach ($transaction->transaction as $transaction) {
|
||||||
//do not store duplicate / pending transactions
|
//do not store duplicate / pending transactions
|
||||||
if (property_exists($transaction, 'status') && $transaction->status == 'PENDING')
|
if (property_exists($transaction, 'status') && $transaction->status == 'PENDING') {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//some object do no store amounts ignore these
|
//some object do no store amounts ignore these
|
||||||
if(!property_exists($transaction, 'amount'))
|
if(!property_exists($transaction, 'amount')) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$data[] = $this->transformTransaction($transaction);
|
$data[] = $this->transformTransaction($transaction);
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,16 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Invoice;
|
namespace App\Helpers\Invoice;
|
||||||
|
|
||||||
use App\Models\Quote;
|
use App\DataMapper\BaseSettings;
|
||||||
|
use App\DataMapper\InvoiceItem;
|
||||||
|
use App\DataMapper\Tax\RuleInterface;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use App\Models\RecurringQuote;
|
use App\Models\Quote;
|
||||||
use App\DataMapper\InvoiceItem;
|
|
||||||
use App\DataMapper\BaseSettings;
|
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use App\DataMapper\Tax\RuleInterface;
|
use App\Models\RecurringQuote;
|
||||||
use App\Utils\Traits\NumberFormatter;
|
use App\Utils\Traits\NumberFormatter;
|
||||||
|
|
||||||
class InvoiceItemSum
|
class InvoiceItemSum
|
||||||
@ -181,8 +181,9 @@ class InvoiceItemSum
|
|||||||
|
|
||||||
$this->rule = new $class();
|
$this->rule = new $class();
|
||||||
|
|
||||||
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2))
|
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2)) {
|
||||||
return $this;
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$this->rule
|
$this->rule
|
||||||
->setEntity($this->invoice)
|
->setEntity($this->invoice)
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Invoice;
|
namespace App\Helpers\Invoice;
|
||||||
|
|
||||||
use App\Models\Quote;
|
use App\DataMapper\Tax\RuleInterface;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use App\Models\RecurringQuote;
|
use App\Models\Quote;
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use App\DataMapper\Tax\RuleInterface;
|
use App\Models\RecurringQuote;
|
||||||
use App\Utils\Traits\NumberFormatter;
|
use App\Utils\Traits\NumberFormatter;
|
||||||
|
|
||||||
class InvoiceItemSumInclusive
|
class InvoiceItemSumInclusive
|
||||||
@ -410,8 +410,9 @@ class InvoiceItemSumInclusive
|
|||||||
|
|
||||||
$this->rule = new $class();
|
$this->rule = new $class();
|
||||||
|
|
||||||
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2))
|
if($this->rule->regionWithNoTaxCoverage($this->client->country->iso_3166_2)) {
|
||||||
return $this;
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$this->rule
|
$this->rule
|
||||||
->setEntity($this->invoice)
|
->setEntity($this->invoice)
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Invoice;
|
namespace App\Helpers\Invoice;
|
||||||
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use App\Models\RecurringQuote;
|
use App\Models\Quote;
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use Illuminate\Support\Collection;
|
use App\Models\RecurringQuote;
|
||||||
|
use App\Utils\Number;
|
||||||
use App\Utils\Traits\NumberFormatter;
|
use App\Utils\Traits\NumberFormatter;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class InvoiceSum
|
class InvoiceSum
|
||||||
{
|
{
|
||||||
|
@ -11,15 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Invoice;
|
namespace App\Helpers\Invoice;
|
||||||
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\PurchaseOrder;
|
use App\Models\PurchaseOrder;
|
||||||
use App\Models\RecurringQuote;
|
use App\Models\Quote;
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
use Illuminate\Support\Collection;
|
use App\Models\RecurringQuote;
|
||||||
use App\Utils\Traits\NumberFormatter;
|
use App\Utils\Traits\NumberFormatter;
|
||||||
use App\Helpers\Invoice\InvoiceItemSumInclusive;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class InvoiceSumInclusive
|
class InvoiceSumInclusive
|
||||||
{
|
{
|
||||||
|
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Utils\TruthSource;
|
|
||||||
use App\Models\CompanyUser;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Jobs\Account\CreateAccount;
|
|
||||||
use App\Transformers\AccountTransformer;
|
|
||||||
use App\Transformers\CompanyUserTransformer;
|
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
||||||
use App\Http\Requests\Account\CreateAccountRequest;
|
use App\Http\Requests\Account\CreateAccountRequest;
|
||||||
use App\Http\Requests\Account\UpdateAccountRequest;
|
use App\Http\Requests\Account\UpdateAccountRequest;
|
||||||
|
use App\Jobs\Account\CreateAccount;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Transformers\AccountTransformer;
|
||||||
|
use App\Transformers\CompanyUserTransformer;
|
||||||
|
use App\Utils\TruthSource;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class AccountController extends BaseController
|
class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use stdClass;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Activity;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\PhantomJS\Phantom;
|
|
||||||
use App\Utils\HostedPDF\NinjaPdf;
|
|
||||||
use App\Utils\Traits\Pdf\PdfMaker;
|
|
||||||
use App\Utils\Traits\Pdf\PageNumbering;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Transformers\ActivityTransformer;
|
|
||||||
use App\Http\Requests\Activity\ShowActivityRequest;
|
|
||||||
use App\Http\Requests\Activity\DownloadHistoricalEntityRequest;
|
use App\Http\Requests\Activity\DownloadHistoricalEntityRequest;
|
||||||
|
use App\Http\Requests\Activity\ShowActivityRequest;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
|
use App\Utils\HostedPDF\NinjaPdf;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\PhantomJS\Phantom;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\Pdf\PageNumbering;
|
||||||
|
use App\Utils\Traits\Pdf\PdfMaker;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
class ActivityController extends BaseController
|
class ActivityController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Support\Facades\Password;
|
|
||||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
|
||||||
class ForgotPasswordController extends Controller
|
class ForgotPasswordController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -25,4 +25,3 @@ class PasswordTimeoutController extends Controller
|
|||||||
return $cached ? response()->json(['message' => 'Password is valid'], 200) : response()->json(['message' => 'Invalid Password'], 412);
|
return $cached ? response()->json(['message' => 'Password is valid'], 200) : response()->json(['message' => 'Invalid Password'], 412);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +111,9 @@ class ResetPasswordController extends Controller
|
|||||||
{
|
{
|
||||||
auth()->logout();
|
auth()->logout();
|
||||||
|
|
||||||
if(request()->has('react') || request()->hasHeader('X-React'))
|
if(request()->has('react') || request()->hasHeader('X-React')) {
|
||||||
return redirect(config('ninja.react_url').'/#/login');
|
return redirect(config('ninja.react_url').'/#/login');
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
@ -132,9 +133,9 @@ class ResetPasswordController extends Controller
|
|||||||
|
|
||||||
if($request->hasHeader('X-REACT') || $request->has('react')) {
|
if($request->hasHeader('X-REACT') || $request->has('react')) {
|
||||||
return redirect(config('ninja.react_url').'/#/login');
|
return redirect(config('ninja.react_url').'/#/login');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return redirect('/#/login');
|
return redirect('/#/login');
|
||||||
|
}
|
||||||
|
|
||||||
return redirect($this->redirectPath())
|
return redirect($this->redirectPath())
|
||||||
->with('status', trans($response));
|
->with('status', trans($response));
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
namespace App\Http\Controllers\Bank;
|
namespace App\Http\Controllers\Bank;
|
||||||
|
|
||||||
use App\Helpers\Bank\Yodlee\DTO\AccountSummary;
|
use App\Helpers\Bank\Yodlee\DTO\AccountSummary;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\BankIntegration;
|
|
||||||
use App\Helpers\Bank\Yodlee\Yodlee;
|
use App\Helpers\Bank\Yodlee\Yodlee;
|
||||||
use App\Http\Controllers\BaseController;
|
use App\Http\Controllers\BaseController;
|
||||||
use App\Jobs\Bank\ProcessBankTransactions;
|
|
||||||
use App\Http\Requests\Yodlee\YodleeAuthRequest;
|
|
||||||
use App\Http\Requests\Yodlee\YodleeAdminRequest;
|
use App\Http\Requests\Yodlee\YodleeAdminRequest;
|
||||||
|
use App\Http\Requests\Yodlee\YodleeAuthRequest;
|
||||||
|
use App\Jobs\Bank\ProcessBankTransactions;
|
||||||
|
use App\Models\BankIntegration;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class YodleeController extends BaseController
|
class YodleeController extends BaseController
|
||||||
{
|
{
|
||||||
@ -292,8 +292,9 @@ class YodleeController extends BaseController
|
|||||||
->where('account_id', $account_number)
|
->where('account_id', $account_number)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if(!$bank_integration)
|
if(!$bank_integration) {
|
||||||
return response()->json(['message' => 'Account does not exist.'], 400);
|
return response()->json(['message' => 'Account does not exist.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
$yodlee = new Yodlee($user->account->bank_integration_account_id);
|
$yodlee = new Yodlee($user->account->bank_integration_account_id);
|
||||||
|
|
||||||
|
@ -11,26 +11,25 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Models\BankIntegration;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use App\Helpers\Bank\Yodlee\Yodlee;
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use App\Factory\BankIntegrationFactory;
|
use App\Factory\BankIntegrationFactory;
|
||||||
use App\Filters\BankIntegrationFilters;
|
use App\Filters\BankIntegrationFilters;
|
||||||
use App\Jobs\Bank\ProcessBankTransactions;
|
use App\Helpers\Bank\Yodlee\Yodlee;
|
||||||
use App\Repositories\BankIntegrationRepository;
|
use App\Http\Requests\BankIntegration\AdminBankIntegrationRequest;
|
||||||
use App\Transformers\BankIntegrationTransformer;
|
|
||||||
use App\Http\Requests\BankIntegration\BulkBankIntegrationRequest;
|
use App\Http\Requests\BankIntegration\BulkBankIntegrationRequest;
|
||||||
|
use App\Http\Requests\BankIntegration\CreateBankIntegrationRequest;
|
||||||
|
use App\Http\Requests\BankIntegration\DestroyBankIntegrationRequest;
|
||||||
use App\Http\Requests\BankIntegration\EditBankIntegrationRequest;
|
use App\Http\Requests\BankIntegration\EditBankIntegrationRequest;
|
||||||
use App\Http\Requests\BankIntegration\ShowBankIntegrationRequest;
|
use App\Http\Requests\BankIntegration\ShowBankIntegrationRequest;
|
||||||
use App\Http\Requests\BankIntegration\AdminBankIntegrationRequest;
|
|
||||||
use App\Http\Requests\BankIntegration\StoreBankIntegrationRequest;
|
use App\Http\Requests\BankIntegration\StoreBankIntegrationRequest;
|
||||||
use App\Http\Requests\BankIntegration\CreateBankIntegrationRequest;
|
|
||||||
use App\Http\Requests\BankIntegration\UpdateBankIntegrationRequest;
|
use App\Http\Requests\BankIntegration\UpdateBankIntegrationRequest;
|
||||||
use App\Http\Requests\BankIntegration\DestroyBankIntegrationRequest;
|
use App\Jobs\Bank\ProcessBankTransactions;
|
||||||
|
use App\Models\BankIntegration;
|
||||||
|
use App\Repositories\BankIntegrationRepository;
|
||||||
|
use App\Transformers\BankIntegrationTransformer;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
class BankIntegrationController extends BaseController
|
class BankIntegrationController extends BaseController
|
||||||
{
|
{
|
||||||
@ -214,8 +213,7 @@ class BankIntegrationController extends BaseController
|
|||||||
$bi->balance = $account['current_balance'];
|
$bi->balance = $account['current_balance'];
|
||||||
$bi->currency = $account['account_currency'];
|
$bi->currency = $account['account_currency'];
|
||||||
$bi->save();
|
$bi->save();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$bank_integration = new BankIntegration();
|
$bank_integration = new BankIntegration();
|
||||||
$bank_integration->company_id = $user->company()->id;
|
$bank_integration->company_id = $user->company()->id;
|
||||||
$bank_integration->account_id = $user->account_id;
|
$bank_integration->account_id = $user->account_id;
|
||||||
|
@ -11,20 +11,20 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Models\BankTransactionRule;
|
|
||||||
use App\Factory\BankTransactionRuleFactory;
|
use App\Factory\BankTransactionRuleFactory;
|
||||||
use App\Filters\BankTransactionRuleFilters;
|
use App\Filters\BankTransactionRuleFilters;
|
||||||
use App\Repositories\BankTransactionRuleRepository;
|
|
||||||
use App\Transformers\BankTransactionRuleTransformer;
|
|
||||||
use App\Http\Requests\BankTransactionRule\BulkBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\BulkBankTransactionRuleRequest;
|
||||||
|
use App\Http\Requests\BankTransactionRule\CreateBankTransactionRuleRequest;
|
||||||
|
use App\Http\Requests\BankTransactionRule\DestroyBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\EditBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\EditBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\ShowBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\ShowBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\StoreBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\StoreBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\CreateBankTransactionRuleRequest;
|
|
||||||
use App\Http\Requests\BankTransactionRule\UpdateBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\UpdateBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\DestroyBankTransactionRuleRequest;
|
use App\Models\BankTransactionRule;
|
||||||
|
use App\Repositories\BankTransactionRuleRepository;
|
||||||
use App\Services\Bank\BankMatchingService;
|
use App\Services\Bank\BankMatchingService;
|
||||||
|
use App\Transformers\BankTransactionRuleTransformer;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class BankTransactionRuleController extends BaseController
|
class BankTransactionRuleController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -926,8 +926,7 @@ class BaseController extends Controller
|
|||||||
} //allows us to selective display bank integrations back to the user if they can view / create bank transactions but without the bank balance being present in the response
|
} //allows us to selective display bank integrations back to the user if they can view / create bank transactions but without the bank balance being present in the response
|
||||||
elseif($this->entity_type == TaxRate::class && $user->hasIntersectPermissions(['create_invoice','edit_invoice','create_quote','edit_quote','create_purchase_order','edit_purchase_order'])) {
|
elseif($this->entity_type == TaxRate::class && $user->hasIntersectPermissions(['create_invoice','edit_invoice','create_quote','edit_quote','create_purchase_order','edit_purchase_order'])) {
|
||||||
// need to show tax rates if the user has the ability to create documents.
|
// need to show tax rates if the user has the ability to create documents.
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$query->where('user_id', '=', $user->id);
|
$query->where('user_id', '=', $user->id);
|
||||||
}
|
}
|
||||||
} 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])) {
|
||||||
|
@ -11,36 +11,36 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\SystemLog;
|
|
||||||
use Postmark\PostmarkClient;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Factory\ClientFactory;
|
|
||||||
use App\Filters\ClientFilters;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\Traits\Uploadable;
|
|
||||||
use App\Utils\Traits\BulkOptions;
|
|
||||||
use App\Jobs\Client\UpdateTaxData;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use App\Repositories\ClientRepository;
|
|
||||||
use App\Events\Client\ClientWasCreated;
|
use App\Events\Client\ClientWasCreated;
|
||||||
use App\Events\Client\ClientWasUpdated;
|
use App\Events\Client\ClientWasUpdated;
|
||||||
use App\Transformers\ClientTransformer;
|
use App\Factory\ClientFactory;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use App\Filters\ClientFilters;
|
||||||
use App\Http\Requests\Client\BulkClientRequest;
|
use App\Http\Requests\Client\BulkClientRequest;
|
||||||
use App\Http\Requests\Client\EditClientRequest;
|
|
||||||
use App\Http\Requests\Client\ShowClientRequest;
|
|
||||||
use App\Http\Requests\Client\PurgeClientRequest;
|
|
||||||
use App\Http\Requests\Client\StoreClientRequest;
|
|
||||||
use App\Http\Requests\Client\CreateClientRequest;
|
use App\Http\Requests\Client\CreateClientRequest;
|
||||||
|
use App\Http\Requests\Client\DestroyClientRequest;
|
||||||
|
use App\Http\Requests\Client\EditClientRequest;
|
||||||
|
use App\Http\Requests\Client\PurgeClientRequest;
|
||||||
|
use App\Http\Requests\Client\ReactivateClientEmailRequest;
|
||||||
|
use App\Http\Requests\Client\ShowClientRequest;
|
||||||
|
use App\Http\Requests\Client\StoreClientRequest;
|
||||||
use App\Http\Requests\Client\UpdateClientRequest;
|
use App\Http\Requests\Client\UpdateClientRequest;
|
||||||
use App\Http\Requests\Client\UploadClientRequest;
|
use App\Http\Requests\Client\UploadClientRequest;
|
||||||
use App\Http\Requests\Client\DestroyClientRequest;
|
use App\Jobs\Client\UpdateTaxData;
|
||||||
use App\Http\Requests\Client\ReactivateClientEmailRequest;
|
|
||||||
use App\Jobs\PostMark\ProcessPostmarkWebhook;
|
use App\Jobs\PostMark\ProcessPostmarkWebhook;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
use App\Repositories\ClientRepository;
|
||||||
|
use App\Transformers\ClientTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\BulkOptions;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
|
use App\Utils\Traits\Uploadable;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Postmark\PostmarkClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ClientController.
|
* Class ClientController.
|
||||||
@ -313,8 +313,9 @@ class ClientController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function updateTaxData(PurgeClientRequest $request, Client $client)
|
public function updateTaxData(PurgeClientRequest $request, Client $client)
|
||||||
{
|
{
|
||||||
if($client->company->account->isPaid())
|
if($client->company->account->isPaid()) {
|
||||||
(new UpdateTaxData($client, $client->company))->handle();
|
(new UpdateTaxData($client, $client->company))->handle();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->itemResponse($client->fresh());
|
return $this->itemResponse($client->fresh());
|
||||||
}
|
}
|
||||||
@ -367,8 +368,7 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
return response()->json(['message' => 'Success'], 200);
|
return response()->json(['message' => 'Success'], 200);
|
||||||
|
|
||||||
}
|
} catch(\Exception $e) {
|
||||||
catch(\Exception $e){
|
|
||||||
|
|
||||||
return response()->json(['message' => $e->getMessage(), 400]);
|
return response()->json(['message' => $e->getMessage(), 400]);
|
||||||
|
|
||||||
|
@ -11,11 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use App\Models\RecurringInvoice;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
|
||||||
use App\Http\ViewComposers\PortalComposer;
|
use App\Http\ViewComposers\PortalComposer;
|
||||||
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
|
||||||
class ContactHashLoginController extends Controller
|
class ContactHashLoginController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -1,184 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
|
||||||
|
|
||||||
use App\Events\Credit\CreditWasViewed;
|
|
||||||
use App\Events\Invoice\InvoiceWasViewed;
|
|
||||||
use App\Events\Misc\InvitationWasViewed;
|
|
||||||
use App\Events\Quote\QuoteWasViewed;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Routing\Redirector;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\View\View;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EntityViewController
|
|
||||||
* @deprecated 5.7 ?
|
|
||||||
*/
|
|
||||||
class EntityViewController extends Controller
|
|
||||||
{
|
|
||||||
use MakesHash;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Available options for viewing.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $entity_types = ['invoice', 'quote', 'credit', 'recurring_invoice'];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the entity outside client portal.
|
|
||||||
*
|
|
||||||
* @param string $entity_type
|
|
||||||
* @param string $invitation_key
|
|
||||||
* @return Factory|View
|
|
||||||
*/
|
|
||||||
public function index(string $entity_type, string $invitation_key)
|
|
||||||
{
|
|
||||||
if (! in_array($entity_type, $this->entity_types)) {
|
|
||||||
abort(404, 'Entity not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
$invitation_entity = sprintf('App\\Models\\%sInvitation', ucfirst($entity_type));
|
|
||||||
|
|
||||||
$key = $entity_type.'_id';
|
|
||||||
|
|
||||||
$invitation = $invitation_entity::where('key', $invitation_key)
|
|
||||||
->with('contact.client')
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
$contact = $invitation->contact;
|
|
||||||
$client = $contact->client;
|
|
||||||
$entity = $invitation->{$entity_type};
|
|
||||||
|
|
||||||
if (is_null($contact->password) || empty($contact->password)) {
|
|
||||||
return redirect("/client/password/reset?email={$contact->email}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
|
||||||
session()->flash("{$entity_type}_VIEW_{$entity->hashed_id}", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! session("{$entity_type}_VIEW_{$entity->hashed_id}")) {
|
|
||||||
return redirect()->route('client.entity_view.password', compact('entity_type', 'invitation_key'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('view_entity.index', [
|
|
||||||
'root' => 'themes',
|
|
||||||
'entity' => $entity,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for entering password.
|
|
||||||
*
|
|
||||||
* @param string $entity_type
|
|
||||||
* @param string $invitation_key
|
|
||||||
*
|
|
||||||
* @return Factory|View
|
|
||||||
*/
|
|
||||||
public function password(string $entity_type, string $invitation_key)
|
|
||||||
{
|
|
||||||
return $this->render('view_entity.password', [
|
|
||||||
'root' => 'themes',
|
|
||||||
'entity_type' => $entity_type,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**`
|
|
||||||
* Handle the password check.
|
|
||||||
*
|
|
||||||
* @param string $entity_type
|
|
||||||
* @param string $invitation_key
|
|
||||||
*
|
|
||||||
* @return Redirector|RedirectResponse|mixed
|
|
||||||
*/
|
|
||||||
public function handlePassword(string $entity_type, string $invitation_key)
|
|
||||||
{
|
|
||||||
if (! in_array($entity_type, $this->entity_types)) {
|
|
||||||
abort(404, 'Entity not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
$invitation_entity = sprintf('App\\Models\\%sInvitation', ucfirst($entity_type));
|
|
||||||
|
|
||||||
$key = $entity_type.'_id';
|
|
||||||
|
|
||||||
$invitation = $invitation_entity::where('key', $invitation_key)->firstOrFail();
|
|
||||||
|
|
||||||
$contact = $invitation->contact;
|
|
||||||
|
|
||||||
$check = Hash::check(request()->password, $contact->password);
|
|
||||||
|
|
||||||
$entity_class = sprintf('App\\Models\\%s', ucfirst($entity_type));
|
|
||||||
|
|
||||||
$entity = $entity_class::findOrFail($invitation->{$key});
|
|
||||||
|
|
||||||
if ($check) {
|
|
||||||
session()->flash("{$entity_type}_VIEW_{$entity->hashed_id}", true);
|
|
||||||
|
|
||||||
return redirect()->route('client.entity_view', compact('entity_type', 'invitation_key'));
|
|
||||||
}
|
|
||||||
|
|
||||||
session()->flash('PASSWORD_FAILED', true);
|
|
||||||
|
|
||||||
return back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function handlePasswordSet(Request $request)
|
|
||||||
{
|
|
||||||
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($request->entity_type)).'Invitation';
|
|
||||||
$key = $request->entity_type.'_id';
|
|
||||||
|
|
||||||
$invitation = $entity_obj::where('key', $request->invitation_key)
|
|
||||||
->whereHas($request->entity_type, function ($query) {
|
|
||||||
$query->where('is_deleted', 0);
|
|
||||||
})
|
|
||||||
->with('contact.client')
|
|
||||||
->firstOrFail();
|
|
||||||
|
|
||||||
$contact = $invitation->contact;
|
|
||||||
$contact->password = Hash::make($request->password);
|
|
||||||
$contact->save();
|
|
||||||
|
|
||||||
$request->session()->invalidate();
|
|
||||||
auth()->guard('contact')->loginUsingId($contact->id, true);
|
|
||||||
|
|
||||||
if (! $invitation->viewed_date) {
|
|
||||||
$invitation->markViewed();
|
|
||||||
|
|
||||||
if (! session()->get('is_silent')) {
|
|
||||||
event(new InvitationWasViewed($invitation->{$request->entity_type}, $invitation, $invitation->{$request->entity_type}->company, Ninja::eventVars()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! session()->get('is_silent')) {
|
|
||||||
$this->fireEntityViewedEvent($invitation, $request->entity_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route('client.'.$request->entity_type.'.show', [$request->entity_type => $this->encodePrimaryKey($invitation->{$key})]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function fireEntityViewedEvent($invitation, $entity_string)
|
|
||||||
{
|
|
||||||
switch ($entity_string) {
|
|
||||||
case 'invoice':
|
|
||||||
event(new InvoiceWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
|
||||||
break;
|
|
||||||
case 'quote':
|
|
||||||
event(new QuoteWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
|
||||||
break;
|
|
||||||
case 'credit':
|
|
||||||
event(new CreditWasViewed($invitation, $invitation->company, Ninja::eventVars()));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// code...
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,27 +11,27 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\ClientContact;
|
|
||||||
use App\Models\QuoteInvitation;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Models\CreditInvitation;
|
|
||||||
use App\Utils\Traits\MakesDates;
|
|
||||||
use App\Jobs\Entity\CreateRawPdf;
|
|
||||||
use App\Models\InvoiceInvitation;
|
|
||||||
use App\Events\Quote\QuoteWasViewed;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use App\Events\Credit\CreditWasViewed;
|
|
||||||
use App\Events\Contact\ContactLoggedIn;
|
use App\Events\Contact\ContactLoggedIn;
|
||||||
use App\Models\PurchaseOrderInvitation;
|
use App\Events\Credit\CreditWasViewed;
|
||||||
use App\Events\Invoice\InvoiceWasViewed;
|
use App\Events\Invoice\InvoiceWasViewed;
|
||||||
use App\Events\Misc\InvitationWasViewed;
|
use App\Events\Misc\InvitationWasViewed;
|
||||||
|
use App\Events\Quote\QuoteWasViewed;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Jobs\Entity\CreateRawPdf;
|
||||||
|
use App\Models\ClientContact;
|
||||||
|
use App\Models\CreditInvitation;
|
||||||
|
use App\Models\InvoiceInvitation;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\PurchaseOrderInvitation;
|
||||||
|
use App\Models\QuoteInvitation;
|
||||||
use App\Services\ClientPortal\InstantPayment;
|
use App\Services\ClientPortal\InstantPayment;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesDates;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class InvitationController.
|
* Class InvitationController.
|
||||||
@ -195,7 +195,7 @@ class InvitationController extends Controller
|
|||||||
|
|
||||||
$file_name = $invitation->{$entity}->numberFormatter().'.pdf';
|
$file_name = $invitation->{$entity}->numberFormatter().'.pdf';
|
||||||
|
|
||||||
$file = (new CreateRawPdf($invitation, $invitation->company->db))->handle();
|
$file = (new CreateRawPdf($invitation))->handle();
|
||||||
|
|
||||||
$headers = ['Content-Type' => 'application/pdf'];
|
$headers = ['Content-Type' => 'application/pdf'];
|
||||||
|
|
||||||
@ -212,6 +212,41 @@ class InvitationController extends Controller
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function handlePasswordSet(Request $request)
|
||||||
|
{
|
||||||
|
$entity_obj = 'App\Models\\'.ucfirst(Str::camel($request->entity_type)).'Invitation';
|
||||||
|
$key = $request->entity_type.'_id';
|
||||||
|
|
||||||
|
$invitation = $entity_obj::where('key', $request->invitation_key)
|
||||||
|
->whereHas($request->entity_type, function ($query) {
|
||||||
|
$query->where('is_deleted', 0);
|
||||||
|
})
|
||||||
|
->with('contact.client')
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
$contact = $invitation->contact;
|
||||||
|
$contact->password = Hash::make($request->password);
|
||||||
|
$contact->save();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
auth()->guard('contact')->loginUsingId($contact->id, true);
|
||||||
|
|
||||||
|
if (! $invitation->viewed_date) {
|
||||||
|
$invitation->markViewed();
|
||||||
|
|
||||||
|
if (! session()->get('is_silent')) {
|
||||||
|
event(new InvitationWasViewed($invitation->{$request->entity_type}, $invitation, $invitation->{$request->entity_type}->company, Ninja::eventVars()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! session()->get('is_silent')) {
|
||||||
|
$this->fireEntityViewedEvent($invitation, $request->entity_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('client.'.$request->entity_type.'.show', [$request->entity_type => $this->encodePrimaryKey($invitation->{$key})]);
|
||||||
|
}
|
||||||
|
|
||||||
public function paymentRouter(string $contact_key, string $payment_id)
|
public function paymentRouter(string $contact_key, string $payment_id)
|
||||||
{
|
{
|
||||||
/** @var \App\Models\ClientContact $contact **/
|
/** @var \App\Models\ClientContact $contact **/
|
||||||
|
@ -11,29 +11,27 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Utils\Number;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use Illuminate\View\View;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\QuoteInvitation;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Models\CreditInvitation;
|
|
||||||
use App\Utils\Traits\MakesDates;
|
|
||||||
use App\Models\InvoiceInvitation;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use App\Models\PurchaseOrderInvitation;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Events\Invoice\InvoiceWasViewed;
|
use App\Events\Invoice\InvoiceWasViewed;
|
||||||
use App\Events\Misc\InvitationWasViewed;
|
use App\Events\Misc\InvitationWasViewed;
|
||||||
use App\Models\RecurringInvoiceInvitation;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Jobs\Vendor\CreatePurchaseOrderPdf;
|
use App\Http\Requests\ClientPortal\Invoices\ProcessInvoicesInBulkRequest;
|
||||||
use App\Http\Requests\ClientPortal\Invoices\ShowInvoiceRequest;
|
use App\Http\Requests\ClientPortal\Invoices\ShowInvoiceRequest;
|
||||||
use App\Http\Requests\ClientPortal\Invoices\ShowInvoicesRequest;
|
use App\Http\Requests\ClientPortal\Invoices\ShowInvoicesRequest;
|
||||||
use App\Http\Requests\ClientPortal\Invoices\ProcessInvoicesInBulkRequest;
|
use App\Models\CreditInvitation;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\InvoiceInvitation;
|
||||||
|
use App\Models\QuoteInvitation;
|
||||||
|
use App\Models\RecurringInvoiceInvitation;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Number;
|
||||||
|
use App\Utils\Traits\MakesDates;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Contracts\View\Factory;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class InvoiceController extends Controller
|
class InvoiceController extends Controller
|
||||||
{
|
{
|
||||||
@ -107,7 +105,7 @@ class InvoiceController extends Controller
|
|||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation, $invitation->company->db))->handle();
|
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation))->handle();
|
||||||
|
|
||||||
$headers = ['Content-Type' => 'application/pdf'];
|
$headers = ['Content-Type' => 'application/pdf'];
|
||||||
return response()->make($file, 200, $headers);
|
return response()->make($file, 200, $headers);
|
||||||
|
@ -27,7 +27,6 @@ use App\Services\Subscription\SubscriptionService;
|
|||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
@ -12,22 +12,21 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
use App\Events\Misc\InvitationWasViewed;
|
||||||
use App\Models\Quote;
|
|
||||||
use Illuminate\View\View;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\QuoteInvitation;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Events\Quote\QuoteWasViewed;
|
use App\Events\Quote\QuoteWasViewed;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Jobs\Invoice\InjectSignature;
|
use App\Http\Requests\ClientPortal\Quotes\ProcessQuotesInBulkRequest;
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Events\Misc\InvitationWasViewed;
|
|
||||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
|
||||||
use App\Http\Requests\ClientPortal\Quotes\ShowQuoteRequest;
|
use App\Http\Requests\ClientPortal\Quotes\ShowQuoteRequest;
|
||||||
use App\Http\Requests\ClientPortal\Quotes\ShowQuotesRequest;
|
use App\Http\Requests\ClientPortal\Quotes\ShowQuotesRequest;
|
||||||
use App\Http\Requests\ClientPortal\Quotes\ProcessQuotesInBulkRequest;
|
use App\Jobs\Invoice\InjectSignature;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use App\Models\QuoteInvitation;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Contracts\View\Factory;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||||
|
|
||||||
class QuoteController extends Controller
|
class QuoteController extends Controller
|
||||||
{
|
{
|
||||||
@ -137,7 +136,7 @@ class QuoteController extends Controller
|
|||||||
|
|
||||||
if ($quote_invitations->count() == 1) {
|
if ($quote_invitations->count() == 1) {
|
||||||
$invitation = $quote_invitations->first();
|
$invitation = $quote_invitations->first();
|
||||||
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation, $invitation->company->db))->handle();
|
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation))->handle();
|
||||||
return response()->streamDownload(function () use ($file) {
|
return response()->streamDownload(function () use ($file) {
|
||||||
echo $file;
|
echo $file;
|
||||||
}, $invitation->quote->numberFormatter().".pdf", ['Content-Type' => 'application/pdf']);
|
}, $invitation->quote->numberFormatter().".pdf", ['Content-Type' => 'application/pdf']);
|
||||||
@ -152,7 +151,7 @@ class QuoteController extends Controller
|
|||||||
$zipFile = new \PhpZip\ZipFile();
|
$zipFile = new \PhpZip\ZipFile();
|
||||||
try {
|
try {
|
||||||
foreach ($quote_invitations as $invitation) {
|
foreach ($quote_invitations as $invitation) {
|
||||||
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation, $invitation->company->db))->handle();
|
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation))->handle();
|
||||||
$zipFile->addFromString($invitation->quote->numberFormatter() . '.pdf', $file);
|
$zipFile->addFromString($invitation->quote->numberFormatter() . '.pdf', $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Requests\Statements\CreateStatementRequest;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\Pdf\PdfMaker;
|
use App\Utils\Traits\Pdf\PdfMaker;
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
use App\Http\Requests\Statements\CreateStatementRequest;
|
|
||||||
|
|
||||||
class ClientStatementController extends BaseController
|
class ClientStatementController extends BaseController
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ class ClientStatementController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pdf = $request->client()->service()->statement(
|
$pdf = $request->client()->service()->statement(
|
||||||
$request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table', 'status', 'show_credits_table']),
|
$request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table', 'status', 'show_credits_table', 'template']),
|
||||||
$send_email
|
$send_email
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -11,39 +11,38 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Str;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\CompanyUser;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\Traits\Uploadable;
|
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
|
||||||
use App\DataMapper\CompanySettings;
|
|
||||||
use App\Jobs\Company\CreateCompany;
|
|
||||||
use App\Jobs\Company\CompanyTaxRate;
|
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
|
||||||
use App\Mail\Company\CompanyDeleted;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use Turbo124\Beacon\Facades\LightLogs;
|
|
||||||
use App\Repositories\CompanyRepository;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
|
||||||
use App\Transformers\CompanyTransformer;
|
|
||||||
use App\DataMapper\Analytics\AccountDeleted;
|
use App\DataMapper\Analytics\AccountDeleted;
|
||||||
use App\Transformers\CompanyUserTransformer;
|
use App\DataMapper\CompanySettings;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use App\Http\Requests\Company\CreateCompanyRequest;
|
||||||
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
use App\Http\Requests\Company\DefaultCompanyRequest;
|
||||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
use App\Http\Requests\Company\DestroyCompanyRequest;
|
||||||
use App\Http\Requests\Company\EditCompanyRequest;
|
use App\Http\Requests\Company\EditCompanyRequest;
|
||||||
use App\Http\Requests\Company\ShowCompanyRequest;
|
use App\Http\Requests\Company\ShowCompanyRequest;
|
||||||
use App\Http\Requests\Company\StoreCompanyRequest;
|
use App\Http\Requests\Company\StoreCompanyRequest;
|
||||||
use App\Http\Requests\Company\CreateCompanyRequest;
|
|
||||||
use App\Http\Requests\Company\UpdateCompanyRequest;
|
use App\Http\Requests\Company\UpdateCompanyRequest;
|
||||||
use App\Http\Requests\Company\UploadCompanyRequest;
|
use App\Http\Requests\Company\UploadCompanyRequest;
|
||||||
use App\Http\Requests\Company\DefaultCompanyRequest;
|
use App\Jobs\Company\CompanyTaxRate;
|
||||||
use App\Http\Requests\Company\DestroyCompanyRequest;
|
use App\Jobs\Company\CreateCompany;
|
||||||
|
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
||||||
|
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||||
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Mail\Company\CompanyDeleted;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Repositories\CompanyRepository;
|
||||||
|
use App\Transformers\CompanyTransformer;
|
||||||
|
use App\Transformers\CompanyUserTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
|
use App\Utils\Traits\Uploadable;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Turbo124\Beacon\Facades\LightLogs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyController.
|
* Class CompanyController.
|
||||||
@ -684,16 +683,15 @@ class CompanyController extends BaseController
|
|||||||
public function updateOriginTaxData(DefaultCompanyRequest $request, Company $company)
|
public function updateOriginTaxData(DefaultCompanyRequest $request, Company $company)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($company->settings->country_id == "840" && !$company?->account->isFreeHostedClient())
|
if($company->settings->country_id == "840" && !$company?->account->isFreeHostedClient()) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
(new CompanyTaxRate($company))->handle();
|
(new CompanyTaxRate($company))->handle();
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
return response()->json(['message' => 'There was a problem updating the tax rates. Please try again.'], 400);
|
return response()->json(['message' => 'There was a problem updating the tax rates. Please try again.'], 400);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
return response()->json(['message' => 'Tax configuration not available due to settings / plan restriction.'], 400);
|
return response()->json(['message' => 'Tax configuration not available due to settings / plan restriction.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->itemResponse($company->fresh());
|
return $this->itemResponse($company->fresh());
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,7 @@ class CompanyGatewayController extends BaseController
|
|||||||
|
|
||||||
if (in_array($company_gateway->gateway_key, $this->stripe_keys)) {
|
if (in_array($company_gateway->gateway_key, $this->stripe_keys)) {
|
||||||
StripeWebhook::dispatch($company_gateway->company->company_key, $company_gateway->id);
|
StripeWebhook::dispatch($company_gateway->company->company_key, $company_gateway->id);
|
||||||
}
|
} elseif($company_gateway->gateway_key == $this->checkout_key) {
|
||||||
elseif($company_gateway->gateway_key == $this->checkout_key) {
|
|
||||||
CheckoutSetupWebhook::dispatch($company_gateway->company->company_key, $company_gateway->id);
|
CheckoutSetupWebhook::dispatch($company_gateway->company->company_key, $company_gateway->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\CompanyUser;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Transformers\UserTransformer;
|
|
||||||
use App\Transformers\CompanyUserTransformer;
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
||||||
use App\Http\Requests\CompanyUser\UpdateCompanyUserRequest;
|
|
||||||
use App\Http\Requests\CompanyUser\UpdateCompanyUserPreferencesRequest;
|
use App\Http\Requests\CompanyUser\UpdateCompanyUserPreferencesRequest;
|
||||||
|
use App\Http\Requests\CompanyUser\UpdateCompanyUserRequest;
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Transformers\CompanyUserTransformer;
|
||||||
|
use App\Transformers\UserTransformer;
|
||||||
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class CompanyUserController extends BaseController
|
class CompanyUserController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -11,35 +11,35 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Credit;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Factory\CreditFactory;
|
|
||||||
use App\Filters\CreditFilters;
|
|
||||||
use App\Jobs\Credit\ZipCredits;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Jobs\Entity\EmailEntity;
|
|
||||||
use App\Factory\CloneCreditFactory;
|
|
||||||
use App\Services\PdfMaker\PdfMerge;
|
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use App\Repositories\CreditRepository;
|
|
||||||
use App\Events\Credit\CreditWasCreated;
|
use App\Events\Credit\CreditWasCreated;
|
||||||
use App\Events\Credit\CreditWasUpdated;
|
use App\Events\Credit\CreditWasUpdated;
|
||||||
use App\Transformers\CreditTransformer;
|
use App\Factory\CloneCreditFactory;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use App\Factory\CreditFactory;
|
||||||
|
use App\Filters\CreditFilters;
|
||||||
|
use App\Http\Requests\Credit\ActionCreditRequest;
|
||||||
use App\Http\Requests\Credit\BulkCreditRequest;
|
use App\Http\Requests\Credit\BulkCreditRequest;
|
||||||
|
use App\Http\Requests\Credit\CreateCreditRequest;
|
||||||
|
use App\Http\Requests\Credit\DestroyCreditRequest;
|
||||||
use App\Http\Requests\Credit\EditCreditRequest;
|
use App\Http\Requests\Credit\EditCreditRequest;
|
||||||
use App\Http\Requests\Credit\ShowCreditRequest;
|
use App\Http\Requests\Credit\ShowCreditRequest;
|
||||||
use App\Http\Requests\Credit\StoreCreditRequest;
|
use App\Http\Requests\Credit\StoreCreditRequest;
|
||||||
use App\Http\Requests\Credit\ActionCreditRequest;
|
|
||||||
use App\Http\Requests\Credit\CreateCreditRequest;
|
|
||||||
use App\Http\Requests\Credit\UpdateCreditRequest;
|
use App\Http\Requests\Credit\UpdateCreditRequest;
|
||||||
use App\Http\Requests\Credit\UploadCreditRequest;
|
use App\Http\Requests\Credit\UploadCreditRequest;
|
||||||
use App\Http\Requests\Credit\DestroyCreditRequest;
|
use App\Jobs\Credit\ZipCredits;
|
||||||
|
use App\Jobs\Entity\EmailEntity;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\Credit;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Repositories\CreditRepository;
|
||||||
|
use App\Services\PdfMaker\PdfMerge;
|
||||||
|
use App\Transformers\CreditTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CreditController.
|
* Class CreditController.
|
||||||
@ -533,14 +533,14 @@ class CreditController extends BaseController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ZipCredits::dispatch($credits->pluck('id')->toArray(), $credits->first()->company, $user);
|
ZipCredits::dispatch($credits->pluck('id')->toArray(), $user->company(), $user);
|
||||||
|
|
||||||
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'bulk_print' && $user->can('view', $credits->first())) {
|
if ($action == 'bulk_print' && $user->can('view', $credits->first())) {
|
||||||
$paths = $credits->map(function ($credit) {
|
$paths = $credits->map(function ($credit) {
|
||||||
return (new \App\Jobs\Entity\CreateRawPdf($credit->invitations->first(), $credit->company->db))->handle();
|
return (new \App\Jobs\Entity\CreateRawPdf($credit->invitations->first()))->handle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$merge = (new PdfMerge($paths->toArray()))->run();
|
$merge = (new PdfMerge($paths->toArray()))->run();
|
||||||
@ -593,8 +593,8 @@ class CreditController extends BaseController
|
|||||||
$file = $credit->service()->getCreditPdf($credit->invitations->first());
|
$file = $credit->service()->getCreditPdf($credit->invitations->first());
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($file) {
|
return response()->streamDownload(function () use ($file) {
|
||||||
echo Storage::get($file);
|
echo $file;
|
||||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
}, $credit->numberFormatter().'.pdf', ['Content-Type' => 'application/pdf']);
|
||||||
break;
|
break;
|
||||||
case 'archive':
|
case 'archive':
|
||||||
$this->credit_repository->archive($credit);
|
$this->credit_repository->archive($credit);
|
||||||
@ -710,8 +710,9 @@ class CreditController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($file) {
|
return response()->streamDownload(function () use ($file) {
|
||||||
echo Storage::get($file);
|
echo $file;
|
||||||
}, basename($file), $headers);
|
}, $credit->numberFormatter().'.pdf', $headers);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +301,10 @@ class DesignController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function create(CreateDesignRequest $request)
|
public function create(CreateDesignRequest $request)
|
||||||
{
|
{
|
||||||
$design = DesignFactory::create(auth()->user()->company()->id, auth()->user()->id);
|
/** @var \App\Models\User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
$design = DesignFactory::create($user->company()->id, $user->id);
|
||||||
|
|
||||||
return $this->itemResponse($design);
|
return $this->itemResponse($design);
|
||||||
}
|
}
|
||||||
@ -346,7 +349,11 @@ class DesignController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function store(StoreDesignRequest $request)
|
public function store(StoreDesignRequest $request)
|
||||||
{
|
{
|
||||||
$design = DesignFactory::create(auth()->user()->company()->id, auth()->user()->id);
|
/** @var \App\Models\User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
$design = DesignFactory::create($user->company()->id, $user->id);
|
||||||
|
|
||||||
$design->fill($request->all());
|
$design->fill($request->all());
|
||||||
$design->save();
|
$design->save();
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ use App\Models\ExpenseCategory;
|
|||||||
use App\Repositories\BaseRepository;
|
use App\Repositories\BaseRepository;
|
||||||
use App\Transformers\ExpenseCategoryTransformer;
|
use App\Transformers\ExpenseCategoryTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Jobs\Company\CompanyExport;
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use App\Http\Requests\Export\StoreExportRequest;
|
use App\Http\Requests\Export\StoreExportRequest;
|
||||||
|
use App\Jobs\Company\CompanyExport;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class ExportController extends BaseController
|
class ExportController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -140,8 +140,9 @@ class GroupSettingController extends BaseController
|
|||||||
public function update(UpdateGroupSettingRequest $request, GroupSetting $group_setting)
|
public function update(UpdateGroupSettingRequest $request, GroupSetting $group_setting)
|
||||||
{
|
{
|
||||||
/** Need this to prevent settings from being overwritten */
|
/** Need this to prevent settings from being overwritten */
|
||||||
if(!$request->file('company_logo'))
|
if(!$request->file('company_logo')) {
|
||||||
$group_setting = $this->group_setting_repo->save($request->all(), $group_setting);
|
$group_setting = $this->group_setting_repo->save($request->all(), $group_setting);
|
||||||
|
}
|
||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting);
|
$this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting);
|
||||||
|
|
||||||
|
@ -121,16 +121,14 @@ class ImportController extends Controller
|
|||||||
|
|
||||||
foreach($headers as $key => $value) {
|
foreach($headers as $key => $value) {
|
||||||
|
|
||||||
foreach($translated_keys as $tkey => $tvalue)
|
foreach($translated_keys as $tkey => $tvalue) {
|
||||||
{
|
|
||||||
|
|
||||||
if($this->testMatch($value, $tvalue['label'])) {
|
if($this->testMatch($value, $tvalue['label'])) {
|
||||||
$hit = $tvalue['key'];
|
$hit = $tvalue['key'];
|
||||||
$hints[$key] = $hit;
|
$hints[$key] = $hit;
|
||||||
unset($translated_keys[$tkey]);
|
unset($translated_keys[$tkey]);
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$hints[$key] = null;
|
$hints[$key] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,14 +138,12 @@ class ImportController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//second pass using the index of the translation here
|
//second pass using the index of the translation here
|
||||||
foreach($headers as $key => $value)
|
foreach($headers as $key => $value) {
|
||||||
{
|
|
||||||
if(isset($hints[$key])) {
|
if(isset($hints[$key])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($translated_keys as $tkey => $tvalue)
|
foreach($translated_keys as $tkey => $tvalue) {
|
||||||
{
|
|
||||||
if($this->testMatch($value, $tvalue['index'])) {
|
if($this->testMatch($value, $tvalue['index'])) {
|
||||||
$hit = $tvalue['key'];
|
$hit = $tvalue['key'];
|
||||||
$hints[$key] = $hit;
|
$hints[$key] = $hit;
|
||||||
|
@ -12,39 +12,40 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use App\Jobs\Cron\AutoBill;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Factory\InvoiceFactory;
|
|
||||||
use App\Filters\InvoiceFilters;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Jobs\Invoice\ZipInvoices;
|
|
||||||
use App\Services\PdfMaker\PdfMerge;
|
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use App\Factory\CloneInvoiceFactory;
|
|
||||||
use App\Jobs\Invoice\BulkInvoiceJob;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use App\Jobs\Invoice\UpdateReminders;
|
|
||||||
use App\Transformers\QuoteTransformer;
|
|
||||||
use App\Repositories\InvoiceRepository;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use App\Transformers\InvoiceTransformer;
|
|
||||||
use App\Events\Invoice\InvoiceWasCreated;
|
use App\Events\Invoice\InvoiceWasCreated;
|
||||||
use App\Events\Invoice\InvoiceWasUpdated;
|
use App\Events\Invoice\InvoiceWasUpdated;
|
||||||
|
use App\Factory\CloneInvoiceFactory;
|
||||||
use App\Factory\CloneInvoiceToQuoteFactory;
|
use App\Factory\CloneInvoiceToQuoteFactory;
|
||||||
|
use App\Factory\InvoiceFactory;
|
||||||
|
use App\Filters\InvoiceFilters;
|
||||||
|
use App\Http\Requests\Invoice\ActionInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\BulkInvoiceRequest;
|
use App\Http\Requests\Invoice\BulkInvoiceRequest;
|
||||||
|
use App\Http\Requests\Invoice\CreateInvoiceRequest;
|
||||||
|
use App\Http\Requests\Invoice\DestroyInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\EditInvoiceRequest;
|
use App\Http\Requests\Invoice\EditInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\ShowInvoiceRequest;
|
use App\Http\Requests\Invoice\ShowInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\StoreInvoiceRequest;
|
use App\Http\Requests\Invoice\StoreInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\ActionInvoiceRequest;
|
|
||||||
use App\Http\Requests\Invoice\CreateInvoiceRequest;
|
|
||||||
use App\Http\Requests\Invoice\UpdateInvoiceRequest;
|
use App\Http\Requests\Invoice\UpdateInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\UploadInvoiceRequest;
|
|
||||||
use App\Http\Requests\Invoice\DestroyInvoiceRequest;
|
|
||||||
use App\Http\Requests\Invoice\UpdateReminderRequest;
|
use App\Http\Requests\Invoice\UpdateReminderRequest;
|
||||||
|
use App\Http\Requests\Invoice\UploadInvoiceRequest;
|
||||||
|
use App\Jobs\Cron\AutoBill;
|
||||||
|
use App\Jobs\Invoice\BulkInvoiceJob;
|
||||||
|
use App\Jobs\Invoice\UpdateReminders;
|
||||||
|
use App\Jobs\Invoice\ZipInvoices;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use App\Repositories\InvoiceRepository;
|
||||||
|
use App\Services\PdfMaker\PdfMerge;
|
||||||
|
use App\Services\Template\TemplateAction;
|
||||||
|
use App\Transformers\InvoiceTransformer;
|
||||||
|
use App\Transformers\QuoteTransformer;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class InvoiceController.
|
* Class InvoiceController.
|
||||||
@ -527,7 +528,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
if ($action == 'bulk_print' && $user->can('view', $invoices->first())) {
|
if ($action == 'bulk_print' && $user->can('view', $invoices->first())) {
|
||||||
$paths = $invoices->map(function ($invoice) {
|
$paths = $invoices->map(function ($invoice) {
|
||||||
return (new \App\Jobs\Entity\CreateRawPdf($invoice->invitations->first(), $invoice->company->db))->handle();
|
return (new \App\Jobs\Entity\CreateRawPdf($invoice->invitations->first()))->handle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$merge = (new PdfMerge($paths->toArray()))->run();
|
$merge = (new PdfMerge($paths->toArray()))->run();
|
||||||
@ -537,6 +538,24 @@ class InvoiceController extends BaseController
|
|||||||
}, 'print.pdf', ['Content-Type' => 'application/pdf']);
|
}, 'print.pdf', ['Content-Type' => 'application/pdf']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($action == 'template' && $user->can('view', $invoices->first())) {
|
||||||
|
|
||||||
|
$hash_or_response = $request->boolean('send_email') ? 'email sent' : \Illuminate\Support\Str::uuid();
|
||||||
|
|
||||||
|
TemplateAction::dispatch(
|
||||||
|
$ids,
|
||||||
|
$request->template_id,
|
||||||
|
Invoice::class,
|
||||||
|
$user->id,
|
||||||
|
$user->company(),
|
||||||
|
$user->company()->db,
|
||||||
|
$hash_or_response,
|
||||||
|
$request->boolean('send_email')
|
||||||
|
);
|
||||||
|
|
||||||
|
return response()->json(['message' => $hash_or_response], 200);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send the other actions to the switch
|
* Send the other actions to the switch
|
||||||
*/
|
*/
|
||||||
@ -719,7 +738,6 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400);
|
return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400);
|
||||||
}
|
}
|
||||||
@ -782,7 +800,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$file_name = $invoice->numberFormatter().'.pdf';
|
$file_name = $invoice->numberFormatter().'.pdf';
|
||||||
|
|
||||||
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation, $invitation->company->db))->handle();
|
$file = (new \App\Jobs\Entity\CreateRawPdf($invitation))->handle();
|
||||||
|
|
||||||
$headers = ['Content-Type' => 'application/pdf'];
|
$headers = ['Content-Type' => 'application/pdf'];
|
||||||
|
|
||||||
@ -911,8 +929,12 @@ class InvoiceController extends BaseController
|
|||||||
$file = $invoice->service()->getInvoiceDeliveryNote($invoice, $invoice->invitations->first()->contact);
|
$file = $invoice->service()->getInvoiceDeliveryNote($invoice, $invoice->invitations->first()->contact);
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($file) {
|
return response()->streamDownload(function () use ($file) {
|
||||||
echo Storage::get($file);
|
echo $file;
|
||||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
}, basename($file), ['Content-Type' => 'application/pdf']);
|
||||||
|
|
||||||
|
// return response()->streamDownload(function () use ($file) {
|
||||||
|
// echo Storage::get($file);
|
||||||
|
// }, basename($file), ['Content-Type' => 'application/pdf']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,8 +261,9 @@ class MigrationController extends BaseController
|
|||||||
{
|
{
|
||||||
nlog('Starting Migration');
|
nlog('Starting Migration');
|
||||||
|
|
||||||
if($request->has('silent_migration'))
|
if($request->has('silent_migration')) {
|
||||||
$this->silent_migration = true;
|
$this->silent_migration = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->companies) {
|
if ($request->companies) {
|
||||||
//handle Laravel 5.5 UniHTTP
|
//handle Laravel 5.5 UniHTTP
|
||||||
@ -318,8 +319,9 @@ class MigrationController extends BaseController
|
|||||||
$nmo->settings = $user->account->companies()->first()->settings;
|
$nmo->settings = $user->account->companies()->first()->settings;
|
||||||
$nmo->to_user = $user;
|
$nmo->to_user = $user;
|
||||||
|
|
||||||
if(!$this->silent_migration)
|
if(!$this->silent_migration) {
|
||||||
NinjaMailerJob::dispatch($nmo, true);
|
NinjaMailerJob::dispatch($nmo, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} elseif ($existing_company && $company_count > 10) {
|
} elseif ($existing_company && $company_count > 10) {
|
||||||
@ -329,8 +331,9 @@ class MigrationController extends BaseController
|
|||||||
$nmo->settings = $user->account->companies()->first()->settings;
|
$nmo->settings = $user->account->companies()->first()->settings;
|
||||||
$nmo->to_user = $user;
|
$nmo->to_user = $user;
|
||||||
|
|
||||||
if(!$this->silent_migration)
|
if(!$this->silent_migration) {
|
||||||
NinjaMailerJob::dispatch($nmo, true);
|
NinjaMailerJob::dispatch($nmo, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -350,8 +353,9 @@ class MigrationController extends BaseController
|
|||||||
$nmo->settings = $user->account->companies()->first();
|
$nmo->settings = $user->account->companies()->first();
|
||||||
$nmo->to_user = $user;
|
$nmo->to_user = $user;
|
||||||
|
|
||||||
if(!$this->silent_migration)
|
if(!$this->silent_migration) {
|
||||||
NinjaMailerJob::dispatch($nmo, true);
|
NinjaMailerJob::dispatch($nmo, true);
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'_id' => Str::uuid(),
|
'_id' => Str::uuid(),
|
||||||
|
@ -11,15 +11,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use App\Http\Requests\OneTimeToken\OneTimeTokenRequest;
|
|
||||||
use App\Http\Requests\OneTimeToken\OneTimeRouterRequest;
|
use App\Http\Requests\OneTimeToken\OneTimeRouterRequest;
|
||||||
|
use App\Http\Requests\OneTimeToken\OneTimeTokenRequest;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class OneTimeTokenController extends BaseController
|
class OneTimeTokenController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,6 @@ namespace App\Http\Controllers;
|
|||||||
use App\Events\Payment\PaymentWasUpdated;
|
use App\Events\Payment\PaymentWasUpdated;
|
||||||
use App\Factory\PaymentFactory;
|
use App\Factory\PaymentFactory;
|
||||||
use App\Filters\PaymentFilters;
|
use App\Filters\PaymentFilters;
|
||||||
use App\Http\Requests\Payment\ActionPaymentRequest;
|
|
||||||
use App\Http\Requests\Payment\CreatePaymentRequest;
|
use App\Http\Requests\Payment\CreatePaymentRequest;
|
||||||
use App\Http\Requests\Payment\DestroyPaymentRequest;
|
use App\Http\Requests\Payment\DestroyPaymentRequest;
|
||||||
use App\Http\Requests\Payment\EditPaymentRequest;
|
use App\Http\Requests\Payment\EditPaymentRequest;
|
||||||
@ -24,14 +23,12 @@ use App\Http\Requests\Payment\StorePaymentRequest;
|
|||||||
use App\Http\Requests\Payment\UpdatePaymentRequest;
|
use App\Http\Requests\Payment\UpdatePaymentRequest;
|
||||||
use App\Http\Requests\Payment\UploadPaymentRequest;
|
use App\Http\Requests\Payment\UploadPaymentRequest;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Invoice;
|
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Repositories\PaymentRepository;
|
use App\Repositories\PaymentRepository;
|
||||||
use App\Transformers\PaymentTransformer;
|
use App\Transformers\PaymentTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\SavesDocuments;
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,19 +11,19 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\PaymentTerm;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Factory\PaymentTermFactory;
|
use App\Factory\PaymentTermFactory;
|
||||||
use App\Filters\PaymentTermFilters;
|
use App\Filters\PaymentTermFilters;
|
||||||
use App\Repositories\PaymentTermRepository;
|
use App\Http\Requests\PaymentTerm\CreatePaymentTermRequest;
|
||||||
use App\Transformers\PaymentTermTransformer;
|
use App\Http\Requests\PaymentTerm\DestroyPaymentTermRequest;
|
||||||
use App\Http\Requests\PaymentTerm\EditPaymentTermRequest;
|
use App\Http\Requests\PaymentTerm\EditPaymentTermRequest;
|
||||||
use App\Http\Requests\PaymentTerm\ShowPaymentTermRequest;
|
use App\Http\Requests\PaymentTerm\ShowPaymentTermRequest;
|
||||||
use App\Http\Requests\PaymentTerm\StorePaymentTermRequest;
|
use App\Http\Requests\PaymentTerm\StorePaymentTermRequest;
|
||||||
use App\Http\Requests\PaymentTerm\CreatePaymentTermRequest;
|
|
||||||
use App\Http\Requests\PaymentTerm\UpdatePaymentTermRequest;
|
use App\Http\Requests\PaymentTerm\UpdatePaymentTermRequest;
|
||||||
use App\Http\Requests\PaymentTerm\DestroyPaymentTermRequest;
|
use App\Models\PaymentTerm;
|
||||||
|
use App\Repositories\PaymentTermRepository;
|
||||||
|
use App\Transformers\PaymentTermTransformer;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
class PaymentTermController extends BaseController
|
class PaymentTermController extends BaseController
|
||||||
{
|
{
|
||||||
|
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