|
@@ -10581,8 +10581,62 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
// user = EvanK;
|
|
// user = EvanK;
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
+ NSString *country_code = nil;
|
|
|
|
|
+ NSString *zipCode = nil;
|
|
|
|
|
+ NSString *stateCode = nil;
|
|
|
|
|
+ NSString *city = nil;
|
|
|
|
|
+
|
|
|
|
|
+ if ([params.allKeys containsObject:@"refresh_trigger"]) {
|
|
|
|
|
+
|
|
|
|
|
+ if([params[@"refresh_trigger"] isEqualToString:@"country"]) { // choose country
|
|
|
|
|
+
|
|
|
|
|
+ NSString *code_id = params[@"country"];
|
|
|
|
|
+ country_code = [self countryCodeByid:code_id];
|
|
|
|
|
+
|
|
|
|
|
+ } else if ([params[@"refresh_trigger"] isEqualToString:@"zipcode"]) { // zipcode
|
|
|
|
|
+
|
|
|
|
|
+ NSString *zip_code = params[@"zipcode"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // 剔除全部为空格
|
|
|
|
|
+ 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;
|
|
|
|
|
+
|
|
|
|
|
+ if (zipCode.length > 0) {
|
|
|
|
|
+
|
|
|
|
|
+ NSDictionary *dic = [self offline_dealZipCode:zip_code];
|
|
|
|
|
+
|
|
|
|
|
+ country_code = [dic valueForKey:@"country_code"];
|
|
|
|
|
+ if (!country_code) {
|
|
|
|
|
+ country_code = @"US";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ stateCode = [dic valueForKey:@"state_code"];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ city = [dic valueForKey:@"city"];
|
|
|
|
|
+
|
|
|
|
|
+ // zip code
|
|
|
|
|
+// NSMutableDictionary *zipDic = [[section_0 valueForKey:@"item_11"] mutableCopy];
|
|
|
|
|
+// [zipDic setValue:zipCode forKey:@"value"];
|
|
|
|
|
+// [section_0 setValue:zipDic forKey:@"item_11"];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
NSMutableDictionary * ret = [self dictionaryFileName:@"createContact.json"];
|
|
NSMutableDictionary * ret = [self dictionaryFileName:@"createContact.json"];
|
|
|
- [ret removeObjectForKey:@"up_params"];
|
|
|
|
|
|
|
+// [ret removeObjectForKey:@"up_params"];
|
|
|
[ret setObject:@"New Address" forKey:@"title"];
|
|
[ret setObject:@"New Address" forKey:@"title"];
|
|
|
|
|
|
|
|
NSDictionary * section_0 = [ret objectForKey:@"section_0"];
|
|
NSDictionary * section_0 = [ret objectForKey:@"section_0"];
|
|
@@ -10591,8 +10645,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
[new_section_0 setObject:[NSNumber numberWithInteger:14] forKey:@"count"];
|
|
[new_section_0 setObject:[NSNumber numberWithInteger:14] forKey:@"count"];
|
|
|
|
|
|
|
|
NSMutableDictionary *country_dic = [section_0[@"item_6"] mutableCopy];
|
|
NSMutableDictionary *country_dic = [section_0[@"item_6"] mutableCopy];
|
|
|
- [country_dic removeObjectForKey:@"refresh"];
|
|
|
|
|
- [country_dic removeObjectForKey:@"restore"];
|
|
|
|
|
|
|
+// [country_dic removeObjectForKey:@"refresh"];
|
|
|
|
|
+// [country_dic removeObjectForKey:@"restore"];
|
|
|
[new_section_0 setObject:country_dic forKey:@"item_0"]; // Country
|
|
[new_section_0 setObject:country_dic forKey:@"item_0"]; // Country
|
|
|
|
|
|
|
|
|
|
|
|
@@ -10603,11 +10657,17 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
[new_section_0 setObject:section_0[@"item_10"] forKey:@"item_5"]; // Address 4
|
|
[new_section_0 setObject:section_0[@"item_10"] forKey:@"item_5"]; // Address 4
|
|
|
|
|
|
|
|
NSMutableDictionary *zip_code_dic = [self anameDealWithStarAtItem:section_0[@"item_11"] add:YES];
|
|
NSMutableDictionary *zip_code_dic = [self anameDealWithStarAtItem:section_0[@"item_11"] add:YES];
|
|
|
- [zip_code_dic removeObjectForKey:@"refresh"];
|
|
|
|
|
|
|
+// [zip_code_dic removeObjectForKey:@"refresh"];
|
|
|
|
|
+ [zip_code_dic setValue:zipCode ? zipCode :@"" forKey:@"value"];
|
|
|
[new_section_0 setObject:zip_code_dic forKey:@"item_6"]; // Zip Code*
|
|
[new_section_0 setObject:zip_code_dic forKey:@"item_6"]; // Zip Code*
|
|
|
|
|
|
|
|
[new_section_0 setObject:[self anameDealWithStarAtItem:section_0[@"item_12"] add:YES] forKey:@"item_7"]; // State/Province*
|
|
[new_section_0 setObject:[self anameDealWithStarAtItem:section_0[@"item_12"] add:YES] forKey:@"item_7"]; // State/Province*
|
|
|
|
|
+
|
|
|
[new_section_0 setObject:[self anameDealWithStarAtItem:section_0[@"item_13"] add:YES] forKey:@"item_8"]; // City*
|
|
[new_section_0 setObject:[self anameDealWithStarAtItem:section_0[@"item_13"] add:YES] forKey:@"item_8"]; // City*
|
|
|
|
|
+ NSDictionary *cityDic = [[new_section_0 objectForKey:@"item_8"] mutableCopy];
|
|
|
|
|
+ [cityDic setValue:city ? city : @"" forKey:@"value"];
|
|
|
|
|
+ [new_section_0 setObject:cityDic forKey:@"item_8"];
|
|
|
|
|
+
|
|
|
[new_section_0 setObject:section_0[@"item_14"] forKey:@"item_9"]; // Contact First Name
|
|
[new_section_0 setObject:section_0[@"item_14"] forKey:@"item_9"]; // Contact First Name
|
|
|
[new_section_0 setObject:section_0[@"item_15"] forKey:@"item_10"]; // Contact Last Name
|
|
[new_section_0 setObject:section_0[@"item_15"] forKey:@"item_10"]; // Contact Last Name
|
|
|
[new_section_0 setObject:section_0[@"item_5"] forKey:@"item_11"]; // Phone*
|
|
[new_section_0 setObject:section_0[@"item_5"] forKey:@"item_11"]; // Phone*
|
|
@@ -10617,27 +10677,27 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
|
|
|
|
|
|
|
|
|
|
|
|
|
// country
|
|
// country
|
|
|
- NSString *countryCode = @"US";
|
|
|
|
|
|
|
+ NSString *countryCode = country_code == nil ? @"US" : country_code;
|
|
|
NSDictionary *allCountry = [self offline_getAllCountryDefault:countryCode];
|
|
NSDictionary *allCountry = [self offline_getAllCountryDefault:countryCode];
|
|
|
[self setValue:allCountry forItemKey:@"item_0" valueKey:@"cadedate" inDictionary:new_section_0];
|
|
[self setValue:allCountry forItemKey:@"item_0" valueKey:@"cadedate" inDictionary:new_section_0];
|
|
|
|
|
|
|
|
|
|
|
|
|
// state
|
|
// state
|
|
|
- NSMutableDictionary *allState = [[self offline_getStateByCountryCode:countryCode checkedState:nil] mutableCopy];
|
|
|
|
|
|
|
+ NSMutableDictionary *allState = [[self offline_getStateByCountryCode:countryCode checkedState:stateCode] mutableCopy];
|
|
|
|
|
|
|
|
- NSDictionary *tmpDic = @{
|
|
|
|
|
- @"value" : @"Other",
|
|
|
|
|
- @"value_id" : @"",
|
|
|
|
|
- @"check" : [NSNumber numberWithInteger:0]
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- for (int i = 0; i < allState.allKeys.count; i++) {
|
|
|
|
|
- NSString *key = [NSString stringWithFormat:@"val_%d",i];
|
|
|
|
|
-
|
|
|
|
|
- NSDictionary *tmp = allState[key];
|
|
|
|
|
- [allState setValue:tmpDic forKey:key];
|
|
|
|
|
- tmpDic = tmp;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// NSDictionary *tmpDic = @{
|
|
|
|
|
+// @"value" : @"Other",
|
|
|
|
|
+// @"value_id" : @"",
|
|
|
|
|
+// @"check" : [NSNumber numberWithInteger:0]
|
|
|
|
|
+// };
|
|
|
|
|
+//
|
|
|
|
|
+// for (int i = 0; i < allState.allKeys.count; i++) {
|
|
|
|
|
+// NSString *key = [NSString stringWithFormat:@"val_%d",i];
|
|
|
|
|
+//
|
|
|
|
|
+// NSDictionary *tmp = allState[key];
|
|
|
|
|
+// [allState setValue:tmpDic forKey:key];
|
|
|
|
|
+// tmpDic = tmp;
|
|
|
|
|
+// }
|
|
|
[allState setValue:[NSNumber numberWithInteger:allState.allKeys.count - 1] forKey:@"count"];
|
|
[allState setValue:[NSNumber numberWithInteger:allState.allKeys.count - 1] forKey:@"count"];
|
|
|
|
|
|
|
|
[self setValue:allState forItemKey:@"item_7" valueKey:@"cadedate" inDictionary:new_section_0];
|
|
[self setValue:allState forItemKey:@"item_7" valueKey:@"cadedate" inDictionary:new_section_0];
|