PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Networking » Net_HL7 » Bug #4841

Possible wrong index used in ACK composition

Details

Submitted2005-07-15 13:36 UTC
Fromarnold4msa at solcon dot nl
StatusWont fix
PackageNet_HL7
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2005-07-15 13:36 UTC] arnold4msa at solcon dot nl

Description:
------------
IMHO a wrong index number is used when composing an ACK, using the setAckCode() method.

I changed this from 3 into 2
The same "feature" exists in the perl code.......

Reproduce code:
---------------
$ack =&new Net_HL7_Messages_ACK($msgObj);

echo "\nBefore setAckCode()\n";
print_r( $ack );

$ack->setAckCode( "A", $MSHSeg->getField(10) );
echo "\nAfter setAckCode()\n";
print_r( $ack );

echo "\nFinal ack:".$ack->toString( 1 );

Expected result:
----------------
The correct result should be "MSA|AA|200503234074|"
(the MCID should be the third argument)

Actual result:
--------------
the result of setAckCode(): "MSA|AA||200503234074|"
(MCID as fourth argument)

\function setAckCode($code, $msg = "")
\ {
\$mode = "A";

// Determine acknowledge mode: normal or enhanced
//
\ if ($this->_ACK_TYPE == "E") {
\ $mode = "C";
\ }

\ if (strlen($code) == 1) {
\ $code = "$mode$code";
\ }

\ $seg1 =& $this->getSegmentByIndex(1);
\ $seg1->setField(1, $code);
\ if ($msg) $seg1->setField(3, $msg);
\ ^^--- changed this value to 2 (start counting with 0)
\ return true;
\ }