Commit 9af2f73503c42ea2fa2ee360fa7138d146d96627
1 parent
869d301b
fix for KTS-715
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5166 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
13 additions
and
5 deletions
lib/metadata/metadatautil.inc.php
| ... | ... | @@ -105,6 +105,14 @@ class KTMetadataUtil { |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $GLOBALS['default']->log->debug('KTMetadataUtil::_getNextForBehaviour, final values are ' . print_r($aValues, true)); |
| 108 | + | |
| 109 | + // now we need to clean this up: remove no-value entries. | |
| 110 | + $temp = $aValues; | |
| 111 | + foreach ($temp as $k => $v) { | |
| 112 | + if (empty($v)) { | |
| 113 | + unset($aValues[$k]); | |
| 114 | + } | |
| 115 | + } | |
| 108 | 116 | return $aValues; |
| 109 | 117 | } |
| 110 | 118 | // }}} |
| ... | ... | @@ -560,12 +568,12 @@ class KTMetadataUtil { |
| 560 | 568 | $aFields = DBUtil::getResultArrayKey($aQuery, 'field_id'); |
| 561 | 569 | $GLOBALS['default']->log->debug(" actual fields are " . print_r($aNextFields, true)); |
| 562 | 570 | foreach ($aNextFields as $iFieldId) { |
| 563 | - if (!in_array($iFieldId, $aFields)) { | |
| 571 | + /*if (!in_array($iFieldId, $aFields)) { | |
| 564 | 572 | $GLOBALS['default']->log->debug(" field $iFieldId is not included, failing"); |
| 565 | 573 | $oChildField =& DocumentField::get($iFieldId); |
| 566 | 574 | $sChildFieldName = $oChildField->getName(); |
| 567 | 575 | return PEAR::raiseError("Child field $sChildFieldName of parent field $sParentFieldName has no selectable values in behaviour $sBehaviourHumanName ($sBehaviourName)"); |
| 568 | - } | |
| 576 | + }*/ | |
| 569 | 577 | } |
| 570 | 578 | } |
| 571 | 579 | $GLOBALS['default']->log->debug("Got through: passed!"); | ... | ... |
lib/widgets/fieldsetDisplay.inc.php
| ... | ... | @@ -54,7 +54,7 @@ require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php"); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /* it may be useful to move this to a factory, eventually? */ |
| 57 | -function getWidgetForMetadataField($field, $current_value, $page, $errors = null, $vocab = null) { | |
| 57 | +function getWidgetForMetadataField($field, $current_value, $page, $errors = null, $vocab = null, $aOptions = null) { | |
| 58 | 58 | // all fields have these elements. |
| 59 | 59 | $fieldLabel = $field->getName(); |
| 60 | 60 | $fieldDescription = $field->getDescription(); |
| ... | ... | @@ -62,7 +62,7 @@ function getWidgetForMetadataField($field, $current_value, $page, $errors = null |
| 62 | 62 | $fieldErrors = $errors; // array of strings |
| 63 | 63 | $fieldName = 'metadata_' . $field->getID(); |
| 64 | 64 | $fieldOptions = array(); |
| 65 | - $fieldRequired = $field->getIsMandatory(); | |
| 65 | + $fieldRequired = $field->getIsMandatory() || KTUtil::arrayGet($aOptions, 'required', false); | |
| 66 | 66 | if ($fieldRequired == 1) { |
| 67 | 67 | $fieldRequired = true; |
| 68 | 68 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/ajaxConditional.php
| ... | ... | @@ -84,7 +84,7 @@ class AjaxConditionalDispatcher extends KTStandardDispatcher { |
| 84 | 84 | $vocab = array(); |
| 85 | 85 | $vocab[''] = 'Unset'; |
| 86 | 86 | foreach ($aFieldInfo['values'] as $md_v) { $vocab[$md_v->getName()] = $md_v->getName(); } |
| 87 | - $oWidget = getWidgetForMetadataField($aFieldInfo['field'], null, $main, null, $vocab) ; | |
| 87 | + $oWidget = getWidgetForMetadataField($aFieldInfo['field'], null, $main, null, $vocab, array('required' => true)) ; | |
| 88 | 88 | $sWidgets .= $oWidget->render(); |
| 89 | 89 | } |
| 90 | 90 | ... | ... |