partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 4e3be27d06da0974fee1b3c42b4b3ebdf97ed258
parent eb44f928a170e5b880d69a548347f4cb0d47a7d2
Author: Felicitus <felicitus@felicitus.org>
Date:   Wed, 29 Jun 2011 05:26:23 +0200

Added "review" flag, displaying create date now

Diffstat:
Mfrontend/js/Components/Part/Editor/PartEditor.js | 5+++++
Mfrontend/js/Components/Part/PartDisplay.js | 9+++++++++
Mfrontend/js/Models/Part.js | 2++
Msrc/de/RaumZeitLabor/PartKeepr/Part/Part.php | 47++++++++++++++++++++++++++++++++++++++++++++++-
Msrc/de/RaumZeitLabor/PartKeepr/Part/PartManager.php | 2+-
5 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/frontend/js/Components/Part/Editor/PartEditor.js b/frontend/js/Components/Part/Editor/PartEditor.js @@ -48,6 +48,11 @@ Ext.define('PartKeepr.PartEditor', { xtype: 'textfield', fieldLabel: i18n("Status"), name: 'status' + },{ + xtype: 'checkbox', + fieldLabel: '', + boxLabel: i18n("Needs Review"), + name: 'needsReview' }]; this.partDistributorGrid = Ext.create("PartKeepr.PartDistributorGrid", { diff --git a/frontend/js/Components/Part/PartDisplay.js b/frontend/js/Components/Part/PartDisplay.js @@ -40,6 +40,14 @@ Ext.define('PartKeepr.PartDisplay', { '<td class="e">'+i18n("Comment")+':</td>', '<td class="e">{comment}</td>', '</tr>', + '<tr>', + '<td class="o">'+i18n("Create Date")+':</td>', + '<td class="o">{createDate}</td>', + '</tr>', + '<tr>', + '<td class="e">'+i18n("Needs Review")+':</td>', + '<td class="e">{needsReview}</td>', + '</tr>', '</table>'); /** @@ -103,6 +111,7 @@ Ext.define('PartKeepr.PartDisplay', { var values = {}; for (var i in r.data) { + console.log(r.data[i]); values[i] = htmlentities(r.data[i]); } diff --git a/frontend/js/Models/Part.js b/frontend/js/Models/Part.js @@ -12,6 +12,8 @@ Ext.define("PartKeepr.Part", { { name: 'status', type: 'string'}, { name: 'stockLevel', type: 'int'}, { name: 'minStockLevel', type: 'int'}, + { name: 'createDate', type: 'datetime'}, + { name: 'needsReview', type: 'boolean'}, // Various things that don't belong to the part, but are transmitted anyways to make handling easier { name: 'partUnitName', type: 'string'}, diff --git a/src/de/RaumZeitLabor/PartKeepr/Part/Part.php b/src/de/RaumZeitLabor/PartKeepr/Part/Part.php @@ -139,6 +139,13 @@ class Part extends BaseEntity implements Serializable, Deserializable { private $status; /** + * Defines if the part needs review + * @Column(type="boolean") + * @var boolean + */ + private $needsReview; + + /** * The create date+time for this part * @Column(type="datetime",nullable=true) * @var \DateTime @@ -151,7 +158,8 @@ class Part extends BaseEntity implements Serializable, Deserializable { $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); $this->images = new \Doctrine\Common\Collections\ArrayCollection(); $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->createDate = new \DateTime(); + $this->setCreateDate(new \DateTime()); + $this->setReviewFlag(false); } /** @@ -207,6 +215,22 @@ class Part extends BaseEntity implements Serializable, Deserializable { } /** + * Sets the review flag + * @param boolean $bReview True if the part needs review, false otherwise + */ + public function setReviewFlag ($bReview) { + $this->needsReview = $bReview; + } + + /** + * Returns the review flag + * @return boolean True if the part needs review, false otherwise + */ + public function getReviewFlag () { + return $this->needsReview; + } + + /** * Set the minimum stock level for this part * * Only positive values are allowed. @@ -318,6 +342,22 @@ class Part extends BaseEntity implements Serializable, Deserializable { } /** + * Sets the create date for this part + * @param \DateTime $dateTime The create date+time + */ + private function setCreateDate (\DateTime $dateTime) { + $this->createDate = $dateTime; + } + + /** + * Returns the create date + * @return \DateTime The create date+time + */ + public function getCreateDate () { + return $this->createDate; + } + + /** * Sets the status for this part. A status is any string describing the status, * e.g. "new", "used", "broken" etc. * @param string $status The status @@ -355,6 +395,8 @@ class Part extends BaseEntity implements Serializable, Deserializable { "images" => $this->serializeChildren($this->getImages()), "attachments" => $this->serializeChildren($this->getAttachments()), "parameters" => $this->serializeChildren($this->getParameters()), + "createDate" => $this->getCreateDate()->format("Y-m-d H:i:s"), + "needsReview" => $this->getReviewFlag(), // Additional things we serialize to make displaying stuff in the frontend easier "categoryName" => is_object($this->category) ? $this->category->getName() : null, @@ -416,6 +458,9 @@ class Part extends BaseEntity implements Serializable, Deserializable { $parameter->setPart($this); } break; + case "needsReview": + $this->setReviewFlag($value); + break; case "attachments": $this->deserializeChildren($value, $this->getAttachments(), "de\RaumZeitLabor\PartKeepr\Part\PartAttachment"); foreach ($this->getAttachments() as $attachment) { diff --git a/src/de/RaumZeitLabor/PartKeepr/Part/PartManager.php b/src/de/RaumZeitLabor/PartKeepr/Part/PartManager.php @@ -108,7 +108,7 @@ class PartManager extends Singleton { - $qb->select("p.averagePrice, p.name, p.id, p.stockLevel, p.minStockLevel, p.comment, st.id AS storageLocation_id, st.name as storageLocationName, f.id AS footprint_id, f.name AS footprintName, c.id AS category_id, c.name AS categoryName, pu.id AS partUnit, pu.name AS partUnitName, pu.is_default AS partUnitDefault"); + $qb->select("p.averagePrice, p.name, p.needsReview, p.createDate, p.id, p.stockLevel, p.minStockLevel, p.comment, st.id AS storageLocation_id, st.name as storageLocationName, f.id AS footprint_id, f.name AS footprintName, c.id AS category_id, c.name AS categoryName, pu.id AS partUnit, pu.name AS partUnitName, pu.is_default AS partUnitDefault"); $qb->orderBy($orderBy, $dir); if ($limit > -1) { $qb->setMaxResults($limit);