*/ 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,$func->decode_entities($title),1,1,'C'); $pdf->multicell($total_width,5,$func->decode_entities($total_result." "._DOCUMENTS." - "._PRINTED_BY." ".$_SESSION['user']['FirstName']." ".$_SESSION['user']['LastName']." (".$func->show($_SESSION['user']['department_label']).")"),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,$func->decode_entities($to_show[$i]),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,$func->decode_entities($func->cut_string($func->show($row[$row_i]),$limit[$row_i])),'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_dynamique_array($request, $size, $title, $Vli_id_dynamic_array) { $size = array_values($size); $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(); ########################################################## ### Compte le nbre de champs du tableau dynamique ########################################################## $db->query(" SELECT count(*) FROM gtb_tableau_champs WHERE gtc_fkid_gtb_tableau = $Vli_id_dynamic_array ") ; $var_nbre_champs_dynamic_array = $db->fetch_array(); $Vli_nbre_champs = $var_nbre_champs_dynamic_array[0]; ########################################################## ### recherche de tous les champs du tableau dynamique ########################################################## $db->query(" SELECT gtc_nom_champs_requete, gtc_nom_entete, gtc_format, gtc_alignement, gtc_position, gtc_taille_px, gtc_tri_dessus, gtc_hidden, gtc_limit_impression, gtc_hidden_print, gtc_taille_mm FROM gtb_tableau_champs WHERE gtc_fkid_gtb_tableau = $Vli_id_dynamic_array ORDER BY gtc_position "); $Vlt_champs_dynamic_array = array(); $cpt=0; while($var_champs_dynamic_array = $db->fetch_array()) { $Vlt_champs_dynamic_array[$cpt]["nom_champs_requete"] = $var_champs_dynamic_array[0]; $Vlt_champs_dynamic_array[$cpt]["nom_entete"] = $var_champs_dynamic_array[1]; $Vlt_champs_dynamic_array[$cpt]["format"] = $var_champs_dynamic_array[2]; $Vlt_champs_dynamic_array[$cpt]["aligement"] = $var_champs_dynamic_array[3]; $Vlt_champs_dynamic_array[$cpt]["position"] = $var_champs_dynamic_array[4]; $Vlt_champs_dynamic_array[$cpt]["taille_px"] = $var_champs_dynamic_array[5]; $Vlt_champs_dynamic_array[$cpt]["tri_dessus"] = $var_champs_dynamic_array[6]; $Vlt_champs_dynamic_array[$cpt]["hidden"] = $var_champs_dynamic_array[7]; $Vlt_champs_dynamic_array[$cpt]["limit_impression"] = $var_champs_dynamic_array[8]; $Vlt_champs_dynamic_array[$cpt]["hidden_print"] = $var_champs_dynamic_array[9]; $Vlt_champs_dynamic_array[$cpt]["taille_mm"] = $var_champs_dynamic_array[10]; $cpt++; } ########################################################## $db->query($request); $total_result = $db->nb_result(); while($values[] = $db->fetch_assoc()); //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,$func->decode_entities($title),1,1,'C'); $pdf->multicell($total_width,5,$func->decode_entities($total_result." "._DOCUMENTS." - "._PRINTED_BY." ".$_SESSION['user']['FirstName']." ".$_SESSION['user']['LastName']." (".$func->show($_SESSION['user']['department_label']).")"),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;$i<=$Vli_nbre_champs;$i++) { if($Vlt_champs_dynamic_array[$i]["hidden_print"]=="N") { $pdf->Cell($Vlt_champs_dynamic_array[$i]["taille_mm"],7,$func->decode_entities($Vlt_champs_dynamic_array[$i]["nom_entete"]),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 <=$Vli_nbre_champs; $row_i++) { if($Vlt_champs_dynamic_array[$row_i]["hidden_print"]=="N") { ################################################################################## ### Formatage de la valeur si besoin est ! ################################################################################## if($Vlt_champs_dynamic_array[$row_i]["format"]!="") { $Vlt_liste_variable_format[0] = $row[$Vlt_champs_dynamic_array[$row_i]["nom_champs_requete"]]; $Vlt_info_format = explode("|", $Vlt_champs_dynamic_array[$row_i]["format"]); $Vli_nbre_info_format = count($Vlt_info_format); for($k=1;$k<$Vli_nbre_info_format;$k++) { $Vli_num_variable = $Vlt_info_format[$k]-1; //$Vlt_liste_variable_format[$k] = $Vlt_liste_resulat_ligne[$Vli_num_variable]; $Vlt_liste_variable_format[$k] = $row[$Vlt_champs_dynamic_array[$Vli_num_variable]["nom_champs_requete"]]; } ############################################ $Vls_nom_format = $Vlt_info_format[0]; $Vls_nom_format_print = $Vlt_info_format[0]."_print"; if(existe_format_print($Vls_nom_format_print)) { $Vls_valeur_tableau = recherche_fonction_format_print($Vls_nom_format_print, $Vlt_liste_variable_format); } else { $Vls_valeur_tableau = recherche_fonction_format($Vls_nom_format, $Vlt_liste_variable_format); } } else { $Vls_valeur_tableau = $row[$Vlt_champs_dynamic_array[$row_i]["nom_champs_requete"]]; } ################################################################################## $Vli_limit_print = $Vlt_champs_dynamic_array[$row_i]["limit_impression"]; if($Vli_limit_print=="") { $Vli_limit_print = 1000; } ################################################################################## switch($Vlt_champs_dynamic_array[$row_i]["aligement"]) { case "center": $Vls_alignement_cellule = "C"; break; case "left": $Vls_alignement_cellule = "L"; break; case "right": $Vls_alignement_cellule = "R"; break; } ################################################################################## $pdf->Cell($Vlt_champs_dynamic_array[$row_i]["taille_mm"],6,$func->decode_entities($func->cut_string($func->show($Vls_valeur_tableau),$Vli_limit_print)),'LR',0,$Vls_alignement_cellule,$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->Cell(190,5,$func->decode_entities(_DETAILS." : "._AFFAIRE." ".$id),0,1,'C'); $pdf->Ln(); $pdf->SetFont('','B',10); $pdf->multicell(190,5,$func->decode_entities(_LETTER_INFO),0,'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,$func->decode_entities(_SOCIETY." : "),'LTB',0,'L',1); $pdf->Cell(150,6,$func->decode_entities($func->cut_string($func->show($societe),75)),'RTB',0,'L',1); $pdf->Ln(); } $pdf->Cell(40,6,$func->decode_entities(_SHIPPER." : "),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($author),30)),'RTB',0,'L',0); $pdf->Cell(40,6,$func->decode_entities(_MAIL_STATE),'LTB',0,'L',0); if ($status=="NEW") { $status_label = $func->decode_entities(_TO_PROCESS); } else if ($status=="COU") { $status_label = $func->decode_entities(_IN_PROGRESS); } else if ($status=="END") { $status_label = $func->decode_entities(_CLOSED); } else if($status == 'OUT') { $status_label = $func->decode_entities(_ONGOING); } else if($status == "VAL") { $status_label = $func->decode_entities(_VAL_STATUS); } else if($status == 'DEL') { $status_label = $func->decode_entities(_DELETED_DOC); } $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($status_label),30)),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($type),30)),'RTB',0,'L',1); $pdf->Cell(40,6,$func->decode_entities(_INVOICE_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($nature_envoi),30)),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_OBJECT." : "),'LTB',0,'L',0); $pdf->Cell(150,6,$func->decode_entities($func->cut_string($func->show($description),75)),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_DOC_DATE),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($func->dateformat($doc_date)),30)),'RTB',0,'L',1); if ($out) { $pdf->Cell(40,6,$func->decode_entities(_SHIPPING_DATE." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($creation_date); } else { $pdf->Cell(40,6,$func->decode_entities(_DATE_START." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($datearrivee); } $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($tmp_date_pdf),30)),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_DL_DATE." : "),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($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,$func->cut_string($func->decode_entities(_LIMIT_DATE_PROCESS),25)." : ",'LTB',0,'L'); } else { $pdf->Cell(40,6,$func->decode_entities(_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,$func->decode_entities($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,$func->decode_entities($func->cut_string($func->show($disp_datetraitement),30),'RTB',0,'L')); } $pdf->Ln(); } $pdf->Cell(40,6,$func->decode_entities(_DEPARTMENT." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($service),30)),'RTB',0,'L',1); if(!$out ) { $priority_label = $_SESSION['priority'][$priority]['label']; $pdf->Cell(40,6,$func->decode_entities(_PRIORITY." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($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,$func->decode_entities(_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,$func->decode_entities(_LASTNAME),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities(_FIRSTNAME),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities(_DEPARTMENT),1,0,'C',1); $pdf->Ln(); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); //Données $fill=false; $diffusion = $_SESSION["diffusion"]->get_diffusion(); $prim_diffusion = array_slice($diffusion,0,1); if( isset($prim_diffusion[key($prim_diffusion)]["USER"]) ) { $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($prim_diffusion[key($prim_diffusion)]["USER"]["LASTNAME"]),30)),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($prim_diffusion[key($prim_diffusion)]["USER"]["FIRSTNAME"]),30)),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($prim_diffusion[key($prim_diffusion)]["USER"]["SERVICE"]),30)),1,0,'C',1); $pdf->Ln(); } else { $pdf->Cell(50,7,$func->decode_entities($func->cut_string("",30)),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities($func->cut_string("",30)),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($prim_diffusion[key($prim_diffusion)]["SERVICE"]["SERVICE"]),30)),1,0,'C',1); $pdf->Ln(); } if (count($diffusion) > 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,$func->decode_entities(_LASTNAME),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities(_FIRSTNAME),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities(_DEPARTMENT),1,0,'C',1); $pdf->Ln(); $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); foreach(array_slice($diffusion,1) as $key_diff => $diff) { if( isset($diff["USER"]) ) { $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($diff["USER"]["LASTNAME"]),30)),1,0,'C',$fill); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($diff["USER"]["FIRSTNAME"]),30)),1,0,'C',$fill); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($diff["USER"]["SERVICE"]),30)),1,0,'C',$fill); $pdf->Ln(); $fill=!$fill; } else { $pdf->Cell(50,7,$func->decode_entities($func->cut_string("",30)),1,0,'C',$fill); $pdf->Cell(50,7,$func->decode_entities($func->cut_string("",30)),1,0,'C',$fill); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show($diff["SERVICE"]["SERVICE"]),30)),1,0,'C',$fill); $pdf->Ln(); $fill=!$fill; } } } $pdf->SetFont('','B',10);$pdf->multicell(190,5,$func->decode_entities(_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,$func->decode_entities(_DATE),1,0,'C',1); $pdf->Cell(50,7,$func->decode_entities(_USER),1,0,'C',1); $pdf->Cell(90,7,$func->decode_entities(_DONE),1,0,'C',1); $pdf->Ln(); $pdf->SetFont('','B',10);$pdf->multicell(190,5,$func->decode_entities(_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,$func->decode_entities($func->cut_string($func->show($func->dateformat($res->EVENT_DATE)),30)),1,0,'L',$fill); $pdf->Cell(50,7,$func->decode_entities($func->cut_string($func->show( $prenom." ".$nom),30)),1,0,'L',$fill); $pdf->Cell(90,7,$func->decode_entities($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,$func->decode_entities(_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,$func->decode_entities(_PRIORITY),1,0,'C',1); $pdf->Cell(30,7,$func->decode_entities(_DATE_START),1,0,'C',1); $pdf->Cell(20,7,$func->decode_entities(_GED_NUM),1,0,'C',1); $pdf->Cell(30,7,$func->decode_entities(_SHIPPER),1,0,'C',1); $pdf->Cell(40,7,$func->decode_entities(_OBJECT),1,0,'C',1); if($_SESSION['config']['corporate'] == "true" && $_SESSION['config']['replace_subject_by_society'] == "true") { $pdf->Cell(40,7,$func->decode_entities(_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,$func->decode_entities($func->cut_string($func->show($res->PRIORITY),10)),1,0,'L',$fill); $pdf->Cell(30,7,$func->decode_entities($func->cut_string($func->show($res->DATE),15)),1,0,'L',$fill); $pdf->Cell(20,7,$func->decode_entities($func->cut_string($func->show($res->RES_ID),5)),1,0,'L',$fill); $pdf->Cell(30,7,$func->decode_entities($func->cut_string($func->show($res->AUTHOR),15)),1,0,'L',$fill); $pdf->Cell(40,7,$func->decode_entities($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,$func->decode_entities($func->cut_string($func->show($res->SOCIETE),20)),1,0,'L',$fill); } else { $pdf->Cell(40,7,$func->decode_entities($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,$func->decode_entities(_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,$func->decode_entities(_DATE),1,0,'C',1); $pdf->Cell(30,7,$func->decode_entities(_USER),1,0,'C',1); $pdf->Cell(130,7,$func->decode_entities(_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,$func->decode_entities($func->cut_string($func->show($func->dateformat($res->DATE)),15)),1,0,'L',$fill); $pdf->Cell(30,7,$func->decode_entities($func->cut_string($func->show($res->FIRSTNAME." ".$res->LASTNAME),20)),1,0,'L',$fill); $pdf->Cell(130,7,$func->decode_entities($func->cut_string($func->show($res->INFO),70)),1,0,'L',$fill); $fill=!$fill; $pdf->Ln(); } $pdf->SetFont('','B',10);$pdf->multicell(190,5,$func->decode_entities(_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,$func->decode_entities(_ANSWER_TYPES_DONE." : ".$types_rep),0,1, 'C'); } if( !empty($notes) ) { $pdf->multicell(190,5,$func->decode_entities(_PROCESS_NOTES." : ".$func->show($notes)),0,1, 'C'); } if(count($rep) > 0) { $pdf->SetFillColor(224,235,255); $pdf->SetTextColor(0); $pdf->SetFont(''); $pdf->multicell(190,5,$func->decode_entities(_ANSWER_JOINED." : ".$types_rep),0,1, 'C'); for($i=0; $i < count($rep); $i++) { $pdf->Cell(190,7,$func->decode_entities($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,$func->decode_entities(_FILE_PROPERTIES),0,1, 'C');$pdf->SetFont('','',10); $pdf->Cell(40,6,$func->decode_entities(_CREATOR),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($typist),30)),'RTB',0,'L',1); $pdf->Cell(40,6,$func->decode_entities($func->cut_string(_REGISTERED_IN_BASE_THE,32).":"),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($func->dateformat($creation_date)),30)),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_FORMAT),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($format),30)),'RTB',0,'L',0); $pdf->Cell(40,6,$func->decode_entities(_SIZE),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($filesize." "._BYTES." ( ".round($filesize/1024,2)."K )"),30)),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_MAIL_IDENTIFIER),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($ref),30)),'RTB',0,'L',1); $pdf->Cell(40,6,$func->decode_entities(_N_GED),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($id),30)),'RTB',0,'L',1); $pdf->Ln(); //DEBUG //$pdf->Output(); $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,$func->decode_entities(_NOTES." : "._AFFAIRE." ".$id),0,1, 'C'); $pdf->SetFont('','B',10); $pdf->multicell(190,5,$func->decode_entities(_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,$func->decode_entities(_SOCIETY." : "),'LTB',0,'L',1); $pdf->Cell(150,6,$func->decode_entities($func->cut_string($func->show($societe),75)),'RTB',0,'L',1); $pdf->Ln(); } $pdf->Cell(40,6,$func->decode_entities(_SHIPPER." : "),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($author),30)),'RTB',0,'L',0); $pdf->Cell(40,6,$func->decode_entities(_MAIL_STATE." : "),'LTB',0,'L',0); if ($status=="NEW") { $status_label = _TO_PROCESS; } else if ($status=="COU") { $status_label = _IN_PROGRESS; } else if ($status=="END") { $status_label = _CLOSED; }else if($status == 'OUT') { $status_label = _ONGOING; } else if($status == "VAL") { $status_label = _VAL_STATUS; } else if($status == 'DEL') { $status_label = _DELETED_DOC; } $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($status_label),30)),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($type),30)),'RTB',0,'L',1); $pdf->Cell(40,6,$func->decode_entities(_INVOICE_TYPE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($nature_envoi),30)),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_OBJECT." : "),'LTB',0,'L',0); $pdf->Cell(150,6,$func->decode_entities($func->cut_string($func->show($description),75)),'RTB',0,'L',0); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_DOC_DATE." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($func->dateformat($doc_date)),30)),'RTB',0,'L',1); if ($out) { $pdf->Cell(40,6,$func->decode_entities(_SHIPPING_DATE." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($creation_date); } else { $pdf->Cell(40,6,$func->decode_entities(_DATE_START." : "),'LTB',0,'L',1); $tmp_date_pdf = $func->dateformat($datearrivee); } $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($tmp_date_pdf),30)),'RTB',0,'L',1); $pdf->Ln(); $pdf->Cell(40,6,$func->decode_entities(_DL_DATE." : "),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($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,$func->cut_string($func->decode_entities(_LIMIT_DATE_PROCESS),25)." : ",'LTB',0,'L'); } else { $pdf->Cell(40,6,$func->decode_entities(_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,$func->cut_string($func->show($func->decode_entities($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,$func->cut_string($func->show($func->decode_entities($disp_datetraitement)),30),'RTB',0,'L'); } $pdf->Ln(); } $pdf->Cell(40,6,$func->decode_entities(_DEPARTMENT." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($service),30)),'RTB',0,'L',1); if(!$out ) { $priority_label = $_SESSION['priority'][$priority]['label']; $pdf->Cell(40,6,$func->decode_entities(_PRIORITY." : "),'LTB',0,'L',1); $pdf->Cell(55,6,$func->decode_entities($func->cut_string($func->show($priority_label),30)),'RTB',0,'L',1); } $pdf->Ln(); if ($_SESSION['config']['gdi_index'] == "true") { $pdf->Cell(40,6,$func->decode_entities(_GID_ID." : "),'LTB',0,'L',0); $pdf->Cell(55,6,$func->decode_entities($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." 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']."%') OR (i.USER_ID ='".$_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,$func->decode_entities(_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,$func->decode_entities(_DATE." : "),'1',0,'J',0); $pdf->Cell(47,7,$func->decode_entities($func->dateformat($res->DATE)),'1',0,'J',0); $pdf->Cell(25,7,$func->decode_entities(_USER." : "),'1',0,'J',0); $pdf->Cell(103,7,$func->decode_entities($func->show($res->FIRSTNAME." ".$res->LASTNAME)),'1',0,'J',0); $pdf->Ln(); $pdf->MultiCell(190,7,$func->decode_entities(strip_tags($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"); } } ?>