11 |
require_once "../obj/utils.class.php"; |
require_once "../obj/utils.class.php"; |
12 |
|
|
13 |
|
|
14 |
$f = new utils("nohtml", "envoi_lettre_RAR"); |
$f = new utils("nohtml", "envoi_lettre_rar"); |
15 |
|
|
16 |
if(isset($_POST['date'])) { |
if(isset($_POST['date'])) { |
17 |
$date = $_POST['date']; |
$date = $_POST['date']; |
36 |
|
|
37 |
// Compteur du nombre de page générées |
// Compteur du nombre de page générées |
38 |
$nbLettres = 0; |
$nbLettres = 0; |
39 |
|
// Liste d'id des instructions |
40 |
|
$id4Gen = array(); |
41 |
|
|
42 |
if(!empty($date) and !empty($liste_instruction)) { |
if(!empty($date) and !empty($liste_instruction)) { |
43 |
// Création d'un tableau d'instruction |
// Création d'un tableau d'instruction |
44 |
$liste = explode("\n", $_POST['liste_instruction']); |
$liste = explode("\n", $_POST['liste_instruction']); |
|
print_r($liste); |
|
45 |
foreach($liste as $instruction) { |
foreach($liste as $instruction) { |
46 |
//Vérification de l'existance de l'instruction |
//Vérification de l'existance de l'instruction |
47 |
if($instruction != "") { |
if($instruction != "") { |
67 |
$f->db->autoExecute(DB_PREFIXE."instruction", $valF, DB_AUTOQUERY_UPDATE,"instruction = ".$instruction); |
$f->db->autoExecute(DB_PREFIXE."instruction", $valF, DB_AUTOQUERY_UPDATE,"instruction = ".$instruction); |
68 |
$f->isDatabaseError(); |
$f->isDatabaseError(); |
69 |
|
|
70 |
$id4Gen[]=$instruction; |
$id4Gen[] = $instruction; |
71 |
$nbLettres ++; |
$nbLettres ++; |
72 |
|
|
73 |
} else { |
} else { |
74 |
if($error != "") { |
if($error != "") { |
75 |
$error .= "<br/>"; |
$error .= "<br/>"; |
76 |
} |
} |
77 |
$error .= _("Une lettre correspondante a l'instruction no")." ".$instruction." "._("a deja ete envoyee, le bordereau ne sera pas généré"); |
$error .= _("Une lettre correspondante a l'instruction no")." ".$instruction." "._("a deja ete envoyee, le bordereau ne sera pas genere"); |
78 |
} |
} |
79 |
} else { |
} else { |
80 |
if($error != "") { |
if($error != "") { |
103 |
echo "<div id=\"formulaire\" class=\"ui-tabs ui-widget ui-widget-content ui-corner-all\">"; |
echo "<div id=\"formulaire\" class=\"ui-tabs ui-widget ui-widget-content ui-corner-all\">"; |
104 |
echo "<ul class=\"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\">"; |
echo "<ul class=\"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\">"; |
105 |
echo "<li class=\"ui-state-default ui-corner-top ui-tabs-selected ui-state-active\"><a href=\"#tabs-1\" id=\"main\">"; |
echo "<li class=\"ui-state-default ui-corner-top ui-tabs-selected ui-state-active\"><a href=\"#tabs-1\" id=\"main\">"; |
106 |
echo _("Liste des envois"); |
echo _("Creation des feuillets pour RAR"); |
107 |
echo "</a></li>"; |
echo "</a></li>"; |
108 |
echo "</ul>"; |
echo "</ul>"; |
109 |
echo "<div id=\"tabs-1\" class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">"; |
echo "<div id=\"tabs-1\" class=\"ui-tabs-panel ui-widget-content ui-corner-bottom\">"; |
119 |
|
|
120 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
121 |
if($nbLettres > 0) { |
if($nbLettres > 0) { |
122 |
$f->displayMessage("ok", $nbLettres." "._("lettre(s) a envoyer : ")."<a href=\"../app/pdf_lettre_rar.php?liste=".implode(",", $id4Gen)."\">"._("Fichier")."</a>"); |
$f->displayMessage("ok", $nbLettres." "._("feuillets generes :")."<br/> |
123 |
|
<span class=\"om-prev-icon om-icon-16 pdf-16\" |
124 |
|
title=\""._("Ouvrir le fichier genere")."\"> |
125 |
|
<a class =\"bold\" href=\"../app/pdf_lettre_rar.php?liste=".implode(",",$id4Gen)."\">"._("Telecharger les feuillets pour RAR")."</a> |
126 |
|
</span>"); |
127 |
} |
} |
128 |
|
|
129 |
// Paramétrage et affichage des champs du formulaire |
// Paramétrage et affichage des champs du formulaire |
143 |
$form->setTaille("date", 10); |
$form->setTaille("date", 10); |
144 |
$form->setMax("date", 10); |
$form->setMax("date", 10); |
145 |
|
|
146 |
$form->setLib("liste_instruction", _("Liste des instructions")."* :"); |
$form->setLib("liste_instruction", _("Liste des instructions scannees")."* :"); |
147 |
$form->setType("liste_instruction", "textarea"); |
$form->setType("liste_instruction", "textarea"); |
148 |
$form->setVal("liste_instruction", $liste_instruction); |
$form->setVal("liste_instruction", $liste_instruction); |
149 |
$form->setTaille("liste_instruction", 20); |
$form->setTaille("liste_instruction", 20); |