Jelajahi Sumber

修改+translateSingleQuote:,增加对参数是否为NSString类型的判断

Pen Li 9 tahun lalu
induk
melakukan
89fc932760

TEMPAT SAMPAH
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 14 - 6
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -2991,7 +2991,6 @@
 + (NSString *)priceNameByPriceId:(NSString *)priceId {
     
     NSString *ret = nil;
-    priceId = [self translateSingleQuote:priceId];
     sqlite3 *db = [iSalesDB get_db];
     NSString *sqlQuery = [NSString stringWithFormat:@"select name from price where type = %@;",priceId];
     sqlite3_stmt * statement;
@@ -3083,11 +3082,10 @@
     return [[dic objectForKey:key] mutableCopy];
 }
 
-+ (NSString *)translateSingleQuote:(NSString *)string {
-//    if ([string isKindOfClass:[NSString class]])
++ (id)translateSingleQuote:(NSString *)string {
+    if ([string isKindOfClass:[NSString class]])
         return [string stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
-//    else
-//        return string;
+    return string;
 }
 
 + (NSString *)valueInParams:(NSDictionary *)params key:(NSString *)key {
@@ -3647,6 +3645,7 @@
     } else {
         companyName = @"";
     }
+    DebugLog(@"company");
     companyName = [self translateSingleQuote:companyName];
     
     NSString *addr1 = [params objectForKey:@"address"];
@@ -3672,7 +3671,7 @@
     if (!addr1) {
         addr1 = @"";
     }
-    
+    DebugLog(@"addr");
     addr = [RAUtils arr2string:@[addr1,addr2,addr3,addr4] separator:@" " trim:true];
     addr = [AESCrypt fastencrypt:addr];
     addr = [self translateSingleQuote:addr];
@@ -3692,12 +3691,14 @@
     } else {
         country = @"";
     }
+    DebugLog(@"country");
     country = [self translateSingleQuote:country];
     
     NSString *state = [params objectForKey:@"state"];
     if (!state) {
         state = @"";
     }
+    DebugLog(@"state");
     state = [self translateSingleQuote:state];
     
     NSString *city = [params objectForKey:@"city"];
@@ -3710,6 +3711,7 @@
     if (!zipcode) {
         zipcode = @"";
     }
+    DebugLog(@"zip");
     zipcode = [self translateSingleQuote:zipcode];
     
     NSString *fistName = [params objectForKey:@"firstname"];
@@ -3724,6 +3726,7 @@
     }
     
     contact_name = [RAUtils arr2string:@[fistName,lastName] separator:@" " trim:true];
+    DebugLog(@"contact_name");
     contact_name = [self translateSingleQuote:contact_name];
     
     fistName = [self translateSingleQuote:fistName];
@@ -3737,24 +3740,28 @@
     } else {
         phone = @"";
     }
+    DebugLog(@"PHONE");
     phone = [self translateSingleQuote:phone];
     
     NSString *fax = [params objectForKey:@"fax"];
     if (!fax) {
         fax = @"";
     }
+    DebugLog(@"FAX");
     fax = [self translateSingleQuote:fax];
     
     NSString *email = [params objectForKey:@"email"];
     if (!email) {
         email = @"";
     }
+    DebugLog(@"EMAIL:%@",email);
     email = [self translateSingleQuote:email];
     
     NSString *notes = [params objectForKey:@"contact_notes"];
     if (!notes) {
         notes = @"";
     }
+    DebugLog(@"NOTE:%@",notes);
     notes = [self translateSingleQuote:notes];
     
     NSString *price = [params objectForKey:@"price_name"];
@@ -3763,6 +3770,7 @@
     } else {
         price = @"";
     }
+    DebugLog(@"PRICE");
     price = [self translateSingleQuote:price];
     
     NSString *salesRep = [params objectForKey:@"sales_rep"];