Skip to content
Snippets Groups Projects
Verified Commit 34cf4a6b authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #11982 TIME 0:30 search date and empty custom value

parent 5ff31545
No related branches found
No related tags found
No related merge requests found
...@@ -787,7 +787,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ ...@@ -787,7 +787,7 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
} }
} }
} }
} elseif (preg_match('/^indexingCustomField_/', $tab_id_fields[$j])) { // opt indexes check } elseif (preg_match('/^indexingCustomField_/', $tab_id_fields[$j]) && !empty($_REQUEST[$tab_id_fields[$j]])) { // opt indexes check
$customFieldId = str_replace("indexingCustomField_", "", $tab_id_fields[$j]); $customFieldId = str_replace("indexingCustomField_", "", $tab_id_fields[$j]);
$customFieldId = str_replace("_min", "", $customFieldId); $customFieldId = str_replace("_min", "", $customFieldId);
$customFieldId = str_replace("_max", "", $customFieldId); $customFieldId = str_replace("_max", "", $customFieldId);
...@@ -800,21 +800,22 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ ...@@ -800,21 +800,22 @@ where lower(translate(folders.label , 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '"'.$_REQUEST[$tab_id_fields[$j]].'"')); $arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '"'.$_REQUEST[$tab_id_fields[$j]].'"'));
} elseif ($customField['type'] == 'date') { } elseif ($customField['type'] == 'date') {
if (strpos($tab_id_fields[$j], '_from') !== false) { if (strpos($tab_id_fields[$j], '_from') !== false) {
$where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and (value::text::timestamp) > (:valueCustom_".$customFieldId."::timestamp))) and "; $where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId."_".$j." and (value::text::timestamp) >= (:valueCustom_".$customFieldId."_".$j."::timestamp))) and ";
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId."_".$j => $customFieldId, ":valueCustom_".$customFieldId."_".$j => '"'.$_REQUEST[$tab_id_fields[$j]].'"'));
} elseif (strpos($tab_id_fields[$j], '_to') !== false) { } elseif (strpos($tab_id_fields[$j], '_to') !== false) {
$where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and (value::text::timestamp) < (:valueCustom_".$customFieldId."::timestamp))) and "; $where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId."_".$j." and (value::text::timestamp) <= (:valueCustom_".$customFieldId."_".$j."::timestamp))) and ";
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId."_".$j => $customFieldId, ":valueCustom_".$customFieldId."_".$j => '"'.$_REQUEST[$tab_id_fields[$j]].' 23:59:59"'));
} }
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '"'.$_REQUEST[$tab_id_fields[$j]].'"'));
} elseif ($customField['type'] == 'string') { } elseif ($customField['type'] == 'string') {
$where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and (value::text) ilike (:valueCustom_".$customFieldId."))) and "; $where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and (value::text) ilike (:valueCustom_".$customFieldId."))) and ";
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '%'.$_REQUEST[$tab_id_fields[$j]].'%')); $arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '%'.$_REQUEST[$tab_id_fields[$j]].'%'));
} elseif ($customField['type'] == 'integer') { } elseif ($customField['type'] == 'integer') {
if (strpos($tab_id_fields[$j], '_min') !== false) { if (strpos($tab_id_fields[$j], '_min') !== false) {
$where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and value > :valueCustom_".$customFieldId.")) and "; $where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId."_".$j." and value >= :valueCustom_".$customFieldId."_".$j.")) and ";
} elseif (strpos($tab_id_fields[$j], '_max') !== false) { } elseif (strpos($tab_id_fields[$j], '_max') !== false) {
$where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId." and value < :valueCustom_".$customFieldId.")) and "; $where_request .= " (res_id in (select res_id from resources_custom_fields where custom_field_id = :customFieldId_".$customFieldId."_".$j." and value <= :valueCustom_".$customFieldId."_".$j.")) and ";
} }
$arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId => $customFieldId, ":valueCustom_".$customFieldId => '"'.$_REQUEST[$tab_id_fields[$j]].'"')); $arrayPDO = array_merge($arrayPDO, array(":customFieldId_".$customFieldId."_".$j => $customFieldId, ":valueCustom_".$customFieldId."_".$j => '"'.$_REQUEST[$tab_id_fields[$j]].'"'));
} }
} }
} }
......
...@@ -35,7 +35,7 @@ class MessageExchangeReviewController ...@@ -35,7 +35,7 @@ class MessageExchangeReviewController
} }
$resLetterboxData = ResModel::getOnView([ $resLetterboxData = ResModel::getOnView([
'select' => ['entity_label', 'res_id', 'identifier', 'external_id'], 'select' => ['entity_label', 'res_id', 'external_id'],
'where' => ['res_id = ?'], 'where' => ['res_id = ?'],
'data' => [$aArgs['res_id']], 'data' => [$aArgs['res_id']],
'orderBy' => ['res_id'], ]); 'orderBy' => ['res_id'], ]);
......
...@@ -30,7 +30,7 @@ class MessageExchangeReviewController ...@@ -30,7 +30,7 @@ class MessageExchangeReviewController
} }
$resLetterboxData = ResModel::getOnView([ $resLetterboxData = ResModel::getOnView([
'select' => ['entity_label', 'res_id', 'identifier', 'external_id'], 'select' => ['entity_label', 'res_id', 'external_id'],
'where' => ['res_id = ?'], 'where' => ['res_id = ?'],
'data' => [$aArgs['res_id']], 'data' => [$aArgs['res_id']],
'orderBy' => ['res_id'], ]); 'orderBy' => ['res_id'], ]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment