*/ require_once("fpdi.php"); require_once("class_functions.php"); class print_list extends FPDI { /** * Show the document list in result of the search * * @param string $SQL request * @param array $colomn to show */ public function print_result_list($request, $to_show, $size, $limit, $title) { $size = array_values($size); $limit = array_values($limit); $total_width = array_sum($size); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } $func = new functions(); $db = new dbquery(); $db -> connect(); $db->query($request); $total_result = $db->nb_result(); while($values[] = $db->fetch_array()); $nb_page = ceil($total_result/40); $pdf= new fpdi();//create a new document PDF $start = 0; $pdf->DisplayPreferences('HideMenubar,HideToolbar,HideWindowUI'); for ($p = 0; $p < $nb_page ; $p++) { $values_by_pages = array(); for($input=$start; $input<($start + 40); $input++) { array_push($values_by_pages, $values[$input]); } $start = $start + 40; $pdf->addPage(); //Add a blank page //Restauration des couleurs et de la police $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont('Arial','B',10); $pdf->multicell($total_width,5,utf8_decode(html_entity_decode($title,ENT_COMPAT,'UTF-8')),1,1,'C'); $pdf->multicell($total_width,5,utf8_decode(html_entity_decode($total_result." "._DOCUMENTS." - "._PRINTED_BY." ".$_SESSION['user']['FirstName']." ".$_SESSION['user']['LastName']." (".$func->show($_SESSION['user']['department_label']).")",ENT_COMPAT,'UTF-8')),1,1, 'C'); $pdf->SetFont('Arial','B',8); //Couleurs, épaisseur du trait et police grasse $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); //En-tête for($i=0;$iCell($size[$i],7,utf8_decode(html_entity_decode($to_show[$i],ENT_COMPAT,'UTF-8')),1,0,'C',1); } $pdf->Ln(); //Restauration des couleurs et de la police $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); //Données $fill=false; foreach($values_by_pages as $row) { for($row_i = 0; $row_i Cell($size[$row_i],6,utf8_decode(html_entity_decode($func->cut_string($func->show($row[$row_i]),$limit[$row_i]),ENT_COMPAT,'UTF-8')),'LR',0,'L',$fill); } $pdf->Ln(); $fill=!$fill; } $pdf->Cell($total_width,0,'','T'); $pdf->Ln(); $pdf->multicell($total_width,5,_PAGE." ".($p+1)."/".$nb_page,1,1, 'C'); } $pdf->AutoPrint(true); $pdf->Output($_SESSION['config']['tmpdir']."/tmp_print".$_SESSION['user']['UserId'].".PDF"); } /** * Show the document list in result of the search * * @param string $SQL request * @param array $colomn to show */ public function print_detail($id) { if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } $func = new functions(); $connexion = new dbquery(); $connexion -> connect(); $connexion2 = new dbquery(); $connexion2 -> connect(); $connexion->query("SELECT * FROM ".$_SESSION['ressources'][0]['tablename']." WHERE RES_ID = ".$id); //$db->show(); $details = $connexion->fetch_object(); $title = stripslashes($details->TITLE); $description = stripslashes($details->DESCRIPTION); $format = $details->FORMAT; $filesize = $details->FILESIZE; $creation_date = $details->CREATION_DATE; $doc_date = $details->DOC_DATE; $fingerprint = $details->FINGERPRINT; $ref = $details->IDENTIFIER; $type = $details->TYPE_ID; $status= $details-> STATUS; $datearrivee= $details -> CUSTOM_D1; $validation_date= $details -> VALIDATION_DATE; $datelimitetraitement=$details -> CUSTOM_D2; $author = stripslashes($details->AUTHOR); $author_name = $details->AUTHOR_NAME; $dest_user = $details->DEST_USER; $destination = $details->DESTINATION; $nature_envoi = $details -> CUSTOM_T2; $courrier = $details -> CUSTOM_T5; $direct = $details -> CUSTOM_T6; $mail = $details -> CUSTOM_T7; $courrierAR = $details -> CUSTOM_T15; $fax = $details -> CUSTOM_T16; $norep = $details -> CUSTOM_T17; $autre = $details -> CUSTOM_T8; $date_traitement = $details->CUSTOM_D3; $notes = $details->CUSTOM_T1; $typist = $details->TYPIST; $is_ingoing = $details->IS_INGOING; $priority = $details->PRIORITY; $societe = $details->SOCIETE; $out = false; if($is_ingoing == 'N' || $status == 'OUT') { $out = true; $connexion->query('select LASTNAME, FIRSTNAME from '.$_SESSION['tablename']['users'].' where USER_ID = "'.$author.'"'); if ($connexion->nb_result()>0) { $res = $connexion->fetch_object(); $author = $res->FIRSTNAME.' '.$res->LASTNAME; } } $connexion->query("select LASTNAME, FIRSTNAME, STATUS, ENABLED from ".$_SESSION['tablename']['users']." where USER_ID = '".$typist."'"); $res = $connexion->fetch_object(); $typist = $res->FIRSTNAME.' '.$res->LASTNAME; $connexion->query("select date(CREATION_DATE) as CREATION_DATE, RES_ID, TITLE FROM res_x WHERE STATUS='REP' AND RELATION=".$id." order by CREATION_DATE desc"); $rep = array(); while($line = $connexion->fetch_object()) { array_push($rep, array("ID" => $line->RES_ID, "DATE" => $connexion->inverse_date($line->CREATION_DATE), 'TITLE' => $line->TITLE)); } if(!empty($type)) { $connexion->query("select DESCRIPTION, RES_TABLE from ".$_SESSION['tablename']['doctypes']." where TYPE_ID = '".$type."'"); $line_sql = $connexion->fetch_object(); $type = $line_sql->DESCRIPTION; $tmp = $line_sql->RES_TABLE; for($i=0; $i < count($_SESSION['ressources']); $i++) { if($_SESSION['ressources'][$i]['tablename'] == $tmp) { $table = $_SESSION['ressources'][$i]['comment']; break; } } } $connexion->query("select SERVICE FROM ".$_SESSION['tablename']['services']." WHERE ID ='".$destination."' "); $res = $connexion->fetch_object(); $service = $res->SERVICE; $copies = array(); $connexion->query("select u.USER_ID as ID, u.FIRSTNAME as FIRST_NAME, u.LASTNAME as LAST_NAME from ".$_SESSION['tablename']['listinstance']." l, ".$_SESSION['tablename']['users']." u where l.RES_TABLE = 'res_x' and l.RES_ID = ".$id." and l.SEQUENCE > 1 and u.USER_ID = l.USER_ID"); while ($res = $connexion->fetch_object()) { array_push($copies, array( 'ID' => $res->ID, 'FIRST_NAME' => $res->FIRST_NAME, 'LAST_NAME'=> $res->LAST_NAME)); } $dest = ""; $connexion->query("select FIRSTNAME, LASTNAME from ".$_SESSION['tablename']['users']." where USER_ID = '".$dest_user."'"); $res = $connexion->fetch_object(); $dest = $res->FIRSTNAME." ".$res->LASTNAME; $pdf= new fpdi();//create a new document PDF $start = 0; $pdf->DisplayPreferences('HideMenubar,HideToolbar,HideWindowUI'); $pdf->addPage(); //Add a blank page $pdf->SetFont('Arial','B',15); //$pdf->multicell(180,5,$title." (".$total_result." "._DOCUMENTS.")",1,1, 'C'); $pdf->Cell(190,5,html_entity_decode(_DETAILS." : "._AFFAIRE." ".$id),0,1, 'C'); $pdf->SetFont('','B',10); $pdf->multicell(190,5,_LETTER_INFO,0,1, 'C'); $pdf->SetFont('','',10); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); //$societe = "123457890123456789012345678901234"; if($_SESSION['config']['corporate'] == "true") { $pdf->Cell(40,6,html_entity_decode(_SOCIETY." : "),'LTB',0,'L',1); $pdf->Cell(150,6,html_entity_decode(utf8_decode($func->cut_string($func->show($societe),75))),'RTB',0,'L',1); $pdf->Ln(); } $pdf->Cell(40,6,html_entity_decode(_SHIPPER." : "),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($author),30))),'RTB',0,'L',0); $pdf->Cell(40,6,html_entity_decode(_MAIL_STATE." : "),'LTB',0,'L',0); if ($status=="NEW") { $status_label =html_entity_decode(_TO_PROCESS);} elseif ($status=="COU") { $status_label = html_entity_decode(_IN_PROGRESS);} elseif ($status=="END") { $status_label = html_entity_decode(_CLOSED);}elseif($status == 'OUT'){$status_label = html_entity_decode(_ONGOING);}elseif($status == "VAL"){ $status_label = html_entity_decode(_VAL_STATUS);}elseif($status == 'DEL'){$status_label = html_entity_decode(_DELETED_DOC); } $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($status_label),30))),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($type),30))),'RTB',0,'L',1); $pdf->Cell(40,6,html_entity_decode(_INVOICE_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($nature_envoi),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_OBJECT." : "),'LTB',0,'L',0); $pdf->Cell(150,6,html_entity_decode(utf8_decode($func->cut_string($func->show($description),75))),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_DOC_DATE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($doc_date)),30))),'RTB',0,'L',1); if ($out) { $pdf->Cell(40,6,html_entity_decode(_SHIPPING_DATE." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($creation_date); } else { $pdf->Cell(40,6,html_entity_decode(_DATE_START." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($datearrivee); } $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($tmp_date_pdf),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_DL_DATE." : "),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($creation_date)),30))),'RTB',0,'L',0); if(!$out) { if ($status=="COU" || $status=="NEW") { $pdf->Cell(40,6,html_entity_decode($func->cut_string(_LIMIT_DATE_PROCESS,25)." : "),'LTB',0,'L'); } else { $pdf->Cell(40,6,html_entity_decode(_PROCESS_DATE." : "),'LTB',0,'L'); } if ($status=="COU" || $status=="NEW" || $status == "VAL") { if($datelimitetraitement <> NULL){$disp_datelimitetraitement = $func->dateformat($datelimitetraitement);}else{$disp_datelimitetraitement = _UNDEFINED;} $pdf->Cell(55,6,utf8_decode($func->cut_string($func->show($disp_datelimitetraitement),30)),'RTB',0,'L'); } else { if($date_traitement <> NULL){$disp_datetraitement = $func->dateformat($date_traitement);}else{$disp_datetraitement = _UNDEFINED;} $pdf->Cell(55,6,utf8_decode($func->cut_string($func->show($disp_datetraitement),30)),'RTB',0,'L'); } $pdf->Ln(); } $pdf->Cell(40,6,html_entity_decode(_DEPARTMENT." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($service),30))),'RTB',0,'L',1); if(!$out ) { $priority_label = $_SESSION['priority'][$priority]['label']; $pdf->Cell(40,6,html_entity_decode(_PRIORITY." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($priority_label),30))),'RTB',0,'L',1); } $pdf->Ln(); //Define Sequence List $fields = " USER_ID, SEQUENCE "; $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_PRINCIPAL_RECIPIENT),0,1, 'C');$pdf->SetFont('','',10); $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_LASTNAME)),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_FIRSTNAME)),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_DEPARTMENT)),1,0,'C',1); $pdf->Ln(); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); //Données $fill=false; $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][0]['LastName']),30))),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][0]['FirstName']),30))),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][0]['Service']),30))),1,0,'C',1); $pdf->Ln(); if (count($_SESSION['diff']) > 1) { $pdf->SetFont('','B',10);$pdf->multicell(190,5,_TO_CC,0,1, 'C');$pdf->SetFont('','',10); $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_LASTNAME)),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_FIRSTNAME)),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_DEPARTMENT)),1,0,'C',1); $pdf->Ln(); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); for($i=1;$iCell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][$i]['LastName']),30))),1,0,'C',$fill); $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][$i]['FirstName']),30))),1,0,'C',$fill); $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($_SESSION['diff'][$i]['Service']),30))),1,0,'C',$fill); $pdf->Ln(); $fill=!$fill; } } $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_DOC_HISTORY),0,1, 'C');$pdf->SetFont('','',10); $connexion->query("select INFO, EVENT_DATE, USER_ID from ".$_SESSION['tablename']['history']." WHERE TABLE_NAME= '".$_SESSION['ressources'][0]['tablename']."' AND RECORD_ID= ".$id." ORDER BY EVENT_DATE desc"); $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_DATE)),1,0,'C',1); $pdf->Cell(50,7,html_entity_decode(utf8_decode(_USER)),1,0,'C',1); $pdf->Cell(90,7,html_entity_decode(utf8_decode(_DONE)),1,0,'C',1); $pdf->Ln(); $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_TO_CC),0,1, 'C');$pdf->SetFont('','',10); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); while ($res = $connexion->fetch_object()) { $connexion2->query("select LASTNAME, FIRSTNAME from ".$_SESSION['tablename']['users']." where USER_ID = '".$res->USER_ID."'"); $res2 = $connexion2->fetch_object(); $nom = $res2->LASTNAME; $prenom = $res2->FIRSTNAME; $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($res->EVENT_DATE)),30))),1,0,'L',$fill); $pdf->Cell(50,7,html_entity_decode(utf8_decode($func->cut_string($func->show( $prenom." ".$nom),30))),1,0,'L',$fill); $pdf->Cell(90,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->INFO),50))),1,0,'L',$fill); $pdf->Ln(); $fill=!$fill; } $connexion->query("select r.RES_ID,r.TITLE,r.DESCRIPTION,date(r.CREATION_DATE) as DATE,r.FORMAT,r.AUTHOR,r.DEST_USER,r.STATUS, r.TYPE_ID,r.DESTINATION, r.PRIORITY, r.DOC_DATE, SOCIETE from res_x r where (r.IS_FOLDER = 'Y' and r.RES_ID = ".$id." ) OR ( r.IS_FOLDER = 'N' and r.FOLDER_ID = ".$id.") and r.STATUS <> 'DEL' and r.STATUS <> 'REP' order by CREATION_DATE"); if ($connexion->nb_result() > 0) { $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_IN_THIS_AFF),0,1, 'C');$pdf->SetFont('','',10); $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(30,7,html_entity_decode(utf8_decode(_PRIORITY)),1,0,'C',1); $pdf->Cell(30,7,html_entity_decode(utf8_decode(_DATE_START)),1,0,'C',1); $pdf->Cell(20,7,html_entity_decode(utf8_decode(_GED_NUM)),1,0,'C',1); $pdf->Cell(30,7,html_entity_decode(utf8_decode(_SHIPPER)),1,0,'C',1); $pdf->Cell(40,7,html_entity_decode(utf8_decode(_OBJECT)),1,0,'C',1); if($_SESSION['config']['corporate'] == "true" && $_SESSION['config']['replace_subject_by_society'] == "true") { $pdf->Cell(40,7,html_entity_decode(utf8_decode(_SOCIETY)),1,0,'C',1); } else { $pdf->Cell(40,7,'',1,0,'C',1); } $pdf->Ln(); } $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); while($res = $connexion->fetch_object()) { $pdf->Cell(30,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->PRIORITY),10))),1,0,'L',$fill); $pdf->Cell(30,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->DATE),15))),1,0,'L',$fill); $pdf->Cell(20,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->RES_ID),5))),1,0,'L',$fill); $pdf->Cell(30,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->AUTHOR),15))),1,0,'L',$fill); $pdf->Cell(40,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->DESCRIPTION),20))),1,0,'L',$fill); if($_SESSION['config']['corporate'] == "true" && $_SESSION['config']['replace_subject_by_society'] == "true") { $pdf->Cell(40,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->SOCIETE),20))),1,0,'L',$fill); } else { $pdf->Cell(40,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->SOCIETE),20))),1,0,'L',$fill); } $fill=!$fill; $pdf->Ln(); } //$connexion->query("select i.ID, i.INFO, i.DATE, i.USER_ID, u.LASTNAME, u.FIRSTNAME from ".$_SESSION['tablename']['notes']." i inner join ".$_SESSION['tablename']['users']." u on i.USER_ID = u.USER_ID WHERE RECORD_ID= ".$id." ORDER BY DATE desc"); $connexion->query("select i.ID, i.INFO, i.DATE, i.USER_ID, u.LASTNAME, u.FIRSTNAME from ".$_SESSION['tablename']['notes']." i inner join ".$_SESSION['tablename']['users']." u on i.USER_ID = u.USER_ID WHERE RECORD_ID = ".$id." AND ((i.ACCESS_SERVICES = 'all' AND i.ACCESS_USERS = 'all') OR (i.ACCESS_USERS = 'not' AND i.ACCESS_SERVICES LIKE '%".$_SESSION['user']['department']."%') OR (i.ACCESS_SERVICES = 'not' AND i.ACCESS_USERS LIKE '%".$_SESSION['user']['UserId']."%')) ORDER BY DATE desc"); if($connexion->nb_result() > 0) { $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_NOTES),0,1, 'C');$pdf->SetFont('','',10); $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(30,7,html_entity_decode(utf8_decode(_DATE)),1,0,'C',1); $pdf->Cell(30,7,html_entity_decode(utf8_decode(_USER)),1,0,'C',1); $pdf->Cell(130,7,html_entity_decode(utf8_decode(_NOTES)),1,0,'C',1); $pdf->Ln(); } $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); while($res = $connexion->fetch_object()) { $pdf->Cell(30,7,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($res->DATE)),15))),1,0,'L',$fill); $pdf->Cell(30,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->FIRSTNAME." ".$res->LASTNAME),20))),1,0,'L',$fill); $pdf->Cell(130,7,html_entity_decode(utf8_decode($func->cut_string($func->show($res->INFO),70))),1,0,'L',$fill); $fill=!$fill; $pdf->Ln(); } $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_MAIL_PROCESS_DONE),0,1, 'C');$pdf->SetFont('','',10); $types_rep = ""; if($courrier <> false && $courrier <>'false') { $types_rep .= _MAIL2.', '; } if($courrierAR <> false && $courrierAR <>'false') { $types_rep .= _AR_MAIL.', '; } if($direct <> false && $direct <>'false') { $types_rep .= _DIRECT_CONTACT.', '; } if($mail <> false && $mail <> 'false') { $types_rep .= _MAIL.', '; } if($fax <> false && $fax <>'false') { $types_rep .= _FAX.', '; } if($noresp <> false && $norep <>'false') { $types_rep .= _NO_ANSWER_NECESSARY.', '; } if($autre <> false && $autre <>'false') { $types_rep .= " ".$autre."".', '; } $types_rep = ereg_replace(', $', '', $types_rep); if ($types_rep <> '') { $pdf->multicell(190,5,html_entity_decode(_ANSWER_TYPES_DONE." : ".$types_rep),0,1, 'C'); } if(count($rep) > 0) { $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); $pdf->multicell(190,5,html_entity_decode(_ANSWER_JOINED." : ".$types_rep),0,1, 'C'); for($i=0; $i < count($rep); $i++) { $pdf->Cell(190,7,html_entity_decode(utf8_decode($func->cut_string($func->show($rep[$i]['DATE'].' : '.$rep[$i]['TITLE']),80))),1,0,'C',$fill); $fill=!$fill; $pdf->Ln(); } } $pdf->SetFont('','B',10);$pdf->multicell(190,5,html_entity_decode(_FILE_PROPERTIES),0,1, 'C');$pdf->SetFont('','',10); $pdf->Cell(40,6,html_entity_decode(_CREATOR),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($typist),30))),'RTB',0,'L',1); $pdf->Cell(40,6,html_entity_decode($func->cut_string(_REGISTERED_IN_BASE_THE,32).":"),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($creation_date)),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_FORMAT),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($format),30))),'RTB',0,'L',0); $pdf->Cell(40,6,html_entity_decode(_SIZE),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($filesize." "._BYTES." ( ".round($filesize/1024,2)."K )"),30))),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_MAIL_IDENTIFIER),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($ref),30))),'RTB',0,'L',1); $pdf->Cell(40,6,html_entity_decode(_N_GED),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($id),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->AutoPrint(true); $pdf->Output($_SESSION['config']['tmpdir'].DIRECTORY_SEPARATOR."tmp_print".$_SESSION['user']['UserId'].".PDF"); } /*****************************************************************************************************************************/ /** * Show the document list in result of the search * * @param string $SQL request * @param array $colomn to show */ public function print_notes($id) { if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } $func = new functions(); $connexion = new dbquery(); $connexion -> connect(); $connexion2 = new dbquery(); $connexion2 -> connect(); $connexion->query("SELECT * FROM ".$_SESSION['ressources'][0]['tablename']." WHERE RES_ID = ".$id); //$db->show(); $details = $connexion->fetch_object(); $title = stripslashes($details->TITLE); $description = stripslashes($details->DESCRIPTION); $format = $details->FORMAT; $filesize = $details->FILESIZE; $creation_date = $details->CREATION_DATE; $doc_date = $details->DOC_DATE; $fingerprint = $details->FINGERPRINT; $ref = $details->IDENTIFIER; $type = $details->TYPE_ID; $status= $details-> STATUS; $datearrivee= $details -> CUSTOM_D1; $validation_date= $details -> VALIDATION_DATE; $datelimitetraitement=$details -> CUSTOM_D2; $author = stripslashes($details->AUTHOR); $author_name = $details->AUTHOR_NAME; $dest_user = $details->DEST_USER; $destination = $details->DESTINATION; $nature_envoi = $details -> CUSTOM_T2; $courrier = $details -> CUSTOM_T5; $direct = $details -> CUSTOM_T6; $mail = $details -> CUSTOM_T7; $courrierAR = $details -> CUSTOM_T15; $fax = $details -> CUSTOM_T16; $norep = $details -> CUSTOM_T17; $autre = $details -> CUSTOM_T8; $date_traitement = $details->CUSTOM_D3; $notes = $details->CUSTOM_T1; $typist = $details->TYPIST; $is_ingoing = $details->IS_INGOING; $priority = $details->PRIORITY; $societe = $details->SOCIETE; //Module GDI => récupération des informations if ($_SESSION['config']['gdi_index'] == "true") { $gdi_num = $details -> GID_ID; } $out = false; if($is_ingoing == 'N' || $status == 'OUT') { $out = true; $connexion->query('select LASTNAME, FIRSTNAME from '.$_SESSION['tablename']['users'].' where USER_ID = "'.$author.'"'); if ($connexion->nb_result()>0) { $res = $connexion->fetch_object(); $author = $res->FIRSTNAME.' '.$res->LASTNAME; } } $connexion->query("select LASTNAME, FIRSTNAME, STATUS, ENABLED from ".$_SESSION['tablename']['users']." where USER_ID = '".$typist."'"); $res = $connexion->fetch_object(); $typist = $res->FIRSTNAME.' '.$res->LASTNAME; $connexion->query("select date(CREATION_DATE) as CREATION_DATE, RES_ID, TITLE FROM res_x WHERE STATUS='REP' AND RELATION=".$id." order by CREATION_DATE desc"); $rep = array(); while($line = $connexion->fetch_object()) { array_push($rep, array("ID" => $line->RES_ID, "DATE" => $connexion->inverse_date($line->CREATION_DATE), 'TITLE' => $line->TITLE)); } if(!empty($type)) { $connexion->query("select DESCRIPTION, RES_TABLE from ".$_SESSION['tablename']['doctypes']." where TYPE_ID = '".$type."'"); $line_sql = $connexion->fetch_object(); $type = $line_sql->DESCRIPTION; $tmp = $line_sql->RES_TABLE; for($i=0; $i < count($_SESSION['ressources']); $i++) { if($_SESSION['ressources'][$i]['tablename'] == $tmp) { $table = $_SESSION['ressources'][$i]['comment']; break; } } } $connexion->query("select SERVICE FROM ".$_SESSION['tablename']['services']." WHERE ID ='".$destination."' "); $res = $connexion->fetch_object(); $service = $res->SERVICE; $copies = array(); $connexion->query("select u.USER_ID as ID, u.FIRSTNAME as FIRST_NAME, u.LASTNAME as LAST_NAME from ".$_SESSION['tablename']['listinstance']." l, ".$_SESSION['tablename']['users']." u where l.RES_TABLE = 'res_x' and l.RES_ID = ".$id." and l.SEQUENCE > 1 and u.USER_ID = l.USER_ID"); while ($res = $connexion->fetch_object()) { array_push($copies, array( 'ID' => $res->ID, 'FIRST_NAME' => $res->FIRST_NAME, 'LAST_NAME'=> $res->LAST_NAME)); } $dest = ""; $connexion->query("select FIRSTNAME, LASTNAME from ".$_SESSION['tablename']['users']." where USER_ID = '".$dest_user."'"); $res = $connexion->fetch_object(); $dest = $res->FIRSTNAME." ".$res->LASTNAME; $pdf= new fpdi();//create a new document PDF $start = 0; $pdf->DisplayPreferences('HideMenubar,HideToolbar,HideWindowUI'); $pdf->addPage(); //Add a blank page $pdf->SetFont('Arial','B',15); $pdf->Cell(190,5,html_entity_decode(_NOTES." : "._AFFAIRE." ".$id),0,1, 'C'); $pdf->SetFont('','B',10); $pdf->multicell(190,5,_LETTER_INFO,0,1, 'C'); $pdf->SetFont('','',10); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); if($_SESSION['config']['corporate'] == "true") { $pdf->Cell(40,6,html_entity_decode(_SOCIETY." : "),'LTB',0,'L',1); $pdf->Cell(150,6,html_entity_decode(utf8_decode($func->cut_string($func->show($societe),75))),'RTB',0,'L',1); $pdf->Ln(); } $pdf->Cell(40,6,html_entity_decode(_SHIPPER." : "),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($author),30))),'RTB',0,'L',0); $pdf->Cell(40,6,html_entity_decode(_MAIL_STATE." : "),'LTB',0,'L',0); if ($status=="NEW") { $status_label =html_entity_decode(_TO_PROCESS);} elseif ($status=="COU") { $status_label = html_entity_decode(_IN_PROGRESS);} elseif ($status=="END") { $status_label = html_entity_decode(_CLOSED);}elseif($status == 'OUT'){$status_label = html_entity_decode(_ONGOING);}elseif($status == "VAL"){ $status_label = html_entity_decode(_VAL_STATUS);}elseif($status == 'DEL'){$status_label = html_entity_decode(_DELETED_DOC); } $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($status_label),30))),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($type),30))),'RTB',0,'L',1); $pdf->Cell(40,6,html_entity_decode(_INVOICE_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($nature_envoi),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_OBJECT." : "),'LTB',0,'L',0); $pdf->Cell(150,6,html_entity_decode(utf8_decode($func->cut_string($func->show($description),75))),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_DOC_DATE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($doc_date)),30))),'RTB',0,'L',1); if ($out) { $pdf->Cell(40,6,html_entity_decode(_SHIPPING_DATE." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($creation_date); } else { $pdf->Cell(40,6,html_entity_decode(_DATE_START." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($datearrivee); } $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($tmp_date_pdf),30))),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,html_entity_decode(_DL_DATE." : "),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($func->dateformat($creation_date)),30))),'RTB',0,'L',0); if(!$out) { if ($status=="COU" || $status=="NEW") { $pdf->Cell(40,6,html_entity_decode($func->cut_string(_LIMIT_DATE_PROCESS,25)." : "),'LTB',0,'L'); } else { $pdf->Cell(40,6,html_entity_decode(_PROCESS_DATE." : "),'LTB',0,'L'); } if ($status=="COU" || $status=="NEW" || $status == "VAL") { if($datelimitetraitement <> NULL){$disp_datelimitetraitement = $func->dateformat($datelimitetraitement);}else{$disp_datelimitetraitement = _UNDEFINED;} $pdf->Cell(55,6,utf8_decode($func->cut_string($func->show($disp_datelimitetraitement),30)),'RTB',0,'L'); } else { if($date_traitement <> NULL){$disp_datetraitement = $func->dateformat($date_traitement);}else{$disp_datetraitement = _UNDEFINED;} $pdf->Cell(55,6,utf8_decode($func->cut_string($func->show($disp_datetraitement),30)),'RTB',0,'L'); } $pdf->Ln(); } $pdf->Cell(40,6,html_entity_decode(_DEPARTMENT." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($service),30))),'RTB',0,'L',1); if(!$out ) { $priority_label = $_SESSION['priority'][$priority]['label']; $pdf->Cell(40,6,html_entity_decode(_PRIORITY." : "),'LTB',0,'L',1); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($priority_label),30))),'RTB',0,'L',1); } $pdf->Ln(); if ($_SESSION['config']['gdi_index'] == "true") { $pdf->Cell(40,6,html_entity_decode(_GID_ID." : "),'LTB',0,'L',0); $pdf->Cell(55,6,html_entity_decode(utf8_decode($func->cut_string($func->show($gdi_num),30))),'RTB',0,'L',0); $pdf->Ln(); } $pdf->Ln(); /*$connexion->query("select i.ID, i.INFO, i.DATE, i.USER_ID, u.LASTNAME, u.FIRSTNAME from ".$_SESSION['tablename']['notes']." i inner join ".$_SESSION['tablename']['users']." u on i.USER_ID = u.USER_ID WHERE RECORD_ID= ".$id." ORDER BY DATE desc");*/ $connexion->query("select i.ID, i.INFO, i.DATE, i.USER_ID, u.LASTNAME, u.FIRSTNAME from ".$_SESSION['tablename']['notes']." i inner join ".$_SESSION['tablename']['users']." u on i.USER_ID = u.USER_ID WHERE RECORD_ID = ".$id." AND ((i.ACCESS_SERVICES = 'all' AND i.ACCESS_USERS = 'all') OR (i.ACCESS_USERS = 'not' AND i.ACCESS_SERVICES LIKE '%".$_SESSION['user']['department']."%') OR (i.ACCESS_SERVICES = 'not' AND i.ACCESS_USERS LIKE '%".$_SESSION['user']['UserId']."%')) ORDER BY DATE desc"); if($connexion->nb_result() > 0) { $pdf->SetFillColor(10,0,255); $pdf->SetTextColor(255); $pdf->SetDrawColor(128,0,0); $pdf->SetLineWidth(.3); $pdf->Cell(190,7,html_entity_decode(utf8_decode(_NOTES)),1,0,'C',1); $pdf->Ln(); } $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); while($res = $connexion->fetch_object()) { $pdf->Cell(15,7,html_entity_decode(_DATE." : "),'1',0,'J',0); $pdf->Cell(47,7,html_entity_decode($func->dateformat($res->DATE)),'1',0,'J',0); $pdf->Cell(25,7,html_entity_decode(_USER." : "),'1',0,'J',0); $pdf->Cell(103,7,html_entity_decode(utf8_decode($func->show($res->FIRSTNAME." ".$res->LASTNAME))),'1',0,'J',0); $pdf->Ln(); $pdf->MultiCell(190,7,html_entity_decode(utf8_decode($func->show($res->INFO))),1,1,'J',0); $fill=!$fill; $pdf->Ln(); } $pdf->AutoPrint(true); $pdf->Output($_SESSION['config']['tmpdir'].DIRECTORY_SEPARATOR."tmp_print".$_SESSION['user']['UserId'].".PDF"); } } ?>