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); $db->query("select docserver_id from res_view_attachments where res_id_master = " . $res_id . " order by res_id desc"); while ($res = $db->fetch_object()) { $docserver_id = $res->docserver_id; break; } $db->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$docserver_id."'"); $res = $db->fetch_object(); $docserver_path = $res->path_template; $db->query("select filename, path,title,res_id,res_id_version,attachment_type from res_view_attachments where res_id_master = " . $res_id . " AND status <> 'OBS' AND status <> 'SIGN' AND status <> 'DEL' and attachment_type IN ('response_project','signed_response') order by creation_date asc"); $array_reponses = array(); $cpt_rep = 0; while ($res2 = $db->fetch_object()){ $filename=$res2->filename; $path = preg_replace('/#/', DIRECTORY_SEPARATOR, $res2->path); $filename_pdf = str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf",$filename); if (file_exists($docserver_path.$path.$filename_pdf)){ $array_reponses[$cpt_rep]['path'] = $docserver_path.$path.$filename_pdf; $array_reponses[$cpt_rep]['title'] = $res2->title; $array_reponses[$cpt_rep]['attachment_type'] = $res2->attachment_type; if ($res2->res_id_version == 0){ $array_reponses[$cpt_rep]['res_id'] = $res2->res_id; $array_reponses[$cpt_rep]['is_version'] = 0; } else{ $array_reponses[$cpt_rep]['res_id'] = $res2->res_id_version; $array_reponses[$cpt_rep]['is_version'] = 1; } $cpt_rep++; } } return $array_reponses; } /*************/ $res_id = $_REQUEST['res_id']; $coll_id = $_REQUEST['coll_id']; require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; include('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'definition_mail_categories.php'); $core =new core_tools(); $data = get_general_data($coll_id, $res_id, 'minimal'); /* Partie centrale */ // AVANCEMENT $avancement_html = ''; $avancement_html .= '

'. _WF .'

'; $avancement_html .= ''; $avancement_html .= '
'; $avancement_html .= '
'; $avancement_html .= ''; $avancement_html .= '<<'; $avancement_html .= ' '. _ALL_HISTORY .''; $avancement_html .= ''; $avancement_html .= ''; //CIRCUIT $circuit_html = ''; $circuit_html .= '

Circuit de visa

'; $modifVisaWorkflow = false; if ($core->test_service('config_visa_workflow', 'visa', false)) { $modifVisaWorkflow = true; } $visa = new visa(); $circuit_html .= '
'; $circuit_html .= '
'; $circuit_html .= $visa->getList($res_id, $coll_id, $modifVisaWorkflow, 'VISA_CIRCUIT', true); $circuit_html .= '

'; /* Historique diffusion visa */ $circuit_html .= '
'; $circuit_html .= '
'; $circuit_html .= ''; $circuit_html .= '<<'; $circuit_html .= ' Historique du circuit de visa'; $circuit_html .= ''; $circuit_html .= ''; //NOTES if ($core->is_module_loaded('notes')){ require_once "modules" . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; $notes_tools = new notes(); //Count notes $nbr_notes = $notes_tools->countUserNotes($res_id, $coll_id); if ($nbr_notes > 0 ) $nbr_notes = ' ('.$nbr_notes.')'; else $nbr_notes = ''; //Notes iframe $notes_html_dt = _NOTES.$nbr_notes; $notes_html_dd = '

'. _NOTES .'

'; } /* Partie droite */ $right_html = ''; $tab_path_rep_file = get_rep_path($res_id, $coll_id); for ($i=0; $i 20) $titleRep = substr($tab_path_rep_file[$i]['title'],0,20).'...'; else $titleRep = $tab_path_rep_file[$i]['title']; $titleRep = str_replace("'", "\\'",$titleRep); $right_html .= '
'.$titleRep.'
'; $right_html .= ''; $right_html .= '
'; } $countAttachments = "select res_id from res_view_attachments where status NOT IN ('DEL','OBS') and res_id_master = " . $res_id . " and coll_id = '" . $coll_id . "'"; $dbAttach = new dbquery(); $dbAttach->query($countAttachments); if ($dbAttach->nb_result() > 0) { $nb_attach = ' (' . ($dbAttach->nb_result()). ')'; } $right_html .= '
'. _ATTACHED_DOC .$nb_attach.'
'; if ($core_tools->is_module_loaded('attachments')) { require 'modules/templates/class/templates_controler.php'; $templatesControler = new templates_controler(); $templates = array(); $templates = $templatesControler->getAllTemplatesForProcess($curdest); $_SESSION['destination_entity'] = $curdest; //var_dump($templates); $right_html .= '
'; $right_html .= '
'; $right_html .= '
'; $right_html .= '

' . _PJ . ', ' . _ATTACHEMENTS . '

'; $req = new request; $req->connect(); $req->query("select res_id from ".$_SESSION['tablename']['attach_res_attachments'] . " where (status = 'A_TRA' or status = 'TRA' or status = 'SIGN') and res_id_master = " . $res_id . " and coll_id = '" . $coll_id . "'"); //$req->show(); $nb_attach = 0; if ($req->nb_result() > 0) { $nb_attach = $req->nb_result(); } $right_html .= '
'; $right_html .= '
'; if ($core_tools->is_module_loaded('templates')) { $right_html .= ''; } $right_html .= '
'; $right_html .= '
'; $right_html .= '
'; $right_html .= '
'; $right_html .= '
'; $right_html .= '
'; } $right_html .= '
'; if ( $core->is_module_loaded('content_management') && $data['category_id']['value'] == 'outgoing') { $versionTable = $sec->retrieve_version_table_from_coll_id( $coll_id ); $selectVersions = "select res_id from " . $versionTable . " where res_id_master = " . $res_id . " and status <> 'DEL' order by res_id desc"; $dbVersions = new dbquery(); $dbVersions->connect(); $dbVersions->query($selectVersions); $nb_versions_for_title = $dbVersions->nb_result(); $lineLastVersion = $dbVersions->fetch_object(); $lastVersion = $lineLastVersion->res_id; if ($lastVersion <> '') { $objectId = $lastVersion; $objectTable = $versionTable; } else { $objectTable = $sec->retrieve_table_from_coll( $coll_id ); $objectId = $res_id; $_SESSION['cm']['objectId4List'] = $res_id; } if ($nb_versions_for_title == 0) { $extend_title_for_versions = '0'; } else { $extend_title_for_versions = $nb_versions_for_title; } $_SESSION['cm']['resMaster'] = ''; $right_html .= '
' . _VERSIONS . ' (' . $extend_title_for_versions . ')
'; $right_html .= '

'; $right_html .= '
' . _VERSIONS . '
'; $right_html .= '

'; $right_html .= '
'; $right_html .= '
'; $right_html .= ''; $right_html .= '' . _VIEW_ORIGINAL . ''; $right_html .= _VIEW_ORIGINAL . ' | '; $right_html .= ''; if ($core->test_service('add_new_version_init', 'apps', false)) { $_SESSION['cm']['objectTable'] = $objectTable; $right_html .= '
'; } $right_html .= '
'; $right_html .= ''; $right_html .= '

'; $right_html .= '
'; } $valid_but = 'valid_action_form( \\\'index_file\\\', \\\'index.php?display=true&page=manage_action&module=core\\\', \\\''.$_REQUEST['action'].'\\\', \\\''.$res_id.'\\\', \\\'res_letterbox\\\', \\\'null\\\', \\\''.$coll_id.'\\\', \\\'page\\\');'; //echo "{status : 1,avancement:'".$avancement_html."',circuit:'".$circuit_html."',notes_dt:'".$notes_html_dt."',notes_dd:'".$notes_html_dd."'}"; echo "{status : 1,notes_dt:'".$notes_html_dt."',notes_dd:'".$notes_html_dd."',circuit:'".addslashes($circuit_html)."',avancement:'".$avancement_html."',right_html:'".$right_html."',valid_button:'".$valid_but."',id_rep:'".$tab_path_rep_file[0]['res_id']."',is_vers_rep:'".$tab_path_rep_file[0]['is_version']."'}"; exit(); ?>