. */ /** * @brief Displays document list in search mode * * @file * @author Yves Christian Kpakpo * @date $date$ * @version $Revision$ * @ingroup apps */ 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_contacts_v2.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_lists.php"; $status_obj = new manage_status(); $sec = new security(); $core_tools = new core_tools(); $request = new request(); $contact = new contacts_v2(); $list = new lists(); //Labels if($core_tools->is_module_loaded('labels')) { require_once "modules" . DIRECTORY_SEPARATOR . "labels" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; $labels = new labels(); } //Include definition fields include_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); //Parameters $urlParameters = ''; //Mode $mode = 'normal'; if(isset($_REQUEST['mode'])&& !empty($_REQUEST['mode'])) { $mode = $core_tools->wash($_REQUEST['mode'], "alphanum", _MODE); } $urlParameters .= '&mode='.$mode; //No details $showIconDetails = true; if(isset($_REQUEST['nodetails'])) { $showIconDetails = false; $urlParameters .= '&nodetails'; } //module if(isset($_REQUEST['modulename'])) { $urlParameters .= '&modulename='.$_REQUEST['modulename']; } //Form if(isset($_REQUEST['action_form'])) { $urlParameters .= '&action_form='.$_REQUEST['action_form']; } //Start $saveTool = true; $useTemplate = true; $exportTool = true; $printTool = true; $bigPageTitle = true; $standaloneForm = false; $radioButton = false; //Templates $defaultTemplate = 'documents_list_search_adv'; $selectedTemplate = $list->getTemplate(); if (empty($selectedTemplate)) { if (!empty($defaultTemplate)) { $list->setTemplate($defaultTemplate); $selectedTemplate = $list->getTemplate(); } } $template_list = array(); array_push($template_list, 'documents_list_search_adv'); if($core_tools->is_module_loaded('cases')) array_push($template_list, 'cases_list_search_adv'); //For status icon $extension_icon = ''; if($selectedTemplate <> 'none') $extension_icon = "_big"; //error and search url $url_error = $_SESSION['config']['businessappurl'].'index.php?page=search_adv_error&dir=indexing_searching'; $url_search = $_SESSION['config']['businessappurl'].'index.php?page=search_adv&dir=indexing_searching'; //error $_SESSION['error_search'] = '


' ._NO_RESULTS.'



'._MAKE_NEW_SEARCH.'
'; /************Construction de la requete*******************/ //Table or view $_SESSION['collection_id_choice'] = 'letterbox_coll'; $view = $sec->retrieve_view_from_coll_id($_SESSION['collection_id_choice']); $select = array(); $select[$view]= array(); //Fields //Documents array_push($select[$view], "res_id as is_labeled", "res_id", "status", "subject", "category_id as category_img", "contact_firstname", "contact_lastname", "contact_society", "user_lastname", "user_firstname", "dest_user", "type_label", "creation_date", "folders_system_id", "folder_name", "entity_label", "category_id, exp_user_id", "is_multicontacts"); //Cases if($core_tools->is_module_loaded("cases") == true) { array_push($select[$view], "case_id", "case_label", "case_description"); } //Where clause $where_tab = array(); //From search if (!empty($_SESSION['searching']['where_request'])) $where_tab[] = $_SESSION['searching']['where_request']. '(1=1)'; //From searching comp query $status = $status_obj->get_not_searchable_status(); if(count($status) > 0) { $status_tab = array(); $status_str = ''; for($i=0; $igetOrder(); $order_field = $list->getOrderField(); if (!empty($order_field) && !empty($order)) $orderstr = "order by ".$order_field." ".$order; else { $list->setOrder(); $list->setOrderField('creation_date'); $orderstr = "order by creation_date desc"; } //URL extra Parameters $parameters = ''; $start = $list->getStart(); if (!empty($order_field) && !empty($order)) $parameters .= '&order='.$order.'&order_field='.$order_field; if (!empty($what)) $parameters .= '&what='.$what; if (!empty($selectedTemplate)) $parameters .= '&template='.$selectedTemplate; if (!empty($start)) $parameters .= '&start='.$start; //Query $tab=$request->select($select,$where_request,$orderstr,$_SESSION['config']['databasetype'],"default", false, "", "", "", $add_security); // $request->show(); //Result array for ($i=0;$iis_module_loaded('labels') && (isset($_SESSION['user']['services']['labels']) && $_SESSION['user']['services']['labels'] === true) ) { $str_label = $labels->get_labels_resid($tab[$i][$j]['value'], $_SESSION['collection_id_choice']); if (!empty($str_label)) $tab[$i][$j]['value'] = ''; else $tab[$i][$j]['value'] = ' '; $tab[$i][$j]["label"]=_LABELS; $tab[$i][$j]["size"]="4"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["order"]=false; } if($tab[$i][$j][$value]=='res_id') { $tab[$i][$j]['res_id']=$tab[$i][$j]['value']; $tab[$i][$j]["label"]=_GED_NUM; $tab[$i][$j]["size"]="4"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]='res_id'; $_SESSION['mlb_search_current_res_id'] = $tab[$i][$j]['value']; // notes $db = new dbquery(); $db->connect(); $query = "select "; $query .= "notes.id "; $query .= "from "; $query .= "notes "; $query .= "left join "; $query .= "note_entities "; $query .= "on "; $query .= "notes.id = note_entities.note_id "; $query .= "where "; $query .= "tablename = 'res_letterbox' "; $query .= "AND "; $query .= "coll_id = 'letterbox_coll' "; $query .= "AND "; $query .= "identifier = " . $tab[$i][$j]['value'] . " "; $query .= "AND "; $query .= "( "; $query .= "( "; $query .= "item_id IN ("; foreach($_SESSION['user']['entities'] as $entitiestmpnote) { $query .= "'" . $entitiestmpnote['ENTITY_ID'] . "', "; } if ($_SESSION['user']['UserId'] == 'superadmin') { $query .= " null "; } else { $query = substr($query, 0, -2); } $query .= ") "; $query .= "OR "; $query .= "item_id IS NULL "; $query .= ") "; $query .= "OR "; $query .= "user_id = '" . $_SESSION['user']['UserId'] . "' "; $query .= ") "; //echo $query . '
'; $db->query($query); $tab[$i][$j]['hasNotes'] = $db->fetch_object(); $tab[$i][$j]['res_multi_contacts'] = $_SESSION['mlb_search_current_res_id']; } if($tab[$i][$j][$value]=="type_label") { $tab[$i][$j]["label"]=_TYPE; $tab[$i][$j]['value'] = $request->show_string($tab[$i][$j]['value']); $tab[$i][$j]["size"]="15"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="type_label"; } if($tab[$i][$j][$value]=="status") { $tab[$i][$j]["label"]=_STATUS; $res_status = $status_obj->get_status_data($tab[$i][$j]['value'],$extension_icon); $tab[$i][$j]['value'] = ''.$res_status['LABEL'].''; $tab[$i][$j]["size"]="5"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="status"; } if($tab[$i][$j][$value]=="subject") { $tab[$i][$j]["label"]=_SUBJECT; $tab[$i][$j]["value"] = $request->cut_string($request->show_string($tab[$i][$j]["value"]), 250); $tab[$i][$j]["size"]="25"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="subject"; } if($tab[$i][$j][$value]=="dest_user") { $tab[$i][$j]["label"]=_DEST_USER; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="dest_user"; } if($tab[$i][$j][$value]=="creation_date") { $tab[$i][$j]["label"]=_REG_DATE; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = $request->format_date_db($tab[$i][$j]['value'], false); $tab[$i][$j]["order"]="creation_date"; } if($tab[$i][$j][$value]=="entity_label") { $tab[$i][$j]["label"]=_ENTITY; $tab[$i][$j]['value'] = $request->show_string($tab[$i][$j]['value']); $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="entity_label"; } if($tab[$i][$j][$value]=="category_id") { $_SESSION['mlb_search_current_category_id'] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = $_SESSION['coll_categories']['letterbox_coll'][$tab[$i][$j]['value']]; $tab[$i][$j]["label"]=_CATEGORY; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="category_id"; } if($tab[$i][$j][$value]=="category_img") { $tab[$i][$j]["label"]=_CATEGORY; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $my_imgcat = get_img_cat($tab[$i][$j]['value'],$extension_icon); $tab[$i][$j]['value'] = $my_imgcat; $tab[$i][$j]["value"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="category_id"; } if($tab[$i][$j][$value]=="contact_firstname") { $contact_firstname = $tab[$i][$j]["value"]; $tab[$i][$j]["show"]=false; } if($tab[$i][$j][$value]=="contact_lastname") { $contact_lastname = $tab[$i][$j]["value"]; $tab[$i][$j]["show"]=false; } if($tab[$i][$j][$value]=="contact_society") { $contact_society = $tab[$i][$j]["value"]; $tab[$i][$j]["show"]=false; } if($tab[$i][$j][$value]=="user_firstname") { $user_firstname = $tab[$i][$j]["value"]; $tab[$i][$j]["show"]=false; } if($tab[$i][$j][$value]=="user_lastname") { $user_lastname = $tab[$i][$j]["value"]; $tab[$i][$j]["show"]=false; } if($tab[$i][$j][$value]=="$template_to_use exp_user_id") { $tab[$i][$j]["label"]=_CONTACT; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = $contact->get_contact_information_from_view($_SESSION['mlb_search_current_category_id'], $contact_lastname, $contact_firstname, $contact_society, $user_lastname, $user_firstname); $tab[$i][$j]["order"]=false; } if($tab[$i][$j][$value]=="is_multicontacts") { if($tab[$i][$j]['value'] == 'Y'){ $tab[$i][$j]["label"]=_CONTACT; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = _MULTI_CONTACT; $tab[$i][$j]["order"]=false; $tab[$i][$j]["is_multi_contacts"] = 'Y'; } } if($tab[$i][$j][$value]=="case_id" && $core_tools->is_module_loaded("cases") == true) { $tab[$i][$j]["label"]=_CASE_NUM; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = "".$tab[$i][$j]['value'].""; $tab[$i][$j]["order"]="case_id"; } if($tab[$i][$j][$value]=="case_label" && $core_tools->is_module_loaded("cases") == true) { $tab[$i][$j]["label"]=_CASE_LABEL; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="case_id"; } if($tab[$i][$j][$value]=="folder_name") { $tab[$i][$j]["label"]=_FOLDER; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=true; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["order"]="folder_name"; } if($tab[$i][$j][$value]=="exp_user_id") { $tab[$i][$j]["label"]=_CONTACT; $tab[$i][$j]["size"]="10"; $tab[$i][$j]["label_align"]="left"; $tab[$i][$j]["align"]="left"; $tab[$i][$j]["valign"]="bottom"; $tab[$i][$j]["show"]=false; $tab[$i][$j]["value_export"] = $tab[$i][$j]['value']; $tab[$i][$j]["value"] = $contact->get_contact_information_from_view($_SESSION['mlb_search_current_category_id'], $contact_lastname, $contact_firstname, $contact_society, $user_lastname, $user_firstname); $tab[$i][$j]["order"]=false; } } } } if (count($tab) > 0) { /************Construction de la liste*******************/ //Clé de la liste $listKey = 'res_id'; //Initialiser le tableau de paramètres $paramsTab = array(); $paramsTab['bool_modeReturn'] = false; //Desactivation du mode return (vs echo) $paramsTab['listCss'] = 'listing largerList spec'; //css $paramsTab['urlParameters'] = $urlParameters.'&dir=indexing_searching'; //Parametres supplémentaires $paramsTab['pageTitle'] = _RESULTS." : ".count($tab).' '._FOUND_DOCS; //Titre de la page $paramsTab['pagePicto'] = 'search'; //Image de la page $paramsTab['bool_bigPageTitle'] = $bigPageTitle; //Titre de la page en grand $paramsTab['bool_showIconDocument'] = true; //Affichage de l'icone du document $paramsTab['bool_showIconDetails'] = $showIconDetails; //Affichage de l'icone de la page de details $paramsTab['bool_showAttachment'] = true; //Affichage du nombre de document attaché (mode étendu) if ($radioButton) { //Boutton radio $paramsTab['bool_radioButton'] = $radioButton; } $paramsTab['defaultTemplate'] = $defaultTemplate; //Default template if ($useTemplate && count($template_list) >0 ) { //Templates $paramsTab['templates'] = array(); $paramsTab['templates'] = $template_list; } $paramsTab['bool_showTemplateDefaultList'] = true; //Default list (no template) //Form attributs //Standalone form $paramsTab['bool_standaloneForm'] = $standaloneForm; //Method if (isset($formMethod) && !empty($formMethod)) $paramsTab['formMethod'] = $formMethod; //Action if (isset($formAction) && !empty($formAction)) $paramsTab['formAction'] = $formAction; //Hiden fields if (isset($hiddenFormFields) && count($hiddenFormFields) > 0) { //Champs hidden supplémentaire | mots clés = id, name, value $paramsTab['hiddenFormFields'] = array(); $paramsTab['hiddenFormFields'] = $hiddenFormFields; } //Buttons if (isset($buttons) && count($buttons) > 0) { //Liste des boutons de formulaire $paramsTab['buttons'] = array(); $paramsTab['buttons'] = $buttons; } //Toolbar $paramsTab['tools'] = array(); //Icones dans la barre d'outils //Fileplan if ($core_tools->test_service('fileplan', 'fileplan', false)) { if ($mode == 'normal') { require_once "modules" . DIRECTORY_SEPARATOR . "fileplan" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; $fileplan = new fileplan(); if ( count($fileplan->getUserFileplan()) > 0 || (count($fileplan->getEntitiesFileplan()) > 0 && $core_tools->test_service('put_doc_in_fileplan', 'fileplan', false) ) ) { $paramsTab['bool_checkBox'] = true; $paramsTab['bool_standaloneForm'] = true; $positions = array( "script" => "showFileplanList('".$_SESSION['config']['businessappurl'] . "index.php?display=true&module=fileplan&page=fileplan_ajax_script" . "&mode=setPosition&origin=search&coll_id=".$_SESSION['collection_id_choice'] . $parameters."', 'formList', '600px', '510px', '" . _CHOOSE_ONE_DOC."')", "icon" => 'bookmark', "tooltip" => _FILEPLAN, "disabledRules" => count($tab)." == 0 || ".$selectedTemplate." == 'cases_list_search_adv'" ); array_push($paramsTab['tools'],$positions); } } } if($saveTool) { $save = array( "script" => "createModal(form_txt);window.location.href='#top';", "icon" => 'save', "tooltip" => _SAVE_QUERY, "disabledRules" => count($tab)." == 0" ); array_push($paramsTab['tools'],$save); } if($exportTool) { $export = array( "script" => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=export', '_blank');", "icon" => 'cloud-download', "tooltip" => _EXPORT_LIST, "disabledRules" => count($tab)." == 0" ); array_push($paramsTab['tools'],$export); } if($printTool && $core_tools->test_service('print_doc_details_from_list', 'apps', false)) { $print = array( "script" => "window.open('".$_SESSION['config']['businessappurl']."index.php?display=true&page=print', '_blank');", "icon" => 'print', "tooltip" => _PRINT_LIST, "disabledRules" => count($tab)." == 0" ); array_push($paramsTab['tools'], $print); } //Afficher la liste $list->showList($tab, $paramsTab, $listKey); // $list->debug(); /*************************Extra javascript***********************/ ?> window.top.location.href=\''.$url_error.'\';'; exit(); }