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
df054933
Commit
df054933
authored
4 years ago
by
Uma
Browse files
Options
Downloads
Patches
Plain Diff
Fixes Pricebook Relatedlist inline search
parent
8851d7b6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/PriceBooks/models/RelationListView.php
+60
-0
60 additions, 0 deletions
modules/PriceBooks/models/RelationListView.php
modules/PriceBooks/views/Detail.php
+24
-0
24 additions, 0 deletions
modules/PriceBooks/views/Detail.php
with
84 additions
and
0 deletions
modules/PriceBooks/models/RelationListView.php
+
60
−
0
View file @
df054933
...
...
@@ -27,12 +27,72 @@ class PriceBooks_RelationListView_Model extends Vtiger_RelationListView_Model {
$db
=
PearDatabase
::
getInstance
();
$parentModule
=
$this
->
getParentRecordModel
()
->
getModule
();
$relationModule
=
$this
->
getRelationModel
()
->
getRelationModuleModel
();
$relationModuleName
=
$relationModule
->
get
(
'name'
);
$relatedColumnFieldMapping
=
$relationModule
->
getConfigureRelatedListFields
();
if
(
count
(
$relatedColumnFieldMapping
)
<=
0
){
$relatedColumnFieldMapping
=
$relationModule
->
getRelatedListFields
();
}
$query
=
$this
->
getRelationQuery
();
if
(
$this
->
get
(
'whereCondition'
)
&&
is_array
(
$this
->
get
(
'whereCondition'
)))
{
$currentUser
=
Users_Record_Model
::
getCurrentUserModel
();
//EnhancedQueryGenerator is used instead of QueryGenerator since below case was faling
//AssignTo Empty
$queryGenerator
=
new
EnhancedQueryGenerator
(
$relationModuleName
,
$currentUser
);
$queryGenerator
->
setFields
(
array_values
(
$relatedColumnFieldMapping
));
$whereCondition
=
$this
->
get
(
'whereCondition'
);
foreach
(
$whereCondition
as
$fieldName
=>
$fieldValue
)
{
$fieldModel
=
$relationModule
->
getField
(
$fieldName
);
$fieldType
=
explode
(
'~'
,
$fieldModel
->
get
(
'typeofdata'
))[
0
];
$referenceModuleList
=
$fieldModel
->
getReferenceList
();
if
(
is_array
(
$fieldValue
))
{
$comparator
=
$fieldValue
[
1
];
$searchValue
=
$fieldValue
[
2
];
$type
=
$fieldValue
[
3
];
if
(
$type
==
'time'
)
{
$searchValue
=
Vtiger_Time_UIType
::
getTimeValueWithSeconds
(
$searchValue
);
}
else
if
(
$type
==
'owner'
||
(
$type
==
'reference'
&&
in_array
(
'Users'
,
$referenceModuleList
)))
{
$searchValue
=
$fieldValue
[
2
];
if
(
!
$fieldModel
->
isCustomField
())
{
$userFieldValues
=
explode
(
','
,
$searchValue
);
$userValues
=
array
();
foreach
(
$userFieldValues
as
$key
=>
$value
)
{
if
(
is_numeric
(
$value
))
{
$userValues
[
$key
]
=
getUserFullName
(
$value
);
}
else
{
$userValues
[
$key
]
=
$value
;
}
}
$searchValue
=
implode
(
','
,
$userValues
);
}
}
else
if
(
$fieldType
==
'DT'
)
{
$dateValues
=
explode
(
','
,
$searchValue
);
//Indicate whether it is fist date in the between condition
$isFirstDate
=
true
;
foreach
(
$dateValues
as
$key
=>
$dateValue
)
{
$dateTimeCompoenents
=
explode
(
' '
,
$dateValue
);
if
(
empty
(
$dateTimeCompoenents
[
1
]))
{
if
(
$isFirstDate
)
$dateTimeCompoenents
[
1
]
=
'00:00:00'
;
else
$dateTimeCompoenents
[
1
]
=
'23:59:59'
;
}
$dateValue
=
implode
(
' '
,
$dateTimeCompoenents
);
$dateValues
[
$key
]
=
$dateValue
;
$isFirstDate
=
false
;
}
$searchValue
=
implode
(
','
,
$dateValues
);
}
// #3681555-Relation fields column's search fields are missing in related list view.
$query
=
(
$type
==
'reference'
)
?
$this
->
getReferenceFieldJoinClause
(
$query
,
$relationModuleName
,
$fieldModel
)
:
$query
;
$queryGenerator
->
addCondition
(
$fieldName
,
$searchValue
,
$comparator
,
"AND"
);
}
}
$whereQuerySplit
=
split
(
"WHERE"
,
$queryGenerator
->
getWhereClause
());
$query
.
=
" AND "
.
$whereQuerySplit
[
1
];
}
$startIndex
=
$pagingModel
->
getStartIndex
();
$pageLimit
=
$pagingModel
->
getPageLimit
();
...
...
This diff is collapsed.
Click to expand it.
modules/PriceBooks/views/Detail.php
+
24
−
0
View file @
df054933
...
...
@@ -31,6 +31,27 @@ class PriceBooks_Detail_View extends Vtiger_Detail_View {
return
parent
::
showRelatedList
(
$request
);
}
$searchParams
=
$request
->
get
(
'search_params'
);
if
(
empty
(
$searchParams
))
{
$searchParams
=
array
();
}
$whereCondition
=
array
();
$relatedModuleModel
=
Vtiger_Module_Model
::
getInstance
(
$relatedModuleName
);
$moduleFields
=
$relatedModuleModel
->
getFields
();
foreach
(
$searchParams
as
$fieldListGroup
){
foreach
(
$fieldListGroup
as
$fieldSearchInfo
){
$fieldModel
=
$moduleFields
[
$fieldSearchInfo
[
0
]];
$tableName
=
$fieldModel
->
get
(
'table'
);
$column
=
$fieldModel
->
get
(
'column'
);
$whereCondition
[
$fieldSearchInfo
[
0
]]
=
array
(
$tableName
.
'.'
.
$column
,
$fieldSearchInfo
[
1
],
$fieldSearchInfo
[
2
],
$fieldSearchInfo
[
3
]);
$fieldSearchInfoTemp
=
array
();
$fieldSearchInfoTemp
[
'searchValue'
]
=
$fieldSearchInfo
[
2
];
$fieldSearchInfoTemp
[
'fieldName'
]
=
$fieldName
=
$fieldSearchInfo
[
0
];
$fieldSearchInfoTemp
[
'comparator'
]
=
$fieldSearchInfo
[
1
];
$searchParams
[
$fieldName
]
=
$fieldSearchInfoTemp
;
}
}
$pagingModel
=
new
Vtiger_Paging_Model
();
$pagingModel
->
set
(
'page'
,
$requestedPage
);
...
...
@@ -45,6 +66,8 @@ class PriceBooks_Detail_View extends Vtiger_Detail_View {
$nextSortOrder
=
"ASC"
;
$sortImage
=
"icon-chevron-up"
;
}
if
(
!
empty
(
$whereCondition
))
$relationListView
->
set
(
'whereCondition'
,
$whereCondition
);
if
(
!
empty
(
$orderBy
))
{
$relationListView
->
set
(
'orderby'
,
$orderBy
);
$relationListView
->
set
(
'sortorder'
,
$sortOrder
);
...
...
@@ -114,6 +137,7 @@ class PriceBooks_Detail_View extends Vtiger_Detail_View {
$viewer
->
assign
(
'SORT_IMAGE'
,
$sortImage
);
$viewer
->
assign
(
'COLUMN_NAME'
,
$orderBy
);
$viewer
->
assign
(
'USER_MODEL'
,
Users_Record_Model
::
getCurrentUserModel
());
$viewer
->
assign
(
'SEARCH_DETAILS'
,
$searchParams
);
$viewer
->
assign
(
'TAB_LABEL'
,
$request
->
get
(
'tab_label'
));
return
$viewer
->
view
(
'RelatedList.tpl'
,
$moduleName
,
'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