From 09318a9b477a6d6deda883d52c56505983e80a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Sch=C3=BCle?= Date: Wed, 27 Nov 2024 10:07:39 +0100 Subject: [PATCH] tweak(Sales/Invoice): don't send validation errors to sentry --- tine20/Sales/Controller/Invoice.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tine20/Sales/Controller/Invoice.php b/tine20/Sales/Controller/Invoice.php index 0d91bbf2cf..982ea7597c 100644 --- a/tine20/Sales/Controller/Invoice.php +++ b/tine20/Sales/Controller/Invoice.php @@ -1546,8 +1546,10 @@ public function createXRechnungsAttachment(Sales_Model_Invoice $invoice): void } rewind($stream); // redundant, but cheap and good for readability } else { - if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ - . ' edocument validation service not configured, skipping! created xrechnung is not validated!'); + if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) { + Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ + . ' edocument validation service not configured, skipping! created xrechnung is not validated!'); + } } $attachmentName = str_replace('/', '-', $customer->getTitle() . '_' . $invoice->number . '-xrechnung.xml'); @@ -1558,7 +1560,14 @@ public function createXRechnungsAttachment(Sales_Model_Invoice $invoice): void Tinebase_FileSystem_RecordAttachments::getInstance()->addRecordAttachment($invoice, $attachmentName, $stream); Tinebase_FileSystem_RecordAttachments::getInstance()->getRecordAttachments($invoice); } catch (Exception $e) { - Tinebase_Exception::log($e, additionalData: ['invoice id: ' . $invoice->getId()]); + if ($e instanceof Tinebase_Exception_ProgramFlow) { + if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) { + Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ + . ' ' . $e->getMessage()); + } + } else { + Tinebase_Exception::log($e, additionalData: ['invoice id: ' . $invoice->getId()]); + } } }