Subversion Repositories SmartDukaan

Rev

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

Rev 5868 Rev 5871
Line 1196... Line 1196...
1196
        return True
1196
        return True
1197
    except:
1197
    except:
1198
        return False    
1198
        return False    
1199
 
1199
 
1200
def set_order_attributes(orderId, attributes):
1200
def set_order_attributes(orderId, attributes):
1201
    existingAttributes = Attribute.query.filter_by(orderId=orderId).all()
-
 
1202
    if existingAttributes :
1201
    for attribute in attributes :
1203
        for existingAttribute in existingAttributes :
1202
        existingAttribute = Attribute.query.filter(Attribute.orderId == orderId).filter(Attribute.name == attribute.name).first()
1204
            for attribute in attributes :
1203
        if existingAttribute:
1205
                if attribute.name == existingAttribute.name :
-
 
1206
                    existingAttribute.value = attribute.value
1204
            existingAttribute.value = attribute.value
1207
    else :                
1205
        else :                
1208
        for t_attribute in attributes:
-
 
1209
            attribute = Attribute()
1206
            attr = Attribute()
1210
            attribute.orderId = orderId
1207
            attr.orderId = orderId
1211
            attribute.name = t_attribute.name
1208
            attr.name = attribute.name
1212
            attribute.value = t_attribute.value
1209
            attr.value = attribute.value
1213
    session.commit()
1210
    session.commit()
1214
        
1211
        
1215
def mark_orders_as_picked_up(provider_id, pickup_details):
1212
def mark_orders_as_picked_up(provider_id, pickup_details):
1216
    for awb, pickup_timestamp in pickup_details.iteritems():
1213
    for awb, pickup_timestamp in pickup_details.iteritems():
1217
        order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
1214
        order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()