Skip to content
Code-Schnipsel Gruppen Projekte
Commit 2bec2d1e erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next-3.x' into 'main'

fix: filter history messages from the first august - because of contract uuids

See merge request !132
Übergeordnete 14394236 f3f76f4d
No related branches found
Tags 3.7.5
2 Merge Requests!140Update 'next-4.x' with latest changes from 'main',!132fix: filter history messages from the first august - because of contract uuids
Pipeline #9663 mit Warnungen bestanden mit Phasen
in 1 Minute und 1 Sekunde
......@@ -389,8 +389,8 @@
<en><![CDATA[Contract]]></en>
</locale>
<locale name="process.history.empty.info">
<de><![CDATA[Hier werden nur Einträge aufgelistet, die nach dem 01.07.2024 erstellt wurden.]]></de>
<en><![CDATA[Only entries created after 01/07/2024 are listed here.]]></en>
<de><![CDATA[Hier werden nur Einträge aufgelistet, die nach dem 01.08.2024 erstellt wurden.]]></de>
<en><![CDATA[Only entries created after 01/08/2024 are listed here.]]></en>
</locale>
</groups>
......@@ -799,37 +799,37 @@
<en><![CDATA[[startCurrency] = [rate]]]></en>
</locale>
<locale name="created.invoice">
<de><![CDATA[Rechnung #[invoiceId] erstellt]]></de>
<en><![CDATA[Created invoice #[invoiceId]]]></en>
<de><![CDATA[Rechnung [invoiceId] erstellt]]></de>
<en><![CDATA[Created invoice [invoiceId]]]></en>
</locale>
<locale name="created.order">
<de><![CDATA[Bestellung #[orderId] erstellt]]></de>
<en><![CDATA[Created order #[orderId]]]></en>
<de><![CDATA[Bestellung [orderId] erstellt]]></de>
<en><![CDATA[Created order [orderId]]]></en>
</locale>
<locale name="process.history.invoice.created">
<de><![CDATA[Rechnung #[hash] erstellt]]></de>
<en><![CDATA[Invoice #[hash] created]]></en>
<de><![CDATA[Rechnung [hash] erstellt]]></de>
<en><![CDATA[Invoice [hash] created]]></en>
</locale>
<locale name="process.history.order.created">
<de><![CDATA[Bestellung #[hash] erstellt]]></de>
<en><![CDATA[Order #[hash] created]]></en>
<de><![CDATA[Bestellung [hash] erstellt]]></de>
<en><![CDATA[Order [hash] created]]></en>
</locale>
<locale name="process.history.offer.created">
<de><![CDATA[Angebot #[hash] erstellt]]></de>
<en><![CDATA[Offer #[hash] created]]></en>
<de><![CDATA[Angebot [hash] erstellt]]></de>
<en><![CDATA[Offer [hash] created]]></en>
</locale>
<locale name="process.history.purchasing.created">
<de><![CDATA[Einkauf #[hash] erstellt]]></de>
<en><![CDATA[Purchase #[hash] created]]></en>
<de><![CDATA[Einkauf [hash] erstellt]]></de>
<en><![CDATA[Purchase [hash] created]]></en>
</locale>
<locale name="process.history.salesorders.created">
<de><![CDATA[Auftrag #[hash] erstellt]]></de>
<en><![CDATA[Sales order #[hash] created]]></en>
<de><![CDATA[Auftrag [hash] erstellt]]></de>
<en><![CDATA[Sales order [hash] created]]></en>
</locale>
<locale name="process.history.booking.created">
<de><![CDATA[Buchung #[hash] erstellt]]></de>
<en><![CDATA[Booking #[hash] created]]></en>
<de><![CDATA[Buchung [hash] erstellt]]></de>
<en><![CDATA[Booking [hash] created]]></en>
</locale>
<locale name="process.history.transaction.created">
<de><![CDATA[Zahlung von [amount] eingegangen / gebucht. (#[hash])]]></de>
......
......@@ -29,7 +29,7 @@ class Process
* this date determines when the global process ids start to work.
* also the relationships.
*/
const PROCESS_ACTIVE_DATE = '2024-07-01 00:00:00';
const PROCESS_ACTIVE_DATE = '2024-08-01 00:00:00';
/**
* @var string
......@@ -278,15 +278,6 @@ public function getCompleteHistory(): Comments
$this->parseSalesOrders($History);
$this->parseTransactions($History);
if ($History->isEmpty()) {
$History->addComment(
QUI::getLocale()->get('quiqqer/erp', 'process.history.empty.info'),
strtotime(self::PROCESS_ACTIVE_DATE),
'quiqqer/erp',
'fa fa-info'
);
}
try {
QUI::getEvents()->fireEvent('quiqqerErpGetCompleteHistory', [$this, $this->processId]);
} catch (\Exception $exception) {
......@@ -299,6 +290,35 @@ public function getCompleteHistory(): Comments
QUI\System\Log::addError($exception->getMessage());
}
// filter comments
/**
* this date determines when the global process ids start to work.
* also the relationships.
*/
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
$comments = $History->toArray();
$comments = array_filter($comments, function ($comment) use ($processDate) {
$createDate = $comment['time'];
if ($createDate > $processDate) {
return true;
}
return false;
});
$History = QUI\ERP\Comments::unserialize($comments);
if ($History->isEmpty()) {
$History->addComment(
QUI::getLocale()->get('quiqqer/erp', 'process.history.empty.info'),
strtotime(self::PROCESS_ACTIVE_DATE),
'quiqqer/erp',
'fa fa-info'
);
}
return $History;
}
......@@ -313,7 +333,7 @@ protected function parseInvoices(Comments $History): void
foreach ($invoices as $Invoice) {
$History->addComment(
QUI::getLocale()->get('quiqqer/erp', 'process.history.invoice.created', [
'hash' => $Invoice->getUUID()
'hash' => $Invoice->getPrefixedNumber()
]),
strtotime($Invoice->getAttribute('date')),
'quiqqer/invoice',
......@@ -391,22 +411,9 @@ public function getInvoices(): array
}
try {
$invoices = QUI\ERP\Accounting\Invoice\Handler::getInstance()->getInvoicesByGlobalProcessId(
return QUI\ERP\Accounting\Invoice\Handler::getInstance()->getInvoicesByGlobalProcessId(
$this->processId
);
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($invoices, function ($Invoice) use ($processDate) {
$createDate = $Invoice->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
} catch (\QUI\Exception) {
return [];
}
......@@ -425,7 +432,7 @@ protected function parseOrders(Comments $History): void
$history = $Order->getHistory()->toArray();
$hasCreateMessage = false;
$createMessage = QUI::getLocale()->get('quiqqer/erp', 'process.history.order.created', [
'hash' => $Order->getUUID()
'hash' => $Order->getPrefixedNumber()
]);
foreach ($history as $entry) {
......@@ -513,19 +520,7 @@ public function getOrders(): array
}
try {
$orders = QUI\ERP\Order\Handler::getInstance()->getOrdersByGlobalProcessId($this->processId);
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($orders, function ($Order) use ($processDate) {
$createDate = $Order->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return QUI\ERP\Order\Handler::getInstance()->getOrdersByGlobalProcessId($this->processId);
} catch (QUI\Exception) {
return [];
}
......@@ -631,18 +626,7 @@ public function getOffers(): array
}
}
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($result, function ($Offer) use ($processDate) {
$createDate = $Offer->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return $result;
}
//endregion
......@@ -656,7 +640,7 @@ protected function parseBookings(Comments $History): void
foreach ($bookings as $Booking) {
$History->addComment(
QUI::getLocale()->get('quiqqer/erp', 'process.history.booking.created', [
'hash' => $Booking->getUuid()
'hash' => $Booking->getPrefixedNumber()
]),
$Booking->getCreateDate()->getTimestamp(),
'quiqqer/booking',
......@@ -728,19 +712,7 @@ public function getBookings(): array
}
}
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($result, function ($Booking) use ($processDate) {
// @todo c_date??
$createDate = $Booking->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return $result;
}
//endregion
......@@ -825,18 +797,7 @@ public function getPurchasing(): array
}
}
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($result, function ($Purchase) use ($processDate) {
$createDate = $Purchase->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return $result;
}
//endregion
......@@ -913,19 +874,7 @@ public function getSalesOrders(): array
}
}
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
return array_filter($result, function ($SalesOrder) use ($processDate) {
$createDate = $SalesOrder->getAttribute('c_date');
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return $result;
}
//endregion
......@@ -977,21 +926,8 @@ public function getTransactions(): array
}
$Transactions = QUI\ERP\Accounting\Payments\Transactions\Handler::getInstance();
$transactions = $Transactions->getTransactionsByProcessId($this->processId);
$processDate = strtotime(self::PROCESS_ACTIVE_DATE);
$this->transactions = array_filter($transactions, function ($Transaction) use ($processDate) {
$createDate = $Transaction->getDate();
$createDate = strtotime($createDate);
if ($createDate > $processDate) {
return true;
}
return false;
});
return $this->transactions;
return $Transactions->getTransactionsByProcessId($this->processId);
}
//endregion
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren