Remove “shadow” variables inside invoices.ServeInvoice
This commit is contained in:
parent
992bbf32a9
commit
cbe868b6d6
|
@ -234,14 +234,12 @@ func ServeInvoice(w http.ResponseWriter, r *http.Request, params httprouter.Para
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
mustRenderNewInvoiceForm(w, r, form)
|
mustRenderNewInvoiceForm(w, r, form)
|
||||||
case "product-form":
|
case "product-form":
|
||||||
company := mustGetCompany(r)
|
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
index, _ := strconv.Atoi(query.Get("index"))
|
index, _ := strconv.Atoi(query.Get("index"))
|
||||||
conn := getConn(r)
|
|
||||||
form := newInvoiceProductForm(index, company, getLocale(r), mustGetTaxOptions(r.Context(), conn, company))
|
form := newInvoiceProductForm(index, company, getLocale(r), mustGetTaxOptions(r.Context(), conn, company))
|
||||||
slug := query.Get("slug")
|
productSlug := query.Get("slug")
|
||||||
if len(slug) > 0 {
|
if len(productSlug) > 0 {
|
||||||
if !form.MustFillFromDatabase(r.Context(), conn, slug) {
|
if !form.MustFillFromDatabase(r.Context(), conn, productSlug) {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue