Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REDSHOP-6006 [J4] - installer doesn't work #5598

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions component/admin/controllers/addquotation_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ public function save($send = 0, $apply = 0)
$user = $userModel->storeUser($post);

if (!$user) {
$errorMsg = $this->_db->getErrorMsg();
$link = Redshop\IO\Route::_('index.php?option=com_redshop&view=addquotation_detail', false);
$this->setRedirect($link, $errorMsg);
$this->setRedirect($link, $userModel->getError());

return false;
}
Expand Down
23 changes: 7 additions & 16 deletions component/admin/controllers/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public function save($key = null, $urlVar = null)

if (!$this->checkEditId($context, $recordId)) {
// Somehow the person just went to the form and tried to save it. We don't allow that.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId), 'error');

// Redirect to the list screen
$this->setRedirect(
Expand All @@ -87,8 +85,7 @@ public function save($key = null, $urlVar = null)
// Check-in the original row.
if ($checkin && $model->checkin($data[$key]) === false) {
// Check-in failed. Go back to the item and display a notice.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand All @@ -106,9 +103,7 @@ public function save($key = null, $urlVar = null)

// Access check.
if (!$this->allowSave($data, $key)) {
/** @scrutinizer ignore-deprecated */
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');

// Redirect to the list screen
$this->setRedirect(
Expand Down Expand Up @@ -167,9 +162,7 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Redirect back to the edit screen.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand All @@ -185,9 +178,7 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Check-in failed, so go back to the record and display a notice.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand All @@ -200,10 +191,10 @@ public function save($key = null, $urlVar = null)
$this->setMessage(
JText::_(
($lang->hasKey(
$this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
$this->text_prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
)
? $this->text_prefix
: 'JLIB_APPLICATION') . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
: 'JLIB_APPLICATION') . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
)
);

Expand Down
13 changes: 7 additions & 6 deletions component/admin/controllers/order_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,13 @@ public function checkoutNext()
// Update order payment table with credit card details
$model->update_ccdata($request['order_id'], $paymentResponse->transaction_id);

$app->redirect(
Redshop\IO\Route::_(
JURI::base() . "index.php?option=com_redshop&view=order_detail&task=edit&cid[]=" . $request['order_id']
),
$paymentResponse->message
);
$app->enqueueMessage($paymentResponse->message);

$app->redirect(
Redshop\IO\Route::_(
JURI::base() . "index.php?option=com_redshop&view=order_detail&task=edit&cid[]=" . $request['order_id']
)
);
}

public function send_invoicemail()
Expand Down
10 changes: 7 additions & 3 deletions component/admin/controllers/prices_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

use Joomla\CMS\Factory;

defined('_JEXEC') or die;


Expand Down Expand Up @@ -52,7 +54,7 @@ public function save($apply = 0)
$type = 'error';
$productId = $this->input->getInt('product_id');
$post['product_currency'] = Redshop::getConfig()->get('CURRENCY_CODE');
$post['cdate'] = time();
$post['cdate'] = Factory::getDate()->format('Y-m-d');
$cid = $this->input->post->get('cid', array(0), 'array');
$post ['price_id'] = $cid [0];

Expand All @@ -67,8 +69,6 @@ public function save($apply = 0)

$row = $model->store($post);

$msg = JText::_('COM_REDSHOP_ERROR_SAVING_PRICE_QUNTITY_DETAIL');

if ($row) {
$type = '';
$msg = JText::_('COM_REDSHOP_PRICE_DETAIL_SAVED');
Expand All @@ -77,6 +77,10 @@ public function save($apply = 0)
} elseif ($post['discount_start_date'] > $post['discount_end_date']) {
$msg = JText::_('COM_REDSHOP_PRODUCT_PRICE_END_DATE_MUST_MORE_THAN_START_DATE');
}
else
{
$msg = $model->getError();
}

if ($apply == 0) {
$this->setRedirect('index.php?option=com_redshop&view=prices&product_id=' . $productId, $msg, $type);
Expand Down
15 changes: 0 additions & 15 deletions component/admin/controllers/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public function importeconomic()
} else {
$errmsg = JText::_('COM_REDSHOP_ERROR_IN_IMPORT_PRODUCT_TO_ECONOMIC');

if (JError::isError(JError::getError())) {
$error = JError::getError();
$errmsg = $error->getMessage();
}

$responcemsg .= "<span style='color: #ff0000'>" . $errmsg . "</span>";
}

Expand Down Expand Up @@ -127,11 +122,6 @@ public function importatteco()
} else {
$errmsg = JText::_('COM_REDSHOP_ERROR_IN_IMPORT_ATTRIBUTES_TO_ECONOMIC');

if (JError::isError(JError::getError())) {
$error = JError::getError();
$errmsg = $error->getMessage();
}

$responcemsg .= "<span style='color: #ff0000'>" . $errmsg . "</span>";
}

Expand Down Expand Up @@ -168,11 +158,6 @@ public function importatteco()
} else {
$errmsg = JText::_('COM_REDSHOP_ERROR_IN_IMPORT_ATTRIBUTES_TO_ECONOMIC');

if (JError::isError(JError::getError())) {
$error = JError::getError();
$errmsg = $error->getMessage();
}

$responcemsg .= "<span style='color: #ff0000'>" . $errmsg . "</span>";
}

Expand Down
6 changes: 4 additions & 2 deletions component/admin/controllers/product_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function saveProduct_Category()
$msg = JText::_('COM_REDSHOP_ERROR_WHILE_ASSIGNING_CATEGORY_TO_PRODUCT');
}

$app->redirect("index.php?option=com_redshop&view=product", $msg);
$app->enqueueMessage($msg);
$app->redirect("index.php?option=com_redshop&view=product");
}

public function removeProduct_Category()
Expand All @@ -43,6 +44,7 @@ public function removeProduct_Category()
$msg = JText::_('COM_REDSHOP_ERROR_WHILE_REMOVING_CATEGORY_FROM_PRODUCT');
}

$app->redirect("index.php?option=com_redshop&view=product", $msg);
$app->enqueueMessage($msg);
$app->redirect("index.php?option=com_redshop&view=product");
}
}
8 changes: 4 additions & 4 deletions component/admin/controllers/product_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public function save($apply = 0)
$selectedTabPosition = $this->input->get('selectedTabPosition');
$this->app->setUserState('com_redshop.product_detail.selectedTabPosition', $selectedTabPosition);

if (is_array($post['product_category'])
&& !in_array($post['cat_in_sefurl'], $post['product_category'])) {
$post['cat_in_sefurl'] = $post['product_category'][0];
}
if (is_array($post['product_category'])
&& (empty($post['cat_in_sefurl']) || !in_array($post['cat_in_sefurl'], $post['product_category']))) {
$post['cat_in_sefurl'] = $post['product_category'][0];
}

$this->checkTask($post);

Expand Down
2 changes: 1 addition & 1 deletion component/admin/controllers/product_price.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function saveprice()
if ($xid && $xid != $priceId[$i]) {
echo $xid;

$this->setError(JText::sprintf('WARNNAMETRYAGAIN', JText::_('COM_REDSHOP_PRICE_ALREADY_EXISTS')));
$this->setMessage(JText::sprintf('WARNNAMETRYAGAIN', JText::_('COM_REDSHOP_PRICE_ALREADY_EXISTS')), 'error');
}

if (!empty($priceId[$i])) {
Expand Down
20 changes: 5 additions & 15 deletions component/admin/controllers/rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public function save($key = null, $urlVar = null)

if (!$this->checkEditId($context, $recordId)) {
// Somehow the person just went to the form and tried to save it. We don't allow that.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId), 'error');

// Redirect to the list screen
$this->setRedirect(
Expand All @@ -85,9 +83,7 @@ public function save($key = null, $urlVar = null)
// Check-in the original row.
if ($checkin && $model->checkin($data[$key]) === false) {
// Check-in failed. Go back to the item and display a notice.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand All @@ -105,9 +101,7 @@ public function save($key = null, $urlVar = null)

// Access check.
if (!$this->allowSave($data, $key)) {
/** @scrutinizer ignore-deprecated */
$this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error');

// Redirect to the list screen
$this->setRedirect(
Expand Down Expand Up @@ -165,9 +159,7 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Redirect back to the edit screen.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand All @@ -183,9 +175,7 @@ public function save($key = null, $urlVar = null)
$app->setUserState($context . '.data', $validData);

// Check-in failed, so go back to the record and display a notice.
/** @scrutinizer ignore-deprecated */
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()));
$this->setMessage(/** @scrutinizer ignore-deprecated */ $this->getError(), 'error');
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'error');

// Redirect back to the edit screen.
$this->setRedirect(
Expand Down
5 changes: 0 additions & 5 deletions component/admin/controllers/stockroom.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public function importStockFromEconomic()
} else {
$errmsg = JText::_('COM_REDSHOP_ERROR_IN_IMPORT_STOCK_FROM_ECONOMIC');

if (JError::isError(JError::getError())) {
$error = JError::getError();
$errmsg = $error->getMessage();
}

$responcemsg .= "<span style='color: #ff0000'>" . $errmsg . "</span>";
}

Expand Down
4 changes: 3 additions & 1 deletion component/admin/controllers/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

use Joomla\CMS\Factory;

defined('_JEXEC') or die;

/**
Expand Down Expand Up @@ -38,7 +40,7 @@ public function duplicate()
$model->duplicate($pks);
$this->setMessage(JText::plural('COM_REDSHOP_N_SUPPLIERS_DUPLICATED', count($pks)));
} catch (Exception $e) {
JError::raiseWarning(500, $e->getMessage());
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}

$this->setRedirect('index.php?option=com_redshop&view=templates');
Expand Down
4 changes: 3 additions & 1 deletion component/admin/controllers/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @license GNU General Public License version 2 or later; see LICENSE
*/

use Joomla\Registry\Registry;

defined('_JEXEC') or die;

/**
Expand Down Expand Up @@ -111,7 +113,7 @@ public function finish()

// Convert array to JRegistry before saving
$configHelper = \Redshop::getConfig();
$config = new \Registry;
$config = new Registry;
$config->loadArray($session->get('redshop.wizard'));

if ($configHelper->save($config)) {
Expand Down
2 changes: 1 addition & 1 deletion component/admin/controllers/xmlexport_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function save($export = 0)

function setChildElement()
{
JHtml::_('behavior.modal');
JHtml::_('bootstrap.modal');

$xmlhelper = new xmlHelper;
$post = $this->input->post->getArray();
Expand Down
Loading