Commit a7d60ab4c37d8481cf713ac447439f4f6a3a9c13

Authored by Paul Barrett
1 parent 94118e55

Retrieve conditional metadata in ktapi get_metadata, do not insert n/a for previously blank values

KTS-4605 Conditional Metadata not working in KTAPI get_metadata(SUP-2537)

Fixed

Committed by: Paul Barrett

Reviewed by: Megan Watson
Showing 1 changed file with 7 additions and 2 deletions
ktapi/KTAPIDocument.inc.php
... ... @@ -1253,7 +1253,9 @@ class KTAPI_Document extends KTAPI_FolderItem
1253 1253  
1254 1254 foreach ($fieldsets as $fieldset)
1255 1255 {
1256   - if ($fieldset->getIsConditional()) { /* this is not implemented...*/ continue; }
  1256 + // this line caused conditional metadata to not be present, and it is there when this is commented out;
  1257 + // if there are problems with conditional metadata in future, check here to make sure this is not the cause
  1258 +// if ($fieldset->getIsConditional()) { /* this is not implemented...*/ continue; }
1257 1259  
1258 1260 $fields = $fieldset->getFields();
1259 1261 $result = array('fieldset' => $fieldset->getName(),
... ... @@ -1400,7 +1402,10 @@ class KTAPI_Document extends KTAPI_FolderItem
1400 1402 if (is_array($fieldinfo))
1401 1403 {
1402 1404 $fieldname = $fieldinfo['name'];
1403   - $value = $fieldinfo['value'];
  1405 + // if the 'blankvalue' argument was set to 1 (true) then do not use the current value;
  1406 + // this prevents the 'n/a' values set for blank fields on get_metadata from being saved as such
  1407 + // while allowing user entered values of 'n/a' to be saved
  1408 + $value = $fieldinfo['blankvalue'] ? '' : $fieldinfo['value'];
1404 1409 }
1405 1410 elseif ($fieldinfo instanceof stdClass) // is_a($fieldinfo, 'stdClass'))
1406 1411 {
... ...