Beispiel #1
0
    def validateBuyerStoreLeadData(self, buyer_store_lead, is_new):
        flag = 0

        if not "name" in buyer_store_lead or buyer_store_lead["name"] == None:
            flag = 1
            buyer_store_lead["name"] = self.name
        if not "mobile_number" in buyer_store_lead or not validate_mobile_number(
                buyer_store_lead["mobile_number"]):
            flag = 1
            buyer_store_lead["mobile_number"] = self.mobile_number
        if not "email" in buyer_store_lead or not validate_email(
                buyer_store_lead["email"]):
            buyer_store_lead["email"] = self.email
        if not "status" in buyer_store_lead or not validate_integer(
                buyer_store_lead["status"]):
            buyer_store_lead["status"] = self.status
        if not "sizes" in buyer_store_lead or buyer_store_lead["sizes"] == None:
            buyer_store_lead["sizes"] = self.sizes
        if not "quantity" in buyer_store_lead or not validate_integer(
                buyer_store_lead["quantity"]):
            buyer_store_lead["quantity"] = self.quantity

        if is_new == 1 and flag == 1:
            return False

        return True
Beispiel #2
0
def validateSellerData(seller, oldseller, isnew):

    flag = 0

    if not "name" in seller or seller["name"] == None:
        flag = 1
        seller["name"] = oldseller.name
    if not "company_name" in seller or seller["company_name"] == None:
        seller["company_name"] = oldseller.company_name
    if not "mobile_number" in seller or seller[
            "mobile_number"] == None or not validate_mobile_number(
                str(seller["mobile_number"])):
        flag = 1
        seller["mobile_number"] = oldseller.mobile_number
    if not "email" in seller or seller["email"] == None or not validate_email(
            seller["email"]):
        seller["email"] = oldseller.email
    if not "password" in seller or seller["password"] == None:
        seller["password"] = oldseller.password
    if not "alternate_phone_number" in seller or seller[
            "alternate_phone_number"] == None:
        seller["alternate_phone_number"] = oldseller.alternate_phone_number
    if not "mobile_verification" in seller or not validate_bool(
            seller["mobile_verification"]):
        seller["mobile_verification"] = oldseller.mobile_verification
    if not "email_verification" in seller or not validate_bool(
            seller["email_verification"]):
        seller["email_verification"] = oldseller.email_verification
    if not "company_profile" in seller or seller["company_profile"] == None:
        seller["company_profile"] = oldseller.company_profile
    if not "seller_conditions" in seller or seller["seller_conditions"] == None:
        seller["seller_conditions"] = oldseller.seller_conditions
    if not "show_online" in seller or not validate_bool(seller["show_online"]):
        seller["show_online"] = oldseller.show_online
    else:
        seller["show_online_changed"] = True
    if not "concerned_person" in seller or seller["concerned_person"] == None:
        seller["concerned_person"] = oldseller.concerned_person
    if not "concerned_person_number" in seller or seller[
            "concerned_person_number"] == None:
        seller["concerned_person_number"] = oldseller.concerned_person_number

    if isnew == 1 and flag == 1:
        return False

    return True
Beispiel #3
0
def validateBuyerData(buyer, oldbuyer, is_new):

	flag = 0

	if not "name" in buyer or buyer["name"]==None:
		flag = 1
		buyer["name"] = oldbuyer.name
	if not "company_name" in buyer or buyer["company_name"]==None:
		buyer["company_name"] = oldbuyer.company_name
	if not "mobile_number" in buyer or not validate_mobile_number(buyer["mobile_number"]):
		flag = 1
		buyer["mobile_number"] = oldbuyer.mobile_number
	if not "email" in buyer or buyer["email"]==None or not validate_email(buyer["email"]):
		buyer["email"] = oldbuyer.email
		if is_new == 1:
			buyer["email"] = None
	if not "alternate_phone_number" in buyer or buyer["alternate_phone_number"]==None:
		buyer["alternate_phone_number"] = oldbuyer.alternate_phone_number
	if not "mobile_verification" in buyer or not validate_bool(buyer["mobile_verification"]):
		buyer["mobile_verification"] = oldbuyer.mobile_verification
	if not "email_verification" in buyer  or not validate_bool(buyer["email_verification"]):
		buyer["email_verification"] = oldbuyer.email_verification
	if not "gender" in buyer or buyer["gender"]:
		buyer["gender"] = oldbuyer.gender
	if not "whatsapp_number" in buyer or buyer["whatsapp_number"]==None:
		if oldbuyer.whatsapp_number==None or oldbuyer.whatsapp_number=="":
			buyer["whatsapp_number"] = buyer["mobile_number"]
		else:
			buyer["whatsapp_number"] = oldbuyer.whatsapp_number
	if not "whatsapp_sharing_active" in buyer or not validate_bool(buyer["whatsapp_sharing_active"]):
		buyer["whatsapp_sharing_active"] = oldbuyer.whatsapp_sharing_active
	if not "store_global_margin" in buyer or not validate_percent(buyer["store_global_margin"], False):
		buyer["store_global_margin"] = oldbuyer.store_global_margin

	if is_new == 1 and flag == 1:
		return False

	return True