From baf7b51f14679e5661830651cc5f237cd754654a Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 1 Jul 2019 07:46:54 +0000 Subject: [PATCH] Add flag_activated to the Warranty entity. Add Status field to Warranty results of search. #227 --- src/Entity/Warranty.php | 18 ++++++++++++++++++ templates/search/form.html.twig | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Entity/Warranty.php b/src/Entity/Warranty.php index c1e16d32..a0e71a99 100644 --- a/src/Entity/Warranty.php +++ b/src/Entity/Warranty.php @@ -121,12 +121,19 @@ class Warranty */ protected $claim_from; + // warranty activated + /** + * @ORM\Column(type="boolean") + */ + protected $flag_activated; + public function __construct() { $this->date_create = new DateTime(); $this->warranty_class = WarrantyClass::WTY_PRIVATE; $this->status = WarrantyStatus::ACTIVE; $this->date_claim = null; + $this->flag_activated = false; } public function getID() @@ -348,4 +355,15 @@ class Warranty { return $this->claim_from; } + + public function setActivated($flag_activated = true) + { + $this->flag_activated = $flag_activated; + return this; + } + + public function isActivated() + { + return $this->flag_activated; + } } diff --git a/templates/search/form.html.twig b/templates/search/form.html.twig index 892ca1ed..e1231721 100644 --- a/templates/search/form.html.twig +++ b/templates/search/form.html.twig @@ -197,6 +197,7 @@ Expiry Date Serial Battery + Status @@ -210,6 +211,13 @@ {{ result.getDateExpire|default("")|date('d M Y') }} {{ result.getSerial|default("") }} {{ result.getSAPBattery.getID|default("") }} + + {% if result.isActivated == true %} + Activated + {% else %} + Not Activated + {% endif %} + {% endfor %}