Révision 9ede589c
plugins/anet_epacks/front/plugin_anet_epacks.generate_odt_client2_8_to_9.form.php | ||
---|---|---|
8 | 8 |
include_once("tools.php"); |
9 | 9 |
|
10 | 10 |
checkRight("config","w"); |
11 |
commonHeader("anet_epacks",$_SERVER['PHP_SELF'],"config","plugins"); |
|
12 |
|
|
11 | 13 |
//checkSeveralRightsOr(array("config" => "w", "profile" => "w")); |
12 | 14 |
|
13 |
require_once('lib/odf.php'); |
|
14 |
$odf = new odf("abuledu-epack.odt"); |
|
15 |
//$odf->exportAsAttachedFile(); |
|
16 |
//$odf->printVars(); |
|
17 |
//print_r($odf); |
|
18 |
//$odf->saveToDisk('tmp/fichier.odt'); |
|
15 |
//require_once('lib/odf.php'); |
|
16 |
//$odf = new odf("abuledu-epack-activated.odt"); |
|
19 | 17 |
|
20 | 18 |
global $DB; |
21 | 19 |
|
... | ... | |
90 | 88 |
exit; |
91 | 89 |
} |
92 | 90 |
|
93 |
$odf->setVars('code', $data['code']); |
|
94 |
$odf->setVars('password', $data['password']); |
|
91 |
//$odf->setVars('code', $data['code']);
|
|
92 |
//$odf->setVars('password', $data['password']);
|
|
95 | 93 |
|
96 |
setlocale(LC_TIME, "fr_FR"); |
|
97 |
$odf->setVars('date', strftime("%A %e %B %Y"), true, 'UTF-8'); |
|
94 |
//setlocale(LC_TIME, "fr_FR");
|
|
95 |
//$odf->setVars('date', strftime("%A %e %B %Y"), true, 'UTF-8');
|
|
98 | 96 |
|
99 | 97 |
//On nous a donné les coordonnées (entité) du client final, pas du "client qui paye" |
100 | 98 |
|
... | ... | |
104 | 102 |
$result2 = $DB->query($query2); |
105 | 103 |
$data2=$DB->fetch_array($result2); |
106 | 104 |
|
107 |
$odf->setVars('correspondant', $data2['name'], true, 'UTF-8'); |
|
108 |
$odf->setVars('adresse', $data2['address'], true, 'UTF-8'); |
|
109 |
$odf->setVars('cp', $data2['postcode']); |
|
110 |
$odf->setVars('ville', $data2['town'], true, 'UTF-8'); |
|
105 |
//$odf->setVars('correspondant', $data2['name'], true, 'UTF-8');
|
|
106 |
//$odf->setVars('adresse', $data2['address'], true, 'UTF-8');
|
|
107 |
//$odf->setVars('cp', $data2['postcode']);
|
|
108 |
//$odf->setVars('ville', $data2['town'], true, 'UTF-8');
|
|
111 | 109 |
|
112 | 110 |
//On "grille" le epack pour eviter de l'affecter a qqn d'autre ... cas particulier du client direct |
113 | 111 |
if($_POST['clientdirect'] == 1) { |
114 | 112 |
$addquery3 = ",FK_activation='$fk_entitee_client',FK_client='$fk_entitee_client',FK_enduser='$fk_entitee_enduser'"; |
115 | 113 |
} |
116 |
$query3="UPDATE glpi_plugin_anet_epacks set FK_clientderyxeo='$fk_entitee_client',creation_date='" . date("Y-m-d") . "'" . $addquery3 . " WHERE ID='" . $data['ID'] . "';"; |
|
114 |
$query3="UPDATE glpi_plugin_anet_epacks set FK_clientderyxeo='$fk_entitee_client',creation_date='" . date("Y-m-d") . "',activation_date='" . date("Y-m-d") . "'" . $addquery3 . " WHERE ID='" . $data['ID'] . "';";
|
|
117 | 115 |
|
118 | 116 |
$DB->query($query3) or die($DB->error()); |
119 | 117 |
|
120 | 118 |
//On créé un fichier local pour archive ... |
121 |
$fichier="archives/" . date("Y-m-d") . "-" . $data['code'] . ".odt"; |
|
122 |
$odf->saveToDisk($fichier); |
|
119 |
//En fait c'est un epack directement active |
|
120 |
//$fichier="archives/" . date("Y-m-d") . "-" . $data['code'] . ".odt"; |
|
121 |
//$odf->saveToDisk($fichier); |
|
123 | 122 |
|
124 | 123 |
//On génère le fichier |
125 | 124 |
//$odf->exportAsAttachedFile(); |
126 |
pushfile($fichier); |
|
125 |
//pushfile($fichier); |
|
126 |
|
|
127 |
|
|
128 |
print "<h1>epacks généré</h1>"; |
|
129 |
print "<p>Votre epack de migration 8 à 9 a été généré: <a href=\"plugin_anet_epacks.generate_odt_activated.form.php?date=" . date("Y-m-d") . "&code=" . $data['code'] . "\">Générer le fichier OOO</a></p>\n"; |
|
130 |
|
|
131 |
commonFooter(); |
|
132 |
|
|
127 | 133 |
?> |
Formats disponibles : Unified diff