Skip to content

Commit

Permalink
added create Activity functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianblum committed Nov 20, 2014
1 parent 937a2ea commit f23fd22
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 1 deletion.
Empty file modified Visionline/Crm/WebApi/Cache.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/CacheEntry.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Connection.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/CreateEnquiryResult.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Enquiry.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/EntityType.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/EnumFieldsResult.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Expression.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/FileCache.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/FileGetOperation.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/FileOperation.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/FilePassthruOperation.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/FileSaveOperation.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Filter.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Interest.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Junction.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Language.php
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions Visionline/Crm/WebApi/Operator.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ class Operator
* @var string
*/
const InPreviousYear = 'InPreviousYear';

/**
* String contains another string
*/
const Contains = 'Contains';
}

?>
Empty file modified Visionline/Crm/WebApi/Order.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/Query.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/QueryResult.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/RelatedQueryResult.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/RelatedRoleQueryResult.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/ResizeMode.php
100755 → 100644
Empty file.
Empty file modified Visionline/Crm/WebApi/UriBuilder.php
100755 → 100644
Empty file.
90 changes: 89 additions & 1 deletion Visionline/Crm/WebApi/WebApi.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class WebApi
* The connection to the CRM-VISIONLINE system
* @var Connection
*/
private $connection;
public $connection;

/**
* Specifies whether debugging is enabled or not.
Expand Down Expand Up @@ -494,6 +494,74 @@ public function _Get($type, array $ids, array $fields)
}
return $result;
}

/**
* Calls the webservice method Create with the specified arguments
* @param string $type the entity type
* @param array $fieldValues the field values to assign to the created entity (associative array of string)
* @throws \SoapFault if a remote error occurs
* @return int The id of the created entity
*/
public function _Create($type, array $fieldValues)
{
try
{
$fieldValuesArray = array();
foreach ($fieldValues as $field => $value) {
$fieldValuesArray[] = array(
'field' => $field,
'value' => $value
);
}

$id = $this->client->Create($this->connection, $type, $fieldValuesArray);

$this->debug('Create - Result is', $id);
$this->debug('Create - Request was', $this->client->__getLastRequest());
$this->debug('Create - Response was', $this->client->__getLastResponse());
}
catch (\SoapFault $e)
{
$this->debug('Create - Request was', $this->client->__getLastRequest());
$this->debug('Create - Response was', $this->client->__getLastResponse());

throw $e;
}
return $id;
}

/**
* Calls the webservice method Update with the specified arguments
* @param string $type the entity type
* @param int $id the id of the entity to be updated
* @param array $fieldValues the field values to set (associative array of string)
* @throws \SoapFault if a remote error occurs
*/
public function _Update($type, $id, array $fieldValues)
{
try
{
$fieldValuesArray = array();
foreach ($fieldValues as $field => $value) {
$fieldValuesArray[] = array(
'field' => $field,
'value' => $value
);
}

$this->client->Update($this->connection, $type, $id, $fieldValuesArray);

$this->debug('Update - Request was', $this->client->__getLastRequest());
$this->debug('Update - Response was', $this->client->__getLastResponse());
}
catch (\SoapFault $e)
{
$this->debug('Update - Request was', $this->client->__getLastRequest());
$this->debug('Update - Response was', $this->client->__getLastResponse());

throw $e;
}
}

/**
* Calls the webservice method EnumFields with the specified arguments
Expand Down Expand Up @@ -1074,6 +1142,26 @@ public function queryContactImages($which)
return $flatResults;
}

/**
* Creates an entity of the specified type and sets its fields to the specified values.
* @param string $type The type of the entity to create
* @param array $values The values to which the entities fields should be set (associative array where the key is the field identifier and the value the field´s value)
* @return int The id of the created entity
*/
public function create($type, array $values) {
return $this->_Create($type, $values);
}

/**
* Updates the entity of the specified type with the specified id and sets it´s fields to the specified values.
* @param string $type The type of the entity to update
* @param int $id The id of the entity to update
* @param array $values The values to which the entity´s fields should be set (associative array where the key is the field identifier and the value the field´s value)
*/
public function update($type, $id, array $values) {
$this->_Update($type, $id, $values);
}

/**
* Gets the values of the fields for the specified entities.
* @param string $type The entity type
Expand Down

0 comments on commit f23fd22

Please sign in to comment.