mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge branch 'v5-develop' into v5-stable
This commit is contained in:
commit
03eb9cdb28
@ -51,11 +51,13 @@ TRUSTED_PROXIES=
|
||||
|
||||
NINJA_ENVIRONMENT=selfhost
|
||||
|
||||
PHANTOMJS_PDF_GENERATION=true
|
||||
#options - snappdf / phantom / hosted_ninja
|
||||
PDF_GENERATOR=phantom
|
||||
|
||||
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
|
||||
PHANTOMJS_SECRET=secret
|
||||
|
||||
UPDATE_SECRET=
|
||||
UPDATE_SECRET=secret
|
||||
|
||||
COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
|
||||
SENTRY_LARAVEL_DSN=https://cc7e8e2c678041689e53e409b7dba236@sentry.invoicing.co/5
|
@ -68,9 +68,11 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
}
|
||||
|
||||
if(config('queue.default') == 'database' && Ninja::isSelfHost()) {
|
||||
if(config('queue.default') == 'database' && Ninja::isSelfHost() && config('ninja.internal_queue_enabled')) {
|
||||
|
||||
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
|
||||
$schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class AccountCreated
|
||||
use Turbo124\Beacon\ExampleMetric\GenericCounter;
|
||||
|
||||
class AccountCreated extends GenericCounter
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class AccountDeleted
|
||||
use Turbo124\Beacon\ExampleMetric\GenericCounter;
|
||||
|
||||
class AccountDeleted extends GenericCounter
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class DbQuery
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class DbQuery extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class EmailFailure
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class EmailFailure extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class EmailInvoiceFailure
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class EmailInvoiceFailure extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class EmailSuccess
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class EmailSuccess extends GenericMixedMetric
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class LoginFailure
|
||||
use Turbo124\Beacon\ExampleMetric\GenericCounter;
|
||||
|
||||
class LoginFailure extends GenericCounter
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class LoginSuccess
|
||||
use Turbo124\Beacon\ExampleMetric\GenericCounter;
|
||||
|
||||
class LoginSuccess extends GenericCounter
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics\Mail;
|
||||
|
||||
class EmailBounce
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class EmailBounce extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics\Mail;
|
||||
|
||||
class EmailSpam
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class EmailSpam extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class MigrationFailure
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class MigrationFailure extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
@ -11,7 +11,9 @@
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class SendRecurringFailure
|
||||
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
|
||||
|
||||
class SendRecurringFailure extends GenericMixedMetric
|
||||
{
|
||||
/**
|
||||
* The type of Sample.
|
||||
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasArchived.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasArchived.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Events\RecurringInvoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceWasArchived.
|
||||
*/
|
||||
class RecurringInvoiceWasArchived
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $recurring_invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasCreated.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasCreated.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Events\RecurringInvoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceWasCreated.
|
||||
*/
|
||||
class RecurringInvoiceWasCreated
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param RecurringInvoice $recurring_invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
47
app/Events/RecurringInvoice/RecurringInvoiceWasDeleted.php
Normal file
47
app/Events/RecurringInvoice/RecurringInvoiceWasDeleted.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Events\RecurringInvoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceWasDeleted.
|
||||
*/
|
||||
class RecurringInvoiceWasDeleted
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
51
app/Events/RecurringInvoice/RecurringInvoiceWasRestored.php
Normal file
51
app/Events/RecurringInvoice/RecurringInvoiceWasRestored.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Events\RecurringInvoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceWasRestored.
|
||||
*/
|
||||
class RecurringInvoiceWasRestored
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $fromDeleted;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
* @param $fromDeleted
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, $fromDeleted, Company $company, array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->fromDeleted = $fromDeleted;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
49
app/Events/RecurringInvoice/RecurringInvoiceWasUpdated.php
Normal file
49
app/Events/RecurringInvoice/RecurringInvoiceWasUpdated.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Events\RecurringInvoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceWasUpdated.
|
||||
*/
|
||||
class RecurringInvoiceWasUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
public $company;
|
||||
|
||||
public $event_vars;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param RecurringInvoice $recurring_invoice
|
||||
* @param Company $company
|
||||
* @param array $event_vars
|
||||
*/
|
||||
public function __construct(RecurringInvoice $recurring_invoice, Company $company, array $event_vars)
|
||||
{
|
||||
$this->recurring_invoice = $recurring_invoice;
|
||||
$this->company = $company;
|
||||
$this->event_vars = $event_vars;
|
||||
}
|
||||
}
|
@ -160,4 +160,13 @@ abstract class QueryFilters
|
||||
return $this->builder->whereClientId(auth('contact')->user()->client->id);
|
||||
}
|
||||
}
|
||||
|
||||
public function created_at($value)
|
||||
{
|
||||
$created_at = $value ? $value : 0;
|
||||
|
||||
$created_at = date('Y-m-d H:i:s', $value);
|
||||
|
||||
return $this->builder->where('created_at', '>=', $created_at);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ function nlog($output, $context = []): void
|
||||
}
|
||||
|
||||
$trace = debug_backtrace();
|
||||
//nlog( debug_backtrace()[1]['function']);
|
||||
// \Illuminate\Support\Facades\Log::channel('invoiceninja')->info(print_r($trace[1]['class'],1), []);
|
||||
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
|
||||
|
||||
|
@ -141,10 +141,10 @@ class ActivityController extends BaseController
|
||||
return response()->json(['message'=> ctrans('texts.no_backup_exists'), 'errors' => new stdClass], 404);
|
||||
}
|
||||
|
||||
if (config('ninja.phantomjs_pdf_generation')) {
|
||||
if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') {
|
||||
$pdf = (new Phantom)->convertHtmlToPdf($backup->html_backup);
|
||||
}
|
||||
elseif(config('ninja.invoiceninja_hosted_pdf_generation')){
|
||||
elseif(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||
$pdf = (new NinjaPdf())->build($backup->html_backup);
|
||||
}
|
||||
else {
|
||||
|
@ -13,17 +13,22 @@ namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\DataMapper\Analytics\LoginFailure;
|
||||
use App\DataMapper\Analytics\LoginSuccess;
|
||||
use App\Events\User\UserLoggedIn;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\Account\CreateAccount;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Libraries\OAuth\OAuth;
|
||||
use App\Libraries\OAuth\Providers\Google;
|
||||
use App\Models\Client;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\CompanyUser;
|
||||
use App\Models\SystemLog;
|
||||
use App\Models\User;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\UserSessionAttributes;
|
||||
use Google_Client;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
@ -170,6 +175,8 @@ class LoginController extends BaseController
|
||||
|
||||
$user = $this->guard()->user();
|
||||
|
||||
event(new UserLoggedIn($user, $user->account->default_company, Ninja::eventVars($user->id)));
|
||||
|
||||
//if user has 2fa enabled - lets check this now:
|
||||
|
||||
if($user->google_2fa_secret && $request->has('one_time_password'))
|
||||
@ -207,6 +214,9 @@ class LoginController extends BaseController
|
||||
$cu = CompanyUser::query()
|
||||
->where('user_id', auth()->user()->id);
|
||||
|
||||
if(!$cu->exists())
|
||||
return response()->json(['message' => 'User not linked to any companies'], 403);
|
||||
|
||||
$cu->first()->account->companies->each(function ($company) use($cu, $request){
|
||||
|
||||
if($company->tokens()->where('is_system', true)->count() == 0)
|
||||
@ -225,6 +235,14 @@ class LoginController extends BaseController
|
||||
->increment()
|
||||
->batch();
|
||||
|
||||
SystemLogger::dispatch(
|
||||
request()->getClientIp(),
|
||||
SystemLog::CATEGORY_SECURITY,
|
||||
SystemLog::EVENT_USER,
|
||||
SystemLog::TYPE_LOGIN_FAILURE,
|
||||
Client::first(),
|
||||
);
|
||||
|
||||
$this->incrementLoginAttempts($request);
|
||||
|
||||
return response()
|
||||
|
@ -334,8 +334,6 @@ class BaseController extends Controller
|
||||
'company.task_statuses'=> function ($query) use ($updated_at, $user) {
|
||||
$query->where('updated_at', '>=', $updated_at);
|
||||
|
||||
if(!$user->isAdmin())
|
||||
$query->where('task_statuses.user_id', $user->id);
|
||||
|
||||
},
|
||||
'company.activities'=> function ($query) use($user) {
|
||||
@ -518,9 +516,6 @@ class BaseController extends Controller
|
||||
'company.task_statuses'=> function ($query) use ($created_at, $user) {
|
||||
$query->where('created_at', '>=', $created_at);
|
||||
|
||||
if(!$user->isAdmin())
|
||||
$query->where('task_statuses.user_id', $user->id);
|
||||
|
||||
},
|
||||
'company.activities'=> function ($query) use($user) {
|
||||
|
||||
|
@ -282,7 +282,7 @@ class ClientController extends BaseController
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
||||
|
||||
event(new ClientWasUpdated($client, $client->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new ClientWasUpdated($client, $client->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($client->fresh());
|
||||
}
|
||||
@ -380,7 +380,7 @@ class ClientController extends BaseController
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
||||
|
||||
event(new ClientWasCreated($client, $client->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new ClientWasCreated($client, $client->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($client);
|
||||
}
|
||||
|
@ -31,4 +31,9 @@ class ContactHashLoginController extends Controller
|
||||
{
|
||||
return redirect('/client/login');
|
||||
}
|
||||
|
||||
public function errorPage()
|
||||
{
|
||||
return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class InvoiceController extends Controller
|
||||
];
|
||||
|
||||
if ($request->query('mode') === 'fullscreen') {
|
||||
return response()->file($invoice->pdf_file_path(null, 'path'));
|
||||
return render('invoices.show-fullscreen', $data);
|
||||
}
|
||||
|
||||
return $this->render('invoices.show', $data);
|
||||
@ -127,6 +127,8 @@ class InvoiceController extends Controller
|
||||
|
||||
$payment_methods = auth()->user()->client->service()->getPaymentMethods($total);
|
||||
|
||||
//if there is only one payment method -> lets return straight to the payment page
|
||||
|
||||
$data = [
|
||||
'settings' => auth()->user()->client->getMergedSettings(),
|
||||
'invoices' => $invoices,
|
||||
@ -136,8 +138,6 @@ class InvoiceController extends Controller
|
||||
'total' => $total,
|
||||
];
|
||||
|
||||
// nlog($data);
|
||||
|
||||
return $this->render('invoices.payment', $data);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ class PaymentController extends Controller
|
||||
->get();
|
||||
}
|
||||
|
||||
$hash_data = ['invoices' => $payable_invoices->toArray(), 'credits' => $credit_totals];
|
||||
$hash_data = ['invoices' => $payable_invoices->toArray(), 'credits' => $credit_totals, 'amount_with_fee' => max(0, (($invoice_totals + $fee_totals) - $credit_totals))];
|
||||
|
||||
if ($request->query('hash')) {
|
||||
$hash_data['billing_context'] = Cache::get($request->query('hash'));
|
||||
@ -303,24 +303,12 @@ class PaymentController extends Controller
|
||||
|
||||
$payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->payment_hash])->first();
|
||||
|
||||
try {
|
||||
return $gateway
|
||||
->driver(auth()->user()->client)
|
||||
->setPaymentMethod($request->input('payment_method_id'))
|
||||
->setPaymentHash($payment_hash)
|
||||
->checkRequirements()
|
||||
->processPaymentResponse($request);
|
||||
} catch (\Exception $e) {
|
||||
SystemLogger::dispatch(
|
||||
$e->getMessage(),
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||
SystemLog::TYPE_FAILURE,
|
||||
auth('contact')->user()->client
|
||||
);
|
||||
|
||||
throw new PaymentFailed($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ class QuoteController extends Controller
|
||||
];
|
||||
|
||||
if ($request->query('mode') === 'fullscreen') {
|
||||
return response()->file($quote->pdf_file_path(null, 'path'));
|
||||
return render('quotes.show-fullscreen', $data);
|
||||
}
|
||||
|
||||
return $this->render('quotes.show', $data);
|
||||
@ -76,9 +76,9 @@ class QuoteController extends Controller
|
||||
}
|
||||
|
||||
if ($quotes->count() == 1) {
|
||||
return response()->streamDownload(function () use ($invoices) {
|
||||
echo file_get_contents($invoices->first()->pdf_file_path());
|
||||
}, basename($invoices->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
|
||||
return response()->streamDownload(function () use ($quotes) {
|
||||
echo file_get_contents($quotes->first()->pdf_file_path());
|
||||
}, basename($quotes->first()->pdf_file_path()), ['Cache-Control:' => 'no-cache']);
|
||||
//return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path()));
|
||||
}
|
||||
|
||||
|
@ -480,12 +480,9 @@ class CompanyController extends BaseController
|
||||
if ($company_count == 1) {
|
||||
$company->company_users->each(function ($company_user) {
|
||||
$company_user->user->forceDelete();
|
||||
$company_user->forceDelete();
|
||||
});
|
||||
|
||||
// if (Ninja::isHosted()) {
|
||||
// RefundCancelledAccount::dispatchNow($account);
|
||||
// }
|
||||
|
||||
$account->delete();
|
||||
|
||||
LightLogs::create(new AccountDeleted())
|
||||
@ -493,6 +490,11 @@ class CompanyController extends BaseController
|
||||
->batch();
|
||||
} else {
|
||||
$company_id = $company->id;
|
||||
|
||||
$company->company_users->each(function ($company_user){
|
||||
$company_user->forceDelete();
|
||||
});
|
||||
|
||||
$company->delete();
|
||||
|
||||
//If we are deleting the default companies, we'll need to make a new company the default.
|
||||
|
@ -201,7 +201,7 @@ class CreditController extends BaseController
|
||||
->fillDefaults()
|
||||
->save();
|
||||
|
||||
event(new CreditWasCreated($credit, $credit->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new CreditWasCreated($credit, $credit->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($credit);
|
||||
}
|
||||
@ -378,7 +378,7 @@ class CreditController extends BaseController
|
||||
|
||||
$credit->service()->deletePdf();
|
||||
|
||||
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($credit);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = QuoteTransformer::class;
|
||||
|
||||
if ($entity_obj->invitations->count() >= 1)
|
||||
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user()->id), 'quote'));
|
||||
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null), 'quote'));
|
||||
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = CreditTransformer::class;
|
||||
|
||||
if ($entity_obj->invitations->count() >= 1)
|
||||
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user()->id), 'credit'));
|
||||
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null), 'credit'));
|
||||
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ class ExpenseController extends BaseController
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $expense->company, $expense);
|
||||
|
||||
event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($expense->fresh());
|
||||
}
|
||||
@ -373,7 +373,7 @@ class ExpenseController extends BaseController
|
||||
{
|
||||
$expense = $this->expense_repo->save($request->all(), ExpenseFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||
|
||||
event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($expense);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ class InvoiceController extends BaseController
|
||||
->triggeredActions($request)
|
||||
->save();
|
||||
|
||||
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
@ -399,7 +399,7 @@ class InvoiceController extends BaseController
|
||||
|
||||
$invoice->service()->deletePdf();
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($invoice);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ use App\Mail\ExistingMigration;
|
||||
use App\Mail\Migration\MaxCompanies;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
@ -378,14 +379,15 @@ class MigrationController extends BaseController
|
||||
return;
|
||||
}
|
||||
|
||||
// try {
|
||||
// StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $fresh_company)->delay(now()->addSeconds(5));
|
||||
nlog("starting migration job");
|
||||
nlog($migration_file);
|
||||
|
||||
if(Ninja::isHosted())
|
||||
StartMigration::dispatch($migration_file, $user, $fresh_company)->onQueue('migration');
|
||||
// } catch (\Exception $e) {
|
||||
// nlog($e->getMessage());
|
||||
// }
|
||||
else
|
||||
StartMigration::dispatch($migration_file, $user, $fresh_company);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ class PaymentController extends BaseController
|
||||
|
||||
$payment = $this->payment_repo->save($request->all(), $payment);
|
||||
|
||||
event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
return $this->itemResponse($payment);
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,11 @@ class PreviewController extends BaseController
|
||||
}
|
||||
|
||||
//if phantom js...... inject here..
|
||||
if (config('ninja.phantomjs_pdf_generation')) {
|
||||
if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') {
|
||||
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||
}
|
||||
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation')){
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||
return (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ class QuoteController extends BaseController
|
||||
|
||||
$quote = $quote->service()->fillDefaults()->save();
|
||||
|
||||
event(new QuoteWasCreated($quote, $quote->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new QuoteWasCreated($quote, $quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($quote);
|
||||
}
|
||||
@ -389,7 +389,7 @@ class QuoteController extends BaseController
|
||||
|
||||
$quote->service()->deletePdf();
|
||||
|
||||
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($quote);
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasUpdated;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Filters\RecurringInvoiceFilters;
|
||||
use App\Http\Requests\RecurringInvoice\ActionRecurringInvoiceRequest;
|
||||
@ -25,6 +27,7 @@ use App\Models\Account;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Repositories\RecurringInvoiceRepository;
|
||||
use App\Transformers\RecurringInvoiceTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Request;
|
||||
@ -200,6 +203,8 @@ class RecurringInvoiceController extends BaseController
|
||||
{
|
||||
$recurring_invoice = $this->recurring_invoice_repo->save($request->all(), RecurringInvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||
|
||||
event(new RecurringInvoiceWasCreated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($recurring_invoice);
|
||||
}
|
||||
|
||||
@ -376,6 +381,8 @@ class RecurringInvoiceController extends BaseController
|
||||
|
||||
$recurring_invoice->service()->deletePdf()->save();
|
||||
|
||||
event(new RecurringInvoiceWasUpdated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($recurring_invoice);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,6 @@ class SelfUpdateController extends BaseController
|
||||
if (file_exists($cacheServices)) { unlink ($cacheServices); }
|
||||
|
||||
Artisan::call('clear-compiled');
|
||||
Artisan::call('cache:clear');
|
||||
Artisan::call('route:clear');
|
||||
Artisan::call('view:clear');
|
||||
Artisan::call('config:clear');
|
||||
|
@ -12,9 +12,11 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Factory\CompanyGatewayFactory;
|
||||
use App\Http\Requests\StripeConnect\InitializeStripeConnectRequest;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\PaymentDrivers\Stripe\Connect\Account;
|
||||
use Stripe\Exception\ApiErrorException;
|
||||
@ -34,36 +36,54 @@ class StripeConnectController extends BaseController
|
||||
if(!is_array($request->getTokenContent()))
|
||||
abort(400, 'Invalid token');
|
||||
|
||||
|
||||
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
|
||||
|
||||
$company_gateway = CompanyGateway::query()
|
||||
->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
|
||||
->where('company_id', $request->getCompany()->id)
|
||||
->first();
|
||||
|
||||
if ($company_gateway) {
|
||||
|
||||
$config = decrypt($company_gateway->config);
|
||||
|
||||
if(property_exists($config, 'account_id'))
|
||||
return render('gateways.stripe.connect.existing');
|
||||
|
||||
}
|
||||
else
|
||||
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->id);
|
||||
|
||||
/* Set Credit Card To Enabled */
|
||||
$gateway_types = $company_gateway->driver(new Client)->gatewayTypes();
|
||||
$fees_and_limits = new \stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
|
||||
$company_gateway->gateway_key = 'd14dd26a47cecc30fdd65700bfb67b34';
|
||||
$company_gateway->fees_and_limits = $fees_and_limits;
|
||||
$company_gateway->save();
|
||||
|
||||
/* Link account if existing account exists */
|
||||
if($account_id = $this->checkAccountAlreadyLinkToEmail($company_gateway, $request->getContact()->email)) {
|
||||
|
||||
$config = json_decode(decrypt($company_gateway->config));
|
||||
|
||||
$config->account_id = $account_id;
|
||||
$company_gateway->config = encrypt(json_encode($config));
|
||||
$company_gateway->save();
|
||||
|
||||
return render('gateways.stripe.connect.existing');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'type' => 'standard',
|
||||
'email' => $request->getContact()->email,
|
||||
'country' => $request->getCompany()->country()->iso_3166_2,
|
||||
];
|
||||
|
||||
$exists = CompanyGateway::query()
|
||||
->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
|
||||
->where('company_id', $request->getCompany()->id)
|
||||
->first();
|
||||
|
||||
if ($exists) {
|
||||
return render('gateways.stripe.connect.existing');
|
||||
}
|
||||
|
||||
$account = Account::create($data);
|
||||
|
||||
$link = Account::link($account->id, $token);
|
||||
|
||||
$company_gateway = CompanyGatewayFactory::create($request->getCompany()->id, $request->getContact()->id);
|
||||
|
||||
$company_gateway->fill([
|
||||
'gateway_key' => 'd14dd26a47cecc30fdd65700bfb67b34',
|
||||
'fees_and_limits' => [],
|
||||
'config' => encrypt(json_encode(['account_id' => $account->id]))
|
||||
]);
|
||||
|
||||
$company_gateway->config = encrypt(json_encode(['account_id' => $account->id]));
|
||||
$company_gateway->save();
|
||||
|
||||
return redirect($link['url']);
|
||||
@ -73,4 +93,22 @@ class StripeConnectController extends BaseController
|
||||
{
|
||||
return render('gateways.stripe.connect.completed');
|
||||
}
|
||||
|
||||
|
||||
private function checkAccountAlreadyLinkToEmail($company_gateway, $email)
|
||||
{
|
||||
$client = Client::first() ? Client::first() : new Client;
|
||||
|
||||
//Pull the list of Stripe Accounts and see if we match
|
||||
$accounts = $company_gateway->driver($client)->getAllConnectedAccounts()->data;
|
||||
|
||||
foreach($accounts as $account)
|
||||
{
|
||||
if($account['email'] == $email)
|
||||
return $account['id'];
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ class SubscriptionController extends BaseController
|
||||
{
|
||||
$subscription = $this->subscription_repo->save($request->all(), SubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||
|
||||
event(new SubscriptionWasCreated($subscription, $subscription->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new SubscriptionWasCreated($subscription, $subscription->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($subscription);
|
||||
}
|
||||
@ -352,7 +352,7 @@ class SubscriptionController extends BaseController
|
||||
|
||||
$subscription = $this->subscription_repo->save($request->all(), $subscription);
|
||||
|
||||
event(new SubscriptionWasUpdated($subscription, $subscription->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new SubscriptionWasUpdated($subscription, $subscription->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($subscription);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ class TaskController extends BaseController
|
||||
if($task->status_order != $old_task->status_order)
|
||||
$this->task_repo->sortStatuses($old_task, $task);
|
||||
|
||||
event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($task->fresh());
|
||||
}
|
||||
@ -378,7 +378,7 @@ class TaskController extends BaseController
|
||||
{
|
||||
$task = $this->task_repo->save($request->all(), TaskFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||
|
||||
event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($task);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ class UserController extends BaseController
|
||||
|
||||
nlog("in the store method of the usercontroller class");
|
||||
|
||||
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($user->fresh());
|
||||
}
|
||||
@ -401,7 +401,7 @@ class UserController extends BaseController
|
||||
$user->company_user()->update(["permissions_updated_at" => now()]);
|
||||
}
|
||||
|
||||
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($user);
|
||||
}
|
||||
@ -474,7 +474,7 @@ class UserController extends BaseController
|
||||
/* If the user passes the company user we archive the company user */
|
||||
$user = $this->user_repo->delete($request->all(), $user);
|
||||
|
||||
event(new UserWasDeleted($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new UserWasDeleted($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($user->fresh());
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ class VendorController extends BaseController
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
||||
|
||||
event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($vendor->fresh());
|
||||
}
|
||||
@ -376,7 +376,7 @@ class VendorController extends BaseController
|
||||
|
||||
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
||||
|
||||
event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($vendor);
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ class InvoicesTable extends Component
|
||||
$local_status = [];
|
||||
|
||||
$query = Invoice::query()
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||
->where('is_deleted', false);
|
||||
|
||||
if (in_array('paid', $this->status)) {
|
||||
$local_status[] = Invoice::STATUS_PAID;
|
||||
|
@ -88,7 +88,9 @@ class RequiredClientInfo extends Component
|
||||
}
|
||||
|
||||
if ($this->updateClientDetails($data)) {
|
||||
$this->emit('passed-required-fields-check');
|
||||
$this->emit('passed-required-fields-check', [
|
||||
'client_postal_code' => $this->contact->client->postal_code,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,10 @@ class CheckClientExistence
|
||||
$multiple_contacts = ClientContact::query()
|
||||
->where('email', auth('contact')->user()->email)
|
||||
->whereNotNull('email')
|
||||
->whereNull('deleted_at')
|
||||
->distinct('company_id')
|
||||
->distinct('email')
|
||||
->whereNotNull('company_id')
|
||||
->whereHas('client', function ($query) {
|
||||
return $query->whereNull('deleted_at');
|
||||
})
|
||||
|
@ -26,7 +26,7 @@ class ClientPortalEnabled
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (auth()->user()->client->getSetting('enable_client_portal') === false) {
|
||||
return redirect()->to('client/dashboard');
|
||||
return redirect()->route('client.error')->with(['title' => ctrans('texts.client_portal'), 'notification' => 'This section of the app has been disabled by the administrator.']);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -37,10 +37,6 @@ class ContactKeyLogin
|
||||
if (Auth::guard('contact')->check()) {
|
||||
Auth::guard('contact')->logout();
|
||||
}
|
||||
nlog("merp");
|
||||
nlog($request->has('magic_link'));
|
||||
nlog($request->input('magic_link'));
|
||||
nlog($request->all());
|
||||
|
||||
if ($request->segment(3) && config('ninja.db.multi_db_enabled')) {
|
||||
if (MultiDB::findAndSetDbByContactKey($request->segment(3))) {
|
||||
@ -71,7 +67,6 @@ nlog($request->all());
|
||||
}
|
||||
} elseif ($request->segment(2) && $request->segment(2) == 'magic_link' && $request->segment(3)) {
|
||||
$contact_email = Cache::get($request->segment(3));
|
||||
nlog("double merp");
|
||||
if($client_contact = ClientContact::where('email', $contact_email)->first()){
|
||||
Auth::guard('contact')->login($client_contact, true);
|
||||
|
||||
@ -83,7 +78,6 @@ nlog("double merp");
|
||||
}
|
||||
}
|
||||
|
||||
nlog("exit");
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
@ -22,15 +22,6 @@ class Cors
|
||||
return Response::make('OK', 200, $headers);
|
||||
}
|
||||
|
||||
/* Work around for file downloads where the response cannot contain have headers set */
|
||||
// if($request instanceOf BinaryFileResponse)
|
||||
// return $next($request);
|
||||
// else
|
||||
// return $next($request)
|
||||
// ->header('Access-Control-Allow-Origin', '*')
|
||||
// ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
|
||||
// ->header('Access-Control-Allow-Headers', 'X-API-SECRET,X-API-TOKEN,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range');
|
||||
|
||||
$response = $next($request);
|
||||
|
||||
$response->headers->set('Access-Control-Allow-Origin', '*');
|
||||
|
@ -52,12 +52,11 @@ class QueryLogging
|
||||
$timeEnd = microtime(true);
|
||||
$time = $timeEnd - $timeStart;
|
||||
|
||||
nlog($request->method().' - '.$request->url().": $count queries - ".$time);
|
||||
|
||||
//nlog($request->method().' - '.urldecode($request->url()).": $count queries - ".$time);
|
||||
// if($count > 50)
|
||||
//nlog($queries);
|
||||
|
||||
LightLogs::create(new DbQuery($request->method(), $request->url(), $count, $time, request()->ip()))
|
||||
LightLogs::create(new DbQuery($request->method(), urldecode($request->url()), $count, $time, request()->ip()))
|
||||
->batch();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,6 @@ class TokenAuth
|
||||
//stateless, don't remember the user.
|
||||
auth()->login($user, false);
|
||||
|
||||
event(new UserLoggedIn($user, $company_token->company, Ninja::eventVars()));
|
||||
|
||||
} else {
|
||||
$error = [
|
||||
'message' => 'Invalid token',
|
||||
|
@ -13,7 +13,7 @@ class ShowCreditRequest extends FormRequest
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
return !$this->credit->is_deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,16 +64,6 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
// foreach($this->input('documents') as $document)
|
||||
// {
|
||||
// if($document instanceof UploadedFile){
|
||||
// nlog("i am an uploaded file");
|
||||
// nlog($document);
|
||||
// }
|
||||
// else
|
||||
// nlog($document);
|
||||
// }
|
||||
|
||||
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
||||
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
||||
}
|
||||
|
@ -59,10 +59,6 @@ class StoreUserRequest extends Request
|
||||
|
||||
//unique user rule - check company_user table for user_id / company_id / account_id if none exist we can add the user. ELSE return false
|
||||
|
||||
//nlog($this->all());
|
||||
//nlog($this->input('company_user.account'));
|
||||
// nlog($this->input('company_user.account.id'));
|
||||
// nlog($this->input('company_user.account.id'));
|
||||
|
||||
if (isset($input['company_user'])) {
|
||||
if (! isset($input['company_user']['is_admin'])) {
|
||||
|
@ -45,9 +45,9 @@ class UpdateUserRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (isset($input['company_user']) && ! auth()->user()->isAdmin()) {
|
||||
unset($input['company_user']);
|
||||
}
|
||||
// if (isset($input['company_user']) && ! auth()->user()->isAdmin()) {
|
||||
// unset($input['company_user']);
|
||||
// }
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
@ -91,13 +91,21 @@ class CreateEntityPdf implements ShouldQueue
|
||||
|
||||
public function handle()
|
||||
{
|
||||
/* Set the locale*/
|
||||
App::setLocale($this->contact->preferredLocale());
|
||||
|
||||
/* Forget the singleton*/
|
||||
App::forgetInstance('translator');
|
||||
|
||||
/* Init a new copy of the translator*/
|
||||
$t = app('translator');
|
||||
|
||||
/* Set customized translations _NOW_ */
|
||||
Lang::replace(Ninja::transformTranslations($this->entity->client->getMergedSettings()));
|
||||
|
||||
$this->entity->service()->deletePdf();
|
||||
|
||||
if (config('ninja.phantomjs_pdf_generation')) {
|
||||
if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') {
|
||||
return (new Phantom)->generate($this->invitation);
|
||||
}
|
||||
|
||||
@ -163,7 +171,7 @@ class CreateEntityPdf implements ShouldQueue
|
||||
|
||||
try {
|
||||
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation')){
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||
$pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||
}
|
||||
else {
|
||||
|
@ -144,7 +144,7 @@ class EmailEntity implements ShouldQueue
|
||||
{
|
||||
switch ($this->entity_string) {
|
||||
case 'invoice':
|
||||
event(new InvoiceWasEmailedAndFailed($this->invitation, $this->company, $message, $this->reminder_template, Ninja::eventVars(auth()->user()->id)));
|
||||
event(new InvoiceWasEmailedAndFailed($this->invitation, $this->company, $message, $this->reminder_template, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -84,8 +84,11 @@ class NinjaMailerJob implements ShouldQueue
|
||||
|
||||
}
|
||||
|
||||
if (strlen($this->nmo->settings->bcc_email) > 1)
|
||||
$this->nmo->mailable->bcc($this->nmo->settings->bcc_email, $this->nmo->settings->bcc_email);
|
||||
if (strlen($this->nmo->settings->bcc_email) > 1) {
|
||||
nlog('bcc list available');
|
||||
nlog($this->nmo->settings->bcc_email);
|
||||
$this->nmo->mailable->bcc(explode(",", $this->nmo->settings->bcc_email), 'Blind Copy');
|
||||
}
|
||||
|
||||
|
||||
//send email
|
||||
|
@ -71,6 +71,7 @@ use App\Repositories\QuoteRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Repositories\VendorContactRepository;
|
||||
use App\Repositories\VendorRepository;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -83,6 +84,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
@ -436,6 +438,10 @@ class Import implements ShouldQueue
|
||||
$user = $user_repository->save($modified, $this->fetchUser($resource['email']), true, true);
|
||||
$user->email_verified_at = now();
|
||||
$user->confirmation_code = '';
|
||||
|
||||
if($modified['deleted_at'])
|
||||
$user->deleted_at = now();
|
||||
|
||||
$user->save();
|
||||
|
||||
$user_agent = array_key_exists('token_name', $resource) ?: request()->server('HTTP_USER_AGENT');
|
||||
@ -461,6 +467,8 @@ class Import implements ShouldQueue
|
||||
|
||||
private function checkUniqueConstraint($model, $column, $value)
|
||||
{
|
||||
$value = trim($value);
|
||||
|
||||
$model_query = (new $model())
|
||||
->query()
|
||||
->where($column, $value)
|
||||
@ -503,10 +511,10 @@ class Import implements ShouldQueue
|
||||
);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$client->created_at = $modified['created_at'];
|
||||
$client->created_at = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$client->updated_at = $modified['updated_at'];
|
||||
$client->updated_at = Carbon::parse($modified['updated_at']);
|
||||
|
||||
$client->save(['timestamps' => false]);
|
||||
|
||||
@ -583,6 +591,12 @@ class Import implements ShouldQueue
|
||||
unset($modified['id']);
|
||||
unset($modified['contacts']);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$modified['created_at'] = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
|
||||
$vendor = $vendor_repository->save(
|
||||
$modified,
|
||||
VendorFactory::create(
|
||||
@ -650,6 +664,12 @@ class Import implements ShouldQueue
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->processUserId($resource);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$modified['created_at'] = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$product_repository->save(
|
||||
@ -696,6 +716,12 @@ class Import implements ShouldQueue
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['line_items'] = $this->cleanItems($modified['line_items']);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$modified['created_at'] = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
if (array_key_exists('invitations', $resource)) {
|
||||
@ -832,6 +858,12 @@ class Import implements ShouldQueue
|
||||
$modified['user_id'] = $this->processUserId($resource);
|
||||
$modified['company_id'] = $this->company->id;
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$modified['created_at'] = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$credit = $credit_repository->save(
|
||||
@ -891,6 +923,18 @@ class Import implements ShouldQueue
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$modified['created_at'] = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
|
||||
if(array_key_exists('tax_rate1', $modified) && is_null($modified['tax_rate1']))
|
||||
$modified['tax_rate1'] = 0;
|
||||
|
||||
if(array_key_exists('tax_rate2', $modified) && is_null($modified['tax_rate2']))
|
||||
$modified['tax_rate2'] = 0;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
|
||||
@ -988,10 +1032,10 @@ class Import implements ShouldQueue
|
||||
);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$payment->created_at = $modified['created_at'];
|
||||
$payment->created_at = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$payment->updated_at = $modified['updated_at'];
|
||||
$payment->updated_at = Carbon::parse($modified['updated_at']);
|
||||
|
||||
$payment->save(['timestamps' => false]);
|
||||
|
||||
@ -1217,6 +1261,11 @@ class Import implements ShouldQueue
|
||||
$modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']);
|
||||
}
|
||||
|
||||
if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){
|
||||
$modified['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34';
|
||||
$modified['fees_and_limits'] = [];
|
||||
}
|
||||
|
||||
$company_gateway = CompanyGateway::create($modified);
|
||||
|
||||
$key = "company_gateways_{$resource['id']}";
|
||||
@ -1358,10 +1407,12 @@ class Import implements ShouldQueue
|
||||
$task = Task::Create($modified);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$task->created_at = $modified['created_at'];
|
||||
$task->created_at = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$task->updated_at = $modified['updated_at'];
|
||||
$task->updated_at = Carbon::parse($modified['updated_at']);
|
||||
|
||||
|
||||
|
||||
$task->save(['timestamps' => false]);
|
||||
|
||||
@ -1446,10 +1497,12 @@ class Import implements ShouldQueue
|
||||
$expense = Expense::Create($modified);
|
||||
|
||||
if(array_key_exists('created_at', $modified))
|
||||
$expense->created_at = $modified['created_at'];
|
||||
$expense->created_at = Carbon::parse($modified['created_at']);
|
||||
|
||||
if(array_key_exists('updated_at', $modified))
|
||||
$expense->updated_at = $modified['updated_at'];
|
||||
$expense->updated_at = Carbon::parse($modified['updated_at']);
|
||||
|
||||
|
||||
|
||||
$expense->save(['timestamps' => false]);
|
||||
|
||||
|
@ -23,6 +23,8 @@ class SchedulerCheck implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $tries = 1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
@ -45,14 +47,17 @@ class SchedulerCheck implements ShouldQueue
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
} catch (\Exception $e) {
|
||||
nlog("I wasn't able to migrate the data.");
|
||||
nlog($e->getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Artisan::call('optimize');
|
||||
Artisan::call('clear-compiled');
|
||||
Artisan::call('route:clear');
|
||||
Artisan::call('config:cache');
|
||||
} catch (\Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
nlog("I wasn't able to optimize.");
|
||||
nlog($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +65,7 @@ class SchedulerCheck implements ShouldQueue
|
||||
Artisan::call('view:clear');
|
||||
} catch (\Exception $e) {
|
||||
nlog("I wasn't able to clear the views.");
|
||||
nlog($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,6 +91,21 @@ class StartMigration implements ShouldQueue
|
||||
$archive = $zip->open(public_path("storage/{$this->filepath}"));
|
||||
$filename = pathinfo($this->filepath, PATHINFO_FILENAME);
|
||||
|
||||
// if($this->company->id == $this->company->account->default_company_id)
|
||||
// {
|
||||
// $new_default_company = $this->company->account->companies->first();
|
||||
|
||||
// if ($new_default_company) {
|
||||
// $this->company->account->default_company_id = $new_default_company->id;
|
||||
// $this->company->account->save();
|
||||
// }
|
||||
// }
|
||||
|
||||
$update_product_flag = $this->company->update_products;
|
||||
|
||||
$this->company->update_products = false;
|
||||
$this->company->save();
|
||||
|
||||
try {
|
||||
if (! $archive) {
|
||||
throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.');
|
||||
@ -113,7 +128,16 @@ class StartMigration implements ShouldQueue
|
||||
|
||||
Storage::deleteDirectory(public_path("storage/migrations/{$filename}"));
|
||||
|
||||
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
|
||||
// $this->company->account->default_company_id = $this->company->id;
|
||||
// $this->company->account->save();
|
||||
|
||||
$this->company->update_products = $update_product_flag;
|
||||
$this->company->save();
|
||||
|
||||
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing | \Exception $e) {
|
||||
|
||||
$this->company->update_products = $update_product_flag;
|
||||
$this->company->save();
|
||||
|
||||
Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));
|
||||
|
||||
|
@ -44,6 +44,9 @@ class SystemLogger implements ShouldQueue
|
||||
|
||||
public function handle() :void
|
||||
{
|
||||
if(!$this->client)
|
||||
return;
|
||||
|
||||
$sl = [
|
||||
'client_id' => $this->client->id,
|
||||
'company_id' => $this->client->company->id,
|
||||
|
@ -43,7 +43,7 @@ class ArchivedClientActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->client->user_id;
|
||||
|
||||
$fields->client_id = $event->client->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class ClientUpdatedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->client->user_id;
|
||||
|
||||
$fields->client_id = $client->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedClientActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->client->user_id;
|
||||
|
||||
$fields->client_id = $event->client->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedCreditActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->credit->user_id;
|
||||
|
||||
$fields->credit_id = $event->credit->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -44,7 +44,7 @@ class CreatedExpenseActivity implements ShouldQueue
|
||||
$fields = new stdClass;
|
||||
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields->expense_id = $event->expense->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedQuoteActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->quote->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->quote->user_id;
|
||||
|
||||
$fields->quote_id = $event->quote->id;
|
||||
$fields->client_id = $event->quote->client_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedSubscriptionActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->subscription->user_id;
|
||||
|
||||
$fields->subscription_id = $event->subscription->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedTaskActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $event->task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreatedVendorActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->vendor->user_id;
|
||||
|
||||
$fields->vendor_id = $event->vendor->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class CreditArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->credit->user_id;
|
||||
|
||||
$fields->payment_id = $event->credit->id;
|
||||
$fields->client_id = $event->credit->client_id;
|
||||
|
@ -43,7 +43,7 @@ class DeleteClientActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->client->user_id;
|
||||
|
||||
$fields->client_id = $event->client->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class DeleteCreditActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->credit->user_id;
|
||||
|
||||
$fields->client_id = $event->credit->client_id;
|
||||
$fields->credit_id = $event->credit->id;
|
||||
|
@ -45,7 +45,7 @@ class ExpenseArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields->expense_id = $expense->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class ExpenseDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields->expense_id = $event->expense->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class ExpenseRestoredActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields->expense_id = $event->expense->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class ExpenseUpdatedActivity implements ShouldQueue
|
||||
|
||||
$expense = $event->expense;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->expense->user_id;
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
|
@ -48,7 +48,7 @@ class PaymentArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$fields->payment_id = $payment->id;
|
||||
$fields->client_id = $payment->client_id;
|
||||
|
@ -43,7 +43,7 @@ class PaymentCreatedActivity implements ShouldQueue
|
||||
|
||||
$payment = $event->payment;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$invoices = $payment->invoices;
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PaymentDeletedActivity implements ShouldQueue
|
||||
|
||||
$payment = $event->payment;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$invoices = $payment->invoices;
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PaymentRefundedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$fields->client_id = $event->payment->id;
|
||||
$fields->client_id = $event->payment->client_id;
|
||||
|
@ -48,7 +48,7 @@ class PaymentUpdatedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$fields->payment_id = $payment->id;
|
||||
$fields->client_id = $payment->client_id;
|
||||
|
@ -43,7 +43,7 @@ class PaymentVoidedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->payment->user_id;
|
||||
|
||||
$fields->client_id = $event->payment->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class QuoteUpdatedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->quote->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->quote->user_id;
|
||||
|
||||
$fields->quote_id = $quote->id;
|
||||
$fields->client_id = $quote->client_id;
|
||||
|
@ -43,7 +43,7 @@ class RestoreClientActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->client->user_id;
|
||||
|
||||
$fields->client_id = $event->client->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class SubscriptionArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->subscription->user_id;
|
||||
|
||||
$fields->subscription_id = $subscription->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class SubscriptionDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->subscription->user_id;
|
||||
|
||||
$fields->subscription_id = $event->subscription->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class SubscriptionRestoredActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->subscription->user_id;
|
||||
|
||||
$fields->subscription_id = $event->subscription->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class SubscriptionUpdatedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->subscription->user_id;
|
||||
|
||||
$fields->subscription_id = $subscription->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class TaskArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class TaskDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $event->task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class TaskRestoredActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $event->task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -45,7 +45,7 @@ class TaskUpdatedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->task->user_id;
|
||||
|
||||
$fields->task_id = $task->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class UpdatedCreditActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->credit->user_id;
|
||||
|
||||
$fields->credit_id = $event->credit->id;
|
||||
$fields->client_id = $event->credit->client_id;
|
||||
|
@ -45,7 +45,7 @@ class VendorArchivedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->vendor->user_id;
|
||||
|
||||
$fields->vendor_id = $vendor->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class VendorDeletedActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->vendor->user_id;
|
||||
|
||||
$fields->vendor_id = $event->vendor->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
@ -43,7 +43,7 @@ class VendorRestoredActivity implements ShouldQueue
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||
$user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->vendor->user_id;
|
||||
|
||||
$fields->vendor_id = $event->vendor->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
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