Skip to content

Commit 1998885

Browse files
author
Dennis van den Heerik
committed
Added optional argument to GetTurnoverGroups for only retrieving
active groups. If no argument or false given, the old functionality remains.
1 parent f325d3f commit 1998885

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Mplusqapiclient.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class MplusQAPIclient
44
{
5-
const CLIENT_VERSION = '1.27.5';
5+
const CLIENT_VERSION = '1.27.6';
66
const WSDL_TTL = 300;
77

88
var $MIN_API_VERSION_MAJOR = 0;
@@ -2322,16 +2322,16 @@ public function getCashDrawerBalancingList($fromFinancialDate, $throughFinancial
23222322

23232323
//----------------------------------------------------------------------------
23242324

2325-
public function getTurnoverGroups($attempts=0)
2325+
public function getTurnoverGroups($onlyActive = null, $attempts=0)
23262326
{
23272327
try {
2328-
$result = $this->client->getTurnoverGroups();
2328+
$result = $this->client->getTurnoverGroups($this->parser->convertGetTurnoverGroupsRequest($onlyActive));
23292329
return $this->parser->parseGetTurnoverGroupsResult($result);
23302330
} catch (SoapFault $e) {
23312331
$msg = $e->getMessage();
23322332
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
23332333
sleep(1);
2334-
return $this->getTurnoverGroups($attempts+1);
2334+
return $this->getTurnoverGroups($onlyActive, $attempts+1);
23352335
} else {
23362336
throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e);
23372337
}
@@ -5899,6 +5899,18 @@ public function parseGetProductOverviewFieldsResult($soapGetProductOverviewField
58995899
} // END parseGetProductOverviewFieldsResult()
59005900

59015901

5902+
//----------------------------------------------------------------------------
5903+
5904+
public function convertGetTurnoverGroupsRequest($onlyActive=null)
5905+
{
5906+
$array = array('request'=>array());
5907+
if ($onlyActive) {
5908+
$array['request']['onlyActive'] = true;
5909+
}
5910+
$object = arrayToObject($array);
5911+
return $object;
5912+
} // END convertTurnoverGroupsRequest()
5913+
59025914
//----------------------------------------------------------------------------
59035915

59045916
public function convertGetDeliveryMethodsV2Request($request)

0 commit comments

Comments
 (0)