commit dd8cd15d641cad71b71d022f92c66a9431bebdd2
parent ffcbaed4cca213f1f709528b9e2c2d2f2a3e42a1
Author: Felicia Hummel <felicia@partkeepr.com>
Date: Fri, 10 Feb 2017 10:57:34 +0100
Emit an error when the selected CSV file does not contain enough columns, fixes #812
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Importer/Importer.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Importer/Importer.js
@@ -447,6 +447,7 @@ Ext.define("PartKeepr.Importer.Importer", {
store.add(recordData);
this.down("#sourceFileGrid").reconfigure(store, columns);
+ this.validateConfig();
},
validateConfig: function ()
{
@@ -461,6 +462,14 @@ Ext.define("PartKeepr.Importer.Importer", {
switch (node.data.data.type) {
case "field":
+ if (configuration.fieldConfiguration && configuration.fieldConfiguration === "copyFrom") {
+ if (this.down("#sourceFileGrid").getColumns().length - 1 < configuration.copyFromField) {
+ this.appendError(node, i18n(
+ "The selected CSV file does not contain enough columns to fulfill the configuration"
+ ));
+ }
+ }
+
if (node.data.required) {
if (configuration.fieldConfiguration) {
switch (configuration.fieldConfiguration) {