Skip to content

Commit

Permalink
Merge pull request #153 from leemyongpakvn/remove-unneeded-code
Browse files Browse the repository at this point in the history
Remove unneeded code
  • Loading branch information
Hlavtox authored Mar 2, 2023
2 parents 92733a6 + 0f2105f commit a84f9fb
Showing 1 changed file with 30 additions and 49 deletions.
79 changes: 30 additions & 49 deletions productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,14 @@ public function renderConfigForm()

public function renderModerateLists()
{
require_once dirname(__FILE__) . '/ProductComment.php';
$return = null;

if (Configuration::get('PRODUCT_COMMENTS_MODERATE')) {
$comments = ProductComment::getByValidate(0, false);

$fields_list = $this->getStandardFieldList();

if (version_compare(_PS_VERSION_, '1.6', '<')) {
$return .= '<h1>' . $this->trans('Reviews waiting for approval', [], 'Modules.Productcomments.Admin') . '</h1>';
$actions = ['enable', 'delete'];
} else {
$actions = ['approve', 'delete'];
}
$actions = ['approve', 'delete'];

$helper = new HelperList();
$helper->list_id = 'form-productcomments-moderate-list';
Expand Down Expand Up @@ -532,8 +526,6 @@ public function displayNoabuseLink($token, $id, $name = null)

public function renderCriterionList()
{
include_once dirname(__FILE__) . '/ProductCommentCriterion.php';

$criterions = ProductCommentCriterion::getCriterions($this->context->language->id, false, false);

$fields_list = [
Expand Down Expand Up @@ -577,8 +569,6 @@ public function renderCriterionList()

public function renderCommentsList()
{
require_once dirname(__FILE__) . '/ProductComment.php';

$fields_list = $this->getStandardFieldList();

$helper = new HelperList();
Expand Down Expand Up @@ -733,45 +723,36 @@ public function renderCriterionForm($id_criterion = 0)
}
}

if (version_compare(_PS_VERSION_, '1.6', '<')) {
$field_category_tree = [
'type' => 'categories_select',
'name' => 'categoryBox',
'label' => $this->trans('Criterion will be restricted to the following categories', [], 'Modules.Productcomments.Admin'),
'category_tree' => $this->initCategoriesAssociation(null, $id_criterion),
];
} else {
$field_category_tree = [
'type' => 'categories',
'label' => $this->trans('Criterion will be restricted to the following categories', [], 'Modules.Productcomments.Admin'),
'name' => 'categoryBox',
'desc' => $this->trans('Mark the boxes of categories to which this criterion applies.', [], 'Modules.Productcomments.Admin'),
'tree' => [
'use_search' => false,
'id' => 'categoryBox',
'use_checkbox' => true,
'selected_categories' => $selected_categories,
],
//retro compat 1.5 for category tree
'values' => [
'trads' => [
'Root' => Category::getTopCategory(),
'selected' => $this->trans('Selected', [], 'Modules.Productcomments.Admin'),
'Collapse All' => $this->trans('Collapse All', [], 'Modules.Productcomments.Admin'),
'Expand All' => $this->trans('Expand All', [], 'Modules.Productcomments.Admin'),
'Check All' => $this->trans('Check All', [], 'Modules.Productcomments.Admin'),
'Uncheck All' => $this->trans('Uncheck All', [], 'Modules.Productcomments.Admin'),
],
'selected_cat' => $selected_categories,
'input_name' => 'categoryBox[]',
'use_radio' => false,
'use_search' => false,
'disabled_categories' => [],
'top_category' => Category::getTopCategory(),
'use_context' => true,
$field_category_tree = [
'type' => 'categories',
'label' => $this->trans('Criterion will be restricted to the following categories', [], 'Modules.Productcomments.Admin'),
'name' => 'categoryBox',
'desc' => $this->trans('Mark the boxes of categories to which this criterion applies.', [], 'Modules.Productcomments.Admin'),
'tree' => [
'use_search' => false,
'id' => 'categoryBox',
'use_checkbox' => true,
'selected_categories' => $selected_categories,
],
//retro compat 1.5 for category tree
'values' => [
'trads' => [
'Root' => Category::getTopCategory(),
'selected' => $this->trans('Selected', [], 'Modules.Productcomments.Admin'),
'Collapse All' => $this->trans('Collapse All', [], 'Modules.Productcomments.Admin'),
'Expand All' => $this->trans('Expand All', [], 'Modules.Productcomments.Admin'),
'Check All' => $this->trans('Check All', [], 'Modules.Productcomments.Admin'),
'Uncheck All' => $this->trans('Uncheck All', [], 'Modules.Productcomments.Admin'),
],
];
}
'selected_cat' => $selected_categories,
'input_name' => 'categoryBox[]',
'use_radio' => false,
'use_search' => false,
'disabled_categories' => [],
'top_category' => Category::getTopCategory(),
'use_context' => true,
],
];

$fields_form_1 = [
'form' => [
Expand Down

0 comments on commit a84f9fb

Please sign in to comment.