Dokumente hinzu und Anzeigefehler korrigiert
This commit is contained in:
@@ -193,11 +193,10 @@ buchungenServer <- function(id, conn, r_global) {
|
||||
## *** Anhänge anzeigen ----
|
||||
tagList(lapply(seq_len(nrow(att)), function(i) {
|
||||
ext <- tools::file_ext(att$original_name[i])
|
||||
filename <- paste0("www/documents/", att$id[i], ".", ext)
|
||||
filename <- paste0("documents/", att$id[i], ".", ext)
|
||||
|
||||
## *** Anhang öffnen ----
|
||||
observeEvent(input[[paste0("open_att_", att$id[i])]], {
|
||||
browser()
|
||||
showModal(modalDialog(
|
||||
tags$iframe(src = filename, width = "100%", height = "600px",
|
||||
style = "border:none;"),
|
||||
|
||||
+233
-278
@@ -3,11 +3,12 @@
|
||||
## Keeps Hibiscus payload fields unchanged
|
||||
##
|
||||
|
||||
library(tidyverse)
|
||||
library(dbx)
|
||||
library(RJDBC)
|
||||
library(DBI)
|
||||
library(RSQLite)
|
||||
library("tidyverse")
|
||||
library("dbx")
|
||||
library("tools")
|
||||
library("RJDBC")
|
||||
library("DBI")
|
||||
library("RSQLite")
|
||||
|
||||
source("~/R/rfunc/fehler_add.R")
|
||||
|
||||
@@ -71,8 +72,8 @@ if (ok) {
|
||||
|
||||
# Schema creation ----
|
||||
|
||||
## * Accounts ----
|
||||
if(ok){
|
||||
|
||||
exec_sql("CREATE TABLE accounts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
account_name TEXT NOT NULL,
|
||||
@@ -86,7 +87,32 @@ if (ok) {
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
accounts <- dbxSelect(con_f, "
|
||||
SELECT id, konto, budget_id, bankname, updated_at, created_at,
|
||||
konto_hibiscus, konto_wiso, kontonummer_bank, notizen, ist_spende
|
||||
FROM Konten
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
account_name = konto,
|
||||
bank_name = bankname,
|
||||
hibiscus_account_id = as.integer(konto_hibiscus),
|
||||
budget_id = as.integer(budget_id),
|
||||
wiso_account = konto_wiso,
|
||||
bank_account_no = kontonummer_bank,
|
||||
is_donations = as.integer(ist_spende),
|
||||
notes = notizen,
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
dbWriteTable(con_s, "accounts", accounts, append = TRUE)
|
||||
ok <- "accounts" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die Accounts Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 16:54
|
||||
|
||||
|
||||
## * Budgets Tabelle ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE budgets (
|
||||
id INTEGER PRIMARY KEY,
|
||||
row_no INTEGER,
|
||||
@@ -96,7 +122,26 @@ if (ok) {
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
budgets <- dbxSelect(con_f, "
|
||||
SELECT id, richtung, bereich, bezeichnung, reihe
|
||||
FROM Budgets
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
row_no = as.integer(reihe),
|
||||
area = bereich,
|
||||
label = bezeichnung,
|
||||
direction = richtung,
|
||||
created_at = format(Sys.time(), ""),
|
||||
updated_at = format(Sys.time(), "")
|
||||
)
|
||||
dbWriteTable(con_s, "budgets", budgets, append = TRUE)
|
||||
ok <- "budgets" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die Budgets Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 16:57
|
||||
|
||||
## * Contacts Tabelle ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE contacts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
first_name TEXT,
|
||||
@@ -122,185 +167,6 @@ if (ok) {
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
|
||||
exec_sql("CREATE TABLE bank_connections (
|
||||
id INTEGER PRIMARY KEY,
|
||||
contact_id INTEGER,
|
||||
contact_text TEXT,
|
||||
iban TEXT,
|
||||
bic TEXT,
|
||||
bank_name TEXT,
|
||||
remote_name TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
|
||||
exec_sql("CREATE TABLE entries (
|
||||
id INTEGER PRIMARY KEY,
|
||||
contact_id INTEGER,
|
||||
purpose TEXT,
|
||||
note TEXT,
|
||||
remote_name TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
|
||||
if (!USE_CENTS) {
|
||||
exec_sql("CREATE TABLE postings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
entry_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
valuta TEXT NOT NULL,
|
||||
booking_date TEXT,
|
||||
amount NUMERIC NOT NULL,
|
||||
invoice_no TEXT,
|
||||
note TEXT,
|
||||
status TEXT,
|
||||
waived INTEGER,
|
||||
bank_transaction_id INTEGER,
|
||||
wiso_id INTEGER,
|
||||
receipt_id INTEGER,
|
||||
project_id INTEGER,
|
||||
coin_share_amount NUMERIC,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
} else {
|
||||
exec_sql("CREATE TABLE postings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
entry_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
valuta TEXT NOT NULL,
|
||||
booking_date TEXT,
|
||||
amount_cents INTEGER NOT NULL,
|
||||
invoice_no TEXT,
|
||||
note TEXT,
|
||||
status TEXT,
|
||||
waived INTEGER,
|
||||
bank_transaction_id INTEGER,
|
||||
wiso_id INTEGER,
|
||||
receipt_id INTEGER,
|
||||
project_id INTEGER,
|
||||
coin_share_cents INTEGER,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
}
|
||||
|
||||
# Hibiscus payload unchanged ----
|
||||
exec_sql("CREATE TABLE hibiscus_transactions (
|
||||
id INTEGER PRIMARY KEY,
|
||||
konto_id INTEGER,
|
||||
empfaenger_konto TEXT,
|
||||
empfaenger_blz TEXT,
|
||||
empfaenger_name TEXT,
|
||||
betrag REAL,
|
||||
zweck TEXT,
|
||||
zweck2 TEXT,
|
||||
zweck3 TEXT,
|
||||
datum TEXT,
|
||||
valuta TEXT,
|
||||
saldo REAL,
|
||||
primanota INTEGER,
|
||||
art TEXT,
|
||||
customerref TEXT,
|
||||
kommentar TEXT,
|
||||
checksum REAL,
|
||||
umsatztyp_id INTEGER,
|
||||
flags REAL,
|
||||
gvcode INTEGER,
|
||||
addkey INTEGER,
|
||||
txid TEXT,
|
||||
purposecode TEXT,
|
||||
endtoendid TEXT,
|
||||
mandateid TEXT,
|
||||
empfaenger_name2 TEXT,
|
||||
creditorid TEXT
|
||||
);")
|
||||
|
||||
# Attachments ----
|
||||
exec_sql("CREATE TABLE attachments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
entry_id INTEGER,
|
||||
quittung_id INTEGER,
|
||||
adress_id INTEGER,
|
||||
wiso_id INTEGER,
|
||||
btisch_id TEXT,
|
||||
original_name TEXT,
|
||||
kategorie TEXT,
|
||||
path TEXT NOT NULL,
|
||||
note TEXT,
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
updated_at TEXT DEFAULT (datetime('now'))
|
||||
);")
|
||||
|
||||
error_f <- fehler_add("Schema created", TRUE, error_f)
|
||||
}
|
||||
|
||||
# Transfer Accounts ----
|
||||
|
||||
if (ok) {
|
||||
accounts <- dbxSelect(con_f, "
|
||||
SELECT id, konto, budget_id, bankname, updated_at, created_at,
|
||||
konto_hibiscus, konto_wiso, kontonummer_bank, notizen, ist_spende
|
||||
FROM Konten
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
account_name = konto,
|
||||
bank_name = bankname,
|
||||
hibiscus_account_id = as.integer(konto_hibiscus),
|
||||
budget_id = as.integer(budget_id),
|
||||
wiso_account = konto_wiso,
|
||||
bank_account_no = kontonummer_bank,
|
||||
is_donations = as.integer(ist_spende),
|
||||
notes = notizen,
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
|
||||
dbWriteTable(con_s, "accounts", accounts, append = TRUE)
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
projects <- dbxSelect(con_f, "
|
||||
SELECT id, projektname, bereich, notiz, jahr, created_at, updated_at from Projekte") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
projektname = projektname,
|
||||
bereich = bereich,
|
||||
notiz = notiz,
|
||||
jahr = as.integer(jahr),
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
|
||||
dbWriteTable(con_s, "projects", projects, append = TRUE)
|
||||
}
|
||||
|
||||
# Transfer Budgets ----
|
||||
|
||||
if (ok) {
|
||||
budgets <- dbxSelect(con_f, "
|
||||
SELECT id, richtung, bereich, bezeichnung, reihe
|
||||
FROM Budgets
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
row_no = as.integer(reihe),
|
||||
area = bereich,
|
||||
label = bezeichnung,
|
||||
direction = richtung,
|
||||
created_at = format(Sys.time(), ""),
|
||||
updated_at = format(Sys.time(), "")
|
||||
)
|
||||
|
||||
dbWriteTable(con_s, "budgets", budgets, append = TRUE)
|
||||
}
|
||||
|
||||
# Transfer Contacts
|
||||
|
||||
if (ok) {
|
||||
contacts <- dbxSelect(con_f, "
|
||||
SELECT id, vorname, nachname, strasse, plz, ort, Land,
|
||||
telefon, mobil, email, anrede, geschlecht, spender, mitglied, notiz,
|
||||
@@ -335,11 +201,59 @@ if (ok) {
|
||||
)
|
||||
|
||||
dbWriteTable(con_s, "contacts", contacts, append = TRUE)
|
||||
}
|
||||
|
||||
# Transfer Entries ----
|
||||
ok <- "contacts" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die contacts Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 16:58
|
||||
|
||||
## * Bankverbindungen ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE bank_connections (
|
||||
id INTEGER PRIMARY KEY,
|
||||
contact_id INTEGER,
|
||||
contact_text TEXT,
|
||||
iban TEXT,
|
||||
bic TEXT,
|
||||
bank_name TEXT,
|
||||
remote_name TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
bank_connections <- dbxSelect(con_f, "
|
||||
SELECT id, adress_id, kontakt, iban, bic, kreditinstitut,
|
||||
remote_name, created_at, updated_at
|
||||
FROM Bankverbindungen
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
contact_id = as.integer(adress_id),
|
||||
contact_text = kontakt,
|
||||
iban = iban,
|
||||
bic = bic,
|
||||
bank_name = kreditinstitut,
|
||||
remote_name = remote_name,
|
||||
created_at = as.character(created_at),
|
||||
updated_at = as.character(updated_at)
|
||||
)
|
||||
sum(duplicated(bank_connections$id))
|
||||
dbWriteTable(con_s, "bank_connections", bank_connections, append = TRUE)
|
||||
ok <- "bank_connections" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add(
|
||||
paste(nrow(bank_connections), "Bankverbindungen übertragen"), TRUE, error_f
|
||||
)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:00
|
||||
|
||||
|
||||
## * Entries Tabelle ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE entries (
|
||||
id INTEGER PRIMARY KEY,
|
||||
contact_id INTEGER,
|
||||
purpose TEXT,
|
||||
note TEXT,
|
||||
remote_name TEXT,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
entries <- dbxSelect(con_f, "
|
||||
SELECT id, adress_id, verwendungszweck, notiz, kontakt, created_at, updated_at
|
||||
FROM trans
|
||||
@@ -354,13 +268,33 @@ if (ok) {
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
|
||||
dbWriteTable(con_s, "entries", entries, append = TRUE)
|
||||
}
|
||||
ok <- "entries" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die entries Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:02
|
||||
|
||||
# Transfer Postings ----
|
||||
|
||||
## * Postings Tabelle ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE postings (
|
||||
id INTEGER PRIMARY KEY,
|
||||
entry_id INTEGER NOT NULL,
|
||||
account_id INTEGER NOT NULL,
|
||||
valuta TEXT NOT NULL,
|
||||
booking_date TEXT,
|
||||
amount NUMERIC NOT NULL,
|
||||
invoice_no TEXT,
|
||||
note TEXT,
|
||||
status TEXT,
|
||||
waived INTEGER,
|
||||
bank_transaction_id INTEGER,
|
||||
wiso_id INTEGER,
|
||||
receipt_id INTEGER,
|
||||
project_id INTEGER,
|
||||
coin_share_amount NUMERIC,
|
||||
created_at TEXT,
|
||||
updated_at TEXT
|
||||
);")
|
||||
postings <- dbxSelect(con_f, "
|
||||
SELECT id, trans_id, konto_id, wertstellung, buchungsdatum, betrag,
|
||||
rechnungsnummer, notiz, status, b_verzicht, umsatz_id, wiso_id,
|
||||
@@ -368,8 +302,6 @@ if (ok) {
|
||||
FROM buchungen
|
||||
") %>%
|
||||
as_tibble()
|
||||
|
||||
if (!USE_CENTS) {
|
||||
postings <- postings %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
@@ -390,36 +322,66 @@ if (ok) {
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
} else {
|
||||
postings <- postings %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
entry_id = as.integer(trans_id),
|
||||
account_id = as.integer(konto_id),
|
||||
valuta = as.character(wertstellung),
|
||||
booking_date = as.character(buchungsdatum),
|
||||
amount_cents = to_cents(betrag),
|
||||
invoice_no = rechnungsnummer,
|
||||
note = notiz,
|
||||
status = status,
|
||||
waived = as.integer(b_verzicht),
|
||||
bank_transaction_id = as.integer(umsatz_id),
|
||||
wiso_id = as.integer(wiso_id),
|
||||
receipt_id = as.integer(quittung_id),
|
||||
project_id = as.integer(projekt_id),
|
||||
coin_share_cents = to_cents(betrag_muenzen),
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
}
|
||||
|
||||
dbWriteTable(con_s, "postings", postings, append = TRUE)
|
||||
}
|
||||
ok <- "postings" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die Postings Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:03
|
||||
|
||||
# Daten aus Attachments Tabelle übertragen ----
|
||||
|
||||
## * Umsatz-Tabelle ----
|
||||
if(F){
|
||||
exec_sql("CREATE TABLE hibiscus_transactions (
|
||||
id INTEGER PRIMARY KEY,
|
||||
konto_id INTEGER,
|
||||
empfaenger_konto TEXT,
|
||||
empfaenger_blz TEXT,
|
||||
empfaenger_name TEXT,
|
||||
betrag REAL,
|
||||
zweck TEXT,
|
||||
zweck2 TEXT,
|
||||
zweck3 TEXT,
|
||||
datum TEXT,
|
||||
valuta TEXT,
|
||||
saldo REAL,
|
||||
primanota INTEGER,
|
||||
art TEXT,
|
||||
customerref TEXT,
|
||||
kommentar TEXT,
|
||||
checksum REAL,
|
||||
umsatztyp_id INTEGER,
|
||||
flags REAL,
|
||||
gvcode INTEGER,
|
||||
addkey INTEGER,
|
||||
txid TEXT,
|
||||
purposecode TEXT,
|
||||
endtoendid TEXT,
|
||||
mandateid TEXT,
|
||||
empfaenger_name2 TEXT,
|
||||
creditorid TEXT
|
||||
);")
|
||||
|
||||
ok <- NA
|
||||
error_f <- fehler_add("Die Tabelle der Umsätze (Hibiscus) wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:05
|
||||
|
||||
## * Attachments Tabelle ----
|
||||
if(ok){
|
||||
exec_sql("CREATE TABLE attachments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
entry_id INTEGER,
|
||||
quittung_id INTEGER,
|
||||
adress_id INTEGER,
|
||||
wiso_id INTEGER,
|
||||
btisch_id TEXT,
|
||||
original_name TEXT,
|
||||
kategorie TEXT,
|
||||
path TEXT NOT NULL,
|
||||
note TEXT,
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
updated_at TEXT DEFAULT (datetime('now'))
|
||||
);")
|
||||
att <- dbxSelect(con_f, "SELECT id, trans_id, quittung_id, wiso_id, btisch_id,
|
||||
adress_id, ft_dateiname, beschreibung, created_at, updated_at, ft_extension FROM Attachments") %>%
|
||||
adress_id, ft_dateiname, beschreibung, created_at, updated_at, ft_extension FROM Dokumente") %>%
|
||||
mutate(
|
||||
id = as.integer(id),
|
||||
trans_id = as.integer(trans_id),
|
||||
@@ -437,59 +399,76 @@ if(ok){
|
||||
original_name = ft_dateiname
|
||||
) %>%
|
||||
select(-ft_extension)
|
||||
dbWriteTable(con_s, "Attachments", att, append = T)
|
||||
} ## ------------------------------------------------------- 2026-03-19 16:38
|
||||
dbWriteTable(con_s, "attachments", att, append = T)
|
||||
ok <- "attachments" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die Attachments Tabelle wurder erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:07
|
||||
|
||||
|
||||
## * Daeien übertragen ----
|
||||
## * Projekct - Tabelle ----
|
||||
if(ok){
|
||||
pfad <- "~/Insync/Projekte/Gemeindefinanzen/gemfin-fm/gemfin04/Dokumente/datei/"
|
||||
exec_sql("CREATE TABLE projects (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
projektname TEXT,
|
||||
bereich TEXT,
|
||||
notiz TEXT,
|
||||
jahr INTEGER,
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
updated_at TEXT DEFAULT (datetime('now'))
|
||||
);")
|
||||
projects <- dbxSelect(con_f, "
|
||||
SELECT id, projektname, bereich, notiz, jahr, created_at, updated_at from Projekte") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
projektname = projektname,
|
||||
bereich = bereich,
|
||||
notiz = notiz,
|
||||
jahr = as.integer(jahr),
|
||||
created_at = created_at,
|
||||
updated_at = updated_at
|
||||
)
|
||||
dbWriteTable(con_s, "projects", projects, append = TRUE)
|
||||
ok <- "projects" %in% dbListTables(con_s)
|
||||
error_f <- fehler_add("Die Projekte - Tabelle wurde erstellt", ok, error_f)
|
||||
} ## ------------------------------------------------------- 2026-05-12 17:08
|
||||
|
||||
|
||||
|
||||
## * Dateien übertragen ----
|
||||
if(ok){
|
||||
pfad <- "~/Documents/workspace/gemfin-fm/gemfin04/Dokumente/datei/"
|
||||
zielpfad <- "~/Documents/workspace/gemfin-shiny/www/documents/"
|
||||
vorhanden <- list.files(pfad, pattern = "pdf")
|
||||
eintraege <- att$original_name
|
||||
anz <- length(eintraege)
|
||||
for(ind in 1:length(eintraege)){
|
||||
if( exists(paste0(zielpfad, eintraege[ind])) ){
|
||||
eintraege <- att %>%
|
||||
filter(!is.na(original_name)) %>%
|
||||
mutate(
|
||||
ext = file_ext(original_name),
|
||||
zielname = paste0(zielpfad, id, ".", ext)
|
||||
)
|
||||
anz <- nrow(eintraege)
|
||||
for(ind in 1:nrow(eintraege)){
|
||||
herkunft <- paste0(pfad, eintraege$original_name[ind])
|
||||
zielname <- eintraege$zielname[ind]
|
||||
|
||||
if( file.exists(herkunft) ){
|
||||
cat(ind, " von ", anz, "\n")
|
||||
file.copy(
|
||||
from = paste0(pfad, vorhanden[ind]),
|
||||
to = "~/Documents/workspace/gemfin-shiny/www/documents/")
|
||||
from = herkunft,
|
||||
to = zielname,
|
||||
overwrite = F)
|
||||
}
|
||||
}
|
||||
# Check
|
||||
neue_dateien <- list.files("~/Documents/workspace/gemfin-shiny/www/documents/")
|
||||
length(neue_dateien)
|
||||
eintraege <- att$original_name
|
||||
|
||||
length(eintraege)
|
||||
nv <- att[-which(eintraege %in% neue_dateien),]
|
||||
error_f <- fehler_add("Alle Dateien übertragen", nrow(nv) == 0, error_f)
|
||||
} ## ------------------------------------------------------- 2026-04-28 18:40
|
||||
|
||||
|
||||
# Transfer Bankverbindungen ----
|
||||
if (ok) {
|
||||
bank_connections <- dbxSelect(con_f, "
|
||||
SELECT id, adress_id, kontakt, iban, bic, kreditinstitut,
|
||||
remote_name, created_at, updated_at
|
||||
FROM Bankverbindungen
|
||||
") %>%
|
||||
transmute(
|
||||
id = as.integer(id),
|
||||
contact_id = as.integer(adress_id),
|
||||
contact_text = kontakt,
|
||||
iban = iban,
|
||||
bic = bic,
|
||||
bank_name = kreditinstitut,
|
||||
remote_name = remote_name,
|
||||
created_at = as.character(created_at),
|
||||
updated_at = as.character(updated_at)
|
||||
)
|
||||
|
||||
sum(duplicated(bank_connections$id))
|
||||
dbWriteTable(con_s, "bank_connections", bank_connections, append = TRUE)
|
||||
error_f <- fehler_add(
|
||||
paste(nrow(bank_connections), "Bankverbindungen übertragen"), TRUE, error_f
|
||||
)
|
||||
}
|
||||
|
||||
# Close ----
|
||||
|
||||
@@ -498,27 +477,3 @@ dbDisconnect(con_f)
|
||||
|
||||
print("Migration finished.")
|
||||
|
||||
|
||||
## * Dateien umbenennen ----
|
||||
library("tools")
|
||||
atts <- dbReadTable(conn, "attachments")
|
||||
sum(duplicated(atts$id)) == 0
|
||||
pfad <- "www/attachments/"
|
||||
for( ind in 1:nrow(atts)){
|
||||
datei <- atts$original_name[ind]
|
||||
if( file.exists(paste0(pfad, datei)) ){
|
||||
# print(ind)
|
||||
ext <- file_ext(datei)
|
||||
idwert <- atts$id[ind]
|
||||
if(is.na(idwert)) break
|
||||
name_neu <- paste0(idwert,".",ext)
|
||||
print(name_neu)
|
||||
file.copy(from = paste0(pfad, datei), to=paste0("www/documents/", name_neu), overwrite = T)
|
||||
}
|
||||
}
|
||||
atts %>%
|
||||
filter(id == 1379)
|
||||
|
||||
which( "1379.pdf" %in% atts$original_name)
|
||||
|
||||
|
||||
|
||||
Executable → Regular
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user