Skip to content

Commit 274c5ee

Browse files
committed
forgot something it seems
1 parent 6baa6a2 commit 274c5ee

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/nemiah/phpSepaXml/SEPADirectDebitBasic.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class SEPADirectDebitBasic extends SEPAFile {
1616
protected $paymentID = "";
1717
protected $initiator = "";
1818
protected $creditor;
19+
protected $btchBookg = null;
1920
protected $debitoren = array();
2021
#protected $sequenceType = 'OOFF'; //FNAL, FRST, OOFF, RCUR
2122
protected $creationDateTime;
22-
protected $type = "";
2323
#protected $requestedCollectionDate;
2424
#protected $type = "COR1";
2525

@@ -73,8 +73,8 @@ private function CtrlSum($sequence = null) {
7373
return $sum;
7474
}
7575

76-
public function toXML() {
77-
$xml = $this->start("pain.008.003.02");
76+
public function toXML($format = "pain.008.003.02") {
77+
$xml = $this->start($format);
7878

7979
if ($this->messageID == '')
8080
$this->messageID = time();
@@ -84,12 +84,14 @@ public function toXML() {
8484
$count += count($type);
8585

8686
$GrpHdr = $xml->addChild('CstmrDrctDbtInitn')->addChild('GrpHdr');
87+
if($this->btchBookg !== null)
88+
$GrpHdr->addChild('BtchBookg', $this->btchBookg);
8789
$GrpHdr->addChild('MsgId', $this->messageID);
8890
$GrpHdr->addChild('CreDtTm', $this->creationDateTime->format('Y-m-d\TH:i:s'));
8991
$GrpHdr->addChild('NbOfTxs', $count);
9092
$GrpHdr->addChild('CtrlSum', $this->CtrlSum());
9193
$GrpHdr->addChild('InitgPty');
92-
$GrpHdr->InitgPty->addChild('Nm', htmlentities($this->initiator));
94+
$GrpHdr->InitgPty->addChild('Nm', SEPAParty::fixNmS($this->initiator));
9395

9496

9597

@@ -105,7 +107,7 @@ public function toXML() {
105107

106108
$PmtTpInf = $PmtInf->addChild('PmtTpInf');
107109
$PmtTpInf->addChild('SvcLvl')->addChild('Cd', 'SEPA');
108-
$PmtTpInf->addChild('LclInstrm')->addChild('Cd', $this->type);
110+
$PmtTpInf->addChild('LclInstrm')->addChild('Cd', $debitoren[0]->type);
109111
$PmtTpInf->addChild('SeqTp', $debitoren[0]->sequenceType);
110112

111113
$PmtInf->addChild('ReqdColltnDt', $debitoren[0]->requestedCollectionDate->format('Y-m-d'));

0 commit comments

Comments
 (0)