Permalink
Browse files

If no storageLocation ID is set, assume a string and search the stora…

…ge locations by string, then inject them into the record. Fixes issue #118
  • Loading branch information...
1 parent 6224a3e commit 8c2c003c6558b9849d8acc5160765e893f8a1c57 @felicitus felicitus committed Mar 25, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 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();

0 comments on commit 8c2c003

Please sign in to comment.