mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-06 15:54:36 -04:00
commit
b48c98cbac
@ -214,10 +214,10 @@ class BaseController extends Controller
|
|||||||
$query->with(
|
$query->with(
|
||||||
[
|
[
|
||||||
'company' => function ($query) use ($updated_at, $user) {
|
'company' => function ($query) use ($updated_at, $user) {
|
||||||
$query->whereNotNull('updated_at')->with('documents');
|
$query->whereNotNull('updated_at')->with('documents')->with('users');
|
||||||
},
|
},
|
||||||
'company.clients' => function ($query) use ($updated_at, $user) {
|
'company.clients' => function ($query) use ($updated_at, $user) {
|
||||||
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens', 'documents', 'group_settings');
|
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens', 'documents');
|
||||||
|
|
||||||
if(!$user->hasPermission('view_client'))
|
if(!$user->hasPermission('view_client'))
|
||||||
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
|
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
|
||||||
@ -253,7 +253,7 @@ class BaseController extends Controller
|
|||||||
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
|
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
|
||||||
},
|
},
|
||||||
'company.groups' => function ($query) use ($updated_at, $user) {
|
'company.groups' => function ($query) use ($updated_at, $user) {
|
||||||
$query->where('updated_at', '>=', $updated_at);
|
$query->where('updated_at', '>=', $updated_at)->with('documents');
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
if(!$user->isAdmin())
|
||||||
$query->where('group_settings.user_id', $user->id);
|
$query->where('group_settings.user_id', $user->id);
|
||||||
@ -301,7 +301,7 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
},
|
},
|
||||||
'company.recurring_invoices'=> function ($query) use ($updated_at, $user) {
|
'company.recurring_invoices'=> function ($query) use ($updated_at, $user) {
|
||||||
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
|
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents', 'client.gateway_tokens', 'client.group_settings');
|
||||||
|
|
||||||
if(!$user->hasPermission('view_recurring_invoice'))
|
if(!$user->hasPermission('view_recurring_invoice'))
|
||||||
$query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
|
$query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
|
||||||
@ -391,7 +391,7 @@ class BaseController extends Controller
|
|||||||
$query->where('created_at', '>=', $created_at);
|
$query->where('created_at', '>=', $created_at);
|
||||||
},
|
},
|
||||||
'company.groups' => function ($query) use ($created_at, $user) {
|
'company.groups' => function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at);
|
$query->where('created_at', '>=', $created_at)->with('documents');
|
||||||
|
|
||||||
},
|
},
|
||||||
'company.payment_terms'=> function ($query) use ($created_at, $user) {
|
'company.payment_terms'=> function ($query) use ($created_at, $user) {
|
||||||
@ -458,7 +458,7 @@ class BaseController extends Controller
|
|||||||
$query->whereNotNull('created_at')->with('documents');
|
$query->whereNotNull('created_at')->with('documents');
|
||||||
},
|
},
|
||||||
'company.clients' => function ($query) use ($created_at, $user) {
|
'company.clients' => function ($query) use ($created_at, $user) {
|
||||||
$query->where('clients.created_at', '>=', $created_at)->with('contacts.company', 'gateway_tokens', 'documents', 'group_settings');
|
$query->where('clients.created_at', '>=', $created_at)->with('contacts.company', 'gateway_tokens', 'documents');
|
||||||
|
|
||||||
if(!$user->hasPermission('view_client'))
|
if(!$user->hasPermission('view_client'))
|
||||||
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
|
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
|
||||||
@ -478,12 +478,6 @@ class BaseController extends Controller
|
|||||||
$query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
|
$query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
|
||||||
|
|
||||||
},
|
},
|
||||||
// 'company.designs'=> function ($query) use ($created_at, $user) {
|
|
||||||
// $query->where('created_at', '>=', $created_at)->with('company');
|
|
||||||
|
|
||||||
// if(!$user->isAdmin())
|
|
||||||
// $query->where('designs.user_id', $user->id);
|
|
||||||
// },
|
|
||||||
'company.documents'=> function ($query) use ($created_at, $user) {
|
'company.documents'=> function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at);
|
$query->where('created_at', '>=', $created_at);
|
||||||
},
|
},
|
||||||
@ -494,7 +488,7 @@ class BaseController extends Controller
|
|||||||
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
|
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
|
||||||
},
|
},
|
||||||
'company.groups' => function ($query) use ($created_at, $user) {
|
'company.groups' => function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at);
|
$query->where('created_at', '>=', $created_at)->with('documents');
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
if(!$user->isAdmin())
|
||||||
$query->where('group_settings.user_id', $user->id);
|
$query->where('group_settings.user_id', $user->id);
|
||||||
|
@ -52,8 +52,12 @@ class QueryLogging
|
|||||||
$timeEnd = microtime(true);
|
$timeEnd = microtime(true);
|
||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
|
|
||||||
if($count > 250)
|
nlog("Query count = {$count}");
|
||||||
|
|
||||||
|
if($count > 250){
|
||||||
|
nlog("Quer count = {$count}");
|
||||||
nlog($queries);
|
nlog($queries);
|
||||||
|
}
|
||||||
|
|
||||||
$ip = '';
|
$ip = '';
|
||||||
|
|
||||||
|
@ -1241,8 +1241,11 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
/* New to convert product ids from old hashes to new hashes*/
|
/* New to convert product ids from old hashes to new hashes*/
|
||||||
if($class == 'App\Models\Subscription'){
|
if($class == 'App\Models\Subscription'){
|
||||||
$obj_array['product_ids'] = $this->recordProductIds($obj_array['product_ids']);
|
//$obj_array['product_ids'] = $this->recordProductIds($obj_array['product_ids']);
|
||||||
$obj_array['recurring_product_ids'] = $this->recordProductIds($obj_array['recurring_product_ids']);
|
//$obj_array['recurring_product_ids'] = $this->recordProductIds($obj_array['recurring_product_ids']);
|
||||||
|
//
|
||||||
|
$obj_array['recurring_product_ids'] = '';
|
||||||
|
$obj_array['product_ids'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_obj = $class::firstOrNew(
|
$new_obj = $class::firstOrNew(
|
||||||
@ -1272,6 +1275,12 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
foreach($id_array as $id) {
|
foreach($id_array as $id) {
|
||||||
|
|
||||||
|
if(!$id)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$id = $this->decodePrimaryKey($id);
|
||||||
|
|
||||||
|
nlog($id);
|
||||||
$tmp_arr[] = $this->encodePrimaryKey($this->transformId('products', $id));
|
$tmp_arr[] = $this->encodePrimaryKey($this->transformId('products', $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1396,7 +1396,7 @@ class Import implements ShouldQueue
|
|||||||
$modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']);
|
$modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On Hosted platform we need to advise Stripe users to connect with Stripe Connect */
|
// /* On Hosted platform we need to advise Stripe users to connect with Stripe Connect */
|
||||||
if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){
|
if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
@ -1413,6 +1413,13 @@ class Import implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Ninja::isSelfHost() && $modified['gateway_key'] == 'd14dd26a47cecc30fdd65700bfb67b34'){
|
||||||
|
|
||||||
|
$modified['gateway_key'] = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$company_gateway = CompanyGateway::create($modified);
|
$company_gateway = CompanyGateway::create($modified);
|
||||||
|
|
||||||
$key = "company_gateways_{$resource['id']}";
|
$key = "company_gateways_{$resource['id']}";
|
||||||
|
@ -39,8 +39,6 @@ class ClientTransformer extends EntityTransformer
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'documents',
|
|
||||||
'gateway_tokens',
|
|
||||||
'activities',
|
'activities',
|
||||||
'ledger',
|
'ledger',
|
||||||
'system_logs',
|
'system_logs',
|
||||||
|
@ -29,10 +29,6 @@ class CreditTransformer extends EntityTransformer
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
|
||||||
// 'history',
|
|
||||||
// 'client',
|
|
||||||
'documents',
|
|
||||||
'activities',
|
'activities',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -31,9 +31,7 @@ class ExpenseTransformer extends EntityTransformer
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [];
|
||||||
'documents',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function includeDocuments(Expense $expense)
|
public function includeDocuments(Expense $expense)
|
||||||
{
|
{
|
||||||
|
@ -23,9 +23,7 @@ class InvoiceHistoryTransformer extends EntityTransformer
|
|||||||
'activity',
|
'activity',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [];
|
||||||
'activity',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function transform(Backup $backup)
|
public function transform(Backup $backup)
|
||||||
{
|
{
|
||||||
|
@ -31,12 +31,9 @@ class InvoiceTransformer extends EntityTransformer
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
// 'invitations',
|
|
||||||
// 'history',
|
|
||||||
'payments',
|
'payments',
|
||||||
'client',
|
'client',
|
||||||
'activities',
|
'activities',
|
||||||
// 'documents',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeInvitations(Invoice $invoice)
|
public function includeInvitations(Invoice $invoice)
|
||||||
|
@ -32,8 +32,6 @@ class PaymentTransformer extends EntityTransformer
|
|||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'client',
|
'client',
|
||||||
'invoices',
|
'invoices',
|
||||||
'paymentables',
|
|
||||||
'documents',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($serializer = null)
|
public function __construct($serializer = null)
|
||||||
|
@ -32,7 +32,6 @@ class ProductTransformer extends EntityTransformer
|
|||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'company',
|
'company',
|
||||||
'user',
|
'user',
|
||||||
'documents',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,6 @@ class ProjectTransformer extends EntityTransformer
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'documents'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeDocuments(Project $project)
|
public function includeDocuments(Project $project)
|
||||||
|
@ -29,12 +29,7 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
|
||||||
'documents',
|
|
||||||
// 'history',
|
|
||||||
'activities',
|
'activities',
|
||||||
// 'payments',
|
|
||||||
// 'client',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeActivities(Quote $quote)
|
public function includeActivities(Quote $quote)
|
||||||
|
@ -31,11 +31,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'invitations',
|
|
||||||
'documents',
|
|
||||||
'activities',
|
'activities',
|
||||||
// 'history',
|
|
||||||
// 'client',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -30,7 +30,6 @@ class TaskTransformer extends EntityTransformer
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'documents'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function includeDocuments(Task $task)
|
public function includeDocuments(Task $task)
|
||||||
|
@ -35,7 +35,6 @@ class VendorTransformer extends EntityTransformer
|
|||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
'activities',
|
'activities',
|
||||||
'documents',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
"php": "^7.3|^7.4|^8.0",
|
"php": "^7.3|^7.4|^8.0",
|
||||||
"anahkiasen/former": "^4.2",
|
"anahkiasen/former": "^4.2",
|
||||||
"barryvdh/laravel-debugbar": "^3.4",
|
"barryvdh/laravel-debugbar": "^3.4",
|
||||||
|
"beyondcode/laravel-query-detector": "^1.5",
|
||||||
"brianium/paratest": "^6.1",
|
"brianium/paratest": "^6.1",
|
||||||
"darkaonline/l5-swagger": "^8.0",
|
"darkaonline/l5-swagger": "^8.0",
|
||||||
"facade/ignition": "^2.3.6",
|
"facade/ignition": "^2.3.6",
|
||||||
|
62
composer.lock
generated
62
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c78080d7228931d63406b506f04a792f",
|
"content-hash": "5bd3a1c05429cbdf59e68e211c0360c7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asm/php-ansible",
|
"name": "asm/php-ansible",
|
||||||
@ -11624,6 +11624,66 @@
|
|||||||
],
|
],
|
||||||
"time": "2021-06-14T14:29:26+00:00"
|
"time": "2021-06-14T14:29:26+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "beyondcode/laravel-query-detector",
|
||||||
|
"version": "1.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/beyondcode/laravel-query-detector.git",
|
||||||
|
"reference": "4a3a0cfb5d5ddc5da59d530ef5c13e260adc6d07"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/beyondcode/laravel-query-detector/zipball/4a3a0cfb5d5ddc5da59d530ef5c13e260adc6d07",
|
||||||
|
"reference": "4a3a0cfb5d5ddc5da59d530ef5c13e260adc6d07",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0",
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"laravel/legacy-factories": "^1.0",
|
||||||
|
"orchestra/testbench": "^3.0 || ^4.0 || ^5.0 || ^6.0",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"BeyondCode\\QueryDetector\\QueryDetectorServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"BeyondCode\\QueryDetector\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Marcel Pociot",
|
||||||
|
"email": "marcel@beyondco.de",
|
||||||
|
"homepage": "https://beyondcode.de",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Laravel N+1 Query Detector",
|
||||||
|
"homepage": "https://github.com/beyondcode/laravel-query-detector",
|
||||||
|
"keywords": [
|
||||||
|
"beyondcode",
|
||||||
|
"laravel-query-detector"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/beyondcode/laravel-query-detector/issues",
|
||||||
|
"source": "https://github.com/beyondcode/laravel-query-detector/tree/1.5.0"
|
||||||
|
},
|
||||||
|
"time": "2021-02-16T22:51:38+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "brianium/paratest",
|
"name": "brianium/paratest",
|
||||||
"version": "v6.3.1",
|
"version": "v6.3.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user