change translation structure

This commit is contained in:
2025-05-14 21:44:40 +02:00
parent 524eb9be7b
commit 97735bab3b
9 changed files with 146 additions and 131 deletions

View File

@ -18,6 +18,7 @@ use OxidEsales\Eshop\Core\Exception\StandardException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\UtilsView;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRenderer;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
@ -34,9 +35,9 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
{
const PDF_DESTINATION_DOWNLOAD = 'D'; // force download in browser
const PDF_DESTINATION_STDOUT = 'I'; // show in browser plugin if available, otherwise download
const PDF_DESTINATION_FILE = 'F'; // save as local file
const PDF_DESTINATION_FILEANDSTDOUT = 'FI'; // output as local file and show in browser plugin
const PDF_DESTINATION_FILEANDDOWNLOAD = 'FD'; // output as local file and force download in browser
const PDF_DESTINATION_FILE = 'F'; // save as a local file
const PDF_DESTINATION_FILEANDSTDOUT = 'FI'; // output as a local file and show in browser plugin
const PDF_DESTINATION_FILEANDDOWNLOAD = 'FD'; // output as a local file and force download in browser
const PDF_DESTINATION_STRING = 'S'; // output as string
const PDF_ORIENTATION_PORTRAIT = 'P';
@ -84,11 +85,6 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
return $this->output($oPdf, $sFilename, $target, $htmlContent);
}
/**
* @param int $iLanguage
* @throws Html2PdfException
*/
/**
* @param $iLanguage
*
@ -213,9 +209,10 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
protected function addBasicAuth($content)
{
// ToDo: change to ModuleSettingService
$username = trim(Registry::getConfig()->getConfigParam('d3PdfDocumentsbasicAuthUserName'));
$password = trim(Registry::getConfig()->getConfigParam('d3PdfDocumentsbasicAuthPassword'));
/** @var ModuleSettingService $settingsService */
$settingsService = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
$username = trim($settingsService->getString('d3PdfDocumentsbasicAuthUserName', Constants::OXID_MODULE_ID));
$password = trim($settingsService->getString('d3PdfDocumentsbasicAuthPassword', Constants::OXID_MODULE_ID));
if ($username && $password) {
$shopUrl = parse_url( Registry::getConfig()->getShopCurrentUrl() );

View File

@ -1,40 +1,18 @@
<?php
/**
* See LICENSE file for license details.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
use D3\PdfDocuments\Application\Model\Constants;
declare(strict_types=1);
$sLangName = "Deutsch";
$basicAuthHelp = <<<HELP
Befindet sich der aktuelle Shop hinter einem BasicAuth, können beim Generieren des PDFs die Bilder nicht geladen werden. Tragen Sie hier die Zugangsdaten ein, um die Bilder zu sehen.
HELP;
$aLang = array(
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Mit aktiviertem Entwicklermodus wird das Dokument im '.
'HTML-Format ausgegeben. Inhaltliche Fehler können so besser nachvollzogen werden.',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => 'BasicAuth des Shops - Benutzername (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => $basicAuthHelp,
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => 'BasicAuth des Shops - Passwort (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => $basicAuthHelp,
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Rechnung ohne Logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Lieferschein',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Lieferschein ohne Logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Dokument',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Sprache',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Dokument erstellen',
);
// @codeCoverageIgnoreStart
$aLang = include __DIR__ . "/../../de/translations.php";
// @codeCoverageIgnoreEnd

View File

@ -1,40 +1,18 @@
<?php
/**
* See LICENSE file for license details.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
use D3\PdfDocuments\Application\Model\Constants;
declare(strict_types=1);
$sLangName = "English";
$basicAuthHelp = <<<HELP
If the current shop is protected by a BasicAuth, the images cannot be loaded when the PDF is generated. Enter the access data here to view the images.
HELP;
$aLang = array(
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'If developer mode is activated, the document is output in '.
'HTML format. This makes it much easier to trace content errors.',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => 'BasicAuth of the shop - user name (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => $basicAuthHelp,
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => 'BasicAuth of the shop - password (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => $basicAuthHelp,
'D3_PDFDOCUMENTS' => 'PDF Documents',
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Invoice without logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Deliverynote',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Deliverynote without logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Document',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Language',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Create Document',
);
// @codeCoverageIgnoreStart
$aLang = include __DIR__ . "/../../en/translations.php";
// @codeCoverageIgnoreEnd

View File

@ -1,29 +1,18 @@
<?php
/**
* See LICENSE file for license details.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
use D3\PdfDocuments\Application\Model\Constants;
$sLangName = "Deutsch";
$aLang = array(
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
declare(strict_types=1);
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Rechnung ohne Logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Lieferschein',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Lieferschein ohne Logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Dokument',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Sprache',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Dokument erstellen',
);
// @codeCoverageIgnoreStart
$aLang = include __DIR__ . "/../../de/translations.php";
// @codeCoverageIgnoreEnd

View File

@ -1,29 +1,18 @@
<?php
/**
* See LICENSE file for license details.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
use D3\PdfDocuments\Application\Model\Constants;
declare(strict_types=1);
$sLangName = "English";
$aLang = array(
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
'D3_PDFDOCUMENTS' => 'PDF Documents',
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Invoice without logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Deliverynote',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Deliverynote without logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Document',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Language',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Create Document',
);
// @codeCoverageIgnoreStart
$aLang = include __DIR__ . "/../../en/translations.php";
// @codeCoverageIgnoreEnd

View File

@ -0,0 +1,44 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
use D3\PdfDocuments\Application\Model\Constants;
// @codeCoverageIgnoreStart
$basicAuthHelp = <<<HELP
Befindet sich der aktuelle Shop hinter einem BasicAuth, können beim Generieren des PDFs die Bilder nicht geladen werden. Tragen Sie hier die Zugangsdaten ein, um die Bilder zu sehen.
HELP;
return [
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Entwicklermodus',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Mit aktiviertem Entwicklermodus wird das Dokument im '.
'HTML-Format ausgegeben. Inhaltliche Fehler können so besser nachvollzogen werden.',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => 'BasicAuth des Shops - Benutzername (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => $basicAuthHelp,
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => 'BasicAuth des Shops - Passwort (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => $basicAuthHelp,
'D3_PDFDOCUMENTS' => 'PDF-Dokumente',
'D3_PDFDOCUMENTS_INVOICE' => 'Rechnung',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Rechnung ohne Logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Lieferschein',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Lieferschein ohne Logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Dokument',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Sprache',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Dokument erstellen',
];

View File

@ -0,0 +1,44 @@
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
use D3\PdfDocuments\Application\Model\Constants;
// @codeCoverageIgnoreStart
$basicAuthHelp = <<<HELP
If the current shop is protected by a BasicAuth, the images cannot be loaded when the PDF is generated. Enter the access data here to view the images.
HELP;
return [
'charset' => 'utf-8',
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Basic settings',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'Developer mode',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'bDev' => 'If developer mode is activated, the document is output in '.
'HTML format. This makes it much easier to trace content errors.',
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => 'BasicAuth of the shop - user name (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthUserName' => $basicAuthHelp,
'SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => 'BasicAuth of the shop - password (optional)',
'HELP_SHOP_MODULE_'. Constants::OXID_MODULE_ID.'basicAuthPassword' => $basicAuthHelp,
'D3_PDFDOCUMENTS' => 'PDF Documents',
'D3_PDFDOCUMENTS_INVOICE' => 'Invoice',
'D3_PDFDOCUMENTS_INVOICE_WITHOUT_LOGO' => 'Invoice without logo',
'D3_PDFDOCUMENTS_DELIVERYNOTE' => 'Deliverynote',
'D3_PDFDOCUMENTS_DELIVERYNOTE_WITHOUT_LOGO' => 'Deliverynote without logo',
'D3_PDFDOCUMENTS_PDF_TYPE' => 'Document',
'D3_PDFDOCUMENTS_LANGUAGE' => 'Language',
'D3_PDFDOCUMENTS_PDF_GENERATE' => 'Create Document',
];

View File

@ -16,14 +16,10 @@ use D3\PdfDocuments\Application\Model\Exceptions\pdfGeneratorExceptionAbstract;
use D3\PdfDocuments\Application\Model\Exceptions\wrongPdfGeneratorInterface;
use D3\PdfDocuments\Application\Model\Registries\registryOrderoverview;
use Exception;
use OxidEsales\Eshop\Application\Controller\Admin\OrderOverview;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use OxidEsales\Eshop\Application\Model\Order;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\TableViewNameGenerator;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
@ -33,7 +29,7 @@ use Psr\Container\NotFoundExceptionInterface;
class d3_overview_controller_pdfdocuments extends d3_overview_controller_pdfdocuments_parent
{
private $generatorError = false;
private ?string $generatorError = null;
public function render()
{
@ -53,7 +49,7 @@ form.submit();
</body>
</html>
HTML;
Registry::getUtils()->showMessageAndExit();
Registry::getUtils()->showMessageAndExit('');
} elseif ($generatorError = Registry::getRequest()->getRequestParameter('generatorError')) {
Registry::getUtilsView()->addErrorToDisplay(urldecode($generatorError));
}

View File

@ -86,13 +86,13 @@ $aModule = [
'value' => false
],
[
'group' => $sModuleId.'main',
'name' => $sModuleId.'basicAuthUserName',
'group' => Constants::OXID_MODULE_ID.'main',
'name' => Constants::OXID_MODULE_ID.'basicAuthUserName',
'type' => 'str'
],
[
'group' => $sModuleId.'main',
'name' => $sModuleId.'basicAuthPassword',
'group' => Constants::OXID_MODULE_ID.'main',
'name' => Constants::OXID_MODULE_ID.'basicAuthPassword',
'type' => 'password'
]
]