Merge branch 'master' into feature/timeline

This commit is contained in:
Björn Fromme
2025-03-18 17:21:56 +01:00
12 changed files with 79 additions and 42 deletions
-16
View File
@@ -43,10 +43,6 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
#[Assert\NotNull(message: 'Bitte gib die Destination an')]
private ?Destination $destination = null;
#[ORM\Column(nullable: true)]
#[Assert\NotBlank(message: 'Bitte gib den Konstenträger an')]
private ?string $costCenter = null;
#[ORM\ManyToOne]
#[Assert\NotNull(message: 'Bitte gib das Jobprofil an')]
private ?JobProfile $jobProfile = null;
@@ -198,18 +194,6 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this;
}
public function getCostCenter(): ?string
{
return $this->costCenter;
}
public function setCostCenter(?string $costCenter): static
{
$this->costCenter = $costCenter;
return $this;
}
public function getJobProfile(): ?JobProfile
{
return $this->jobProfile;
+15
View File
@@ -43,6 +43,9 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
#[Assert\NotNull(message: 'Bitte ordne eine Feedback-Vorlage zu')]
private ?FeedbackSet $feedbackSet = null;
#[ORM\Column(nullable: true)]
private ?string $costUnit = null;
public function __construct()
{
$this->uuid = Uuid::v4();
@@ -119,6 +122,18 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
return $this;
}
public function getCostUnit(): ?string
{
return $this->costUnit;
}
public function setCostUnit(?string $costUnit): static
{
$this->costUnit = $costUnit;
return $this;
}
public function isQualified(Teamer $teamer): bool
{
// Check licenses
-3
View File
@@ -58,9 +58,6 @@ class AssignmentType extends AbstractType
'hx-swap' => 'innerHTML',
],
])
->add('costCenter', TextType::class, [
'label' => 'Kostenträger',
])
->add('jobProfile', EntityType::class, [
'label' => 'Jobprofil',
'class' => JobProfile::class,
+4 -1
View File
@@ -52,6 +52,9 @@ class JobProfileType extends AbstractType
'choice_label' => 'name',
'placeholder' => 'Kein Feedback',
])
->add('costUnit', TextType::class, [
'label' => 'Kostenstelle',
])
;
}
@@ -62,4 +65,4 @@ class JobProfileType extends AbstractType
'anti_xss' => true,
]);
}
}
}
+12 -9
View File
@@ -22,26 +22,29 @@ class InvoiceApprover extends AbstractPdfRenderer
throw new \InvalidArgumentException('Expected PDF but got '.$invoice->getMimeType());
}
// Load template
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
if (false === file_exists($filepath)) {
throw new \InvalidArgumentException('Uploaded document not found at '.$filepath);
}
$pdf = new Pdf();
$pdf->SetAuthor($teamer->getFullName(), true);
$pdf->SetCreator($teamer->getFullName(), true);
// Load template
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
$pdf->appendPdf($filepath);
$pdf->setPage(1);
// Cost unit
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
// Cost unit job profile
if (null !== $costUnit = $assignment->getJobProfile()->getCostUnit()) {
$pdf->SetFont('Arial', '', 11);
$pdf->Text(20,20, utf8_decode('Kostenstelle: '.$costUnit));
$pdf->Text(20,20, utf8_decode('Kostenstelle 1: '.$costUnit));
}
// Cost center
if (null !== $costCenter = $assignment->getCostCenter()) {
// Cost unit destination/hotel
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
$pdf->SetFont('Arial', '', 11);
$pdf->Text(20,25, utf8_decode('Kostenträger: '.$costCenter));
$pdf->Text(20,25, utf8_decode('Kostenstelle 2: '.$costUnit));
}
// Approval