obtformlib.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <?php
  2. // ------------------------------
  3. // Caractéristiques du module
  4. // ------------------------------
  5. unset($module);
  6. $module = array(
  7. "titre" => "Gestion des libérations",
  8. "urldest" => $SCRIPT_NAME . "?page=liste_liberations",
  9. "recherche" => array("engin" => true),
  10. "jeton" => $jeton,
  11. "opradmin" => "Ajouter une libération",
  12. "fenetre" => array(
  13. "nom" => "liste_liberations",
  14. "titre" => "titre",
  15. "largeur" => "1024",
  16. "hauteur" => "500",
  17. "champs" => array("lemploye")
  18. ),
  19. "msgajoutbouton" => "Ajout de la libération",
  20. "msgmodifbouton" => "Modification de la libération",
  21. "nombre_a_afficher" => array(
  22. 0 => array("refid" => 15, "valeur" => 15),
  23. 1 => array("refid" => 30, "valeur" => 30),
  24. 2 => array("refid" => 45, "valeur" => 45),
  25. 3 => array("refid" => 60, "valeur" => 60),
  26. 4 => array("refid" => 120, "valeur" => 120),
  27. 5 => array("refid" => 240, "valeur" => 240)
  28. ),
  29. "lientri" => true,
  30. "entete" => array(
  31. 1 => array("Employé" => "concat(employes.nomfamille,employes.prenom)", "largeur" => "130px"),
  32. 2 => array("Type" => "liberations.typeoperation", "largeur" => "78px"),
  33. 3 => array("Date de libération" => "ligneliberations.dateliberation", "largeur" => "141px"),
  34. 4 => array("Article" => "articles.noarticle", "largeur" => "65px"),
  35. 5 => array("Commentaire" => "ligneliberations.commentaire", "largeur" => "204px"),
  36. 6 => array("Durée" => "duree.duree", "largeur" => "61px"),
  37. 7 => array("Lieu" => "ligneliberations.lieu", "largeur" => "79px"),
  38. 8 => array("Assumer par" => "ligneliberations.quipaye", "largeur" => "105px"),
  39. 9 => array("Paiement" => "ligneliberations.paiement", "largeur" => "84px"),
  40. 10 => array("En date du" => "ligneliberations.datepaiement", "largeur" => "90px"),
  41. 11 => array("<img alt=\"Save\" src=\"../images/icones/icones_12.png\">" => "-1", "largeur" => "23px", "droit" => array("gestion_site" => "Oui")),
  42. 12 => array("<img alt=\"Pdf\" src=\"../images/pdficon_small.gif\">" => "-1", "largeur" => "22px")
  43. ),
  44. "msg" => array(
  45. "maj_ok" => "Création de la libération effectuée avec succès.",
  46. "maj_echec" => "L'opération de création de la libération a échouée",
  47. "rech_ok" => "La recherche a réussie.",
  48. "rech_echec" => "La recherche a été infructueuse ou a échouée.",
  49. "employeur_invalide" => "Employeur introuvable ou inconnu.",
  50. )
  51. );
  52. session_start();
  53. require (__DIR__ . '/vendor/autoload.php');
  54. require_once("lib/libconfig.inc.php");
  55. require_once("lib/libsession.inc.php");
  56. require_once("lib/libfonctions.inc.php");
  57. require_once("lib/libmysql.inc.php");
  58. require_once("lib/libencode.inc.php");
  59. require_once("lib/libforms.inc.php");
  60. require_once("lib/libcourriel.inc.php");
  61. require_once("lib/libliberations.inc.php");
  62. require_once("lib/lib2fa.inc.php");
  63. ini_set('display_errors', 'off');
  64. //Encodage des caractères
  65. header('Content-Type: text/html; charset=$ENCODAGE');
  66. //Pour test local avec des appels directs, transformer les INPUT_POST en INPUT_GET
  67. //INPUT_POST
  68. //INPUT_GET
  69. $SCRIPT_NAME = "index2.php";
  70. $jeton = filter_input(INPUT_POST, "jeton");
  71. $rsearch1 = filter_input(INPUT_POST, "prm1");
  72. if (!empty($rsearch1)) {
  73. if ($rsearch1 == "-1" || intval($rsearch1) > 0) {
  74. unset($cpt, $vide);
  75. $cpt = 0;
  76. if (intval($rsearch1) > 0) {
  77. unset($sqlparam);
  78. $sqlparam["table"][] = "liberations";
  79. $sqlparam["table"][] = "ligneliberations";
  80. $sqlparam["table"][] = "employes";
  81. $sqlparam["table"][] = "articles";
  82. $sqlparam["table"][] = "employeurs";
  83. $sqlparam["table"][] = "duree";
  84. $sqlparam["join"][] = "ligneliberations.refliberation = liberations.refliberation";
  85. $sqlparam["join"][] = "employes.refemploye = liberations.refemploye";
  86. $sqlparam["join"][] = "ligneliberations.refarticle = articles.refarticle";
  87. $sqlparam["join"][] = "employes.refemployeur=employeurs.refemployeur";
  88. $sqlparam["join"][] = "ligneliberations.duree=duree.refduree";
  89. $sqlparam["champs"][] = "liberations.refliberation";
  90. $sqlparam["champs"][] = "ligneliberations.refligneliberation";
  91. $sqlparam["champs"][] = "employes.numemploye";
  92. $sqlparam["champs"][] = "CONCAT(employes.prenom,' ',employes.nomfamille) as nomemploye";
  93. $sqlparam["champs"][] = "liberations.typeoperation";
  94. $sqlparam["champs"][] = "UNIX_TIMESTAMP(liberations.datedemande) as datedemande";
  95. $sqlparam["champs"][] = "unix_timestamp(ligneliberations.dateliberation) as dateliberation";
  96. $sqlparam["champs"][] = "duree.duree";
  97. $sqlparam["champs"][] = "articles.noarticle";
  98. $sqlparam["champs"][] = "ligneliberations.commentaire";
  99. $sqlparam["champs"][] = "ligneliberations.lieu";
  100. $sqlparam["champs"][] = "ligneliberations.quipaye";
  101. $sqlparam["champs"][] = "ligneliberations.paiement";
  102. $sqlparam["champs"][] = "IF(ligneliberations.paiement=2,UNIX_TIMESTAMP(ligneliberations.datepaiement),'') as datepaiement";
  103. $sqlparam["where"][] = sprintf("liberations.refliberation=%d", $rsearch1);
  104. unset($resultlib);
  105. $resultlib = executerRequeteSql($sqlparam);
  106. $cpt = count($resultlib) - 1;
  107. $vide = false;
  108. } else {
  109. $cpt = 0;
  110. $vide = true;
  111. $resultlib = array();
  112. }
  113. //Si syndicat régionaux, on limite l'accès aux articles.
  114. unset($sqlparam);
  115. $sqlparam["table"][] = "articles";
  116. $sqlparam["champs"][] = "refarticle";
  117. $sqlparam["champs"][] = "noarticle";
  118. if ($_SESSION['gestion_site'] == 'Non') {
  119. $sqlparam["where"][] = "noarticle='7.04' OR noarticle='7.09'";
  120. }
  121. $sqlparam["ordre"][] = "length(noarticle)";
  122. $sqlparam["ordre"][] = "noarticle";
  123. unset($resultart);
  124. $resultart = executerRequeteSql($sqlparam);
  125. //Lecture des durées de temps
  126. unset($sqlparam);
  127. $sqlparam["table"][] = "duree";
  128. $sqlparam["champs"][] = "refduree";
  129. $sqlparam["champs"][] = "duree";
  130. unset($resultduree);
  131. $resultduree = executerRequeteSql($sqlparam);
  132. // Vérification de la libération si elle a été annulée ou pas
  133. $liberationIsCanceled = isLiberationCanceledCompletely($rsearch1);
  134. // Formulaire de saisie
  135. print " <table width='100%' border='0' >\n";
  136. print " <tr>\n";
  137. print " <td align='center' width='100%'>\n";
  138. print " <div style='background:#f2f6f7'>\n";
  139. print " <form action='" . $SCRIPT_NAME . "?page=liste_liberations&jeton=" . $jeton . "' method='post' id='frmModif' name='frmModif' "; //>\n";
  140. if (isset($param["validation"])) {
  141. print " onSubmit='return ValidationFormulaire();'";
  142. }
  143. print " autocomplete='off'>\n";
  144. print " <table width='100%'>\n";
  145. print " <tr>\n";
  146. print " <td colspan='2'>\n";
  147. print " <table width='100%'>\n";
  148. print " <tr>\n";
  149. print " </tr>\n";
  150. print " </table>\n";
  151. print " </td>\n";
  152. print " </tr>\n";
  153. print "<INPUT TYPE='hidden' name='action'>\n";
  154. if ($vide) {
  155. print "<INPUT TYPE='hidden' name='noliberation'>\n";
  156. } else {
  157. print "<INPUT TYPE='hidden' name='noliberation' value='" . $rsearch1 . "'>\n";
  158. }
  159. print "<table width='100%' border='0'>\n";
  160. print "<tr>\n";
  161. print "<td valign=top style='width:300px;'>Type d'op&eacute;ration : </td>\n";
  162. print "<td style='width:305px;'>\n";
  163. if ($vide) {
  164. print "<table id='tblopr' style='width:265px; padding-left:20px; padding-right: 20px; border:1px solid #cfcfcf;'>\n";
  165. print "<tr>\n";
  166. print "<td>\n";
  167. print "<label for='opr1'>\n";
  168. print "<input style='margin-right:10px;' type='radio' id='opr1' name='ltypeopr' value='1'> Demande&nbsp;&nbsp;\n";
  169. print "</label>\n";
  170. print "<label for='opr2'>\n";
  171. print "<input style='margin-right:10px;' type='radio' id='opr2' name='ltypeopr' value='2'> Annulation&nbsp;&nbsp;\n";
  172. print "</label>\n";
  173. print "</td>\n";
  174. print "</tr>\n";
  175. print "</table>\n";
  176. } else {
  177. unset($vtypeopr);
  178. $vtypeopr = ($resultlib[0]["typeoperation"] == 1) ? "Demande" : "Annulation";
  179. print $vtypeopr;
  180. print "<input type='hidden' id='opr' name='ltypeopr' value='" . $resultlib[0]["typeoperation"] . "'>\n";
  181. print "<input type='hidden' name='liberation' value='$rsearch1'>\n";
  182. }
  183. print "</td>\n";
  184. print "<td style='text-align:right; width:200px;'>\n";
  185. print "<INPUT class='styled vsolde' TYPE='button' VALUE='Voir le solde' id='vsolde' onclick='voirsolde();'>\n";
  186. print "<div style='position: relative; margin-left:85px;'>\n";
  187. print "<div class='voirsolde' id='voirsolde' style='display:none; padding:2px;'></div>\n";
  188. print "</div>\n";
  189. print "</td>\n";
  190. print "</tr>\n";
  191. print "<tr>\n";
  192. print "<td valign=top>\n";
  193. print "Employ&eacute; :\n";
  194. print "</td>\n";
  195. print "<td colspan='2'>\n";
  196. unset($condition1, $condition2, $condition3);
  197. $condition1 = "Recherche";
  198. $condition2 = "";
  199. $condition3 = date("Y-m-d");
  200. if (!$vide) {
  201. $condition1 = $resultlib[0]["nomemploye"];
  202. $condition2 = ($resultlib[0]["typeoperation"] == 2) ? "checked" : "";
  203. $condition3 = date("Y-m-d", $resultlib[0]["datedemande"]);
  204. }
  205. if ($vide) {
  206. print "<input type='text' value='$condition1' id='zonerecherche2' name='zonerecherche2' onfocus=\"this.value='';\">\n";
  207. } else {
  208. print ucfirst($condition1);
  209. print "<input type='hidden' value='$condition1' id='zonerecherche2' name='zonerecherche2'>\n";
  210. }
  211. print "<input type='hidden' value='$condition2' id='lreference2' name='lreference'>\n";
  212. print "<div id='zoneresultats2' style='max-height:300px;'>\n";
  213. print "</div>\n";
  214. print "</td>\n";
  215. print "</tr>\n";
  216. print "<tr>\n";
  217. print "<td>Date de la cr&eacute;ation du document de lib&eacute;ration : </td>\n";
  218. print "<td colspan='1'>\n";
  219. if ($vide) {
  220. print "<INPUT TYPE='text' NAME='ldatecreation' id='datecreation' Value='$condition3'> (Format : AAAA-MM-JJ)\n";
  221. } else {
  222. print "$condition3";
  223. print "<INPUT TYPE='hidden' NAME='ldatecreation' id='datecreation' Value='$condition3'>";
  224. }
  225. print "</td>\n";
  226. print "<td style='text-align:right;'>";
  227. //Actions multiples
  228. //Pour l'instant seulement, les annulations sont possibles.
  229. if (!$vide && $resultlib[0]["typeoperation"] == 1) {
  230. $result3 = array(
  231. 1 => array("refid" => "Annuler ces libérations", "valeur" => "Annuler ces libérations")
  232. );
  233. unset($param);
  234. $param["form"] = "frmModif";
  235. $param["nom"] = "actionmultiple";
  236. $param["etq"] = "";
  237. $param["defaut"] = 0;
  238. $param["donnees"] = $result3;
  239. $param["menu"] = true;
  240. $param["evt"] = "onchange=\"confirmAction(this);\"";
  241. $param["style"] = "";
  242. print formListbox2($param);
  243. print "<div style='float:right; margin-bottom:12px; font-size:25px;'>&#8628;</div>\n";
  244. print "</td>";
  245. }
  246. print "</tr>\n";
  247. print "<tr>\n";
  248. print "<td colspan='3'>\n";
  249. //<!-- Il faut conserver 2 rangées pour cette table, l'entête et la seconde
  250. //qui sert de modèle pour l'insertion des rangées virtuelles subséquentes.-->
  251. print "<table id='liberations' cellspacing='0' style='width:100%; border-collapse:collapse; border:1px solid #cfcfcf;'>";
  252. print "<tbody>\n";
  253. print "<tr>\n";
  254. print "<th class='liberationsdetail'>Date de lib&eacute;ration</th>\n";
  255. print "<th class='liberationsdetail'>Article</th>\n";
  256. print "<th class='liberationsdetail'>Commentaire</th>\n";
  257. print "<th class='liberationsdetail'>Dur&eacute;e</th>\n";
  258. print "<th class='liberationsdetail'>Lieu</th>\n";
  259. print "<th class='liberationsdetail'>Assum&eacute;e par</th>\n";
  260. if (!$vide) {
  261. print "<th class='liberationsdetail'>Paiement</th>";
  262. print "<th class='liberationsdetail'>En date du</th>";
  263. } else {
  264. // Colonne visible seulement en mode ajout
  265. print "<th class='liberationsdetail'>&nbsp;</th>\n";
  266. }
  267. print "<th class='liberationsdetail'>Action</th>\n";
  268. print "</tr>\n";
  269. // Boucle d'affichage des lignes de détail
  270. unset($x);
  271. $tableauid = array();
  272. for ($x = 0; $x <= $cpt; $x++) {
  273. unset($liberation);
  274. $liberation["refliberation"] = "";
  275. $liberation["date"] = "";
  276. $liberation["article"] = "";
  277. $liberation["commentaire"] = "";
  278. $liberation["duree"] = "";
  279. $liberation["lieu"] = "";
  280. $liberation["assumerpar"] = "";
  281. $liberation["paiement"] = "";
  282. $liberation["datepaiement"] = "";
  283. if (!$vide) {
  284. $liberation["refliberation"] = $resultlib[$x]["refliberation"];
  285. $liberation["date"] = date("Y-m-d", $resultlib[$x]["dateliberation"]);
  286. $liberation["article"] = $resultlib[$x]["noarticle"];
  287. $liberation["commentaire"] = htmlentities(stripslashes($resultlib[$x]["commentaire"]), ENT_QUOTES, $ENCODAGE);
  288. $liberation["duree"] = $resultlib[$x]["duree"];
  289. $liberation["lieu"] = htmlentities(stripslashes($resultlib[$x]["lieu"]), ENT_QUOTES, $ENCODAGE);
  290. $liberation["assumerpar"] = $resultlib[$x]["quipaye"];
  291. $liberation["paiement"] = $resultlib[$x]["paiement"];
  292. $liberation["datepaiement"] = ($resultlib[$x]["paiement"] == 2) ? date("Y-m-d", $resultlib[$x]["datepaiement"]) : "";
  293. $liberation["refligneliberation"] = $resultlib[$x]["refligneliberation"];
  294. }
  295. print "<tr class='ligne' id='ligne$x'>\n";
  296. // Le document original ne doit pas être annulé et doit être une demande uniquement.
  297. if ($rsearch1 == -1 || (!$liberationIsCanceled && $vtypeopr == "Demande")) {
  298. print "<td class='liberationsdetail'>\n";
  299. print "<input name=\"ancdate[]\" value=\"" . $liberation["date"] . "\" id='idanc$x'\" type=\"hidden\">";
  300. print "<input name='datelib[]' style='min-width:80px;' value='" . $liberation["date"] . "' id='id$x' onblur=\"verifieDate('id$x','lart$x');\" onfocus='verifieinfo();' >";
  301. print "<img alt='Calendrier' src='images/calendar.gif' class='calendrier' id='butdate$x' onclick=\"calendrier('id$x');\">\n";
  302. print "</td>\n";
  303. print "<td class='liberationsdetail'>\n";
  304. print "<select name='larticle[]' id='lart$x' onfocus='verifieinfo();' onblur=\"reponseBoolDate=true;verifieDate('id$x','lart$x');\" >\n";
  305. print "<option value='0'>--------</option>\n";
  306. if (isset($resultart) && is_array($resultart) && count($resultart) > 0) {
  307. foreach ($resultart as $clef => $champs) {
  308. unset($selected);
  309. $selected = "";
  310. if ($champs["noarticle"] == $liberation["article"]) {
  311. $selected = "selected";
  312. }
  313. print "<option $selected value=\"" . $champs["refarticle"] . "\">" . $champs["noarticle"] . "</option>";
  314. }
  315. }
  316. print "</select>\n";
  317. print "</td>\n";
  318. print "<td class='liberationsdetail'>\n";
  319. print "<input class='boite_commentaire' name='commentaire[]' id='com$x' value=\"" . $liberation["commentaire"] . "\" onfocus='verifieinfo();' >\n";
  320. print "</td>\n";
  321. print "<td class='liberationsdetail'>\n";
  322. print "<select name='lduree[]' id='ldur$x' onfocus='verifieinfo();' >\n";
  323. print "<option value='0'>------</option>\n";
  324. if (isset($resultduree) && is_array($resultduree) && count($resultduree) > 0) {
  325. foreach ($resultduree as $clef => $champs) {
  326. unset($selected);
  327. $selected = "";
  328. if ($champs["duree"] == $liberation["duree"]) {
  329. $selected = "selected";
  330. }
  331. print "<option $selected value=\"" . $champs["refduree"] . "\">" . $champs["duree"] . "</option>";
  332. }
  333. }
  334. print "</select>\n";
  335. print "</td>\n";
  336. print "<td class='liberationsdetail'>\n";
  337. print "<input name='lieu[]' value=\"" . $liberation["lieu"] . "\" id='lie$x' onfocus='verifieinfo();' >\n";
  338. print "</td>\n";
  339. print "<td class='liberationsdetail'>\n";
  340. print "<select NAME='lassumerpar[]' id='las$x' onfocus='verifieinfo();' >\n";
  341. print "<option value='0'>--------</option>\n";
  342. unset($selected1, $selected2);
  343. $selected1 = "";
  344. $selected2 = "";
  345. if ($liberation["assumerpar"] == "Syndicat") {
  346. $selected1 = "selected";
  347. } elseif ($liberation["assumerpar"] == "Employeur") {
  348. $selected2 = "selected";
  349. }
  350. print "<option $selected1 value='Syndicat'>Syndicat</option>\n";
  351. print "<option $selected2 value='Employeur'>Employeur</option>\n";
  352. print "</select>\n";
  353. print "</td>\n";
  354. if (!$vide) {
  355. print "<td class='liberationsdetail'>";
  356. print "<select NAME=\"lpaiement[]\" id=\"lpa$x\" onchange=\"creeDatePaiement('lpa$x','datepaiement$x');\"\">";
  357. print "<option value=\"0\">--------</option>";
  358. unset($condition1, $condition2);
  359. $condition1 = ($liberation["paiement"] == "1") ? "Selected" : "";
  360. $condition2 = ($liberation["paiement"] == "2") ? "Selected" : "";
  361. print "<option value=\"1\" $condition1>Non</option>";
  362. print "<option value=\"2\" $condition2>Oui</option>";
  363. print "</td>\n";
  364. print "<td class='liberationsdetail'>";
  365. print "<input name=\"datepaiement[]\" id=\"datepaiement$x\" size=\"10\" maxlength=\"10\" type=\"text\" readonly=\"readonly\" value=\"" . $liberation["datepaiement"] . "\">";
  366. print sprintf("<input type='hidden' id='ligneliberation$x' name='ligneliberation[]' value='%d'>", $liberation["refligneliberation"]);
  367. print "</td>\n";
  368. } else {
  369. // La suppression de ligne seulement en mode ajout d'une libération
  370. print "<td class='liberationsdetail'>\n";
  371. print "<input type='button' class='supprimer' onclick='supprimeLigne(this);' value='' id='$x'>\n";
  372. print "</td>\n";
  373. }
  374. print "<td class='liberationsdetail'>";
  375. // Copie de ligne
  376. print "<input id='copie$x' type='button' class='copier' title='Copier' onclick='copieLigne($x);'>\n";
  377. if (!$vide) {
  378. // Case à cocher pour action multiple
  379. printf("<input type='checkbox' title='Action multiple' id='actionmulti%d' name='actionmulti[]' value='%d'>\n", $x, $liberation["refligneliberation"]);
  380. }
  381. print "</td>\n";
  382. $tableauid[] = "$(\"#id$x\").datepicker({
  383. autoSize: true,
  384. onSelect:function(){
  385. reponseBoolDate=true;
  386. verifieDate('id$x','lart$x');
  387. }
  388. });\n
  389. $(\"#id$x\").datepicker(\"hide\");\n";
  390. print "</tr>\n";
  391. } else {
  392. // ------------------------------------------
  393. // Libération annulée, modification interdite
  394. // ------------------------------------------
  395. print "<td class='liberationsdetail'>\n";
  396. print $liberation["date"];
  397. print "</td>\n";
  398. print "<td class='liberationsdetail'>\n";
  399. print $liberation["article"];
  400. print "</td>\n";
  401. print "<td class='liberationsdetail'>\n";
  402. print $liberation["commentaire"];
  403. print "</td>\n";
  404. print "<td class='liberationsdetail'>\n";
  405. print $liberation["duree"];
  406. print "</td>\n";
  407. print "<td class='liberationsdetail'>\n";
  408. print $liberation["lieu"];
  409. print "</td>\n";
  410. print "<td class='liberationsdetail'>\n";
  411. print $liberation["assumerpar"];
  412. print "</td>\n";
  413. if (!$vide) {
  414. print "<td class='liberationsdetail'>";
  415. $paiement = ($liberation["paiement"] == "1") ? "Oui" : "Non";
  416. print $paiement;
  417. print "</td>\n";
  418. print "<td class='liberationsdetail'>";
  419. print $liberation["datepaiement"];
  420. print "</td>\n";
  421. }
  422. print "<td class='liberationsdetail'></td>\n";
  423. print "</tr>\n";
  424. }
  425. }
  426. // Fin de la boucle
  427. print "</tbody>\n";
  428. print "</table>\n";
  429. print "<script type=\"text/javascript\">$(document).ready(function() {\n";
  430. if ($vide) {
  431. print "
  432. // Calendrier pour la date de demande
  433. $( \"#datecreation\" ).datepicker({
  434. showOn: \"button\",
  435. buttonImage: \"images/calendar.gif\",
  436. buttonImageOnly: true
  437. });\n";
  438. }
  439. foreach ($tableauid as $clef) {
  440. print $clef;
  441. }
  442. print "});</script>";
  443. // L'ajout de ligne seulement en mode ajout d'une libération
  444. if (!$vide) {
  445. print "<div style='height:25px;'></div>\n";
  446. } else {
  447. print "<div class='user' style='cursor:pointer;' tabindex='0' onclick=\"addRow('liberations');\">Ajouter une ligne</div>\n";
  448. }
  449. print "<div style='width:auto; text-align:center;'>\n";
  450. print "<INPUT class='styled' TYPE='button' VALUE='Aper&ccedil;u' onclick='apercuLiberation(" . $liberation["refliberation"] . ");'>\n";
  451. // Le document original ne doit pas être annulé et doit être une demande uniquement.
  452. if ($rsearch1 == -1 || (!$liberationIsCanceled && $vtypeopr == "Demande")) {
  453. if ($vide) {
  454. print "<INPUT class='styled' TYPE='button' VALUE='Accepter et imprimer' onclick='ValidationFormulaire(this.value);'>\n";
  455. print "<INPUT class='styled' TYPE='button' VALUE='Accepter et envoyer par courriel' onclick='ValidationFormulaire(this.value);'>\n";
  456. } else {
  457. print "<INPUT class='styled' TYPE='button' VALUE='Modifier' onclick='ValidationFormulaire(this.value);'>\n";
  458. print "<INPUT class='styled' TYPE='button' VALUE='Modifier et imprimer' onclick='ValidationFormulaire(this.value);'>\n";
  459. // Bouton d'annulation applicable seulement pour les demandes.
  460. //if ($resultlib[0]["typeoperation"] == 1) {
  461. // print "<INPUT class='styled' TYPE='button' VALUE='Annuler complètement la demande de libération' onclick='AnnuleLiberation(this.value," . $liberation["refliberation"] . ");'>\n";
  462. //}
  463. }
  464. } else {
  465. print "<INPUT class='styled' TYPE='button' VALUE='Copier la demande de libération' onclick='CopierLiberation(this.value," . $liberation["refliberation"] . ");'>\n";
  466. }
  467. if ($vide) {
  468. print "<INPUT class='styled' TYPE='button' VALUE='Effacer' onclick='recommencer();'>";
  469. }
  470. unset($titretemp);
  471. //$datepaiement = ($champs[6] == 2) ? date("Y-m-d", $champs[8]) : "&nbsp;";
  472. if (isset($module["actionajoutbouton"])) {
  473. $titretemp = $module["actionajoutbouton"];
  474. }
  475. $titretemp = '';
  476. print "</div>\n";
  477. print " <tr>\n";
  478. print " <td colspan='3' style='height:50px; text-align:center;'>\n";
  479. $style = "font-size:10pt; font-family:arial, helvetica, sans-serif; margin-left:5px; margin-right:5px; text-align:center;";
  480. //TODO
  481. //Suspendu pour l'instant, je ne vois pas d'assignation de la variable $titre.....
  482. //SG 2023-09-30
  483. /*
  484. if (is_array($titre)) {
  485. foreach ($titre as $clef) {
  486. print "<input style='$style' type=\"submit\" id='boutonaction' name=\"action\" value=\"" . $clef . "\">&nbsp;\n";
  487. }
  488. } else {
  489. if ($titre != '') {
  490. print " <input style='$style' type=\"submit\" id='boutonaction' name=\"action\" value=\"" . $titre . "\">\n";
  491. }
  492. }
  493. */
  494. print "<input class='styled' type=\"button\" id='boutonaction' value=\"Annuler\" onclick='fermerfenetremodale();'>&nbsp;\n";
  495. print " </td>\n";
  496. print " </tr>\n";
  497. print " </table>\n";
  498. print " </form>\n";
  499. print " </div>\n";
  500. print " </td>\n";
  501. print " </tr>\n";
  502. print " </table>\n";
  503. //fenetremodalefin($titretemp);
  504. ?>
  505. <script>
  506. $(document).ready(function () {
  507. // Paramètres pour la seconde zone de recherche
  508. $("#zonerecherche2").focus(function () {
  509. if ($("#zonerecherche2").val() === 'Recherche') {
  510. $("#zonerecherche2").val('');
  511. }
  512. });
  513. $("#zonerecherche2").blur(function () {
  514. $("#zoneresultats2").slideUp();
  515. });
  516. $("#zonerecherche2").keyup(function () {
  517. var SearchText = $("#zonerecherche2").val();
  518. if (SearchText.length > 0) {
  519. $("#zoneresultats2").load("ajaxsearch.php", {zonerecherche: SearchText, id: 2});
  520. $("#zoneresultats2").slideDown();
  521. } else {
  522. $("#zoneresultats2").slideUp();
  523. }
  524. });
  525. $("#zoneresultats2").slideUp();
  526. });
  527. </script>
  528. <?php
  529. }
  530. }
  531. die();