|
|
@@ -4176,26 +4176,41 @@
|
|
|
} else if ([params[@"refresh_trigger"] isEqualToString:@"zipcode"]) { // zipcode
|
|
|
|
|
|
NSString *zip_code = params[@"zipcode"];
|
|
|
- zipCode = zip_code;
|
|
|
-
|
|
|
- countryCode_id = params[@"country"];
|
|
|
|
|
|
- NSDictionary *dic = [self offline_dealZipCode:zip_code];
|
|
|
|
|
|
- countryCode = [dic valueForKey:@"country_code"];
|
|
|
- if (!countryCode) {
|
|
|
- countryCode = @"US";
|
|
|
+ // 剔除全部为空格
|
|
|
+ int spaceCount = 0;
|
|
|
+ for (int i = 0; i < zip_code.length; i++) {
|
|
|
+ if ([zip_code characterAtIndex:i] == ' ') {
|
|
|
+ spaceCount++;
|
|
|
+ }
|
|
|
}
|
|
|
+ if (spaceCount == zip_code.length) {
|
|
|
+ zip_code = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ zipCode = zip_code;
|
|
|
|
|
|
- stateCode = [dic valueForKey:@"state_code"];
|
|
|
-
|
|
|
-
|
|
|
- city = [dic valueForKey:@"city"];
|
|
|
-
|
|
|
- // zip code
|
|
|
- NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_10"] mutableCopy];
|
|
|
- [zipDic setValue:zipCode forKey:@"value"];
|
|
|
- [section_0 setValue:zipDic forKey:@"item_10"];
|
|
|
+ if (zipCode.length > 0) {
|
|
|
+ countryCode_id = params[@"country"];
|
|
|
+
|
|
|
+ NSDictionary *dic = [self offline_dealZipCode:zip_code];
|
|
|
+
|
|
|
+ countryCode = [dic valueForKey:@"country_code"];
|
|
|
+ if (!countryCode) {
|
|
|
+ countryCode = @"US";
|
|
|
+ }
|
|
|
+
|
|
|
+ stateCode = [dic valueForKey:@"state_code"];
|
|
|
+
|
|
|
+
|
|
|
+ city = [dic valueForKey:@"city"];
|
|
|
+
|
|
|
+ // zip code
|
|
|
+ NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_10"] mutableCopy];
|
|
|
+ [zipDic setValue:zipCode forKey:@"value"];
|
|
|
+ [section_0 setValue:zipDic forKey:@"item_10"];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -4436,7 +4451,8 @@
|
|
|
|
|
|
int result = [iSalesDB execSql:sql];
|
|
|
|
|
|
- NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"min_ver\":\"160409\",\"mode\":\"Regular Mode\"}",result];
|
|
|
+// NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"min_ver\":\"160409\",\"mode\":\"Regular Mode\"}",result];
|
|
|
+ NSString *retStr = [NSString stringWithFormat:@"{\"result\":%d,\"mode\":\"Regular Mode\"}",result];
|
|
|
|
|
|
return [retStr dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
}
|
|
|
@@ -4538,22 +4554,36 @@
|
|
|
} else if ([params[@"refresh_trigger"] isEqualToString:@"zipcode"]) {
|
|
|
|
|
|
NSString *zip_code = params[@"zipcode"];
|
|
|
- zipcode = zip_code;
|
|
|
-
|
|
|
- countryCode_id = params[@"country"];
|
|
|
-
|
|
|
- NSDictionary *dic = [self offline_dealZipCode:zip_code];
|
|
|
-
|
|
|
- countryCode = [dic valueForKey:@"country_code"];
|
|
|
-
|
|
|
- stateCode = [dic valueForKey:@"state_code"];
|
|
|
-
|
|
|
- city = [dic valueForKey:@"city"];
|
|
|
+ // 剔除全部为空格
|
|
|
+ int spaceCount = 0;
|
|
|
+ for (int i = 0; i < zip_code.length; i++) {
|
|
|
+ if ([zip_code characterAtIndex:i] == ' ') {
|
|
|
+ spaceCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (spaceCount == zip_code.length) {
|
|
|
+ zip_code = @"";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- // zip code
|
|
|
- NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_8"] mutableCopy];
|
|
|
- [zipDic setValue:zipcode forKey:@"value"];
|
|
|
- [section_0 setValue:zipDic forKey:@"item_8"];
|
|
|
+ if (zipcode.length > 0) {
|
|
|
+ zipcode = zip_code;
|
|
|
+
|
|
|
+ countryCode_id = params[@"country"];
|
|
|
+
|
|
|
+ NSDictionary *dic = [self offline_dealZipCode:zip_code];
|
|
|
+
|
|
|
+ countryCode = [dic valueForKey:@"country_code"];
|
|
|
+
|
|
|
+ stateCode = [dic valueForKey:@"state_code"];
|
|
|
+
|
|
|
+ city = [dic valueForKey:@"city"];
|
|
|
+
|
|
|
+ // zip code
|
|
|
+ NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_8"] mutableCopy];
|
|
|
+ [zipDic setValue:zipcode forKey:@"value"];
|
|
|
+ [section_0 setValue:zipDic forKey:@"item_8"];
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -6069,7 +6099,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
@@ -6110,7 +6140,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
[dic setValue:[NSNumber numberWithInteger:wish_count] forKey:@"wish_count"];
|
|
|
|
|
|
// 删除
|
|
|
@@ -6139,7 +6169,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
@@ -6167,7 +6197,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
|
|
|
@@ -6188,7 +6218,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
@@ -6219,7 +6249,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
[dic setValue:bsubtotaljson[@"cuft"] forKey:@"cuft"];
|
|
|
[dic setValue:bsubtotaljson[@"weight"] forKey:@"weight"];
|
|
|
[dic setValue:bsubtotaljson[@"carton"] forKey:@"carton"];
|
|
|
@@ -6966,7 +6996,7 @@
|
|
|
// unit price
|
|
|
NSString *str_price = [self textAtColumn:3 statement:stmt];
|
|
|
NSString* Price=nil;
|
|
|
- if(str_price==nil)
|
|
|
+ if([str_price isEqualToString:@""])
|
|
|
{
|
|
|
NSNumber* price = [self get_model_default_price:appDelegate.contact_id product_id:nil item_id:@(item_id) db:db];
|
|
|
if(price==nil)
|
|
|
@@ -7286,10 +7316,10 @@
|
|
|
NSString *sql = [NSString stringWithFormat:@"select logist,lift_gate,logistic_note from offline_order where so_id = '%@';",orderCode];
|
|
|
|
|
|
|
|
|
- __block NSString *logist = nil;
|
|
|
- __block NSString *lift_gate = nil;
|
|
|
+ __block NSString *logist = @"";
|
|
|
+ __block NSString *lift_gate = @"";
|
|
|
__block int lift_gate_integer = 0;
|
|
|
- __block NSString *logistic_note = nil;
|
|
|
+ __block NSString *logistic_note = @"";
|
|
|
[iSalesDB jk_query:sql db:db close:NO completion:^(sqlite3_stmt *stmt, NSMutableDictionary *container, long *count) {
|
|
|
|
|
|
logist = [self textAtColumn:0 statement:stmt];
|
|
|
@@ -7379,11 +7409,15 @@
|
|
|
[val_0 setValue:val0_subItem forKey:@"sub_item"];
|
|
|
|
|
|
// val_1
|
|
|
-
|
|
|
- if (lift_gate_integer == 1) {
|
|
|
- lift_gate = @"true";
|
|
|
- } else {
|
|
|
- lift_gate = @"false";
|
|
|
+ lift_gate = [self valueInParams:params key:@"lift_gate"];
|
|
|
+ if([lift_gate isEqualToString:@""]) {
|
|
|
+
|
|
|
+ if (lift_gate_integer == 1) {
|
|
|
+ lift_gate = @"true";
|
|
|
+ } else {
|
|
|
+ lift_gate = @"false";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
int common_carrier_check = 0;
|
|
|
@@ -7429,6 +7463,7 @@
|
|
|
};
|
|
|
|
|
|
[dic setValue:item_0 forKey:@"item_0"];
|
|
|
+ [dic setValue:lift_gate forKey:@"lift_gate"];
|
|
|
|
|
|
return dic;
|
|
|
}
|
|
|
@@ -7804,9 +7839,12 @@
|
|
|
[ret setValue:order_type_dic forKey:@"section_0"];
|
|
|
|
|
|
// 1 Shipping Method
|
|
|
- NSDictionary *shipping_method_dic = [self shippingMethodDic:params db:db];
|
|
|
+ NSMutableDictionary *shipping_method_dic = [[self shippingMethodDic:params db:db] mutableCopy];
|
|
|
+ [params setValue:[shipping_method_dic objectForKey:@"lift_gate"] forKey:@"lift_gate"];
|
|
|
+ [shipping_method_dic removeObjectForKey:@"lift_gate"];
|
|
|
[ret setValue:shipping_method_dic forKey:@"section_1"];
|
|
|
|
|
|
+
|
|
|
// 2 Payment Information
|
|
|
NSDictionary *payment_info_dic = [self paymentInfoDic:params db:db];
|
|
|
[ret setValue:payment_info_dic forKey:@"section_2"];
|
|
|
@@ -7995,7 +8033,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
|
|
|
@@ -8023,7 +8061,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
|
|
|
@@ -8358,7 +8396,7 @@
|
|
|
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
[dic setValue:[NSNumber numberWithInteger:ret] forKey:@"result"];
|
|
|
[dic setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
+// [dic setValue:@"160409" forKey:@"min_ver"];
|
|
|
|
|
|
return [RAUtils dict2data:dic];
|
|
|
|