File tree Expand file tree Collapse file tree 13 files changed +119
-15
lines changed
Creditmemo/AbstractCreditmemo
Shipment/AbstractShipment
Test/Unit/Controller/Adminhtml/Order/Creditmemo
dev/tests/integration/testsuite/Magento/Framework/App/Filesystem
lib/internal/Magento/Framework/App/Response/Http Expand file tree Collapse file tree 13 files changed +119
-15
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,12 @@ public function __construct(
74
74
*/
75
75
public function massAction (AbstractCollection $ collection )
76
76
{
77
+ $ pdf = $ this ->pdfCreditmemo ->getPdf ($ collection );
78
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
79
+
77
80
return $ this ->fileFactory ->create (
78
81
sprintf ('creditmemo%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
79
- $ this -> pdfCreditmemo -> getPdf ( $ collection )-> render () ,
82
+ $ fileContent ,
80
83
DirectoryList::VAR_DIR ,
81
84
'application/pdf '
82
85
);
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ public function __construct(
53
53
54
54
/**
55
55
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Forward
56
+ * @throws \Exception
56
57
*/
57
58
public function execute ()
58
59
{
@@ -69,9 +70,11 @@ public function execute()
69
70
$ date = $ this ->_objectManager ->get (
70
71
\Magento \Framework \Stdlib \DateTime \DateTime::class
71
72
)->date ('Y-m-d_H-i-s ' );
73
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
74
+
72
75
return $ this ->_fileFactory ->create (
73
76
\creditmemo::class . $ date . '.pdf ' ,
74
- $ pdf -> render () ,
77
+ $ fileContent ,
75
78
DirectoryList::VAR_DIR ,
76
79
'application/pdf '
77
80
);
Original file line number Diff line number Diff line change @@ -75,9 +75,12 @@ public function __construct(
75
75
*/
76
76
public function massAction (AbstractCollection $ collection )
77
77
{
78
+ $ pdf = $ this ->pdfInvoice ->getPdf ($ collection );
79
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
80
+
78
81
return $ this ->fileFactory ->create (
79
82
sprintf ('invoice%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
80
- $ this -> pdfInvoice -> getPdf ( $ collection )-> render () ,
83
+ $ fileContent ,
81
84
DirectoryList::VAR_DIR ,
82
85
'application/pdf '
83
86
);
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ public function __construct(
45
45
46
46
/**
47
47
* @return ResponseInterface|void
48
+ * @throws \Exception
48
49
*/
49
50
public function execute ()
50
51
{
@@ -58,9 +59,11 @@ public function execute()
58
59
$ date = $ this ->_objectManager ->get (
59
60
\Magento \Framework \Stdlib \DateTime \DateTime::class
60
61
)->date ('Y-m-d_H-i-s ' );
62
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
63
+
61
64
return $ this ->_fileFactory ->create (
62
65
'invoice ' . $ date . '.pdf ' ,
63
- $ pdf -> render () ,
66
+ $ fileContent ,
64
67
DirectoryList::VAR_DIR ,
65
68
'application/pdf '
66
69
);
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ public function __construct(
76
76
*
77
77
* @param AbstractCollection $collection
78
78
* @return ResponseInterface|ResultInterface
79
+ * @throws \Exception
79
80
*/
80
81
protected function massAction (AbstractCollection $ collection )
81
82
{
@@ -85,9 +86,12 @@ protected function massAction(AbstractCollection $collection)
85
86
$ this ->messageManager ->addError (__ ('There are no printable documents related to selected orders. ' ));
86
87
return $ this ->resultRedirectFactory ->create ()->setPath ($ this ->getComponentRefererUrl ());
87
88
}
89
+ $ pdf = $ this ->pdfCreditmemo ->getPdf ($ creditmemoCollection ->getItems ());
90
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
91
+
88
92
return $ this ->fileFactory ->create (
89
93
sprintf ('creditmemo%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
90
- $ this -> pdfCreditmemo -> getPdf ( $ creditmemoCollection -> getItems ())-> render () ,
94
+ $ fileContent ,
91
95
DirectoryList::VAR_DIR ,
92
96
'application/pdf '
93
97
);
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ public function __construct(
113
113
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Redirect
114
114
*
115
115
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
116
+ * @throws \Exception
116
117
*/
117
118
protected function massAction (AbstractCollection $ collection )
118
119
{
@@ -142,10 +143,11 @@ protected function massAction(AbstractCollection $collection)
142
143
foreach ($ documents as $ document ) {
143
144
$ pdf ->pages = array_merge ($ pdf ->pages , $ document ->pages );
144
145
}
146
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
145
147
146
148
return $ this ->fileFactory ->create (
147
149
sprintf ('docs%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
148
- $ pdf -> render () ,
150
+ $ fileContent ,
149
151
DirectoryList::VAR_DIR ,
150
152
'application/pdf '
151
153
);
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ public function __construct(
75
75
*
76
76
* @param AbstractCollection $collection
77
77
* @return ResponseInterface|ResultInterface
78
+ * @throws \Exception
78
79
*/
79
80
protected function massAction (AbstractCollection $ collection )
80
81
{
@@ -83,9 +84,12 @@ protected function massAction(AbstractCollection $collection)
83
84
$ this ->messageManager ->addError (__ ('There are no printable documents related to selected orders. ' ));
84
85
return $ this ->resultRedirectFactory ->create ()->setPath ($ this ->getComponentRefererUrl ());
85
86
}
87
+ $ pdf = $ this ->pdfInvoice ->getPdf ($ invoicesCollection ->getItems ());
88
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
89
+
86
90
return $ this ->fileFactory ->create (
87
91
sprintf ('invoice%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
88
- $ this -> pdfInvoice -> getPdf ( $ invoicesCollection -> getItems ())-> render () ,
92
+ $ fileContent ,
89
93
DirectoryList::VAR_DIR ,
90
94
'application/pdf '
91
95
);
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ public function __construct(
77
77
*
78
78
* @param AbstractCollection $collection
79
79
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Redirect
80
+ * @throws \Exception
80
81
*/
81
82
protected function massAction (AbstractCollection $ collection )
82
83
{
@@ -87,9 +88,13 @@ protected function massAction(AbstractCollection $collection)
87
88
$ this ->messageManager ->addError (__ ('There are no printable documents related to selected orders. ' ));
88
89
return $ this ->resultRedirectFactory ->create ()->setPath ($ this ->getComponentRefererUrl ());
89
90
}
91
+
92
+ $ pdf = $ this ->pdfShipment ->getPdf ($ shipmentsCollection ->getItems ());
93
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
94
+
90
95
return $ this ->fileFactory ->create (
91
96
sprintf ('packingslip%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
92
- $ this -> pdfShipment -> getPdf ( $ shipmentsCollection -> getItems ())-> render () ,
97
+ $ fileContent ,
93
98
DirectoryList::VAR_DIR ,
94
99
'application/pdf '
95
100
);
Original file line number Diff line number Diff line change @@ -70,9 +70,12 @@ public function __construct(
70
70
*/
71
71
public function massAction (AbstractCollection $ collection )
72
72
{
73
+ $ pdf = $ this ->pdfShipment ->getPdf ($ collection );
74
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
75
+
73
76
return $ this ->fileFactory ->create (
74
77
sprintf ('packingslip%s.pdf ' , $ this ->dateTime ->date ('Y-m-d_H-i-s ' )),
75
- $ this -> pdfShipment -> getPdf ( $ collection )-> render () ,
78
+ $ fileContent ,
76
79
DirectoryList::VAR_DIR ,
77
80
'application/pdf '
78
81
);
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public function __construct(
48
48
49
49
/**
50
50
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Forward
51
+ * @throws \Exception
51
52
*/
52
53
public function execute ()
53
54
{
@@ -63,9 +64,11 @@ public function execute()
63
64
$ date = $ this ->_objectManager ->get (
64
65
\Magento \Framework \Stdlib \DateTime \DateTime::class
65
66
)->date ('Y-m-d_H-i-s ' );
67
+ $ fileContent = ['type ' => 'string ' , 'value ' => $ pdf ->render (), 'rm ' => true ];
68
+
66
69
return $ this ->_fileFactory ->create (
67
70
'packingslip ' . $ date . '.pdf ' ,
68
- $ pdf -> render () ,
71
+ $ fileContent ,
69
72
DirectoryList::VAR_DIR ,
70
73
'application/pdf '
71
74
);
You can’t perform that action at this time.
0 commit comments