diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..49a6388d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +database +node_modules +www/cache +www/dist +userdata +!userdata/wiki \ No newline at end of file diff --git a/.gitignore b/.gitignore index 23051876..00dc3a55 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ userdata www/cache/ node_modules/ www/themes/new/css/custom.css +docker-compose.override.yml +.idea \ No newline at end of file diff --git a/classes/Components/EnvironmentConfig/Bootstrap.php b/classes/Components/EnvironmentConfig/Bootstrap.php index 50f56342..18262ca2 100644 --- a/classes/Components/EnvironmentConfig/Bootstrap.php +++ b/classes/Components/EnvironmentConfig/Bootstrap.php @@ -44,14 +44,6 @@ class Bootstrap /** @var LegacyApplication $app */ $app = $container->get('LegacyApplication'); - if (!class_exists('License')) { - $test = dirname(__DIR__, 3) . '/phpwf/plugins/class.license.php'; - $file = new SplFileInfo($test); - if ($file->isFile()) { - include $test; - } - } - - return new EnvironmentConfigProvider(new License(), $app->Conf); + return new EnvironmentConfigProvider($app->Conf); } } diff --git a/classes/Components/EnvironmentConfig/EnvironmentConfig.php b/classes/Components/EnvironmentConfig/EnvironmentConfig.php index 3c6c50da..1ca73d67 100644 --- a/classes/Components/EnvironmentConfig/EnvironmentConfig.php +++ b/classes/Components/EnvironmentConfig/EnvironmentConfig.php @@ -34,11 +34,6 @@ final class EnvironmentConfig */ private $userdataDirectoryPath; - /** - * @var array|null $ioncubeSystemInformation - */ - private $ioncubeSystemInformation; - /** * @param string $databaseHost * @param string $databaseName @@ -46,7 +41,6 @@ final class EnvironmentConfig * @param string $databasePassword * @param int $databasePort * @param string $userdataDirectoryPath - * @param array $ioncubeSystemInformation */ public function __construct( string $databaseHost, @@ -54,8 +48,7 @@ final class EnvironmentConfig string $databaseUser, string $databasePassword, int $databasePort, - string $userdataDirectoryPath, - ?array $ioncubeSystemInformation + string $userdataDirectoryPath ) { $this->databaseHost = $databaseHost; $this->databaseName = $databaseName; @@ -63,7 +56,6 @@ final class EnvironmentConfig $this->databasePassword = $databasePassword; $this->databasePort = $databasePort; $this->userdataDirectoryPath = $userdataDirectoryPath; - $this->ioncubeSystemInformation = $ioncubeSystemInformation; } /** @@ -113,121 +105,4 @@ final class EnvironmentConfig { return $this->userdataDirectoryPath; } - - /** - * @return ?array - */ - public function getIoncubeSystemInformation(): ?array - { - return $this->ioncubeSystemInformation; - } - - /** - * @return bool - */ - public function isSystemHostedOnCloud(): bool - { - return !empty($this->ioncubeSystemInformation['iscloud']['value']); - } - - /** - * @return bool - */ - public function isSystemFlaggedAsDevelopmentVersion(): bool - { - return !empty($this->ioncubeSystemInformation['isdevelopmentversion']['value']); - } - - /** - * @return bool - */ - public function isSystemFlaggedAsTestVersion(): bool - { - return !empty($this->ioncubeSystemInformation['testlizenz']['value']); - } - - /** - * @return int - */ - public function getMaxUser(): int - { - if (!isset($this->ioncubeSystemInformation['maxuser']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['maxuser']['value']; - } - - /** - * @return int - */ - public function getMaxLightUser(): int - { - if (!isset($this->ioncubeSystemInformation['maxlightuser']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['maxlightuser']['value']; - } - - /** - * @return int|null - */ - public function getExpirationTimeStamp(): ?int - { - if (!isset($this->ioncubeSystemInformation['expdate']['value'])) { - return 0; - } - - return (int)$this->ioncubeSystemInformation['expdate']['value']; - } - - /** - * @param string $name - * - * @return string|null - */ - public function getValueOfSpecificIoncubeSystemInformation(string $name): ?string - { - if ($this->ioncubeSystemInformation === null) { - return null; - } - - if (array_key_exists($name, $this->ioncubeSystemInformation)) { - return $this->ioncubeSystemInformation[$name]['value']; - } - - return null; - } - - /** - * @return array - */ - public function getSystemFallbackEmailAddresses(): array - { - $emailAddresses = []; - $mailAddressSelfBuyCustomer = (string)$this->getValueOfSpecificIoncubeSystemInformation('buyemail'); - if ($mailAddressSelfBuyCustomer !== '') { - $emailAddresses[] = $mailAddressSelfBuyCustomer; - } - - $mailAddressCustomerLicence = (string)$this->getValueOfSpecificIoncubeSystemInformation('emaillicence'); - if ($mailAddressCustomerLicence !== '' - && strpos($mailAddressCustomerLicence, '@') !== false - && strpos($mailAddressCustomerLicence, '@xentral.com') === false - && strpos($mailAddressCustomerLicence, '@xentral.biz') === false) { - $emailAddresses[] = $mailAddressCustomerLicence; - } - - //in old licences email-address of customer can be insert in name instead email - $nameCustomerLicence = (string)$this->getValueOfSpecificIoncubeSystemInformation('namelicence'); - if ($nameCustomerLicence !== '' - && strpos($nameCustomerLicence, '@') !== false - && strpos($nameCustomerLicence, '@xentral.com') === false - && strpos($nameCustomerLicence, '@xentral.biz') === false) { - $emailAddresses[] = $nameCustomerLicence; - } - - return $emailAddresses; - } } diff --git a/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php b/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php index 81b9a035..50164a58 100644 --- a/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php +++ b/classes/Components/EnvironmentConfig/EnvironmentConfigProvider.php @@ -7,19 +7,14 @@ use License; final class EnvironmentConfigProvider { - /** @var License $license */ - private $license; - /** @var Config $config */ private $config; /** - * @param License $license * @param Config $config */ - public function __construct(License $license, Config $config) + public function __construct(Config $config) { - $this->license = $license; $this->config = $config; } @@ -30,8 +25,7 @@ final class EnvironmentConfigProvider { $environmentConfig = new EnvironmentConfig( $this->config->WFdbhost, $this->config->WFdbname, $this->config->WFdbuser, - $this->config->WFdbpass, $this->config->WFdbport, $this->config->WFuserdata, - (array)$this->license->getProperties() + $this->config->WFdbpass, $this->config->WFdbport, $this->config->WFuserdata ); return $environmentConfig; diff --git a/classes/Core/ErrorHandler/ErrorHandler.php b/classes/Core/ErrorHandler/ErrorHandler.php index a871bf58..4c4ef3ee 100644 --- a/classes/Core/ErrorHandler/ErrorHandler.php +++ b/classes/Core/ErrorHandler/ErrorHandler.php @@ -84,10 +84,6 @@ final class ErrorHandler public function handleException($exception) { $title = null; - if ($this->isIoncubeError($exception)) { - $title = $this->handleIoncubeError($exception); - } - $data = new ErrorPageData($exception, $title); $renderer = new ErrorPageRenderer($data); header('HTTP/1.1 500 Internal Server Error'); @@ -125,96 +121,4 @@ final class ErrorHandler { return in_array((int)$type, self::THROWABLE_ERROR_TYPES, true); } - - /** - * @param Throwable $exception - * - * @return bool - */ - private function isIoncubeError($exception) - { - if ((int)$exception->getCode() !== E_CORE_ERROR) { - return false; - } - if (strpos($exception->getMessage(), 'requires a license file.') !== false) { - return true; - } - if (strpos($exception->getMessage(), 'ionCube Encoder') !== false) { - return true; - } - - return false; - } - - /** - * @param Throwable $exception - * - * @return string|null - */ - private function handleIoncubeError($exception) - { - $file = $this->extractFileFromIoncubeError($exception); - if (empty($file)) { - return null; - } - - if (!$this->isDeleteableFile($file)) { - return null; - } - - @unlink($file); - if(is_file($file)) { - return sprintf('Es wurde eine alte Systemdatei gefunden die nicht manuell gelöscht werden konnte. - Bitte löschen Sie die Datei %s', $file); - } - return 'Es wurde eine alte Systemdatei gefunden und automatisch gelöscht. - Bitte führen Sie das Update nochmal durch dann sollte diese Meldung nicht mehr erscheinen.'; - } - - /** - * @param string $file - * - * @return bool - */ - private function isDeleteableFile(string $file) - { - if (!is_file($file)) { - return false; - } - $dir = dirname($file); - foreach (self::DELETE_FILE_FOLDERS as $folder) { - if (substr($dir, -strlen($folder)) === $folder) { - return true; - } - } - - return false; - } - - /** - * @example "
The encoded file /var/www/xentral/www/pages/adresse.php requires a license file.
" - * "The license file /var/www/xentral/key.php is corrupt." - * - * @param Throwable $exception - * - * @return string|null - */ - private function extractFileFromIoncubeError($exception) - { - $message = strip_tags($exception->getMessage()); - $theFilePos = stripos($message, 'The File '); - if ($theFilePos === false) { - $theFilePos = strpos($message, 'The encoded file'); - if ($theFilePos === false) { - return null; - } - $theFilePos += 16; - } else { - $theFilePos += 9; - } - $file = trim(substr($message, $theFilePos)); - $file = explode(' ', $file); - - return reset($file); - } } diff --git a/classes/Core/ErrorHandler/ErrorPageData.php b/classes/Core/ErrorHandler/ErrorPageData.php index 469d65df..52a159c1 100644 --- a/classes/Core/ErrorHandler/ErrorPageData.php +++ b/classes/Core/ErrorHandler/ErrorPageData.php @@ -323,15 +323,6 @@ final class ErrorPageData implements JsonSerializable 'ldap' => function () { return function_exists('ldap_connect'); }, - 'ioncube' => function () { - if (!function_exists('ioncube_loader_version')) { - return false; - } - - $ioncubeMajorVersion = (int)@ioncube_loader_version(); - - return $ioncubeMajorVersion >= 5; - }, ]; } diff --git a/classes/Modules/Article/Service/ArticleService.php b/classes/Modules/Article/Service/ArticleService.php index 11b13b54..5e204c5a 100644 --- a/classes/Modules/Article/Service/ArticleService.php +++ b/classes/Modules/Article/Service/ArticleService.php @@ -16,6 +16,7 @@ class ArticleService function CopyArticle(int $id, bool $purchasePrices, bool $sellingPrices, bool $files, bool $properties, bool $instructions, bool $partLists, bool $customFields, string $newArticleNumber = '') { + $newArticleNumber = $this->app->DB->real_escape_string($newArticleNumber); $this->app->DB->MysqlCopyRow('artikel','id',$id); $idnew = $this->app->DB->GetInsertID(); @@ -26,7 +27,7 @@ class ArticleService $this->app->DB->Update("UPDATE artikel SET steuersatz = '$steuersatz' WHERE id = '$idnew' LIMIT 1"); } - $this->app->DB->Update("UPDATE artikel SET nummer='$newArticleNumber' WHERE id='$idnew' LIMIT 1"); + $this->app->DB->Update("UPDATE artikel SET nummer='$newArticleNumber', matrixprodukt = 0 WHERE id='$idnew' LIMIT 1"); if($this->app->DB->Select("SELECT variante_kopie FROM artikel WHERE id = '$id' LIMIT 1")) $this->app->DB->Update("UPDATE artikel SET variante = 1, variante_von = '$id' WHERE id = '$idnew' LIMIT 1"); diff --git a/classes/Modules/GoogleApi/GoogleScope.php b/classes/Modules/GoogleApi/GoogleScope.php index 0bce92b7..b2096a6a 100644 --- a/classes/Modules/GoogleApi/GoogleScope.php +++ b/classes/Modules/GoogleApi/GoogleScope.php @@ -6,9 +6,6 @@ namespace Xentral\Modules\GoogleApi; final class GoogleScope { - /** @var string CLOUDPRINT */ - public const CLOUDPRINT = 'https://www.googleapis.com/auth/cloudprint'; - /** @var string CALENDAR */ public const CALENDAR = 'https://www.googleapis.com/auth/calendar'; diff --git a/classes/Modules/GoogleApi/Service/GoogleAccountGateway.php b/classes/Modules/GoogleApi/Service/GoogleAccountGateway.php index ea694726..e689cbc9 100644 --- a/classes/Modules/GoogleApi/Service/GoogleAccountGateway.php +++ b/classes/Modules/GoogleApi/Service/GoogleAccountGateway.php @@ -213,25 +213,6 @@ final class GoogleAccountGateway return array_values($pairs); } - /** - * Will be removed after Dec 31. 2020 - * - * @deprecated - * - * @codeCoverageIgnore - * - * @return GoogleAccountData - */ - public function getCloudPrintAccount(): GoogleAccountData - { - $accounts = $this->getAccountsByScope(GoogleScope::CLOUDPRINT); - if (count($accounts) < 1) { - throw new GoogleAccountNotFoundException('No cloud printing account available.'); - } - - return $accounts[0]; - } - /** * @param int $accountId * diff --git a/classes/Modules/GoogleCloudPrint/www/js/PrinterGoogleCloudPrint.js b/classes/Modules/GoogleCloudPrint/www/js/PrinterGoogleCloudPrint.js deleted file mode 100644 index 426f1348..00000000 --- a/classes/Modules/GoogleCloudPrint/www/js/PrinterGoogleCloudPrint.js +++ /dev/null @@ -1,109 +0,0 @@ - -/** - * Für die Bedienung der Modul-Oberfläche - */ -var PrinterGoogleCloudPrint = (function ($) { - 'use strict'; - - var me = { - - isInitialized: false, - $apiSelect: null, - $printerSelect: null, - initApiValue: null, - initPrinterValue: null, - printercache: {}, - - /** - * @return void - */ - init: function () { - if (me.isInitialized === true) { - return; - } - me.$apiSelect = $('select[name="google_api"]'); - me.$printerSelect = $('select[name="google_printer"]'); - me.initApiValue = me.$apiSelect.val(); - me.initPrinterValue = me.$printerSelect.val(); - - var options = {}; - $('select[name="google_printer"] option').each( function () { - options[$(this).attr('value')] = $(this).text(); - }); - me.printercache[me.initApiValue] = options; - - me.registerEvents(); - me.isInitialized = true; - }, - - setPrinterSelectOptions: function(options, selected) { - me.$printerSelect.empty(); // remove old options - $.each(options, function(value, display) { - me.$printerSelect.append($('').attr('value', value).text(display)); - }); - if (selected in options) { - me.$printerSelect.val(selected); - } - }, - - /** - * @return {void} - */ - registerEvents: function () { - me.$apiSelect.change(function () { - me.ajaxLoadPrinterOptions(this.value); - }); - }, - - /** - * @param {number} fieldId - * - * @return {void} - */ - ajaxLoadPrinterOptions: function (apiName) { - if (apiName === '') { - return; - } - - if (apiName in me.printercache) { - me.setPrinterSelectOptions(me.printercache[apiName], me.initPrinterValue); - return; - } - - $.ajax({ - url: 'index.php?module=googleapi&action=ajaxprinters', - data: { - api_name: apiName - }, - method: 'post', - dataType: 'json', - beforeSend: function () { - me.$printerSelect.prop('disabled', true); - me.$apiSelect.prop('disabled', true); - App.loading.open(); - }, - complete: function() { - me.$printerSelect.prop('disabled', false); - me.$apiSelect.prop('disabled', false); - }, - error: function (error) { - App.loading.close(); - }, - success: function (data) { - me.printercache[apiName] = data; - me.setPrinterSelectOptions(data, me.initPrinterValue); - App.loading.close(); - } - }); - }, - }; - - return { - init: me.init, - }; - -})(jQuery); - -$(document).ready(function () { - PrinterGoogleCloudPrint.init(); -}); diff --git a/classes/Modules/MatrixProduct/MatrixProductService.php b/classes/Modules/MatrixProduct/MatrixProductService.php index 96933a0a..ee2d0a46 100644 --- a/classes/Modules/MatrixProduct/MatrixProductService.php +++ b/classes/Modules/MatrixProduct/MatrixProductService.php @@ -130,13 +130,25 @@ final class MatrixProductService foreach ($optionArr as $option) { $groupId = $this->gateway->GetArticleGroupIdByName($articleId, $option['groupname']); if (!$groupId) { - $obj = new Group($option['groupname'], nameExternal: $option['groupnameext'], projectId: $option['groupprojekt'], required: $option['grouprequired'], articleId: $articleId); + $obj = new Group( + name: $option['groupname'], + nameExternal: $option['groupnameext'], + projectId: $option['groupprojekt'], + required: $option['grouprequired'], + articleId: $articleId); $group = $this->gateway->InsertArticleGroup($obj); $groupId = $group->id; } $optionId = $this->gateway->GetArticleOptionIdByName($articleId, $groupId, $option['name']); if (!$optionId) { - $obj = new Option($option['name'], $groupId, nameExternal: $option['name_ext'], sort: $option['sort'], globalOptionId: $option['id'], articleId: $articleId); + $obj = new Option( + name: $option['name'], + groupId: $groupId, + nameExternal: $option['name_ext'], + sort: $option['sort'], + articleNumberSuffix: $option['articlenumber_suffix'], + globalOptionId: $option['id'], + articleId: $articleId); $this->gateway->InsertArticleOption($obj); } } diff --git a/classes/Modules/MatrixProduct/www/js/AddGlobalToArticle.vue b/classes/Modules/MatrixProduct/www/js/AddGlobalToArticle.vue index 9897d366..44279bef 100644 --- a/classes/Modules/MatrixProduct/www/js/AddGlobalToArticle.vue +++ b/classes/Modules/MatrixProduct/www/js/AddGlobalToArticle.vue @@ -1,5 +1,5 @@ @@ -9,6 +9,7 @@ import {ref, onMounted} from "vue"; import axios from "axios"; import Dialog from "primevue/dialog"; import Listbox from "primevue/listbox"; +import Fluid from "primevue/fluid"; import Button from "primevue/button"; import {AlertErrorHandler} from '@res/js/ajaxErrorHandler'; @@ -36,17 +37,19 @@ async function save() {