Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into REDSHOP-6083
Browse files Browse the repository at this point in the history
  • Loading branch information
H.A committed Aug 11, 2020
2 parents c68645b + 97a90fb commit 53658e3
Show file tree
Hide file tree
Showing 88 changed files with 1,315 additions and 1,562 deletions.
35 changes: 19 additions & 16 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g15/Missing 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g02 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g03 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g05 0 0'
Expand Down Expand Up @@ -195,6 +196,7 @@ pipeline:
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g08 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g10 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g11 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g06 0 0'

05-Group5:
group: 01-tests
Expand All @@ -214,8 +216,8 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g06 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g09 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g11 0 0'

06-Group6:
group: 01-tests
Expand All @@ -235,7 +237,8 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/install/extension 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g13 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g15/Wishlist 0 0'

07-Group7:
group: 01-tests
Expand All @@ -255,8 +258,9 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g13 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g15 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g15/Products/Category 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g16 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g14 0 0'

08-Group8:
group: 01-tests
Expand All @@ -276,8 +280,7 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g15/Products/Category 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g16 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g16 0 0'

09-Group9:
group: 01-tests
Expand All @@ -297,8 +300,8 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g16 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g11 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g12 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g17 0 0'

10-Group10:
group: 01-tests
Expand All @@ -318,9 +321,8 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g12 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g14 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g17 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Plugins/Shipping 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g15/OneStepCheckout 0 0'

11-Group11:
group: 01-tests
Expand All @@ -340,7 +342,8 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Plugins/Shipping 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Module 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Category 0 0'

12-Group12:
group: 01-tests
Expand All @@ -360,9 +363,7 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Module 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/administrator/g15/Wishlist 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Category 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Plugins/payment 0 0'

13-Group13:
group: 01-tests
Expand All @@ -382,7 +383,9 @@ pipeline:
# Waits until Chromedriver is up and running
- while ! nc -z localhost 9515; do sleep 1; done
# Performs test
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g17/Plugins/payment 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g15/Ajax 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/integration/g15/TermsCondition 0 0'
- su www-data -c 'vendor/bin/robo tests:run acceptance/install/extension 0 0'

services:
db:
Expand Down
224 changes: 9 additions & 215 deletions component/admin/controllers/wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,225 +3,19 @@
* @package RedSHOP.Backend
* @subpackage Controller
*
* @copyright Copyright (C) 2008 - 2020 redCOMPONENT.com. All rights reserved.
* @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

defined('_JEXEC') or die;


class RedshopControllerWrapper extends RedshopController
/**
* Controller Wrapper Detail
*
* @package RedSHOP.Backend
* @subpackage Controller
* @since __DEPLOY_VERSION__
*/
class RedshopControllerWrapper extends RedshopControllerForm
{
public function cancel()
{
$this->setRedirect('index.php');
}

/**
* @throws Exception
*/
public function remove()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->get('product_id');
$wrapperIds = $this->input->post->get('cid', [0], 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
\JFactory::getApplication()->enqueueMessage(
\JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_DELETE'),
'warning'
);
}

$result = \Redshop\Wrapper\Helper::removeWrappers($wrapperIds);

if ($result == true) {
$msg = \JText::_('COM_REDSHOP_WRAPPER_DETAIL_DELETED_SUCCESSFULLY');
}

$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl
. '&product_id=' . $productId,
$msg
);
}

/**
* @throws Exception
*/
public function publish()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->get('product_id');
$wrapperIds = $this->input->post->get('cid', array(0), 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
throw new Exception(JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_PUBLISH'));
}

$model = $this->getModel('wrapper_detail');

if (!$model->publish($wrapperIds, 1)) {
echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
}

$msg = JText::_('COM_REDSHOP_WRAPPER_PUBLISHED_SUCCESSFULLY');
$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl . '&product_id=' . $productId,
$msg
);
}

/**
* Proxy for getModel
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config The array of possible config values. Optional.
*
* @return object The model.
*/
public function getModel(
$name = 'Wrapper_detail',
$prefix = 'RedshopModel',
$config = array('ignore_request' => true)
) {
$model = parent::getModel($name, $prefix, $config);

return $model;
}

/**
* logic for unpublish
*
* @access public
* @return void
*/
public function unpublish()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->get('product_id');
$wrapperIds = $this->input->post->get('cid', array(0), 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
throw new Exception(JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_UNPUBLISH'));
}

$model = $this->getModel('wrapper_detail');

if (!$model->publish($wrapperIds, 0)) {
echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
}

$msg = JText::_('COM_REDSHOP_WRAPPER_UNPUBLISHED_SUCCESSFULLY');
$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl . '&product_id=' . $productId,
$msg
);
}

public function enableWrapperUseToAll()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->get('product_id');
$wrapperIds = $this->input->post->get('cid', array(0), 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
throw new Exception(JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_PUBLISH'));
}

$model = $this->getModel('wrapper_detail');

if (!$model->enableWrapperUseToAll($wrapperIds, 1)) {
echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
}

$msg = JText::_('COM_REDSHOP_USE_TO_ALL_ENABLE_SUCCESSFULLY');
$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl . '&product_id=' . $productId,
$msg
);
}

public function enable_defaultunpublish()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->get('product_id');
$wrapperIds = $this->input->post->get('cid', array(0), 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
throw new Exception(JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_UNPUBLISH'));
}

$model = $this->getModel('wrapper_detail');

if (!$model->enableWrapperUseToAll($wrapperIds, 0)) {
echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
}

$msg = JText::_('COM_REDSHOP_USE_TO_ALL_DISABLE_SUCCESSFULLY');
$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl . '&product_id=' . $productId,
$msg
);
}

public function enable_defaultpublish()
{
$showAll = $this->input->get('showall', '0');
$tmpl = '';

if ($showAll) {
$tmpl = '&tmpl=component';
}

$productId = $this->input->post->get('product_id');
$wrapperIds = $this->input->post->get('cid', array(0), 'array');

if (!is_array($wrapperIds) || count($wrapperIds) < 1) {
throw new Exception(JText::_('COM_REDSHOP_SELECT_AN_ITEM_TO_UNPUBLISH'));
}

$model = $this->getModel('wrapper_detail');

if (!$model->enableWrapperUseToAll($wrapperIds, 1)) {
echo "<script> alert('" . $model->getError(true) . "'); window.history.go(-1); </script>\n";
}

$msg = JText::_('COM_REDSHOP_USE_TO_ALL_ENABLE_SUCCESSFULLY');
$this->setRedirect(
'index.php?option=com_redshop&view=wrapper&showall=' . $showAll . $tmpl . '&product_id=' . $productId,
$msg
);
}
}
Loading

0 comments on commit 53658e3

Please sign in to comment.