From 274c5ee9ca41e54e7e1b41fab0d5ef7ab02db634 Mon Sep 17 00:00:00 2001 From: Nena Furtmeier Date: Mon, 6 Mar 2023 17:08:42 +0100 Subject: [PATCH] forgot something it seems --- src/nemiah/phpSepaXml/SEPADirectDebitBasic.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nemiah/phpSepaXml/SEPADirectDebitBasic.php b/src/nemiah/phpSepaXml/SEPADirectDebitBasic.php index 8a64662..0438070 100644 --- a/src/nemiah/phpSepaXml/SEPADirectDebitBasic.php +++ b/src/nemiah/phpSepaXml/SEPADirectDebitBasic.php @@ -16,10 +16,10 @@ class SEPADirectDebitBasic extends SEPAFile { protected $paymentID = ""; protected $initiator = ""; protected $creditor; + protected $btchBookg = null; protected $debitoren = array(); #protected $sequenceType = 'OOFF'; //FNAL, FRST, OOFF, RCUR protected $creationDateTime; - protected $type = ""; #protected $requestedCollectionDate; #protected $type = "COR1"; @@ -73,8 +73,8 @@ private function CtrlSum($sequence = null) { return $sum; } - public function toXML() { - $xml = $this->start("pain.008.003.02"); + public function toXML($format = "pain.008.003.02") { + $xml = $this->start($format); if ($this->messageID == '') $this->messageID = time(); @@ -84,12 +84,14 @@ public function toXML() { $count += count($type); $GrpHdr = $xml->addChild('CstmrDrctDbtInitn')->addChild('GrpHdr'); + if($this->btchBookg !== null) + $GrpHdr->addChild('BtchBookg', $this->btchBookg); $GrpHdr->addChild('MsgId', $this->messageID); $GrpHdr->addChild('CreDtTm', $this->creationDateTime->format('Y-m-d\TH:i:s')); $GrpHdr->addChild('NbOfTxs', $count); $GrpHdr->addChild('CtrlSum', $this->CtrlSum()); $GrpHdr->addChild('InitgPty'); - $GrpHdr->InitgPty->addChild('Nm', htmlentities($this->initiator)); + $GrpHdr->InitgPty->addChild('Nm', SEPAParty::fixNmS($this->initiator)); @@ -105,7 +107,7 @@ public function toXML() { $PmtTpInf = $PmtInf->addChild('PmtTpInf'); $PmtTpInf->addChild('SvcLvl')->addChild('Cd', 'SEPA'); - $PmtTpInf->addChild('LclInstrm')->addChild('Cd', $this->type); + $PmtTpInf->addChild('LclInstrm')->addChild('Cd', $debitoren[0]->type); $PmtTpInf->addChild('SeqTp', $debitoren[0]->sequenceType); $PmtInf->addChild('ReqdColltnDt', $debitoren[0]->requestedCollectionDate->format('Y-m-d'));