. */ /** * @brief Advanced search form * * @file search_adv_business.php * @author Laurent Giovannoni * @date $date$ * @version $Revision$ * @ingroup indexing_searching */ require_once('core/class/class_request.php'); require_once('core/class/class_security.php'); require_once('core/class/class_manage_status.php'); require_once('apps/' . $_SESSION['config']['app_id'] . '/class/class_indexing_searching_app.php'); require_once('apps/' . $_SESSION['config']['app_id'] . '/class/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; if (isset($_REQUEST['exclude'])) { $_SESSION['excludeId'] = $_REQUEST['exclude']; } $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_business', '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_business&dir=indexing_searching'; $page_label = _SEARCH_ADV_SHORT; $page_id = "search_adv_business"; $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 = 'business_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 (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 '', 'LABEL' => _CHOOSE.'...')); for ($j=0; $j $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; } //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; //Closing date $arr_tmp2 = array('label' => _CLOSING_DATE, 'type' => 'date_range', 'param' => array('field_label' => _CLOSING_DATE, 'id1' => 'closing_date_from', 'id2' =>'closing_date_to')); $param['closing_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; //Process limit date $arr_tmp2 = array('label' => _LIMIT_DATE_PROCESS, 'type' => 'date_range', 'param' => array('field_label' => _LIMIT_DATE_PROCESS, 'id1' => 'process_limit_date_from', 'id2' =>'process_limit_date_to')); $param['process_limit_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; if ($_SESSION['features']['search_notes'] == 'true') { //annotations $arr_tmp2 = array('label' => _NOTES, 'type' => 'textarea', 'param' => array('field_label' => _NOTES, 'other' => $size)); $param['doc_notes'] = $arr_tmp2; } //tags if ($core_tools->is_module_loaded('tags')) { $arr_tmptag = array(); require_once 'modules/tags/class/TagControler.php' ; require_once 'modules/tags/tags_tables_definition.php'; $tag = new tag_controler; $tag_return_value = $tag -> get_all_tags($coll_id); if ($tag_return_value) { foreach($tag_return_value as $tagelem) { array_push($arr_tmptag, array('VALUE' => $tagelem['tag_label'], 'LABEL' => $tagelem['tag_label'])); } } else { array_push($arr_tmptag, array('VALUE' => '', 'LABEL' => _TAGNONE)); } $param['tag_mu'] = array('label' => _TAG_SEARCH, 'type' => 'select_multiple', 'param' => array('field_label' => _TAG_SEARCH, 'label_title' => _CHOOSE_TAG, 'id' => 'tags','options' => $arr_tmptag)); } //destination (department) if ($core_tools->is_module_loaded('entities')) { $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' => _FOLDER, 'type' => 'input_text', 'param' => array('field_label' => _FOLDER, 'other' => $size)); $param['market'] = $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)); // 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' and coll_id = '" . $coll_id . "' 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; //currency $arr_tmp2 = array('label' => _CURRENCY, 'type' => 'input_text', 'param' => array('field_label' => _CURRENCY, 'other' => $size)); $param['currency'] = $arr_tmp2; //net_sum $arr_tmp2 = array('label' => _NET_SUM, 'type' => 'input_text', 'param' => array('field_label' => _NET_SUM, 'other' => $size)); $param['net_sum'] = $arr_tmp2; //tax_sum $arr_tmp2 = array('label' => _TAX_SUM, 'type' => 'input_text', 'param' => array('field_label' => _TAX_SUM, 'other' => $size)); $param['tax_sum'] = $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) { ?>
is_module_loaded("basket") == true) { ?>

 
 
 


/>
/>
/>
/>
/>
/>
 

 

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