1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Merge pull request #8815 from turbo124/v5-develop

v5.7.17
This commit is contained in:
David Bomba 2023-09-20 22:16:45 +10:00 committed by GitHub
commit 91c669b894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 38 deletions

View File

@ -1 +1 @@
5.7.16
5.7.17

View File

@ -11,14 +11,15 @@
namespace App\Http\Controllers;
use App\Models\User;
use App\Http\Requests\Search\GenericSearchRequest;
use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Invoice;
use App\Models\User;
class SearchController extends Controller
{
public function __invoke()
public function __invoke(GenericSearchRequest $request)
{
/** @var \App\Models\User $user */
$user = auth()->user();
@ -32,66 +33,75 @@ class SearchController extends Controller
}
private function clientMap(User $user) {
private function clientMap(User $user)
{
return Client::query()
->company()
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use($user) {
->where('is_deleted', 0)
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use ($user) {
$query->where('user_id', $user->id);
})
->cursor()
->map(function ($client){
return [
'name' => $client->present()->name(),
'type' => '/client',
'id' => $client->hashed_id,
'path' => "/clients/{$client->hashed_id}/edit",
'heading' => ctrans('texts.clients')
];
->map(function ($client) {
return [
'name' => $client->present()->name(),
'type' => '/client',
'id' => $client->hashed_id,
'path' => "/clients/{$client->hashed_id}/edit"
];
});
}
private function clientContactMap(User $user) {
private function clientContactMap(User $user)
{
return ClientContact::query()
->company()
->with('client')
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use($user) {
->whereHas('client', function ($q) {
$q->where('is_deleted', 0);
})
->when($user->cannot('view_all') || $user->cannot('view_client'), function ($query) use ($user) {
$query->where('user_id', $user->id);
})
->cursor()
->map(function ($contact){
return [
'name' => $contact->present()->search_display(),
'type' => '/client_contact',
'id' => $contact->client->hashed_id,
'path' => "/clients/{$contact->client->hashed_id}",
'heading' => ctrans('texts.contacts')
];
->map(function ($contact) {
return [
'name' => $contact->present()->search_display(),
'type' => '/client_contact',
'id' => $contact->client->hashed_id,
'path' => "/clients/{$contact->client->hashed_id}"
];
});
}
private function invoiceMap(User $user) {
private function invoiceMap(User $user)
{
return Invoice::query()
->company()
->with('client')
->when($user->cannot('view_all') || $user->cannot('view_invoice'), function ($query) use($user) {
->where('is_deleted', 0)
->whereHas('client', function ($q) {
$q->where('is_deleted', 0);
})
->when($user->cannot('view_all') || $user->cannot('view_invoice'), function ($query) use ($user) {
$query->where('user_id', $user->id);
})
->cursor()
->map(function ($invoice){
return [
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
'type' => '/invoice',
'id' => $invoice->hashed_id,
'path' => "/invoices/{$invoice->hashed_id}/edit",
'heading' => ctrans('texts.invoices')
];
->map(function ($invoice) {
return [
'name' => $invoice->client->present()->name() . ' - ' . $invoice->number,
'type' => '/invoice',
'id' => $invoice->hashed_id,
'path' => "/clients/{$invoice->hashed_id}/edit"
];
});
}
private function settingsMap() {
private function settingsMap()
{
$paths = [
'user_details' => '/settings/user_details',
@ -103,7 +113,7 @@ class SearchController extends Controller
'custom_fields' => '/settings/user_details/custom_fields',
'preferences' => '/settings/user_details/preferences',
'company_details' => '/settings/company_details',
'company_details,details' => '/settings/company_details/',
'company_details,details' => '/settings/company_details/details',
'company_details,address' => '/settings/company_details/address',
'company_details,logo' => '/settings/company_details/logo',
'company_details,defaults' => '/settings/company_details/defaults',
@ -181,7 +191,6 @@ class SearchController extends Controller
'path' => $value,
'type' => $transkey,
'name' => $translation,
'heading' => ctrans('texts.settings')
];
}

View File

@ -15,8 +15,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION','5.7.16'),
'app_tag' => env('APP_TAG','5.7.16'),
'app_version' => env('APP_VERSION','5.7.17'),
'app_tag' => env('APP_TAG','5.7.17'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),