Skip to content

Commit

Permalink
Merge branch 'stockCorrections' into 'master'
Browse files Browse the repository at this point in the history
Support for getStockCorrections

See merge request mpluskassa/mplus-api-client-deprecated!50
  • Loading branch information
freerk-mpluskassa committed Jan 13, 2021
2 parents d3e261c + c4240ef commit 16aa5a8
Showing 1 changed file with 87 additions and 4 deletions.
91 changes: 87 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.33.0';
const CLIENT_VERSION = '1.33.1';
const WSDL_TTL = 300;

var $MIN_API_VERSION_MAJOR = 0;
Expand Down Expand Up @@ -4383,8 +4383,41 @@ public function savePurchaseBook($branchNumber, $entries) {
throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e);
}
}

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

// END savePurchaseBook()
public function getStockCorrections(
$employeeNumbers = null,
$branchNumbers = null,
$articleNumbers = null,
$fromFinancialDate = null,
$throughFinancialDate = null,
$correctionType = null,
$stockCorrectionNumber = null
) {
try {
$result = $this->client->getStockCorrections($this->parser->convertGetStockCorrectionsRequest(
$employeeNumbers,
$branchNumbers,
$articleNumbers,
$fromFinancialDate,
$throughFinancialDate,
$correctionType,
$stockCorrectionNumber
));
if ($this->getReturnRawResult()) {
return $result;
}
return $this->parser->parseGetStockCorrectionsResult($result);
}
catch (SoapFault $e) {
throw new MplusQAPIException('SoapFault occurred: ' . $e->getMessage(), 0, $e);
}
catch (Exception $e) {
throw new MplusQAPIException('Exception occurred: ' . $e->getMessage(), 0, $e);
}
}

}

//==============================================================================
Expand Down Expand Up @@ -7143,6 +7176,13 @@ public function parseSavePurchaseBookResult($soapSavePurchaseBookResult) {
}

// END parseSavePurchaseBookResult()

//----------------------------------------------------------------------------
public function parseGetStockCorrectionsResult($soapGetStockCorrectionsResult) {
return $soapGetStockCorrectionsResult;
}

// END parseGetStockCorrectionsResult()

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

Expand Down Expand Up @@ -10127,8 +10167,51 @@ public function convertSavePurchaseBookRequest($branchNumber, $entries) {
$request->request->entries = $entries;
return $request;
}

// END convertSavePurchaseBookRequest()

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

public function convertGetStockCorrectionsRequest(
$employeeNumbers,
$branchNumbers,
$articleNumbers,
$fromFinancialDate,
$throughFinancialDate,
$correctionType,
$stockCorrectionNumber
) {
$request = [];
if (!is_null($employeeNumbers)) {
if (!is_array($employeeNumbers)) {
$employeeNumbers = [$employeeNumbers];
}
$request['employeeNumbers'] = $employeeNumbers;
}
if (!is_null($branchNumbers)) {
if (!is_array($branchNumbers)) {
$branchNumbers = [$branchNumbers];
}
$request['branchNumbers'] = $branchNumbers;
}
if (!is_null($articleNumbers)) {
if (!is_array($articleNumbers)) {
$articleNumbers = [$articleNumbers];
}
$request['articleNumbers'] = $articleNumbers;
}
if (!is_null($fromFinancialDate) && !empty($fromFinancialDate)) {
$request['fromFinancialDate'] = $fromFinancialDate;
}
if (!is_null($throughFinancialDate) && !empty($throughFinancialDate)) {
$request['throughFinancialDate'] = $throughFinancialDate;
}
if (!is_null($correctionType)) {
$request['correctionType'] = $correctionType;
}
if (!is_null($stockCorrectionNumber) && !empty($stockCorrectionNumber)) {
$request['stockCorrectionNumber'] = $this->convertYearNumber($stockCorrectionNumber);
}
return arrayToObject(['request'=>$request]);
}

}

Expand Down

0 comments on commit 16aa5a8

Please sign in to comment.