Merge branch 'ocs_api_fix_success_code' into oc_api_tests

This commit is contained in:
tomneedham 2013-11-14 00:41:04 +00:00
commit b06682b7fb
1 changed files with 13 additions and 2 deletions

View File

@ -173,7 +173,7 @@ class OC_API {
$response = reset($thirdparty['failed']);
return $response;
} else {
$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
$responses = $thirdparty['succeeded'];
}
// Merge the successful responses
$meta = array();
@ -185,8 +185,19 @@ class OC_API {
} else {
$data = array_merge_recursive($data, $response['response']->getData());
}
$codes[] = $response->getStatusCode();
}
$result = new OC_OCS_Result($data, 100);
// Use any non 100 status codes
$statusCode = 100;
foreach($codes as $code) {
if($code != 100) {
$statusCode = $code;
break;
}
}
$result = new OC_OCS_Result($data, $statusCode);
return $result;
}