@@ -3819,33 +3819,31 @@ public function verifyCredentials($request, $attempts=0)
38193819
38203820 //----------------------------------------------------------------------------
38213821
3822- public function report ($ arguments , $ attempts = 0 ) {
3823- try {
3824- if (!is_array ($ arguments ) || !array_key_exists ('method ' , $ arguments ) || empty ($ arguments ['method ' ])) {
3825- throw new Exception ("No method defined for group call : " . __FUNCTION__ );
3826- }
3827- $ method = __FUNCTION__ . $ arguments ['method ' ];
3828- unset($ arguments ['method ' ]);
3829- $ parameters = $ this ->parser ->convertReportRequest ($ method , $ arguments );
3830- $ result = call_user_func (array ($ this ->client , $ method ), $ parameters );
3831- if ($ this ->returnRawResult ) {
3832- return $ result ;
3833- }
3834- return $ this ->parser ->parseReportResult ($ method , $ result );
3835- } catch (SoapFault $ e ) {
3836- $ msg = $ e ->getMessage ();
3837- if (false !== stripos ($ msg , 'Could not connect to host ' ) and $ attempts < 3 ) {
3838- sleep (1 );
3839- return $ this ->report ($ arguments , $ attempts + 1 );
3840- } else {
3841- throw new MplusQAPIException ('SoapFault occurred: ' . $ msg , 0 , $ e );
3842- }
3843- } catch (Exception $ e ) {
3844- throw new MplusQAPIException ('Exception occurred: ' . $ e ->getMessage (), 0 , $ e );
3845- }
3822+ public function report ($ arguments , $ attempts = 0 ) {
3823+ try {
3824+ if (!is_array ($ arguments ) || !array_key_exists ('method ' , $ arguments ) || empty ($ arguments ['method ' ])) {
3825+ throw new Exception ("No method defined for group call : " . __FUNCTION__ );
3826+ }
3827+ $ method = __FUNCTION__ . $ arguments ['method ' ];
3828+ unset($ arguments ['method ' ]);
3829+ $ parameters = $ this ->parser ->convertReportRequest ($ method , $ arguments );
3830+ $ result = call_user_func (array ($ this ->client , $ method ), $ parameters );
3831+ if ($ this ->returnRawResult ) {
3832+ return $ result ;
3833+ }
3834+ return $ this ->parser ->parseReportResult ($ method , $ result );
3835+ } catch (SoapFault $ e ) {
3836+ $ msg = $ e ->getMessage ();
3837+ if (false !== stripos ($ msg , 'Could not connect to host ' ) and $ attempts < 3 ) {
3838+ sleep (1 );
3839+ return $ this ->report ($ arguments , $ attempts + 1 );
3840+ } else {
3841+ throw new MplusQAPIException ('SoapFault occurred: ' . $ msg , 0 , $ e );
3842+ }
3843+ } catch (Exception $ e ) {
3844+ throw new MplusQAPIException ('Exception occurred: ' . $ e ->getMessage (), 0 , $ e );
38463845 }
3847- // END report()
3848-
3846+ }
38493847
38503848 //----------------------------------------------------------------------------
38513849
@@ -6900,6 +6898,14 @@ public function parseReportResult($method, $soapReportResult)
69006898 }
69016899 }
69026900 break ;
6901+ case "reportAverageSpending " :
6902+ $ data = array ();
6903+ if (isset ($ soapReportResult ->averageSpendingList ->averageSpending )) {
6904+ foreach ($ soapReportResult ->averageSpendingList ->averageSpending as $ soapAverageSpending ) {
6905+ $ data [] = $ soapAverageSpending ;
6906+ }
6907+ }
6908+ break ;
69036909 }
69046910 return $ data ;
69056911 } // END parseReportResult()
@@ -9404,6 +9410,22 @@ public function convertReportRequest($method, $arguments) {
94049410 'branchNumbers ' , 'articleNumbers ' , 'perHour ' , 'turnoverGroups '
94059411 ),
94069412 ),
9413+ 'reportBranchPerformance ' => array (
9414+ 'required ' => array (
9415+ 'fromFinancialDate ' , 'throughFinancialDate ' ,
9416+ ),
9417+ 'optional ' => array (
9418+ 'branchNumbers '
9419+ ),
9420+ ),
9421+ 'reportAverageSpending ' => array (
9422+ 'required ' => array (
9423+ 'fromFinancialDate ' , 'throughFinancialDate ' , 'source '
9424+ ),
9425+ 'optional ' => array (
9426+ 'branchNumbers ' , 'employeeNumbers '
9427+ ),
9428+ ),
94079429 );
94089430 $ request = [];
94099431 if (array_key_exists ($ method , $ fields )) {
@@ -9455,6 +9477,9 @@ public function convertReportRequest($method, $arguments) {
94559477 case "perHour " :
94569478 $ request ['perHour ' ] = $ arguments ['perHour ' ] === true ? true : false ;
94579479 break ;
9480+ default :
9481+ $ request [$ callField ] = $ arguments [$ callField ];
9482+ break ;
94589483 }
94599484 }
94609485 }
0 commit comments