From: Kilian Saffran Date: Wed, 30 Dec 2020 15:44:12 +0000 (+0100) Subject: v20201230 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=1f7eae2e22954b839fbc009aa15aa3747031ad84;p=invoicejournal.git v20201230 --- diff --git a/desktopapp/dialogs/Address.html b/desktopapp/dialogs/Address.html new file mode 100644 index 0000000..d8b7189 --- /dev/null +++ b/desktopapp/dialogs/Address.html @@ -0,0 +1,92 @@ + \ No newline at end of file diff --git a/desktopapp/dialogs/InvoiceBooking.html b/desktopapp/dialogs/InvoiceBooking.html index e85b62a..1601d0d 100644 --- a/desktopapp/dialogs/InvoiceBooking.html +++ b/desktopapp/dialogs/InvoiceBooking.html @@ -54,7 +54,7 @@
- +
@@ -62,7 +62,7 @@ \ No newline at end of file diff --git a/desktopapp/index.html b/desktopapp/index.html index 67046ec..09ae5cc 100644 --- a/desktopapp/index.html +++ b/desktopapp/index.html @@ -33,7 +33,7 @@
@@ -65,6 +65,7 @@ +
diff --git a/desktopapp/js/dataform.js b/desktopapp/js/dataform.js index 861eb4f..27fb81e 100644 --- a/desktopapp/js/dataform.js +++ b/desktopapp/js/dataform.js @@ -38,7 +38,7 @@ let dataform = { if (field.classList.contains("richeditarea")){ flds[field.dataset.table][field.dataset.column] = tinymce.get(field.id).getContent(); } else { - flds[field.dataset.table][field.dataset.column] = field.innerHTML; + flds[field.dataset.table][field.dataset.column] = field.value; } } else if (field.type == "checkbox" ){ if (field.checked){ diff --git a/desktopapp/js/email.js b/desktopapp/js/email.js index 7767ecc..4f8e585 100644 --- a/desktopapp/js/email.js +++ b/desktopapp/js/email.js @@ -1,4 +1,9 @@ +var emlformat = require('eml-format'); +import MsgReader from '@kenjiuno/msgreader' + let email = { + templatetype: "eml", + currenttemplate: {}, openthunderbird: function(maildata){ let args =[]; let mailcfg =[]; @@ -25,8 +30,26 @@ let email = { }); }, openOutlook: function(){ + const mailappout = spawn(preferences.global.mailapp, args); //outlook.exe /c ipm.note /m "someone@microsoft.com&subject=test%20subject&body=test%20body" /a test.txt }, + create: function(mailtemplate,repdata,accdata){ + if (mailtemplate == 'msg'){ + email.templatetype ='msg'; + const msgFileBuffer = fs.readFileSync('./data/test.msg') + const msgtmpl = new MsgReader(msgFileBuffer) + email.currenttemplate = msgtmpl.getFileData() + } else { + var eml = fs.readFileSync(preferences.global.currentdataset.datapath + '/templates/email/' + mailtemplate, "utf-8"); + emlformat.read(eml, function(error, data) { + if (error) return console.log(error); + email.currenttemplate = JSON.stringify(data, " ", 2); + console.log(data); + console.log("globalprefs",preferences.global); + }); + } + console.log("globalprefs",preferences.global); + }, // sendWithSMTP: function(maildata){ // const transporter = nodemailer.createTransport({ // host: preferences.global.mailserver, diff --git a/desktopapp/js/lang/de.js b/desktopapp/js/lang/de.js new file mode 100644 index 0000000..e69de29 diff --git a/desktopapp/js/lang/fr.js b/desktopapp/js/lang/fr.js new file mode 100644 index 0000000..e69de29 diff --git a/desktopapp/js/myapp.js b/desktopapp/js/myapp.js index 9b782c1..354509d 100644 --- a/desktopapp/js/myapp.js +++ b/desktopapp/js/myapp.js @@ -84,9 +84,9 @@ let myapp = { }); }, viewdialog: function( dlgname){ - //app.loaddialog(dlgname).then(result => { + // myapp.loaddialog(dlgname).then(result => { document.getElementById("dlg" + dlgname).style.display = 'block'; - //}); + // }); }, closeDialog: function(dlgname){ @@ -101,9 +101,11 @@ let myapp = { document.getElementById("dlgconfirm").style.display = 'block'; }, message: function(title,message){ - document.getElementById('dlgmessage_title').innerHTML=title; - document.getElementById('dlgmessage_text').innerHTML=message; - document.getElementById('dlgmessage').style.display='block'; + myapp.loaddialog("message").then(result => { + document.getElementById('dlgmessage_title').innerHTML=title; + document.getElementById('dlgmessage_text').innerHTML=message; + document.getElementById('dlgmessage').style.display='block'; + }); return false; }, setpref: function(key,value){ diff --git a/desktopapp/js/report.js b/desktopapp/js/report.js index b3d0c46..dd8cc02 100644 --- a/desktopapp/js/report.js +++ b/desktopapp/js/report.js @@ -30,7 +30,11 @@ let report ={ console.log("Render",preferences.global.currentdataset.datapath + '/templates/' + id_report); console.log("to",report.tmpoutput); carbone.render(preferences.global.currentdataset.datapath + '/templates/' + id_report, data, options, function(err, result){ - if (err) return console.log("XX ERR",err); + if (err) { + console.log("XX ERR",err); + myapp.message("Error",err); + return; + } console.log("docresult",result); fs.writeFileSync(report.tmpoutput, result); // to kill automatically LibreOffice workers @@ -43,7 +47,7 @@ let report ={ if (report.callback){ report.callback({"file":report.reportfile}); } - process.exit(); + //process.exit(); }); } } \ No newline at end of file diff --git a/desktopapp/modules/addresses/addresses.html b/desktopapp/modules/addresses/addresses.html index b9aba3c..2a07842 100644 --- a/desktopapp/modules/addresses/addresses.html +++ b/desktopapp/modules/addresses/addresses.html @@ -1,13 +1,13 @@
-
- Adressen -
- +
Adressen
+ + + +
-
+
+ \ No newline at end of file diff --git a/desktopapp/modules/addresses/addresses.js b/desktopapp/modules/addresses/addresses.js index 2a38c34..3c64bb9 100644 --- a/desktopapp/modules/addresses/addresses.js +++ b/desktopapp/modules/addresses/addresses.js @@ -1,8 +1,8 @@ let addresses = { tbl: null, tblselector: null, - tblcontacts: null, - tblmailtemplates: null, + // tblcontacts: null, + // tblmailtemplates: null, current_id: null, viewmodule: function(){ this.gettbldata(); @@ -15,45 +15,52 @@ let addresses = { height: "calc(100vh - 60px)", layout: "fitDataStretch", selectable: 1, - rowClick:function(e, row){ - console.log("Filter selected"); - let fsel = addresses.tbl.getSelectedData(); - console.log(fsel); - addresses.current_id = fsel[0].id; - addresses.edit(fsel[0].id); + rowDlbClick:function(e, row){ + // console.log("Filter selected"); + // + // console.log(fsel); + // addresses.current_id = fsel[0].id; + addresses.edit(); //invoices.getsums(fsel); }, rowContext:function(e, row){ e.preventDefault(); }, columns: [ - {title: "Name", field: "receipient", resizable: false}, - ] - }); - addresses.tblcontacts = new Tabulator("#tbl_contacts",{ - //headerFilterPlaceholder: "filter...", - height: "400px", - layout: "fitColumns", - selectable: 1, - rowContext:function(e, row){ e.preventDefault(); }, - columns: [ - {title: "Surname", field: "surname"}, - {title: "Prename", field: "prename"}, - {title: "E-Mail", field: "email"}, - {title: "Telefon", field: "phone"}, - {title: "Position", field: "job"} - ] - }); - addresses.tblmailtemplates = new Tabulator("#tbl_mailtemplates",{ - //headerFilterPlaceholder: "filter...", - height: "calc(100vh - 560px)", - layout: "fitColumns", - selectable: 1, - rowContext:function(e, row){ e.preventDefault(); }, - columns: [ - {title: "Name", field: "templatename" ,width: 300}, - {title: "Sender", field: "sendermail", width: 200}, - {title: "Betreff", field: "subject"}, + {title: "Nr.", field: "clientnumber",headerFilter:"input" }, + {title: "Name", field: "receipient",headerFilter:"input" }, + {title: "Adresse",field: "address" }, + {title: "PLZ", field: "zip" }, + {title: "Ort",field: "city"}, + {title: "Land",field: "country"}, + {title: "E-mail",field: "email"}, + {title: "Tel.",field: "phone"}, ] }); + // addresses.tblcontacts = new Tabulator("#tbl_contacts",{ + // //headerFilterPlaceholder: "filter...", + // height: "400px", + // layout: "fitColumns", + // selectable: 1, + // rowContext:function(e, row){ e.preventDefault(); }, + // columns: [ + // {title: "Surname", field: "surname"}, + // {title: "Prename", field: "prename"}, + // {title: "E-Mail", field: "email"}, + // {title: "Telefon", field: "phone"}, + // {title: "Position", field: "job"} + // ] + // }); + // addresses.tblmailtemplates = new Tabulator("#tbl_mailtemplates",{ + // //headerFilterPlaceholder: "filter...", + // height: "calc(100vh - 560px)", + // layout: "fitColumns", + // selectable: 1, + // rowContext:function(e, row){ e.preventDefault(); }, + // columns: [ + // {title: "Name", field: "templatename" ,width: 300}, + // {title: "Sender", field: "sendermail", width: 200}, + // {title: "Betreff", field: "subject"}, + // ] + // }); if (addresses.tblselector == null){ if (document.getElementById("#tbl_addressselect")){ addresses.initSelector(); @@ -61,6 +68,9 @@ let addresses = { } myapp.loaddialog("confirm").then(result => { + }); + myapp.loaddialog("Address").then(result => { + }); }, initSelector: function(){ @@ -82,7 +92,7 @@ let addresses = { }, gettbldata: function(idsel){ - db.queryarray("select id,receipient from addresses order by receipient").then(data => { + db.queryarray("select * from addresses order by receipient").then(data => { addresses.tbl.setData(data).then(res => { if (idsel){ addresses.tbl.selectRow(idsel); @@ -96,12 +106,14 @@ let addresses = { return false; }, - edit: function (selid){ - addresses.current_id = selid; + edit: function (){ + let fsel = addresses.tbl.getSelectedData(); + addresses.current_id = fsel[0].id; dataform.cleanform('addresses'); - db.query("select * from addresses where id='"+selid+"';").then(data => { + db.query("select * from addresses where id='"+fsel[0].id+"';").then(data => { console.log("Address Data:",data); dataform.fillform('addresses',{},data); + myapp.viewdialog("Address"); }).catch(e => { console.log(e);}); // postData({"get":"addresslist","dbschema":"dks","id":selid}).then(data => { @@ -115,8 +127,8 @@ let addresses = { console.log("New addresse ID",newid.id); db.execAsync("INSERT INTO addresses (id,clientnumber,receipient) VALUES ('"+newid.id+"','"+ clnum+"','Neue Addresse');").then( res =>{ addresses.gettbldata(newid.id); - addresses.current_id = fsel[0].id; - addresses.edit(fsel[0].id); + //addresses.current_id = fsel[0].id; + addresses.edit(); }); }).catch(e => { console.log(e);});; }).catch(e => { console.log(e);});; @@ -140,6 +152,16 @@ let addresses = { duplicate: function(){ }, + save: function(){ + let aflds = dataform.getformcontent("addresses",{"addresses":{}}); + aflds.addresses["id"]=addresses.current_id; + let sql = db.create_replace("addresses",aflds.addresses); + console.log(sql); + db.execAsync(sql).then(res => { + //invoice.getBookingData(); + myapp.closeDialog("Address"); + }); + } } \ No newline at end of file diff --git a/desktopapp/modules/bookings/booking.js b/desktopapp/modules/bookings/booking.js index 43f5ae5..f83cded 100644 --- a/desktopapp/modules/bookings/booking.js +++ b/desktopapp/modules/bookings/booking.js @@ -1,21 +1,21 @@ let booking = { - editors:{"invoicebooking_description":null}, + // editors:{"invoicebooking_description":null}, initDialog: function(){ - tinymce.init({ - selector: '#invoicebooking_description', - plugins: 'paste searchreplace autolink directionality visualblocks visualchars template charmap nonbreaking textpattern noneditable charmap autoresize ', - menubar: false, - entity_encoding : 'raw', - toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect | forecolor removeformat | charmap', - toolbar_sticky: true, - language: 'de', - statusbar: false, - forced_root_block : '', - min_height: 150, - branding: false, - contextmenu: false, - }); + // tinymce.init({ + // selector: '#invoicebooking_description', + // plugins: 'paste searchreplace autolink directionality visualblocks visualchars template charmap nonbreaking textpattern noneditable charmap autoresize ', + // menubar: false, + // entity_encoding : 'raw', + // toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect | forecolor removeformat | charmap', + // toolbar_sticky: true, + // language: 'de', + // statusbar: false, + // forced_root_block : '', + // min_height: 150, + // branding: false, + // contextmenu: false, + // }); } // current_id: null, // loaddata: function(id){ diff --git a/desktopapp/modules/invoices/invoice.html b/desktopapp/modules/invoices/invoice.html index d341d8e..9308aed 100644 --- a/desktopapp/modules/invoices/invoice.html +++ b/desktopapp/modules/invoices/invoice.html @@ -34,11 +34,18 @@
- +
+
+
+ + +
+
diff --git a/desktopapp/modules/invoices/invoice.js b/desktopapp/modules/invoices/invoice.js index 576e9fd..3c3400a 100644 --- a/desktopapp/modules/invoices/invoice.js +++ b/desktopapp/modules/invoices/invoice.js @@ -4,7 +4,7 @@ let invoice = { bookingtbl: null, documents: {}, //addresstbl: null, - selects:{"invoices_invoicetype":null,"invoices_status":null,"invoices_id_template":null}, + selects:{"invoices_invoicetype":null,"invoices_status":null,"invoices_id_template":null,"invoices_mailtemplate":null}, viewmodule: function(id){ myapp.loadmodule('invoices','invoice').then(result => { dataform.cleanform('invoice'); @@ -63,6 +63,10 @@ let invoice = { select: "#invoices_id_template", showSearch: false }); + invoice.selects["invoices_mailtemplate"] =new SlimSelect({ + select: "#invoices_mailtemplate", + showSearch: false + }); // invoice.selects["invoices_id_accounts"] = new SlimSelect({ // select: "#invoices_id_accounts", @@ -73,6 +77,7 @@ let invoice = { //invoice.getAccountsList(); invoice.getReportList(); + invoice.getMailTemplates(); invoice.getStatusList(); invoice.getDocumentList(); invoice.initbookings(); @@ -103,7 +108,7 @@ let invoice = { {title: "Einheit",field: "unit",width: 80 }, {title: "Preis", field: "unitamount",headerSort: false, formatter:"money",hozAlign:"right",width: 80, formatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2}}, {title: "MwSt (%)", field: "vatpercent",headerSort: false, formatter:"money",hozAlign:"right",width: 70, formatterParams:{ decimal:",", thousand:".", symbol:"%", symbolAfter:"p", precision:2}}, - {title: "Netto", field: "netamount",headerSort: false, formatter:"money",hozAlign:"right",width: 100, formatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2},bottomCalc:"sum",bottomCalcFormatter:"money",bottomCalcFormatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2, }}, + {title: "Netto", field: "netamount",headerSort: false, formatter:"money",hozAlign:"right",width: 100, formatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2},bottomCalc:"sum",bottomCalcFormatter:"money",bottomCalcFormatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2 }}, {title: "MwSt", field: "taxamount",headerSort: false, formatter:"money",hozAlign:"right",width: 90, formatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2},bottomCalc:"sum",bottomCalcFormatter:"money",bottomCalcFormatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2, }}, {title: "Brutto", field: "grossamount",headerSort: false, formatter:"money",hozAlign:"right",width: 100, formatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2},bottomCalc:"sum",bottomCalcFormatter:"money",bottomCalcFormatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2, }}, //,bottomCalcFormatter:"money", bottomCalcFormatterParams:{ decimal:",", thousand:".", symbol:"€", symbolAfter:"p", precision:2} @@ -126,7 +131,8 @@ let invoice = { console.log(files); let fileext = /\.(docx$|odt$)+/i; files.forEach(file => { - if (fileext.match(file)) { + console.log(file); + if (file.match(fileext)) { replist.push({"value":file,"text":file}); } }); @@ -135,6 +141,25 @@ let invoice = { }); return false; }, + getMailTemplates: function(){ + console.log("read template path",preferences.global.currentdataset.datapath + '/templates/email'); + fs.readdir(preferences.global.currentdataset.datapath + '/templates/email', (err, files) => { + if (err) console.log(err); + else { + let replist = []; + console.log(files); + let fileext = /\.(eml$|msg$)+/i; + files.forEach(file => { + console.log(file); + if (file.match(fileext)) { + replist.push({"value":file,"text":file}); + } + }); + dataform.fillselectlist(invoice.selects["invoices_mailtemplate"],replist,'value','text'); + } + }); + return false; + }, getStatusList: function(){ db.queryarray("SELECT id, status,color FROM statustypes where reporttypes LIKE '%\"invoice\"%' ORDER BY pos;").then(data => { let stypes = []; @@ -347,7 +372,7 @@ let invoice = { }, createPDF: function(){ //let idreport = invoice.selects["invoices_id_template"].selected(); - let idreport= 'invoice/' + 'simple.odt'; + let idreport= 'invoice/' + invoice.selects["invoices_id_template"].selected(); let fname = document.getElementById("invoices_businessyear").value +"/" + preferences.defaultdata.fileprefix +document.getElementById("invoices_reference").value; //"book":{"type":"queryarray","sql":"SELECT sku, replace(quantity,'.',',') as quantity, replace(printf('%.2f',unitamount),'.',',') as unitamount, unit, name, description, replace(printf('%.2f',taxamount),'.',',') as taxamount, replace(printf('%.2f',taxpercent),'.',',') as taxpercent, replace(printf('%.2f',netamount),'.',',') as netamount FROM bookings where id_invoices= '%%id%%';"}, //"vat":{"type":"query","sql":"select case when count(taxpercent)=1 then taxpercent else null end as taxpercent from (select replace(taxpercent,'.',',') as taxpercent from bookings where id_invoices= '%%id%%' group by taxpercent) xx;"} @@ -364,8 +389,8 @@ let invoice = { if (gtaxpercent != ""){ gtaxpercent = gtaxpercent + "%"; } - repdata["vatpercent"] = gtaxtpercent; - reportnew.generate(idreport,repdata, fname,invoice.afterPDFCreation); + repdata["vatpercent"] = gtaxpercent; + report.generate(idreport,repdata, fname,invoice.afterPDFCreation); }); }); @@ -374,12 +399,12 @@ let invoice = { afterPDFCreation: function(data){ console.log(data); - // if (data && data.file){ - // document.getElementById("invoices_pdffile").value=data.file; - // invoice.openPDF(); - // dataform.savefield(document.getElementById("invoices_pdffile")); - // } - // invoice.hasPDF(); + if (data && data.file){ + document.getElementById("invoices_pdffile").value=data.file; + invoice.openPDF(); + dataform.savefield(document.getElementById("invoices_pdffile")); + } + invoice.hasPDF(); }, openPDF: function(){ if (document.getElementById("invoices_pdffile").value != ''){ @@ -391,6 +416,13 @@ let invoice = { } }, sendEmail: function(){ + db.query("select inv.accountvatid, inv.clientnumber, inv.payedamount, strftime('%d.%m.%Y',inv.invoicedate) as invoicedate, strftime('%d.%m.%Y',inv.deadlinedate) as deadlinedate, inv.footertext, inv.reference, inv.headertext, inv.pdffile, inv.offerreference, inv.referencenumber, inv.accountname, inv.accountaddress, inv.accountzip, inv.accountcity, inv.accountcountry, replace(printf('%.2f',sum(bk.netamount)),'.',',') as netamount,inv.footertext,inv.headertext,replace(printf('%.2f',sum(bk.taxamount)),'.',',') as vatamount, replace(printf('%.2f',sum(bk.netamount + bk.taxamount)),'.',',') as grossamount from invoices inv join bookings bk on (inv.id=bk.id_invoices) where inv.id = '"+ invoice.current_id +"';").then(repdata => { + let idacc = document.getElementById("invoices_id_accounts").value; + db.query("select * from addresses where id='" + idacc+ "';").then( accdata => { + email.create(invoice.selects["invoices_mailtemplate"].selected(),repdata,accdata); + }); + + }); email.openthunderbird() }, @@ -487,7 +519,7 @@ let invoice = { dataform.cleanform("invoicebooking"); if (sel[0]){ db.query("select * from bookings where id='"+ sel[0].id +"'").then(bdata => { - //console.log(bdata); + console.log(bdata); dataform.fillform("invoicebooking",{},bdata); myapp.viewdialog("InvoiceBooking"); }).catch(e => { console.log(e);});; diff --git a/desktopapp/modules/products/products.js b/desktopapp/modules/products/products.js index 35475fb..7e10ee5 100644 --- a/desktopapp/modules/products/products.js +++ b/desktopapp/modules/products/products.js @@ -12,8 +12,8 @@ let products = { init: function(){ products.tbl = new Tabulator("#tbl_products",{ headerFilterPlaceholder: "filter...", - groupBy:["producttype", "productgroup"], - groupStartOpen:[true, true], + //groupBy:["producttype", "productgroup"], + //groupStartOpen:[true, true], height: "calc(100vh - 60px)", layout: "fitColumns", selectable: 1, diff --git a/desktopapp/modules/settings/settings.html b/desktopapp/modules/settings/settings.html index e4ad244..e1c5026 100644 --- a/desktopapp/modules/settings/settings.html +++ b/desktopapp/modules/settings/settings.html @@ -8,53 +8,6 @@
-
- Unternehmens-Daten - -
-
- -
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
-
Standard-Werte
@@ -66,11 +19,11 @@
- +
+ "defaultdata_pref-invoicedeadlinedays" onblur="dataform.savefield(this);" placeholder="Tage" text-align-right="" type="number" value="">
@@ -92,7 +45,10 @@
- +
diff --git a/desktopapp/package-lock.json b/desktopapp/package-lock.json index e85e9d4..f81760c 100644 --- a/desktopapp/package-lock.json +++ b/desktopapp/package-lock.json @@ -21,6 +21,29 @@ "sumchecker": "^3.0.1" } }, + "@kenjiuno/decompressrtf": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@kenjiuno/decompressrtf/-/decompressrtf-0.1.3.tgz", + "integrity": "sha512-Hpgi2jbP73+2Lri8MJ/Jbf8ZIViuG4Z4UsPU3bEqWB6MY8Z6kd8KDLmw/5pUVQq4gvKtDUto8DtXSuEUo3fpPA==" + }, + "@kenjiuno/iconvlite-wrapper-with-iso2022jp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@kenjiuno/iconvlite-wrapper-with-iso2022jp/-/iconvlite-wrapper-with-iso2022jp-0.1.0.tgz", + "integrity": "sha512-glVyhmil2HejINatYPkXMkGZ8M+zN1hAhUm8mzypI+Fm5a1G4v4V6liXK1NLrlBOHAh3SNfzEICc0PxcOmpq7A==", + "requires": { + "encoding-japanese": "^1.0.29", + "iconv-lite": "^0.4.24" + } + }, + "@kenjiuno/msgreader": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@kenjiuno/msgreader/-/msgreader-1.4.0.tgz", + "integrity": "sha512-nBu7VTdIL9z/xBX3QFX/SOU+vknHorzIn2XygFRV4W2Sp2VMFBJ//2DgxKlR0wwK59CgNZjtDRDoazET5StgQg==", + "requires": { + "@kenjiuno/decompressrtf": "^0.1.3", + "@kenjiuno/iconvlite-wrapper-with-iso2022jp": "^0.1.0" + } + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -644,6 +667,11 @@ } } }, + "eml-format2": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/eml-format2/-/eml-format2-0.5.0.tgz", + "integrity": "sha512-dDigfpSWSSzNHBG+U9ZDMIgR7CXPiBnPyW2cR6DWW/f+NDwQ2E45WhgFmADHAkl/T3Vjegn7amg9l+bJ3WD8ew==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -651,6 +679,11 @@ "dev": true, "optional": true }, + "encoding-japanese": { + "version": "1.0.30", + "resolved": "https://registry.npmjs.org/encoding-japanese/-/encoding-japanese-1.0.30.tgz", + "integrity": "sha512-bd/DFLAoJetvv7ar/KIpE3CNO8wEuyrt9Xuw6nSMiZ+Vrz/Q21BPsMHvARL2Wz6IKHKXgb+DWZqtRg1vql9cBg==" + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", diff --git a/desktopapp/package.json b/desktopapp/package.json index 9b3ac12..ac8b0e5 100644 --- a/desktopapp/package.json +++ b/desktopapp/package.json @@ -20,7 +20,9 @@ "electron-packager": "^15.1.0" }, "dependencies": { + "@kenjiuno/msgreader": "^1.4.0", "carbone": "^2.1.1", + "eml-format2": "^0.5.0", "sqlite3": "^5.0.0" } } diff --git a/install/admin_install_prereq.ps1 b/install/admin_install_prereq.ps1 new file mode 100644 index 0000000..970481c --- /dev/null +++ b/install/admin_install_prereq.ps1 @@ -0,0 +1,9 @@ +if ((-not (Get-Variable -Name PSScriptRoot -ValueOnly -ErrorAction SilentlyContinue)) -and + ($scriptBlockFile = $MyInvocation.MyCommand.ScriptBlock.File)) { + $PSScriptRoot = $MyInvocation.MyCommand.ScriptBlock.File + +} +$PSScriptRoot +$myfp = $PSScriptRoot + "\install_choco.ps1" +$myfp +Start-Process PowerShell -Verb RunAs -WorkingDirectory $PSScriptRoot -ArgumentList $myfp \ No newline at end of file diff --git a/install/install_choco.ps1 b/install/install_choco.ps1 index ac618d6..52c92f2 100644 --- a/install/install_choco.ps1 +++ b/install/install_choco.ps1 @@ -2,5 +2,5 @@ $InstallDir= 'C:\ProgramData\chocoportable' $env:ChocolateyInstall="$InstallDir" Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -choco install python -y +#choco install python -y choco install libreoffice-still -y \ No newline at end of file diff --git a/install/windows/setup_64bit.iss b/install/windows/setup_64bit.iss index ae6b273..07dbfa9 100644 --- a/install/windows/setup_64bit.iss +++ b/install/windows/setup_64bit.iss @@ -1,13 +1,13 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define public MyAppVersion "1.0.1" -#define public MyOutputDir "D:\Workspace\invoicejournal\release" -#define public MySourceDir "D:\Workspace\invoicejournal" -#define public MySetupName "setup_invoicejournal.exe" +;#define public MyAppVersion "1.0.1" +;#define public MyOutputDir "D:\Workspace\invoicejournal\release" +;#define public MySourceDir "D:\Workspace\invoicejournal" +;#define public MySetupName "setup_invoicejournal.exe" #define MyAppName "Invoice Journal" -#define MyAppPublisher "DKS s.�r.l." +#define MyAppPublisher "DKS s.à r.l." #define MyAppURL "https://www.dks.lu/" #define MyAppExeName "invoicejournal.exe" @@ -27,7 +27,7 @@ DefaultDirName={autopf}\InvoiceJournal DisableWelcomePage=yes DisableProgramGroupPage=yes DisableDirPage=yes -UserInfoPage=yes +;UserInfoPage=yes CloseApplications=force CloseApplicationsFilter=invoicejournal.exe LicenseFile={#MySourceDir}\install\EULA_Default.rtf @@ -53,45 +53,45 @@ Name: "french"; MessagesFile: "compiler:Languages\French.isl" [Files] Source: "{#MySourceDir}\release-builds\invoicejournal-win32-x64\invoicejournal.exe"; DestDir: "{app}"; Flags: overwritereadonly ignoreversion Source: "{#MySourceDir}\release-builds\invoicejournal-win32-x64\*"; DestDir: "{app}"; Flags: overwritereadonly ignoreversion recursesubdirs createallsubdirs -Source: "{#MySourceDir}\install\iinstall_choco.ps1"; DestDir: "{tmp}" +Source: "{#MySourceDir}\install\install_choco.ps1"; DestDir: "{tmp}" [Icons] Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" [Run] -Filename: "powershell.exe";Parameters: "-ExecutionPolicy Bypass -File ""{tmp}\setup.ps1"""; WorkingDir: {tmp}; Flags: runhidden +Filename: "powershell.exe";Parameters: "-ExecutionPolicy Bypass -File ""{tmp}\install_choco.ps1"""; WorkingDir: {tmp}; Flags: runhidden Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [Code] -function CheckSerial(Serial: String): Boolean; -begin - Result := (Serial <> ''); -end; +; function CheckSerial(Serial: String): Boolean; +; begin +; Result := (Serial <> ''); +; end; -function NextButtonClick(CurPageID: Integer): Boolean; -var - WinHttpReq: Variant; - WMIResult: Variant; - Url: string; -begin - Result := True; - if CurPageID = wpUserInfo then - begin - WMIResult := GetWMIInfo('') - WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); - Url := 'http://localhost/license/licensecheck.php?serial=' + - WizardForm.UserInfoSerialEdit.Text; +; function NextButtonClick(CurPageID: Integer): Boolean; +; var +; WinHttpReq: Variant; +; WMIResult: Variant; +; Url: string; +; begin +; Result := True; +; if CurPageID = wpUserInfo then +; begin +; WMIResult := GetWMIInfo('') +; WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); +; Url := 'http://localhost/license/licensecheck.php?serial=' + +; WizardForm.UserInfoSerialEdit.Text; - WinHttpReq.Open('GET', Url, False); - WinHttpReq.Send(''); - { Depending on implementation of the server, use wither HTTP status code (.Status) or } - { contents of returned "page" (.ResponseText) } - { Here we use the HTTP status code: } - { 200 = serial is valid, anything else = serial is invalid, } - { and when invalid, we display .ResponseText } - Result := (WinHttpReq.Status = 200); - if not Result then - MsgBox(WinHttpReq.ResponseText, mbError, MB_OK); - end; -end; \ No newline at end of file +; WinHttpReq.Open('GET', Url, False); +; WinHttpReq.Send(''); +; { Depending on implementation of the server, use wither HTTP status code (.Status) or } +; { contents of returned "page" (.ResponseText) } +; { Here we use the HTTP status code: } +; { 200 = serial is valid, anything else = serial is invalid, } +; { and when invalid, we display .ResponseText } +; Result := (WinHttpReq.Status = 200); +; if not Result then +; MsgBox(WinHttpReq.ResponseText, mbError, MB_OK); +; end; +; end; \ No newline at end of file diff --git a/install/windows_installer.bat b/install/windows_installer.bat index 774ed8a..5aa3fe8 100644 --- a/install/windows_installer.bat +++ b/install/windows_installer.bat @@ -23,8 +23,8 @@ set /p tag=Enter Tag: @REM call npm run package-win64 > tmpcompile.txt @REM cd .. -mkdir %CD%\release-builds\invoicejournal-win32-x64\tools -xcopy %CD%\tools\* %CD%\release-builds\invoicejournal-win32-x64\tools\ +@REM mkdir %CD%\release-builds\invoicejournal-win32-x64\tools +@REM xcopy %CD%\tools\* %CD%\release-builds\invoicejournal-win32-x64\tools\ del %CD%\release\%appname%_%tag%_Setup.exe echo "Compile Setup %CD%\install\windows\setup_64bit.iss" "C:/Program Files (x86)/Inno Setup 6/ISCC.exe" /V3 /DMyAppVersion=%tag% /DMyOutputDir=%CD%\release /DMySourceDir=%CD% /DMySetupName=%appname%_%tag%_Setup %CD%\install\windows\setup_64bit.iss