Skip to content
Snippets Groups Projects
Commit a0011c0c authored by Unknown's avatar Unknown
Browse files

Ajout de log dans le tamponnage ~Actes

parent cccdf93b
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ et adhère aux principes du [Semantic Versioning](http://semver.org/).
### Évolutions
- Modification de l'opacité du tampon (0.5 -> 0.8) ~Actes #339
- Ajout de log dans le tamponnage ~Actes
### Corrections
......
......@@ -8,12 +8,17 @@ class ActeTamponne {
/** @var PDFStampWrapper */
private $pdfStampWrapper;
/** @var Logger */
private $logger;
public function __construct(
ActesTransactionsSQL $actesTransactionsSQL,
PDFStampWrapper $pdfStampWrapper
PDFStampWrapper $pdfStampWrapper,
Logger $logger
) {
$this->actesTransactionsSQL = $actesTransactionsSQL;
$this->pdfStampWrapper = $pdfStampWrapper;
$this->logger = $logger;
}
public function tamponnerPDF($file_path,$transaction_id,$date_affichage = false){
......@@ -39,8 +44,11 @@ class ActeTamponne {
$pdfStampData->identifiant_unique = $transactionInfo['unique_id'];
try {
return $this->pdfStampWrapper->stamp($file_path, $pdfStampData);
$result = $this->pdfStampWrapper->stamp($file_path, $pdfStampData);
$this->logger->log("PDF STAMP","Tamponnage de l'acte $transaction_id");
return $result;
} catch (Exception $e){
$this->logger->log("PDF STAMP","Impossible de tamponn l'acte $transaction_id : " . $e->getMessage());
return file_get_contents($file_path);
}
}
......
......@@ -13,8 +13,9 @@ class ActeTamponneTest extends PHPUnit_Framework_TestCase {
/** @var ActesTransactionsSQL $actesTransactionsSQL */
$acteTamponne = new ActeTamponne($actesTransactionsSQL,new PDFStampWrapper(""));
$acteTamponne = new ActeTamponne($actesTransactionsSQL,new PDFStampWrapper(""), new Logger());
$this->expectOutputRegex("#Impossible de tamponn l'acte 12#");
$acteTamponne->tamponnerPDF(__DIR__."/../fixtures/vide.pdf","12");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment