include project name in invoice name (#1672)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\Invoice;
|
||||
|
||||
use App\Entity\Project;
|
||||
use Symfony\Component\String\UnicodeString;
|
||||
|
||||
final class InvoiceFilename
|
||||
@@ -34,6 +35,17 @@ final class InvoiceFilename
|
||||
$filename .= '-' . $uCompany->ascii()->snake();
|
||||
}
|
||||
|
||||
if (null !== $model->getQuery()) {
|
||||
$projects = $model->getQuery()->getProjects();
|
||||
if (\count($projects) === 1) {
|
||||
$pName = $projects[0];
|
||||
if ($pName instanceof Project) {
|
||||
$uProject = new UnicodeString($pName->getName());
|
||||
$filename .= '-' . $uProject->ascii()->snake();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user