partkeepr

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

commit 8c2c003c6558b9849d8acc5160765e893f8a1c57
parent 6224a3eba7224d1f3da9944f8a573d3677fbf6e5
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun, 25 Mar 2012 04:22:13 +0200

If no storageLocation ID is set, assume a string and search the storage locations by string, then inject them into the record. Fixes issue #118

Diffstat:
Msrc/frontend/js/Components/Part/Editor/PartEditor.js | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/frontend/js/Components/Part/Editor/PartEditor.js b/src/frontend/js/Components/Part/Editor/PartEditor.js @@ -269,6 +269,19 @@ Ext.define('PartKeepr.PartEditor', { this.record.manufacturers().remove(removeRecords); } + /** + * Check if the storage location is valid. If not, try an exact, case-insensitive match for the + * storage location name and inject that into the record. + */ + if (isNaN(this.record.get("storageLocation"))) { + var storageLocationRecord = this.storageLocationComboBox.getStore().findRecord( + "name", + this.storageLocationComboBox.getValue(), + 0, false, false, true) ; + + this.record.set("storageLocation", storageLocationRecord.get("id")); + } + }, onEditStart: function () { this.bindChildStores();