Esempio n. 1
0
def _new():
    custid = request.form.get("custid")
    custid = custid if custid!=None else request.args.get("custid")
    tel = request.form.get("cellphone")
    customer=MyCustomer()
    cust = customer.get(custid)
    if request.path=="/cust/new":
        return  render_template("customer/form.html",cust=None)
    else:
        if request.path=="/cust/edit":
            return render_template("customer/form.html",cust=cust)
        else:
            return render_template("customer/view.html",cust=cust)
Esempio n. 2
0
def _save():
    custid = request.form.get("custid")
    dispName = request.form.get("dispName")
    cellphone = request.form.get("cellphone")
    work4 = request.form.get("work4")
    homeAdr = request.form.get("homeAdr")
    c=None
    myCust=MyCustomer()
    try:
        c = myCust.get(custid)
    except:
        pass
    
    if c==None:
        custid=MyCustomer().appedCustomer(cellphone, dispName, "PERSON", {"work4":work4,"homeAdr":homeAdr}, [], [])
    else:
        MyCustomer().updateCustomer(custid,cellphone, dispName, "PERSON", {"work4":work4,"homeAdr":homeAdr}, c.__data__["__tags__"], c.__data__["__req__"])
    return json.dumps(dict(state=0,result=dict(custid=str(custid))))