<% if !_site.has_rank?("admin") _hb.alert(_("You are not an administrator and cannot view this page.")).back end if _get["choice"] == "dosave" save_hash = { :name => _post["texname"] } end if _get["customer_id"].to_i > 0 customer = _ob.get(:Customer, _get["customer_id"]) title = sprintf(_("Edit customer: %s"), customer.name.html) if _get["choice"] == "dosave" customer.update(save_hash) _hb.redirect("?show=customer_edit&customer_id#{customer.id}") end if _get["choice"] == "dodelete" _hb.on_error_go_back do _ob.delete(customer) _hb.redirect("?show=customer_search") end end else title = _("Add new customer") if _get["choice"] == "dosave" _hb.on_error_go_back do customer = _ob.add(:Customer, save_hash) _hb.redirect("?show=customer_edit&customer_id=#{customer.id}") end end end print _site.header(title) %>
"> <%=_site.boxt(_("Enter details"), "350px")%> <% print Knj::Web.inputs([{ :title => _("Name"), :name => :texname, :value => [customer, :name], :descr => _("The name of the customer as it should appear in the system.") }]) %>
<%if customer%> " onclick="location.href='?show=customer_show&customer_id=<%=customer.id%>';" /> " onclick="if (confirm('<%=_("Do you want to delete this customer?")%>')){location.href='?show=customer_edit&customer_id=<%=customer.id%>&choice=dodelete';}" /> <%end%> " />
<%=_site.boxb%>