commit 0dba1cb9001e82ee06f71d978451e6ce9541ef80
parent 407d1f55f803946c258cfe58815035c00ec91e93
Author: Felicitus <felicitus@felicitus.org>
Date: Mon, 3 Aug 2015 14:56:51 +0200
Refactored part unit display
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartsGrid.js
@@ -293,8 +293,8 @@ Ext.define('PartKeepr.PartsGrid', {
*/
stockLevelRenderer: function (val,q,rec)
{
- if (rec.get("partUnitDefault") !== true) {
- return val + " " + rec.get("partUnitShortName");
+ if (rec.getPartUnit()) {
+ return val + " " + rec.getPartUnit().get("shortName");
} else {
return val;
}
diff --git a/src/PartKeepr/PartBundle/Entity/Part.php b/src/PartKeepr/PartBundle/Entity/Part.php
@@ -14,7 +14,6 @@ use PartKeepr\Util\BaseEntity;
use PartKeepr\Util\Exceptions\OutOfRangeException;
use Symfony\Component\Serializer\Annotation\Groups;
-
/**
* Represents a part in the database. The heart of our project. Handle with care!
*
@@ -62,7 +61,7 @@ class Part extends BaseEntity
* The unit in which the part's "amount" is calculated. This is necessary to count parts
* in "pieces", "meters" or "grams".
* @ORM\ManyToOne(targetEntity="PartKeepr\PartBundle\Entity\PartMeasurementUnit", inversedBy="parts")
- *
+ * @Groups({"default"})
* @var PartMeasurementUnit
*/
private $partUnit;
@@ -101,7 +100,8 @@ class Part extends BaseEntity
/**
* Holds the part attachments
- * @ORM\OneToMany(targetEntity="PartKeepr\PartBundle\Entity\PartAttachment",mappedBy="part",cascade={"persist", "remove"})
+ * @ORM\OneToMany(targetEntity="PartKeepr\PartBundle\Entity\PartAttachment",
+ * mappedBy="part",cascade={"persist", "remove"})
* @Groups({"default"})
*
* @var PartAttachment
@@ -153,7 +153,8 @@ class Part extends BaseEntity
/**
* The parameters for this part
- * @ORM\OneToMany(targetEntity="PartKeepr\PartParameter\PartParameter",mappedBy="part",cascade={"persist", "remove"})
+ * @ORM\OneToMany(targetEntity="PartKeepr\PartParameter\PartParameter",
+ * mappedBy="part",cascade={"persist", "remove"})
*
* @var ArrayCollection
*/
@@ -654,5 +655,4 @@ class Part extends BaseEntity
{
return $this->getName()." (".$this->getId().")";
}
-
}