diff --git a/src/crm/api/handler/EntityAPIHandler.php b/src/crm/api/handler/EntityAPIHandler.php index 105012d5..901f2090 100644 --- a/src/crm/api/handler/EntityAPIHandler.php +++ b/src/crm/api/handler/EntityAPIHandler.php @@ -40,6 +40,7 @@ public function getRecord($param_map=array(),$header_map=array()) foreach ($header_map as $key => $value) { if($value!==null)$this->addHeader($key, $value); } + $this->addHeader("Content-Type", "application/json"); $responseInstance = APIRequest::getInstance($this)->getAPIResponse(); $recordDetails = $responseInstance->getResponseJSON()['data']; @@ -52,7 +53,7 @@ public function getRecord($param_map=array(),$header_map=array()) } } - public function createRecord($trigger, $lar_id) + public function createRecord($trigger, $lar_id,$process) { try { if ($this->record->getEntityId() != NULL) { @@ -71,6 +72,9 @@ public function createRecord($trigger, $lar_id) if ($lar_id !== null) { $requestBodyObj["lar_id"] = $lar_id; } + if($process !== null && is_array($process) ){ + $requestBodyObj["process"] =$process; + } $this->requestBody = json_encode($requestBodyObj); @@ -90,7 +94,7 @@ public function createRecord($trigger, $lar_id) } } - public function updateRecord($trigger) + public function updateRecord($trigger,$process) { try { if ($this->record->getEntityId() == NULL) { @@ -106,7 +110,9 @@ public function updateRecord($trigger) if ($trigger !== null && is_array($trigger)) { $requestBodyObj["trigger"] = $trigger; } - + if($process !== null && is_array($process) ){ + $requestBodyObj["process"] =$process; + } $this->requestBody =json_encode( $requestBodyObj); $responseInstance = APIRequest::getInstance($this)->getAPIResponse(); diff --git a/src/crm/api/handler/MassEntityAPIHandler.php b/src/crm/api/handler/MassEntityAPIHandler.php index 74288279..9fde6e79 100644 --- a/src/crm/api/handler/MassEntityAPIHandler.php +++ b/src/crm/api/handler/MassEntityAPIHandler.php @@ -24,7 +24,7 @@ public static function getInstance($moduleInstance) return new MassEntityAPIHandler($moduleInstance); } - public function createRecords($records, $trigger,$lar_id) + public function createRecords($records, $trigger,$lar_id,$process) { if (sizeof($records) > 100) { throw new ZCRMException(APIConstants::API_MAX_RECORDS_MSG, APIConstants::RESPONSECODE_BAD_REQUEST); @@ -49,6 +49,9 @@ public function createRecords($records, $trigger,$lar_id) if ($lar_id !== null) { $requestBodyObj["lar_id"] = $lar_id; } + if($process !== null && is_array($process) ){ + $requestBodyObj["process"] =$process; + } $this->requestBody = $requestBodyObj; @@ -77,7 +80,7 @@ public function createRecords($records, $trigger,$lar_id) } } - public function upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields) + public function upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields,$process) { if (sizeof($records) > 100) { throw new ZCRMException(APIConstants::API_MAX_RECORDS_MSG, APIConstants::RESPONSECODE_BAD_REQUEST); @@ -106,6 +109,9 @@ public function upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields if ($lar_id !== null) { $requestBodyObj["lar_id"] = $lar_id; } + if($process !== null && is_array($process) ){ + $requestBodyObj["process"] =$process; + } $this->requestBody = $requestBodyObj; // Fire Request @@ -133,7 +139,7 @@ public function upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields } } - public function updateRecords($records, $trigger) + public function updateRecords($records, $trigger,$process) { if (sizeof($records) > 100) { throw new ZCRMException(APIConstants::API_MAX_RECORDS_MSG, APIConstants::RESPONSECODE_BAD_REQUEST); @@ -155,6 +161,9 @@ public function updateRecords($records, $trigger) if ($trigger !== null && is_array($trigger)) { $requestBodyObj["trigger"] = $trigger; } + if($process !== null && is_array($process) ){ + $requestBodyObj["process"] =$process; + } $this->requestBody = $requestBodyObj; diff --git a/src/crm/crud/ZCRMModule.php b/src/crm/crud/ZCRMModule.php index 64ec698a..6cdcadbe 100644 --- a/src/crm/crud/ZCRMModule.php +++ b/src/crm/crud/ZCRMModule.php @@ -1152,9 +1152,9 @@ public function massUpdateRecords($entityIds, $fieldApiName, $value) * @param string $lar_id lead assignment rule id * @return BulkAPIResponse instance of the BulkAPIResponse class which holds the Bulk API response. */ - public function updateRecords($records, $trigger = null) + public function updateRecords($records, $trigger = null,$process = null) { - return MassEntityAPIHandler::getInstance($this)->updateRecords($records, $trigger); + return MassEntityAPIHandler::getInstance($this)->updateRecords($records, $trigger,$process); } /** @@ -1165,9 +1165,9 @@ public function updateRecords($records, $trigger = null) * @param string $lar_id lead assignment rule id * @return BulkAPIResponse instance of the BulkAPIResponse class which holds the Bulk API response. */ - public function createRecords($records, $trigger = null,$lar_id = null) + public function createRecords($records, $trigger = null,$lar_id = null,$process = null) { - return MassEntityAPIHandler::getInstance($this)->createRecords($records, $trigger,$lar_id); + return MassEntityAPIHandler::getInstance($this)->createRecords($records, $trigger,$lar_id,$process); } /** @@ -1178,9 +1178,9 @@ public function createRecords($records, $trigger = null,$lar_id = null) * @param string $lar_id lead assignment rule id * @return BulkAPIResponse instance of the BulkAPIResponse class which holds the Bulk API response. */ - public function upsertRecords($records, $trigger = null,$lar_id = null,$duplicate_check_fields=null) + public function upsertRecords($records, $trigger = null,$lar_id = null,$duplicate_check_fields=null,$process = null) { - return MassEntityAPIHandler::getInstance($this)->upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields); + return MassEntityAPIHandler::getInstance($this)->upsertRecords($records, $trigger,$lar_id,$duplicate_check_fields,$process); } /** diff --git a/src/crm/crud/ZCRMRecord.php b/src/crm/crud/ZCRMRecord.php index fb7498b6..0c9d0b3e 100644 --- a/src/crm/crud/ZCRMRecord.php +++ b/src/crm/crud/ZCRMRecord.php @@ -588,14 +588,14 @@ public function getRecordRowNumber() * @return APIResponse instance of the APIResponse class which holds the API response. * */ - public function create( $trigger = null,$lar_id = null) + public function create( $trigger = null,$lar_id = null,$process = null) { if (self::getEntityId() != null) { $exception = new ZCRMException("Entity ID MUST be null for create operation.", APIConstants::RESPONSECODE_BAD_REQUEST); $exception->setExceptionCode("ID EXIST"); throw $exception; } - return EntityAPIHandler::getInstance($this)->createRecord($trigger ,$lar_id); + return EntityAPIHandler::getInstance($this)->createRecord($trigger ,$lar_id,$process); } /** @@ -605,14 +605,14 @@ public function create( $trigger = null,$lar_id = null) * @throws ZCRMException if Entity ID of the record is NULL * @return APIResponse instance of the APIResponse class which holds the API response. */ - public function update( $trigger = null) + public function update( $trigger = null,$process = null) { if (self::getEntityId() == null) { $exception = new ZCRMException("Entity ID MUST NOT be null for update operation.", APIConstants::RESPONSECODE_BAD_REQUEST); $exception->setExceptionCode("ID MISSING"); throw $exception; } - return EntityAPIHandler::getInstance($this)->updateRecord($trigger ); + return EntityAPIHandler::getInstance($this)->updateRecord($trigger,$process); } /**