diff --git a/CMRF_Drupal/Call.php b/CMRF_Drupal/Call.php index c490f37..69c4ff1 100644 --- a/CMRF_Drupal/Call.php +++ b/CMRF_Drupal/Call.php @@ -21,7 +21,7 @@ class Call extends AbstractCall { public static function createNew($connector_id, $core, $entity, $action, $parameters, $options, $callback) { $call = new Call($core, $connector_id); - + // compile request $call->request = $call->compileRequest($parameters, $options); $call->request['entity'] = $entity; @@ -31,7 +31,7 @@ public static function createNew($connector_id, $core, $entity, $action, $parame $call->record = array( 'status' => CallInterface::STATUS_INIT, 'connector_id' => $call->getConnectorID(), - 'request' => json_encode($call->request), + 'request' => json_encode($call->request), 'metadata' => '{}', 'request_hash' => $call->getHash(), 'create_date' => date('YmdHis'), @@ -50,7 +50,7 @@ public static function createNew($connector_id, $core, $entity, $action, $parame public static function createWithRecord($connector_id, $core, $record) { $call = new Call($core, $connector_id, $record->cid); $call->record = json_decode(json_encode($record), TRUE); - $call->request = json_decode($call->record['request'], TRUE); + $call->request = json_decode($call->record['request'], TRUE); $call->reply = json_decode($call->record['reply'], TRUE); return $call; } @@ -107,9 +107,18 @@ public function triggerCallback() { public function setStatus($status, $error_message, $error_code = NULL) { - $this->data['status'] = $status; - $this->data['error_message'] = $error_message; - $this->data['error_code'] = $error_code; + $error = array( + 'is_error' => '1', + 'error_message' => $error_message, + 'error_code' => $error_code); + + // update the DB + $update = array( + 'cid' => $this->id, + 'status' => $status, + 'reply_date' => date('YmdHis'), + 'reply' => json_encode($error)); + drupal_write_record('cmrf_core_call', $update, array('cid')); } } diff --git a/cmrf_core.info b/cmrf_core.info index 737a661..a287bb9 100644 --- a/cmrf_core.info +++ b/cmrf_core.info @@ -3,8 +3,6 @@ description = CMRF CiviCRM REST Connection core = 7.x ; Information added by Drupal.org packaging script on 2014-10-18 -version = "7.x-1.x-dev" -core = "7.x" -project = "drupal_module_boilerplate" -datestamp = "1413658731" - +project = "cmrf_core" +version = "7.x-0.1" +datestamp = "1492613168" \ No newline at end of file