Unregister blocked value
Removes the blocked value from one line of an existing transaction, e.g. one registered with Register blocked value.
Twinfield documentation: Transaction blocked value.
This example changes data in Twinfield. Only run it on a test administration.
The command goes to the TransactionBlockedValueService, a Command & Query web service. It returns nothing; when Twinfield refuses it, you get a CommandQueryFaultException with errorCode BlockedValueCannotBeUnregistered (see TransactionBlockedValueServiceFaultCode).
$twinfield = Example::twinfield();
// E.g. `INK 202600021 1`: day book, transaction number and line id.[, $dayBook, $number, $line] = array_pad($argv ?? [], 4, null);
if ($dayBook === null || $number === null || $line === null) { echo 'Usage: php example.php <day book> <transaction number> <line id>', PHP_EOL;
exit(0);}
try { $twinfield->transactionBlockedValues()->unregister($dayBook, (int) $number, (int) $line);} catch (CommandQueryFaultException $exception) { echo 'Refused (', $exception->errorCode, '): ', $exception->errorMessage, PHP_EOL;
exit(1);}
echo 'Removed the blocked value from line ', $line, ' of ', $dayBook, ' ', $number, PHP_EOL;The write guard of the examples blocks changes unless you allow them for a company in TWINFIELD_WRITE_COMPANIES:
TWINFIELD_COMPANY=1002_3 TWINFIELD_ALLOW_WRITES=1002_3 php examples/transaction-blocked-values/unregister-blocked-value/example.php INK 202600021 1Removed the blocked value from line 1 of INK 202600021What the SDK sends to Twinfield and what Twinfield sends back, for a call like the one in this example. The responses come from the tests, with example data.
UnregisterBlockedAmountForTransaction
Section titled “UnregisterBlockedAmountForTransaction”Twinfield documentation: Transaction blocked value: UnregisterBlockedAmountForTransaction.
$twinfield->transactionBlockedValues()->unregister('MEMO', 202100001, 1);The SDK sends this in the SOAP body to TransactionBlockedValueService.svc, with SOAPAction http://www.twinfield.com/TransactionBlockedValueService/Process; the access token goes in the SOAP header:
<Command xmlns="http://www.twinfield.com/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:a="http://schemas.datacontract.org/2004/07/Twinfield.WebServices.TransactionBlockedValueService" i:type="a:UnregisterBlockedAmountForTransaction"> <a:CompanyCode>1000</a:CompanyCode> <a:TransactionCode>MEMO</a:TransactionCode> <a:TransactionLineId>1</a:TransactionLineId> <a:TransactionNumber>202100001</a:TransactionNumber></Command>Twinfield answers with an empty SOAP body: the command succeeded.
Source
Section titled “Source”View examples/transaction-blocked-values/unregister-blocked-value/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.