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

refactor: use erp date settings

Übergeordneter c88cf3c1
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -22,6 +22,9 @@ function ($params, $filter) {
$Grid = new QUI\Utils\Grid();
$Locale = QUI::getLocale();
$defaultDateFormat = QUI\ERP\Defaults::getDateFormat();
$defaultTimeFormat = QUI\ERP\Defaults::getTimestampFormat();
$ProcessingStatus = ProcessingStatusHandler::getInstance();
$list = $ProcessingStatus->getProcessingStatusList();
$processing = [];
......@@ -39,22 +42,6 @@ function ($params, $filter) {
$data = $Invoices->searchTemporaryInvoices($query);
$localeCode = QUI::getLocale()->getLocalesByLang(
QUI::getLocale()->getCurrent()
);
$DateFormatter = new \IntlDateFormatter(
$localeCode[0],
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE
);
$DateFormatterLong = new \IntlDateFormatter(
$localeCode[0],
\IntlDateFormatter::SHORT,
\IntlDateFormatter::SHORT
);
$needleFields = [
'id',
'order_id',
......@@ -179,12 +166,14 @@ function ($params, $filter) {
}
// format
$data[$key]['date'] = $DateFormatter->format(
\strtotime($TemporaryInvoice->getAttribute('date'))
$data[$key]['date'] = $Locale->formatDate(
\strtotime($TemporaryInvoice->getAttribute('date')),
$defaultDateFormat
);
$data[$key]['c_date'] = $DateFormatterLong->format(
\strtotime($TemporaryInvoice->getAttribute('date'))
$data[$key]['c_date'] = $Locale->formatDate(
\strtotime($TemporaryInvoice->getAttribute('date')),
$defaultTimeFormat
);
//$vatTextArray = InvoiceUtils::getVatTextArrayFromVatArray($invoiceData['vat_array'], $Currency);
......
......@@ -541,22 +541,8 @@ protected function parseListForGrid($data)
$Locale = QUI::getLocale();
$Payments = Payments::getInstance();
$localeCode = QUI::getLocale()->getLocalesByLang(
QUI::getLocale()->getCurrent()
);
$DateFormatter = new \IntlDateFormatter(
$localeCode[0],
\IntlDateFormatter::SHORT,
\IntlDateFormatter::NONE
);
$DateFormatterLong = new \IntlDateFormatter(
$localeCode[0],
\IntlDateFormatter::SHORT,
\IntlDateFormatter::SHORT
);
$defaultDateFormat = QUI\ERP\Defaults::getDateFormat();
$defaultTimeFormat = QUI\ERP\Defaults::getTimestampFormat();
$needleFields = [
'customer_id',
......@@ -641,7 +627,10 @@ protected function parseListForGrid($data)
);
$invoiceData['order_date'] = $Order->getCreateDate();
$invoiceData['order_date'] = $DateFormatterLong->format(\strtotime($invoiceData['order_date']));
$invoiceData['order_date'] = $Locale->formatDate(
\strtotime($invoiceData['order_date']),
$defaultTimeFormat
);
} catch (QUI\Exception $Exception) {
}
......@@ -656,13 +645,25 @@ protected function parseListForGrid($data)
$timeForPayment = \strtotime($Invoice->getAttribute('time_for_payment'));
$invoiceData['globalProcessId'] = $Invoice->getGlobalProcessId();
$invoiceData['date'] = $DateFormatter->format(\strtotime($Invoice->getAttribute('date')));
$invoiceData['time_for_payment'] = $DateFormatter->format($timeForPayment);
$invoiceData['c_date'] = $DateFormatterLong->format(\strtotime($Invoice->getAttribute('c_date')));
$invoiceData['globalProcessId'] = $Invoice->getGlobalProcessId();
$invoiceData['date'] = $Locale->formatDate(
\strtotime($Invoice->getAttribute('date')),
$defaultDateFormat
);
$invoiceData['time_for_payment'] = $Locale->formatDate($timeForPayment, $defaultDateFormat);
$invoiceData['c_date'] = $Locale->formatDate(
\strtotime($Invoice->getAttribute('c_date')),
$defaultTimeFormat
);
if ($Invoice->getAttribute('paid_date')) {
$invoiceData['paid_date'] = $DateFormatter->format($Invoice->getAttribute('paid_date'));
$invoiceData['paid_date'] = $Locale->formatDate(
$Invoice->getAttribute('paid_date'),
$defaultDateFormat
);
} else {
$invoiceData['paid_date'] = Handler::EMPTY_VALUE;
}
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren