partkeepr

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

commit f832324b8254bdc386adc491b35da1f5b48f7cba
parent b99405305394e55ad6ba35899a5c05d4666c8d15
Author: Felicitus <felicitus@felicitus.org>
Date:   Thu,  5 Apr 2012 06:30:16 +0200

Added comments for the stock entries

Diffstat:
Msrc/backend/de/RaumZeitLabor/PartKeepr/Stock/StockEntry.php | 24++++++++++++++++++++++++
Msrc/backend/de/RaumZeitLabor/PartKeepr/Stock/StockService.php | 1+
Msrc/frontend/js/Components/StockReport/AbstractStockHistoryGrid.js | 13+++++++++++++
Msrc/frontend/js/Models/StockEntry.js | 3++-
4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Stock/StockEntry.php b/src/backend/de/RaumZeitLabor/PartKeepr/Stock/StockEntry.php @@ -45,6 +45,13 @@ class StockEntry extends BaseEntity implements Serializable { private $correction; /** + * @Column(type="string",nullable=true) + * @var string + */ + private $comment; + + + /** * Creates a new stock entry. A stock entry tracks how many parts * were the stockLevel is the amount of items added/removed, * by which user and how much the user paid for it (for adding parts only!) @@ -195,6 +202,22 @@ class StockEntry extends BaseEntity implements Serializable { } /** + * Sets a comment + * @param string $comment + */ + public function setComment ($comment) { + $this->comment = $comment; + } + + /** + * Returns the comment + * @return string The comment + */ + public function getComment () { + return $this->comment; + } + + /** * (non-PHPdoc) * @see de\RaumZeitLabor\PartKeepr\Util.Serializable::serialize() */ @@ -207,6 +230,7 @@ class StockEntry extends BaseEntity implements Serializable { "username" => is_object($this->getUser()) ? $this->getUser()->getUsername() : PartKeepr::i18n("Unknown User"), "user_id" => is_object($this->getUser()) ? $this->getUser()->getId() : null, "stockLevel" => abs($this->getStockLevel()), + "comment" => $this->getComment(), "dateTime" => $this->getDateTime()->format("Y-m-d H:i:s"), "direction" => ($this->getStockLevel() < 0) ? "out" : "in", "price" => $this->getPrice() diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Stock/StockService.php b/src/backend/de/RaumZeitLabor/PartKeepr/Stock/StockService.php @@ -81,6 +81,7 @@ class StockService extends Service implements RestfulService { } + $stockEntry->setComment($this->getParameter("comment")); PartKeepr::getEM()->flush(); return array("data" => $stockEntry->serialize()); diff --git a/src/frontend/js/Components/StockReport/AbstractStockHistoryGrid.js b/src/frontend/js/Components/StockReport/AbstractStockHistoryGrid.js @@ -55,6 +55,14 @@ Ext.define('PartKeepr.AbstractStockHistoryGrid', { return val; } } + },{ + header: i18n("Comment"), + dataIndex: 'comment', + width: 60, + editor: { + xtype:'textfield', + allowBlank:true + } }]; }, model: 'PartKeepr.StockEntry', @@ -135,6 +143,11 @@ Ext.define('PartKeepr.AbstractStockHistoryGrid', { return false; } break; + case "comment": + if ( !sameUser && !PartKeepr.getApplication().isAdmin()) { + return false; + } + break; default: return true; } diff --git a/src/frontend/js/Models/StockEntry.js b/src/frontend/js/Models/StockEntry.js @@ -9,6 +9,7 @@ Ext.define("PartKeepr.StockEntry", { { name: 'storageLocation_name', type: 'string'}, { name: 'direction', type: 'string'}, { name: 'part_name', type: 'string'}, - { name: 'price', type: 'float'} + { name: 'price', type: 'float'}, + { name: 'comment', type: 'string'} ] }); \ No newline at end of file