Changeset 32078


Ignore:
Timestamp:
11/23/17 13:38:01 (3 years ago)
Author:
kjdon
Message:

only record deleted metadata changes if the field value was non empty. Otherwise if the user adds a field then deletes it, it will send off a delete meta request with an empty value, and something else will get deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/documentedit_scripts_util.js

    r32060 r32078  
    336336  var metadataChanges = new Array();
    337337  if (_deletedMetadata.length > 0) {
    338     addCollectionToBuild(collection);
    339338
    340339    for(var i = 0; i < _deletedMetadata.length; i++) {
     
    353352      var valueCell = cells[1];
    354353      var value = valueCell.getElementsByTagName("TEXTAREA")[0].value;
    355       metadataChanges.push({type:'delete', docID:docID, name:name, value:value});
     354    if (value.length) {
     355        // check for non empty value, in case all they have done is add a field then deleted it.
     356        metadataChanges.push({type:'delete', docID:docID, name:name, value:value});
     357        addCollectionToBuild(collection);
     358    }
    356359      removeFromParent(currentRow);
    357360    }
Note: See TracChangeset for help on using the changeset viewer.