diff --git a/webservice/clienttools/client_service.php b/webservice/clienttools/client_service.php index f3c5275..addca68 100644 --- a/webservice/clienttools/client_service.php +++ b/webservice/clienttools/client_service.php @@ -67,6 +67,16 @@ class client_service{ return true; } + /** + * Forces parameter to boolean. + * $isTrue array contains a list of values that are recognized as 'true' values in boolean + */ + protected function bool($var=NULL){ + $isTrue=Array('true','0','yes'); + if(is_bool($var))return $var; + return (in_array(strtolower(trim((string)$var)),$isTrue)); + } + } ?> \ No newline at end of file diff --git a/webservice/clienttools/services/0.9/kt.php b/webservice/clienttools/services/0.9/kt.php index 232436c..bc9f8b7 100644 --- a/webservice/clienttools/services/0.9/kt.php +++ b/webservice/clienttools/services/0.9/kt.php @@ -532,10 +532,9 @@ class kt extends client_service { $filename = $params ['filename']; $reason = $params ['reason']; $tempfilename = $params ['tempfilename']; - $major_update = $params ['major_update']; + $major_update = $this->bool($params); //Force value into boolean container. $application = $this->AuthInfo ['appType']; - $this->addDebug ( 'Checkin', "checkin_document('$session_id',$document_id,'$filename','$reason','$tempfilename', '$application', $major_update)" ); $kt = &$this->KT; // we need to add some security to ensure that people don't frig the checkin process to access restricted files. @@ -552,6 +551,7 @@ class kt extends client_service { } // checkin + $this->logInfo('kt.checkin_document','Parameter Inspector',$major_update); $result = $document->checkin ( $filename, $reason, $tempfilename, $major_update ); if (PEAR::isError ( $result )) { $this->setResponse ( array ('status_code' => 14 ) ); @@ -578,6 +578,7 @@ class kt extends client_service { $metadata = array (); $packed = $arr ['metadata']; + //TODO: $meta is undefined - please revise foreach ( $meta as $item ) { $fieldSet = $item ['fieldset']; unset ( $item ['fieldset'] ); @@ -604,7 +605,7 @@ class kt extends client_service { $document = &$folder->add_document ( $arr ['title'], $arr ['filename'], $arr ['documenttype'], $arr ['tempfilename'] ); if (PEAR::isError ( $document )) { - $this->addError ( "Could not add Document [title:{$title},filename:{$filename},documenttype:{$documenttype},tempfilename:{$tempfilename}]" ); + $this->addError ( "Could not add Document [title:{$arr['title']},filename:{$arr['filename']},documenttype:{$arr['documenttype']},tempfilename:{$arr['tempfilename']}]" ); $this->setResponse ( array ('status_code' => 1, 'message' => 'Could not add Document' ) ); return false; }