Fixed Userfield initialization on /purchase and /inventory (fixes #2581)

This commit is contained in:
Bernd Bestel
2025-01-12 17:40:39 +01:00
parent b706f0c65a
commit 7d6b76effb
4 changed files with 13 additions and 4 deletions

View File

@@ -53,7 +53,7 @@
### Userfields ### Userfields
- xxx - Fixed that Userfield default values were not initialized for the `stock` entity (so affecting the purchase and inventory page)
### General ### General

View File

@@ -548,3 +548,5 @@ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
} }
}); });
} }
Grocy.Components.UserfieldsForm.Load();

View File

@@ -738,3 +738,5 @@ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
} }
}); });
} }
Grocy.Components.UserfieldsForm.Load();

View File

@@ -111,13 +111,18 @@ $("#type").on("change", function(e)
$("#default-value-group.userfield-type-" + value).removeClass("d-none"); $("#default-value-group.userfield-type-" + value).removeClass("d-none");
}); });
$('#entity').focus();
if (GetUriParam("entity")) if (GetUriParam("entity"))
{ {
$("#entity").val(GetUriParam("entity")); $("#entity").val(GetUriParam("entity"));
$("#entity").trigger("change"); $("#entity").trigger("change");
setTimeout(function()
{
$('#name').focus(); $('#name').focus();
}, 500);
}
else
{
$('#entity').focus();
} }
$("#type").trigger("change"); $("#type").trigger("change");