Remove redundant stockType field mapping, refactor location handling in identifier mapper, and update related tests.
This commit is contained in:
@@ -118,7 +118,6 @@ export function mapLookupItemToForm({
|
||||
setField('identifierCode', textValue('identifier_code'));
|
||||
setField('name', textValue('name'));
|
||||
setField('description', textValue('description'));
|
||||
setField('stockType', textValue('stock_type'));
|
||||
setField('level', textValue('level'));
|
||||
setField('quantity', numberValue('quantity_initial'));
|
||||
setField('uom', textValue('uom_symbol'));
|
||||
@@ -138,14 +137,14 @@ export function mapLookupItemToForm({
|
||||
setField('expirationDate', '');
|
||||
}
|
||||
|
||||
const canSetLocation = !String(nextForm.locationId || '').trim();
|
||||
const locationUuid = nonEmptyText(lookupItem?.location_initial_uuid_b64);
|
||||
if (canSetLocation && locationUuid) {
|
||||
if (locationUuid) {
|
||||
const matchingLocation = locations.find((entry) => entry.uuid_b64 === locationUuid);
|
||||
if (matchingLocation) {
|
||||
nextForm.locationId = String(matchingLocation.id);
|
||||
nextLocationSearch = matchingLocation.name;
|
||||
didUpdate = true;
|
||||
setField('locationId', String(matchingLocation.id));
|
||||
if (nextLocationSearch !== matchingLocation.name) {
|
||||
nextLocationSearch = matchingLocation.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user