Просмотр исходного кода

160919
fix forcedownload logic check in login window .

Ray Zhang 9 лет назад
Родитель
Сommit
d8f6648148

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 65 - 1
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -630,7 +630,7 @@
       <BreakpointProxy
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             continueAfterRunningActions = "No"
             filePath = "iSales-NPD/AppDelegate.m"
             filePath = "iSales-NPD/AppDelegate.m"
@@ -675,5 +675,69 @@
             landmarkType = "5">
             landmarkType = "5">
          </BreakpointContent>
          </BreakpointContent>
       </BreakpointProxy>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesDB.m"
+            timestampString = "495963927.215656"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "693"
+            endingLineNumber = "693"
+            landmarkName = "+initializeDb"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesDB.m"
+            timestampString = "495963932.025825"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "734"
+            endingLineNumber = "734"
+            landmarkName = "+initializeDb"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesDB.m"
+            timestampString = "495963935.571955"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "43"
+            endingLineNumber = "43"
+            landmarkName = "offline_dirty()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/data_provider/iSalesDB.m"
+            timestampString = "495964098.161058"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "50"
+            endingLineNumber = "50"
+            landmarkName = "encryptfield()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
    </Breakpoints>
 </Bucket>
 </Bucket>

+ 13 - 0
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -196,6 +196,19 @@
     NSString* user = self.edituser.text;
     NSString* user = self.edituser.text;
     NSString* password = self.editpass.text;
     NSString* password = self.editpass.text;
     
     
+    
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    
+    bool forcedownload = [defaults boolForKey:@"Forcedownload"];
+    
+    if(forcedownload && self.checkOfflineMode.selected)
+    {
+        self.checkOfflineMode.selected = !self.checkOfflineMode.selected;
+        
+        [RAUtils alert_view:@"Detective incomplete sync, please finish sync first." title:@"Incomplete sync"];
+        return;
+    }
+    
     if(user.length==0||password.length==0)
     if(user.length==0||password.length==0)
     {
     {
         //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
         //        UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];

+ 11 - 1
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -39,7 +39,13 @@ int count_dbconn;
     return NO;
     return NO;
 }
 }
 
 
-
+void offline_dirty(sqlite3_context *context, int argc, sqlite3_value **argv) {
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    [defaults removeObjectForKey:@"Need_Sync"];
+    [defaults setBool:true forKey:@"Need_Sync"];
+    [defaults synchronize];
+}
 void encryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
 void encryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     assert(argc == 1);
     assert(argc == 1);
     switch (sqlite3_value_type(argv[0])){
     switch (sqlite3_value_type(argv[0])){
@@ -113,6 +119,7 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     int nResult	= 0;
     int nResult	= 0;
     nResult=sqlite3_create_function(db, "decrypt", -1, SQLITE_ANY, 0, decryptfield, 0, 0);
     nResult=sqlite3_create_function(db, "decrypt", -1, SQLITE_ANY, 0, decryptfield, 0, 0);
     nResult=sqlite3_create_function(db, "encrypt", -1, SQLITE_ANY, 0, encryptfield, 0, 0);
     nResult=sqlite3_create_function(db, "encrypt", -1, SQLITE_ANY, 0, encryptfield, 0, 0);
+    nResult=sqlite3_create_function(db, "offline_dirty", -1, SQLITE_ANY, 0, offline_dirty, 0, 0);
     //  sqlite3_create_function(database, "yourAwesome", 4, SQLITE_UTF8, NULL, &yourAwesomeFunc, NULL, NULL);
     //  sqlite3_create_function(database, "yourAwesome", 4, SQLITE_UTF8, NULL, &yourAwesomeFunc, NULL, NULL);
     //    nResult	= sqlite3_create_function(db, "containi", -1, SQLITE_ANY, 0, icuContainiFunc, 0, 0);
     //    nResult	= sqlite3_create_function(db, "containi", -1, SQLITE_ANY, 0, icuContainiFunc, 0, 0);
     return nResult;
     return nResult;
@@ -683,6 +690,8 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     
     
     NSString* create_offline_salesrep=@"CREATE TABLE IF NOT EXISTS offline_salesrep ( _id INTEGER PRIMARY KEY, name text, code text,salesrep_id integer);";
     NSString* create_offline_salesrep=@"CREATE TABLE IF NOT EXISTS offline_salesrep ( _id INTEGER PRIMARY KEY, name text, code text,salesrep_id integer);";
     
     
+    NSString* create_order_trigger=@"CREATE TRIGGER  if not exists offline_order_insert after insert on offline_order BEGIN select offline_dirty(''); select encrypt('abc'); END;";
+    
     //
     //
     
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -722,6 +731,7 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
         [self execSql:create_bundle db:db];
         [self execSql:create_bundle db:db];
         [self execSql:create_catalog db:db];
         [self execSql:create_catalog db:db];
         [self execSql:create_errlog db:db];
         [self execSql:create_errlog db:db];
+        [self execSql:create_order_trigger db:db];