v20240603074716 0.13.1
authorKilian Saffran <ksaffran@dks.lu>
Mon, 3 Jun 2024 05:50:09 +0000 (07:50 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Mon, 3 Jun 2024 05:50:09 +0000 (07:50 +0200)
dev/release_app.sh
public_html/lib/App/Sepa.php
public_html/lib/App/WorkerProcess.php
public_html/lib/version.php
public_html/tmpl/js/app/invoicing.min.js
public_html/tmpl/js/pages/invoicing.js

index 399f208..68dbe45 100644 (file)
@@ -66,51 +66,6 @@ if [[ "${ACTION}" == "update" ]]
 then
   rsync -n -av -e "ssh -p ${SSHPORT}" ${BASEDIR}/release/$newtag/* ${SSHUSER}@${SSHHOST}${REMOTEAPPFOLDER}/ 
 fi
-exit
-#find . -type f -printf "%p|%s|%TY%Tm%Td%TH%TM%.2TS\n" | grep -v "./data/" | grep -v "./log/" | grep -v "./config." | grep -v "./lib/Config.php" | sort > ${TMPDIR}/sourcefiles.local.txt
 
-#ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} 'cd '${REMOTEAPPFOLDER}' && find . -type f -printf "%p|%s|%TY%Tm%Td%TH%TM%.2TS\n" | grep -v "./data/" | grep -v "/log/" | grep -v "./config./" | grep -v "./lib/Config.php" | sort' > ${TMPDIR}/sourcefiles.remote.txt
-#diff -y -W 200 ${TMPDIR}/sourcefiles.local.txt ${TMPDIR}/sourcefiles.remote.txt | grep version
+echo "${ACTION} of $newtag done successfully"
 
-# echo "To update:"
-# UPDFILES=`diff -y -W 200 ${TMPDIR}/sourcefiles.local.txt ${TMPDIR}/sourcefiles.remote.txt | grep " |" | awk '{ print $1 }' | cut -d"|" -f 1`
-# #| grep -v ".htaccess" | grep -v "/config.php" | grep -v ".git" | grep -v "/media/"
-# echo ${UPDFILES}
-# cd ${CALLDIR} && exit
-# echo ""
-# echo "new files:"
-# INSFILES=`diff -y -W 200 ${TMPDIR}/sourcefiles.local.txt ${TMPDIR}/sourcefiles.remote.txt | grep " <" | awk '{ print $1 }' | cut -d"|" -f 1 | grep -v ".htaccess" | grep -v "/config.php" | grep -v ".git" | grep -v "/media/"`
-# echo ${INSFILES}
-# echo ""
-# echo "only online or OLD files:"
-# diff -y -W 200 ${TMPDIR}/sourcefiles.remote.txt ${TMPDIR}/sourcefiles.local.txt | grep " <" | awk '{ print $1 }'
-# echo ""
-# echo "----------------------------"
-# echo ""
-#cd ${CALLDIR}"/app"
-
-if [ -e ${TMPDIR}/update_${CDATE}.tar.gz ]
-then
-  rm ${TMPDIR}/update_${CDATE}.tar.gz
-fi
-if [ "${UPDFILES}" != "" ] || [ "${INSFILES}" != "" ]
-then 
-  echo "TAR package:" 
-  tar czvf ${TMPDIR}/update_${CDATE}.tar.gz ${UPDFILES} ${INSFILES}
-  #tar tzvf ${CALLDIR}/update_${CDATE}.tar.gz
-fi
-if [ "${UPLOAD}" == "upload" ]
-then
- echo "upload/Install files"
- if [ -e ${TMPDIR}/update_${CDATE}.tar.gz ]
- then
-  scp -P ${SSHPORT}  ${TMPDIR}/update_${CDATE}.tar.gz ${SSHUSER}@${SSHHOST}:${REMOTEAPPFOLDER}
-  ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} 'cd '${REMOTEAPPFOLDER}' && tar xzvf update_'${CDATE}'.tar.gz && rm update_'${CDATE}'.tar.gz'
- else
-  echo "NO Files to Install/upload!"
- fi
-fi
-if [ -e ${TMPDIR}/update_${CDATE}.tar.gz ]
-then
-  rm ${TMPDIR}/update_${CDATE}.tar.gz
-fi
\ No newline at end of file
index e25388d..e1489fa 100644 (file)
@@ -201,7 +201,7 @@ class Sepa extends stdClass {
                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                        $phpexe=$_SERVER['PHPRC']."\\php.exe";
                } else {
-                       $phpexe=$_SERVER['PHPRC']."/php";
+                       $phpexe="php";
                }
                $xmlfile=date('Ymd_his').".xml";
                $params = "";
@@ -222,7 +222,7 @@ class Sepa extends stdClass {
                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                        $phpexe=$_SERVER['PHPRC']."\\php.exe";
                } else {
-                       $phpexe=$_SERVER['PHPRC']."/php";
+                       $phpexe="php";
                }
                $pinfo = $pp->executeCli($phpexe." ".$this->cfg["scripts"]."importsepaxml.php"." -f ".$xmlfile."","imporetsepa");
                return $pinfo;
index 24fcb95..1793033 100644 (file)
@@ -34,7 +34,12 @@ class WorkerProcess extends stdClass {
     }
                
     $command .= " > ".$redirectlog.""; 
-               pclose(popen("start /B ". $command, "r"));
+               if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+                       pclose(popen("start /B ". $command, "r"));
+               } else {
+                       pclose(popen($command." &", "r"));
+               }
+               
                //$retval = exec($command);
                $ret = array('log' => basename($redirectlog),"status" => null,"msg" => "started","cmd" => $command,"process" => getmypid());    
                return $ret;
index fddf781..727130c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-$cfg["version"]="0.12.4";
+$cfg["version"]="0.13.1";
 if ($cfg["debug"] == "1"){
   $cfg["version"] =date('YmdHis');
 }
index d2eddc1..ea3289d 100644 (file)
@@ -1 +1 @@
-let invoicing={tbl:null,tbldates:null,selects:{},filters:{status:{"":""}},init:function(){let tomorrow=new Date;tomorrow.setDate(tomorrow.getDate()+1),flatpickr("#debitdate",{altInput:!0,allowInput:!0,altFormat:"d/m/Y",dateFormat:"Y-m-d",defaultDate:tomorrow,minDate:tomorrow}),this.selects=dataform.initSelects(document.getElementsByClassName("select")),invoicing.tbldates=new Tabulator("#tbl_dates",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 65px)",layout:"fitDataStretch",selectable:1,columns:[{title:"Mois",field:"id",width:120,hozAlign:"center",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Count",field:"cnt",width:50,headerFilter:!1,headerSort:!1,hozAlign:"right"}]}),invoicing.tbldates.on("rowClick",(function(e,row){invoicing.gettblCotisationsData(),invoicing.gettblTransactionsData()})),invoicing.tbl_cotisations=new Tabulator("#tbl_cotisations",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 120px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",rowContextMenu:[{label:'<span class="rowicon icon-edit"></span>éditer',action:function(e,row){return invoicing.editCotisation(),!1}}],columns:[{title:"#",formatter:"rownum",headerFilter:null,headerMenu:tablehelper.headerMenu},{title:"Nom",field:"lastname",width:200},{title:"Prénom",field:"firstname",width:200},{title:"Mois",field:"date_month",visible:!1,formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Date Traitement",field:"date_transaction",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"dd/MM/yyyy",invalidPlaceholder:""}},{title:"status",field:"status",headerFilter:"list",formatter:tablehelper.statusFormatter,headerFilterParams:{valuesLookup:!0,clearable:!0}},{title:"Montant",field:"amount",formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2},bottomCalc:tablehelper.totalAmount},{title:"Type Payement",field:"paymenttype",headerFilter:"list",headerFilterParams:{valuesLookup:!0,clearable:!0}},{title:"Fichier Export",field:"sepa_file_out",visible:!1},{title:"Fichier Import",field:"transaction_file_in",visible:!1},{title:"ID Transaction",field:"transaction_id",visible:!1},{title:"Code SEPA",field:"last_sepa_code"}]}),invoicing.tbl_cotisations.on("rowDblClick",(function(e,row){invoicing.editCotisation()})),invoicing.tbl_transactions=new Tabulator("#tbl_transactions",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 120px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",rowContextMenu:[{label:'<span class="rowicon icon-edit"></span>éditer',action:function(e,row){return invoicing.editTransaction(),!1}}],columns:[{title:"#",formatter:"rownum",headerFilter:null},{title:"Date Transaction",field:"datemovement"},{title:"nom",field:"lastname"},{title:"Prénom",field:"firstname"},{title:"succès",field:"success"},{title:"Cotisation Type",field:"quotatype"},{title:"Montant",field:"quota",formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2}},{title:"Fichier XML Retour",field:"filexml"},{title:"Ficher XML Envoi",field:"refxml"},{title:"Sepa signé",field:"sepasigned"},{title:"Groupe Sepa",field:"sepagroup"},{title:"Compte Débiteur",field:"accountout"},{title:"Compter Crediteur",field:"accountin"},{title:"Note",field:"quotaobs"},{title:"Message Erreur",field:"errormsg"},{title:"Code Erreur",field:"errorcode"}]}),invoicing.tblexportsepa=new Tabulator("#tbl_exportsepa",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 125px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",groupBy:["date_month"],groupStartOpen:[!0],groupHeader:[function(value,count,data,group){return value?value+" ("+count+")":""}],groupClosedShowCalcs:!0,columns:[{formatter:"rowSelection",titleFormatter:"rowSelection",hozAlign:"center",headerSort:!1,headerFilter:null},{title:"#",formatter:"rownum",headerFilter:null},{title:"Nom",field:"lastname",width:250},{title:"Prénom",field:"firstname",width:250},{title:"Mois",field:"date_month",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Montant",field:"amount",headerFilter:!1,headerSort:!1,width:100,formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2},bottomCalc:tablehelper.totalAmount},{title:"Status",field:"status",headerFilter:"list",formatter:tablehelper.statusFormatter,headerFilterParams:{valuesLookup:!0,clearable:!0}}]})},load:function(){invoicing.gettbldates(),invoicing.gettblTransactionsData(),invoicing.gettblCotisationsData(),myapp.viewpanel("invoicing")},gettbldates:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),postData({cl:"Cotisations",fn:"getDatesList"}).then(data=>{invoicing.tbldates.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},gettblTransactionsData:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),sel&&sel[0]&&postData({cl:"Payments",fn:"getList",month:sel[0].month,year:sel[0].year}).then(data=>{invoicing.tbl_transactions.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},gettblCotisationsData:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),sel&&sel[0]&&postData({cl:"Cotisations",fn:"getList",monthdate:sel[0].id}).then(data=>{invoicing.tbl_cotisations.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},editCotisation:function(){let sel=null;invoicing.tbl_cotisations&&(sel=invoicing.tbl_cotisations.getSelectedData()),document.getElementById("dlg_cotisation_btnok").setAttribute("onclick","invoicing.saveCotisation();"),sel[0]&&postData({cl:"Cotisations",fn:"getRowData",id:sel[0].id}).then(data=>{dataform.fillform("cotisation",this.selects,data.result.data),myapp.viewdialog("cotisation")})},saveCotisation(){let datatosave=dataform.getContent("cotisation",invoicing.selects),transferdata={amount:datatosave.amount,paymenttype:datatosave.paymenttype,date_transaction:datatosave.date_transaction,status:datatosave.status};postData({cl:"Cotisations",fn:"saveRow",id:datatosave.id,data:transferdata}).then(data=>{invoicing.gettblCotisationsData(),document.getElementById("dlg_cotisation").style.display="none"}).catch(e=>{document.getElementById("dlg_cotisation").style.display="none"})},editTransaction:function(){let sel=null;invoicing.tbl&&(sel=invoicing.tbl.getSelectedData()),sel[0]&&postData({cl:"Cotisations",fn:"getRowData",id:sel[0].id}).then(data=>{dataform.fillform("cootisation",this.selects,data.result.data),myapp.viewdialog("cotisation")})},saveTransaction(){},getCountries:function(){postData({cl:"Countries",fn:"getCountries"}).then(data=>{data.result.data.unshift({iso2:null,country:null}),dataform.fillselectlist(this.selects.birthcountry,data.result.data,"iso2","country"),dataform.fillselectlist(this.selects.addresscountry,data.result.data,"iso2","country")})},loadFileDlg(){},importSepa(){myapp.upload("Import fichier XML SEPA","","importer","annuler","invoicing.importSepaFile();","text/xml")},getProcessInfo(logfile){console.log("Start get info ",logfile),postData({cl:"WorkerProcess",fn:"getLastWorkerInfo",logfile:logfile}).then(data=>{var windowReference;(console.log("info returend",data.result.data),data.result.data.info&&"error"!=data.result.data.status)?(myapp.setDataloadText(data.result.data.info),data.result.data.info.startsWith("End: ")&&(progressinfo.stopGetInfo(),logfile.endsWith("exportsepa.log")&&!data.result.data.info.startsWith("End: Erreur:")&&(window.open().location=api+"file.php?open="+encodeURIComponent(invoicing.exportfile)))):"error"==data.result.data.status&&(myapp.setDataloadText(data.result.data.error),progressinfo.stopGetInfo())}).catch(e=>{myapp.setDataloadText("ne peux pas avoir d'info sur le progrès!")})},importSepaFile(){console.log("Start Sepa Import"),myapp.openDataload("Import données","Attendez svp! Import XML encours!"),postFile(document.getElementById("dlg_uploadfile_files"),{folder:"importsepa"}).then(data=>{console.log("return File Import",data),data.file?postData({cl:"Sepa",fn:"startSepaImport",xmlfile:data.file}).then(data=>{console.log(data.result.data),progressinfo.startGetInfo("invoicing.getProcessInfo('"+data.result.data.log+"')",1)}):(myapp.closeDataload(),myapp.message("Erreur","Échec de l'importation du fichier XML!"))}).catch(e=>{console.log("Error Dataload!",e),myapp.closeDataload(),myapp.message("Erreur","Échec de l'importation du fichier XML!",e.msg)})},viewTabExport:function(){myapp.viewtab("tab_invoicing","inv_export"),myapp.openDataload("Recherche données","Attendez svp!"),postData({cl:"Cotisations",fn:"getUnpaidSepaList"}).then(data=>{console.log(data.result.data),invoicing.tblexportsepa.setData(data.result.data).then(data=>{}),myapp.closeDataload()}).catch(e=>{console.log(e),myapp.closeDataload()})},viewTabTransactions:function(){myapp.viewtab("tab_invoicing","inv_transactions")},viewTabCotisations:function(){myapp.viewtab("tab_invoicing","inv_cotisations")},addCotisationMonth:function(){postData({cl:"Cotisations",fn:"addCotisationMonth"}).then(data=>{invoicing.gettbldates()}).catch(e=>{})},updateCotisationMonth:function(){let selmonyear=invoicing.tbldates.getSelectedData();selmonyear[0]?postData({cl:"Cotisations",fn:"checkSepaTransactions",month:selmonyear[0].id}).then(data=>{invoicing.gettblCotisationsData(),invoicing.gettblTransactionsData()}).catch(e=>{}):myapp.message("Info","Pas de mois sélectionné!")},exportSepa:function(){let selmonyear=invoicing.tbldates.getSelectedData(),selunpaid=invoicing.tblexportsepa.getSelectedData(),debitdate=document.getElementById("debitdate").value;console.log("Start Sepa Export"),myapp.openDataload("Export des données","Attendez svp! Export XML encours!"),unpaid=[];let sendmonth=0,sendyear=0;if(selmonyear[0]&&(sendmonth=selmonyear[0].month,sendyear=selmonyear[0].year),selunpaid[0])for(i=0;i<selunpaid.length;i++)unpaid.push(selunpaid[i].id);else unpaid=[];selmonyear[0]||selunpaid||(myapp.message("Info","Pas de mois et ou non-payés sélectionnés!"),myapp.closeDataload()),postData({cl:"Sepa",fn:"createSepa",year:sendyear,month:sendmonth,unpaiddata:unpaid,debitdate:debitdate}).then(data=>{console.log("Export result",data.result.data),progressinfo.startGetInfo("invoicing.getProcessInfo('"+data.result.data.log+"')",1),invoicing.exportfile=data.result.data.file}).catch(e=>{console.log("Error export Sepa!",e),myapp.closeDataload(),myapp.message("Erreur","Échec de l'export du fichier XML!",e.msg)})}};
\ No newline at end of file
+let invoicing={tbl:null,tbldates:null,selects:{},filters:{status:{"":""}},init:function(){let tomorrow=new Date;tomorrow.setDate(tomorrow.getDate()+1),flatpickr("#debitdate",{altInput:!0,allowInput:!0,altFormat:"d/m/Y",dateFormat:"Y-m-d",defaultDate:tomorrow,minDate:tomorrow}),this.selects=dataform.initSelects(document.getElementsByClassName("select")),invoicing.tbldates=new Tabulator("#tbl_dates",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 65px)",layout:"fitDataStretch",selectable:1,columns:[{title:"Mois",field:"id",width:120,hozAlign:"center",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Count",field:"cnt",width:50,headerFilter:!1,headerSort:!1,hozAlign:"right"}]}),invoicing.tbldates.on("rowClick",(function(e,row){invoicing.gettblCotisationsData(),invoicing.gettblTransactionsData()})),invoicing.tbl_cotisations=new Tabulator("#tbl_cotisations",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 120px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",rowContextMenu:[{label:'<span class="rowicon icon-edit"></span>éditer',action:function(e,row){return invoicing.editCotisation(),!1}}],columns:[{title:"#",formatter:"rownum",headerFilter:null,headerMenu:tablehelper.headerMenu},{title:"Nom",field:"lastname",width:200},{title:"Prénom",field:"firstname",width:200},{title:"Mois",field:"date_month",visible:!1,formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Date Traitement",field:"date_transaction",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"dd/MM/yyyy",invalidPlaceholder:""}},{title:"status",field:"status",headerFilter:"list",formatter:tablehelper.statusFormatter,headerFilterParams:{valuesLookup:!0,clearable:!0}},{title:"Montant",field:"amount",formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2},bottomCalc:tablehelper.totalAmount},{title:"Type Payement",field:"paymenttype",headerFilter:"list",headerFilterParams:{valuesLookup:!0,clearable:!0}},{title:"Fichier Export",field:"sepa_file_out",visible:!1},{title:"Fichier Import",field:"transaction_file_in",visible:!1},{title:"ID Transaction",field:"transaction_id",visible:!1},{title:"Code SEPA",field:"last_sepa_code"}]}),invoicing.tbl_cotisations.on("rowDblClick",(function(e,row){invoicing.editCotisation()})),invoicing.tbl_transactions=new Tabulator("#tbl_transactions",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 120px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",rowContextMenu:[{label:'<span class="rowicon icon-edit"></span>éditer',action:function(e,row){return invoicing.editTransaction(),!1}}],columns:[{title:"#",formatter:"rownum",headerFilter:null},{title:"Date Transaction",field:"datemovement"},{title:"nom",field:"lastname"},{title:"Prénom",field:"firstname"},{title:"succès",field:"success"},{title:"Cotisation Type",field:"quotatype"},{title:"Montant",field:"quota",formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2}},{title:"Fichier XML Retour",field:"filexml"},{title:"Ficher XML Envoi",field:"refxml"},{title:"Sepa signé",field:"sepasigned"},{title:"Groupe Sepa",field:"sepagroup"},{title:"Compte Débiteur",field:"accountout"},{title:"Compter Crediteur",field:"accountin"},{title:"Note",field:"quotaobs"},{title:"Message Erreur",field:"errormsg"},{title:"Code Erreur",field:"errorcode"}]}),invoicing.tblexportsepa=new Tabulator("#tbl_exportsepa",{columnDefaults:{resizable:!1,headerFilterPlaceholder:"",headerSort:!0,headerFilter:"input",formatter:"html"},height:"calc(100vh - 125px)",layout:"fitDataStretch",selectable:!0,selectableRangeMode:"click",groupBy:["date_month"],groupStartOpen:[!0],groupHeader:[function(value,count,data,group){return value?value+" ("+count+")":""}],groupClosedShowCalcs:!0,columns:[{formatter:"rowSelection",titleFormatter:"rowSelection",hozAlign:"center",headerSort:!1,headerFilter:null},{title:"#",formatter:"rownum",headerFilter:null},{title:"Nom",field:"lastname",width:250},{title:"Prénom",field:"firstname",width:250},{title:"Mois",field:"date_month",formatter:"datetime",formatterParams:{inputFormat:"yyyy-MM-dd",outputFormat:"MM/yyyy",invalidPlaceholder:""}},{title:"Montant",field:"amount",headerFilter:!1,headerSort:!1,width:100,formatter:"money",hozAlign:"right",formatterParams:{decimal:",",thousand:"",symbol:"€",symbolAfter:"p",negativeSign:!0,precision:2},bottomCalc:tablehelper.totalAmount},{title:"Status",field:"status",headerFilter:"list",formatter:tablehelper.statusFormatter,headerFilterParams:{valuesLookup:!0,clearable:!0}}]})},load:function(){invoicing.gettbldates(),invoicing.gettblTransactionsData(),invoicing.gettblCotisationsData(),myapp.viewpanel("invoicing")},gettbldates:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),postData({cl:"Cotisations",fn:"getDatesList"}).then(data=>{invoicing.tbldates.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},gettblTransactionsData:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),sel&&sel[0]&&postData({cl:"Payments",fn:"getList",month:sel[0].month,year:sel[0].year}).then(data=>{invoicing.tbl_transactions.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},gettblCotisationsData:function(){let sel=null;invoicing.tbldates.initialized&&(sel=invoicing.tbldates.getSelectedData()),sel&&sel[0]&&postData({cl:"Cotisations",fn:"getList",monthdate:sel[0].id}).then(data=>{invoicing.tbl_cotisations.setData(data.result.data).then(data=>{})}).catch(e=>{console.log(e)})},editCotisation:function(){let sel=null;invoicing.tbl_cotisations&&(sel=invoicing.tbl_cotisations.getSelectedData()),document.getElementById("dlg_cotisation_btnok").setAttribute("onclick","invoicing.saveCotisation();"),sel[0]&&postData({cl:"Cotisations",fn:"getRowData",id:sel[0].id}).then(data=>{dataform.fillform("cotisation",this.selects,data.result.data),myapp.viewdialog("cotisation")})},saveCotisation(){let datatosave=dataform.getContent("cotisation",invoicing.selects),transferdata={amount:datatosave.amount,paymenttype:datatosave.paymenttype,date_transaction:datatosave.date_transaction,status:datatosave.status};postData({cl:"Cotisations",fn:"saveRow",id:datatosave.id,data:transferdata}).then(data=>{invoicing.gettblCotisationsData(),document.getElementById("dlg_cotisation").style.display="none"}).catch(e=>{document.getElementById("dlg_cotisation").style.display="none"})},editTransaction:function(){let sel=null;invoicing.tbl&&(sel=invoicing.tbl.getSelectedData()),sel[0]&&postData({cl:"Cotisations",fn:"getRowData",id:sel[0].id}).then(data=>{dataform.fillform("cootisation",this.selects,data.result.data),myapp.viewdialog("cotisation")})},saveTransaction(){},getCountries:function(){postData({cl:"Countries",fn:"getCountries"}).then(data=>{data.result.data.unshift({iso2:null,country:null}),dataform.fillselectlist(this.selects.birthcountry,data.result.data,"iso2","country"),dataform.fillselectlist(this.selects.addresscountry,data.result.data,"iso2","country")})},loadFileDlg(){},importSepa(){myapp.upload("Import fichier XML SEPA","","importer","annuler","invoicing.importSepaFile();","text/xml")},getProcessInfo(logfile){console.log("Start get info ",logfile),postData({cl:"WorkerProcess",fn:"getLastWorkerInfo",logfile:logfile}).then(data=>{var windowReference;(console.log("info returend",data.result.data),data.result.data.info&&"error"!=data.result.data.status)?(myapp.setDataloadText(data.result.data.info),data.result.data.info.startsWith("End: ")&&(progressinfo.stopGetInfo(),logfile.endsWith("exportsepa.log")&&!data.result.data.info.startsWith("End: Erreur:")&&(window.open().location=api+"file.php?open="+encodeURIComponent(invoicing.exportfile)))):"error"==data.result.data.status&&(myapp.setDataloadText(data.result.data.error),progressinfo.stopGetInfo())}).catch(e=>{myapp.setDataloadText("ne peux pas avoir d'info sur le progrès!")})},importSepaFile(){console.log("Start Sepa Import"),myapp.openDataload("Import données","Attendez svp! Import XML encours!"),postFile(document.getElementById("dlg_uploadfile_files"),{folder:"importsepa"}).then(data=>{console.log("return File Import",data),data.file?postData({cl:"Sepa",fn:"startSepaImport",xmlfile:data.file}).then(data=>{console.log("Before get Processinfo",data.result.data),progressinfo.startGetInfo("invoicing.getProcessInfo('"+data.result.data.log+"')",1)}):(myapp.closeDataload(),myapp.message("Erreur","Échec de l'importation du fichier XML!"))}).catch(e=>{console.log("Error Dataload!",e),myapp.closeDataload(),myapp.message("Erreur","Échec de l'importation du fichier XML!",e.msg)})},viewTabExport:function(){myapp.viewtab("tab_invoicing","inv_export"),myapp.openDataload("Recherche données","Attendez svp!"),postData({cl:"Cotisations",fn:"getUnpaidSepaList"}).then(data=>{console.log(data.result.data),invoicing.tblexportsepa.setData(data.result.data).then(data=>{}),myapp.closeDataload()}).catch(e=>{console.log(e),myapp.closeDataload()})},viewTabTransactions:function(){myapp.viewtab("tab_invoicing","inv_transactions")},viewTabCotisations:function(){myapp.viewtab("tab_invoicing","inv_cotisations")},addCotisationMonth:function(){postData({cl:"Cotisations",fn:"addCotisationMonth"}).then(data=>{invoicing.gettbldates()}).catch(e=>{})},updateCotisationMonth:function(){let selmonyear=invoicing.tbldates.getSelectedData();selmonyear[0]?postData({cl:"Cotisations",fn:"checkSepaTransactions",month:selmonyear[0].id}).then(data=>{invoicing.gettblCotisationsData(),invoicing.gettblTransactionsData()}).catch(e=>{}):myapp.message("Info","Pas de mois sélectionné!")},exportSepa:function(){let selmonyear=invoicing.tbldates.getSelectedData(),selunpaid=invoicing.tblexportsepa.getSelectedData(),debitdate=document.getElementById("debitdate").value;console.log("Start Sepa Export"),myapp.openDataload("Export des données","Attendez svp! Export XML encours!"),unpaid=[];let sendmonth=0,sendyear=0;if(selmonyear[0]&&(sendmonth=selmonyear[0].month,sendyear=selmonyear[0].year),selunpaid[0])for(i=0;i<selunpaid.length;i++)unpaid.push(selunpaid[i].id);else unpaid=[];selmonyear[0]||selunpaid||(myapp.message("Info","Pas de mois et ou non-payés sélectionnés!"),myapp.closeDataload()),postData({cl:"Sepa",fn:"createSepa",year:sendyear,month:sendmonth,unpaiddata:unpaid,debitdate:debitdate}).then(data=>{console.log("Export result",data.result.data),progressinfo.startGetInfo("invoicing.getProcessInfo('"+data.result.data.log+"')",1),invoicing.exportfile=data.result.data.file}).catch(e=>{console.log("Error export Sepa!",e),myapp.closeDataload(),myapp.message("Erreur","Échec de l'export du fichier XML!",e.msg)})}};
\ No newline at end of file
index da8546f..128ecf2 100644 (file)
@@ -340,9 +340,10 @@ let invoicing = {
     
     postFile(document.getElementById("dlg_uploadfile_files"),{"folder":"importsepa"}).then( data => {
       console.log("return File Import",data);
+
       if (data.file){
         postData({"cl":"Sepa","fn":"startSepaImport","xmlfile":data.file}).then(data => {
-          console.log(data.result.data);
+          console.log("Before get Processinfo",data.result.data);
           progressinfo.startGetInfo("invoicing.getProcessInfo('"+data.result.data.log+"')",1);
           
           // invoicing.gettbldates();