Subversion Repositories SmartDukaan

Rev

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

Rev 5786 Rev 5791
Line 888... Line 888...
888
        return True
888
        return True
889
    except:
889
    except:
890
        return False    
890
        return False    
891
 
891
 
892
def set_order_attributes(orderId, attributes):
892
def set_order_attributes(orderId, attributes):
-
 
893
    existingAttributes = Attribute.query.filter_by(orderId=orderId).all()
-
 
894
    if existingAttributes :
-
 
895
        for existingAttribute in existingAttributes :
-
 
896
            for attribute in attributes :
-
 
897
                if attribute.name == existingAttribute.name :
-
 
898
                    existingAttribute.value = attribute.value
-
 
899
    else :                
893
    for t_attribute in attributes:
900
        for t_attribute in attributes:
894
        attribute = Attribute()
901
            attribute = Attribute()
895
        attribute.orderId = orderId
902
            attribute.orderId = orderId
896
        attribute.name = t_attribute.name
903
            attribute.name = t_attribute.name
897
        attribute.value = t_attribute.value
904
            attribute.value = t_attribute.value
898
        session.commit()
905
    session.commit()
899
        
906
        
900
def mark_orders_as_picked_up(provider_id, pickup_details):
907
def mark_orders_as_picked_up(provider_id, pickup_details):
901
    for awb, pickup_timestamp in pickup_details.iteritems():
908
    for awb, pickup_timestamp in pickup_details.iteritems():
902
        order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
909
        order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
903
        if order == None or order.status != OrderStatus.SHIPPED_FROM_WH:
910
        if order == None or order.status != OrderStatus.SHIPPED_FROM_WH: