@@ -16,10 +16,10 @@ class SEPADirectDebitBasic extends SEPAFile {
16
16
protected $ paymentID = "" ;
17
17
protected $ initiator = "" ;
18
18
protected $ creditor ;
19
+ protected $ btchBookg = null ;
19
20
protected $ debitoren = array ();
20
21
#protected $sequenceType = 'OOFF'; //FNAL, FRST, OOFF, RCUR
21
22
protected $ creationDateTime ;
22
- protected $ type = "" ;
23
23
#protected $requestedCollectionDate;
24
24
#protected $type = "COR1";
25
25
@@ -73,8 +73,8 @@ private function CtrlSum($sequence = null) {
73
73
return $ sum ;
74
74
}
75
75
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 );
78
78
79
79
if ($ this ->messageID == '' )
80
80
$ this ->messageID = time ();
@@ -84,12 +84,14 @@ public function toXML() {
84
84
$ count += count ($ type );
85
85
86
86
$ GrpHdr = $ xml ->addChild ('CstmrDrctDbtInitn ' )->addChild ('GrpHdr ' );
87
+ if ($ this ->btchBookg !== null )
88
+ $ GrpHdr ->addChild ('BtchBookg ' , $ this ->btchBookg );
87
89
$ GrpHdr ->addChild ('MsgId ' , $ this ->messageID );
88
90
$ GrpHdr ->addChild ('CreDtTm ' , $ this ->creationDateTime ->format ('Y-m-d\TH:i:s ' ));
89
91
$ GrpHdr ->addChild ('NbOfTxs ' , $ count );
90
92
$ GrpHdr ->addChild ('CtrlSum ' , $ this ->CtrlSum ());
91
93
$ GrpHdr ->addChild ('InitgPty ' );
92
- $ GrpHdr ->InitgPty ->addChild ('Nm ' , htmlentities ($ this ->initiator ));
94
+ $ GrpHdr ->InitgPty ->addChild ('Nm ' , SEPAParty:: fixNmS ($ this ->initiator ));
93
95
94
96
95
97
@@ -105,7 +107,7 @@ public function toXML() {
105
107
106
108
$ PmtTpInf = $ PmtInf ->addChild ('PmtTpInf ' );
107
109
$ PmtTpInf ->addChild ('SvcLvl ' )->addChild ('Cd ' , 'SEPA ' );
108
- $ PmtTpInf ->addChild ('LclInstrm ' )->addChild ('Cd ' , $ this ->type );
110
+ $ PmtTpInf ->addChild ('LclInstrm ' )->addChild ('Cd ' , $ debitoren [ 0 ] ->type );
109
111
$ PmtTpInf ->addChild ('SeqTp ' , $ debitoren [0 ]->sequenceType );
110
112
111
113
$ PmtInf ->addChild ('ReqdColltnDt ' , $ debitoren [0 ]->requestedCollectionDate ->format ('Y-m-d ' ));
0 commit comments