|
|
@@ -667,17 +667,23 @@ class Test extends Model {
|
|
|
return "/account/tests/{$this->id}/files/pdf";
|
|
|
}
|
|
|
|
|
|
+ public function getTesterInvoicePDFPath(): bool {
|
|
|
+ return sprintf("%s/tester_invoice.pdf", $this->getDirectory());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function hasTesterInvoicePDF(): bool {
|
|
|
- $directory = $this->getDirectory();
|
|
|
- return file_exists($directory . "/tester_invoice.pdf");
|
|
|
+ return file_exists($this->getTesterInvoicePDFPath());
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getTravelCostsPhotoPath(): string {
|
|
|
+ return sprintf("%s/travel_costs.jpg", $this->getDirectory());
|
|
|
}
|
|
|
|
|
|
public function hasTravelCostsPhoto(): bool {
|
|
|
- $path = sprintf("%s/travel_costs.jpg", $this->getDirectory());
|
|
|
- return file_exists($path);
|
|
|
+ return file_exists($this->getTravelCostsPhotoPath());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -704,8 +710,13 @@ class Test extends Model {
|
|
|
$this->status_tester_invoice = Test::STATUS_TESTER_INVOICE_NONE;
|
|
|
$this->dts_tester_invoice_generated = null;
|
|
|
|
|
|
- $pdf_filepath = $this->getDirectory() . "/tester_invoice.pdf";
|
|
|
- unlink($pdf_filepath);
|
|
|
+ if($this->hasTesterInvoicePDF()) {
|
|
|
+ unlink($this->getTesterInvoicePDFPath());
|
|
|
+ }
|
|
|
+
|
|
|
+ if($this->hasTravelCostsPhoto()) {
|
|
|
+ unlink($this->getTravelCostsPhotoPath());
|
|
|
+ }
|
|
|
|
|
|
return $this->commit();
|
|
|
}
|