. */ /** * @brief Action : Document validation * * Open a modal box to displays the validation form, make the form checks * and loads the result in database. Used by the core (manage_action.php page). * * @file * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup apps */ /** * $confirm bool false */ $confirm = false; /** * $etapes array Contains only one etap : form */ $etapes = array('form'); /** * $frm_width Width of the modal (empty) */ $frm_width=''; /** * $frm_height Height of the modal (empty) */ $frm_height = ''; /** * $mode_form Mode of the modal : fullscreen */ $mode_form = 'fullscreen'; include('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); ///////////////////// Pattern to check dates $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; /** * Gets the path of the file to displays * * @param $res_id String Resource identifier * @param $coll_id String Collection identifier * @return String File path **/ function get_file_path($res_id, $coll_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); $sec =new security(); $view = $sec->retrieve_view_from_coll_id($coll_id); if(empty($view)) { $view = $sec->retrieve_table_from_coll($coll_id); } $db = new dbquery(); $db->connect(); $db->query("select docserver_id, path, filename from ".$view." where res_id = ".$res_id); $res = $db->fetch_object(); $path = preg_replace('/#/', DIRECTORY_SEPARATOR, $res->path); $docserver_id = $res->docserver_id; $filename = $res->filename; $db->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$docserver_id."'"); $res = $db->fetch_object(); $docserver_path = $res->path_template; return $docserver_path.$path.$filename; } function check_category($coll_id, $res_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); $sec =new security(); $view = $sec->retrieve_view_from_coll_id($coll_id); $db = new dbquery(); $db->connect(); $db->query("select category_id from ".$view." where res_id = ".$res_id); $res = $db->fetch_object(); if(!isset($res->category_id)) { $ind_coll = $sec->get_ind_collection($coll_id); $table_ext = $_SESSION['collections'][$ind_coll]['extensions'][0]; $db->query("insert into ".$table_ext." (res_id, category_id) VALUES (".$res_id.", '".$_SESSION['coll_categories']['letterbox_coll']['default_category']."')"); //$db->show(); } } /** * Returns the validation form text * * @param $values Array Contains the res_id of the document to validate * @param $path_manage_action String Path to the PHP file called in Ajax * @param $id_action String Action identifier * @param $table String Table * @param $module String Origin of the action * @param $coll_id String Collection identifier * @param $mode String Action mode 'mass' or 'page' * @return String The form content text **/ function get_form_txt($values, $path_manage_action, $id_action, $table, $module, $coll_id, $mode ) { if (preg_match("/MSIE 6.0/", $_SERVER["HTTP_USER_AGENT"])) { $browser_ie = true; $display_value = 'block'; } elseif(preg_match('/msie/i', $_SERVER["HTTP_USER_AGENT"]) && !preg_match('/opera/i', $_SERVER["HTTP_USER_AGENT"]) ) { $browser_ie = true; $display_value = 'block'; } else { $browser_ie = false; $display_value = 'table-row'; } $_SESSION['req'] = "action"; $res_id = $values[0]; $_SESSION['doc_id'] = $res_id; $frm_str = ''; 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_business_app_tools.php"); require_once("modules".DIRECTORY_SEPARATOR."basket".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_modules_tools.php"); require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_types.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); $sec =new security(); $core_tools =new core_tools(); $b = new basket(); $type = new types(); $business = new business_app_tools(); if($_SESSION['features']['show_types_tree'] == 'true') { $doctypes = $type-> getArrayStructTypes($coll_id); } else { $doctypes = $type->getArrayTypes($coll_id); } $db = new dbquery(); $db->connect(); $hidden_doctypes = array(); $tmp = $business->get_titles(); $titles = $tmp['titles']; $default_title = $tmp['default_title']; if($core_tools->is_module_loaded('templates')) { $db->query("select type_id from ".$_SESSION['tablename']['temp_templates_doctype_ext']." where is_generated = 'NULL!!!'"); while($res = $db->fetch_object()) { array_push($hidden_doctypes, $res->type_id); } } $today = date('d-m-Y'); if ($core_tools->is_module_loaded('entities')) { $EntitiesIdExclusion = array(); $db = new dbquery(); $db->connect(); if (count($_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities']) > 0) { $db->query( "select entity_id from " . ENT_ENTITIES . " where entity_id not in (" . $_SESSION['user']['redirect_groupbasket'][$_SESSION['current_basket']['id']][$id_action]['entities'] . ") and enabled= 'Y' order by entity_id" ); while ($res = $db->fetch_object()) { array_push($EntitiesIdExclusion, $res->entity_id); } } require_once 'modules/entities/class/class_manage_entities.php'; $ent = new entity(); $allEntitiesTree= array(); $allEntitiesTree = $ent->getShortEntityTreeAdvanced( $allEntitiesTree, 'all', '', $EntitiesIdExclusion, 'all' ); //LOADING LISTMODEL require_once('modules/entities/class/class_manage_listdiff.php'); $diff_list = new diffusion_list(); $load_listmodel = true; $db->query("select res_id from " . $_SESSION['tablename']['ent_listinstance']." where res_id = " . $res_id); if ($db->nb_result() > 0) { $load_listmodel = false; $_SESSION['indexing']['diff_list'] = $diff_list->get_listinstance($res_id); } } if($core_tools->is_module_loaded('physical_archive')) { $boxes = array(); $db->query("select arbox_id, title from ".$_SESSION['tablename']['ar_boxes']." where status = 'NEW' order by title"); while($res = $db->fetch_object()) { array_push($boxes, array( 'ID' => $res->arbox_id, 'LABEL' => $db->show_string($res->title))); } } check_category($coll_id, $res_id); $data = get_general_data($coll_id, $res_id, 'minimal'); /* echo '
';
    print_r($data);
    echo '
';exit; */ $frm_str .= '
'; $frm_str .= ''; $frm_str .= '
'; $frm_str .= '
'; /*** TOOLBAR ***/ $frm_str .= '
'; $frm_str .= ''; $frm_str .= ''; //CONTACT if ($_SESSION['features']['personal_contact'] == "true" ) { $frm_str .= ''; } // HISTORY $frm_str .= ''; //NOTE if ($core_tools->is_module_loaded('notes')) { $frm_str .= ''; } //ATTACHMENTS if ($core_tools->is_module_loaded('attachments')) { $frm_str .= ''; } //LINKS $frm_str .= ''; //END TOOLBAR $frm_str .= '
'; $frm_str .= '|'; $frm_str .= '<<' . '' . _CREATE_CONTACT . ''; $frm_str .= '|'; $frm_str .= ''; $frm_str .= '|'; $frm_str .= '<<' . '' . _DOC_HISTORY . ''; $frm_str .= '|'; $frm_str .= ''; require_once 'modules/notes/class/class_modules_tools.php'; $notes_tools = new notes(); //Count notes $nbr_notes = $notes_tools->countUserNotes($res_id, $coll_id); $nbr_notes = ' ('.$nbr_notes.')'; $frm_str .= '|'; $frm_str .= '<<' . '' . _NOTES . $nbr_notes . ''; $frm_str .= '|'; $frm_str .= ''; $req = new request; $req->connect(); $req->query("select res_id from " . $_SESSION['tablename']['attach_res_attachments'] . " where status <> 'DEL' and res_id_master = " . $res_id . " and coll_id = '" . $coll_id . "'"); if ($req->nb_result() > 0) { $nb_attach = $req->nb_result(); } else { $nb_attach = 0; } if ($answer <> '') { $answer .= ': '; } $frm_str .= '|'; $frm_str .= '<<' . '' . _PJ . ' (' . $answer .'' . $nb_attach . ')'; $frm_str .= '|'; $frm_str .= ''; require_once('core/class/LinkController.php'); $Class_LinkController = new LinkController(); $nbLink = $Class_LinkController->nbDirectLink( $res_id, $coll_id, 'all' ); $frm_str .= '|'; $frm_str .= '<<' . '' . _LINK_TAB . ' (' . $nbLink . ')'; $frm_str .= '|'; $frm_str .= '
'; $frm_str .= '
'; //FRAME FOR TOOLS //CONTACT CREATION $frm_str .= ''; $frm_str .= ''; //HISTORY FRAME $frm_str .= ''; //NOTES if ($core_tools->is_module_loaded('notes')) { //Iframe notes $frm_str .= ''; } //ATTACHMENTS if ($core_tools->is_module_loaded('attachments')) { require 'modules/templates/class/templates_controler.php'; $templatesControler = new templates_controler(); $templates = array(); $templates = $templatesControler->getAllTemplatesForProcess($data['destination']); $frm_str .= '