Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Removed unsupported modules + improvements for php7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rskrzypczak committed Nov 2, 2023
1 parent 39d2d66 commit c3543f4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '');
Expand Down
2 changes: 0 additions & 2 deletions app/Utils/ConfReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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'] ?? '-',
Expand Down
12 changes: 8 additions & 4 deletions app/YetiForce/Shop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}
Expand Down
16 changes: 1 addition & 15 deletions app/YetiForce/Shop/AbstractBaseProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
*
Expand Down
2 changes: 0 additions & 2 deletions install/install_schema/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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` */
Expand Down
4 changes: 2 additions & 2 deletions modules/Settings/Companies/models/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)]);
Expand Down
24 changes: 17 additions & 7 deletions modules/Settings/Companies/models/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit c3543f4

Please sign in to comment.