getDocuments example

$constraints['documentIds'] = RuleConstraints::uuids();

        return $constraints;
    }

    public function match(RuleScope $scope): bool
    {
        if (!$scope instanceof FlowRuleScope) {
            return false;
        }

        if (!$documents = $scope->getOrder()->getDocuments()) {
            return false;
        }

        $typeIds = [];
        foreach ($documents->getElements() as $document) {
            $typeIds[] = $document->getDocumentTypeId();
        }

        return RuleComparison::uuids(array_values(array_unique($typeIds))$this->documentIds, $this->operator);
    }

    
'type_id' => $entry->getType() ? $entry->getType()->getId() : null,
                    'order_id' => $entry->getOrder() ? $entry->getOrder()->getId() : null,
                    'shop_id' => $entry->getShop() ? $entry->getShop()->getId() : null,
                    'subject' => $entry->getSubject(),
                    'sender' => (string) $entry->getSender(),
                    'sent_at' => $entry->getSentAt()->format('Y-m-d H:i:s'),
                    'content_html' => $entry->getContentHtml(),
                    'content_text' => $entry->getContentText(),
                ]);
                $mailLogId = (int) $this->connection->lastInsertId();

                foreach ($entry->getDocuments() as $document) {
                    $this->connection->insert('s_mail_log_document', [
                        'log_id' => $mailLogId,
                        'document_id' => $document->getId(),
                    ]);
                }

                foreach ($entry->getRecipients() as $recipient) {
                    $mail = mb_strtolower(trim($recipient->getMailAddress()));

                    $this->connection->insert('s_mail_log_recipient', [
                        'log_id' => $mailLogId,
                        
private Enlight_Components_Snippet_Manager $snippets;

    public function __construct(string $entity, ModelManager $entityManager, Enlight_Components_Snippet_Manager $snippets)
    {
        parent::__construct($entity$entityManager);
        $this->snippets = $snippets;
    }

    public function getList($identifiers)
    {
        $orders = parent::getList($identifiers);
        $documents = $this->getDocuments($orders);

        $namespace = $this->snippets->getNamespace('backend/static/order_status');

        foreach ($orders as &$order) {
            $order['orderStateName'] = $namespace->get($order['orderStateKey']);
            $order['orderDocuments'] = $this->getOrderDocuments($documents$order);
            $order['supplierId'] = explode(',', $order['supplierId'] ?? '');
            $order['articleNumber'] = explode(',', $order['articleNumber'] ?? '');
        }

        return $orders;
    }
$this->View()->assign([
                'success' => false,
                'message' => 'No valid order id passed.',
            ]);

            return;
        }

        $files = [];
        $models = $this->getOrderDocumentsQuery($data->orders, $data->docType)->getResult();
        foreach ($models as $model) {
            foreach ($model->getDocuments() as $document) {
                $file = $this->downloadFileFromFilesystem(sprintf('documents/%s.pdf', $document->getHash()));
                if ($file !== null) {
                    $files[] = $file;
                }
            }
        }

        $this->mergeDocuments($files);

        // Remove temporary files         foreach ($files as $file) {
            
$mail->setAssociation(LogEntryBuilder::SHOP_ASSOCIATION, $entry->getShop());
        }

        $this->assignOrderDocuments($entry$mail);
        $this->assignTemplateDocuments($entry$mail);

        return $mail;
    }

    protected function assignOrderDocuments(Log $logEntry, Enlight_Components_Mail $mail): void
    {
        if ($logEntry->getDocuments()->isEmpty()) {
            return;
        }

        foreach ($logEntry->getDocuments() as $document) {
            $filePath = sprintf('documents/%s.pdf', $document->getHash());
            $fileName = sprintf('%s.pdf', $document->getType()->getName());

            if (!$this->filesystem->has($filePath)) {
                continue;
            }

            

        $this->entityManager->persist($contact);
        $this->entityManager->flush();
    }

    protected function assignDocuments(Log $logEntry, Enlight_Components_Mail $mail): void
    {
        if (!$mail->hasAttachments || $logEntry->getOrder() === null) {
            return;
        }

        $documents = $this->entityManager->getRepository(Order::class)->getDocuments([$logEntry->getOrder()->getId()]);
        $filenameIdMap = [];

        foreach ($documents as $document) {
            $filename = $this->getDocumentFilename($document);

            if ($filename) {
                $filenameIdMap[$filename] = $document['id'];
            }
        }

        foreach ($mail->getParts() as $part) {
            
Home | Imprint | This part of the site doesn't use cookies.