partkeepr

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

commit 693ac3256c628d480b26d786a5929887a7868ecc
parent bba388dd0700c8bfe790f32162d8cdff7b1c0f55
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat,  7 Nov 2015 18:36:51 +0100

Fixed stock report editing

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/StockReport/AbstractStockHistoryGrid.js | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/StockReport/AbstractStockHistoryGrid.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/StockReport/AbstractStockHistoryGrid.js @@ -124,15 +124,18 @@ Ext.define('PartKeepr.AbstractStockHistoryGrid', { * @param e Passed from ExtJS * @returns {Boolean} */ - onBeforeEdit: function (e) { + onBeforeEdit: function (editor, context, eOpts) { + var sameUser = false; // Checks if the usernames match - var sameUser = e.record.get("username") == PartKeepr.getApplication().getUsername(); + if (context.record.getUser() !== null) { + sameUser = context.record.getUser().getId() == PartKeepr.getApplication().getLoginManager().getUser().getId(); + } - switch (e.field) { + switch (context.field) { case "price": // Check the direction is "out". If yes, editing the price field is not allowed - if (e.record.get("direction") == "out") { + if (context.record.get("direction") == "out") { return false; }