* @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'); 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_resource.php"); require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/"; function writeLogIndex($EventInfo) { $logFileOpened = fopen($_SESSION['config']['logdir']."visa_mail.log", 'a'); fwrite($logFileOpened, '[' . date('d') . '/' . date('m') . '/' . date('Y') . ' ' . date('H') . ':' . date('i') . ':' . date('s') . '] ' . $EventInfo . "\r\n" ); fclose($logFileOpened); } function createPdfNotes($list_notes){ define('FPDF_FONTPATH','modules/visa/class/font/'); //above line is import to define, otherwise it gives an error : Could not include font metric file require('modules/visa/class/fpdf.php'); require('modules/visa/class/fpdi.php'); class ChargePdf extends FPDI { function LoadData($tab) { // Lecture des lignes du fichier $data = array(); /*foreach($lines as $line) $data[] = explode(';',trim($line));*/ for ($i = 0; $i < count($tab); $i++){ $note = getNote($tab[$i]); $user = getInfosUser($note['user']); $data[] = array(utf8_decode($user['prenom']).' '.utf8_decode($user['nom']),$note['date'],utf8_decode($note['text'])); } return $data; } var $widths; var $aligns; function SetWidths($w) { $this->widths=$w; } function SetAligns($a) { $this->aligns=$a; } function Row($data) { //Calcule la hauteur de la ligne $nb=0; for($i=0;$iNbLines($this->widths[$i],$data[$i])); $h=5*$nb; $this->CheckPageBreak($h); for($i=0;$iwidths[$i]; $a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L'; $x=$this->GetX();$y=$this->GetY(); $this->Rect($x,$y,$w,$h); $this->MultiCell($w,5,$data[$i],0,$a); $this->SetXY($x+$w,$y); } $this->Ln($h); } function CheckPageBreak($h) { if($this->GetY()+$h>$this->PageBreakTrigger)$this->AddPage($this->CurOrientation); } function NbLines($w,$txt) { $cw=&$this->CurrentFont['cw']; if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); if($nb>0 and $s[$nb-1]=="\n") $nb--; $sep=-1;$i=0;$j=0;$l=0;$nl=1; while($i<$nb) { $c=$s[$i]; if($c=="\n") { $i++;$sep=-1;$j=$i;$l=0;$nl++; continue; } if($c==' ') $sep=$i; $l+=$cw[$c]; if($l>$wmax) { if($sep==-1) { if($i==$j) $i++; } else $i=$sep+1;$sep=-1;$j=$i;$l=0;$nl++; } else $i++; } return $nl; } } $pdf = new ChargePdf(); $pdf->addPage(); $data = $pdf->LoadData($list_notes); $header = array('Nom', 'Consigne', 'Date'); $pdf->SetFont('Arial','B',12); $pdf->SetY(30); //$pdf->Table($header, $data); $pdf->SetWidths(array(40,30,100)); $pdf->SetAligns(array('C','C','C')); $pdf->Row(array('Nom', 'Date', 'Note')); $pdf->SetAligns(array('L','C','L')); $pdf->SetFont('Arial','',10); foreach($data as $d){ $pdf->Row($d); } $outputFile = $_SESSION['config']['tmppath'] . DIRECTORY_SEPARATOR . "listNotes".$_SESSION['user']['UserId'].".pdf"; $pdf->Output($outputFile, 'F'); return $outputFile; } function getNotes($res_id){ $db = new dbquery(); $db->connect(); $req_notes = "select * from notes where identifier = '".$res_id."'"; $db->query($req_notes); $tab_notes = array(); while ($notes = $db->fetch_object()) { $note = "Note de ".$notes->user_id.", le ".$notes->date_note." : ".$notes->note_text; //array_push($tab_notes, $note); array_push($tab_notes, array('id_note'=>$notes->id,'user_id'=>$notes->user_id,'date_note'=>$notes->date_note,'note_text'=>$notes->note_text)); } return $tab_notes; } function getNote($id_note){ $note = array(); $requete = "SELECT * from notes where id = $id_note"; $db = new dbquery(); $db->connect(); $db->query($requete); $res=$db->fetch_object(); $note['user'] = $res->user_id; $note['text'] = $res->note_text; $date = explode("-",$res->date_note); $note['date'] = $date[2]."/".$date[1]."/".$date[0]; return $note; } /** * 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(); } } function get_rep_path($res_id, $coll_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."docservers_controler.php"); $docserverControler = new docservers_controler(); $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); $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; } function getDossier($values_form){ $dossier = array(); $list_notes = array(); foreach($values_form as $v){ if ($v['ID'] == "contenu_dossier"){ $val = explode("_",$v['VALUE']); array_push($dossier,array('type'=>$val[0],'id'=>$val[1])); if ($val[0] == "note"){ array_push($list_notes,$val[1]); } } } if (count($list_notes) > 0){ $path_file_notes = createPdfNotes($list_notes); array_push($dossier,array('type'=>'pdf_notes','path'=>$path_file_notes)); } return $dossier; } function getPaths($dossier, $id_doc){ //$paths = array(); //foreach ($dossier as $d){ for ($i = 0; $i < count($dossier); $i++){ $id = $dossier[$i]['id']; if ($dossier[$i]['type'] == "initial"){ $db = new dbquery(); $db->connect(); $resource = new resource(); $whereClause = ' and 1=1'; $adrTable = $_SESSION['collections'][0]['adr']; /* TEST VERSION */ $sec = new security(); $versionTable = $sec->retrieve_version_table_from_coll_id( 'letterbox_coll' ); $selectVersions = "select res_id from " . $versionTable . " where res_id_master = " . $id . " and status <> 'DEL' order by res_id desc"; $dbVersions = new dbquery(); $dbVersions->connect(); $dbVersions->query($selectVersions); $lineLastVersion = $dbVersions->fetch_object(); $lastVersion = $lineLastVersion->res_id; if ($lastVersion <> ''){ $adr = $resource->getResourceAdr( $versionTable, $lastVersion, $whereClause, '' ); } else { $adr = $resource->getResourceAdr( "res_view_letterbox", $id, $whereClause, $adrTable ); } /****************/ //writeLogIndex(print_r($adr,true)); $db->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$adr[0][0]['docserver_id']."'"); $res = $db->fetch_object(); $docserver_path = $res->path_template; if (isset($adr[0][0]['visu_filename']) && $adr[0][0]['visu_filename'] != "") $dossier[$i]['path'] = str_replace("//","/",$docserver_path . str_replace("#", DIRECTORY_SEPARATOR , $adr[0][0]['path']) . $adr[0][0]['visu_filename']); else $dossier[$i]['path'] = str_replace("//","/",$docserver_path . str_replace("#", DIRECTORY_SEPARATOR , $adr[0][0]['path']) . $adr[0][0]['filename']); } elseif ($dossier[$i]['type'] == "attach"){ //writeLogIndex("Attach num $id"); $path = get_attach_path_id($id, $id_doc, "letterbox_coll"); //writeLogIndex(print_r($path,true)); $dossier[$i]['path'] = $path; } elseif ($dossier[$i]['type'] == "note"){ } } return $dossier; } function concat_files($dossier, $res_id){ require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."docservers_controler.php"; require_once "core".DIRECTORY_SEPARATOR."docservers_tools.php"; require_once 'core/class/docserver_types_controler.php'; $cmd = "pdftk "; foreach($dossier as $d){ if (isset($d['path'])) $cmd .= $d['path']." "; } $tmpFileName = 'tmp_file_' . $_SESSION['user']['UserId'] . '_' . rand() . '.pdf'; $filePathOnTmp = $_SESSION['config']['tmppath'] . $tmpFileName; $cmd .= " cat output ".$filePathOnTmp; exec($cmd); ajout_bdd($tmpFileName,$res_id); } function ajout_bdd($fnameTmp, $res_id){ $db = new dbquery(); $db->connect(); $collId = 'letterbox_coll'; require_once 'modules/attachments/attachments_tables.php'; require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."docservers_controler.php"; require_once "core".DIRECTORY_SEPARATOR."docservers_tools.php"; require_once 'core/class/docserver_types_controler.php'; $docserv_control = new docservers_controler(); $docserverTypeControler = new docserver_types_controler(); $docserver = $docserv_control->getDocserverToInsert($collId); if (empty($docserver)) { $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' . _NO_AVAILABLE_DOCSERVER . '. ' . _MORE_INFOS; } else { $newSize = $docserv_control->checkSize( $docserver, $filesize ); if ($newSize == 0) { $_SESSION['error'] = _DOCSERVER_ERROR . ' : ' . _NOT_ENOUGH_DISK_SPACE . '. ' . _MORE_INFOS . '.'; } else { $title = "Dossier du document n°".$res_id; $fileInfos = array( 'tmpDir' => $_SESSION['config']['tmppath'], 'size' => filesize ($_SESSION['config']['tmppath'].$fnameTmp), 'format' => 'pdf', 'tmpFileName' => $fnameTmp, ); $storeResult = array(); $storeResult = $docserv_control->storeResourceOnDocserver( $collId, $fileInfos ); if (isset($storeResult['error']) && $storeResult['error'] <> '') { $_SESSION['error'] = $storeResult['error']; } else { require_once "core/class/class_request.php"; $req = new request(); $req->connect(); $resAttach = new resource(); $_SESSION['data'] = array(); array_push( $_SESSION['data'], array( 'column' => 'typist', 'value' => $_SESSION['user']['UserId'], 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'format', 'value' => 'pdf', 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'docserver_id', 'value' => $storeResult['docserver_id'], 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'status', 'value' => 'TRA', 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'offset_doc', 'value' => ' ', 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'logical_adr', 'value' => ' ', 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'title', 'value' => $req->protect_string_db($title), 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'relation', 'value' => 1, 'type' => 'integer', ) ); array_push( $_SESSION['data'], array( 'column' => 'coll_id', 'value' => $collId, 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'res_id_master', 'value' => $res_id, 'type' => 'integer', ) ); array_push( $_SESSION['data'], array( 'column' => 'type_id', 'value' => 0, 'type' => 'int', ) ); array_push( $_SESSION['data'], array( 'column' => 'identifier', 'value' => '1', 'type' => 'string', ) ); array_push( $_SESSION['data'], array( 'column' => 'attachment_type', 'value' => 'print_folder', 'type' => 'string', ) ); $id = $resAttach->load_into_db( RES_ATTACHMENTS_TABLE, $storeResult['destination_dir'], $storeResult['file_destination_name'] , $storeResult['path_template'], $storeResult['docserver_id'], $_SESSION['data'], $_SESSION['config']['databasetype'] ); $complete_path = $storeResult['path_template'].str_replace('#',DIRECTORY_SEPARATOR,$storeResult['destination_dir']).$storeResult['file_destination_name']; if ($id == false) { $_SESSION['error'] = $resAttach->get_error(); } else { if ($_SESSION['history']['attachadd'] == "true") { $hist = new history(); $sec = new security(); $view = $sec->retrieve_view_from_coll_id( $collId ); $hist->add( $view, $res_id, 'ADD', 'attachadd', ucfirst(_DOC_NUM) . $id . ' ' . _NEW_ATTACH_ADDED . ' ' . _TO_MASTER_DOCUMENT . $res_id, $_SESSION['config']['databasetype'], 'apps' ); $hist->add( RES_ATTACHMENTS_TABLE, $id, 'ADD','attachadd', $_SESSION['error'] . _NEW_ATTACHMENT, $_SESSION['config']['databasetype'], 'attachments' ); } } return $complete_path; } return 'null'; } } } function get_attach_path($res_id, $coll_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."docservers_controler.php"); $docserverControler = new docservers_controler(); $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(); $docserver_id = $res->docserver_id; $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,status,typist,creation_date,format,attachment_type from res_view_attachments where status <> 'DEL' AND status IN ('TRA','SIGN') AND res_id_master = " . $res_id . " order by attachment_type, creation_date asc"); $array_attach = 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); $array_attach[$cpt_rep]['path'] = $docserver_path.$path.$filename_pdf; $array_attach[$cpt_rep]['title'] = $res2->title; $array_attach[$cpt_rep]['res_id'] = $res2->res_id; $array_attach[$cpt_rep]['attachment_type'] = $res2->attachment_type; $array_attach[$cpt_rep]['format'] = $res2->format; $array_attach[$cpt_rep]['typist'] = $res2->typist; $date = explode(" ",$res2->creation_date); $array_attach[$cpt_rep]['date'] = $date[0]; $cpt_rep++; } return $array_attach; } function get_attach_path_id($id_attach, $id_doc, $coll_id) { require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."docservers_controler.php"); $docserverControler = new docservers_controler(); $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 = ".$id_doc); $res = $db->fetch_object(); $docserver_id = $res->docserver_id; $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,status,typist,creation_date from res_attachments where res_id = " . $id_attach ); $res2 = $db->fetch_object(); $filename=$res2->filename; $path = preg_replace('/#/', DIRECTORY_SEPARATOR, $res2->path); $path = str_replace ("//","/",$path); $filename_pdf = str_replace(pathinfo($filename, PATHINFO_EXTENSION), "pdf",$filename); return $docserver_path.$path.$filename_pdf; } function getDocsBasket(){ $db = new dbquery(); $db->connect(); $orderstr = "order by creation_date desc"; if (isset($_SESSION['last_order_basket'])) $orderstr = $_SESSION['last_order_basket']; $requete = "select res_id from ".$_SESSION['current_basket']['view']." where " . $_SESSION['current_basket']['clause'] . " $orderstr"; $db->query($requete, true); $tab_docs = array(); while($res = $db->fetch_object()){ array_push($tab_docs,$res->res_id); } return $tab_docs; } function getInfosUser($user_id){ $db=new dbquery(); $db->connect(); $db->query("SELECT firstname, lastname, group_id, entity_id from users u, usergroup_content uc, users_entities ue where u.user_id = '$user_id' AND uc.user_id = u.user_id AND ue.user_id = u.user_id AND ue.primary_entity='Y' AND uc.primary_group = 'Y' "); $user = array(); $res = $db->fetch_object(); $user['prenom'] = $res->firstname; $user['nom'] = $res->lastname; $user['groupe'] = $res->group_id; $user['entite'] = $res->entity_id; return $user; } 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'; } unset($_SESSION['m_admin']['contact']); $_SESSION['req'] = "action"; $res_id = $values[0]; $_SESSION['doc_id'] = $res_id; // Ouverture de la modal $docLockerCustomPath = 'apps/maarch_entreprise/actions/docLocker.php'; $docLockerPath = $_SESSION['config']['businessappurl'] . '/actions/docLocker.php'; if (is_file($docLockerCustomPath)) require_once $docLockerCustomPath; else if (is_file($docLockerPath)) require_once $docLockerPath; else exit("can't find docLocker.php"); $docLocker = new docLocker($res_id); if (!$docLocker->canOpen()) { $docLockerscriptError = ''; return $docLockerscriptError; } $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(); /*check_category($coll_id, $res_id); $data = get_general_data($coll_id, $res_id, 'minimal');*/ /* echo '
';
    print_r($data);
    echo '
';exit; */ $db = new dbquery(); $db->connect(); $view = $sec->retrieve_view_from_coll_id($coll_id); $db->query("select alt_identifier,typist from " . $view . " where res_id = " . $res_id); $resChrono = $db->fetch_object(); $chrono_number = $resChrono->alt_identifier; $typist = getInfosUser($resChrono->typist); $typist = $typist['prenom'].' '.$typist['nom']; $frm_str .= '

'._VISA_MAIL.' '._NUM.''.$res_id.''; $frm_str .= '

'; $frm_str .= '
'; $frm_str .= '
'; $tab_docs = getDocsBasket(); //$frm_str .= '
'.print_r($tab_docs,true).'
'; //$selectedCat = ''; $list_docs = ''; foreach($tab_docs as $num=>$res_id_doc){ $list_docs .= $res_id_doc."#"; if ($res_id_doc == $res_id){ $classLine = ' class="selectedId" '; } else $classLine = ' class="unselectedId" '; $frm_str .= '
'; check_category($coll_id, $res_id_doc); $data = get_general_data($coll_id, $res_id_doc, 'minimal'); if ($res_id_doc == $res_id){ $selectedCat = $data['category_id']['value']; $curContact = $data['contact']; $curSubject = $data['subject']; $curDate = $data['doc_date']; $curNumDoc = $num; $curdest = $data['destination']; } $frm_str .= '
    '; $frm_str .= '
  • '; $frm_str .= $chrono_number . ' - ' .$res_id_doc; $frm_str .= '
  • '; $frm_str .= '
  • '; $frm_str .= ' '; if(isset($data['contact']) && !empty($data['contact'])) { if (strlen($data['contact']) > 35) $contact = substr($data['contact'],0,35).'...'; else $contact = $data['contact']; $frm_str .= $contact; } $frm_str .= '
  • '; $frm_str .= '
  • '; $frm_str .= ' '; if(isset($data['subject']) && !empty($data['subject'])) { if (strlen($data['subject']) > 80) $subject = substr($data['subject'],0,80).'...'; else $subject = $data['subject']; $frm_str .= $subject; } $frm_str .= '
  • '; $frm_str .= '
  • '; $frm_str .= ' '; $frm_str .= $data['admission_date']; $frm_str .= ' '; $frm_str .= $data['process_limit_date']; $frm_str .= '
  • '; $frm_str .= '
'; $frm_str .= '
'; } $frm_str .= '
'; $frm_str .= '
'; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= '
'; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; //Onglet document $frm_str .= '
'._INCOMING.'
'; $frm_str .= '
'; $frm_str .= ''; $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()). ')'; } $frm_str .= '
'. _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); $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '

' . _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') 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(); } $frm_str .= '
'; $frm_str .= '
'; if ($core_tools->is_module_loaded('templates')) { $frm_str .= ''; } $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; } $frm_str .= '
'; //Onglet Avancement $frm_str .= '
Avancement
'; $frm_str .= '
Avancement
'; $frm_str .= '

'. _WF .'

'; $frm_str .= ''; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= ''; $frm_str .= '<<'; $frm_str .= ' '. _ALL_HISTORY .''; $frm_str .= ''; $frm_str .= ''; $frm_str .= '
'; //Onglet notes if ($core_tools->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 $frm_str .= '
'. _NOTES.$nbr_notes .'

'. _NOTES .'

'; } $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
Dossier
'; $frm_str .= '
'; $frm_str .= '

Contenu du dossier de réponse

'; $frm_str .= '

Requérent : '.$curContact.'

'; $frm_str .= '

Objet : '.$curSubject.'

'; $frm_str .= '
'; /*$circuit_visa = new visa(); $frm_str .= $circuit_visa->getList($res_id, $coll_id, true);*/ $tab_attach_file = get_attach_path($res_id, $coll_id); $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; if ($selectedCat == "incoming"){ $frm_str .= ''; $frm_str .= ''; } else{ $frm_str .= ''; $frm_str .= ''; } $currentStat = ""; //$frm_str .= print_r($tab_attach_file,true); $bordereauExists = false; for ($i=0; $i'.$tab_attach_file[$i]['title'].''; } if (!$bordereauExists){ $frm_str .= ""; $frm_str .= ''; } $tab_notes = getNotes($res_id); if (count($tab_notes) > 0){ $frm_str .= ''; foreach($tab_notes as $note){ $auteur = getInfosUser($note['user_id']); $frm_str .= ''; } } $frm_str .= ''; $frm_str .= '
TitreRédacteurDate

+ Courrier entrant

'.$curSubject.''.$curContact.''.$curDate.'

+ Courrier sortant

'.$curSubject.''.$typist.''.$curDate.'
'.$auteur['prenom'].' '.$auteur['nom'].''.$tab_attach_file[$i]['date'].'

+ Générer la fiche de circulation

+ Notes

'.$note['note_text'].''.$auteur['prenom'].' '.$auteur['nom'].''.$note['date_note'].'
'; $frm_str .= '
'; $frm_str .= '
'; //Onglet Circuit $frm_str .= '
'._VISA_WORKFLOW.'
'; $frm_str .= '

'._VISA_WORKFLOW.'

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

'; /* Historique diffusion visa */ $frm_str .= '
'; $frm_str .= '
'; $frm_str .= ''; $frm_str .= '<<'; $frm_str .= ' '._DIFF_LIST_VISA_HISTORY.''; $frm_str .= ''; $frm_str .= ''; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= '
'; $frm_str .= ''._ACTIONS.' : '; $actions = $b->get_actions_from_current_basket($res_id, $coll_id, 'PAGE_USE'); if(count($actions) > 0) { $frm_str .=' '; $table = $sec->retrieve_table_from_coll($coll_id); $frm_str .= ' '; } $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; $frm_str .= ''; //$frm_str .= ''; $frm_str .= ''; $frm_str .= ' '; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; $frm_str .= '
'; /*** Extra javascript ***/ $frm_str .= ''; return addslashes($frm_str); } /** * Checks the action form * * @param $form_id String Identifier of the form to check * @param $values Array Values of the form * @return Bool true if no error, false otherwise **/ function check_form($form_id,$values) { //writeLogIndex("GO check_form !!"); $_SESSION['action_error'] = ''; if(count($values) < 1 || empty($form_id)) { $_SESSION['action_error'] = _FORM_ERROR; return false; } else { return true; } } /** * Get the value of a given field in the values returned by the form * * @param $values Array Values of the form to check * @param $field String the field * @return String the value, false if the field is not found **/ function get_value_fields($values, $field) { for($i=0; $iretrieve_table_from_coll($coll_id); $dossier = getDossier($values_form); $dossier = getPaths($dossier, $res_id); concat_files($dossier,$res_id); return array( 'result' => $res_id.'#', 'history_msg' => '', 'page_result' => $_SESSION['config']['businessappurl'] . 'index.php?page=view_parapheur_controller&module=visa' . '&res_id=' . $res_id ); }