From cee4134a2103d13fa5f8fe2a1a930bf4e4986d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danyi=20D=C3=A1vid?= Date: Tue, 29 Jan 2019 08:54:51 +0100 Subject: [PATCH] * fault-type added * expensive confirm step is now mandatory --- src/App/Entity/Fault.php | 26 +++++++++++++++++++++++++ src/App/Service/FaultManagerService.php | 10 +++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/App/Entity/Fault.php b/src/App/Entity/Fault.php index 210dd17..2b92856 100644 --- a/src/App/Entity/Fault.php +++ b/src/App/Entity/Fault.php @@ -37,6 +37,12 @@ class Fault implements JsonSerializable */ private $worksheetNumber; + /** + * @ORM\Column(name="fault_type", type="string", length=30, nullable=true, options={"default": "uzemeltetesi"}) + * @var string + */ + private $faultType; + /** * @ORM\JoinColumn(name="facility_location_id", nullable=false) * @ORM\ManyToOne(targetEntity="FacilityLocation", inversedBy="faults") @@ -271,6 +277,24 @@ class Fault implements JsonSerializable return $this; } + /** + * @return string + */ + public function getFaultType(): ?string + { + return $this->faultType; + } + + /** + * @param string $faultType + * @return Fault + */ + public function setFaultType(?string $faultType): Fault + { + $this->faultType = $faultType; + return $this; + } + /** * @return FacilityLocation */ @@ -868,6 +892,7 @@ class Fault implements JsonSerializable { return [ 'id' => $this->id, + 'faultType' => $this->getFaultType(), 'facilityLocation' => $this->getFacilityLocation(), 'facilityLocationDescription' => $this->getFacilityLocationDescription(), 'errorCategory' => $this->getErrorCategory(), @@ -905,6 +930,7 @@ class Fault implements JsonSerializable { return [ 'id' => $this->id, + 'faultType' => $this->getFaultType(), 'facilityLocation' => $this->getFacilityLocation()->getId(), 'facilityLocationDescription' => $this->getFacilityLocationDescription(), 'errorCategory' => $this->getErrorCategory()->getId(), diff --git a/src/App/Service/FaultManagerService.php b/src/App/Service/FaultManagerService.php index 4e7846c..fc8b1f0 100644 --- a/src/App/Service/FaultManagerService.php +++ b/src/App/Service/FaultManagerService.php @@ -128,7 +128,7 @@ class FaultManagerService $now = new \DateTime(); if ($prevState == 'new' && in_array($data['state'], ['cnf','exp'])) { $fault->setConfirmer($user) - ->setConfirmedAt($now); + ->setConfirmedAt($now); } // high expense approved if ($prevState == 'exp' && $data['state'] == 'cnf') { @@ -317,7 +317,7 @@ class FaultManagerService $this->mailer->sendFaultMail( $recipients, - sprintf("[WN] Kisértékű munka - %s", $fault->getWorksheetNumber()), + sprintf("[WN] Új munka - %s", $fault->getWorksheetNumber()), $fault, sprintf( "Becsült munkaköltség: %s\nBecsült alapanyagköltség: %s\nVisszaigazolta: %s", @@ -341,7 +341,7 @@ class FaultManagerService $this->mailer->sendFaultMail( $recipients, - "[WN] Nagyértékű munka", + "[WN] Új munka", $fault, sprintf( "Becsült munkaköltség: %s\nBecsült alapanyagköltség: %s\nVisszaigazolta: %s", @@ -365,7 +365,7 @@ class FaultManagerService $this->mailer->sendFaultMail( $recipients, - sprintf("[WN] Nagyértékű munka jóváhagyva - %s", $fault->getWorksheetNumber()), + sprintf("[WN] Munka jóváhagyva - %s", $fault->getWorksheetNumber()), $fault, sprintf( "Becsült munkaköltség: %s\nBecsült alapanyagköltség: %s\nJóváhagyta: %s", @@ -389,7 +389,7 @@ class FaultManagerService $this->mailer->sendFaultMail( $recipients, - "[WN] Nagyértékű munka elutasítva", + "[WN] Munka elutasítva", $fault, sprintf("A hiba javítását %s elutasította", $user->getName()) );