X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fcsv-import-from-shell.sh;h=94e44355d4582069808409dbe3de7376e2ea106e;hb=2a0cbd885790174fa0f212e6661b30362650a42c;hp=277e8fcdc8bf39cb4c05c8cbf2b75dbe2978ae9f;hpb=1f3fea6c844add4f42c4e5ee22dcb688867876a2;p=kivitendo-erp.git diff --git a/scripts/csv-import-from-shell.sh b/scripts/csv-import-from-shell.sh old mode 100644 new mode 100755 index 277e8fcdc..94e44355d --- a/scripts/csv-import-from-shell.sh +++ b/scripts/csv-import-from-shell.sh @@ -14,6 +14,7 @@ # ---- Logindaten und URL anpassen: ---- login=MyLxOfficeUserName password=MySecretPassword +client_id=ClientDatabaseID url='https://localhost/kivitendo-erp/controller.pl' function fail { @@ -65,7 +66,7 @@ function do_curl { # "settings.apply_buchungsgruppe": Buchungsgruppe wo anwenden: # "never", "all", "missing" - # "settings.parts_type": Artikeltyp: "part", "service", "mixed" + # "settings.part_type": Artikeltyp: "part", "service", "mixed" # "settings.article_number_policy": Artikel mit existierender # Artikelnummer: "update_prices", "insert_new" @@ -112,7 +113,19 @@ function do_curl { # Projektnummer (nur, wenn "settings.duplicates" auch gesetzt # ist). + # Spaltenzuordnungen für Benutzerdefinierte Variablen: + # Beispiel (Achtung, die Reihenfolge ist wichtig): + + # "mappings[+].from=vm_product_length" + # "mappings[].to=cvar_vm_product_length" + # "mappings[+].from=vm_product_width" + # "mappings[].to=cvar_vm_product_width" + # "mappings[+].from=vm_product_height" + # "mappings[].to=cvar_vm_product_height" + curl \ + -X 'POST' \ + -H 'Content-Type:multipart/form-data' \ --silent --insecure \ -F 'action=CsvImport/dispatch' \ -F "${action}=1" \ @@ -126,13 +139,14 @@ function do_curl { -F 'settings.default_buchungsgruppe=395' \ -F 'settings.duplicates=no_check' \ -F 'settings.numberformat=1.000,00' \ - -F 'settings.parts_type=part' \ + -F 'settings.part_type=part' \ -F 'settings.sellprice_adjustment=0' \ -F 'settings.sellprice_adjustment_type=percent' \ -F 'settings.sellprice_places=2' \ -F 'settings.shoparticle_if_missing=0' \ -F "{AUTH}login=${login}" \ -F "{AUTH}password=${password}" \ + -F "{AUTH}client_id=${client_id}" \ -F "file=@${file}" \ ${url} } @@ -140,10 +154,10 @@ function do_curl { tmpf=$(mktemp) do_curl 'action_test' > $tmpf -if grep -q -i 'es wurden.*objekte gefunden, von denen.*' $tmpf; then +if grep -q -i 'Ihr Import wird verarbeitet' $tmpf; then rm $tmpf do_curl 'action_import' > $tmpf - if grep -i 'von.*objekten wurden importiert' $tmpf ; then + if grep -i 'Ihr Import wird verarbeitet' $tmpf ; then rm $tmpf else echo "Import schlug fehl. Ausgabe befindet sich in ${tmpf}"