Skip to content

Commit 55a4d22

Browse files
author
Andreas Müller
committed
Merge branch 'master' of github.com:ndu2/gitlab-time-tracker
2 parents 7246104 + 02363cc commit 55a4d22

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/output/invoice.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,28 @@ class invoice extends Base {
7171
let zipDebitor = "";
7272
let cityDebitor = "";
7373
let addressDebitor = "";
74-
74+
let countryDebitor = "CH";
7575

7676
if(nDebitorAddressFields > 0) {
77-
nameDebitor = this.config.get('invoiceAddress') [0].replace("_", " ");
77+
nameDebitor = this.config.get('invoiceAddress') [0].replaceAll("_", " ");
7878
}
7979
if(nDebitorAddressFields > 2) {
8080
let endOfZipPosDebitor = this.config.get('invoiceAddress')[nDebitorAddressFields-1].search("[ _]");
81-
zipDebitor = this.config.get('invoiceAddress')[nDebitorAddressFields-1].substring(0, endOfZipPosDebitor).replace("_", " ");
82-
cityDebitor = this.config.get('invoiceAddress')[nDebitorAddressFields-1].substring(endOfZipPosDebitor + 1).replace("_", " ");
83-
addressDebitor = this.config.get('invoiceAddress') [nDebitorAddressFields-2].replace("_", " ");
81+
zipDebitor = this.config.get('invoiceAddress')[nDebitorAddressFields-1].substring(0, endOfZipPosDebitor).replaceAll("_", " ");
82+
cityDebitor = this.config.get('invoiceAddress')[nDebitorAddressFields-1].substring(endOfZipPosDebitor + 1).replaceAll("_", " ");
83+
addressDebitor = this.config.get('invoiceAddress') [nDebitorAddressFields-2].replaceAll("_", " ");
84+
if(zipDebitor.search("-") > 0)
85+
{
86+
let countryZip = zipDebitor.split("-");
87+
countryDebitor = countryZip[0];
88+
zipDebitor = countryZip[1];
89+
}
8490
}
8591

8692
const data = {
8793
currency: "CHF",
8894
amount: this.totalForInvoice,
89-
reference: this.config.get('invoiceReference'),
95+
additionalInformation: this.config.get('invoiceReference'),
9096
creditor: {
9197
name: this.config.get('invoiceSettings').from[0],
9298
address: this.config.get('invoiceSettings').from [2],
@@ -100,7 +106,7 @@ class invoice extends Base {
100106
address: addressDebitor,
101107
zip: zipDebitor,
102108
city: cityDebitor,
103-
country: "CH"
109+
country: countryDebitor
104110
}
105111
};
106112
const options = {

0 commit comments

Comments
 (0)