|
@@ -2630,7 +2630,7 @@
|
|
|
|
|
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
- NSString *sqlQuery = [NSString stringWithFormat:@"select * from offline_state where country_code = %d;",[countryCode integerValue]];
|
|
|
|
|
|
|
+ NSString *sqlQuery = [NSString stringWithFormat:@"select * from offline_state where country_code = %@;",countryCode];
|
|
|
|
|
|
|
|
// NSString *sqlQuery = [NSString stringWithFormat:@"select * from offline_state"];
|
|
// NSString *sqlQuery = [NSString stringWithFormat:@"select * from offline_state"];
|
|
|
|
|
|
|
@@ -2737,6 +2737,27 @@
|
|
|
[dic setValue:item forKey:itemKey];
|
|
[dic setValue:item forKey:itemKey];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
++ (NSString *)countryCodeByid:(NSString *)code_id {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *ret = nil;
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
+ NSString *sqlQuery = [NSString stringWithFormat:@"select code from offline_country where countrycode_id = %@",code_id];
|
|
|
|
|
+ sqlite3_stmt * statement;
|
|
|
|
|
+
|
|
|
|
|
+ if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK) {
|
|
|
|
|
+ while (sqlite3_step(statement) == SQLITE_ROW) {
|
|
|
|
|
+ char *code = (char *)sqlite3_column_text(statement, 0);
|
|
|
|
|
+ ret = [NSString stringWithUTF8String:code];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3_finalize(statement);
|
|
|
|
|
+ }
|
|
|
|
|
+ sqlite3_close(db);
|
|
|
|
|
+
|
|
|
|
|
+ return ret;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+ (NSData *)offline_createContact:(NSMutableDictionary *)params {
|
|
+ (NSData *)offline_createContact:(NSMutableDictionary *)params {
|
|
|
|
|
|
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"createContact.json" ofType:nil];
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"createContact.json" ofType:nil];
|
|
@@ -2750,13 +2771,14 @@
|
|
|
NSString *countryCode = nil;
|
|
NSString *countryCode = nil;
|
|
|
if ([params.allKeys containsObject:@"refresh_trigger"]) {
|
|
if ([params.allKeys containsObject:@"refresh_trigger"]) {
|
|
|
if([params[@"refresh_trigger"] isEqualToString:@"country"]) { // choose country
|
|
if([params[@"refresh_trigger"] isEqualToString:@"country"]) { // choose country
|
|
|
- countryCode = params[@"country"];
|
|
|
|
|
- key = [NSString stringWithFormat:@"val_%d",[countryCode integerValue] - 1];
|
|
|
|
|
|
|
+ NSString *code_id = params[@"country"];
|
|
|
|
|
+ key = [NSString stringWithFormat:@"val_%d",[code_id integerValue] - 1];
|
|
|
|
|
+ countryCode = [self countryCodeByid:code_id];
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// default: US United States
|
|
// default: US United States
|
|
|
key = @"val_227";
|
|
key = @"val_227";
|
|
|
- countryCode = @"228";
|
|
|
|
|
|
|
+ countryCode = @"US";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
NSMutableDictionary *country = [allCountry objectForKey:key];
|
|
NSMutableDictionary *country = [allCountry objectForKey:key];
|