Explorar o código

修复Set Category Price中输入框为空的情况。

Pen Li %!s(int64=9) %!d(string=hai) anos
pai
achega
ac00e51ef2

BIN=BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 12
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,16 +2,4 @@
 <Bucket
    type = "0"
    version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            scope = "0"
-            stopOnStyle = "0">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
 </Bucket>

+ 29 - 14
RedAnt ERP Mobile/iSales-NPD/SetCategoryPriceController.m

@@ -199,13 +199,20 @@
     // http://192.168.0.126:8080/site/isales/setSeeGivenPrice.htm
     
     NSString *discount = @"";
+    BOOL rightDiscount = YES;
     switch (self.changePrice) {
         case Float:{
             discount = self.floatTextField.text;
+            if (!discount || !discount.length) {
+                rightDiscount = NO;
+            }
         }
             break;
         case Percent:{
             discount = [self.percentageTextField.text stringByAppendingString:@"%"];
+            if (!discount || discount.length <= 1) {
+                rightDiscount = NO;
+            }
         }
             break;
     
@@ -214,24 +221,32 @@
     }
     
     
-    
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Set Price"];
-    
-    NSDictionary *dic = [iSalesNetwork set_npd_shop_givenPrice:@{@"base_price" : [NSString stringWithFormat:@"%d",self.priceType],@"discount" : discount,@"category_id" : @(self.categoryID)}.mutableCopy];
-    
-    [waitalert dismissWithClickedButtonIndex:0 animated:YES];
-    
-    if ([[dic objectForKey:@"result"] integerValue] == 2) {
+    if (rightDiscount) {
         
-        [self.categoryPrice setObject:[NSString stringWithFormat:@"%d",self.priceType] forKey:@"base_price"];
-        [self.categoryPrice setObject:discount forKey:@"price_discount"];
+        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Set Price"];
+        
+        NSDictionary *dic = [iSalesNetwork set_npd_shop_givenPrice:@{@"base_price" : [NSString stringWithFormat:@"%d",self.priceType],@"discount" : discount,@"category_id" : @(self.categoryID)}.mutableCopy];
+        
+        [waitalert dismissWithClickedButtonIndex:0 animated:YES];
+        
+        if ([[dic objectForKey:@"result"] integerValue] == 2) {
+            
+            [self.categoryPrice setObject:[NSString stringWithFormat:@"%d",self.priceType] forKey:@"base_price"];
+            [self.categoryPrice setObject:discount forKey:@"price_discount"];
+            
+            // 将数据返回
+            if (self.returnBlock)
+                self.returnBlock(self.categoryPrice);
+        }
+        
+        [self.navigationController popViewControllerAnimated:YES];
+        
+    } else {
+        
+        [RAUtils message_alert:@"Please write a correct value" title:@"Warning" controller:self];
         
-        // 将数据返回
-        if (self.returnBlock)
-            self.returnBlock(self.categoryPrice);
     }
     
-    [self.navigationController popViewControllerAnimated:YES];
 }
 
 #pragma mark - text field delegate