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)
|
||||
mustRenderNewInvoiceForm(w, r, form)
|
||||
case "product-form":
|
||||
company := mustGetCompany(r)
|
||||
query := r.URL.Query()
|
||||
index, _ := strconv.Atoi(query.Get("index"))
|
||||
conn := getConn(r)
|
||||
form := newInvoiceProductForm(index, company, getLocale(r), mustGetTaxOptions(r.Context(), conn, company))
|
||||
slug := query.Get("slug")
|
||||
if len(slug) > 0 {
|
||||
if !form.MustFillFromDatabase(r.Context(), conn, slug) {
|
||||
productSlug := query.Get("slug")
|
||||
if len(productSlug) > 0 {
|
||||
if !form.MustFillFromDatabase(r.Context(), conn, productSlug) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue