1 |
<?php |
2 |
//Temporisation de l'affichage pour utiliser la function header |
3 |
ob_start(); |
4 |
require_once "../obj/utils.class.php"; |
5 |
$f = new utils (NULL, "avis_code_barre", |
6 |
_("Consultation par code barre")); |
7 |
$erreur=""; |
8 |
//Traitement des valeurs renvoyees par POST |
9 |
if(isset($_POST['validation']) AND $_POST['consultation']!="" AND is_numeric($_POST['consultation'])) { |
10 |
// Verification de l'existance de la consultation |
11 |
$sql = "SELECT count(*) FROM public.consultation WHERE consultation=".$_POST['consultation']; |
12 |
$count_consult = $f->db->getone($sql); |
13 |
if (database::isError($count_consult)) { |
14 |
// Affichage de l'erreur |
15 |
$this->erreur_db($count_consult->getDebugInfo(), $count_consult->getMessage(), ''); |
16 |
} else { |
17 |
// Traitement des erreurs ou redirection vers la consultation |
18 |
$f->addToLog("avis_code_barre.php ligne : ".__LINE__." Query :".$sql, VERBOSE_MODE); |
19 |
if($count_consult==0) { |
20 |
$erreur=_("Aucune consultation avec cet identifiant."); |
21 |
} elseif ($count_consult>1){ |
22 |
$erreur=_("Plusieurs consultation avec cet identifiant."); |
23 |
} else { |
24 |
header("Location: ../scr/form.php?obj=consultation&action=1&retour=avis_code_barre&idx=".$_POST['consultation']); |
25 |
} |
26 |
} |
27 |
} elseif(isset($_POST['validation']) AND $_POST['consultation']=="") { |
28 |
$erreur=_("Veuiller saisir un No de consultation."); |
29 |
} elseif (isset($_POST['validation']) AND !is_numeric($_POST['consultation'])) { |
30 |
$erreur=_("Ce code n'est pas valide."); |
31 |
} |
32 |
// Affichage du buffer de sortie |
33 |
ob_end_flush(); |
34 |
/*Affichage du formulaire*/ |
35 |
echo '<div class="subtitle">'; |
36 |
echo '<h3>'; |
37 |
echo _("Application"); |
38 |
echo '<span class="om-icon om-icon-16 om-icon-fix arrow-right-16">$nbsp;</span>'; |
39 |
echo _("avis par code barre"); |
40 |
echo '</h3>'; |
41 |
echo '</div>'; |
42 |
require_once '../obj/om_formulaire.class.php'; |
43 |
echo "<div id=\"formulaire\" class=\"ui-tabs ui-widget ui-widget-content ui-corner-all\">"; |
44 |
echo "<ul class=\"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\">"; |
45 |
echo "<li class=\"ui-state-default ui-corner-top ui-tabs-selected ui-state-active\"><a href=\"#tabs-1\" id=\"main\">Consultation</a></li>"; |
46 |
echo "</ul>"; |
47 |
|
48 |
echo "<div id=\"tabs-1\" class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">"; |
49 |
|
50 |
echo '<div class="formulaire">'; |
51 |
echo "\t<form method=\"post\" id=\"avis_code_barre_form\" action=\"../app/avis_code_barre.php\" class=\"formEntete ui-corner-all\">\n"; |
52 |
//Ajout de l'erreur |
53 |
if($erreur != "") { |
54 |
$class = "error"; |
55 |
$f->displayMessage($class, $erreur); |
56 |
} |
57 |
|
58 |
// |
59 |
$validation = 0; |
60 |
$maj = 0; |
61 |
$champs = array("consultation"); |
62 |
|
63 |
// |
64 |
$form = new formulaire(NULL, $validation, $maj, $champs); |
65 |
// |
66 |
$form->setLib("consultation", _("No de consultation")." :"); |
67 |
$form->setType("consultation", "text"); |
68 |
$form->setTaille("consultation", 10); |
69 |
$form->setMax("consultation", 10); |
70 |
// |
71 |
$form->entete(); |
72 |
$form->afficher($champs, $validation, false, false); |
73 |
$form->enpied(); |
74 |
|
75 |
// |
76 |
|
77 |
echo "\t<div class=\"formControls\">\n"; |
78 |
echo "\t\t<input type=\"submit\" class=\"om-button ui-button ui-widget ui-state-default ui-corner-all\" |
79 |
value=\""._("Valider")."\" name=\"validation\" />\n"; |
80 |
echo "\t</div>\n"; |
81 |
echo "\t</form>\n"; |
82 |
echo "</div>"; |
83 |
echo "</div>"; |
84 |
echo "</div>"; |
85 |
?> |