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
Code80
vtigercrm
Commits
ac08e0a6
Commit
ac08e0a6
authored
5 years ago
by
Uma
Browse files
Options
Downloads
Patches
Plain Diff
Pagination queries had been parameterized
parent
9b33d4f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Vtiger/models/ListView.php
+8
-4
8 additions, 4 deletions
modules/Vtiger/models/ListView.php
modules/Vtiger/models/MiniList.php
+12
-6
12 additions, 6 deletions
modules/Vtiger/models/MiniList.php
with
20 additions
and
10 deletions
modules/Vtiger/models/ListView.php
+
8
−
4
View file @
ac08e0a6
...
...
@@ -232,12 +232,14 @@ class Vtiger_ListView_Model extends Vtiger_Base_Model {
$startIndex
=
$pagingModel
->
getStartIndex
();
$pageLimit
=
$pagingModel
->
getPageLimit
();
$paramArray
=
array
();
if
(
!
empty
(
$orderBy
)
&&
$orderByFieldModel
)
{
if
(
$orderBy
==
'roleid'
&&
$moduleName
==
'Users'
){
$listQuery
.
=
' ORDER BY vtiger_role.rolename '
.
' '
.
$sortOrder
;
}
else
{
$listQuery
.
=
' ORDER BY '
.
$queryGenerator
->
getOrderByColumn
(
$orderBy
)
.
' '
.
$sortOrder
;
$listQuery
.
=
' ORDER BY ? '
.
$sortOrder
;
array_push
(
$paramArray
,
$queryGenerator
->
getOrderByColumn
(
$orderBy
));
}
if
(
$orderBy
==
'first_name'
&&
$moduleName
==
'Users'
)
{
...
...
@@ -256,9 +258,11 @@ class Vtiger_ListView_Model extends Vtiger_Base_Model {
ListViewSession
::
setSessionQuery
(
$moduleName
,
$listQuery
,
$viewid
);
$listQuery
.
=
" LIMIT
$startIndex
,"
.
(
$pageLimit
+
1
);
$listResult
=
$db
->
pquery
(
$listQuery
,
array
());
$listQuery
.
=
" LIMIT ?, ?"
;
array_push
(
$paramArray
,
$startIndex
);
array_push
(
$paramArray
,
(
$pageLimit
+
1
));
$listResult
=
$db
->
pquery
(
$listQuery
,
$paramArray
);
$listViewRecordModels
=
array
();
$listViewEntries
=
$listViewContoller
->
getListViewRecords
(
$moduleFocus
,
$moduleName
,
$listResult
);
...
...
This diff is collapsed.
Click to expand it.
modules/Vtiger/models/MiniList.php
+
12
−
6
View file @
ac08e0a6
...
...
@@ -105,13 +105,13 @@ class Vtiger_MiniList_Model extends Vtiger_Widget_Model {
if
(
empty
(
$pageLimit
))
{
$pageLimit
=
10
;
}
return
$pageLimit
;
return
intval
(
$pageLimit
)
;
}
function
getStartIndex
()
{
$nextPage
=
$this
->
get
(
'nextPage'
);
$startIndex
=
((
$nextPage
-
1
)
*
$this
->
getRecordLimit
());
return
$startIndex
;
return
intval
(
$startIndex
)
;
}
public
function
getRecords
()
{
...
...
@@ -121,15 +121,18 @@ class Vtiger_MiniList_Model extends Vtiger_Widget_Model {
if
(
!
$this
->
listviewRecords
)
{
$db
=
PearDatabase
::
getInstance
();
$paramArray
=
array
();
$query
=
$this
->
queryGenerator
->
getQuery
();
$query
.
=
' ORDER BY vtiger_crmentity.modifiedtime DESC'
;
$query
.
=
' LIMIT '
.
$this
->
getStartIndex
()
.
','
.
$this
->
getRecordLimit
();
$query
.
=
' LIMIT ? , ?'
;
array_push
(
$paramArray
,
$this
->
getStartIndex
());
array_push
(
$paramArray
,
$this
->
getRecordLimit
());
$query
=
str_replace
(
" FROM "
,
",vtiger_crmentity.crmid as id FROM "
,
$query
);
if
(
$this
->
getTargetModule
()
==
'Calendar'
)
{
$query
=
str_replace
(
" WHERE "
,
" WHERE vtiger_crmentity.setype = 'Calendar' AND "
,
$query
);
}
$result
=
$db
->
pquery
(
$query
,
a
rray
()
);
$result
=
$db
->
pquery
(
$query
,
$paramA
rray
);
$targetModuleName
=
$this
->
getTargetModule
();
$targetModuleFocus
=
CRMEntity
::
getInstance
(
$targetModuleName
);
...
...
@@ -152,14 +155,17 @@ class Vtiger_MiniList_Model extends Vtiger_Widget_Model {
$this
->
initListViewController
();
$db
=
PearDatabase
::
getInstance
();
$query
=
$this
->
queryGenerator
->
getQuery
();
$paramArray
=
array
();
$startIndex
=
$this
->
getStartIndex
()
+
$this
->
getRecordLimit
();
$query
.
=
' LIMIT '
.
$startIndex
.
','
.
$this
->
getRecordLimit
();
$query
.
=
' LIMIT ?, ?'
;
array_push
(
$paramArray
,
$startIndex
);
array_push
(
$paramArray
,
$this
->
getRecordLimit
());
if
(
$this
->
getTargetModule
()
==
'Calendar'
)
{
$query
=
str_replace
(
" WHERE "
,
" WHERE vtiger_crmentity.setype = 'Calendar' AND "
,
$query
);
}
$result
=
$db
->
pquery
(
$query
,
a
rray
()
);
$result
=
$db
->
pquery
(
$query
,
$paramA
rray
);
if
(
$db
->
num_rows
(
$result
)
>
0
)
{
return
true
;
}
...
...
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