Skip to content

Commit 3c9b297

Browse files
author
Mplus Software
committed
Update to v0.9.6
Support for API protocol v0.9.6 createProduct now also returns created articleNumbers, besides productNumber. updateProduct now also returns created (newArticleNumbers) and updated (existingArticleNumbers), besides productNumber. Bugfix in updateProduct result processing.
1 parent 53c8c79 commit 3c9b297

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

Mplusqapiclient.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
class MplusQAPIclient
44
{
5-
const CLIENT_VERSION = '0.9.5';
5+
const CLIENT_VERSION = '0.9.6';
66

77
var $MIN_API_VERSION_MAJOR = 0;
88
var $MIN_API_VERSION_MINOR = 9;
9-
var $MIN_API_VERSION_REVIS = 1;
9+
var $MIN_API_VERSION_REVIS = 6;
1010

1111
var $MAX_API_VERSION_MAJOR = 0;
1212
var $MAX_API_VERSION_MINOR = 9;
13-
var $MAX_API_VERSION_REVIS = 1;
13+
var $MAX_API_VERSION_REVIS = 6;
1414

1515
var $debug = false;
1616

@@ -509,7 +509,6 @@ public function createProduct($product)
509509
try {
510510
$result = $this->client->createProduct($this->parser->convertProduct($product));
511511
return $this->parser->parseCreateProductResult($result);
512-
513512
} catch (SoapFault $e) {
514513
throw new MplusQAPIException('SoapFault occurred: '.$e->getMessage(), 0, $e);
515514
} catch (Exception $e) {
@@ -524,7 +523,6 @@ public function updateProduct($product)
524523
try {
525524
$result = $this->client->updateProduct($this->parser->convertProduct($product));
526525
return $this->parser->parseUpdateProductResult($result);
527-
528526
} catch (SoapFault $e) {
529527
throw new MplusQAPIException('SoapFault occurred: '.$e->getMessage(), 0, $e);
530528
} catch (Exception $e) {
@@ -1948,18 +1946,34 @@ public function parseUpdateRelationResult($soapUpdateRelationResult) {
19481946
public function parseCreateProductResult($soapCreateProductResult) {
19491947
if (isset($soapCreateProductResult->result) and $soapCreateProductResult->result == 'CREATE-PRODUCT-RESULT-OK') {
19501948
if (isset($soapCreateProductResult->productNumber)) {
1951-
return $soapCreateProductResult->productNumber;
1949+
if (isset($soapCreateProductResult->articleNumbers)) {
1950+
return array('productNumber'=>$soapCreateProductResult->productNumber,
1951+
'articleNumbers'=>objectToArray($soapCreateProductResult->articleNumbers));
1952+
} else {
1953+
return array('productNumber'=>$soapCreateProductResult->productNumber);
1954+
}
1955+
} else {
1956+
return true;
19521957
}
19531958
}
19541959
return false;
19551960
} // END parseCreateProductResult()
19561961

19571962
//----------------------------------------------------------------------------
19581963

1959-
public function parseUpdateProductResult($soapCreateProductResult) {
1964+
public function parseUpdateProductResult($soapUpdateProductResult) {
19601965
if (isset($soapUpdateProductResult->result) and $soapUpdateProductResult->result == 'UPDATE-PRODUCT-RESULT-OK') {
1961-
if (isset($soapUpdateProductResult->productNumber)) {
1962-
return $soapUpdateProductResult->productNumber;
1966+
if (isset($soapUpdateProductResult->existingArticleNumbers)) {
1967+
if (isset($soapUpdateProductResult->newArticleNumbers)) {
1968+
return array('existingArticleNumbers'=>objectToArray($soapUpdateProductResult->existingArticleNumbers),
1969+
'newArticleNumbers'=>objectToArray($soapUpdateProductResult->newArticleNumbers));
1970+
} else {
1971+
return array('existingArticleNumbers'=>objectToArray($soapUpdateProductResult->existingArticleNumbers));
1972+
}
1973+
} elseif (isset($soapUpdateProductResult->newArticleNumbers)) {
1974+
return array('newArticleNumbers'=>objectToArray($soapUpdateProductResult->newArticleNumbers));
1975+
} else {
1976+
return true;
19631977
}
19641978
}
19651979
return false;

0 commit comments

Comments
 (0)