Skip to content

Commit b2aae0b

Browse files
author
Dennis van den Heerik
committed
BranchGroups call ingebouwd
1 parent 27a22c5 commit b2aae0b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Mplusqapiclient.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,8 +3262,27 @@ public function report($arguments, $attempts = 0)
32623262
}
32633263
} // END report()
32643264

3265+
32653266
//----------------------------------------------------------------------------
32663267

3268+
public function getBranchGroups($attempts = 0)
3269+
{
3270+
try {
3271+
$result = $this->client->getBranchGroups();
3272+
return $this->parser->parseGetBranchGroupsResult($result);
3273+
} catch (SoapFault $e) {
3274+
$msg = $e->getMessage();
3275+
if (false !== stripos($msg, 'Could not connect to host') and $attempts < 3) {
3276+
sleep(1);
3277+
return $this->getBranchGroups($attempts + 1);
3278+
} else {
3279+
throw new MplusQAPIException('SoapFault occurred: ' . $msg, 0, $e);
3280+
}
3281+
} catch (Exception $e) {
3282+
throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e);
3283+
}
3284+
} // END getBranchGroups()
3285+
32673286
}
32683287

32693288
//==============================================================================
@@ -4943,6 +4962,17 @@ public function parseGetBranchesResult($soapGetBranchesResult) {
49434962
}
49444963
return $branches;
49454964
} // END parseGetBranchesResult()
4965+
4966+
//----------------------------------------------------------------------------
4967+
4968+
public function parseGetBranchGroupsResult($soapGetBranchGroupsResult) {
4969+
$branchGroups = array();
4970+
if (isset($soapGetBranchGroupsResult->branchGroupsList->branchGroups)) {
4971+
$soapBranchGroups = $soapGetBranchGroupsResult->branchGroupsList->branchGroups;
4972+
return objectToArray($soapBranchGroups);
4973+
}
4974+
return $branchGroups;
4975+
} // END parseGetBranchGroupsResult()
49464976

49474977
//----------------------------------------------------------------------------
49484978

0 commit comments

Comments
 (0)