From 235154ae59b0f12d9a6577801dcf2892305d4e54 Mon Sep 17 00:00:00 2001 From: sergem Date: Tue, 27 Oct 2009 14:50:53 +0200 Subject: [PATCH] Modified the get_metadata clienttools api call to work with largetext and multiselects --- webservice/clienttools/services/0.2/kt.php | 63 +++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/webservice/clienttools/services/0.2/kt.php b/webservice/clienttools/services/0.2/kt.php index ef29255..c27334e 100644 --- a/webservice/clienttools/services/0.2/kt.php +++ b/webservice/clienttools/services/0.2/kt.php @@ -368,29 +368,48 @@ class kt extends client_service { } $items[]=array("name"=>"__document_type", "index"=>0, "value"=>$document_type, "control_type"=>"lookup", "selection"=>$json_document_types); + foreach ($detail as $fieldset) { + foreach ($fieldset['fields'] as $field) { + + $prepArray = array( + 'fieldset' => $fieldset['fieldset'], + 'name' => $field['name'], + + // Change for value. If blank value is set to 1, change value to '' + // Overcomes issue of n/a + 'value' => ($document_id > 0 ? ($field['blankvalue'] == '1' ? '' : $field['value']) : ''), + + 'description' => $field['description'], + 'control_type' => $field['control_type'], + 'selection' => $field['selection'], + 'required' => $field['required'], + 'blankvalue' => $field['blankvalue'], + 'index' => $index + ); + + // Small Adjustment for multiselect to real type + if ($field['control_type'] == 'multiselect') { + $prepArray['control_type'] = $field['options']['type']; + } + + + if (isset($field['options']['ishtml'])) { + $prepArray['ishtml'] = $field['options']['ishtml']; + } else { + $prepArray['ishtml'] = '0'; + } + + if (isset($field['options']['maxlength'])) { + $prepArray['maxlength'] = $field['options']['maxlength']; + } else { + $prepArray['maxlength'] = '-1'; + } + + $items[] = $prepArray; + $index++; + } + } - for($i=0;$i$detail[$i]['fieldset'], - 'name'=>$detail[$i]['fields'][$j]['name'], - - // Change for value. If blank value is set to 1, change value to '' - // Overcomes issue of n/a - 'value'=>($document_id > 0 ? ($detail[$i]['fields'][$j]['blankvalue']=='1' ? '' : $detail[$i]['fields'][$j]['value']) : ''), - - 'description'=>$detail[$i]['fields'][$j]['description'], - 'control_type'=>$detail[$i]['fields'][$j]['control_type'], - 'selection'=>$detail[$i]['fields'][$j]['selection'], - 'required'=>$detail[$i]['fields'][$j]['required'], - 'blankvalue'=>$detail[$i]['fields'][$j]['blankvalue'], - 'index'=>$index - ); - $index++; - } - } $this->setResponse(array('id'=>$title, 'items'=>$items, 'count'=>count($items))); -- libgit2 0.21.4