Subversion Repositories SmartDukaan

Rev

Rev 15304 | Rev 15306 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15304 Rev 15305
Line 981... Line 981...
981
    else:
981
    else:
982
        return obj
982
        return obj
983
    
983
    
984
def getRetailerObj(retailer, otherContacts=[]):
984
def getRetailerObj(retailer, otherContacts=[]):
985
    otherContacts = [] if otherContacts is None else otherContacts
985
    otherContacts = [] if otherContacts is None else otherContacts
-
 
986
    print "otherContacts",otherContacts
986
    obj = Mock()
987
    obj = Mock()
987
    obj.title = retailer.title
988
    obj.title = retailer.title
988
    obj.id = retailer.id
989
    obj.id = retailer.id
989
    if retailer.contact1 is not None and retailer.contact1 not in otherContacts:
990
    if retailer.contact1 is not None and retailer.contact1 not in otherContacts:
990
        otherContacts.append(retailer.contact1)
991
        otherContacts.append(retailer.contact1)
Line 1010... Line 1011...
1010
            jsonReq = json.loads(req.stream.read(), encoding='utf-8')
1011
            jsonReq = json.loads(req.stream.read(), encoding='utf-8')
1011
            lgr.info( "Request in Search----\n"  + str(jsonReq))
1012
            lgr.info( "Request in Search----\n"  + str(jsonReq))
1012
            contact=jsonReq.get('searchTerm')
1013
            contact=jsonReq.get('searchTerm')
1013
            if(searchType=="number"):
1014
            if(searchType=="number"):
1014
                anotherCondition = or_(Retailers.contact1==contact,Retailers.contact2==contact)
1015
                anotherCondition = or_(Retailers.contact1==contact,Retailers.contact2==contact)
1015
            elif(searchType=="counter"):    
1016
            elif(searchType=="counter"):
-
 
1017
                retailer_ids = list(session.query(RetailerContacts.retailer_id).filter_by(mobile_number=contact).all()    
1016
                anotherCondition = Retailers.title.ilike('%%%s%%'%(contact))
1018
                anotherCondition = Retailers.title.ilike('%%%s%%'%(contact))
1017
            
1019
            
1018
            searchUser = session.query(Retailers).filter(Retailers.modified != None).filter(anotherCondition).all()
1020
            searchUser = session.query(Retailers).filter(Retailers.modified != None).filter(anotherCondition).all()
1019
            if searchUser is None:
1021
            if searchUser is None:
1020
                resp.body = json.dumps("{}")
1022
                resp.body = json.dumps("{}")