Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / scripts / csv-import-from-shell.sh
index e8a1991..94e4435 100755 (executable)
@@ -66,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"
@@ -113,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" \
@@ -127,7 +139,7 @@ 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' \
@@ -142,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}"