creation_liberation.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. <?php
  2. define("LIBERATIONSWEB", 20091223);
  3. session_start();
  4. //Librairie de fonctions
  5. require (__DIR__ . '/vendor/autoload.php');
  6. require_once("lib/libconfig.inc.php");
  7. require_once("lib/libsession.inc.php");
  8. require_once("lib/libfonctions.inc.php");
  9. require_once("lib/libmysql.inc.php");
  10. require_once("lib/libencode.inc.php");
  11. require_once("lib/libcourriel.inc.php");
  12. require_once("lib/libcentrale.inc.php");
  13. require_once("fpdf/fpdf.php");
  14. //Validation du numéro de la libération
  15. $nolib2 = filter_input(INPUT_GET, "lib");
  16. if ($nolib2 == -1 || !is_numeric($nolib2)) {
  17. die("Erreur A");
  18. }
  19. $nolib = antiInjection($nolib2);
  20. //Validation de la sortie (écran,courriel ou impression) de la libération)
  21. $verssortie = filter_input(INPUT_GET, "sortie");
  22. if ($verssortie != "ecran" && $verssortie != "courriel" && $verssortie != "impression" && $verssortie != "web") {
  23. die("Erreur B");
  24. }
  25. class PDF extends FPDF {
  26. var $NomContact;
  27. var $Dept;
  28. var $NomEmployeur;
  29. var $EmployeursAdresse1;
  30. var $EmployeursVille;
  31. var $EmployeursCodePostal;
  32. var $DateDemande;
  33. var $NumEmploye;
  34. var $NomEmploye;
  35. var $EmployeAdresse1;
  36. var $EmployeAdresse2;
  37. var $Ville;
  38. var $Operation;
  39. var $Dateliberation;
  40. var $javascript;
  41. var $Presentation;
  42. var $n_js;
  43. var $syndicatnom;
  44. var $configCentrale;
  45. function WordWrap(&$text, $maxwidth) {
  46. $text = trim($text);
  47. if ($text === '')
  48. return 0;
  49. $space = $this->GetStringWidth(' ');
  50. $lines = explode("\n", $text);
  51. $text = '';
  52. $count = 0;
  53. foreach ($lines as $line) {
  54. $words = preg_split('/ +/', $line);
  55. $width = 0;
  56. foreach ($words as $word) {
  57. $wordwidth = $this->GetStringWidth($word);
  58. if ($wordwidth > $maxwidth) {
  59. // Word is too long, we cut it
  60. for ($i = 0; $i < strlen($word); $i++) {
  61. $wordwidth = $this->GetStringWidth(substr($word, $i, 1));
  62. if ($width + $wordwidth <= $maxwidth) {
  63. $width += $wordwidth;
  64. $text .= substr($word, $i, 1);
  65. } else {
  66. $width = $wordwidth;
  67. $text = rtrim($text) . "\n" . substr($word, $i, 1);
  68. $count++;
  69. }
  70. }
  71. } elseif ($width + $wordwidth <= $maxwidth) {
  72. $width += $wordwidth + $space;
  73. $text .= $word . ' ';
  74. } else {
  75. $width = $wordwidth + $space;
  76. $text = rtrim($text) . "\n" . $word . ' ';
  77. $count++;
  78. }
  79. }
  80. $text = rtrim($text) . "\n";
  81. $count++;
  82. }
  83. $text = rtrim($text);
  84. return $count;
  85. }
  86. //Entête de page
  87. function Header() {
  88. $Image41 = 'logo/' . $_SESSION["syndicat"] . "." . $_SESSION['logo'];
  89. $this->Image($Image41, 139, 25, 47, 22);
  90. //Employeur
  91. $x1 = 119;
  92. $x2 = 159;
  93. $x3 = 160;
  94. //Employeur
  95. $this->SetXY($x1, 54);
  96. $this->SetFont('Times', 'BU', 11);
  97. $etiquette64 = "Employeur";
  98. $this->Cell(52, 6, $etiquette64, 0, 0, 'L');
  99. $this->SetXY($x1, 60);
  100. $this->SetFont('Times', '', 11);
  101. $this->Cell(70, 5, mb_convert_encoding($this->NomContact, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  102. $this->SetXY($x1, 65);
  103. $this->SetFont('Times', '', 11);
  104. $this->Cell(91, 5, mb_convert_encoding($this->Dept, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  105. $this->SetXY($x1, 70);
  106. $this->SetFont('Times', '', 11);
  107. $this->Cell(91, 5, mb_convert_encoding($this->NomEmployeur, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  108. $this->SetXY($x1, 75);
  109. $this->SetFont('Times', '', 11);
  110. $this->Cell(91, 5, mb_convert_encoding($this->EmployeursAdresse1, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  111. $this->SetXY($x1, 80);
  112. $this->SetFont('Times', '', 11);
  113. $this->Cell(37, 5, mb_convert_encoding($this->EmployeursVille, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  114. $this->SetXY($x2, 80);
  115. $this->SetFont('Times', '', 11);
  116. $this->Cell(30, 5, $this->EmployeursCodePostal, 0, 0, 'L');
  117. $this->SetXY($x3, 90);
  118. $this->SetFont('Times', '', 11);
  119. $this->Cell(28, 5, $this->DateDemande, 0, 0, 'L');
  120. //étiquette de détail
  121. $this->SetXY(119, 90);
  122. $this->SetFont('Times', 'B', 11);
  123. $DateDemande_etiquette = "Date de la demande :";
  124. $this->Cell(28, 5, $DateDemande_etiquette, 0, 0, 'L');
  125. $this->SetXY(25, 90);
  126. $this->SetFont('Times', 'B', 11);
  127. $etiquette46 = mb_convert_encoding("LA(LES) LIBÉRATION(S) SYNDICALE(S)", 'ISO-8859-1', 'UTF-8');
  128. $this->Cell(67, 6, $etiquette46, 0, 0, 'L');
  129. $this->SetXY(25, 95);
  130. $this->SetFont('Times', 'BU', 11);
  131. $etiquette56 = "DATE(S)";
  132. $this->Cell(16, 6, $etiquette56, 0, 0, 'L');
  133. $this->SetXY(64, 95);
  134. $this->SetFont('Times', 'BU', 11);
  135. $etiquette57 = "ARTICLE";
  136. $this->Cell(20, 6, $etiquette57, 0, 0, 'L');
  137. $this->SetXY(46, 95);
  138. $this->SetFont('Times', 'BU', 11);
  139. $etiquette59 = mb_convert_encoding("DURÉE", 'ISO-8859-1', 'UTF-8');
  140. $this->Cell(16, 6, $etiquette59, 0, 0, 'L');
  141. $this->SetXY(86, 95);
  142. $this->SetFont('Times', 'BU', 11);
  143. $etiquette71 = "LIEU";
  144. $this->Cell(20, 6, $etiquette71, 0, 0, 'L');
  145. $this->SetXY(119, 95);
  146. $this->SetFont('Times', 'BU', 11);
  147. $etiquette58 = "COMMENTAIRES";
  148. $this->Cell(29, 6, $etiquette58, 0, 0, 'L');
  149. //Employé
  150. $this->SetXY(25, 54);
  151. $this->SetFont('Times', 'BU', 11);
  152. $etiquette65 = mb_convert_encoding("Employé", 'ISO-8859-1', 'UTF-8');
  153. if ($this->Presentation == "Madame") {
  154. $etiquette65 .= "e";
  155. }
  156. $this->Cell(52, 6, $etiquette65, 0, 0, 'L');
  157. //Employé
  158. $this->SetXY(25, 60);
  159. $this->SetFont('Times', '', 11);
  160. $this->Cell(60, 5, mb_convert_encoding($this->NomEmploye, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  161. $this->SetXY(25, 65);
  162. $this->SetFont('Times', '', 11);
  163. $this->Cell(60, 5, mb_convert_encoding($this->EmployeAdresse1, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  164. unset($y);
  165. $y = 0;
  166. $this->SetXY(25, 70 + $y);
  167. $this->SetFont('Times', '', 11);
  168. $this->Cell(59, 5, mb_convert_encoding($this->Ville, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  169. $this->SetXY(25, 75 + $y);
  170. $this->SetFont('Times', '', 11);
  171. $etiquette66 = "Matricule :";
  172. $this->Cell(19, 5, $etiquette66, 0, 0, 'L');
  173. $this->SetXY(46, 75 + $y);
  174. $this->SetFont('Times', '', 11);
  175. $this->Cell(19, 5, mb_convert_encoding($this->NumEmploye, 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  176. $this->SetXY(25, 30);
  177. $this->SetFont('Times', 'B', 20);
  178. $this->Cell(113, 9, $this->Operation, 0, 0, 'C');
  179. $this->SetLineWidth(1);
  180. $this->Rect(25, 25, 113, 22);
  181. $this->SetY(105);
  182. }
  183. //Pied de page
  184. function Footer() {
  185. //Numéro de page
  186. //Positionnement à 1,5 cm du bas
  187. //Police Arial italique 8
  188. $this->SetY(-12);
  189. $this->SetFont('Arial', 'I', 8);
  190. $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
  191. $etiquette52 = $this->configCentrale["presidence_nom"] . ", " . $this->configCentrale["presidence_poste"];
  192. $etiquette43 = $this->configCentrale["syndicat_nom"];
  193. $etiquette45 = $this->configCentrale["adresse"] . ", " . $this->configCentrale["ville"] .
  194. " (" . $this->configCentrale["province"] . ") " . $this->configCentrale["codepostal"] .
  195. " Téléphone : " . str_replace(array("(", ")"), "", $this->configCentrale["telephone"]) .
  196. " Télécopieur : " . str_replace(array("(", ")"), "", $this->configCentrale["telecopieur"]);
  197. $etiquette71 = "À compléter par l'employeur et retourner par courriel à " . $this->configCentrale["courriel"];
  198. // Ligne de signature
  199. $this->SetLineWidth(0);
  200. $this->Line(125, 218, 184, 218);
  201. // Nom de la personne à la présidence
  202. $this->SetXY(125, 220);
  203. $this->SetFont('Times', 'B', 9);
  204. $this->WordWrap($etiquette52, 57);
  205. $this->MultiCell(60, 4, mb_convert_encoding($etiquette52, 'ISO-8859-1', 'UTF-8'));
  206. //Nom du syndicat
  207. $this->SetXY(25, 259);
  208. $this->SetFont('Times', 'B', 9);
  209. $this->Cell(160, 4, mb_convert_encoding($etiquette43, 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
  210. // Adresse
  211. $this->SetXY(25, 264);
  212. $this->SetFont('Times', 'B', 9);
  213. $this->Cell(160, 4, mb_convert_encoding($etiquette45, 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
  214. // Mention
  215. $this->SetXY(130, 232);
  216. $this->SetFont('Times', '', 9);
  217. $this->WordWrap($etiquette71, 38);
  218. $this->MultiCell(38, 3, mb_convert_encoding($etiquette71, 'ISO-8859-1', 'UTF-8'));
  219. $this->SetLineWidth(1);
  220. $this->Line(25, 264, 184, 264);
  221. // Rectangle employeur
  222. $this->SetLineWidth(0);
  223. $this->Rect(29, 229, 145, 23);
  224. // Section employeur
  225. $this->SetXY(32, 227);
  226. $this->SetFont('Times', 'B', 9);
  227. $etiquette69 = "Section Employeur";
  228. $this->SetFillColor(255, 255, 255);
  229. $this->Cell(37, 4, $etiquette69, 0, 0, 'L', true);
  230. $this->SetXY(32, 227);
  231. $this->SetFillColor(0, 0, 0);
  232. $this->Cell(37, 4, $etiquette69, 0, 0, 'L', false);
  233. $this->SetLineWidth(0);
  234. $this->Rect(33, 234, 4, 4);
  235. // Case à cocher Acceptée
  236. $this->SetXY(41, 236);
  237. $this->SetFont('Times', 'B', 9);
  238. $etiquette73 = mb_convert_encoding("Acceptée", 'ISO-8859-1', 'UTF-8');
  239. $this->Cell(21, 4, $etiquette73, 0, 0, 'L');
  240. $this->SetLineWidth(0);
  241. $this->Rect(83, 234, 4, 4);
  242. // Case à cocher Refusée
  243. $this->SetXY(92, 235);
  244. $this->SetFont('Times', 'B', 9);
  245. $etiquette76 = mb_convert_encoding("Refusée", 'ISO-8859-1', 'UTF-8');
  246. $this->Cell(21, 4, $etiquette76, 0, 0, 'L');
  247. $this->SetLineWidth(0);
  248. $this->Line(34, 246, 66, 246);
  249. // Signature employeur
  250. $this->SetXY(38, 247);
  251. $this->SetFont('Times', 'B', 9);
  252. $etiquette78 = "Signature";
  253. $this->Cell(24, 4, $etiquette78, 0, 0, 'L');
  254. $this->SetLineWidth(0);
  255. $this->Line(75, 246, 107, 246);
  256. $this->SetXY(77, 247);
  257. $this->SetFont('Times', 'B', 9);
  258. $etiquette80 = "Date";
  259. $this->Cell(24, 4, $etiquette80, 0, 0, 'L');
  260. }
  261. }
  262. unset($sqlparam);
  263. $sqlparam["table"][] = "liberations";
  264. $sqlparam["table"][] = "ligneliberations";
  265. $sqlparam["table"][] = "employes";
  266. $sqlparam["table"][] = "articles";
  267. $sqlparam["table"][] = "employeurs";
  268. $sqlparam["table"][] = "duree";
  269. $sqlparam["join"][] = "ligneliberations.refliberation = liberations.refliberation";
  270. $sqlparam["join"][] = "employes.refemploye = liberations.refemploye";
  271. $sqlparam["join"][] = "articles.refarticle=ligneliberations.refarticle";
  272. $sqlparam["join"][] = "employeurs.refemployeur=employes.refemployeur";
  273. $sqlparam["join"][] = "duree.refduree=ligneliberations.duree";
  274. $sqlparam["champs"][] = "employes.numemploye";
  275. $sqlparam["champs"][] = "IF(employes.presentation=-1,'Madame','Monsieur') as presentation";
  276. $sqlparam["champs"][] = "employes.prenom";
  277. $sqlparam["champs"][] = "employes.nomfamille";
  278. $sqlparam["champs"][] = "employes.adresse1";
  279. $sqlparam["champs"][] = "employes.adresse2";
  280. $sqlparam["champs"][] = "CONCAT_WS(' ',employes.ville,LEFT(employes.codepostal,3),"
  281. . "RIGHT(employes.codepostal,3)) as ville";
  282. $sqlparam["champs"][] = "employeurs.nomcontact";
  283. $sqlparam["champs"][] = "employeurs.dept";
  284. $sqlparam["champs"][] = "employeurs.nomemployeur";
  285. $sqlparam["champs"][] = "employeurs.adresse1 as adresseemployeur";
  286. $sqlparam["champs"][] = "employeurs.ville as villeemployeur";
  287. $sqlparam["champs"][] = "CONCAT(LEFT(employeurs.codepostal,3),\" \",RIGHT(employeurs.codepostal,3)) as codepemployeur";
  288. $sqlparam["champs"][] = "If(liberations.typeoperation=2,'Annulation','Demande') AS toperation";
  289. $sqlparam["champs"][] = " UNIX_TIMESTAMP(liberations.datedemande) as datedemande";
  290. $sqlparam["champs"][] = "unix_timestamp(ligneliberations.dateliberation) as dateliberation";
  291. $sqlparam["champs"][] = "duree.duree";
  292. $sqlparam["champs"][] = "articles.noarticle";
  293. $sqlparam["champs"][] = "ligneliberations.commentaire";
  294. $sqlparam["champs"][] = "ligneliberations.lieu";
  295. $sqlparam["champs"][] = "employes.email";
  296. $sqlparam["champs"][] = "employeurs.email as emailemployeur";
  297. $sqlparam["where"][] = sprintf("liberations.refliberation=%d", $nolib);
  298. $result = executerRequeteSql($sqlparam);
  299. //Si aucune libération, alors erreur
  300. if (!($result && is_array($result) && count($result) > 0)) {
  301. die("Erreur C - Libération introuvable");
  302. }
  303. //Instanciation de la classe dérivée
  304. $pdf = new PDF('P', 'mm', 'Letter');
  305. $pdf->SetMargins(25, 25);
  306. $pdf->SetAutoPageBreak(true, 70);
  307. $pdf->AliasNbPages();
  308. $pdf->SetFont('Times', '', 11);
  309. $pdf->syndicatnom = $_SESSION["syndicatnom"];
  310. $pdf->configCentrale = buildConfigCentrale();
  311. $lignesujetmail = "\n";
  312. $i = 1;
  313. foreach ($result as $clef => $champs) {
  314. if ($i == 1) {
  315. //Info de l'employé
  316. $pdf->Presentation = htmlspecialchars($champs["presentation"], ENT_SUBSTITUTE, "ISO8859-15");
  317. $pdf->NumEmploye = htmlspecialchars(stripslashes($champs["numemploye"]), ENT_SUBSTITUTE, "ISO8859-15"); //0
  318. $pdf->NomEmploye = htmlspecialchars(stripslashes($champs["prenom"] . " " . $champs["nomfamille"]), ENT_SUBSTITUTE, "ISO8859-15"); //1
  319. $pdf->EmployeAdresse1 = htmlspecialchars(stripslashes($champs["adresse1"]), ENT_SUBSTITUTE, "ISO8859-15"); //2
  320. $pdf->EmployeAdresse2 = htmlspecialchars(stripslashes($champs["adresse2"]), ENT_SUBSTITUTE, "ISO8859-15"); //2
  321. $pdf->Ville = htmlspecialchars(stripslashes($champs["ville"]), ENT_SUBSTITUTE, "ISO8859-15"); //3
  322. $pdf->Operation = mb_convert_encoding($champs["toperation"] . " de libération", 'ISO-8859-1', 'UTF-8');
  323. $pdf->DateDemande = date("Y-m-d", $champs["datedemande"]); //5
  324. //
  325. //Info de l'employeur
  326. $pdf->NomContact = htmlspecialchars(stripslashes($champs["nomcontact"]), ENT_SUBSTITUTE, "ISO8859-15"); //6
  327. $pdf->Dept = htmlspecialchars(stripslashes($champs["dept"]), ENT_SUBSTITUTE, "ISO8859-15"); //7
  328. $pdf->NomEmployeur = htmlspecialchars(stripslashes($champs["nomemployeur"]), ENT_SUBSTITUTE, "ISO8859-15"); //8
  329. $pdf->EmployeursAdresse1 = htmlspecialchars(stripslashes($champs["adresseemployeur"]), ENT_SUBSTITUTE, "ISO8859-15"); //9
  330. $pdf->EmployeursVille = htmlspecialchars(stripslashes($champs["villeemployeur"]), ENT_SUBSTITUTE, "ISO8859-15"); //10
  331. $pdf->EmployeursCodePostal = htmlspecialchars(stripslashes($champs["codepemployeur"]), ENT_SUBSTITUTE, "ISO8859-15");
  332. $pdf->AddPage();
  333. }
  334. $pdf->Dateliberation = date("Y-m-d", $champs["dateliberation"]); //12
  335. $pdf->SetX(25);
  336. $pdf->Cell(16, 4, $pdf->Dateliberation, 0, 0, 'L');
  337. // Utiliser un format plus facilement lisible
  338. $lignesujetmail .= str_replace(" ", "&nbsp;", sprintf("%-18s", $pdf->Dateliberation));
  339. $pdf->SetX(46);
  340. $pdf->Cell(16, 4, $champs["duree"], 0, 0, 'L');
  341. $pdf->SetX(64);
  342. $pdf->Cell(15, 4, mb_convert_encoding($champs["noarticle"], 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  343. $lignesujetmail .= " / " . str_replace(" ", "&nbsp;", sprintf("%-11s",
  344. mb_convert_encoding($champs["noarticle"], 'ISO-8859-1', 'UTF-8')));
  345. $pdf->SetX(86);
  346. $pdf->Cell(20, 4, mb_convert_encoding($champs["lieu"], 'ISO-8859-1', 'UTF-8'), 0, 0, 'L');
  347. $pdf->SetX(119);
  348. $pdf->MultiCell(84, 4, mb_convert_encoding($champs["commentaire"], 'ISO-8859-1', 'UTF-8'));
  349. $lignesujetmail .= " / " . substr(mb_convert_encoding($champs["commentaire"], 'ISO-8859-1', 'UTF-8'), 0, 40);
  350. $lignesujetmail .= (strlen($champs["commentaire"]) > 40 ? "..." : "");
  351. // Fermeture de la ligne de détail
  352. $lignesujetmail .= "\n";
  353. $pdf->ln();
  354. $i++;
  355. }
  356. // Assignation de la signature
  357. unset($signature, $car_sig);
  358. $car_sig = "";
  359. if ($verssortie == "courriel") {
  360. $car_sig = "<br>";
  361. }
  362. if ($_SESSION['gestion_site'] >= "Oui") {
  363. $signature = "$car_sig$car_sig\n\n";
  364. $signature .= $pdf->configCentrale["contact"] . "$car_sig\n";
  365. $signature .= $pdf->configCentrale["contact_poste"] . "$car_sig\n";
  366. $signature .= "Téléphone : " . str_replace(array("(", ")"), "", $pdf->configCentrale["telephone"])
  367. . "$car_sig\n";
  368. $signature .= " Télécopieur : " . str_replace(array("(", ")"), "", $pdf->configCentrale["telecopieur"])
  369. . "$car_sig\n";
  370. $signature .= "Courriel : " . $pdf->configCentrale["courriel"];
  371. } else {
  372. $signature = "\n\n";
  373. $signature .= "" . $_SESSION['nomreel'] . "\n";
  374. $signature .= "Représentant local\n";
  375. $signature .= $_SESSION['adressecourriel'];
  376. }
  377. // Affichage
  378. if ($verssortie == "ecran") {
  379. $pdf->Output();
  380. } elseif ($verssortie == "web") {
  381. $message = "Résumé du document de libération\n";
  382. $message .= "\n";
  383. $message .= "Info de l'employé\n";
  384. $message .= "Matricule : " . $pdf->NumEmploye . "\n";
  385. $message .= $pdf->Presentation . " " . $pdf->NomEmploye . "\n";
  386. $message .= $pdf->EmployeAdresse1 . "\n";
  387. if (!empty($pdf->EmployeAdresse2)) {
  388. $message .= $pdf->EmployeAdresse2 . "\n";
  389. }
  390. $message .= $pdf->Ville . "\n";
  391. $message .= "\n";
  392. $message .= "Info de l'employeur\n";
  393. $message .= $pdf->NomContact . "\n";
  394. $message .= $pdf->Dept . "\n";
  395. $message .= $pdf->NomEmployeur . "\n";
  396. $message .= $pdf->EmployeursAdresse1 . "\n";
  397. $message .= $pdf->EmployeursVille . ", ";
  398. $message .= $pdf->EmployeursCodePostal . "\n";
  399. $message .= "\n";
  400. $message .= "Type : " . $pdf->Operation . "\n";
  401. $message .= "Date de la demande : " . $pdf->DateDemande . "\n";
  402. $message .= "\n";
  403. $message .= "Date de libération / Article / Commentaires (40 premiers caractères)";
  404. $message .= $lignesujetmail;
  405. $message .= "\n";
  406. $message .= "\n";
  407. $message .= "Ce document sera vérifié dans une période de 3 jours.\n";
  408. $message .= "Ce message a été généré automatiquement par une application. $APPLICATION";
  409. $message .= $signature;
  410. $sujetcourriel = $pdf->Operation . " par courriel pour " . $pdf->NomEmploye;
  411. print "<html>";
  412. print "<style> body { height:100%; margin:0; padding:0; font-family:arial, helvetica, sans-serif; background-color:#e8e8e8; }</style>\n";
  413. print "</body>\n";
  414. print "<div style='width:650px; margin:auto; padding:10;'>";
  415. print "<form action='creation_liberation.php?lib=" . $nolib . "&sortie=courriel' method='post' enctype='text/plain'>\n";
  416. print "<div style='float:left; width:75px; padding-top:2px; height:23px;'>De : </div>" . $_SESSION['nomreel'] . " (" . $_SESSION['adressecourriel'] . ")\n";
  417. print "<div style='clear:both;'both;'></div>\n";
  418. print "<div style='float:left; width:75px; padding-top:2px; height:23px;'>Pour : </div><input style='width:450px;' type='text' name='employeur' value=\"" . $champs["emailemployeur"] . "\" /> (employeur)\n";
  419. print "<div style='clear:both;'both;'></div>\n";
  420. print "<div style='float:left; width:75px; padding-top:2px; height:23px;'>Cc : </div><input style='width:450px;' type='text' name='employe' value=\"" . $champs["email"] . "\" /> (employ�)\n";
  421. print "<div style='clear:both;'both;'></div>\n";
  422. print "<div style='float:left; width:75px; padding-top:2px; height:23px;'>Sujet : </div><input style='width:450px;' type='text' name='sujet' value=\"$sujetcourriel\" />\n";
  423. print "<div style='clear:both;'both;'></div>\n";
  424. print "<div style='float:left; width:75px; padding-top:2px; height:23px;'>Message : </div>\n";
  425. print "<div style='clear:both;'both;'></div>\n";
  426. print "<textarea name='message' rows='10' cols='80' style='width:650px; height:575px;' >$message</textarea>\n";
  427. print "<br>\n";
  428. print "<input type='submit' name='envoyer' style='margin-top:10px;' value='Envoyer le courriel' />\n";
  429. print "</form>\n";
  430. print "</div>\n";
  431. print "</body></html>";
  432. }
  433. /*elseif ($verssortie == "courriel") {
  434. $doc = $pdf->Output('', 'S');
  435. if (empty($_REQUEST["message"])) {
  436. $message = "<u>Résumé du document de libération</u><br>\n";
  437. $message .= "<br>\n";
  438. $message .= "<u>Info de l'employé</u><br>\n";
  439. $message .= "Matricule : " . $pdf->NumEmploye . "<br>\n";
  440. $message .= $pdf->Presentation . " " . $pdf->NomEmploye . "<br>\n";
  441. $message .= $pdf->EmployeAdresse1 . "<br>\n";
  442. $message .= $pdf->EmployeAdresse2 . "<br>\n";
  443. $message .= $pdf->Ville . "<br>\n";
  444. $message .= "<br>\n";
  445. $message .= "<u>Info de l'employeur</u><br>";
  446. $message .= $pdf->NomContact . "<br>\n";
  447. $message .= $pdf->Dept . "<br>\n";
  448. $message .= $pdf->NomEmployeur . "<br>\n";
  449. $message .= $pdf->EmployeursAdresse1 . "<br>\n";
  450. $message .= $pdf->EmployeursVille . "<br>\n";
  451. $message .= $pdf->EmployeursCodePostal . "<br>\n";
  452. $message .= "<br>\n";
  453. $message .= "Type : " . $pdf->Operation . "<br>\n";
  454. $message .= "Date de la demande : " . $pdf->DateDemande . "<br>\n";
  455. $message .= "<br>\n<pre>";
  456. $message .= "<u>Date de libération</u> / <u>Article</u> / <u>Commentaires (40 premiers caractères)</u><br>";
  457. $message .= $lignesujetmail;
  458. $message .= "</pre><br>\n";
  459. $message .= "<br>\n";
  460. $message .= "Ce document sera vérifié dans une période de 3 jours.<br><br>\n";
  461. $message .= "Ce message a été généré automatiquement par une application. $APPLICATION";
  462. $message .= $signature;
  463. } else {
  464. $message = $_REQUEST["message"];
  465. }
  466. if (empty($_REQUEST["sujet"])) {
  467. $sujetcourriel = $pdf->Operation . " par courriel pour " . $pdf->NomEmploye;
  468. } else {
  469. $sujetcourriel = $_REQUEST["sujet"];
  470. }
  471. if (empty($_REQUEST["employeur"])) {
  472. $adresseemployeur = $champs["emailemployeur"];
  473. } else {
  474. $adresseemployeur = $_REQUEST["employeur"];
  475. }
  476. if (empty($_REQUEST["employe"])) {
  477. $adresseemploye = $champs["email"];
  478. } else {
  479. $adresseemploye = $_REQUEST["employe"];
  480. }
  481. }
  482. */