. */ /** * @brief Advanced search form * * @file search_adv_invoices.php * @author Claire Figueras * @author Loïc Vinet * @date $date$ * @version $Revision$ * @ingroup indexing_searching_invoices */ require_once ("core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_request.php"); require_once ("core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_security.php"); require_once ("core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_manage_status.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(); $_SESSION['search']['plain_text'] = ""; $type = new types(); $func = new functions(); $conn = new dbquery(); $conn->connect(); $search_obj = new indexing_searching_app(); $status_obj = new manage_status(); $sec = new security(); $_SESSION['indexation'] = false; $mode = 'normal'; if (isset ($_REQUEST['mode']) && !empty ($_REQUEST['mode'])) { $mode = $func->wash($_REQUEST['mode'], "alphanum", _MODE); } if ($mode == 'normal') { $core_tools->test_service('adv_search_invoices', 'apps'); /****************Management of the location bar ************/ $init = false; if (isset ($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") { $init = true; } $level = ""; if (isset ($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) { $level = $_REQUEST['level']; } $page_path = $_SESSION['config']['businessappurl'] . 'index.php?page=search_adv_invoices&dir=indexing_searching'; $page_label = _ADV_SEARCH_INVOICES; $page_id = "search_adv_invoices"; $core_tools->manage_location_bar($page_path, $page_label, $page_id, $init, $level); /***********************************************************/ } elseif ($mode == 'popup' || $mode == 'frame') { $core_tools->load_html(); $core_tools->load_header('', true, false); $time = $core_tools->get_session_time_expire(); ?>
query("select query_id, query_name from " . $_SESSION['tablename']['saved_queries'] . " where user_id = '" . $_SESSION['user']['UserId'] . "' order by query_name"); $queries = array (); while ($res = $conn->fetch_object()) { array_push($queries, array ( 'ID' => $res->query_id, 'LABEL' => $res->query_name )); } $conn->query("select user_id, firstname, lastname, status from " . $_SESSION['tablename']['users'] . " where enabled = 'Y' and status <> 'DEL' order by lastname asc"); $users_list = array (); while ($res = $conn->fetch_object()) { array_push($users_list, array ( 'ID' => $conn->show_string($res->user_id), 'NOM' => $conn->show_string($res->lastname), 'PRENOM' => $conn->show_string($res->firstname), 'STATUT' => $res->status )); } $coll_id = 'res_coll'; $view = $sec->retrieve_view_from_coll_id($coll_id); $where = $sec->get_where_clause_from_coll_id($coll_id); if (!empty ($where)) { $where = ' where ' . $where; } //Check if web brower is ie_6 or not if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) { $browser_ie = 'true'; $class_for_form = 'form'; $hr = '
'; $size = ''; } elseif (isset($HTTP_USER_AGENT) && (preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $HTTP_USER_AGENT))) { $browser_ie = 'true'; $class_for_form = 'forms'; $hr = ''; $size = ''; } else { $browser_ie = 'false'; $class_for_form = 'forms'; $hr = ''; $size = ''; // $size = 'style="width:40px;"'; } // building of the parameters array used to pre-load the category list and the search elements $param = array (); // Indexes specific to doctype $indexes = $type->get_all_indexes($coll_id); for ($i = 0; $i < count($indexes); $i++) { $field = $indexes[$i]['column']; if (preg_match('/^custom_/', $field)) { $field = 'doc_' . $field; } if ($indexes[$i]['type_field'] == 'select') { $arr_tmp = array (); array_push($arr_tmp, array ( 'VALUE' => '', 'LABEL' => _CHOOSE . '...' )); for ($j = 0; $j < count($indexes[$i]['values']); $j++) { array_push($arr_tmp, array ( 'VALUE' => $indexes[$i]['values'][$j]['id'], 'LABEL' => $indexes[$i]['values'][$j]['label'] )); } $arr_tmp2 = array ( 'label' => $indexes[$i]['label'], 'type' => 'select_simple', 'param' => array ( 'field_label' => $indexes[$i]['label'], 'default_label' => '', 'options' => $arr_tmp ) ); } elseif ($indexes[$i]['type'] == 'date') { $arr_tmp2 = array ( 'label' => $indexes[$i]['label'], 'type' => 'date_range', 'param' => array ( 'field_label' => $indexes[$i]['label'], 'id1' => $field . '_from', 'id2' => $field . '_to' ) ); } else if ($indexes[$i]['type'] == 'string') { $arr_tmp2 = array ( 'label' => $indexes[$i]['label'], 'type' => 'input_text', 'param' => array ( 'field_label' => $indexes[$i]['label'], 'other' => $size ) ); } else // integer or float { $arr_tmp2 = array ( 'label' => $indexes[$i]['label'], 'type' => 'num_range', 'param' => array ( 'field_label' => $indexes[$i]['label'], 'id1' => $field . '_min', 'id2' => $field . '_max' ) ); } $param[$field] = $arr_tmp2; } //Coming date /* $arr_tmp2 = array ( 'label' => _DATE_START, 'type' => 'date_range', 'param' => array ( 'field_label' => _DATE_START, 'id1' => 'admission_date_from', 'id2' => 'admission_date_to' ) ); $param['admission_date'] = $arr_tmp2; */ //Loaded date $arr_tmp2 = array ( 'label' => _REG_DATE, 'type' => 'date_range', 'param' => array ( 'field_label' => _REG_DATE, 'id1' => 'creation_date_from', 'id2' => 'creation_date_to' ) ); $param['creation_date'] = $arr_tmp2; //Document date $arr_tmp2 = array ( 'label' => _DOC_DATE, 'type' => 'date_range', 'param' => array ( 'field_label' => _DOC_DATE, 'id1' => 'doc_date_from', 'id2' => 'doc_date_to' ) ); $param['doc_date'] = $arr_tmp2; /* //destinataire $arr_tmp = array (); for ($i = 0; $i < count($users_list); $i++) { array_push($arr_tmp, array ( 'VALUE' => $users_list[$i]['ID'], 'LABEL' => $users_list[$i]['NOM'] . " " . $users_list[$i]['PRENOM'] )); } $arr_tmp2 = array ( 'label' => _PROCESS_RECEIPT, 'type' => 'select_multiple', 'param' => array ( 'field_label' => _PROCESS_RECEIPT, 'label_title' => _CHOOSE_RECIPIENT_SEARCH_TITLE, 'id' => 'destinataire', 'options' => $arr_tmp ) ); $param['destinataire'] = $arr_tmp2; */ //destination (department) /* if ($core_tools->is_module_loaded('entities')) { $coll_id = 'res_coll'; $where = $sec->get_where_clause_from_coll_id($coll_id); $table = $sec->retrieve_view_from_coll_id($coll_id); if (empty ($table)) { $table = $sec->retrieve_table_from_coll($coll_id); } if (!empty ($where)) { $where = ' where ' . $where; } //$conn->query("select distinct r.destination from ".$table." r join ".$_SESSION['tablename']['ent_entities']." e on e.entity_id = r.destination ".$where." group by r.destination "); $conn->query("select distinct r.destination, e.short_label from " . $table . " r join " . $_SESSION['tablename']['ent_entities'] . " e on e.entity_id = r.destination " . $where . " group by e.short_label, r.destination order by e.short_label"); // $conn->show(); $arr_tmp = array (); while ($res = $conn->fetch_object()) { array_push($arr_tmp, array ( 'VALUE' => $res->destination, 'LABEL' => $res->short_label )); } $param['destination_mu'] = array ( 'label' => _DESTINATION_SEARCH, 'type' => 'select_multiple', 'param' => array ( 'field_label' => _DESTINATION_SEARCH, 'label_title' => _CHOOSE_ENTITES_SEARCH_TITLE, 'id' => 'services', 'options' => $arr_tmp ) ); } */ // Folder /* if ($core_tools->is_module_loaded('folder')) { $arr_tmp2 = array ( 'label' => _MARKET, 'type' => 'input_text', 'param' => array ( 'field_label' => _MARKET, 'other' => $size ) ); $param['market'] = $arr_tmp2; $arr_tmp2 = array ( 'label' => _PROJECT, 'type' => 'input_text', 'param' => array ( 'field_label' => _PROJECT, 'other' => $size ) ); $param['project'] = $arr_tmp2; } */ //status $status = $status_obj->get_searchable_status(); $arr_tmp = array (); for ($i = 0; $i < count($status); $i++) { array_push($arr_tmp, array ( 'VALUE' => $status[$i]['ID'], 'LABEL' => $status[$i]['LABEL'] )); } /* array_push($arr_tmp, array ( 'VALUE' => 'REL1', 'LABEL' => _FIRST_WARNING )); array_push($arr_tmp, array ( 'VALUE' => 'REL2', 'LABEL' => _SECOND_WARNING )); array_push($arr_tmp, array ( 'VALUE' => 'LATE', 'LABEL' => _LATE )); /* array_push($arr_tmp, array ( 'VALUE' => 'REL1', 'LABEL' => _FIRST_WARNING )); array_push($arr_tmp, array ( 'VALUE' => 'REL2', 'LABEL' => _SECOND_WARNING )); array_push($arr_tmp, array ( 'VALUE' => 'LATE', 'LABEL' => _LATE )); */ // Sorts the $param['status'] array function cmp_status($a, $b) { return strcmp(strtolower($a["LABEL"]), strtolower($b["LABEL"])); } usort($arr_tmp, "cmp_status"); $arr_tmp2 = array ( 'label' => _STATUS_PLUR, 'type' => 'select_multiple', 'param' => array ( 'field_label' => _STATUS, 'label_title' => _CHOOSE_STATUS_SEARCH_TITLE, 'id' => 'status', 'options' => $arr_tmp ) ); $param['status'] = $arr_tmp2; //doc_type /*$conn->query("select type_id, description from " . $_SESSION['tablename']['doctypes'] . " where enabled = 'Y' order by description asc"); $arr_tmp = array (); while ($res = $conn->fetch_object()) { array_push($arr_tmp, array ( 'VALUE' => $res->type_id, 'LABEL' => $conn->show_string($res->description) )); } $arr_tmp2 = array ( 'label' => _DOCTYPES, 'type' => 'select_multiple', 'param' => array ( 'field_label' => _DOCTYPE, 'label_title' => _CHOOSE_DOCTYPES_SEARCH_TITLE, 'id' => 'doctypes', 'options' => $arr_tmp ) ); $param['doctype'] = $arr_tmp2; */ /* //category $arr_tmp = array (); array_push($arr_tmp, array ( 'VALUE' => '', 'LABEL' => _CHOOSE_CATEGORY )); foreach (array_keys($_SESSION['coll_categories']['res_coll']) as $cat_id) { array_push($arr_tmp, array ( 'VALUE' => $cat_id, 'LABEL' => $_SESSION['coll_categories']['res_coll'][$cat_id] )); } $arr_tmp2 = array ( 'label' => _CATEGORY, 'type' => 'select_simple', 'param' => array ( 'field_label' => _CATEGORY, 'default_label' => '', 'options' => $arr_tmp ) ); $param['category'] = $arr_tmp2; //Arbox_id ; for physical_archive * * * */ /* if ($core_tools->is_module_loaded('physical_archive') == true) { //arbox_id $conn->query("select arbox_id, title from " . $_SESSION['tablename']['ar_boxes'] . " where status <> 'DEL' order by description asc"); $arr_tmp = array (); while ($res = $conn->fetch_object()) { array_push($arr_tmp, array ( 'VALUE' => $res->arbox_id, 'LABEL' => $conn->show_string($res->title) )); } $arr_tmp2 = array ( 'label' => _ARBOXES, 'type' => 'select_multiple', 'param' => array ( 'field_label' => _ARBOXES, 'label_title' => _CHOOSE_BOXES_SEARCH_TITLE, 'id' => 'arboxes', 'options' => $arr_tmp ) ); $param['arbox_id'] = $arr_tmp2; $arr_tmp2 = array ( 'label' => _ARBATCHES, 'type' => 'input_text', 'param' => array ( 'field_label' => _ARBATCHES, 'other' => $size ) ); $param['arbatch_id'] = $arr_tmp2; } */ // Sorts the param array function cmp($a, $b) { return strcmp(strtolower($a["label"]), strtolower($b["label"])); } uasort($param, "cmp"); $tab = $search_obj->send_criteria_data($param); //$conn->show_array($param); //$conn->show_array($tab); // criteria list options $src_tab = $tab[0]; $core_tools->load_js(); ?>

0) { ?>
" alt="" /> is_module_loaded("basket") == true){?>

/>
 


 

'; if ($mode == 'popup') { ?>
'; }