. */ /** * @brief Advanced search form management * * @file search_adv_result_invoices.php * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup indexing_searching_mlb */ require_once ("core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_request.php"); require_once ("core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_security.php"); require_once ('apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . "class_indexing_searching_app.php"); require_once ('apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . "class_types.php"); $core_tools = new core_tools(); $core_tools->test_user(); $core_tools->load_lang(); $is = new indexing_searching_app(); $func = new functions(); $req = new request(); $type = new types(); $fields = ""; $orderby = ""; $baskets_clause = ''; $coll_id = 'res_coll'; $indexes = $type->get_all_indexes($coll_id); //$func->show_array($indexes); $_SESSION['error_search'] = ''; $_SESSION['searching']['comp_query'] = ''; // define the row of the start if (isset ($_REQUEST['start'])) { $start = $_REQUEST['start']; } else { $start = 0; } if ($_REQUEST['mode'] == 'frame') { $mode = 'frame'; } elseif ($_REQUEST['mode'] == 'popup') { $mode = 'popup'; } else { $mode = 'normal'; $core_tools->test_service('adv_search_invoices', 'apps'); } $where_request = ""; $case_view = false; $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; $json_txt = '{'; /** * Array $_REQUEST['meta'] exemple ( [0] => copies#copies_false,copies_true#radio [1] => objet#objet#input_text [2] => numged#numged#input_text [3] => multifield#multifield#input_text [4] => category#category#select_simple [5] => doc_date#doc_date_from,doc_date_to#date_range ) **/ //$func->show_array($_REQUEST['meta']);exit; if (count($_REQUEST['meta']) > 0) { //Verif for parms sended by url if ($_GET['meta']) { for ($m = 0; $m < count($_REQUEST['meta']); $m++) { if (strstr($_REQUEST['meta'][$m], '||') == true) { $_REQUEST['meta'][$m] = str_replace('||', '#', $_REQUEST['meta'][$m]); } } } $opt_indexes = array (); $_SESSION['meta_search'] = $_REQUEST['meta']; for ($i = 0; $i < count($_REQUEST['meta']); $i++) { //echo $_REQUEST['meta'][$i]."
"; $tab = explode('#', $_REQUEST['meta'][$i]); if ($tab[0] == 'welcome') { $tab[0] = 'multifield'; $tab[2] = 'input_text'; } $id_val = $tab[0]; $json_txt .= "'" . $tab[0] . "' : { 'type' : '" . $tab[2] . "', 'fields' : {"; $tab_id_fields = explode(',', $tab[1]); //$func->show_array($tab_id_fields); for ($j = 0; $j < count($tab_id_fields); $j++) { //echo $tab_id_fields[$j]."
"; // ENTITIES if ($tab_id_fields[$j] == 'services_chosen' && isset ($_REQUEST['services_chosen'])) { $json_txt .= " 'services_chosen' : ["; $srv_chosen_tmp = " ("; for ($get_i = 0; $get_i < count($_REQUEST['services_chosen']); $get_i++) { $srv_chosen_tmp .= "'" . $func->protect_string_db($_REQUEST['services_chosen'][$get_i]) . "',"; $json_txt .= "'" . $_REQUEST['services_chosen'][$get_i] . "',"; } $srv_chosen_tmp = substr($srv_chosen_tmp, 0, -1); $json_txt = substr($json_txt, 0, -1); $srv_chosen_tmp .= ") "; $where_request .= " destination IN " . $srv_chosen_tmp . " "; $where_request .= " and "; $json_txt .= '],'; } // MULTIFIELD : subject, title, doc_custom_t1, process notes else if ($tab_id_fields[$j] == 'multifield' && !empty ($_REQUEST['multifield'])) { $json_txt .= "'multifield' : ['" . addslashes(trim($_REQUEST['multifield'])) . "'],"; $where_request .= "(subject LIKE '%" . $func->protect_string_db($_REQUEST['multifield']) . "%' or alt_identifier LIKE '%" . $func->protect_string_db($_REQUEST['multifield']) . "%' or title LIKE '%" . $func->protect_string_db($_REQUEST['multifield']) . "%' or doc_custom_t1 LIKE '%" . $func->protect_string_db($_REQUEST['multifield']) . "%' or process_notes like '%" . $func->protect_string_db($_REQUEST['multifield']) . "%') "; $where_request .= " and "; } // DEST else if ($tab_id_fields[$j] == 'dest' && !empty ($_REQUEST['dest'])) { $json_txt .= " 'dest' : ['" . addslashes(trim($_REQUEST['dest'])) . "'],"; $dest = $func->wash($_REQUEST['dest'], "no", _DEST, "no"); $where_request .= " (dest_contact_id in(select contact_id from " . $_SESSION['tablename']['contacts'] . " where lastname LIKE '" . $func->protect_string_db($dest) . "%' or firstname LIKE '" . $func->protect_string_db($dest) . "%' or society LIKE '" . $func->protect_string_db($dest) . "%' or function LIKE '" . $func->protect_string_db($dest) . "%') or dest_user_id in (select user_id from " . $_SESSION['tablename']['users'] . " where lastname LIKE '" . $func->protect_string_db($dest) . "%' or firstname LIKE '" . $func->protect_string_db($dest) . "%' or user_id LIKE '" . $func->protect_string_db($dest) . "%')) and "; } // GED NUM else if ($tab_id_fields[$j] == 'numged' && !empty ($_REQUEST['numged'])) { $json_txt .= " 'numged' : ['" . addslashes(trim($_REQUEST['numged'])) . "'],"; $where_request .= "res_id = " . $func->wash($_REQUEST['numged'], "num", _N_GED, "no") . " and "; } // DEST_USER else if ($tab_id_fields[$j] == 'destinataire_chosen' && !empty ($_REQUEST['destinataire_chosen'])) { $json_txt .= " 'destinataire_chosen' : ["; $destinataire_chosen_tmp = " ("; for ($get_i = 0; $get_i < count($_REQUEST['destinataire_chosen']); $get_i++) { $destinataire_chosen_tmp .= "'" . $func->protect_string_db($_REQUEST['destinataire_chosen'][$get_i]) . "',"; $json_txt .= "'" . $_REQUEST['destinataire_chosen'][$get_i] . "',"; } $destinataire_chosen_tmp = substr($destinataire_chosen_tmp, 0, -1); $json_txt = substr($json_txt, 0, -1); $destinataire_chosen_tmp .= ") "; $where_request .= " (dest_user IN " . $destinataire_chosen_tmp . " or res_id in (select res_id from " . $_SESSION['tablename']['ent_listinstance'] . " where item_id in " . $destinataire_chosen_tmp . " and item_mode = 'dest')) "; $where_request .= " and "; //echo $where_request;exit; $json_txt .= '],'; } // FULLTEXT else if ($tab_id_fields[$j] == 'fulltext' && !empty ($_REQUEST['fulltext'])) { $json_txt .= " 'fulltext' : ['" . addslashes(trim($_REQUEST['fulltext'])) . "'],"; set_include_path("apps" . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . "tools" . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path()); require_once ('Zend' . DIRECTORY_SEPARATOR . 'Search' . DIRECTORY_SEPARATOR . 'Lucene.php'); $_SESSION['search']['plain_text'] = $_REQUEST['fulltext']; $path_to_lucene_index = $_SESSION['collections'][0]['path_to_lucene_index']; if (is_dir($path_to_lucene_index)) { if (!$func->isDirEmpty($path_to_lucene_index)) { $index = Zend_Search_Lucene :: open($path_to_lucene_index); //$hits = $index->find($_REQUEST['fulltext']."~"); $hits = $index->find($_REQUEST['fulltext']); $Liste_Ids = "0"; foreach ($hits as $hit) { $Liste_Ids .= ", '" . $hit->Id . "'"; } $where_request .= " res_id IN ($Liste_Ids) and "; } } else { $where_request .= " 1=-1 and "; } } //WELCOME PAGE else if ($tab_id_fields[$j] == 'welcome' && (!empty($_REQUEST['welcome']))) { $welcome = $_REQUEST['welcome']; $json_txt .= "'multifield' : ['".addslashes(trim($welcome))."'],"; if (is_numeric($_REQUEST['welcome'])) { $where_multifield_request .= "(res_id = ".$func->protect_string_db($_REQUEST['welcome'].") or "); } $where_multifield_request .= "(lower(subject) LIKE lower('%".$func->protect_string_db($_REQUEST['welcome'])."%') " ."or lower(identifier) LIKE lower('%".$func->protect_string_db($_REQUEST['welcome'])."%') " ."or lower(title) LIKE lower('%".$func->protect_string_db($_REQUEST['welcome'])."%')) "; $welcome = $_REQUEST['welcome']; set_include_path('apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'tools' . DIRECTORY_SEPARATOR . PATH_SEPARATOR . get_include_path() ); require_once('Zend/Search/Lucene.php'); Zend_Search_Lucene_Analysis_Analyzer::setDefault( new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive() // we need utf8 for accents ); Zend_Search_Lucene_Search_QueryParser::setDefaultOperator(Zend_Search_Lucene_Search_QueryParser::B_AND); Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8'); $path_to_lucene_index = $_SESSION['collections'][6]['path_to_lucene_index']; if (is_dir($path_to_lucene_index)) { if (!$func->isDirEmpty($path_to_lucene_index)) { $index = Zend_Search_Lucene::open($path_to_lucene_index); $hits = $index->find($welcome); $Liste_Ids = "0"; $cptIds = 0; foreach ($hits as $hit) { if ($cptIds < 500) { $Liste_Ids .= ", '". $hit->Id ."'"; } else { break; } $cptIds ++; } $where_request_welcome .= " res_id IN ($Liste_Ids) or ".$where_multifield_request. " and "; } } else { $where_request_welcome .= " ".$where_multifield_request." and "; } } // DOCTYPES else if ($tab_id_fields[$j] == 'doctypes_chosen' && !empty ($_REQUEST['doctypes_chosen'])) { $json_txt .= " 'doctypes_chosen' : ["; $doctypes_chosen_tmp = " ("; for ($get_i = 0; $get_i < count($_REQUEST['doctypes_chosen']); $get_i++) { $doctypes_chosen_tmp .= "'" . $func->protect_string_db($_REQUEST['doctypes_chosen'][$get_i]) . "',"; $json_txt .= "'" . $_REQUEST['doctypes_chosen'][$get_i] . "',"; } $doctypes_chosen_tmp = substr($doctypes_chosen_tmp, 0, -1); $json_txt = substr($json_txt, 0, -1); $doctypes_chosen_tmp .= ") "; $where_request .= " type_id IN " . $doctypes_chosen_tmp . " "; $where_request .= " and "; $json_txt .= '],'; } // ARBOXE //Physical Archive including => filter on boxes //else if($tab_id_fields[$j] == 'boxes_chosen' && !empty($_REQUEST['arbox_id_chosen'])) else if ($tab_id_fields[$j] == 'arboxes_chosen') { $json_txt .= " 'arbox_id_chosen' : ["; $arbox_id_chosen_tmp = " ("; if (count($_REQUEST['arboxes_chosen'])) { for ($get_i = 0; $get_i < count($_REQUEST['arboxes_chosen']); $get_i++) { $arbox_id_chosen_tmp .= "'" . $func->protect_string_db($_REQUEST['arboxes_chosen'][$get_i]) . "',"; $json_txt .= "'" . $_REQUEST['arboxes_chosen'][$get_i] . "',"; } $arbox_id_chosen_tmp = substr($arbox_id_chosen_tmp, 0, -1); $json_txt = substr($json_txt, 0, -1); $arbox_id_chosen_tmp .= ") "; $where_request .= " arbox_id IN " . $arbox_id_chosen_tmp . " "; $where_request .= " and "; } $json_txt .= '],'; } // ARBATCH //Gestion boite archive => Limitation au lot else if ($tab_id_fields[$j] == 'arbatch_id' && !empty ($_REQUEST['arbatch_id'])) { $json_txt .= " 'arbatch_id' : ['" . addslashes(trim($_REQUEST['arbatch_id'])) . "'],"; $arbatch_id = $func->wash($_REQUEST['arbatch_id'], "no", _BATCH, "no"); { $where_request .= " arbatch_id = " . $arbatch_id . " and "; } } // MAIL NATURE else if ($tab_id_fields[$j] == 'mail_nature' && !empty ($_REQUEST['mail_nature'])) { $json_txt .= "'mail_nature' : ['" . addslashes(trim($_REQUEST['mail_nature'])) . "'],"; $where_request .= " nature_id = '" . $func->protect_string_db($_REQUEST['mail_nature']) . "' and "; } // CREATION DATE : FROM else if ($tab_id_fields[$j] == 'creation_date_from' && !empty ($_REQUEST['creation_date_from'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['creation_date_from']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['creation_date_from']; } else { $where_request .= " (" . $req->extract_date("creation_date") . " >= '" . $func->format_date_db($_REQUEST['creation_date_from']) . "') and "; $json_txt .= " 'creation_date_from' : ['" . trim($_REQUEST['creation_date_from']) . "'],"; } } // CREATION DATE : TO else if ($tab_id_fields[$j] == 'creation_date_to' && !empty ($_REQUEST['creation_date_to'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['creation_date_to']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['creation_date_to']; } else { $where_request .= " (" . $req->extract_date("creation_date") . " <= '" . $func->format_date_db($_REQUEST['creation_date_to']) . "') and "; $json_txt .= " 'creation_date_to' : ['" . trim($_REQUEST['creation_date_to']) . "'],"; } } // PROCESS DATE : FROM (closing_date) else if ($tab_id_fields[$j] == 'closing_date_from' && !empty ($_REQUEST['closing_date_from'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['closing_date_from']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['closing_date_from']; } else { $where_request .= " (" . $req->extract_date("closing_date") . " >= '" . $func->format_date_db($_REQUEST['closing_date_from']) . "') and "; $json_txt .= "'closing_date_from' : ['" . trim($_REQUEST['closing_date_from']) . "'],"; } } // CLOSING DATE : TO else if ($tab_id_fields[$j] == 'closing_date_to' && !empty ($_REQUEST['closing_date_to'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['closing_date_to']) == false) { $_SESSION['error'] = _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['closing_date_to']; } else { $where_request .= " (" . $req->extract_date("closing_date") . " <= '" . $func->format_date_db($_REQUEST['closing_date_to']) . "') and "; $json_txt .= "'closing_date_to' : ['" . trim($_REQUEST['closing_date_to']) . "'],"; } } // PROCESS LIMIT DATE : FROM else if ($tab_id_fields[$j] == 'process_limit_date_from' && !empty ($_REQUEST['process_limit_date_from'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['process_limit_date_from']) == false) { $_SESSION['error'] = _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['process_limit_date_from']; } else { $where_request .= " (" . $req->extract_date("process_limit_date") . " >= '" . $func->format_date_db($_REQUEST['process_limit_date_from']) . "') and "; $json_txt .= "'process_limit_date_from' : ['" . trim($_REQUEST['process_limit_date_from']) . "'],"; } } // PROCESS LIMIT DATE : TO else if ($tab_id_fields[$j] == 'process_limit_date_to' && !empty ($_REQUEST['process_limit_date_to'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['process_limit_date_to']) == false) { $_SESSION['error'] = _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['process_limit_date_to']; } else { $where_request .= " (" . $req->extract_date("process_limit_date") . " <= '" . $func->format_date_db($_REQUEST['process_limit_date_to']) . "') and "; $json_txt .= "'process_limit_date_to' : ['" . trim($_REQUEST['process_limit_date_to']) . "'],"; } } // STATUS else if ($tab_id_fields[$j] == 'status_chosen' && isset ($_REQUEST['status_chosen'])) { $json_txt .= " 'status_chosen' : ["; $where_request .= "( "; for ($get_i = 0; $get_i < count($_REQUEST['status_chosen']); $get_i++) { $json_txt .= "'" . $_REQUEST['status_chosen'][$get_i] . "',"; if ($_REQUEST['status_chosen'][$get_i] == "REL1") { $where_request .= "( " . $req->extract_date('alarm1_date') . " <= " . $req->current_datetime() . " and " . $req->extract_date('alarm2_date') . " > " . $req->current_datetime() . " and status <> 'END') or "; } else { if ($_REQUEST['status_chosen'][$get_i] == "REL2") { $where_request .= "( " . $req->current_datetime() . " >= " . $req->extract_date('alarm2_date') . " and status <> 'END') or "; } elseif ($_REQUEST['status_chosen'][$get_i] == "LATE") { $where_request .= "( process_limit_date is not null and " . $req->current_datetime() . " > " . $req->extract_date('process_limit_date') . " and status <> 'END') or "; } else { $where_request .= " ( status = '" . $func->protect_string_db($_REQUEST['status_chosen'][$get_i]) . "') or "; } } } $where_request = preg_replace("/or $/", "", $where_request); $json_txt = substr($json_txt, 0, -1); $where_request .= ") and "; $json_txt .= '],'; } // ANSWER TYPE BITMASK /** * Answer type bitmask * 0 0 0 0 0 0 * | | | | | |_ Simple Mail * | | | | |___ Registered mail * | | | |_____ Direct Contact * | | |_______ Email * | |_________ Fax * |___________ Other Answer **/ else if ($tab_id_fields[$j] == 'AR' && !empty ($_REQUEST['AR'])) { $where_request .= " answer_type_bitmask like '____1_' AND "; $json_txt .= " 'AR' : ['" . addslashes(trim($_REQUEST['AR'])) . "'],"; } else if ($tab_id_fields[$j] == 'fax' && !empty ($_REQUEST['fax'])) { $where_request .= " answer_type_bitmask like '_1____' AND "; $json_txt .= " 'fax' : ['" . addslashes(trim($_REQUEST['fax'])) . "'],"; } else if ($tab_id_fields[$j] == 'courriel' && !empty ($_REQUEST['courriel'])) { $where_request .= " answer_type_bitmask like '__1___' AND "; $json_txt .= " 'courriel' : ['" . addslashes(trim($_REQUEST['courriel'])) . "'],"; } else if ($tab_id_fields[$j] == 'autre' && !empty ($_REQUEST['autre'])) { $where_request .= " answer_type_bitmask like '1_____' AND "; $json_txt .= " 'autre' : ['" . addslashes(trim($_REQUEST['autre'])) . "'],"; } else if ($tab_id_fields[$j] == 'direct' && !empty ($_REQUEST['direct'])) { $where_request .= " answer_type_bitmask like '___1__' AND "; $json_txt .= " 'direct' : ['" . addslashes(trim($_REQUEST['direct'])) . "'],"; } else if ($tab_id_fields[$j] == 'simple_mail' && !empty ($_REQUEST['simple_mail'])) { $where_request .= " answer_type_bitmask like '_____1' AND "; $json_txt .= " 'simple_mail' : ['" . addslashes(trim($_REQUEST['simple_mail'])) . "'],"; } else if ($tab_id_fields[$j] == 'norep' && !empty ($_REQUEST['norep'])) { $where_request .= " answer_type_bitmask = '000000' AND "; $json_txt .= " 'norep' : ['" . addslashes(trim($_REQUEST['norep'])) . "'],"; } // MAIL CATEGORY else if ($tab_id_fields[$j] == 'category' && !empty ($_REQUEST['category'])) { $where_request .= " category_id = '" . $func->protect_string_db($_REQUEST['category']) . "' AND "; $json_txt .= "'category' : ['" . addslashes($_REQUEST['category']) . "'],"; } else if ($tab_id_fields[$j] == 'baskets_clause_true' && $_REQUEST['baskets_clause'] == "true") { for ($ind_bask = 0; $ind_bask < count($_SESSION['user']['baskets']); $ind_bask++) { if (isset ($_SESSION['user']['baskets'][$ind_bask]['clause']) && trim($_SESSION['user']['baskets'][$ind_bask]['clause']) <> '') { $_SESSION['searching']['comp_query'] .= ' or (' . $_SESSION['user']['baskets'][$ind_bask]['clause'] . ')'; } } $_SESSION['searching']['comp_query'] = preg_replace('/^ or/', '', $_SESSION['searching']['comp_query']); $baskets_clause = ($_REQUEST['baskets_clause']); $json_txt .= " 'baskets_clause_true' : ['true'],"; } else if ($tab_id_fields[$j] == 'baskets_clause_false' && $_REQUEST['baskets_clause'] == "false") { $baskets_clause = "false"; $json_txt .= "'baskets_clause_false' : ['false'],"; } // ADMISSION DATE : FROM else if ($tab_id_fields[$j] == 'admission_date_from' && !empty ($_REQUEST['admission_date_from'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['admission_date_from']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['admission_date_from']; } else { $where_request .= " (" . $req->extract_date("admission_date") . " >= '" . $func->format_date_db($_REQUEST['admission_date_from']) . "') and "; $json_txt .= " 'admission_date_from' : ['" . trim($_REQUEST['admission_date_from']) . "'],"; } } // ADMISSION DATE : TO else if ($tab_id_fields[$j] == 'admission_date_to' && !empty ($_REQUEST['admission_date_to'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['admission_date_to']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['admission_date_to']; } else { $where_request .= " (" . $req->extract_date("admission_date") . " <= '" . $func->format_date_db($_REQUEST['admission_date_to']) . "') and "; $json_txt .= " 'admission_date_to' : ['" . trim($_REQUEST['admission_date_to']) . "'],"; } } // DOC DATE : FROM else if ($tab_id_fields[$j] == 'doc_date_from' && !empty ($_REQUEST['doc_date_from'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['doc_date_from']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['doc_date_from']; } else { $where_request .= " (" . $req->extract_date("doc_date") . " >= '" . $func->format_date_db($_REQUEST['doc_date_from']) . "') and "; $json_txt .= " 'doc_date_from' : ['" . trim($_REQUEST['doc_date_from']) . "'],"; } } // DOC DATE : TO else if ($tab_id_fields[$j] == 'doc_date_to' && !empty ($_REQUEST['doc_date_to'])) { if (preg_match($_ENV['date_pattern'], $_REQUEST['doc_date_to']) == false) { $_SESSION['error'] .= _WRONG_DATE_FORMAT . ' : ' . $_REQUEST['doc_date_to']; } else { $where_request .= " (" . $req->extract_date("doc_date") . " <= '" . $func->format_date_db($_REQUEST['doc_date_to']) . "') and "; $json_txt .= " 'doc_date_to' : ['" . trim($_REQUEST['doc_date_to']) . "'],"; } } else // opt indexes check { $tmp = $type->search_checks($indexes, $tab_id_fields[$j], $_REQUEST[$tab_id_fields[$j]] ); //$func->show_array($tmp); $json_txt .= $tmp['json_txt']; $where_request .= $tmp['where']; } } $json_txt = preg_replace('/,$/', '', $json_txt); $json_txt .= "}},"; } $json_txt = preg_replace('/,$/', '', $json_txt); } //echo $where_request;exit; $json_txt = preg_replace("/,$/", "", $json_txt); $json_txt .= '}'; /* echo $json_txt; echo '
'.$where_request; exit(); */ $_SESSION['current_search_query'] = $json_txt; if (!empty ($_SESSION['error'])) { if ($mode == 'normal') { $_SESSION['error_search'] = '
' . _MUST_CORRECT_ERRORS . ' :

' . $_SESSION['error_search'] . '
' . _CLICK_HERE_TO_CORRECT . '
'; ?>
' . _MUST_CORRECT_ERRORS . ' :

' . $_SESSION['error_search'] . '
' . _CLICK_HERE_TO_CORRECT . '
'; ?> '') { $where_request_welcome = substr($where_request_welcome, 0, -4); $where_request .= '(' . $where_request_welcome . ') and '; } $where_request = trim($where_request); $_SESSION['searching']['where_request'] = $where_request; } if (isset($_REQUEST['specific_case']) && $_REQUEST['specific_case'] == "attach_to_case") { $page = 'list_results_mlb_frame'; ?>