Răsfoiți Sursa

1.修改Model Detail Assembling按钮显隐控制。
2.修改Portfolio文件名校验以及文件保存。

Pen Li 8 ani în urmă
părinte
comite
c37f0729b6

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


+ 1 - 1
RedAnt ERP Mobile/common/Functions/PDF+Web/PDFViewController.h

@@ -41,5 +41,5 @@
 @property bool defaultStyle;
 
 
-@property (strong,nonatomic) NSString* attachment_name; //email 按钮附件名称
+@property (strong,nonatomic) NSString* attachment_name; //email 按钮附件名称(已废弃)
 @end

+ 28 - 17
RedAnt ERP Mobile/common/Functions/PDF+Web/PDFViewController.m

@@ -11,6 +11,7 @@
 #import "const.h"
 #import "AppDelegate.h"
 #import "PDFUtils.h"
+#import "TextUtils.h"
 
 
 @interface PDFViewController ()
@@ -28,6 +29,10 @@
     return self;
 }
 
+- (void)setFilename:(NSString *)filename {
+    _filename = [TextUtils legalFilename:filename];
+}
+
 - (void)viewDidLoad
 {
     
@@ -275,8 +280,12 @@
                 if (self.cachePath.length) {
                     filePath = self.cachePath;
                 }
+                
                 [self.content writeToFile:filePath atomically:YES];
                 
+                self.url = filePath;
+                self.isLocalfile = true;
+
                 
                 self.btnshare.enabled =true;
                 
@@ -482,24 +491,24 @@
    
     //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     
-    NSString *filePath = nil;
-    if(!self.isLocalfile)
-    {
-    NSString *path = NSTemporaryDirectory();
-    NSString* filename =self.filename;
-    
-   filePath= [path stringByAppendingPathComponent:filename];
-    
-    }
-    else
-        filePath = self.url;
+//    NSString *filePath = nil;
+//    if(!self.isLocalfile)
+//    {
+//    NSString *path = NSTemporaryDirectory();
+//    NSString* filename =self.filename;
+//    
+//   filePath= [path stringByAppendingPathComponent:filename];
+//    
+//    }
+//    else
+//        filePath = self.url;
 
     
     
   
     
 
-    [self openFile:filePath];
+    [self openFile:self.url];
 }
 - (IBAction)onSaveClick:(id)sender {
     
@@ -551,11 +560,13 @@
 
 - (IBAction)onEmailClick:(id)sender {
     //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    NSString *path = NSTemporaryDirectory();
+//    NSString *path = NSTemporaryDirectory();
     NSString* filename =self.filename;
     
-    NSString *filePath = [path stringByAppendingPathComponent:filename];
-    
+//    NSString *filePath = [path stringByAppendingPathComponent:filename];
+
+    NSString *filePath = self.url;
+
     
     
     
@@ -586,8 +597,8 @@
     
     NSData *data = [NSData dataWithContentsOfFile:filePath];
     
-    if(self.attachment_name.length>0)
-        filename = self.attachment_name;
+//    if(self.attachment_name.length>0)
+//        filename = self.attachment_name;
     [mc addAttachmentData:data mimeType:@"application/pdf" fileName:filename];
     [self presentModalViewController:mc animated:YES];
     

+ 2 - 2
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -2867,7 +2867,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     ViewController.isLocalfile=NO;
     NSString* subject;
     
-    NSString* cur_time =[RAUtils current_date];
+
     subject =@"Cart Print";
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
@@ -2881,7 +2881,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     }
     ViewController.mail_to = send_to;
     
-    ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+    ViewController.filename = [NSString stringWithFormat:@"NPD_Product_List.pdf"];
     ViewController.mail_subject = subject;
     
     ViewController.hidenavi = false;

+ 5 - 0
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -1550,6 +1550,11 @@ self.isrefreshing=false;
         };
         
         NSString *introduce = [section_json objectForKey:@"assembly_pdf_path"];
+        if (introduce == nil || introduce.length == 0) {
+            cell.introduceBtn.hidden = YES;
+        } else {
+            cell.introduceBtn.hidden = NO;
+        }
         cell.introduceBlock = ^(UIButton *sender) {
             
             [weakself showIntroducePDF:introduce];

+ 4 - 4
RedAnt ERP Mobile/common/Functions/portfolio/PDFListViewController.m

@@ -505,8 +505,8 @@
     if(url==nil)
     {
         
-        NSMutableDictionary* params = [RAUtils string2dict:[self.content_data[indexPath.row] valueForKey:@"off_params"]];
-        NSMutableDictionary* values = [RAUtils string2dict:[self.content_data[indexPath.row] valueForKey:@"model_info"]];
+        NSMutableDictionary* params = [[RAUtils string2dict:[self.content_data[indexPath.row] valueForKey:@"off_params"]] mutableCopy];
+        NSMutableDictionary* values = [[RAUtils string2dict:[self.content_data[indexPath.row] valueForKey:@"model_info"]] mutableCopy];
         params[@"replaceValue"]=values;
         params[@"tearsheetsId"]=[self.content_data[indexPath.row] valueForKey:@"tearsheetsId"];
         NSString* createpdf = [iSalesNetwork create_portfolio:params];
@@ -525,7 +525,7 @@
     NSString* subject;
     //                    if (company.length==0) {
     
-    NSString* cur_time =[RAUtils current_date];
+//    NSString* cur_time =[RAUtils current_date];
     subject =name;//[NSString stringWithFormat:@"NPD Product List %@",cur_time];
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
@@ -547,7 +547,7 @@
     //                        subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
     //                    }
     NSString* lfilename = [TextUtils legalFilename:name];
-    ViewController.attachment_name = [NSString stringWithFormat:@"%@.pdf",lfilename];
+//    ViewController.attachment_name = [NSString stringWithFormat:@"%@.pdf",lfilename];
     ViewController.filename = [NSString stringWithFormat:@"%@.pdf",lfilename];
     ViewController.mail_subject = subject;
 

+ 3 - 1
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -23,6 +23,7 @@
 #import "DefaultAppearance.h"
 #import "SortItemViewController.h"
 #import "SortButton.h"
+#import "TextUtils.h"
 
 #define ALERT_DEL 1025
 #define checked_Count @"checkedCount"
@@ -432,7 +433,8 @@
         //                    {
         //                        subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
         //                    }
-        ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+//        ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+        ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:name]];
         ViewController.mail_subject = subject;
         
         ViewController.hidenavi = false;

+ 3 - 2
RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m

@@ -11,6 +11,7 @@
 #import "PDFViewController.h"
 #import "MainViewController.h"
 #import "Singleton.h"
+#import "TextUtils.h"
 
 @interface TearSheetParamViewController ()
 
@@ -299,7 +300,7 @@
                 ViewController.canSave = true;
                 ViewController.isLocalfile=isLocalFile;
                 //                    ViewController.mail_content = [self.content_data valueForKey:@"email_content"];
-                
+                ViewController.filename = [NSString stringWithFormat:@"%@.pdf",[TextUtils legalFilename:catelog_name]];
                 ViewController.save_name =catelog_name;
                 ViewController.save_note =internal_note;
                 //ViewController.filename = catelog_name;
@@ -343,7 +344,7 @@
                 //                    {
                 //                        subject = [NSString stringWithFormat:@"Tear sheet for %@",company ];
                 //                    }
-                ViewController.attachment_name = [NSString stringWithFormat:@"%@.pdf",catelog_name];//[NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
+//                ViewController.attachment_name = [NSString stringWithFormat:@"%@.pdf",catelog_name];//[NSString stringWithFormat:@"NPD_Product_List %@.pdf",cur_time];
                 ViewController.mail_subject = subject;
                 
                 //                    ViewController.onLoadSuccess =^(NSString* url)

+ 3 - 2
RedAnt ERP Mobile/common/Functions/watchlist/WatchListViewController.m

@@ -1305,7 +1305,7 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     ViewController.isLocalfile=NO;
     NSString* subject;
     
-    NSString* cur_time =[RAUtils current_date];
+
     subject =@"Wishlist Print";
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* customer_email=    [appDelegate.customerInfo valueForKey:@"customer_email"];
@@ -1319,7 +1319,8 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     }
     ViewController.mail_to = send_to;
     
-    ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Wish_List %@.pdf",cur_time];
+    //    ViewController.attachment_name = [NSString stringWithFormat:@"NPD_Wish_List %@.pdf",cur_time];
+    ViewController.filename = [NSString stringWithFormat:@"NPD_Wish_List.pdf"];
     ViewController.mail_subject = subject;
     
     ViewController.hidenavi = false;

+ 5 - 0
RedAnt ERP Mobile/common/TextUtils.m

@@ -194,6 +194,11 @@
 {
     NSString* ret = str;
     //....... todo
+    // < > / \ | : " * ?
+    NSCharacterSet *charSet = [NSCharacterSet characterSetWithCharactersInString:@"<>/\\|:\"*?"];
+    NSArray *arr = [str componentsSeparatedByCharactersInSet:charSet];
+    ret = [arr componentsJoinedByString:@""];
+    
     return ret;
 }
 @end

+ 10 - 10
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -1059,7 +1059,7 @@
                                                 <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="t2l-bU-0kL">
                                                     <rect key="frame" x="35" y="510" width="100" height="30"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                                    <state key="normal" title="Description"/>
+                                                    <state key="normal" title="Features"/>
                                                     <connections>
                                                         <action selector="descriptionBtnClick:" destination="PCZ-Ci-oQf" eventType="touchUpInside" id="5jn-ta-qdm"/>
                                                     </connections>
@@ -2200,7 +2200,7 @@
                                         <rect key="frame" x="0.0" y="88" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Pol-lE-P45" id="FAm-1c-nX0">
-                                            <rect key="frame" x="0.0" y="0.0" width="702" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="730" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Clean Cache" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AHm-p1-51h">
@@ -5816,7 +5816,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="22" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6hT-I3-WW3" id="gKI-En-sgV">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <view contentMode="scaleToFill" id="Eyx-Zr-PLO" customClass="RTLabel">
@@ -5834,7 +5834,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="66" width="768" height="190"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lSe-2G-cT7" id="KDS-aU-tYT">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="190"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="189.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12345678.00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="yQq-ma-HdT" userLabel="unit price">
@@ -5958,7 +5958,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="256" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9rG-Hv-ICg" id="e5s-wc-IkL">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$123456789.00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fNL-sW-tkk" userLabel="price">
@@ -5986,7 +5986,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="300" width="768" height="186"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9hm-qp-u5H" id="PQ9-FQ-6Si">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="186"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="185.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <webView userInteractionEnabled="NO" contentMode="scaleToFill" allowsInlineMediaPlayback="NO" mediaPlaybackRequiresUserAction="NO" mediaPlaybackAllowsAirPlay="NO" keyboardDisplayRequiresUserAction="NO" id="9m6-iq-KMk">
@@ -6005,7 +6005,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="486" width="768" height="148"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="s5l-6k-iWO" id="8ms-PN-eNw">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="148"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="147.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="wjN-UC-W3J">
@@ -6029,7 +6029,7 @@ Email: redantsupport@united-us.net</string>
                                         <rect key="frame" x="0.0" y="634" width="768" height="218"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PTO-3k-BWh" id="51c-J3-9uN">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="218"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="217.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Tracking Number:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cdf-E6-8nk">
@@ -7050,7 +7050,7 @@ Email: redantsupport@united-us.net</string>
                                 <rect key="frame" x="0.0" y="22" width="768" height="44"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ebw-26-5Ud" id="gop-RV-8fg">
-                                    <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                 </tableViewCellContentView>
                             </tableViewCell>
@@ -8032,7 +8032,7 @@ Email: redantsupport@united-us.net</string>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HwF-54-hzr">
-                                                    <rect key="frame" x="28" y="0.0" width="672" height="43.5"/>
+                                                    <rect key="frame" x="15" y="0.0" width="698" height="43.5"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="16"/>
                                                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>