|
|
@@ -36,6 +36,7 @@
|
|
|
#define NUMBERS @"0123456789.\n"
|
|
|
#import "OLDataProvider.h"
|
|
|
#import <objc/objc.h>
|
|
|
+#import "MainViewController.h"
|
|
|
|
|
|
|
|
|
@interface subitem_data ()
|
|
|
@@ -59,6 +60,7 @@
|
|
|
|
|
|
[appDelegate.urgencyDic removeObjectForKey:[NSString stringWithFormat:@"level_%d",self.level]];
|
|
|
[appDelegate.urgencyDic setValue:[NSNumber numberWithInteger:self.level] forKey:@"count"];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (NSString *)class_name {
|
|
|
@@ -202,7 +204,9 @@
|
|
|
|
|
|
|
|
|
[urgencyDic setValue:appDelegate.order_code forKey:@"order_code"];
|
|
|
-
|
|
|
+ MainViewController *mainVC = (MainViewController *)appDelegate.main_vc;
|
|
|
+ NSString *so = [mainVC.labelSo.text substringFromIndex:5];
|
|
|
+ [urgencyDic setValue:so forKey:@"order_so"];
|
|
|
[urgencyDic setValue:[NSNumber numberWithInt:appDelegate.order_status ] forKey:@"order_status"];
|
|
|
|
|
|
[urgencyDic setValue:appDelegate.order_customer_id forKey:@"order_customer_id"];
|
|
|
@@ -259,14 +263,14 @@
|
|
|
// // closeButton.title = @"Close";
|
|
|
//
|
|
|
// self.navigationItem.leftBarButtonItem = closeButton;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
if(self.url_type==URL_REMOTE)
|
|
|
{
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:self.loading_msg title:self.loading_title];
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
- NSDictionary* editor_json = [iSalesNetwork request_Editor:self.request_url params:self.params];
|
|
|
+ NSDictionary* editor_json = [iSalesNetwork request_Editor:weakself.request_url params:weakself.params];
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
@@ -276,26 +280,26 @@
|
|
|
if([[editor_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
|
|
|
- self.content_data_download = [editor_json mutableCopy];
|
|
|
+ weakself.content_data_download = [editor_json mutableCopy];
|
|
|
|
|
|
- self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
|
|
|
+ weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
|
|
|
// self.content_data = [editor_json mutableCopy];
|
|
|
// self.content_data = [self translate_json:editor_json];
|
|
|
|
|
|
// NSMutableDictionary* content_data1 = [self translate_json:self.content_data];
|
|
|
|
|
|
- [self download_success];
|
|
|
+ [weakself download_success];
|
|
|
|
|
|
- [self.editorTable reloadData];
|
|
|
+ [weakself.editorTable reloadData];
|
|
|
|
|
|
// NSString * ttt=[self.content_data valueForKey:@"title"] ;
|
|
|
|
|
|
- self.navigationItem.title = [self.content_data_download valueForKey:@"title"] ;
|
|
|
+ weakself.navigationItem.title = [weakself.content_data_download valueForKey:@"title"] ;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
|
|
|
+ [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:weakself] ;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -962,20 +966,21 @@
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:self.loading_msg title:self.loading_title];
|
|
|
|
|
|
self.params[@"refresh_trigger"]=trigger;
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
|
|
|
|
|
|
- NSDictionary* refresh_params=[self get_refresh_param];
|
|
|
+ NSDictionary* refresh_params=[weakself get_refresh_param];
|
|
|
|
|
|
NSArray* changed_key=[refresh_params allKeys];
|
|
|
for(int i=0;i<changed_key.count;i++)
|
|
|
{
|
|
|
NSString* obj_str=[NSString stringWithFormat:@"%@",[refresh_params valueForKey:(NSString*)changed_key[i]]];
|
|
|
- [self.params setObject:obj_str forKey:(NSString*)changed_key[i]];
|
|
|
+ [weakself.params setObject:obj_str forKey:(NSString*)changed_key[i]];
|
|
|
}
|
|
|
|
|
|
- NSDictionary* editor_json = [iSalesNetwork request_Editor:self.request_url params:self.params];
|
|
|
+ NSDictionary* editor_json = [iSalesNetwork request_Editor:weakself.request_url params:weakself.params];
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
@@ -984,18 +989,18 @@
|
|
|
if([[editor_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
|
|
|
- self.content_data_download = [self CopyDirty:self.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
+ weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
|
|
|
- self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
|
|
|
+ weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
|
|
|
|
|
|
- [self download_success];
|
|
|
- [self.editorTable reloadData];
|
|
|
+ [weakself download_success];
|
|
|
+ [weakself.editorTable reloadData];
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
|
|
|
+ [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:weakself] ;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2110,6 +2115,7 @@
|
|
|
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:self.loading_msg title:self.loading_title];
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
NSDictionary* editor_json = [iSalesNetwork commoneditor_partialrefresh:params url:url];
|
|
|
@@ -2129,14 +2135,14 @@
|
|
|
NSString* name = [pr_item valueForKey:@"name"];
|
|
|
NSString* value = [pr_item valueForKey:@"value"];
|
|
|
|
|
|
- [self setValue:name value:value];
|
|
|
+ [weakself setValue:name value:value];
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
|
|
|
+ [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:weakself] ;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2229,6 +2235,7 @@
|
|
|
|
|
|
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:self.loading_msg title:self.loading_title];
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
NSDictionary* editor_json = [iSalesNetwork commoneditor_partialrefresh:params url:url];
|
|
|
@@ -2248,13 +2255,13 @@
|
|
|
NSString* name = [pr_item valueForKey:@"name"];
|
|
|
NSString* value = [pr_item valueForKey:@"value"];
|
|
|
|
|
|
- [self setValue:name value:value];
|
|
|
+ [weakself setValue:name value:value];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:self] ;
|
|
|
+ [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:nil controller:weakself] ;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2784,10 +2791,10 @@
|
|
|
cvc.subaction_tag =[NSString stringWithFormat:@"%ld",(long)sender.tag];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -2808,10 +2815,10 @@
|
|
|
cvc.contact_type = value;
|
|
|
cvc.is_subaction = @"true";
|
|
|
cvc.subaction_tag =[NSString stringWithFormat:@"%ld",(long)sender.tag];
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -2832,10 +2839,10 @@
|
|
|
cvc.subaction_tag =[NSString stringWithFormat:@"%ld",(long)sender.tag];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -2856,10 +2863,10 @@
|
|
|
cvc.subaction_tag =[NSString stringWithFormat:@"%ld",(long)sender.tag];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -3314,12 +3321,12 @@
|
|
|
cell.editable=true;
|
|
|
cell.labelTitle.text = title;
|
|
|
cell.labelDescription.text = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cell.imgChanged = ^(NSString* url_down,NSString* url_up,int index ,NSString* url_index)
|
|
|
{
|
|
|
// NSMutableDictionary* editjson = [item_json mutableCopy];
|
|
|
// editjson[@"img_url"]=url;
|
|
|
- [self imgIsChanged:url_down url_up:url_up indexPath:indexPath index:index url_index:url_index];
|
|
|
+ [weakself imgIsChanged:url_down url_up:url_up indexPath:indexPath index:index url_index:url_index];
|
|
|
|
|
|
|
|
|
};
|
|
|
@@ -3346,7 +3353,7 @@
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url0]];
|
|
|
@@ -4610,9 +4617,10 @@
|
|
|
ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4631,10 +4639,10 @@
|
|
|
ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4654,9 +4662,10 @@
|
|
|
|
|
|
cvc.contact_type = value;
|
|
|
cvc.showNavibar = true;
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4675,10 +4684,10 @@
|
|
|
ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4697,10 +4706,10 @@
|
|
|
ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4719,10 +4728,10 @@
|
|
|
ContactListViewController* cvc = [self.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
|
|
|
cvc.showNavibar = true;
|
|
|
cvc.contact_type = value;
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
|
|
|
|
|
|
- [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
+ [weakself handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
|
|
|
|
|
|
//
|
|
|
// if(self.returnValue)
|
|
|
@@ -4837,7 +4846,7 @@
|
|
|
|
|
|
__block UIImage* signimg=nil;
|
|
|
SignatureViewController * vc =[ self.storyboard instantiateViewControllerWithIdentifier:@"SignatureViewController"];
|
|
|
-
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
vc.onReturnImg = ^(UIImage* img)
|
|
|
{
|
|
|
signimg = img;
|
|
|
@@ -4875,19 +4884,19 @@
|
|
|
// if(img_url_up.length==0)
|
|
|
// img_url_up=@"";
|
|
|
|
|
|
- NSMutableDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
|
|
|
+ NSMutableDictionary* item_json =((NSMutableArray*)weakself.content_data_control[indexPath.section])[indexPath.row];
|
|
|
|
|
|
[item_json setValue:img_url_down forKey:@"avalue"];
|
|
|
[item_json setValue:img_url_up forKey:@"value"];
|
|
|
[item_json setValue:@"true" forKey:@"dirty"];
|
|
|
- NSMutableDictionary* section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
+ NSMutableDictionary* section_json = [[weakself.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
[section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",indexPath.row]];
|
|
|
|
|
|
- [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
- self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
|
|
|
+ [weakself.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
+ weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed:weakself.changed_data];
|
|
|
|
|
|
|
|
|
- CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
+ CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [weakself.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
|
|
|
cell.imageviewSignature.image = signimg;
|
|
|
|
|
|
@@ -4895,7 +4904,7 @@
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
|
|
|
+ [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:weakself] ;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -4946,7 +4955,7 @@
|
|
|
|
|
|
DebugLog(@"data string: %@",str);
|
|
|
|
|
|
- [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:self] ;
|
|
|
+ [RAUtils message_alert:@"Can not connect to server please try again." title:@"Upload Image" controller:weakself] ;
|
|
|
|
|
|
} else {
|
|
|
DebugLog(@"response ");
|
|
|
@@ -4975,19 +4984,19 @@
|
|
|
// if(img_url_up.length==0)
|
|
|
// img_url_up=@"";
|
|
|
|
|
|
- NSMutableDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
|
|
|
+ NSMutableDictionary* item_json =((NSMutableArray*)weakself.content_data_control[indexPath.section])[indexPath.row];
|
|
|
|
|
|
[item_json setValue:img_url_down forKey:@"avalue"];
|
|
|
[item_json setValue:img_url_up forKey:@"value"];
|
|
|
[item_json setValue:@"true" forKey:@"dirty"];
|
|
|
- NSMutableDictionary* section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
+ NSMutableDictionary* section_json = [[weakself.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
|
|
|
[section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",indexPath.row]];
|
|
|
|
|
|
- [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
- self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
|
|
|
+ [weakself.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
+ weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed:weakself.changed_data];
|
|
|
|
|
|
|
|
|
- CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
+ CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [weakself.editorTable cellForRowAtIndexPath:indexPath];
|
|
|
|
|
|
cell.imageviewSignature.image = signimg;
|
|
|
|
|
|
@@ -4995,7 +5004,7 @@
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
|
|
|
+ [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:weakself] ;
|
|
|
}
|
|
|
|
|
|
|