PluginProbe
Packeta / 2.0.9
Packeta v2.0.9
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
← All changes | src/Packetery/Module/Order/CollectionPrint.php +14 -27 trunk2.0.9 View file →
@@ -13,14 +13,11 @@
13 13 use Packetery\Core\Api\Soap\Request;
14 14 use Packetery\Core\Api\Soap\Response;
15 15 use Packetery\Core\Entity\Order;
16 16 use Packetery\Latte\Engine;
17 -use Packetery\Module\Dashboard\DashboardPage;
18 17 use Packetery\Module\EntityFactory;
19 18 use Packetery\Module\MessageManager;
20 -use Packetery\Module\Options\OptionsProvider;
21 19 use Packetery\Module\Plugin;
22 -use Packetery\Module\Transients;
23 20 use Packetery\Module\Views\UrlBuilder;
24 21 use Packetery\Nette\Http;
25 22
26 23 /**
@@ -28,9 +25,8 @@
28 25 *
29 26 * @package Packetery\Order
30 27 */
31 28 class CollectionPrint {
32 -
33 29 const ACTION_PRINT_ORDER_COLLECTION = 'packetery_print_order_collection';
34 30 const PAGE_SLUG = 'packeta-order-collection-print';
35 31
36 32 /**
@@ -86,13 +82,8 @@
86 82 * @var UrlBuilder
87 83 */
88 84 private $urlBuilder;
89 85
90 - /**
91 - * @var OptionsProvider
92 - */
93 - private $optionsProvider;
94 -
95 86 public function __construct(
96 87 Engine $latteEngine,
97 88 Http\Request $httpRequest,
98 89 Client $soapApiClient,
@@ -99,10 +90,9 @@
99 90 MessageManager $messageManager,
100 91 EntityFactory\Address $addressFactory,
101 92 Repository $orderRepository,
102 93 PacketActionsCommonLogic $packetActionsCommonLogic,
103 - UrlBuilder $urlBuilder,
104 - OptionsProvider $optionsProvider
94 + UrlBuilder $urlBuilder
105 95 ) {
106 96 $this->latteEngine = $latteEngine;
107 97 $this->httpRequest = $httpRequest;
108 98 $this->soapApiClient = $soapApiClient;
@@ -110,9 +100,8 @@
110 100 $this->addressFactory = $addressFactory;
111 101 $this->orderRepository = $orderRepository;
112 102 $this->commonLogic = $packetActionsCommonLogic;
113 103 $this->urlBuilder = $urlBuilder;
114 - $this->optionsProvider = $optionsProvider;
115 104 }
116 105
117 106 /**
118 107 * Generates id of transient to store order ids.
@@ -119,9 +108,9 @@
119 108 *
120 109 * @return string
121 110 */
122 111 public static function getOrderIdsTransientName(): string {
123 - return Transients::ORDER_COLLECTION_PRINT_ORDER_IDS_PREFIX . wp_get_session_token();
112 + return 'packetery_order_collection_print_order_ids_' . wp_get_session_token();
124 113 }
125 114
126 115 /**
127 116 * Prepares form and renders template.
@@ -180,20 +169,19 @@
180 169 $storeAddress = $this->addressFactory->fromWcStoreOptions();
181 170 $this->latteEngine->render(
182 171 PACKETERY_PLUGIN_DIR . '/template/order/collection-print.latte',
183 172 [
184 - 'storeAddress' => $storeAddress,
185 - 'storeName' => get_option( 'blogname', '' ),
186 - 'shipmentBarcodeText' => $shipmentResult->getSimpleBarcodeText(),
187 - 'shipmentBarcode' => $shipmentBarcodeResult->getImageContent(),
188 - 'orders' => $orders,
189 - 'packetIds' => $packetIds,
190 - 'wpOrders' => $wpOrders,
191 - 'orderCount' => count( $packetIds ),
192 - 'printedAt' => ( new \DateTimeImmutable() )->setTimezone( wp_timezone() ),
193 - 'stylesheet' => $this->urlBuilder->buildAssetUrl( 'public/css/order-collection-print.css' ),
194 - 'showConsignPasswordForZBox' => $this->optionsProvider->isShowConsignPasswordForZBoxEnabled(),
195 - 'translations' => [
173 + 'storeAddress' => $storeAddress,
174 + 'storeName' => get_option( 'blogname', '' ),
175 + 'shipmentBarcodeText' => $shipmentResult->getSimpleBarcodeText(),
176 + 'shipmentBarcode' => $shipmentBarcodeResult->getImageContent(),
177 + 'orders' => $orders,
178 + 'packetIds' => $packetIds,
179 + 'wpOrders' => $wpOrders,
180 + 'orderCount' => count( $packetIds ),
181 + 'printedAt' => ( new \DateTimeImmutable() )->setTimezone( wp_timezone() ),
182 + 'stylesheet' => $this->urlBuilder->buildAssetUrl( 'public/css/order-collection-print.css' ),
183 + 'translations' => [
196 184 'handoverPacketsHeading' => __( 'Handover packets', 'packeta' ),
197 185 'packetCount' => __( 'Packet count', 'packeta' ),
198 186 'printedAt' => __( 'Printed at', 'packeta' ),
199 187 'sender' => __( 'Sender', 'packeta' ),
@@ -199,9 +187,8 @@
199 187 'sender' => __( 'Sender', 'packeta' ),
200 188 'recipient' => __( 'Recipient', 'packeta' ),
201 189 'orderNumber' => __( 'Order number', 'packeta' ),
202 190 'barcode' => __( 'Barcode', 'packeta' ),
203 - 'zboxConsignPassword' => __( 'Consignment code', 'packeta' ),
204 191 'created' => __( 'Created', 'packeta' ),
205 192 'nameAndSurname' => __( 'Name and surname', 'packeta' ),
206 193 'cod' => __( 'C.O.D.', 'packeta' ),
207 194 'pickUpPointOrCarrier' => __( 'Pickup point or carrier', 'packeta' ),
@@ -216,9 +203,9 @@
216 203 * Registers submenu item.
217 204 */
218 205 public function register(): void {
219 206 add_submenu_page(
220 - DashboardPage::SLUG,
207 + \Packetery\Module\Options\Page::SLUG,
221 208 __( 'Print AWB', 'packeta' ),
222 209 __( 'Print AWB', 'packeta' ),
223 210 'manage_woocommerce',
224 211 self::PAGE_SLUG,