Bläddra i källkod

1.修改NPD离线Place Order在保存时忽略Disabled Section。

Pen Li 8 år sedan
förälder
incheckning
45dc55ba79
1 ändrade filer med 176 tillägg och 62 borttagningar
  1. 176 62
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

+ 176 - 62
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -3740,15 +3740,15 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
     NSString *customer_name = [self translateSingleQuote:params[@"customer_name"]];
     NSString* customer_cid = [self translateSingleQuote:params[@"customer_cid"]];
-//    NSString* customer_address1 = [self translateSingleQuote:params[@"customer_address1"]];
-    //    NSString* customer_address2 = [self translateSingleQuote:params[@"customer_address2"]];
-    //    NSString* customer_address3 = [self translateSingleQuote:params[@"customer_address3"]];
-    //    NSString* customer_address4 = [self translateSingleQuote:params[@"customer_address4"]];
-    //    NSString* customer_city = [self translateSingleQuote:params[@"customer_city"]];
+    NSString* customer_address1 = [self translateSingleQuote:params[@"customer_address1"]];
+    NSString* customer_address2 = [self translateSingleQuote:params[@"customer_address2"]];
+//    NSString* customer_address3 = [self translateSingleQuote:params[@"customer_address3"]];
+//    NSString* customer_address4 = [self translateSingleQuote:params[@"customer_address4"]];
+    NSString* customer_city = [self translateSingleQuote:params[@"customer_city"]];
     NSString* customer_contact = [self translateSingleQuote:params[@"customer_contact"]];
     NSString* customer_contact_ext = [self translateSingleQuote:params[@"customer_contact_ext"]];
-    //    NSString* customer_contact_notes = [self translateSingleQuote:params[@"customer_contact_notes"]];
-    //    NSString* customer_country = [self translateSingleQuote:params[@"customer_country"]];
+//    NSString* customer_contact_notes = [self translateSingleQuote:params[@"customer_contact_notes"]];
+    NSString* customer_country = [self translateSingleQuote:params[@"customer_country"]];
     NSString* customer_email = [self translateSingleQuote:params[@"customer_email"]];
     NSString* customer_fax = [self translateSingleQuote:params[@"customer_fax"]];
     NSString* customer_first_name = [self translateSingleQuote:params[@"customer_first_name"]];
@@ -3757,8 +3757,8 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     NSString* customer_phone = [self translateSingleQuote:params[@"customer_phone"]];
     //   NSString* customer_price_type = [self translateSingleQuote:params[@"customer_price_type"]];
     NSString* customer_sales_rep = [self translateSingleQuote:params[@"customer_sales_rep"]];
-    //  NSString* customer_state = [self translateSingleQuote:params[@"customer_state"]];
-    //   NSString* customer_zipcode = [self translateSingleQuote:params[@"customer_zipcode"]];
+    NSString* customer_state = [self translateSingleQuote:params[@"customer_state"]];
+    NSString* customer_zipcode = [self translateSingleQuote:params[@"customer_zipcode"]];
     NSString* create_by = [self translateSingleQuote:params[@"user"]];
     
     NSMutableArray* arr_name= [[NSMutableArray alloc] init];
@@ -3807,7 +3807,7 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     if(so_id==nil)
         so_id=[NSString stringWithFormat:@"OFFLINE%@",[NSUUID UUID].UUIDString ];
     
-    NSString* sql_neworder=[NSString stringWithFormat:@"insert into offline_order(so_id,status,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,sales_rep,create_by,customer_contact,must_call,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,sales_terms,sender_address1,sender_address2,sender_state,sender_zipcode,sender_city,sender_country) values('%@',0,'%@','%@','%@','%@','%@','%@','%@','%@',1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','FOB','%@','%@','%@','%@','%@','%@')",so_id,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,customer_sales_rep,create_by ,contact_name,cid,name,ext,contact,phone,fax,email,customer_cid,customer_name,customer_contact_ext,customer_contact,customer_phone,customer_fax,customer_email,ext,addr2,state,zipcode,city,country];
+    NSString* sql_neworder=[NSString stringWithFormat:@"insert into offline_order(so_id,status,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,sales_rep,create_by,customer_contact,must_call,sender_cid,sender_name,sender_ext,sender_contact,sender_phone,sender_fax,sender_email,billing_cid,billing_name,billing_ext,billing_contact,billing_phone,billing_fax,billing_email,sales_terms,sender_address1,sender_address2,sender_state,sender_zipcode,sender_city,sender_country,billing_address1,billing_address2,billing_state,billing_zipcode,billing_city,billing_country) values('%@',0,'%@','%@','%@','%@','%@','%@','%@','%@',1,'%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','FOB','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@','%@')",so_id,customer_cid,customer_contact,customer_email,customer_fax,customer_phone,customer_sales_rep,create_by ,contact_name,cid,name,ext,contact,phone,fax,email,customer_cid,customer_name,customer_contact_ext,customer_contact,customer_phone,customer_fax,customer_email,ext,addr2,state,zipcode,city,country,customer_address1,customer_address2,customer_state,customer_zipcode,customer_city,customer_country];
     
     
     
@@ -12466,6 +12466,14 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     
     NSString *contactSql = [NSString stringWithFormat:@"update offline_contact set %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ %@ where contact_id = '%@'",contact_contact,contact_email,contact_phone,contact_fax,customer_name,customer_address1,customer_address2,customer_address3,customer_address4,customer_country,customer_state,customer_city,customer_zipcode,contact_id];
     
+    // Place Order Setting,对于Disable的Section保存时不做处理,即没有对应的参数时对应的column就不再重置为null
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *cachefolder = [paths objectAtIndex:0];
+    NSString *ui_path = [cachefolder stringByAppendingPathComponent:@"offline_data/UISetting.json"];
+    NSData *ui_data = [NSData dataWithContentsOfFile:ui_path];;
+    NSError *error=nil;
+    NSMutableDictionary* menu = [[NSJSONSerialization JSONObjectWithData:ui_data options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
+    NSDictionary *setting = [menu objectForKey:@"placeOrder"];
     
     NSString *receive_cid = [self valueInParams:param key:@"receive_cid" translateSingleQuote:YES];
     if (receive_cid.length) {
@@ -12563,83 +12571,105 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     }
     
     
-    
+    NSNumber *shipFromDisable = setting[@"ShipFromDisabled"];
     
     NSString *sender_cid = [self valueInParams:param key:@"sender_cid" translateSingleQuote:YES];
     if (sender_cid.length) {
         sender_cid = [NSString stringWithFormat:@"sender_cid = '%@',",sender_cid];
     } else {
-        sender_cid = [NSString stringWithFormat:@"sender_cid = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_cid = [NSString stringWithFormat:@"sender_cid = null,"];
+        }
     }
     
     NSString *sender_name = [self valueInParams:param key:@"sender_name" translateSingleQuote:YES];
     if (sender_name.length) {
         sender_name = [NSString stringWithFormat:@"sender_name = '%@',",sender_name];
     } else {
-        sender_name = [NSString stringWithFormat:@"sender_name = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_name = [NSString stringWithFormat:@"sender_name = null,"];
+        }
     }
     
     NSString *sender_ext = [self valueInParams:param key:@"sender_ext" translateSingleQuote:YES];
     if (sender_ext.length) {
         sender_ext = [NSString stringWithFormat:@"sender_ext = '%@',",sender_ext];
     } else {
-        sender_ext = [NSString stringWithFormat:@"sender_ext = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_ext = [NSString stringWithFormat:@"sender_ext = null,"];
+        }
     }
     
     NSString *sender_addr1 = [self valueInParams:param key:@"sender_address1" translateSingleQuote:YES];
     if (sender_addr1.length) {
         sender_addr1 = [NSString stringWithFormat:@"sender_address1 = '%@',",sender_addr1];
     } else {
-        sender_addr1 = [NSString stringWithFormat:@"sender_address1 = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_addr1 = [NSString stringWithFormat:@"sender_address1 = null,"];
+        }
     }
     
     NSString *sender_addr2 = [self valueInParams:param key:@"sender_address2" translateSingleQuote:YES];
     if (sender_addr2.length) {
         sender_addr2 = [NSString stringWithFormat:@"sender_address2 = '%@',",sender_addr2];
     } else {
-        sender_addr2 = [NSString stringWithFormat:@"sender_address2 = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_addr2 = [NSString stringWithFormat:@"sender_address2 = null,"];
+        }
     }
     
     NSString *sender_city = [self valueInParams:param key:@"sender_city" translateSingleQuote:YES];
     if (sender_city.length) {
         sender_city = [NSString stringWithFormat:@"sender_city = '%@',",sender_city];
     } else {
-        sender_city = [NSString stringWithFormat:@"sender_city = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_city = [NSString stringWithFormat:@"sender_city = null,"];
+        }
     }
     
     NSString *sender_state = [self valueInParams:param key:@"sender_state" translateSingleQuote:YES];
     if (sender_state.length) {
         sender_state = [NSString stringWithFormat:@"sender_state = '%@',",sender_state];
     } else {
-        sender_state = [NSString stringWithFormat:@"sender_state = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_state = [NSString stringWithFormat:@"sender_state = null,"];
+        }
     }
     
     NSString *sender_zipcode = [self valueInParams:param key:@"sender_zipcode" translateSingleQuote:YES];
     if (sender_zipcode.length) {
         sender_zipcode = [NSString stringWithFormat:@"sender_zipcode = '%@',",sender_zipcode];
     } else {
-        sender_zipcode = [NSString stringWithFormat:@"sender_zipcode = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_zipcode = [NSString stringWithFormat:@"sender_zipcode = null,"];
+        }
     }
     
     NSString *sender_country = [self valueInParams:param key:@"sender_country" translateSingleQuote:YES];
     if (sender_country.length) {
         sender_country = [NSString stringWithFormat:@"sender_country = '%@',",sender_country];
     } else {
-        sender_country = [NSString stringWithFormat:@"sender_country = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_country = [NSString stringWithFormat:@"sender_country = null,"];
+        }
     }
     
     NSString *sender_contact = [self valueInParams:param key:@"sender_contact" translateSingleQuote:YES];
     if(sender_contact.length) {
         sender_contact = [NSString stringWithFormat:@"sender_contact = '%@',",sender_contact];
     } else {
-        sender_contact = [NSString stringWithFormat:@"sender_contact = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_contact = [NSString stringWithFormat:@"sender_contact = null,"];
+        }
     }
     
     NSString *sender_phone = [self valueInParams:param key:@"sender_phone" translateSingleQuote:YES];
     if (sender_phone.length) {
         sender_phone = [NSString stringWithFormat:@"sender_phone = '%@',",sender_phone];
     } else {
-        sender_phone = [NSString stringWithFormat:@"sender_phone = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_phone = [NSString stringWithFormat:@"sender_phone = null,"];
+        }
     }
     
     
@@ -12647,21 +12677,29 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     if (sender_fax.length) {
         sender_fax = [NSString stringWithFormat:@"sender_fax = '%@',",sender_fax];
     } else {
-        sender_fax = [NSString stringWithFormat:@"sender_fax = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_fax = [NSString stringWithFormat:@"sender_fax = null,"];
+        }
     }
     
     NSString *sender_email = [self valueInParams:param key:@"sender_email" translateSingleQuote:YES];
     if (sender_email.length) {
         sender_email = [NSString stringWithFormat:@"sender_email = '%@',",sender_email];
     } else {
-        sender_email = [NSString stringWithFormat:@"sender_email = null,"];
+        if (![shipFromDisable integerValue]) {
+            sender_email = [NSString stringWithFormat:@"sender_email = null,"];
+        }
     }
     
+    NSNumber *freightBillToDisable = setting[@"FreightBillToDisabled"];
+    
     NSString *shipping_billto_cid = [self valueInParams:param key:@"shipping_billto_cid" translateSingleQuote:YES];
     if (shipping_billto_cid.length) {
         shipping_billto_cid = [NSString stringWithFormat:@"shipping_billto_cid = '%@',",shipping_billto_cid];
     } else {
-        shipping_billto_cid = [NSString stringWithFormat:@"shipping_billto_cid = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_cid = [NSString stringWithFormat:@"shipping_billto_cid = null,"];
+        }
     }
     
     
@@ -12669,7 +12707,9 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     if (shipping_billto_name.length) {
         shipping_billto_name = [NSString stringWithFormat:@"shipping_billto_name = '%@',",shipping_billto_name];
     } else {
-        shipping_billto_name = [NSString stringWithFormat:@"shipping_billto_name = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_name = [NSString stringWithFormat:@"shipping_billto_name = null,"];
+        }
     }
     
     
@@ -12677,106 +12717,137 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     if (shipping_billto_ext.length) {
         shipping_billto_ext = [NSString stringWithFormat:@"shipping_billto_ext = '%@',",shipping_billto_ext];
     } else {
-        shipping_billto_ext = [NSString stringWithFormat:@"shipping_billto_ext = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_ext = [NSString stringWithFormat:@"shipping_billto_ext = null,"];
+        }
     }
     
     NSString *shipping_billto_addr1 = [self valueInParams:param key:@"shipping_billto_address1" translateSingleQuote:YES];
     if (shipping_billto_addr1.length) {
         shipping_billto_addr1 = [NSString stringWithFormat:@"shipping_billto_address1 = '%@',",shipping_billto_addr1];
     } else {
-        shipping_billto_addr1 = [NSString stringWithFormat:@"shipping_billto_address1 = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_addr1 = [NSString stringWithFormat:@"shipping_billto_address1 = null,"];
+        }
     }
     
     NSString *shipping_billto_addr2 = [self valueInParams:param key:@"shipping_billto_address2" translateSingleQuote:YES];
     if (shipping_billto_addr2.length) {
         shipping_billto_addr2 = [NSString stringWithFormat:@"shipping_billto_address2 = '%@',",shipping_billto_addr2];
     } else {
-        shipping_billto_addr2 = [NSString stringWithFormat:@"shipping_billto_address2 = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_addr2 = [NSString stringWithFormat:@"shipping_billto_address2 = null,"];
+        }
     }
     
     NSString *shipping_billto_city = [self valueInParams:param key:@"shipping_billto_city" translateSingleQuote:YES];
     if (shipping_billto_city.length) {
         shipping_billto_city = [NSString stringWithFormat:@"shipping_billto_city = '%@',",shipping_billto_city];
     } else {
-        shipping_billto_city = [NSString stringWithFormat:@"shipping_billto_city = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_city = [NSString stringWithFormat:@"shipping_billto_city = null,"];
+        }
     }
     
     NSString *shipping_billto_state = [self valueInParams:param key:@"shipping_billto_state" translateSingleQuote:YES];
     if (shipping_billto_state.length) {
         shipping_billto_state = [NSString stringWithFormat:@"shipping_billto_state = '%@',",shipping_billto_state];
     } else {
-        shipping_billto_state = [NSString stringWithFormat:@"shipping_billto_state = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_state = [NSString stringWithFormat:@"shipping_billto_state = null,"];
+        }
     }
     
     NSString *shipping_billto_zipcode = [self valueInParams:param key:@"shipping_billto_zipcode" translateSingleQuote:YES];
     if (shipping_billto_zipcode.length) {
         shipping_billto_zipcode = [NSString stringWithFormat:@"shipping_billto_zipcode = '%@',",shipping_billto_zipcode];
     } else {
-        shipping_billto_zipcode = [NSString stringWithFormat:@"shipping_billto_zipcode = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_zipcode = [NSString stringWithFormat:@"shipping_billto_zipcode = null,"];
+        }
     }
     
     NSString *shipping_billto_country = [self valueInParams:param key:@"shipping_billto_country" translateSingleQuote:YES];
     if (shipping_billto_country.length) {
         shipping_billto_country = [NSString stringWithFormat:@"shipping_billto_country = '%@',",shipping_billto_country];
     } else {
-        shipping_billto_country = [NSString stringWithFormat:@"shipping_billto_country = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_country = [NSString stringWithFormat:@"shipping_billto_country = null,"];
+        }
     }
     
     NSString *shipping_billto_contact = [self valueInParams:param key:@"shipping_billto_contact" translateSingleQuote:YES];
     if (shipping_billto_contact.length) {
         shipping_billto_contact = [NSString stringWithFormat:@"shipping_billto_contact = '%@',",shipping_billto_contact];
     } else {
-        shipping_billto_contact = [NSString stringWithFormat:@"shipping_billto_contact = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_contact = [NSString stringWithFormat:@"shipping_billto_contact = null,"];
+        }
     }
     
     NSString *shipping_billto_phone = [self valueInParams:param key:@"shipping_billto_phone" translateSingleQuote:YES];
     if (shipping_billto_phone.length) {
         shipping_billto_phone = [NSString stringWithFormat:@"shipping_billto_phone = '%@',",shipping_billto_phone];
     } else {
-        shipping_billto_phone = [NSString stringWithFormat:@"shipping_billto_phone = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_phone = [NSString stringWithFormat:@"shipping_billto_phone = null,"];
+        }
     }
     
     NSString *shipping_billto_fax = [self valueInParams:param key:@"shipping_billto_fax" translateSingleQuote:YES];
     if (shipping_billto_fax.length) {
         shipping_billto_fax = [NSString stringWithFormat:@"shipping_billto_fax = '%@',",shipping_billto_fax];
     } else {
-        shipping_billto_fax = [NSString stringWithFormat:@"shipping_billto_fax = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_fax = [NSString stringWithFormat:@"shipping_billto_fax = null,"];
+        }
     }
     
     NSString *shipping_billto_email = [self valueInParams:param key:@"shipping_billto_email" translateSingleQuote:YES];
     if (shipping_billto_email.length) {
         shipping_billto_email = [NSString stringWithFormat:@"shipping_billto_email = '%@',",shipping_billto_email];
     } else {
-        shipping_billto_email = [NSString stringWithFormat:@"shipping_billto_email = null,"];
+        if (![freightBillToDisable integerValue]) {
+            shipping_billto_email = [NSString stringWithFormat:@"shipping_billto_email = null,"];
+        }
     }
     
+    NSNumber *merchandiseBillToDisable = setting[@"MerchandiseBillToDisabled"];
     
     NSString *billing_cid = [self valueInParams:param key:@"billing_cid" translateSingleQuote:YES];
     if (billing_cid.length) {
         billing_cid = [NSString stringWithFormat:@"billing_cid = '%@',",billing_cid];
     } else {
-        billing_cid = [NSString stringWithFormat:@"billing_cid = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_cid = [NSString stringWithFormat:@"billing_cid = null,"];
+        }
     }
     
     NSString *billing_name = [self valueInParams:param key:@"billing_name" translateSingleQuote:YES];
     if (billing_name.length) {
         billing_name = [NSString stringWithFormat:@"billing_name = '%@',",billing_name];
     } else {
-        billing_name = [NSString stringWithFormat:@"billing_name = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_name = [NSString stringWithFormat:@"billing_name = null,"];
+        }
     }
     
     NSString *billing_ext = [self valueInParams:param key:@"billing_ext" translateSingleQuote:YES];
     if (billing_ext.length) {
         billing_ext = [NSString stringWithFormat:@"billing_ext = '%@',",billing_ext];
     } else {
-        billing_ext = [NSString stringWithFormat:@"billing_ext = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_ext = [NSString stringWithFormat:@"billing_ext = null,"];
+        }
     }
     
     NSString *billing_addr1 = [self valueInParams:param key:@"billing_address1" translateSingleQuote:YES];
     if (billing_addr1.length) {
         billing_addr1 = [NSString stringWithFormat:@"billing_address1 = '%@',",billing_addr1];
     } else {
-        billing_addr1 = [NSString stringWithFormat:@"billing_address1 = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_addr1 = [NSString stringWithFormat:@"billing_address1 = null,"];
+        }
     }
     
     NSString *billing_addr2 = [self valueInParams:param key:@"billing_address2" translateSingleQuote:YES];
@@ -12790,148 +12861,191 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
     if (billing_city.length) {
         billing_city = [NSString stringWithFormat:@"billing_city = '%@',",billing_city];
     } else {
-        billing_city = [NSString stringWithFormat:@"billing_city = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_city = [NSString stringWithFormat:@"billing_city = null,"];
+        }
     }
     
     NSString *billing_state = [self valueInParams:param key:@"billing_state" translateSingleQuote:YES];
     if (billing_state.length) {
         billing_state = [NSString stringWithFormat:@"billing_state = '%@',",billing_state];
     } else {
-        billing_state = [NSString stringWithFormat:@"billing_state = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_state = [NSString stringWithFormat:@"billing_state = null,"];
+        }
     }
     
     NSString *billing_zipcode = [self valueInParams:param key:@"billing_zipcode" translateSingleQuote:YES];
     if (billing_zipcode.length) {
         billing_zipcode = [NSString stringWithFormat:@"billing_zipcode = '%@',",billing_zipcode];
     } else {
-        billing_zipcode = [NSString stringWithFormat:@"billing_zipcode = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_zipcode = [NSString stringWithFormat:@"billing_zipcode = null,"];
+        }
     }
     
     NSString *billing_country = [self valueInParams:param key:@"billing_country" translateSingleQuote:YES];
     if (billing_country.length) {
         billing_country = [NSString stringWithFormat:@"billing_country = '%@',",billing_country];
     } else {
-        billing_country = [NSString stringWithFormat:@"billing_country = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_country = [NSString stringWithFormat:@"billing_country = null,"];
+        }
     }
     
     NSString *billing_contact = [self valueInParams:param key:@"billing_contact" translateSingleQuote:YES];
     if (billing_contact.length) {
         billing_contact = [NSString stringWithFormat:@"billing_contact = '%@',",billing_contact];
     } else {
-        billing_contact = [NSString stringWithFormat:@"billing_contact = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_contact = [NSString stringWithFormat:@"billing_contact = null,"];
+        }
     }
     
     NSString *billing_phone = [self valueInParams:param key:@"billing_phone" translateSingleQuote:YES];
     if (billing_phone.length) {
         billing_phone = [NSString stringWithFormat:@"billing_phone = '%@',",billing_phone];
     } else {
-        billing_phone = [NSString stringWithFormat:@"billing_phone = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_phone = [NSString stringWithFormat:@"billing_phone = null,"];
+        }
     }
     
     NSString *billing_fax = [self valueInParams:param key:@"billing_fax" translateSingleQuote:YES];
     if (billing_fax.length) {
         billing_fax = [NSString stringWithFormat:@"billing_fax = '%@',",billing_fax];
     } else {
-        billing_fax = [NSString stringWithFormat:@"billing_fax = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_fax = [NSString stringWithFormat:@"billing_fax = null,"];
+        }
     }
     
     NSString *billing_email = [self valueInParams:param key:@"billing_email" translateSingleQuote:YES];
     if (billing_email.length) {
         billing_email = [NSString stringWithFormat:@"billing_email = '%@',",billing_email];
     } else {
-        billing_email = [NSString stringWithFormat:@"billing_email = null,"];
+        if (![merchandiseBillToDisable integerValue]) {
+            billing_email = [NSString stringWithFormat:@"billing_email = null,"];
+        }
     }
     
+    NSNumber *returnToDisable = setting[@"ReturnToDisabled"];
     
     NSString *returnto_cid = [self valueInParams:param key:@"returnto_cid" translateSingleQuote:YES];
     if (returnto_cid.length) {
         returnto_cid = [NSString stringWithFormat:@"returnto_cid = '%@',",returnto_cid];
     } else {
-        returnto_cid = [NSString stringWithFormat:@"returnto_cid = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_cid = [NSString stringWithFormat:@"returnto_cid = null,"];
+        }
     }
     
     NSString *returnto_name = [self valueInParams:param key:@"returnto_name" translateSingleQuote:YES];
     if (returnto_name.length) {
         returnto_name = [NSString stringWithFormat:@"returnto_name = '%@',",returnto_name];
     } else {
-        returnto_name = [NSString stringWithFormat:@"returnto_name = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_name = [NSString stringWithFormat:@"returnto_name = null,"];
+        }
     }
     
     NSString *returnto_ext = [self valueInParams:param key:@"returnto_ext" translateSingleQuote:YES];
     if (returnto_ext.length) {
         returnto_ext = [NSString stringWithFormat:@"returnto_ext = '%@',",returnto_ext];
     } else {
-        returnto_ext = [NSString stringWithFormat:@"returnto_ext = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_ext = [NSString stringWithFormat:@"returnto_ext = null,"];
+        }
     }
     
     NSString *returnto_addr1 = [self valueInParams:param key:@"returnto_address1" translateSingleQuote:YES];
     if (returnto_addr1.length) {
         returnto_addr1 = [NSString stringWithFormat:@"returnto_address1 = '%@',",returnto_addr1];
     } else {
-        returnto_addr1 = [NSString stringWithFormat:@"returnto_address1 = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_addr1 = [NSString stringWithFormat:@"returnto_address1 = null,"];
+        }
     }
     
     NSString *returnto_addr2 = [self valueInParams:param key:@"returnto_address2" translateSingleQuote:YES];
     if (returnto_addr2.length) {
         returnto_addr2 = [NSString stringWithFormat:@"returnto_address2 = '%@',",returnto_addr2];
     } else {
-        returnto_addr2 = [NSString stringWithFormat:@"returnto_address2 = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_addr2 = [NSString stringWithFormat:@"returnto_address2 = null,"];
+        }
     }
     
     NSString *returnto_city = [self valueInParams:param key:@"returnto_city" translateSingleQuote:YES];
     if (returnto_city.length) {
         returnto_city = [NSString stringWithFormat:@"returnto_city = '%@',",returnto_city];
     } else {
-        returnto_city = [NSString stringWithFormat:@"returnto_city = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_city = [NSString stringWithFormat:@"returnto_city = null,"];
+        }
     }
     
     NSString *returnto_state = [self valueInParams:param key:@"returnto_state" translateSingleQuote:YES];
     if (returnto_state.length) {
         returnto_state = [NSString stringWithFormat:@"returnto_state = '%@',",returnto_state];
     } else {
-        returnto_state = [NSString stringWithFormat:@"returnto_state = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_state = [NSString stringWithFormat:@"returnto_state = null,"];
+        }
     }
     
     NSString *returnto_zipcode = [self valueInParams:param key:@"returnto_zipcode" translateSingleQuote:YES];
     if (returnto_zipcode.length) {
         returnto_zipcode = [NSString stringWithFormat:@"returnto_zipcode = '%@',",returnto_zipcode];
     } else {
-        returnto_zipcode = [NSString stringWithFormat:@"returnto_zipcode = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_zipcode = [NSString stringWithFormat:@"returnto_zipcode = null,"];
+        }
     }
     
     NSString *returnto_country = [self valueInParams:param key:@"returnto_country" translateSingleQuote:YES];
     if (returnto_country.length) {
         returnto_country = [NSString stringWithFormat:@"returnto_country = '%@',",returnto_country];
     } else {
-        returnto_country = [NSString stringWithFormat:@"returnto_country = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_country = [NSString stringWithFormat:@"returnto_country = null,"];
+        }
     }
     
     NSString *returnto_contact = [self valueInParams:param key:@"returnto_contact" translateSingleQuote:YES];
     if (returnto_contact.length) {
         returnto_contact = [NSString stringWithFormat:@"returnto_contact = '%@',",returnto_contact];
     } else {
-        returnto_contact = [NSString stringWithFormat:@"returnto_contact = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_contact = [NSString stringWithFormat:@"returnto_contact = null,"];
+        }
     }
     
     NSString *returnto_phone = [self valueInParams:param key:@"returnto_phone" translateSingleQuote:YES];
     if (returnto_phone.length) {
         returnto_phone = [NSString stringWithFormat:@"returnto_phone = '%@',",returnto_phone];
     } else {
-        returnto_phone = [NSString stringWithFormat:@"returnto_phone = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_phone = [NSString stringWithFormat:@"returnto_phone = null,"];
+        }
     }
     
     NSString *returnto_fax = [self valueInParams:param key:@"returnto_fax" translateSingleQuote:YES];
     if (returnto_fax.length) {
         returnto_fax = [NSString stringWithFormat:@"returnto_fax = '%@',",returnto_fax];
     } else {
-        returnto_fax = [NSString stringWithFormat:@"returnto_fax = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_fax = [NSString stringWithFormat:@"returnto_fax = null,"];
+        }
     }
     
     NSString *returnto_email = [self valueInParams:param key:@"returnto_email" translateSingleQuote:YES];
     if (returnto_email.length) {
         returnto_email = [NSString stringWithFormat:@"returnto_email = '%@',",returnto_email];
     } else {
-        returnto_email = [NSString stringWithFormat:@"returnto_email = null,"];
+        if (![returnToDisable integerValue]) {
+            returnto_email = [NSString stringWithFormat:@"returnto_email = null,"];
+        }
     }
     
     NSString *order_status = @"status = 1,";