Skip to content

Commit

Permalink
Added optional argument to GetTurnoverGroups for only retrieving
Browse files Browse the repository at this point in the history
active groups. If no argument or false given, the old functionality 
remains.
  • Loading branch information
Dennis van den Heerik committed Feb 4, 2020
1 parent f325d3f commit 1998885
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Mplusqapiclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class MplusQAPIclient
{
const CLIENT_VERSION = '1.27.5';
const CLIENT_VERSION = '1.27.6';
const WSDL_TTL = 300;

var $MIN_API_VERSION_MAJOR = 0;
Expand Down Expand Up @@ -2322,16 +2322,16 @@ public function getCashDrawerBalancingList($fromFinancialDate, $throughFinancial

//----------------------------------------------------------------------------

public function getTurnoverGroups($attempts=0)
public function getTurnoverGroups($onlyActive = null, $attempts=0)
{
try {
$result = $this->client->getTurnoverGroups();
$result = $this->client->getTurnoverGroups($this->parser->convertGetTurnoverGroupsRequest($onlyActive));
return $this->parser->parseGetTurnoverGroupsResult($result);
} catch (SoapFault $e) {
$msg = $e->getMessage();
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
sleep(1);
return $this->getTurnoverGroups($attempts+1);
return $this->getTurnoverGroups($onlyActive, $attempts+1);
} else {
throw new MplusQAPIException('SoapFault occurred: '.$msg, 0, $e);
}
Expand Down Expand Up @@ -5899,6 +5899,18 @@ public function parseGetProductOverviewFieldsResult($soapGetProductOverviewField
} // END parseGetProductOverviewFieldsResult()


//----------------------------------------------------------------------------

public function convertGetTurnoverGroupsRequest($onlyActive=null)
{
$array = array('request'=>array());
if ($onlyActive) {
$array['request']['onlyActive'] = true;
}
$object = arrayToObject($array);
return $object;
} // END convertTurnoverGroupsRequest()

//----------------------------------------------------------------------------

public function convertGetDeliveryMethodsV2Request($request)
Expand Down

0 comments on commit 1998885

Please sign in to comment.