|
|
@@ -556,51 +556,54 @@
|
|
|
{
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
|
- if(appDelegate.order_code.length>0)
|
|
|
+ if(appDelegate.order_code && appDelegate.order_code.length>0)
|
|
|
{
|
|
|
appDelegate.order_code= nil;
|
|
|
[appDelegate SetSo:nil];
|
|
|
|
|
|
- // MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
- ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
- cvc.showNavibar = true;
|
|
|
- cvc.contact_type = @"Sales_Order_Customer";
|
|
|
- cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
+ if (appDelegate.user_type == USER_ROLE_EMPLOYEE) {
|
|
|
+ // MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
|
|
|
+ ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
+ cvc.showNavibar = true;
|
|
|
+ cvc.contact_type = @"Sales_Order_Customer";
|
|
|
+ cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
+
|
|
|
+ appDelegate.contact_id=[value valueForKey:@"customer_cid"];
|
|
|
+ appDelegate.customerInfo = value;
|
|
|
+
|
|
|
+ self.norefresh = true;
|
|
|
+ [self neworder];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // [main_vc checklogin:true];
|
|
|
+ // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+
|
|
|
+ //
|
|
|
+ // if(self.returnValue)
|
|
|
+ // self.returnValue(value);
|
|
|
+ };
|
|
|
|
|
|
- appDelegate.contact_id=[value valueForKey:@"customer_cid"];
|
|
|
- appDelegate.customerInfo = value;
|
|
|
+ cvc.onCancel = ^(){
|
|
|
+ self.norefresh = true;
|
|
|
+ if(appDelegate.customerInfo==nil)
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [self neworder];
|
|
|
+ }
|
|
|
+ // [main_vc checklogin:true];
|
|
|
+ };
|
|
|
+ cvc.onReset = ^(){
|
|
|
+ // [main_vc checklogin:true];
|
|
|
+ };
|
|
|
|
|
|
- self.norefresh = true;
|
|
|
+ [self.navigationController pushViewController:cvc animated:true];
|
|
|
+ } else if (appDelegate.user_type == USER_ROLE_CUSTOMER){
|
|
|
[self neworder];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // [main_vc checklogin:true];
|
|
|
- // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
-
|
|
|
- //
|
|
|
- // if(self.returnValue)
|
|
|
- // self.returnValue(value);
|
|
|
- };
|
|
|
-
|
|
|
- cvc.onCancel = ^(){
|
|
|
- self.norefresh = true;
|
|
|
- if(appDelegate.customerInfo==nil)
|
|
|
- {
|
|
|
- [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"" controller:self];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [self neworder];
|
|
|
- }
|
|
|
- // [main_vc checklogin:true];
|
|
|
- };
|
|
|
- cvc.onReset = ^(){
|
|
|
- // [main_vc checklogin:true];
|
|
|
- };
|
|
|
-
|
|
|
- [self.navigationController pushViewController:cvc animated:true];
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
else
|