Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
e9c7f730
Commit
e9c7f730
authored
3 years ago
by
Quentin Ribac
Browse files
Options
Downloads
Patches
Plain Diff
FIX #18183 TIME 1:15 added more contact fields in /rest/search by senders and recipients
parent
0ec7cce6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/search/controllers/SearchController.php
+42
-10
42 additions, 10 deletions
src/app/search/controllers/SearchController.php
with
42 additions
and
10 deletions
src/app/search/controllers/SearchController.php
+
42
−
10
View file @
e9c7f730
...
@@ -622,12 +622,28 @@ class SearchController
...
@@ -622,12 +622,28 @@ class SearchController
$args
[
'searchData'
][]
=
$sendersMatch
;
$args
[
'searchData'
][]
=
$sendersMatch
;
}
}
if
(
!
empty
(
$body
[
'senders'
])
&&
!
empty
(
$body
[
'senders'
][
'values'
])
&&
is_array
(
$body
[
'senders'
][
'values'
])
&&
is_string
(
$body
[
'senders'
][
'values'
][
0
]))
{
if
(
!
empty
(
$body
[
'senders'
])
&&
!
empty
(
$body
[
'senders'
][
'values'
])
&&
is_array
(
$body
[
'senders'
][
'values'
])
&&
is_string
(
$body
[
'senders'
][
'values'
][
0
]))
{
$fields
=
AutoCompleteController
::
getInsensitiveFieldsForRequest
([
'fields'
=>
[
'company'
]]);
$fieldsToCompleteSendersBy
=
[
'firstname'
,
'lastname'
,
'company'
,
'department'
,
'function'
,
'address_number'
,
'address_street'
,
'address_additional1'
,
'address_additional2'
,
'address_postcode'
,
'address_town'
,
'address_country'
,
'email'
,
'phone'
];
$fields
=
AutoCompleteController
::
getInsensitiveFieldsForRequest
([
'fields'
=>
$fieldsToCompleteSendersBy
]);
$requestData
=
AutoCompleteController
::
getDataForRequest
([
$requestData
=
AutoCompleteController
::
getDataForRequest
([
'search'
=>
$body
[
'senders'
][
'values'
][
0
],
'search'
=>
trim
(
$body
[
'senders'
][
'values'
][
0
]
)
,
'fields'
=>
$fields
,
'fields'
=>
$fields
,
'fieldsNumber'
=>
1
'fieldsNumber'
=>
count
(
$fieldsToCompleteSendersBy
)
]);
]);
$contacts
=
ContactModel
::
get
([
$contacts
=
ContactModel
::
get
([
...
@@ -639,17 +655,17 @@ class SearchController
...
@@ -639,17 +655,17 @@ class SearchController
if
(
empty
(
$contactIds
))
{
if
(
empty
(
$contactIds
))
{
return
null
;
return
null
;
}
else
{
}
else
{
$
recipient
sMatch
=
ResourceContactModel
::
get
([
$
sender
sMatch
=
ResourceContactModel
::
get
([
'select'
=>
[
'res_id'
],
'select'
=>
[
'res_id'
],
'where'
=>
[
'item_id in (?)'
,
'type = ?'
,
'mode = ?'
],
'where'
=>
[
'item_id in (?)'
,
'type = ?'
,
'mode = ?'
],
'data'
=>
[
$contactIds
,
'contact'
,
'sender'
]
'data'
=>
[
$contactIds
,
'contact'
,
'sender'
]
]);
]);
$resourceBy
Recipient
s
=
array_column
(
$
recipient
sMatch
,
'res_id'
);
$resourceBy
Sender
s
=
array_column
(
$
sender
sMatch
,
'res_id'
);
if
(
empty
(
$resourceBy
Recipient
s
))
{
if
(
empty
(
$resourceBy
Sender
s
))
{
return
null
;
return
null
;
}
else
{
}
else
{
$args
[
'searchWhere'
][]
=
'res_id in (?)'
;
$args
[
'searchWhere'
][]
=
'res_id in (?)'
;
$args
[
'searchData'
][]
=
$resourceBy
Recipient
s
;
$args
[
'searchData'
][]
=
$resourceBy
Sender
s
;
}
}
}
}
}
}
...
@@ -678,12 +694,28 @@ class SearchController
...
@@ -678,12 +694,28 @@ class SearchController
$args
[
'searchData'
][]
=
$recipientsMatch
;
$args
[
'searchData'
][]
=
$recipientsMatch
;
}
}
if
(
!
empty
(
$body
[
'recipients'
])
&&
!
empty
(
$body
[
'recipients'
][
'values'
])
&&
is_array
(
$body
[
'recipients'
][
'values'
])
&&
is_string
(
$body
[
'recipients'
][
'values'
][
0
]))
{
if
(
!
empty
(
$body
[
'recipients'
])
&&
!
empty
(
$body
[
'recipients'
][
'values'
])
&&
is_array
(
$body
[
'recipients'
][
'values'
])
&&
is_string
(
$body
[
'recipients'
][
'values'
][
0
]))
{
$fields
=
AutoCompleteController
::
getInsensitiveFieldsForRequest
([
'fields'
=>
[
'company'
]]);
$fieldsToCompleteRecipientsBy
=
[
'firstname'
,
'lastname'
,
'company'
,
'department'
,
'function'
,
'address_number'
,
'address_street'
,
'address_additional1'
,
'address_additional2'
,
'address_postcode'
,
'address_town'
,
'address_country'
,
'email'
,
'phone'
];
$fields
=
AutoCompleteController
::
getInsensitiveFieldsForRequest
([
'fields'
=>
$fieldsToCompleteRecipientsBy
]);
$requestData
=
AutoCompleteController
::
getDataForRequest
([
$requestData
=
AutoCompleteController
::
getDataForRequest
([
'search'
=>
$body
[
'recipients'
][
'values'
][
0
],
'search'
=>
trim
(
$body
[
'recipients'
][
'values'
][
0
]
)
,
'fields'
=>
$fields
,
'fields'
=>
$fields
,
'fieldsNumber'
=>
1
'fieldsNumber'
=>
count
(
$fieldsToCompleteRecipientsBy
)
]);
]);
$contacts
=
ContactModel
::
get
([
$contacts
=
ContactModel
::
get
([
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment