Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
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
Show more breadcrumbs
justinfreeman (Agileware)
Core
Commits
24df2136
Commit
24df2136
authored
11 years ago
by
Kurund Jalmi
Browse files
Options
Downloads
Patches
Plain Diff
worked on CRM-12551, fix the datatable break due to tab character
parent
55a66cac
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
CRM/Utils/JSON.php
+13
-1
13 additions, 1 deletion
CRM/Utils/JSON.php
with
13 additions
and
1 deletion
CRM/Utils/JSON.php
+
13
−
1
View file @
24df2136
...
...
@@ -102,6 +102,17 @@ class CRM_Utils_JSON {
return
$json
;
}
/**
* This function is used to encode data for dataTable plugin
*
* @param array $params associated array of row elements
* @param int $sEcho datatable needs this to make it more secure
* @param int $iTotal total records
* @param int $iFilteredTotal total records on a page
* @param array $selectorElements selector elements
* @return string
*
*/
static
function
encodeDataTableSelector
(
$params
,
$sEcho
,
$iTotal
,
$iFilteredTotal
,
$selectorElements
)
{
$sOutput
=
'{'
;
$sOutput
.
=
'"sEcho": '
.
intval
(
$sEcho
)
.
', '
;
...
...
@@ -115,13 +126,14 @@ class CRM_Utils_JSON {
if
(
$addcomma
)
{
$sOutput
.
=
","
;
}
//$sOutput .= '"'.addslashes($value[$element]).'"';
//CRM-7130 --lets addslashes to only double quotes,
//since we are using it to quote the field value.
//str_replace helps to provide a break for new-line
$sOutput
.
=
'"'
.
addcslashes
(
str_replace
(
array
(
"
\r\n
"
,
"
\n
"
,
"
\r
"
),
'<br />'
,
$value
[
$element
]),
'"\\'
)
.
'"'
;
//remove extra spaces and tab character that breaks dataTable CRM-12551
$sOutput
=
preg_replace
(
"/\s+/"
,
" "
,
$sOutput
);
$addcomma
=
TRUE
;
}
$sOutput
.
=
"],"
;
...
...
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