Commit 82a3949c authored by Guinness's avatar Guinness

Fix receipt.pdf being outdated + fix paths.

parent 213037a8
...@@ -408,7 +408,7 @@ class Perso extends Controller ...@@ -408,7 +408,7 @@ class Perso extends Controller
$db = $f3->get('DB'); $db = $f3->get('DB');
$id = $params['id']; $id = $params['id'];
$command = "pdftk "; $command = "pdftk ";
$args = " ./receipt.pdf fill_form tmp/".$id.".xfdf output tmp/".$id.".pdf flatten dont_ask"; $args = " ./receipt.pdf fill_form ../tmp/".$id.".xfdf output ../tmp/".$id.".pdf flatten dont_ask";
$logger->write($command . " " .$args); $logger->write($command . " " .$args);
// Vérification que le don appartient bien à l'utilisateur connecté // Vérification que le don appartient bien à l'utilisateur connecté
...@@ -472,7 +472,7 @@ class Perso extends Controller ...@@ -472,7 +472,7 @@ class Perso extends Controller
</field> </field>
</fields> </fields>
</xfdf>'; </xfdf>';
$fp = fopen("tmp/".$id.".xfdf", "w"); $fp = fopen("../tmp/".$id.".xfdf", "w");
if ($fp) { if ($fp) {
fputs($fp, $content); fputs($fp, $content);
fclose($fp); fclose($fp);
...@@ -483,12 +483,12 @@ class Perso extends Controller ...@@ -483,12 +483,12 @@ class Perso extends Controller
exec($command.$args, $output); exec($command.$args, $output);
// Suppression du fichier datas // Suppression du fichier datas
unlink("tmp/".$id.".xfdf"); unlink("../tmp/".$id.".xfdf");
// Renvoi du fichier pdf au client // Renvoi du fichier pdf au client
$fp = fopen("tmp/".$id.".pdf", "rb"); $fp = fopen("../tmp/".$id.".pdf", "rb");
if ($fp) { if ($fp) {
$fsize = filesize("tmp/".$id.".pdf"); $fsize = filesize("../tmp/".$id.".pdf");
header("Content-Type: application/pdf"); header("Content-Type: application/pdf");
header("Content-Disposition: attachment; filename=\"".$id.".pdf\""); header("Content-Disposition: attachment; filename=\"".$id.".pdf\"");
header("Content-Length: $fsize"); header("Content-Length: $fsize");
...@@ -502,7 +502,7 @@ class Perso extends Controller ...@@ -502,7 +502,7 @@ class Perso extends Controller
} }
// Suppression du fichier reçu // Suppression du fichier reçu
unlink("tmp/".$id.".pdf"); unlink("../tmp/".$id.".pdf");
die(); die();
} }
......
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment