File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ class invoice extends Base {
6666 let city = this . config . get ( 'invoiceSettings' ) . from [ 3 ] . substring ( endOfZipPos + 1 ) ;
6767
6868 // debitor
69- let nDebitorAddressFields = this . config . get ( 'invoiceAddress' ) . length ;
69+ let nDebitorAddressFields = Array . isArray ( this . config . get ( 'invoiceAddress' ) ) ? this . config . get ( 'invoiceAddress' ) . length : - 1 ;
7070 let nameDebitor = "" ;
7171 let zipDebitor = "" ;
7272 let cityDebitor = "" ;
@@ -76,10 +76,16 @@ class invoice extends Base {
7676 if ( nDebitorAddressFields > 0 ) {
7777 nameDebitor = this . config . get ( 'invoiceAddress' ) [ 0 ] . replaceAll ( "_" , " " ) ;
7878 }
79+ else {
80+ nameDebitor = this . config . get ( 'invoiceAddress' ) . toString ( ) ;
81+ }
82+
7983 if ( nDebitorAddressFields > 2 ) {
8084 let endOfZipPosDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 1 ] . search ( "[ _]" ) ;
81- zipDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 1 ] . substring ( 0 , endOfZipPosDebitor ) . replaceAll ( "_" , " " ) ;
82- cityDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 1 ] . substring ( endOfZipPosDebitor + 1 ) . replaceAll ( "_" , " " ) ;
85+ if ( endOfZipPosDebitor > 0 ) {
86+ zipDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 1 ] . substring ( 0 , endOfZipPosDebitor ) . replaceAll ( "_" , " " ) ;
87+ cityDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 1 ] . substring ( endOfZipPosDebitor + 1 ) . replaceAll ( "_" , " " ) ;
88+ }
8389 addressDebitor = this . config . get ( 'invoiceAddress' ) [ nDebitorAddressFields - 2 ] . replaceAll ( "_" , " " ) ;
8490 if ( zipDebitor . search ( "-" ) > 0 )
8591 {
You can’t perform that action at this time.
0 commit comments