|
|
@@ -9973,11 +9973,11 @@
|
|
|
NSString *orderBy = @"";
|
|
|
switch (sort) {
|
|
|
case 0:{
|
|
|
- orderBy = @"modifytime desc";
|
|
|
+ orderBy = @"modify_time desc";
|
|
|
}
|
|
|
break;
|
|
|
case 1:{
|
|
|
- orderBy = @"modifytime asc";
|
|
|
+ orderBy = @"modify_time asc";
|
|
|
}
|
|
|
break;
|
|
|
case 2:{
|
|
|
@@ -9998,7 +9998,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"select p.product_id,p.name,p.description,ifnull(p.sheet_price,'null'),p.sheet_discount,ifnull(p.available_qty,'null'),p.percentage,p.item_id,p.fashion_id,i.url,p.line_note,p.percent from offline_portfolio as p left join model_image as i on i.product_id = p.product_id where i.type = 1 group by p.product_id order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"select p.product_id,p.name,p.description,ifnull(p.sheet_price,'null'),p.sheet_discount,ifnull(p.available_qty,'null'),p.percentage,p.item_id,p.fashion_id,i.url,p.line_note,p.percent from offline_portfolio as p left join model_image as i on i.product_id = p.product_id where i.type = 1 and (p.is_delete is null or p.is_delete = 0) group by p.product_id order by %@ limit %d offset %d;",orderBy,limit,offset];
|
|
|
|
|
|
__block NSMutableDictionary *dic = [NSMutableDictionary dictionary];
|
|
|
|
|
|
@@ -10212,7 +10212,7 @@
|
|
|
[resultDictionary setObject:[NSNumber numberWithInt:RESULT_FALSE] forKey:@"result"];
|
|
|
return [RAUtils dict2data:resultDictionary];
|
|
|
}
|
|
|
- pdf_path = newPath;
|
|
|
+ pdf_path = [newPath lastPathComponent];
|
|
|
|
|
|
// 保存信息
|
|
|
|
|
|
@@ -10239,11 +10239,11 @@
|
|
|
int limit = [[params valueForKey:@"limit"] integerValue];
|
|
|
NSString *keyword = [params valueForKey:@"keyWord"];
|
|
|
|
|
|
- NSString *where = @"";
|
|
|
+ NSString *where = @"where is_delete is null or is_delete = 0";
|
|
|
|
|
|
if (keyword.length) {
|
|
|
keyword = [self translateSingleQuote:keyword];
|
|
|
- where = [NSString stringWithFormat:@"where lower(create_user) like '%%%@%%' or lower(tear_note) like '%%%@%%' or lower(tear_name) like '%%%@%%'",keyword.lowercaseString,keyword.lowercaseString,keyword.lowercaseString];
|
|
|
+ where = [NSString stringWithFormat:@"where (is_delete is null or is_delete = 0 ) and lower(create_user) like '%%%@%%' or lower(tear_note) like '%%%@%%' or lower(tear_name) like '%%%@%%'",keyword.lowercaseString,keyword.lowercaseString,keyword.lowercaseString];
|
|
|
}
|
|
|
|
|
|
NSString *sql = [NSString stringWithFormat:@"select tear_name,tear_note,createtime,create_user,pdf_path,tearsheets_id from offline_pdf %@ order by createtime desc limit %d offset %d;",where,limit,offset];
|
|
|
@@ -10293,7 +10293,7 @@
|
|
|
|
|
|
NSString *prodct_ids = [params objectForKey:@"product_id"];
|
|
|
// NSString *user = [params objectForKey:@"user"];
|
|
|
- NSString *sql = [NSString stringWithFormat:@"insert into offline_portfolio (product_id,name,description,item_id,img) select * from (select p.product_id,p.name,p.description,p.item_id,i.url from product as p left join model_image as i on i.product_id = p.product_id where p.product_id in (%@) and p.product_id not in (select product_id from offline_portfolio) and i.type = 1 group by p.product_id order by i.default_img desc, i._id asc );",prodct_ids];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"insert into offline_portfolio (product_id,name,description,item_id,img) select * from (select p.product_id,p.name,p.description,p.item_id,i.url from product as p left join model_image as i on i.product_id = p.product_id where p.product_id in (%@) and p.product_id not in (select product_id from offline_portfolio) and i.type = 1 group by p.product_id order by i.default_img desc, i._id asc );insert into offline_portfolio (product_id,name,description,item_id,img,is_delete) select * from (select p.product_id,p.name,p.description,p.item_id,i.url,0 from product as p left join model_image as i on i.product_id = p.product_id where p.product_id in (%@) and p.product_id in (select product_id from offline_portfolio where is_delete = 1) and i.type = 1 and (select count(0) from offline_portfolio where product_id = p.product_id) = 1 group by p.product_id order by i.default_img desc, i._id asc );delete from offline_portfolio where (select count(0) from offline_portfolio where product_id in (%@)) > 1 and is_delete = 1;",prodct_ids,prodct_ids,prodct_ids];
|
|
|
|
|
|
int result = [iSalesDB execSql:sql];
|
|
|
|
|
|
@@ -10445,14 +10445,14 @@
|
|
|
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"delete from offline_portfolio where item_id in (%@);",portfolio_ids];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"update offline_portfolio set is_delete = 1 where item_id in (%@);",portfolio_ids];
|
|
|
|
|
|
int result = [iSalesDB execSql:sql db:db];
|
|
|
|
|
|
[dic setObject:[NSNumber numberWithInt:result] forKey:@"result"];
|
|
|
[dic setObject:@"Regular Mode" forKey:@"mode"];
|
|
|
|
|
|
- int count = [iSalesDB get_recordcount:db table:@"offline_portfolio" where:@"1=1"];
|
|
|
+ int count = [iSalesDB get_recordcount:db table:@"offline_portfolio" where:@"(is_delete is null or is_delete = 0)"];
|
|
|
|
|
|
[dic setObject:[NSNumber numberWithInt:count] forKey:@"portfolio_count"];
|
|
|
|
|
|
@@ -10477,7 +10477,7 @@
|
|
|
return [RAUtils dict2data:dic];
|
|
|
}
|
|
|
|
|
|
- NSString *sql = [NSString stringWithFormat:@"delete from offline_pdf where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"update offline_pdf set is_delete = 1 where tearsheets_id = %d and create_user = '%@';",tearsheetsId,[self translateSingleQuote:user]];
|
|
|
|
|
|
|
|
|
int result = [iSalesDB execSql:sql];
|