Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vtigercrm
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Welcome to Vtiger Community. To gain access for account, please contact [ community @ vtiger.com ]
Show more breadcrumbs
beppo.it
vtigercrm
Commits
83922ccd
Commit
83922ccd
authored
7 years ago
by
Balaji M
Browse files
Options
Downloads
Patches
Plain Diff
added new file to fetch reference records
parent
0e383d8d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchReferenceRecords.php
+62
-0
62 additions, 0 deletions
...es/Mobile/modules/Mobile/api/ws/FetchReferenceRecords.php
with
62 additions
and
0 deletions
pkg/vtiger/modules/Mobile/modules/Mobile/api/ws/FetchReferenceRecords.php
0 → 100644
+
62
−
0
View file @
83922ccd
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
include_once
'include/Webservices/DescribeObject.php'
;
include_once
'include/Webservices/Query.php'
;
class
Mobile_WS_FetchReferenceRecords
extends
Mobile_WS_Controller
{
function
process
(
Mobile_API_Request
$request
)
{
$response
=
new
Mobile_API_Response
();
$current_user
=
$this
->
getActiveUser
();
//fetch reference records request params
$referenceModule
=
$request
->
get
(
'module'
);
$searchKey
=
$request
->
get
(
'searchValue'
);
if
(
$referenceModule
==
'Documents'
)
{
$labelFields
=
'notes_title'
;
}
else
if
(
$referenceModule
==
'HelpDesk'
)
{
$labelFields
=
'ticket_title'
;
}
else
{
$describe
=
vtws_describe
(
$referenceModule
,
$current_user
);
$labelFields
=
$describe
[
'labelFields'
];
}
$labelFieldsArray
=
explode
(
','
,
$labelFields
);
$sql
=
sprintf
(
"SELECT %s FROM %s WHERE "
,
$labelFields
,
$referenceModule
);
foreach
(
$labelFieldsArray
as
$labelField
)
{
$sql
.
=
$labelField
.
" LIKE '%"
.
$searchKey
.
"%' OR "
;
}
$sql
=
rtrim
(
$sql
,
' OR '
)
.
';'
;
$wsresult
=
vtws_query
(
$sql
,
$current_user
);
$referenceRecords
=
array
();
foreach
(
$wsresult
as
$result
)
{
$record
=
array
();
foreach
(
$labelFieldsArray
as
$labelField
)
{
$record
[
'label'
]
.
=
$result
[
$labelField
]
.
' '
;
}
$record
[
'label'
]
=
trim
(
$record
[
'label'
]);
$record
[
'value'
]
=
decode_html
(
$result
[
'id'
]);
$referenceRecords
[]
=
$record
;
}
$response
->
setResult
(
$referenceRecords
);
return
$response
;
}
}
?>
\ No newline at end of file
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