From d1ea14e9be0891f7e19bdf5090a70aad9caa45ba Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 19 Dec 2015 03:55:57 +0100 Subject: improved show based imports diff --git a/importer.go b/importer.go index 94065f6..afe422f 100644 --- a/importer.go +++ b/importer.go @@ -525,6 +525,7 @@ func is_cart_member_of_show(ctx *ImportContext, res *ImportResult, carts []uint) } res.ResponseCode = http.StatusBadRequest res.ErrorString = fmt.Sprintf("Requested cart %d is not a member of show: %d", ctx.Cart, ctx.ShowId) + res.Cart = ctx.Cart return false } @@ -609,8 +610,14 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { if err = clear_show_carts(ctx, res, show_carts); err != nil || (res.ResponseCode != http.StatusOK && res.ResponseCode != http.StatusNotFound) { return } - if err = add_show_cart_cut(ctx, res, show_carts); err != nil || res.ResponseCode != http.StatusOK { - return + if ctx.ClearCart && !ctx.ClearShowCarts { + if err = remove_add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK { + return + } + } else { + if err = add_show_cart_cut(ctx, res, show_carts); err != nil || res.ResponseCode != http.StatusOK { + return + } } rmCartOnErr = true } else if ctx.GroupName != "" { -- cgit v0.10.2