diff --git a/app/Company.php b/app/Company.php index 22e250ed486..0224f62db1c 100644 --- a/app/Company.php +++ b/app/Company.php @@ -40,7 +40,7 @@ class Company extends Base * * @return array|bool */ - public static function getCompany(): array|bool + public static function getCompany() { if (Cache::staticHas('CompanyGet', '')) { return Cache::staticGet('CompanyGet', ''); diff --git a/app/Utils/ConfReport.php b/app/Utils/ConfReport.php index abfb1a89fc1..257cc871b44 100644 --- a/app/Utils/ConfReport.php +++ b/app/Utils/ConfReport.php @@ -326,7 +326,6 @@ class ConfReport public static $environment = [ 'crmVersion' => ['container' => 'env', 'testCli' => false, 'label' => 'CRM_VERSION'], 'crmDate' => ['container' => 'env', 'testCli' => false, 'label' => 'CRM_DATE'], - 'companySize' => ['container' => 'env', 'testCli' => false, 'label' => 'COMPANY_SIZE'], 'operatingSystem' => ['container' => 'env', 'testCli' => true, 'label' => 'OPERATING_SYSTEM'], 'serverSoftware' => ['container' => 'env', 'testCli' => false, 'label' => 'SERVER_SOFTWARE'], 'currentUser' => ['container' => 'env', 'type' => 'CronEqual', 'testCli' => true, 'label' => 'SCRIPT_USER'], @@ -616,7 +615,6 @@ public static function getConfig() 'public_html' => IS_PUBLIC_DIR ? 'On' : 'Off', 'crmVersion' => \App\Version::get(), 'crmDate' => \App\Version::get('patchVersion'), - 'companySize' => \App\Config::main('application_unique_key') ? \App\Company::getSize() : '-', 'crmDir' => ROOT_DIRECTORY, 'operatingSystem' => 'demo' === \App\Config::main('systemMode') ? php_uname('s') : php_uname(), 'serverSoftware' => $_SERVER['SERVER_SOFTWARE'] ?? '-', diff --git a/app/YetiForce/Shop.php b/app/YetiForce/Shop.php index 5aba009df7d..90cfc66b04e 100644 --- a/app/YetiForce/Shop.php +++ b/app/YetiForce/Shop.php @@ -89,7 +89,8 @@ public static function getVariablePayments(): array */ public static function check(string $productName): bool { - $product = new (self::getProductClass($productName))($productName); + $className = self::getProductClass($productName); + $product = new $className($productName); return $product->getStatus(); } @@ -129,7 +130,8 @@ public static function checkWithMessage(string $productName): array */ public static function checkAlert(string $productName): string { - $product = new (self::getProductClass($productName))($productName); + $className = self::getProductClass($productName); + $product = new $className($productName); return $product->getAlertMessage(); } @@ -159,7 +161,8 @@ public static function verify(bool $getNames = false): string $products = \App\YetiForce\Register::getProducts(); foreach ($products ?? [] as $row) { $productName = $row['product']; - $product = new (self::getProductClass($productName))($productName); + $className = self::getProductClass($productName); + $product = new $className($productName); if ($product->isExpired()) { $names[$productName] = $productName; if (!$getNames) { @@ -269,7 +272,8 @@ private function setProducts(array $products) { foreach ($products as $productData) { $name = $productData['name'] ?? ''; - if (!empty($productData['packages']) && ($product = self::getProductClass($name)::fromArray($productData)) && $product->isAvailable()) { + $className = self::getProductClass($name); + if (!empty($productData['packages']) && ($product = $className::fromArray($productData)) && $product->isAvailable()) { self::$productCache[$product->getName()] = $product; } } diff --git a/app/YetiForce/Shop/AbstractBaseProduct.php b/app/YetiForce/Shop/AbstractBaseProduct.php index e458074ca19..66043123fbc 100644 --- a/app/YetiForce/Shop/AbstractBaseProduct.php +++ b/app/YetiForce/Shop/AbstractBaseProduct.php @@ -164,7 +164,7 @@ public function isConfigured(): bool * * @return static */ - public static function fromArray(array $data): static + public static function fromArray(array $data) { $name = $data['name'] ?? ''; $self = new static($name); @@ -256,20 +256,6 @@ public function getPrice(): int return $this->package->getPrice(); } - /** - * Get price label. - * - * @param string $key - * - * @return string - */ - public function getPriceLabel(string $key): string - { - return isset($this->packages[$key]) - ? $this->packages[$key]->getLabel() - : \App\Language::translate('LBL_SHOP_COMPANY_SIZE_' . strtoupper($key), 'Settings::YetiForce'); - } - /** * Get currency code. * diff --git a/install/install_schema/data.sql b/install/install_schema/data.sql index 48fa967c28f..d8f6c6f44e6 100644 --- a/install/install_schema/data.sql +++ b/install/install_schema/data.sql @@ -163,7 +163,6 @@ insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (28,'Log',1,'2020-09-09 12:08:50'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (29,'LoginHistory',1,'2020-09-09 12:08:50'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (30,'Logs',1,'2020-09-09 12:08:50'); -insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (31,'Magento',1,'2020-09-09 12:08:50'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (32,'Mail',1,'2020-09-09 12:08:50'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (33,'MailIntegration',1,'2020-09-09 12:08:50'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (34,'MailSmtp',1,'2020-09-09 12:08:50'); @@ -214,7 +213,6 @@ insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (82,'Kanban',1,'2021-08-13 11:36:47'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (83,'MeetingServices',1,'2021-11-18 16:39:26'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (84,'Media',1,'2022-06-07 17:18:53'); -insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (85,'Wapro',1,'2022-06-13 15:05:10'); insert into `a_yf_settings_modules`(`id`,`name`,`status`,`created_time`) values (86,'RecordCollector',1,'2022-06-27 11:20:43'); /*Data for the table `a_yf_smsnotifier_servers` */ diff --git a/modules/Settings/Companies/models/Module.php b/modules/Settings/Companies/models/Module.php index d7dfed4fb4f..cd66a4c8d5a 100644 --- a/modules/Settings/Companies/models/Module.php +++ b/modules/Settings/Companies/models/Module.php @@ -79,7 +79,7 @@ public function hasCreatePermissions(): bool * * @return array|false */ - public static function getColumnNames(): bool|array + public static function getColumnNames() { $tableSchema = \App\Db::getInstance('admin')->getTableSchema('s_#__companies', true); if ($tableSchema) { @@ -112,7 +112,7 @@ public static function getFormFields(): array * * @return bool|array */ - public function getNameFields(): bool|array + public function getNameFields() { $columnNames = self::getColumnNames(); unset($columnNames[array_search('id', $columnNames)]); diff --git a/modules/Settings/Companies/models/Record.php b/modules/Settings/Companies/models/Record.php index aca4b4638e6..9e947641959 100644 --- a/modules/Settings/Companies/models/Record.php +++ b/modules/Settings/Companies/models/Record.php @@ -51,7 +51,7 @@ public function getEditViewUrl(): string * * @return bool|Settings_Companies_Record_Model instance, if exists */ - public static function getInstance(): bool|self + public static function getInstance() { $db = \App\Db::getInstance('admin'); $row = (new \App\Db\Query())->from('s_#__companies')->one($db); @@ -144,12 +144,22 @@ public function getDisplayValue(string $key): string { $value = $this->get($key) ?? ''; - return match ($key) { - 'tabid' => \App\Module::getModuleName((int) $value), - 'industry' => App\Language::translate($value), - 'country' => \App\Language::translateSingleMod($value, 'Other.Country'), - default => \App\Purifier::encodeHtml($value), - }; + switch ($key) { + case 'tabid': + $value = \App\Module::getModuleName((int) $value); + break; + case 'industry': + $value = App\Language::translate($value); + break; + case 'country': + $value =\App\Language::translateSingleMod($value, 'Other.Country'); + break; + default: + $value =\App\Purifier::encodeHtml($value); + break; + } + + return $value; } /**