Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
2cf10ac0
Commit
2cf10ac0
authored
Aug 24, 2015
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix filtering
parent
8061ec90
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/comm/prospect/list.php
+19
-3
19 additions, 3 deletions
htdocs/comm/prospect/list.php
htdocs/core/class/extrafields.class.php
+10
-9
10 additions, 9 deletions
htdocs/core/class/extrafields.class.php
with
29 additions
and
12 deletions
htdocs/comm/prospect/list.php
+
19
−
3
View file @
2cf10ac0
...
...
@@ -160,6 +160,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels
=
$extrafields
->
fetch_name_optionals_label
(
'thirdparty'
);
$search_array_options
=
$extrafields
->
getOptionalsFromPost
(
$extralabels
,
''
,
'search_'
);
// Do we click on purge search criteria ?
if
(
GETPOST
(
"button_removefilter_x"
)
||
GETPOST
(
"button_removefilter"
))
// Both test are required to be compatible with all browsers
...
...
@@ -174,6 +175,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_datec
=
""
;
$search_categ
=
""
;
$search_status
=
""
;
$search_array_options
=
array
();
}
if
(
$search_status
==
''
)
$search_status
=
1
;
// always display active customer first
...
...
@@ -256,6 +258,18 @@ if ($socname)
$sortfield
=
"s.nom"
;
$sortorder
=
"ASC"
;
}
// Extra fields
if
(
is_array
(
$extrafields
->
attribute_list
)
&&
count
(
$extrafields
->
attribute_list
))
{
foreach
(
$extrafields
->
attribute_list
as
$key
=>
$val
)
{
$crit
=
GETPOST
(
'search_options_'
.
$key
);
if
(
$val
&&
$crit
!=
''
)
{
$sql
.
=
natural_search
(
'ef.'
.
$key
,
$crit
);
}
}
}
// Add where from hooks
$parameters
=
array
();
$reshook
=
$hookmanager
->
executeHooks
(
'printFieldListWhere'
,
$parameters
);
// Note that $action and $object may have been modified by hook
...
...
@@ -269,6 +283,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
$sql
.
=
" ORDER BY
$sortfield
$sortorder
, s.nom ASC"
;
$sql
.
=
$db
->
plimit
(
$conf
->
liste_limit
+
1
,
$offset
);
//print $sql;
dol_syslog
(
'comm/prospect/list.php'
,
LOG_DEBUG
);
$resql
=
$db
->
query
(
$sql
);
...
...
@@ -434,8 +449,9 @@ if ($resql)
{
if
(
$val
)
{
$crit
=
$search_array_options
[
'search_options_'
.
$key
];
print
'<td class="liste_titre">'
;
//
print $extrafields->showInputField($key, $
array_options[$key]
, '', '', 'search_', 4);
print
$extrafields
->
showInputField
(
$key
,
$
crit
,
''
,
''
,
'search_'
,
4
);
print
'</td>'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
htdocs/core/class/extrafields.class.php
+
10
−
9
View file @
2cf10ac0
...
...
@@ -1427,9 +1427,10 @@ class ExtraFields
*
* @param array $extralabels $array of extrafields
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return int 1 if array_options set / 0 if no value
*/
function
getOptionalsFromPost
(
$extralabels
,
$keyprefix
=
''
)
function
getOptionalsFromPost
(
$extralabels
,
$keyprefix
=
''
,
$keysuffix
=
''
)
{
global
$_POST
;
...
...
@@ -1444,24 +1445,24 @@ class ExtraFields
if
(
in_array
(
$key_type
,
array
(
'date'
,
'datetime'
)))
{
// Clean parameters
$value_key
=
dol_mktime
(
$_POST
[
"options_"
.
$key
.
$keyprefix
.
"hour"
],
$_POST
[
"options_"
.
$key
.
$keyprefix
.
"min"
],
0
,
$_POST
[
"options_"
.
$key
.
$keyprefix
.
"month"
],
$_POST
[
"options_"
.
$key
.
$keyprefix
.
"day"
],
$_POST
[
"options_"
.
$key
.
$keyprefix
.
"year"
]);
$value_key
=
dol_mktime
(
$_POST
[
$keysuffix
.
"options_"
.
$key
.
$keyprefix
.
"hour"
],
$_POST
[
$keysuffix
.
"options_"
.
$key
.
$keyprefix
.
"min"
],
0
,
$_POST
[
$keysuffix
.
"options_"
.
$key
.
$keyprefix
.
"month"
],
$_POST
[
$keysuffix
.
"options_"
.
$key
.
$keyprefix
.
"day"
],
$_POST
[
$keysuffix
.
"options_"
.
$key
.
$keyprefix
.
"year"
]);
}
else
if
(
in_array
(
$key_type
,
array
(
'checkbox'
)))
{
$value_arr
=
GETPOST
(
"options_"
.
$key
.
$keyprefix
);
$value_arr
=
GETPOST
(
$keysuffix
.
"options_"
.
$key
.
$keyprefix
);
$value_key
=
implode
(
$value_arr
,
','
);
}
else
if
(
in_array
(
$key_type
,
array
(
'price'
,
'double'
)))
{
$value_arr
=
GETPOST
(
"options_"
.
$key
.
$keyprefix
);
$value_arr
=
GETPOST
(
$keysuffix
.
"options_"
.
$key
.
$keyprefix
);
$value_key
=
price2num
(
$value_arr
);
}
else
{
$value_key
=
GETPOST
(
"options_"
.
$key
.
$keyprefix
);
$value_key
=
GETPOST
(
$keysuffix
.
"options_"
.
$key
.
$keyprefix
);
}
$array_options
[
"options_"
.
$key
]
=
$value_key
;
// No keyprefix here. keyprefix is used only for read.
$array_options
[
$keysuffix
.
"options_"
.
$key
]
=
$value_key
;
// No keyprefix here. keyprefix is used only for read.
}
return
$array_options
;
...
...
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