# ---- Logindaten und URL anpassen: ----
login=MyLxOfficeUserName
password=MySecretPassword
+client_id=ClientDatabaseID
url='https://localhost/kivitendo-erp/controller.pl'
function fail {
# "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"
# 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" \
-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}
}
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}"