mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
[D4CRIS-1080] Fix issue where a replace patch operation was dispatched instead of an add one when field's previous value is empty
This commit is contained in:
@@ -389,7 +389,7 @@ export class SectionFormOperationsService {
|
||||
this.operationsBuilder.add(
|
||||
pathCombiner.getPath(segmentedPath),
|
||||
value, true);
|
||||
} else if (previousValue.isPathEqual(this.formBuilder.getPath(event.model)) || hasStoredValue) {
|
||||
} else if (previousValue.isPathEqual(this.formBuilder.getPath(event.model)) || (hasStoredValue && isNotEmpty(previousValue.value)) ) {
|
||||
// Here model has a previous value changed or stored in the server
|
||||
if (hasValue(event.$event) && hasValue(event.$event.previousIndex)) {
|
||||
if (event.$event.previousIndex < 0) {
|
||||
@@ -422,7 +422,7 @@ export class SectionFormOperationsService {
|
||||
previousValue.delete();
|
||||
} else if (value.hasValue()) {
|
||||
// Here model has no previous value but a new one
|
||||
if (isUndefined(this.getArrayIndexFromEvent(event)) || this.getArrayIndexFromEvent(event) === 0) {
|
||||
if (isUndefined(this.getArrayIndexFromEvent(event)) || this.getArrayIndexFromEvent(event) === 0) {
|
||||
// Model is single field or is part of an array model but is the first item,
|
||||
// so dispatch an add operation that initialize the values of a specific metadata
|
||||
this.operationsBuilder.add(
|
||||
|
Reference in New Issue
Block a user