custom/plugins/IwvDatevV6/src/Subscriber/CustomDocumentLinesSubscriber.php line 32

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Iwv\IwvDatevV6\Subscriber;
  4. use Iwv\IwvDatevV6\Events\IwvDatevCustomDocumentLinesEvent;
  5. use Iwv\IwvDatevV6\Service\CustomDocuments\PickwareErpProInvoiceCorrection;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class CustomDocumentLinesSubscriber implements EventSubscriberInterface
  8. {
  9.     /** @var PickwareErpProInvoiceCorrection */
  10.     protected $documentErpProRefund;
  11.     public function __construct(PickwareErpProInvoiceCorrection $documentErpProRefund)
  12.     {
  13.         $this->documentErpProRefund $documentErpProRefund;
  14.     }
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             IwvDatevCustomDocumentLinesEvent::class => 'onCustomDocumentLines',
  19.         ];
  20.     }
  21.     /**
  22.      * @param IwvDatevCustomDocumentLinesEvent $customDocumentLineEvent
  23.      * @return void
  24.      */
  25.     public function onCustomDocumentLines(IwvDatevCustomDocumentLinesEvent $customDocumentLineEvent): void
  26.     {
  27.         # Disable ERP Pro (missing discounts from export)
  28.         $documentLines $this->documentErpProRefund->getDocumentLines($customDocumentLineEvent->getDocumentDB(), $customDocumentLineEvent->getContext());
  29.         $customDocumentLineEvent->setDocumentLines($documentLines);
  30.     }
  31. }