We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 97 |
| Total Lines | 633 |
| Duplicated Lines | 0 % |
| Changes | 6 | ||
| Bugs | 0 | Features | 0 |
Complex classes like BasketController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BasketController, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 27 | class BasketController extends AbstractController |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * @var BasketRepository |
||
| 31 | */ |
||
| 32 | protected $basketRepository; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param BasketRepository $basketRepository |
||
| 36 | */ |
||
| 37 | public function injectBasketRepository(BasketRepository $basketRepository) |
||
| 38 | { |
||
| 39 | $this->basketRepository = $basketRepository; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var MailRepository |
||
| 44 | */ |
||
| 45 | protected $mailRepository; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param MailRepository $mailRepository |
||
| 49 | */ |
||
| 50 | public function injectMailRepository(MailRepository $mailRepository) |
||
| 51 | { |
||
| 52 | $this->mailRepository = $mailRepository; |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @var PrinterRepository |
||
| 57 | */ |
||
| 58 | protected $printerRepository; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param PrinterRepository $printerRepository |
||
| 62 | */ |
||
| 63 | public function injectPrinterRepository(PrinterRepository $printerRepository) |
||
| 64 | { |
||
| 65 | $this->printerRepository = $printerRepository; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var ActionLogRepository |
||
| 70 | */ |
||
| 71 | protected $actionLogRepository; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @param ActionLogRepository $actionLogRepository |
||
| 75 | */ |
||
| 76 | public function injectActionLogRepository(ActionLogRepository $actionLogRepository) |
||
| 77 | { |
||
| 78 | $this->actionLogRepository = $actionLogRepository; |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Different actions which depends on the choosen action (form) |
||
| 83 | * |
||
| 84 | * @return void |
||
| 85 | */ |
||
| 86 | public function basketAction() |
||
| 87 | { |
||
| 88 | $requestData = GeneralUtility::_GPmerged('tx_dlf'); |
||
| 89 | unset($requestData['__referrer'], $requestData['__trustedProperties']); |
||
| 90 | |||
| 91 | $basketData = $this->getBasketData(); |
||
| 92 | |||
| 93 | // action remove from basket |
||
| 94 | if ($requestData['basket_action'] === 'remove') { |
||
| 95 | // remove entry from list |
||
| 96 | if (isset($requestData['selected'])) { |
||
| 97 | $basketData = $this->removeFromBasket($requestData, $basketData); |
||
| 98 | } |
||
| 99 | } |
||
| 100 | // action remove from basket |
||
| 101 | if ($requestData['basket_action'] == 'download') { |
||
| 102 | // open selected documents |
||
| 103 | if (isset($requestData['selected'])) { |
||
| 104 | $pdfUrl = $this->settings['pdfgenerate']; |
||
| 105 | foreach ($requestData['selected'] as $docValue) { |
||
| 106 | if ($docValue['id']) { |
||
| 107 | $docData = $this->getDocumentData($docValue['id'], $docValue); |
||
| 108 | $pdfUrl .= $docData['urlParams'] . $this->settings['pdfparamseparator']; |
||
| 109 | $this->redirectToUri($pdfUrl); |
||
| 110 | } |
||
| 111 | } |
||
| 112 | } |
||
| 113 | } |
||
| 114 | // action print from basket |
||
| 115 | if ($requestData['print_action']) { |
||
| 116 | // open selected documents |
||
| 117 | if (isset($requestData['selected'])) { |
||
| 118 | $this->printDocument($requestData, $basketData); |
||
| 119 | } |
||
| 120 | } |
||
| 121 | // action send mail |
||
| 122 | if ($requestData['mail_action']) { |
||
| 123 | if (isset($requestData['selected'])) { |
||
| 124 | $this->sendMail($requestData); |
||
| 125 | } |
||
| 126 | } |
||
| 127 | |||
| 128 | $this->redirect('main'); |
||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Add documents to the basket |
||
| 133 | * |
||
| 134 | * @return void |
||
| 135 | */ |
||
| 136 | public function addAction() |
||
| 137 | { |
||
| 138 | $requestData = GeneralUtility::_GPmerged('tx_dlf'); |
||
| 139 | unset($requestData['__referrer'], $requestData['__trustedProperties']); |
||
| 140 | |||
| 141 | $basketData = $this->getBasketData(); |
||
| 142 | |||
| 143 | if ( |
||
| 144 | !empty($requestData['id']) |
||
| 145 | && $requestData['addToBasket'] |
||
| 146 | ) { |
||
| 147 | $returnData = $this->addToBasket($requestData, $basketData); |
||
| 148 | $this->view->assign('pregenerateJs', $returnData['jsOutput']); |
||
| 149 | } |
||
| 150 | |||
| 151 | $this->redirect('main'); |
||
| 152 | } |
||
| 153 | |||
| 154 | /** |
||
| 155 | * The main method of the plugin |
||
| 156 | * |
||
| 157 | * @return void |
||
| 158 | */ |
||
| 159 | public function mainAction() |
||
| 160 | { |
||
| 161 | $requestData = GeneralUtility::_GPmerged('tx_dlf'); |
||
| 162 | unset($requestData['__referrer'], $requestData['__trustedProperties']); |
||
| 163 | |||
| 164 | $basketData = $this->getBasketData(); |
||
| 165 | |||
| 166 | if ($basketData['doc_ids']) { |
||
| 167 | if (is_object($basketData['doc_ids'])) { |
||
| 168 | $basketData['doc_ids'] = get_object_vars($basketData['doc_ids']); |
||
| 169 | } |
||
| 170 | $count = sprintf(LocalizationUtility::translate('basket.count', 'dlf'), count($basketData['doc_ids'])); |
||
|
|
|||
| 171 | } else { |
||
| 172 | $count = sprintf(LocalizationUtility::translate('basket.count', 'dlf'), 0); |
||
| 173 | } |
||
| 174 | $this->view->assign('count', $count); |
||
| 175 | |||
| 176 | $allMails = $this->mailRepository->findAllWithPid($this->settings['pages']); |
||
| 177 | |||
| 178 | $mailSelect = []; |
||
| 179 | if ($allMails->count() > 0) { |
||
| 180 | $mailSelect[0] = htmlspecialchars(LocalizationUtility::translate('basket.chooseMail', 'dlf')); |
||
| 181 | foreach ($allMails as $mail) { |
||
| 182 | $mailSelect[$mail->getUid()] = htmlspecialchars($mail->getName()) . ' (' . htmlspecialchars($mail->getMail()) . ')'; |
||
| 183 | } |
||
| 184 | $this->view->assign('mailSelect', $mailSelect); |
||
| 185 | } |
||
| 186 | |||
| 187 | $allPrinter = $this->printerRepository->findAll(); |
||
| 188 | |||
| 189 | $printSelect = []; |
||
| 190 | if ($allPrinter->count() > 0) { |
||
| 191 | $printSelect[0] = htmlspecialchars(LocalizationUtility::translate('basket.choosePrinter', 'dlf')); |
||
| 192 | foreach ($allPrinter as $printer) { |
||
| 193 | $printSelect[$printer->getUid()] = htmlspecialchars($printer->getLabel()); |
||
| 194 | } |
||
| 195 | $this->view->assign('printSelect', $printSelect); |
||
| 196 | } |
||
| 197 | |||
| 198 | $entries = []; |
||
| 199 | if (isset($basketData['doc_ids'])) { |
||
| 200 | // get each entry |
||
| 201 | foreach ($basketData['doc_ids'] as $value) { |
||
| 202 | $entries[] = $this->getEntry($value); |
||
| 203 | } |
||
| 204 | $this->view->assign('entries', $entries); |
||
| 205 | } |
||
| 206 | } |
||
| 207 | |||
| 208 | /** |
||
| 209 | * The basket data from user session. |
||
| 210 | * |
||
| 211 | * @return array The found data from user session. |
||
| 212 | */ |
||
| 213 | protected function getBasketData() |
||
| 214 | { |
||
| 215 | // get user session |
||
| 216 | $sessionId = $GLOBALS['TSFE']->fe_user->id; |
||
| 217 | |||
| 218 | if ($GLOBALS['TSFE']->loginUser) { |
||
| 219 | $basket = $this->basketRepository->findOneByFeUserId((int) $GLOBALS['TSFE']->fe_user->user['uid']); |
||
| 220 | } else { |
||
| 221 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_dlf_basket', ''); |
||
| 222 | $GLOBALS['TSFE']->fe_user->sesData_change = true; |
||
| 223 | $GLOBALS['TSFE']->fe_user->storeSessionData(); |
||
| 224 | |||
| 225 | $basket = $this->basketRepository->findOneBySessionId($sessionId); |
||
| 226 | } |
||
| 227 | // session already exists |
||
| 228 | if ($basket === null) { |
||
| 229 | // create new basket in db |
||
| 230 | $insertArray['fe_user_id'] = $GLOBALS['TSFE']->loginUser ? $GLOBALS['TSFE']->fe_user->user['uid'] : 0; |
||
| 231 | $insertArray['session_id'] = $sessionId; |
||
| 232 | $insertArray['doc_ids'] = ''; |
||
| 233 | $insertArray['label'] = ''; |
||
| 234 | $insertArray['l18n_diffsource'] = ''; |
||
| 235 | GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 236 | ->getConnectionForTable('tx_dlf_basket') |
||
| 237 | ->insert( |
||
| 238 | 'tx_dlf_basket', |
||
| 239 | $insertArray |
||
| 240 | ); |
||
| 241 | |||
| 242 | return ''; |
||
| 243 | } |
||
| 244 | |||
| 245 | $basketData['uid'] = $basket->getUid(); |
||
| 246 | $basketData['doc_ids'] = json_decode($basket->getDocIds()); |
||
| 247 | return $basketData; |
||
| 248 | } |
||
| 249 | |||
| 250 | /** |
||
| 251 | * Return one basket entry |
||
| 252 | * |
||
| 253 | * @access protected |
||
| 254 | * |
||
| 255 | * @param array $data: DocumentData |
||
| 256 | * @param array $template: Template information |
||
| 257 | * |
||
| 258 | * @return string One basket entry |
||
| 259 | */ |
||
| 260 | protected function getEntry($data) |
||
| 261 | { |
||
| 262 | if (is_object($data)) { |
||
| 263 | $data = get_object_vars($data); |
||
| 264 | } |
||
| 265 | $id = $data['id']; |
||
| 266 | $startpage = $data['startpage']; |
||
| 267 | $endpage = $data['endpage']; |
||
| 268 | $startX = $data['startX']; |
||
| 269 | $startY = $data['startY']; |
||
| 270 | $endX = $data['endX']; |
||
| 271 | $endY = $data['endY']; |
||
| 272 | $rotation = $data['rotation']; |
||
| 273 | |||
| 274 | $docData = $this->getDocumentData($id, $data); |
||
| 275 | |||
| 276 | $entryArray['BASKETDATA'] = $docData; |
||
| 277 | |||
| 278 | $entryKey = $id . '_' . $startpage; |
||
| 279 | if (!empty($startX)) { |
||
| 280 | $entryKey .= '_' . $startX; |
||
| 281 | } |
||
| 282 | if (!empty($endX)) { |
||
| 283 | $entryKey .= '_' . $endX; |
||
| 284 | } |
||
| 285 | |||
| 286 | $entryArray['id'] = $id; |
||
| 287 | $entryArray['CONTROLS'] = [ |
||
| 288 | 'startpage' => $startpage, |
||
| 289 | 'endpage' => $endpage, |
||
| 290 | 'startX' => $startX, |
||
| 291 | 'startY' => $startY, |
||
| 292 | 'endX' => $endX, |
||
| 293 | 'endY' => $endY, |
||
| 294 | 'rotation' => $rotation, |
||
| 295 | ]; |
||
| 296 | |||
| 297 | $entryArray['NUMBER'] = $docData['record_id']; |
||
| 298 | $entryArray['key'] = $entryKey; |
||
| 299 | |||
| 300 | // return one entry |
||
| 301 | return $entryArray; |
||
| 302 | } |
||
| 303 | |||
| 304 | /** |
||
| 305 | * Returns the downloadurl configured in the basket |
||
| 306 | * |
||
| 307 | * @access protected |
||
| 308 | * |
||
| 309 | * @param int $id: Document id |
||
| 310 | * |
||
| 311 | * @return mixed download url or false |
||
| 312 | */ |
||
| 313 | protected function getDocumentData($id, $data) |
||
| 314 | { |
||
| 315 | // get document instance to load further information |
||
| 316 | $document = Document::getInstance($id, 0); |
||
| 317 | if ($document) { |
||
| 318 | // replace url param placeholder |
||
| 319 | $urlParams = str_replace("##page##", (int) $data['page'], $this->settings['pdfparams']); |
||
| 320 | $urlParams = str_replace("##docId##", $document->recordId, $urlParams); |
||
| 321 | $urlParams = str_replace("##startpage##", (int) $data['startpage'], $urlParams); |
||
| 322 | if ($data['startpage'] != $data['endpage']) { |
||
| 323 | $urlParams = str_replace("##endpage##", $data['endpage'] === "" ? "" : (int) $data['endpage'], $urlParams); |
||
| 324 | } else { |
||
| 325 | // remove parameter endpage |
||
| 326 | $urlParams = str_replace(",##endpage##", '', $urlParams); |
||
| 327 | } |
||
| 328 | $urlParams = str_replace("##startx##", $data['startX'] === "" ? "" : (int) $data['startX'], $urlParams); |
||
| 329 | $urlParams = str_replace("##starty##", $data['startY'] === "" ? "" : (int) $data['startY'], $urlParams); |
||
| 330 | $urlParams = str_replace("##endx##", $data['endX'] === "" ? "" : (int) $data['endX'], $urlParams); |
||
| 331 | $urlParams = str_replace("##endy##", $data['endY'] === "" ? "" : (int) $data['endY'], $urlParams); |
||
| 332 | $urlParams = str_replace("##rotation##", $data['rotation'] === "" ? "" : (int) $data['rotation'], $urlParams); |
||
| 333 | |||
| 334 | $downloadUrl = $this->settings['pdfgenerate'] . $urlParams; |
||
| 335 | |||
| 336 | $title = $document->getTitle($id, true); |
||
| 337 | if (empty($title)) { |
||
| 338 | $title = LocalizationUtility::translate('basket.noTitle', 'dlf') ? : ''; |
||
| 339 | } |
||
| 340 | |||
| 341 | // Set page and cutout information |
||
| 342 | $info = ''; |
||
| 343 | if ($data['startX'] != '' && $data['endX'] != '') { |
||
| 344 | // cutout |
||
| 345 | $info .= htmlspecialchars(LocalizationUtility::translate('basket.cutout', 'dlf')) . ' '; |
||
| 346 | } |
||
| 347 | if ($data['startpage'] == $data['endpage']) { |
||
| 348 | // One page |
||
| 349 | $info .= htmlspecialchars(LocalizationUtility::translate('page', 'dlf')) . ' ' . $data['startpage']; |
||
| 350 | } else { |
||
| 351 | $info .= htmlspecialchars(LocalizationUtility::translate('page', 'dlf')) . ' ' . $data['startpage'] . '-' . $data['endpage']; |
||
| 352 | } |
||
| 353 | $downloadLink = '<a href="' . $downloadUrl . '" target="_blank">' . htmlspecialchars($title) . '</a> (' . $info . ')'; |
||
| 354 | if ($data['startpage'] == $data['endpage']) { |
||
| 355 | $pageNums = 1; |
||
| 356 | } else { |
||
| 357 | $pageNums = $data['endpage'] - $data['startpage']; |
||
| 358 | } |
||
| 359 | return [ |
||
| 360 | 'downloadUrl' => $downloadUrl, |
||
| 361 | 'title' => $title, |
||
| 362 | 'info' => $info, |
||
| 363 | 'downloadLink' => $downloadLink, |
||
| 364 | 'pageNums' => $pageNums, |
||
| 365 | 'urlParams' => $urlParams, |
||
| 366 | 'record_id' => $document->recordId, |
||
| 367 | ]; |
||
| 368 | } |
||
| 369 | return false; |
||
| 370 | } |
||
| 371 | |||
| 372 | /** |
||
| 373 | * Adds documents to the basket |
||
| 374 | * |
||
| 375 | * @access protected |
||
| 376 | * |
||
| 377 | * @param array $_piVars: piVars |
||
| 378 | * @param array $basketData: basket data |
||
| 379 | * |
||
| 380 | * @return array Basket data and Javascript output |
||
| 381 | */ |
||
| 382 | protected function addToBasket($_piVars, $basketData) |
||
| 383 | { |
||
| 384 | $output = ''; |
||
| 385 | if (!$_piVars['startpage']) { |
||
| 386 | $page = 0; |
||
| 387 | } else { |
||
| 388 | $page = (int) $_piVars['startpage']; |
||
| 389 | } |
||
| 390 | if ($page != null || $_piVars['addToBasket'] == 'list') { |
||
| 391 | $documentItem = [ |
||
| 392 | 'id' => (int) $_piVars['id'], |
||
| 393 | 'startpage' => (int) $_piVars['startpage'], |
||
| 394 | 'endpage' => !isset($_piVars['endpage']) || $_piVars['endpage'] === "" ? "" : (int) $_piVars['endpage'], |
||
| 395 | 'startX' => !isset($_piVars['startX']) || $_piVars['startX'] === "" ? "" : (int) $_piVars['startX'], |
||
| 396 | 'startY' => !isset($_piVars['startY']) || $_piVars['startY'] === "" ? "" : (int) $_piVars['startY'], |
||
| 397 | 'endX' => !isset($_piVars['endX']) || $_piVars['endX'] === "" ? "" : (int) $_piVars['endX'], |
||
| 398 | 'endY' => !isset($_piVars['endY']) || $_piVars['endY'] === "" ? "" : (int) $_piVars['endY'], |
||
| 399 | 'rotation' => !isset($_piVars['rotation']) || $_piVars['rotation'] === "" ? "" : (int) $_piVars['rotation'] |
||
| 400 | ]; |
||
| 401 | // update basket |
||
| 402 | if (!empty($basketData['doc_ids'])) { |
||
| 403 | $items = $basketData['doc_ids']; |
||
| 404 | $items = get_object_vars($items); |
||
| 405 | } else { |
||
| 406 | $items = []; |
||
| 407 | } |
||
| 408 | // get document instance to load further information |
||
| 409 | $document = Document::getInstance($documentItem['id'], 0); |
||
| 410 | // set endpage for toc and subentry based on logid |
||
| 411 | if (($_piVars['addToBasket'] == 'subentry') or ($_piVars['addToBasket'] == 'toc')) { |
||
| 412 | $smLinks = $document->smLinks; |
||
| 413 | $pageCounter = sizeof($smLinks['l2p'][$_piVars['logId']]); |
||
| 414 | $documentItem['endpage'] = ($documentItem['startpage'] + $pageCounter) - 1; |
||
| 415 | } |
||
| 416 | // add whole document |
||
| 417 | if ($_piVars['addToBasket'] == 'list') { |
||
| 418 | $documentItem['endpage'] = $document->numPages; |
||
| 419 | } |
||
| 420 | $arrayKey = $documentItem['id'] . '_' . $page; |
||
| 421 | if (!empty($documentItem['startX'])) { |
||
| 422 | $arrayKey .= '_' . $documentItem['startX']; |
||
| 423 | } |
||
| 424 | if (!empty($documentItem['endX'])) { |
||
| 425 | $arrayKey .= '_' . $documentItem['endX']; |
||
| 426 | } |
||
| 427 | // do not add more than one identical object |
||
| 428 | if (!in_array($arrayKey, $items)) { |
||
| 429 | $items[$arrayKey] = $documentItem; |
||
| 430 | // replace url param placeholder |
||
| 431 | $pdfParams = str_replace("##startpage##", $documentItem['startpage'], $this->settings['pdfparams']); |
||
| 432 | $pdfParams = str_replace("##docId##", $document->recordId, $pdfParams); |
||
| 433 | $pdfParams = str_replace("##startx##", $documentItem['startX'], $pdfParams); |
||
| 434 | $pdfParams = str_replace("##starty##", $documentItem['startY'], $pdfParams); |
||
| 435 | $pdfParams = str_replace("##endx##", $documentItem['endX'], $pdfParams); |
||
| 436 | $pdfParams = str_replace("##endy##", $documentItem['endY'], $pdfParams); |
||
| 437 | $pdfParams = str_replace("##rotation##", $documentItem['rotation'], $pdfParams); |
||
| 438 | if ($documentItem['startpage'] != $documentItem['endpage']) { |
||
| 439 | $pdfParams = str_replace("##endpage##", $documentItem['endpage'], $pdfParams); |
||
| 440 | } else { |
||
| 441 | // remove parameter endpage |
||
| 442 | $pdfParams = str_replace(",##endpage##", '', $pdfParams); |
||
| 443 | } |
||
| 444 | $pdfGenerateUrl = $this->settings['pdfgenerate'] . $pdfParams; |
||
| 445 | if ($this->settings['pregeneration']) { |
||
| 446 | // send ajax request to webapp |
||
| 447 | $output .= ' |
||
| 448 | <script> |
||
| 449 | $(document).ready(function(){ |
||
| 450 | $.ajax({ |
||
| 451 | url: "' . $pdfGenerateUrl . '", |
||
| 452 | }).done(function() { |
||
| 453 | }); |
||
| 454 | }); |
||
| 455 | </script>'; |
||
| 456 | } |
||
| 457 | } |
||
| 458 | $update = ['doc_ids' => json_encode($items)]; |
||
| 459 | GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 460 | ->getConnectionForTable('tx_dlf_basket') |
||
| 461 | ->update( |
||
| 462 | 'tx_dlf_basket', |
||
| 463 | $update, |
||
| 464 | ['uid' => (int) $basketData['uid']] |
||
| 465 | ); |
||
| 466 | $basketData['doc_ids'] = $items; |
||
| 467 | } |
||
| 468 | return ['basketData' => $basketData, 'jsOutput' => $output]; |
||
| 469 | } |
||
| 470 | |||
| 471 | /** |
||
| 472 | * Removes selected documents from basket |
||
| 473 | * |
||
| 474 | * @access protected |
||
| 475 | * |
||
| 476 | * @param array $_piVars: plugin variables |
||
| 477 | * @param array $basketData: array with document information |
||
| 478 | * |
||
| 479 | * @return array basket data |
||
| 480 | */ |
||
| 481 | protected function removeFromBasket($_piVars, $basketData) |
||
| 482 | { |
||
| 483 | if (!empty($basketData['doc_ids'])) { |
||
| 484 | $items = $basketData['doc_ids']; |
||
| 485 | $items = get_object_vars($items); |
||
| 486 | } |
||
| 487 | foreach ($_piVars['selected'] as $value) { |
||
| 488 | if (isset($value['id'])) { |
||
| 489 | $arrayKey = $value['id'] . '_' . $value['startpage']; |
||
| 490 | if (!empty($value['startX'])) { |
||
| 491 | $arrayKey .= '_' . $value['startX']; |
||
| 492 | } |
||
| 493 | if (!empty($value['endX'])) { |
||
| 494 | $arrayKey .= '_' . $value['endX']; |
||
| 495 | } |
||
| 496 | if (isset($items[$arrayKey])) { |
||
| 497 | unset($items[$arrayKey]); |
||
| 498 | } |
||
| 499 | } |
||
| 500 | } |
||
| 501 | if (empty($items)) { |
||
| 502 | $update = ['doc_ids' => '']; |
||
| 503 | } else { |
||
| 504 | $update = ['doc_ids' => json_encode($items)]; |
||
| 505 | } |
||
| 506 | |||
| 507 | GeneralUtility::makeInstance(ConnectionPool::class) |
||
| 508 | ->getConnectionForTable('tx_dlf_basket') |
||
| 509 | ->update( |
||
| 510 | 'tx_dlf_basket', |
||
| 511 | $update, |
||
| 512 | ['uid' => (int) $basketData['uid']] |
||
| 513 | ); |
||
| 514 | $basketData['doc_ids'] = $items; |
||
| 515 | return $basketData; |
||
| 516 | } |
||
| 517 | |||
| 518 | /** |
||
| 519 | * Send mail with pdf download url |
||
| 520 | * |
||
| 521 | * @access protected |
||
| 522 | * |
||
| 523 | * @return void |
||
| 524 | */ |
||
| 525 | protected function sendMail($requestData) |
||
| 593 | } |
||
| 594 | |||
| 595 | /** |
||
| 596 | * Sends document information to an external printer (url) |
||
| 597 | * |
||
| 598 | * @access protected |
||
| 599 | * |
||
| 600 | * @return void |
||
| 601 | */ |
||
| 602 | protected function printDocument($requestData, $basketData) |
||
| 660 | } |
||
| 661 | } |
||
| 662 |