diff --git a/component/admin/controllers/addquotation_detail.php b/component/admin/controllers/addquotation_detail.php index d764d88bf76..229ab5294dc 100644 --- a/component/admin/controllers/addquotation_detail.php +++ b/component/admin/controllers/addquotation_detail.php @@ -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; } diff --git a/component/admin/controllers/category.php b/component/admin/controllers/category.php index ca6b7bf9d3c..180200024be 100644 --- a/component/admin/controllers/category.php +++ b/component/admin/controllers/category.php @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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' ) ); diff --git a/component/admin/controllers/order_detail.php b/component/admin/controllers/order_detail.php index 3c368a0b09f..b055ee0584f 100644 --- a/component/admin/controllers/order_detail.php +++ b/component/admin/controllers/order_detail.php @@ -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() diff --git a/component/admin/controllers/prices_detail.php b/component/admin/controllers/prices_detail.php index d326b2f3387..f5fa6c50d97 100644 --- a/component/admin/controllers/prices_detail.php +++ b/component/admin/controllers/prices_detail.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\Factory; + defined('_JEXEC') or die; @@ -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]; @@ -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'); @@ -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); diff --git a/component/admin/controllers/product.php b/component/admin/controllers/product.php index 9e76ab742a5..8a8c8be3e58 100644 --- a/component/admin/controllers/product.php +++ b/component/admin/controllers/product.php @@ -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 .= "" . $errmsg . ""; } @@ -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 .= "" . $errmsg . ""; } @@ -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 .= "" . $errmsg . ""; } diff --git a/component/admin/controllers/product_category.php b/component/admin/controllers/product_category.php index 4ae1a20c02a..da89aa20396 100644 --- a/component/admin/controllers/product_category.php +++ b/component/admin/controllers/product_category.php @@ -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() @@ -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"); } } diff --git a/component/admin/controllers/product_detail.php b/component/admin/controllers/product_detail.php index 75a1b121b6d..b4f3d1b3f2f 100755 --- a/component/admin/controllers/product_detail.php +++ b/component/admin/controllers/product_detail.php @@ -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); diff --git a/component/admin/controllers/product_price.php b/component/admin/controllers/product_price.php index 24ac0dd6435..5490706a16c 100644 --- a/component/admin/controllers/product_price.php +++ b/component/admin/controllers/product_price.php @@ -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])) { diff --git a/component/admin/controllers/rating.php b/component/admin/controllers/rating.php index e37d79ec268..96e8bee05a1 100644 --- a/component/admin/controllers/rating.php +++ b/component/admin/controllers/rating.php @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( diff --git a/component/admin/controllers/stockroom.php b/component/admin/controllers/stockroom.php index 1261592a794..996afbb6132 100644 --- a/component/admin/controllers/stockroom.php +++ b/component/admin/controllers/stockroom.php @@ -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 .= "" . $errmsg . ""; } diff --git a/component/admin/controllers/templates.php b/component/admin/controllers/templates.php index ec6b90cdde4..66cd98e56c3 100644 --- a/component/admin/controllers/templates.php +++ b/component/admin/controllers/templates.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\Factory; + defined('_JEXEC') or die; /** @@ -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'); diff --git a/component/admin/controllers/wizard.php b/component/admin/controllers/wizard.php index 04499eaae7d..309d69a4bcc 100644 --- a/component/admin/controllers/wizard.php +++ b/component/admin/controllers/wizard.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\Registry\Registry; + defined('_JEXEC') or die; /** @@ -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)) { diff --git a/component/admin/controllers/xmlexport_detail.php b/component/admin/controllers/xmlexport_detail.php index 09dcdb3cde1..d5074e4b24c 100644 --- a/component/admin/controllers/xmlexport_detail.php +++ b/component/admin/controllers/xmlexport_detail.php @@ -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(); diff --git a/component/admin/language/en-GB/en-GB.com_redshop.ini b/component/admin/language/en-GB/en-GB.com_redshop.ini index 895d50c0048..d9b2ad0be48 100644 --- a/component/admin/language/en-GB/en-GB.com_redshop.ini +++ b/component/admin/language/en-GB/en-GB.com_redshop.ini @@ -1552,7 +1552,7 @@ COM_REDSHOP_PRODUCT_IMAGES = "Other Images" COM_REDSHOP_PRODUCT_IMAGE = "Product Image" COM_REDSHOP_ADD_ADDITIONAL_IMAGES = "Add additional images or Media" COM_REDSHOP_DISCOUNT_PRODUCT = "Discount Products" -COM_REDSHOP_DOWNLOAD_FOLDER = "Select a file uploaded to the Server at your "_QQ_"Downloadable product root"_QQ_" folder" +COM_REDSHOP_DOWNLOAD_FOLDER = "Select a file uploaded to the Server at your \"Downloadable product root\" folder" COM_REDSHOP_FILE = "File" COM_REDSHOP_FILES = "Files" COM_REDSHOP_MAIN_IMAGE = "Main Image" @@ -2282,7 +2282,7 @@ COM_REDSHOP_PRODUCT_DETAIL_DELETED_SUCCESSFULLY = "Product deleted successfully" COM_REDSHOP_PRODUCT_DETAIL_PUBLISHED_SUCCESSFULLY = "Product detail published successfully" COM_REDSHOP_PRODUCT_DETAIL_UNPUBLISHED_SUCCESSFULLY = "Product detail unpublished successfully" COM_REDSHOP_PRODUCT_DETAIL_EDITING_CANCELLED = "Product detail editing cancelled" -COM_REDSHOP_ALERT_PRESELECTED_CHECK = ""_QQ_"Allow multiple selection of attributes"_QQ_" was not checked, choosing more than one "_QQ_"Preselected"_QQ_" is not allowed" +COM_REDSHOP_ALERT_PRESELECTED_CHECK = "\"Allow multiple selection of attributes\" was not checked, choosing more than one \"Preselected\" is not allowed" COM_REDSHOP_CATEGORY_MUST_SELECTED = "Category must be selected" COM_REDSHOP_TEMPLATE_MUST_SELECTED = "Template must selected" COM_REDSHOP_PRODUCT_ITEM_MUST_HAVE_A_NAME = "Product item must have a name" @@ -3357,8 +3357,8 @@ COM_REDSHOP_WARNING_TO_DELETE = "Are you sure you want to delete" COM_REDSHOP_ACCOUNT_LINK = "Account Link" COM_REDSHOP_PRODUCT_HOVER_IMAGE_ENABLE_LBL = "Product Hover Image Enable" COM_REDSHOP_AUTOGENERATE_XMLFILE = "Link for autogenerate xml file" -COM_REDSHOP_ORDER_DOWNLOAD_INVOICE_LINK = "Multiple invoice is generating and can be download %s" -COM_REDSHOP_ORDER_DOWNLOAD_LABEL = "Link for download %s" +COM_REDSHOP_ORDER_DOWNLOAD_INVOICE_LINK = "Multiple invoice is generating and can be download %s" +COM_REDSHOP_ORDER_DOWNLOAD_LABEL = "Link for download %s" COM_REDSHOP_OTHER_INFORMATION = "Other information" COM_REDSHOP_ORDER_DISCOUNT_INVALID = "Value of Discount can not larger than Order Subtotal" COM_REDSHOP_ORDER_DISCOUNT_NOT_LESS_THAN_ZERO = "Valud of Discount can not less than zero" @@ -3381,8 +3381,8 @@ COM_REDSHOP_NO_ITEM_SELECTED = "No item selected" ; WIZARD SECTION COM_REDSHOP_COMPONENT_NAME = "redSHOP" -COM_REDSHOP_BY_LINK = "by redcomponent.com" -COM_REDSHOP_TERMS_AND_CONDITION = "Released under the terms and conditions of the GNU General Public License." +COM_REDSHOP_BY_LINK = "by redcomponent.com" +COM_REDSHOP_TERMS_AND_CONDITION = "Released under the terms and conditions of the GNU General Public License." COM_REDSHOP_CHECK_UPDATES = "* Remember to check for updates on" ; CONFIG SECTION @@ -4118,7 +4118,7 @@ COM_REDSHOP_TEMPLATE_TAG_ATTRIBUTE_WITH_CART_WITHOUT_VAT = "{without_vat} %s Pro COM_REDSHOP_TEMPLATE_TAG_COMPARE_PRODUCT_REMOVE_ALL = "{remove_all} %s Remove all items" COM_REDSHOP_TEMPLATE_TAG_COMPARE_PRODUCT_RETURNTOCATEGORY_NAME = "{returntocategory_name} %s Return to Category Name" COM_REDSHOP_TEMPLATE_TAG_COMPARE_PRODUCT_RETURNTOCATEGORY_LINK = "{returntocategory_link} %s Return to Category Link" -COM_REDSHOP_FIELDS_MEDIA_DEPRECATED = "The media type is deprecated, please use content plugin to parse media on your page. Read more." +COM_REDSHOP_FIELDS_MEDIA_DEPRECATED = "The media type is deprecated, please use content plugin to parse media on your page. Read more." ; Credit Card Types COM_REDSHOP_CARD_TYPE_ALL = "Select All Cards" @@ -4167,7 +4167,7 @@ COM_REDSHOP_ALERT_VIEW_ALL = "Read all" COM_REDSHOP_SELECT_IMAGE = "Select Image" COM_REDSHOP_ADDITIONAL_INFORMATION = "Additional Information" COM_REDSHOP_PRODUCT_MEASURES = "Product Measures" -COM_REDSHOP_UPLOAD_IMAGE_WARNING = "The image will change after you click on save" +COM_REDSHOP_UPLOAD_IMAGE_WARNING = "The image will change after you click on save" COM_REDSHOP_LOGIN_TEMPLATE = "Login Template" COM_REDSHOP_DEFAULT_STOCKROOM_BELOW_AMOUNT_NUMBER_LBL = "Alert below amount number" COM_REDSHOP_CONFIG_LOAD_REDSHOP_STYLE_LBL = "Do you want to load redSHOP style?" @@ -4386,7 +4386,7 @@ COM_REDSHOP_MASS_DISCOUNT_ENDDATE_LOWER_STARTDATE = "Enddate is lower than start ; PDF Generator COM_REDSHOP_ERROR_MISSING_PDF_PLUGIN = "Error! There are no available PDF library. Please install at least one plugin for use this feature." COM_REDSHOP_ERROR_GENERATE_PDF = "Error! There are some problem when generate PDF file." -COM_REDSHOP_WARNING_MISSING_PDF_PLUGIN = "PDF features has been disabled because system does not find any PDF library available." +COM_REDSHOP_WARNING_MISSING_PDF_PLUGIN = "PDF features has been disabled because system does not find any PDF library available." ; Mass changing order status & order payment status in order backend COM_REDSHOP_MASS_CHANGE_STATUS_ORDER = "Change status of multi-order" @@ -4398,13 +4398,13 @@ COM_REDSHOP_EXPORT_STEP_2 = "Step 2. Configuration" COM_REDSHOP_EXPORT_STEP_3 = "Step 3. Process" COM_REDSHOP_EXPORT_LOG = "Log" COM_REDSHOP_EXPORT_DONE = "Done" -COM_REDSHOP_EXPORT_WARNING_MISSING_PLUGIN = "There are no available plugins for Export features." +COM_REDSHOP_EXPORT_WARNING_MISSING_PLUGIN = "There are no available plugins for Export features." COM_REDSHOP_EXPORT_CONFIG_SEPARATOR = "Separator" ; Import COM_REDSHOP_IMPORT_CONFIGURATION = "Import configuration" COM_REDSHOP_IMPORT_SELECT_TYPE = "Select Import Scope" -COM_REDSHOP_IMPORT_WARNING_MISSING_PLUGIN = "There are no available plugins for Import features." +COM_REDSHOP_IMPORT_WARNING_MISSING_PLUGIN = "There are no available plugins for Import features." COM_REDSHOP_IMPORT_STEP_1 = "1. Select import" COM_REDSHOP_IMPORT_STEP_2 = "2. Configuration" COM_REDSHOP_IMPORT_STEP_3 = "3. Upload file" @@ -4963,3 +4963,4 @@ COM_REDSHOP_PROMOTION_CONDITION_TO_DATE="To" COM_REDSHOP_PROMOTION_CONDITION_ORDER_VOLUME="Order volume" COM_REDSHOP_PLEASE_ENTER_DELIVERY_TIME_NOT_LESS_THAN_ZERO="Please enter delivery time not less than zero" +JSEARCH_TOOLS="Search Tools" \ No newline at end of file diff --git a/component/admin/language/en-GB/en-GB.com_redshop.sys.ini b/component/admin/language/en-GB/en-GB.com_redshop.sys.ini index 3fe53fe2b9e..7c07057632f 100644 --- a/component/admin/language/en-GB/en-GB.com_redshop.sys.ini +++ b/component/admin/language/en-GB/en-GB.com_redshop.sys.ini @@ -119,8 +119,8 @@ COM_REDSHOP_REGISTRATION_REDIRECTION_PAGE_DESC = "Please select Redirection Menu ; INSTALLATION AND UPDATE SECTION COM_REDSHOP_COMPONENT_NAME = "redSHOP" -COM_REDSHOP_BY_LINK = "by redcomponent.com" -COM_REDSHOP_TERMS_AND_CONDITION = "Released under the terms and conditions of the GNU General Public License." +COM_REDSHOP_BY_LINK = "by redcomponent.com" +COM_REDSHOP_TERMS_AND_CONDITION = "Released under the terms and conditions of the GNU General Public License." COM_REDSHOP_CHECK_UPDATES = "Remember to check for updates on" COM_REDSHOP_INSTALL_KLARNA_INFO = "We now support %s as one of our default payment methods." diff --git a/component/admin/layouts/component/assets.php b/component/admin/layouts/component/assets.php index b9f492337ec..3bf4d7cf95f 100644 --- a/component/admin/layouts/component/assets.php +++ b/component/admin/layouts/component/assets.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JHtml::_('behavior.framework'); +JHtml::_('redshopjquery.framework'); JHtml::_('bootstrap.tooltip'); JHtml::_( 'redshopjquery.select2', diff --git a/component/admin/layouts/component/full/content/header.php b/component/admin/layouts/component/full/content/header.php index d8598ed3f01..c635c5c2975 100644 --- a/component/admin/layouts/component/full/content/header.php +++ b/component/admin/layouts/component/full/content/header.php @@ -22,7 +22,7 @@ ?>
- JComponentTitle; ?> + get('JComponentTitle'); ?>
> diff --git a/component/admin/layouts/joomla/form/renderfield.php b/component/admin/layouts/joomla/form/renderfield.php index 782954a49e8..d8e0fd3f02b 100644 --- a/component/admin/layouts/joomla/form/renderfield.php +++ b/component/admin/layouts/joomla/form/renderfield.php @@ -18,7 +18,7 @@ */ if (!empty($displayData['options']['showonEnabled'])) { - JHtml::_('jquery.framework'); + JHtml::_('redshopjquery.framework'); JHtml::_('script', 'jui/cms.js', false, true); } diff --git a/component/admin/layouts/newsletter/field_template.php b/component/admin/layouts/newsletter/field_template.php index 6933f752722..616e13dcb42 100644 --- a/component/admin/layouts/newsletter/field_template.php +++ b/component/admin/layouts/newsletter/field_template.php @@ -7,8 +7,13 @@ * @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); + /** * Layout variables * ====================================== @@ -23,13 +28,9 @@
- - - + get('USE_STOCKROOM')): ?> - - +
@@ -177,13 +181,13 @@ class="key_prop"/> - - +
diff --git a/component/admin/layouts/product_detail/product_subproperty.php b/component/admin/layouts/product_detail/product_subproperty.php index 7e53ddb20aa..2bd179b23da 100644 --- a/component/admin/layouts/product_detail/product_subproperty.php +++ b/component/admin/layouts/product_detail/product_subproperty.php @@ -108,23 +108,26 @@ - - + get('USE_STOCKROOM')): ?> - - + @@ -176,16 +179,16 @@ class="btn btn-danger delete_subproperty" type="button"/> ?> - - + diff --git a/component/admin/layouts/searchtools/default/filters.php b/component/admin/layouts/searchtools/default/filters.php index 89e99f25c38..76af3ab27e3 100755 --- a/component/admin/layouts/searchtools/default/filters.php +++ b/component/admin/layouts/searchtools/default/filters.php @@ -49,7 +49,7 @@ getAttribute('dataShowOn')) { - JHtml::_('jquery.framework'); + JHtml::_('redshopjquery.framework'); JHtml::_('script', 'jui/cms.js', false, true); $showOn = " data-showon='" . $showOnData . "'"; } diff --git a/component/admin/layouts/shopper_group/logo.php b/component/admin/layouts/shopper_group/logo.php index caae74914c5..c507a48d88a 100644 --- a/component/admin/layouts/shopper_group/logo.php +++ b/component/admin/layouts/shopper_group/logo.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); + /** * Layout variables * ====================================== diff --git a/component/admin/layouts/wrapper/image.php b/component/admin/layouts/wrapper/image.php index facb0b04f02..91924665cb0 100644 --- a/component/admin/layouts/wrapper/image.php +++ b/component/admin/layouts/wrapper/image.php @@ -8,7 +8,7 @@ * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); + /** * Layout variables * ====================================== diff --git a/component/admin/models/accountgroup_detail.php b/component/admin/models/accountgroup_detail.php index 2bb7cd5eef0..9a90de03055 100644 --- a/component/admin/models/accountgroup_detail.php +++ b/component/admin/models/accountgroup_detail.php @@ -120,13 +120,13 @@ public function store($data) $row = $this->getTable(); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } diff --git a/component/admin/models/addorder_detail.php b/component/admin/models/addorder_detail.php index fe4c33d3f10..11aedc26df6 100644 --- a/component/admin/models/addorder_detail.php +++ b/component/admin/models/addorder_detail.php @@ -212,7 +212,7 @@ public function store($postdata) if (!$row->bind($postdata)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -223,7 +223,7 @@ public function store($postdata) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -309,7 +309,7 @@ public function store($postdata) if (!$rowitem->bind($postdata)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } @@ -361,7 +361,7 @@ public function store($postdata) if (!$rowitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } @@ -404,7 +404,7 @@ public function store($postdata) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -446,7 +446,7 @@ public function store($postdata) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -486,7 +486,7 @@ public function store($postdata) if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $rowattitem->getError() ); return false; @@ -519,7 +519,7 @@ public function store($postdata) if ($accessoryId > 0) { if (!$rowaccitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowaccitem->getError()); return false; } @@ -546,7 +546,7 @@ public function store($postdata) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -584,7 +584,7 @@ public function store($postdata) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -622,7 +622,7 @@ public function store($postdata) if ($subPropertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -652,20 +652,19 @@ public function store($postdata) if (!$rowpayment->bind($postdata)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowpayment->getError()); return false; } $rowpayment->order_id = $row->order_id; - $rowpayment->payment_method_id = $postdata['payment_method_class']; $rowpayment->order_payment_amount = $row->order_total; $rowpayment->order_payment_name = $postdata['order_payment_name']; $rowpayment->payment_method_class = $postdata['payment_method_class']; if (!$rowpayment->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowpayment->getError()); return false; } @@ -677,7 +676,7 @@ public function store($postdata) if (!$orderuserrow->bind($userrow)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderuserrow->getError()); return false; } @@ -687,7 +686,7 @@ public function store($postdata) if (!$orderuserrow->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderuserrow->getError()); return false; } @@ -703,7 +702,7 @@ public function store($postdata) if (!$orderuserrow->bind($userrow)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderuserrow->getError()); return false; } @@ -713,7 +712,7 @@ public function store($postdata) if (!$orderuserrow->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderuserrow->getError()); return false; } diff --git a/component/admin/models/addquotation_detail.php b/component/admin/models/addquotation_detail.php index e7862480a7a..4602869c203 100644 --- a/component/admin/models/addquotation_detail.php +++ b/component/admin/models/addquotation_detail.php @@ -61,14 +61,14 @@ public function storeShipping($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -79,14 +79,14 @@ public function storeShipping($data) if (!$rowsh->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowsh->getError()); return false; } if (!$rowsh->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowsh->getError()); return 0; } @@ -116,7 +116,7 @@ public function store($data) if (!$userRow->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $userRow->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $userRow->getError()); return false; } @@ -140,7 +140,7 @@ public function store($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -149,7 +149,7 @@ public function store($data) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -223,14 +223,14 @@ public function store($data) if (!$rowitem->bind($quotation_item[$i])) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } if (!$rowitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } @@ -288,7 +288,7 @@ public function store($data) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -330,7 +330,7 @@ public function store($data) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -370,7 +370,7 @@ public function store($data) if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $rowattitem->getError() ); return false; @@ -403,7 +403,7 @@ public function store($data) if ($accessoryId > 0) { if (!$rowaccitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowaccitem->getError()); return false; } @@ -430,7 +430,7 @@ public function store($data) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -473,7 +473,7 @@ public function store($data) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -515,7 +515,7 @@ public function store($data) if ($subPropertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } diff --git a/component/admin/models/alert_detail.php b/component/admin/models/alert_detail.php index 89907594c38..3dcad33157b 100644 --- a/component/admin/models/alert_detail.php +++ b/component/admin/models/alert_detail.php @@ -47,13 +47,7 @@ public function delete($cid = array()) ->delete($db->qn('#__redshop_alerts')) ->where($conditions); - $db->setQuery($query); - - if (!$db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); } return true; @@ -79,13 +73,7 @@ public function read($cid = array(), $read = 1) ->set($fields) ->where($conditions); - $db->setQuery($query); - - if (!$db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/attribute_set_detail.php b/component/admin/models/attribute_set_detail.php index fe5bf034750..3f101f11efb 100644 --- a/component/admin/models/attribute_set_detail.php +++ b/component/admin/models/attribute_set_detail.php @@ -100,29 +100,14 @@ public function delete($cid = array()) } $attr_delete = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute WHERE attribute_id =' . $imagename->attribute_id; - $this->_db->setQuery($attr_delete); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->setQuery($attr_delete)->execute(); $prop_delete = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute_property WHERE attribute_id =' . $imagename->attribute_id; - $this->_db->setQuery($prop_delete); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->setQuery($prop_delete)->execute(); } $query = 'DELETE FROM ' . $this->_table_prefix . 'attribute_set WHERE attribute_set_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->setQuery($query)->execute(); } return true; @@ -135,14 +120,7 @@ public function publish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'attribute_set' . ' SET published = ' . intval($publish) . ' WHERE attribute_set_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -282,25 +260,11 @@ public function deleteattr($cid = array()) $query = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute WHERE attribute_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute_property WHERE attribute_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } @@ -333,24 +297,10 @@ public function deleteprop($cid = array(), $image_name) } $query = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute_property WHERE property_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->_db->setQuery($query)->execute(); - return false; - } else { - $query = 'DELETE FROM ' . $this->_table_prefix . 'product_subattribute_color WHERE subattribute_id IN (' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } - } + $query = 'DELETE FROM ' . $this->_table_prefix . 'product_subattribute_color WHERE subattribute_id IN (' . $cids . ' )'; + $this->_db->setQuery($query)->execute(); } } @@ -377,14 +327,7 @@ public function deleteattr_current($cid = array()) $query = 'DELETE FROM ' . $this->_table_prefix . 'product_attribute_property WHERE attribute_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } @@ -394,14 +337,14 @@ public function store_attr($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -416,7 +359,7 @@ public function store_pro($data) if (!$row->bind($data) || !$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -433,14 +376,14 @@ public function store_sub($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -466,14 +409,7 @@ public function property_more_img($post, $main_img, $sub_img) $query = "UPDATE " . $this->_table_prefix . "product_attribute_property SET property_main_image = '" . $main_name . "' WHERE property_id ='" . $post['section_id'] . "' "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } @@ -500,14 +436,7 @@ public function property_more_img($post, $main_img, $sub_img) $query = "INSERT INTO " . $this->_table_prefix . "media (`media_id`,`media_name`,`media_section`,`section_id`,`media_type`,`media_mimetype`,`published`) VALUES ('','" . $sub_name . "','property','" . $post['section_id'] . "','images','" . $sub_type . "','1') "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } } @@ -533,14 +462,7 @@ public function deletesubimage($mediaid) $query = 'DELETE FROM ' . $this->_table_prefix . 'media WHERE media_id = ' . $mediaid; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); return true; } @@ -588,14 +510,7 @@ public function subattribute_color($post, $sub_img) $sub_name . "',`subattribute_id` = '" . $post['section_id'] . "' WHERE subattribute_color_id = '" . $post['subattribute_color_id'][$i] . "'"; } - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } else { if ($post['property_sub_img_tmp'][$i] != "" && $sub_img['name'][$i] == "") { @@ -604,14 +519,7 @@ public function subattribute_color($post, $sub_img) $post['property_sub_img_tmp'][$i] . "',`subattribute_id` = '" . $post['section_id'] . "' WHERE subattribute_color_id = '" . $post['subattribute_color_id'][$i] . "'"; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } } @@ -637,14 +545,7 @@ public function delsubattr_diff($subattr_diff) $query = 'DELETE FROM ' . $this->_table_prefix . 'product_subattribute_color WHERE subattribute_color_id = "' . $diff->subattribute_color_id . '"'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -814,14 +715,14 @@ public function copy($cid = array()) // Bind and save data into 'product_attribute' if (!$row->bind($attribute)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -896,14 +797,14 @@ public function copy($cid = array()) // Bind and save data into 'product_attribute_property' if (!$row->bind($attribute_properties)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -1019,7 +920,7 @@ public function copy($cid = array()) if (!$row->bind($sub_attribute_properties)) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $row->getError() ); return false; @@ -1028,7 +929,7 @@ public function copy($cid = array()) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $row->getError() ); return false; @@ -1100,14 +1001,14 @@ public function store($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -1131,7 +1032,7 @@ public function copyadditionalImage($data) if (!$rowmedia->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } @@ -1143,7 +1044,7 @@ public function copyadditionalImage($data) if (!$rowmedia->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } @@ -1181,14 +1082,14 @@ public function save_product_attribute_price($product_attribute_price, $section) // Bind and save data into 'attributeprices_detail' if (!$row->bind($attribute)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } diff --git a/component/admin/models/barcode.php b/component/admin/models/barcode.php index 6a3432b41a4..283d40556ae 100644 --- a/component/admin/models/barcode.php +++ b/component/admin/models/barcode.php @@ -39,13 +39,13 @@ public function save($data) $row = $this->getTable('barcode'); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } diff --git a/component/admin/models/catalog_request.php b/component/admin/models/catalog_request.php index 43945323a4e..215951890a2 100644 --- a/component/admin/models/catalog_request.php +++ b/component/admin/models/catalog_request.php @@ -107,13 +107,7 @@ public function delete($cid = array()) $cids = implode(',', $cid); $query = 'DELETE FROM ' . $this->_table_prefix . 'catalog_request WHERE catalog_user_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -127,13 +121,7 @@ public function publish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'catalog_request' . ' SET block = ' . intval($publish) . ' WHERE catalog_user_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/categories.php b/component/admin/models/categories.php index bb487f73c7f..bdaf0ccb74d 100644 --- a/component/admin/models/categories.php +++ b/component/admin/models/categories.php @@ -73,11 +73,7 @@ public function assignTemplate($data) ->set($fields) ->where($conditions); - if (!$db->setQuery($query)->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/category.php b/component/admin/models/category.php index 76a498bd17e..fc8ab7d8663 100644 --- a/component/admin/models/category.php +++ b/component/admin/models/category.php @@ -63,7 +63,7 @@ public function getForm($data = array(), $loadData = true) public function getExtraFields($item) { $templateDesc = RedshopHelperTemplate::getTemplate('category', $item->template, ''); - $template = $templateDesc[0]->template_desc; + $template = $templateDesc[0]->template_desc ?? ''; $regex = '/{rs_[\w]{1,}\}/'; preg_match_all($regex, $template, $matches); @@ -215,9 +215,13 @@ public function saveCategory(&$data) $row->setOption('media', $dropzoneMedia); } - if (!$row->store()) { - return false; - } + if (!$row->store()) + { + /** @scrutinizer ignore-deprecated */ + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); + + return false; + } $data['id'] = $row->id; @@ -314,7 +318,7 @@ public function productAccessoriesStore($categoryId) if (!$accessoryTable->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $accessoryTable->getError()); return false; } diff --git a/component/admin/models/import_vm.php b/component/admin/models/import_vm.php index e2d48cb5376..1c9169a30cc 100755 --- a/component/admin/models/import_vm.php +++ b/component/admin/models/import_vm.php @@ -933,11 +933,7 @@ public function syncProduct($index) . 'VALUES (' . $table->product_id . ',' . Redshop::getConfig()->get( 'DEFAULT_STOCKROOM' ) . ',' . $productInStock . ')'; - $db->setQuery($stockQuery); - - if ( ! $db->execute()) { - $this->setError($db->getErrorMsg()); - } + $db->setQuery($stockQuery)->execute(); } // Product images diff --git a/component/admin/models/media.php b/component/admin/models/media.php index 3aa21ac49c8..ff61a71f789 100644 --- a/component/admin/models/media.php +++ b/component/admin/models/media.php @@ -236,13 +236,13 @@ public function store($data) $row = $this->getTable('media_download'); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -271,13 +271,7 @@ public function deleteAddtionalFiles($fileId) } $query = "DELETE FROM `#__redshop_media_download` WHERE `id`='" . $fileId . "' "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); return true; } @@ -297,7 +291,7 @@ public function saveorder($cid = array(), $order) $row->ordering = $order[$i]; if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -373,13 +367,7 @@ public function deleteFile($id) $query = $db->getQuery(true) ->delete($db->qn('#__redshop_media')) ->where($db->qn('media_id') . ' = ' . $id); - $db->setQuery($query); - - if (!$db->execute()) { - $this->setError($db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); return true; } @@ -402,11 +390,7 @@ public function newFile($file) $fileObj->media_mimetype = $file['media_mimetype']; $fileObj->published = 1; - if (!$db->insertObject('#__redshop_media', $fileObj)) { - $this->setError($db->getErrorMsg()); - - return false; - } + $db->insertObject('#__redshop_media', $fileObj); return $db->insertid(); } diff --git a/component/admin/models/media_detail.php b/component/admin/models/media_detail.php index 83209333411..74220503973 100644 --- a/component/admin/models/media_detail.php +++ b/component/admin/models/media_detail.php @@ -26,8 +26,12 @@ public function __construct() { parent::__construct(); $this->_table_prefix = '#__redshop_'; - $array = JFactory::getApplication()->input->get('cid', 0, 'array'); - $this->setId((int)$array[0]); + $array = JFactory::getApplication()->input->get('cid', [], 'array'); + + if (array_key_exists(0, $array)) + { + $this->setId((int) $array[0]); + } } public function setId($id) @@ -129,14 +133,14 @@ public function store($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -251,14 +255,7 @@ public function delete($cid = array()) } $query = 'DELETE FROM ' . $this->_table_prefix . 'media WHERE media_id IN ( ' . $mediadata->media_id . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } } @@ -273,14 +270,7 @@ public function publish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'media' . ' SET published = ' . intval($publish) . ' WHERE media_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -303,40 +293,19 @@ public function defaultmedia($media_id = 0, $section_id = 0, $media_section = "" $query = "UPDATE `" . $this->_table_prefix . "product` " . "SET `product_thumb_image` = '', `product_full_image` = '" . $rs->media_name . "' " . "WHERE `product_id`='" . $section_id . "' "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); break; case "property": $query = "UPDATE `" . $this->_table_prefix . "product_attribute_property` " . "SET `property_main_image` = '" . $rs->media_name . "' " . "WHERE `property_id`='" . $section_id . "' "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); break; case "subproperty": $query = "UPDATE `" . $this->_table_prefix . "product_subattribute_color` " . "SET `subattribute_color_main_image` = '" . $rs->media_name . "' " . "WHERE `subattribute_color_id`='" . $section_id . "' "; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); break; } } else { @@ -381,7 +350,7 @@ public function saveorder($cid = array(), $order) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } diff --git a/component/admin/models/order.php b/component/admin/models/order.php index 1831a19c783..c7367fd7f6f 100644 --- a/component/admin/models/order.php +++ b/component/admin/models/order.php @@ -149,7 +149,7 @@ public function _buildQuery() $query->order($db->escape($filterOrder . ' ' . $filterOrderDir)); // Get the dispatcher and load the users plugins. - $dispatcher = JEventDispatcher::getInstance(); + $dispatcher = RedshopHelperUtility::getDispatcher(); JPluginHelper::importPlugin('redshop'); // Trigger the data preparation event. diff --git a/component/admin/models/order_detail.php b/component/admin/models/order_detail.php index 0f4dc8870a1..f00cb21409e 100644 --- a/component/admin/models/order_detail.php +++ b/component/admin/models/order_detail.php @@ -103,14 +103,14 @@ public function store($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -165,44 +165,16 @@ public function delete($cid = array()) } $query = 'DELETE FROM ' . $this->_table_prefix . 'orders WHERE order_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'order_item WHERE order_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'order_payment WHERE order_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'order_users_info WHERE order_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $quotation = RedshopHelperQuotation::getQuotationWithOrder($cids); @@ -212,37 +184,16 @@ public function delete($cid = array()) for ($j = 0, $jn = count($quotation_item); $j < $jn; $j++) { $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_fields_data ' . 'WHERE quotation_item_id=' . $quotation_item[$j]->quotation_item_id; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_item ' . 'WHERE quotation_id=' . $quotation[$q]->quotation_id; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation WHERE order_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -367,7 +318,7 @@ public function neworderitem($data, $quantity, $order_item_id) if (!$orderitemdata->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderitemdata->getError()); return false; } @@ -410,7 +361,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -453,7 +404,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -494,7 +445,7 @@ public function neworderitem($data, $quantity, $order_item_id) if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $rowattitem->getError() ); return false; @@ -527,7 +478,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($accessoryId > 0) { if (!$rowaccitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowaccitem->getError()); return false; } @@ -554,7 +505,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -591,7 +542,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -633,7 +584,7 @@ public function neworderitem($data, $quantity, $order_item_id) if ($subPropertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -717,17 +668,10 @@ public function delete_item($data) $query = $db->getQuery(true) ->delete($db->qn('#__redshop_order_item')) ->where($db->qn('order_item_id') . ' = ' . $orderItem->getId()); - $db->setQuery($query); + $db->setQuery($query)->execute(); unset($orderItem); - if (!$db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg()); - - return false; - } - $this->updateAttributeItem($orderItemId, $orderItemQuantity); // Remove order item attribute @@ -1288,7 +1232,7 @@ public function update_ccdata($order_id, $payment_transaction_id) $order_payment_cardname = base64_encode($ccdata['order_payment_name']); $order_payment_number = base64_encode($ccdata['order_payment_number']); $order_payment_ccv = base64_encode($ccdata['credit_card_code']); - $order_payment_expire = $ccdata['order_payment_expire_month'] . $ccdata['order_payment_expire_year']; + $order_payment_expire = (int) ($ccdata['order_payment_expire_month'] . $ccdata['order_payment_expire_year']); $payment_update = "UPDATE " . $this->_table_prefix . "order_payment " . " SET order_payment_code = '" . $order_payment_code . "' ," diff --git a/component/admin/models/prices_detail.php b/component/admin/models/prices_detail.php index 62610cde141..e9270c51759 100644 --- a/component/admin/models/prices_detail.php +++ b/component/admin/models/prices_detail.php @@ -93,8 +93,6 @@ public function _initData() } else { $detail = new stdClass; $detail->price_id = 0; - $detail->product_id = $this->_prodid; - $detail->product_name = $this->_prodname; $detail->product_price = 0.00; $detail->product_currency = null; $detail->shopper_group_id = 0; @@ -106,6 +104,9 @@ public function _initData() $detail->discount_end_date = 0; } + $detail->product_id = $this->_prodid; + $detail->product_name = $this->_prodname; + $this->_data = $detail; return (boolean)$this->_data; @@ -124,19 +125,19 @@ public function store($data) $row = $this->getTable(); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->check()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -153,7 +154,7 @@ public function delete($cid = array()) $this->_db->setQuery($query); if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } diff --git a/component/admin/models/product.php b/component/admin/models/product.php index 46589d3a003..752dbcf2af5 100644 --- a/component/admin/models/product.php +++ b/component/admin/models/product.php @@ -366,14 +366,7 @@ public function assignTemplate($data) $cids = implode(',', $cid); $query = 'UPDATE #__redshop_product' . ' SET `product_template` = "' . intval($product_template) . '" ' . ' WHERE product_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/product_detail.php b/component/admin/models/product_detail.php index 702fa5bdb2f..555d6281805 100644 --- a/component/admin/models/product_detail.php +++ b/component/admin/models/product_detail.php @@ -7,6 +7,10 @@ * @copyright Copyright (C) 2008 - 2020 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\Factory; +use Joomla\Utilities\ArrayHelper; + defined('_JEXEC') or die; jimport('joomla.client.helper'); @@ -134,11 +138,11 @@ public function _initData() // ToDo: This is potentially unsafe because $_POST elements are not sanitized. $data = $this->input->post->getArray(); - $data['product_desc'] = JFilterInput::getInstance(null, null, 1, 1)->clean( + $data['product_desc'] = JFilterInput::getInstance([], [], 1, 1)->clean( $this->input->get('product_desc', '', 'RAW'), 'html' ); - $data['product_s_desc'] = JFilterInput::getInstance(null, null, 1, 1)->clean( + $data['product_s_desc'] = JFilterInput::getInstance([], [], 1, 1)->clean( $this->input->get('product_s_desc', '', 'RAW'), 'html' ); @@ -299,26 +303,17 @@ public function delete($cid = array()) $imagename->property_id . '" '; $this->_db->setQuery($subattr_delete); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); $attr_delete = 'DELETE FROM ' . $this->table_prefix . 'product_attribute WHERE attribute_id ="' . $imagename->attribute_id . '" '; $this->_db->setQuery($attr_delete); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); $prop_delete = 'DELETE FROM ' . $this->table_prefix . 'product_attribute_property WHERE attribute_id ="' . $imagename->attribute_id . '" '; $this->_db->setQuery($prop_delete); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); } $imageQuery = 'SELECT p.product_thumb_image, @@ -368,45 +363,30 @@ public function delete($cid = array()) $query = 'DELETE FROM ' . $this->table_prefix . 'product WHERE product_id IN ( ' . $productIds . ' )'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); $query_related = 'DELETE FROM ' . $this->table_prefix . 'product_accessory WHERE product_id IN ( ' . $productIds . ' )'; $this->_db->setQuery($query_related); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); $query_related = 'DELETE FROM ' . $this->table_prefix . 'product_related WHERE product_id IN ( ' . $productIds . ' )'; $this->_db->setQuery($query_related); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); $query_media = 'DELETE FROM ' . $this->table_prefix . 'media WHERE section_id IN ( ' . $productIds . ' ) AND media_section = "product"'; $this->_db->setQuery($query_media); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); // Remove product category xref relation $query_relation = 'DELETE FROM ' . $this->table_prefix . 'product_category_xref WHERE product_id IN ( ' . $productIds . ' ) '; $this->_db->setQuery($query_relation); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); // Delete Association if Exist @@ -420,28 +400,19 @@ public function delete($cid = array()) $query = 'DELETE FROM ' . $this->table_prefix . 'product_tags_xref WHERE product_id IN ( ' . $productIds . ' ) '; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); // Remove product wishlist relation $query = 'DELETE FROM ' . $this->table_prefix . 'wishlist_product WHERE product_id IN ( ' . $productIds . ' ) '; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); // Remove product compare relation $query = 'DELETE FROM ' . $this->table_prefix . 'product_compare WHERE product_id IN ( ' . $productIds . ' ) '; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $this->_db->execute(); // Remove fields_data relation $fieldModel = RedshopModel::getInstance('fields', 'RedshopModel'); @@ -469,10 +440,7 @@ public function delete($cid = array()) $db->setQuery($query); - if ($db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - } + $db->execute(); RedshopHelperUtility::getDispatcher()->trigger('onAfterProductDelete', array($cid)); @@ -554,12 +522,7 @@ public function publish($cid = array(), $publish = 1) . ' WHERE product_id IN ( ' . $cids . ' )'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } return true; @@ -759,12 +722,7 @@ public function copy($cid = array(), $postMorePriority = false) ->set('product_id = ' . (int)$row->product_id) ->set('ordering = ' . (int)$relatedData->ordering); - if (!$db->setQuery($query)->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); } } } @@ -788,14 +746,14 @@ public function copy($cid = array(), $postMorePriority = false) if (!$rowprices_detail->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowprices_detail->getError()); return false; } if (!$rowprices_detail->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowprices_detail->getError()); return false; } @@ -827,14 +785,14 @@ public function copy($cid = array(), $postMorePriority = false) if (!$rowmedia->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } if (!$rowmedia->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } @@ -896,7 +854,7 @@ public function store($data) $this->handleDateTimeRange($data['discount_stratdate'], $data['discount_enddate']); if (!$row->bind($data)) { - $this->app->enqueueMessage(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg(), 'error'); + $this->app->enqueueMessage(/** @scrutinizer ignore-deprecated */ $row->getError(), 'error'); return false; } @@ -964,12 +922,7 @@ public function store($data) ->where($db->qn('section_id') . ' = ' . $row->product_id); $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } if (isset($data['product_full_image_delete']) && boolval($data['product_full_image_delete']) === true) { @@ -1115,7 +1068,7 @@ public function store($data) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -1163,12 +1116,7 @@ public function store($data) $query = 'DELETE FROM ' . $this->table_prefix . 'product_category_xref WHERE product_id="' . $prodid . '" '; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); // Delete redshop_product_payment_xref $db = $this->_db; @@ -1176,12 +1124,7 @@ public function store($data) ->delete($db->qn('#__redshop_product_payment_xref')) ->where($db->qn('product_id') . ' = ' . $db->q($prodid)); - if (!$db->setQuery($query)->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $db->setQuery($query)->execute(); } $catDiscountQuery = $this->_db->getQuery(true); @@ -1204,12 +1147,7 @@ public function store($data) VALUES ("' . $category . '","' . $prodid . '","' . $ordering . '")'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); if ((count($categories) - 1) != $index) { $catDiscountQuery->where( @@ -1254,12 +1192,7 @@ public function store($data) ->values(implode(',', $values)); $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } } @@ -1324,7 +1257,7 @@ public function store($data) if (!$accdetail->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $accdetail->getError()); return false; } @@ -1334,32 +1267,25 @@ public function store($data) $query_rel_del = 'DELETE FROM ' . $this->table_prefix . 'product_related ' . 'WHERE product_id IN ( ' . $row->product_id . ' )'; $this->_db->setQuery($query_rel_del); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } - - $ordering_related = 0; + $this->_db->execute(); - if (isset($data['related_product']) && ($relatedProducts = explode(',', $data['related_product']))) { - foreach ($relatedProducts as $related_data) { - $ordering_related++; - $related_id = $related_data; - $productId = $row->product_id; - $query_related = 'INSERT INTO ' . $this->table_prefix . 'product_related(related_id,product_id,ordering) - VALUES ("' . $related_id . '","' . $productId . '","' . $ordering_related . '")'; - $this->_db->setQuery($query_related); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + if (!empty($data['related_product'])) + { + $relatedProducts = array_filter( + ArrayHelper::toInteger( + explode(',', $data['related_product']) + ) + ); - return false; - } - } - } + foreach ($relatedProducts as $ordering => $relatedData) + { + $obj = new stdClass; + $obj->related_id = $relatedData; + $obj->product_id = $row->product_id; + $obj->ordering = $ordering; + $this->_db->insertObject($this->table_prefix . 'product_related', $obj); + } + } // Discount calculator start $query = "DELETE FROM `" . $this->table_prefix . "product_discount_calc` WHERE product_id='" . $row->product_id . "' "; @@ -1410,7 +1336,7 @@ public function store($data) if ($calcrow->check()) { if (!$calcrow->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $calcrow->getError()); return false; } @@ -1445,7 +1371,7 @@ public function store($data) if (!$pdcextrarow->store()) { $calc_extra = 1; $extra_err_msg = /** @scrutinizer ignore-deprecated */ - $this->_db->getErrorMsg(); + $pdcextrarow->getError(); } } } @@ -1498,7 +1424,7 @@ public function store($data) if (!$sub_row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $sub_row->getError()); return false; } @@ -1547,7 +1473,7 @@ public function store($data) if (!$product_serial->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $product_serial->getError()); return false; } @@ -1632,14 +1558,14 @@ public function storeMediaSave2Copy($data, $row) if (!$rowmedia->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } if (!$rowmedia->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } @@ -2032,14 +1958,14 @@ public function store_attr($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -2114,14 +2040,14 @@ public function store_pro($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -2153,12 +2079,7 @@ public function InsertStockroom($section_id, $name, $stockroom_id, $quantiy, $pr "' . $ordered_preorder . '")'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); return true; } @@ -2241,14 +2162,14 @@ public function copyadditionalImage($data, $isMainImage = false, $mainImageName if (!$rowmedia->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } if (!$rowmedia->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowmedia->getError()); return false; } @@ -2297,14 +2218,14 @@ public function store_sub($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -2359,15 +2280,10 @@ public function insertProductStock( $ordered_preorder = 0 ) { $query = 'INSERT INTO ' . $this->table_prefix . 'product_stockroom_xref (product_id,stockroom_id,quantity,preorder_stock,ordered_preorder) - VALUE("' . $productId . '","' . $stockroom_id . '","' . $quantiy . '","' . $preorder_stock . '","' . $ordered_preorder . '")'; + VALUE("' . (int) $productId . '","' . (int) $stockroom_id . '","' . (int) $quantiy . '","' . (int) $preorder_stock . '","' . (int) $ordered_preorder . '")'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); // For stockroom Notify Email. $stockroom_data = array(); @@ -2421,13 +2337,6 @@ public function copyProductAttribute($cid, $productId) $resultInsertAttr = $db->insertObject('#__redshop_product_attribute', $attribute[$att]); - if (!$resultInsertAttr) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } - $attributeId = $this->_db->insertid(); $query = 'SELECT * FROM `' . $this->table_prefix . 'product_attribute_property` WHERE `attribute_id` = "' . $oldAttributeId . '" order by ordering asc'; @@ -2480,14 +2389,14 @@ public function copyProductAttribute($cid, $productId) if (!$attribute_price_detail->bind($attr_price)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $attribute_price_detail->getError()); return false; } if (!$attribute_price_detail->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $attribute_price_detail->getError()); return false; } @@ -2674,8 +2583,7 @@ public function SaveAttributeStockroom($post) } else { if ($preorder_stock < $ordered_preorder && $preorder_stock != "" && $ordered_preorder != "") { $msg = JText::_('COM_REDSHOP_PREORDER_STOCK_NOT_ALLOWED'); - /** @scrutinizer ignore-deprecated */ - JError::raiseWarning('', $msg); + Factory::getApplication()->enqueueMessage($msg, 'warning'); return false; } else { @@ -2875,14 +2783,14 @@ public function copyDiscountCalcdata($old_product_id, $new_product_id, $discount if (!$calcrow->check()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $calcrow->getError()); return false; } if (!$calcrow->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $calcrow->getError()); return false; } @@ -3140,23 +3048,13 @@ public function deleteprop($cid = array(), $image_name = array()) $query = 'DELETE FROM ' . $this->table_prefix . 'product_attribute_property WHERE property_id IN ( ' . $cids . ' )'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->_db->execute(); - return false; - } else { - // Changed 5 feb - $query = 'DELETE FROM ' . $this->table_prefix . 'product_subattribute_color WHERE subattribute_id IN (' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + // Changed 5 feb + $query = 'DELETE FROM ' . $this->table_prefix . 'product_subattribute_color WHERE subattribute_id IN (' . $cids . ' )'; + $this->_db->setQuery($query); - return false; - } - } + $this->_db->execute(); } return true; @@ -3251,12 +3149,7 @@ public function property_more_img($post, $main_img, $sub_img) "' WHERE subattribute_color_id ='" . $post['section_id'] . "' "; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } else { $main_dest = REDSHOP_FRONT_IMAGES_RELPATH . 'property/' . $main_name; @@ -3266,12 +3159,7 @@ public function property_more_img($post, $main_img, $sub_img) . "' WHERE property_id ='" . $post['section_id'] . "' "; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } } } @@ -3347,12 +3235,7 @@ public function deletesubimage($mediaid) $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); return true; } @@ -3458,12 +3341,7 @@ public function delsubattr_diff($subattr_diff) $diff->subattribute_color_id . '"'; $this->_db->setQuery($query); - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->execute(); } return true; @@ -4262,7 +4140,7 @@ public function checkout($uid = null) if (!$product_detail->checkout($uid, $this->id)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $product_detail->getError()); return false; } @@ -4671,14 +4549,9 @@ public function removeAccessory($accessoryId, $category_id = 0, $child_product_i $query->where('child_product_id = ' . (int)$child_product_id); } - if (!$db->setQuery($query)->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $db->setQuery($query)->execute(); - return false; - } else { - return true; - } + return true; } /** diff --git a/component/admin/models/producttags_detail.php b/component/admin/models/producttags_detail.php index da41337ef36..71eadbbdd7c 100644 --- a/component/admin/models/producttags_detail.php +++ b/component/admin/models/producttags_detail.php @@ -89,13 +89,13 @@ public function store($data) $row = $this->getTable('product_tags'); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } diff --git a/component/admin/models/quotation.php b/component/admin/models/quotation.php index fc3da61575e..212b49a6c64 100644 --- a/component/admin/models/quotation.php +++ b/component/admin/models/quotation.php @@ -162,14 +162,6 @@ public function getItemsCsv() $items = $this->_getList($query); - // Check for a database error. - if (/** @scrutinizer ignore-deprecated */ $this->_db->getErrorNum()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } - if ($items) { foreach ($items as $key => $item) { $items[$key]->quotation_status = RedshopHelperQuotation::getQuotationStatusName( diff --git a/component/admin/models/quotation_detail.php b/component/admin/models/quotation_detail.php index 6b2d47560aa..0ea789bd09e 100644 --- a/component/admin/models/quotation_detail.php +++ b/component/admin/models/quotation_detail.php @@ -147,14 +147,14 @@ public function store($data) if (!$row->bind($data)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -168,14 +168,14 @@ public function store($data) if (!$rowitem->bind($quotation_item[$i])) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } if (!$rowitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowitem->getError()); return false; } @@ -202,58 +202,23 @@ public function delete($cid = array()) for ($i = 0, $in = count($items); $i < $in; $i++) { $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_accessory_item ' . 'WHERE quotation_item_id = ' . $items[$i]->quotation_item_id . ' '; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_attribute_item ' . 'WHERE quotation_item_id = ' . $items[$i]->quotation_item_id . ' '; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_fields_data ' . 'WHERE quotation_item_id = ' . $items[$i]->quotation_item_id . ' '; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_item ' . 'WHERE quotation_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation WHERE quotation_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); return true; } @@ -262,47 +227,19 @@ public function deleteitem($cids = 0, $quotation_id = 0) { $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_fields_data ' . 'WHERE quotation_item_id IN ( ' . $cids . ' ) '; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_accessory_item ' . 'WHERE quotation_item_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_attribute_item ' . 'WHERE quotation_item_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'quotation_item ' . 'WHERE quotation_item_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); // Update Quotation Record $QuotationData = $this->getTable('quotation_detail'); @@ -424,7 +361,7 @@ public function newQuotationItem($data) if (!$qitemdata->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $qitemdata->getError()); return false; } @@ -467,7 +404,7 @@ public function newQuotationItem($data) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -510,7 +447,7 @@ public function newQuotationItem($data) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -551,7 +488,7 @@ public function newQuotationItem($data) if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ $this->setError( - /** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg() + /** @scrutinizer ignore-deprecated */ $rowattitem->getError() ); return false; @@ -584,7 +521,7 @@ public function newQuotationItem($data) if ($accessoryId > 0) { if (!$rowaccitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowaccitem->getError()); return false; } @@ -611,7 +548,7 @@ public function newQuotationItem($data) if ($attributeId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -654,7 +591,7 @@ public function newQuotationItem($data) if ($propertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -697,7 +634,7 @@ public function newQuotationItem($data) if ($subPropertyId > 0) { if (!$rowattitem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowattitem->getError()); return false; } @@ -795,7 +732,7 @@ public function storeOrder($data) if (!$row->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $row->getError()); return false; } @@ -839,7 +776,7 @@ public function storeOrder($data) if (!$rowItem->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $rowItem->getError()); return false; } @@ -852,7 +789,7 @@ public function storeOrder($data) if (!$orderUser->bind($userRow)) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderUser->getError()); return false; } @@ -862,7 +799,7 @@ public function storeOrder($data) if (!$orderUser->store()) { /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); + $this->setError(/** @scrutinizer ignore-deprecated */ $orderUser->getError()); return false; } diff --git a/component/admin/models/shipping_rate_detail.php b/component/admin/models/shipping_rate_detail.php index 2cab13c10c9..ca7724111c0 100644 --- a/component/admin/models/shipping_rate_detail.php +++ b/component/admin/models/shipping_rate_detail.php @@ -122,7 +122,7 @@ public function store($data) $row = $this->getTable(); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -152,7 +152,7 @@ public function store($data) } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -166,13 +166,7 @@ public function delete($cid = array()) $cids = implode(',', $cid); $query = 'DELETE FROM ' . $this->_table_prefix . 'shipping_rate WHERE shipping_rate_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/stockimage_detail.php b/component/admin/models/stockimage_detail.php index 45e5b06a0bf..43e8c6f2833 100644 --- a/component/admin/models/stockimage_detail.php +++ b/component/admin/models/stockimage_detail.php @@ -98,13 +98,13 @@ public function store($data) } if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -132,13 +132,7 @@ public function delete($cid = array()) $query = 'DELETE FROM ' . $this->_table_prefix . 'stockroom_amount_image ' . 'WHERE stock_amount_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/stockroom_listing.php b/component/admin/models/stockroom_listing.php index 744f6fa38f1..b387bb85a96 100644 --- a/component/admin/models/stockroom_listing.php +++ b/component/admin/models/stockroom_listing.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\Factory; + defined('_JEXEC') or die; /** @@ -185,7 +187,7 @@ public function storeStockroomQuantity( } else { if (($preorder_stock < $ordered_preorder) && $preorder_stock != "" && $ordered_preorder != "") { $msg = JText::_('COM_REDSHOP_PREORDER_STOCK_NOT_ALLOWED'); - JError::raiseWarning('', $msg); + Factory::getApplication()->enqueueMessage($msg, 'warning'); return false; } else { @@ -198,7 +200,7 @@ public function storeStockroomQuantity( } else { if ($preorder_stock < $ordered_preorder && $preorder_stock != "" && $ordered_preorder != "") { $msg = JText::_('COM_REDSHOP_PREORDER_STOCK_NOT_ALLOWED') . "for Stockroom "; - JError::raiseWarning('', $msg); + Factory::getApplication()->enqueueMessage($msg, 'warning'); return false; } else { diff --git a/component/admin/models/stockrooms.php b/component/admin/models/stockrooms.php index 019c8cbe6f6..e753f0f8b15 100644 --- a/component/admin/models/stockrooms.php +++ b/component/admin/models/stockrooms.php @@ -118,12 +118,7 @@ public function frontpublish($cids = array(), $publish = 1) ->update($this->_db->qn('#__redshop_stockroom')) ->set($this->_db->qn('show_in_front') . ' = ' . $this->_db->q(intval($publish))) ->where($this->_db->qn('id') . ' = ' . $this->_db->q((int) $cid)); - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/user.php b/component/admin/models/user.php index f5381ba6588..e1de787bcca 100644 --- a/component/admin/models/user.php +++ b/component/admin/models/user.php @@ -18,9 +18,12 @@ public function __construct() { parent::__construct(); - $array = JFactory::getApplication()->input->get('user_id', 0, 'array'); + $array = JFactory::getApplication()->input->get('user_id', [], 'array'); - $this->setId((int)$array[0]); + if (array_key_exists(0, $array)) + { + $this->setId((int) $array[0]); + } } public function setId($id) diff --git a/component/admin/models/user_detail.php b/component/admin/models/user_detail.php index 777d698d6ba..19e257beff1 100644 --- a/component/admin/models/user_detail.php +++ b/component/admin/models/user_detail.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\Factory; + defined('_JEXEC') or die; @@ -34,7 +36,7 @@ public function __construct() $this->_table_prefix = '#__redshop_'; $this->_context = 'order_id'; - $array = $app->input->get('cid', 0, 'array'); + $array = $app->input->get('cid', [], 'array'); $this->_uid = $app->input->get('user_id', 0); $limit = $app->getUserStateFromRequest($this->_context . 'limit', 'limit', $app->getCfg('list_limit'), 0); @@ -42,7 +44,11 @@ public function __construct() $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); - $this->setId((int)$array[0]); + + if (array_key_exists(0, $array)) + { + $this->setId((int) $array[0]); + } } public function setId($id) @@ -190,8 +196,7 @@ public function storeUser($post) if ($post['createaccount']) { if ($post['user_id'] == 0 && ($post['password'] == '' || $post['password2'] == '')) { - /** @scrutinizer ignore-deprecated */ - JError::raiseWarning('', JText::_('COM_REDSHOP_PLEASE_ENTER_PASSWORD')); + Factory::getApplication()->enqueueMessage(JText::_('COM_REDSHOP_PLEASE_ENTER_PASSWORD'), 'warning'); return false; } @@ -305,14 +310,7 @@ public function delete($cid = array(), $deleteJoomlaUsers = false) } } - $db->setQuery($queryDefault); - - if (!$db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg()); - - return false; - } + $db->setQuery($queryDefault)->execute(); } return true; @@ -326,14 +324,7 @@ public function publish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'users_info ' . 'SET approved=' . intval($publish) . ' ' . 'WHERE user_id IN ( ' . $cids . ' ) '; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - /** @scrutinizer ignore-deprecated */ - $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/xmlexport_detail.php b/component/admin/models/xmlexport_detail.php index 87d68514381..a5d04fa6d67 100644 --- a/component/admin/models/xmlexport_detail.php +++ b/component/admin/models/xmlexport_detail.php @@ -103,7 +103,7 @@ public function store($data, $export = 0) $row = $this->getTable(); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -115,7 +115,7 @@ public function store($data, $export = 0) $row->published = $data['xmlpublished']; if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -172,33 +172,15 @@ public function delete($cid = array()) $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export_log ' . 'WHERE xmlexport_id IN (' . $cids . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export_ipaddress ' . 'WHERE xmlexport_id IN (' . $cids . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export ' . 'WHERE xmlexport_id IN (' . $cids . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -208,13 +190,7 @@ public function deleteIpAddress($xmlexport_ip_id = 0) { $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_export_ipaddress ' . 'WHERE xmlexport_ip_id IN (' . $xmlexport_ip_id . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); return true; } @@ -227,13 +203,7 @@ public function auto_syncpublish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'xml_export ' . ' SET auto_sync = ' . intval($publish) . ' WHERE xmlexport_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -247,13 +217,7 @@ public function usetoallpublish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'xml_export ' . ' SET use_to_all_users = ' . intval($publish) . ' WHERE xmlexport_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -273,13 +237,7 @@ public function publish($cid = array(), $publish = 1) $query = ' UPDATE ' . $this->_table_prefix . 'xml_export ' . ' SET published = ' . intval($publish) . ' WHERE xmlexport_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/xmlimport_detail.php b/component/admin/models/xmlimport_detail.php index 235b865a0e7..398801eefd0 100644 --- a/component/admin/models/xmlimport_detail.php +++ b/component/admin/models/xmlimport_detail.php @@ -282,7 +282,7 @@ public function store($data, $import = 0) $row = $this->getTable(); if (!$row->bind($data)) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -290,7 +290,7 @@ public function store($data, $import = 0) $row->published = $data['xmlpublished']; if (!$row->store()) { - $this->setError($this->_db->getErrorMsg()); + $this->setError($row->getError()); return false; } @@ -328,23 +328,11 @@ public function delete($cid = array()) $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_import_log ' . 'WHERE xmlimport_id IN (' . $cids . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); $query = 'DELETE FROM ' . $this->_table_prefix . 'xml_import ' . 'WHERE xmlimport_id IN (' . $cids . ')'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -358,13 +346,7 @@ public function auto_syncpublish($cid = array(), $publish = 1) $query = 'UPDATE ' . $this->_table_prefix . 'xml_import ' . ' SET auto_sync = ' . intval($publish) . ' WHERE xmlimport_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; @@ -384,13 +366,7 @@ public function publish($cid = array(), $publish = 1) $query = ' UPDATE ' . $this->_table_prefix . 'xml_import ' . ' SET published = ' . intval($publish) . ' WHERE xmlimport_id IN ( ' . $cids . ' )'; - $this->_db->setQuery($query); - - if (!$this->_db->execute()) { - $this->setError($this->_db->getErrorMsg()); - - return false; - } + $this->_db->setQuery($query)->execute(); } return true; diff --git a/component/admin/models/zip_import.php b/component/admin/models/zip_import.php index 4a10509f42c..63eb82e33ed 100644 --- a/component/admin/models/zip_import.php +++ b/component/admin/models/zip_import.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\Factory; + defined('_JEXEC') or die; jimport('joomla.installer.installer'); @@ -38,7 +40,8 @@ public function getData() session_unregister("filename"); session_unregister("zipno"); $msg = JText::_('COM_REDSHOP_REDSHOP_REMOTLY_UPDATED'); - $app->redirect(JURI::base() . 'index.php?option=com_redshop', $msg); + $app->enqueueMessage($msg); + $app->redirect(JURI::base() . 'index.php?option=com_redshop'); } public function getzipfilenames() @@ -92,7 +95,8 @@ public function install() if (!$package) { $this->setState('message', 'Unable to find install package'); $msg = JText::_('COM_REDSHOP_REDSHOP_REMOTELY_UPDATED'); - $app->redirect(JURI::base() . "index.php?option=com_redshop", $msg); + $app->enqueueMessage($msg); + $app->redirect(JURI::base() . "index.php?option=com_redshop"); } // Get an installer instance @@ -107,7 +111,8 @@ public function install() redirect(JURI::base() . "index.php?option=com_redshop", $msg); + $app->enqueueMessage($msg); + $app->redirect(JURI::base() . "index.php?option=com_redshop"); } // Set some model state values @@ -149,7 +154,7 @@ public function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PLEASE_ENTER_A_URL')); + Factory::getApplication()->enqueueMessage(JText::_('COM_REDSHOP_PLEASE_ENTER_A_URL'), 'warning'); ?> diff --git a/component/admin/views/addorder_detail/tmpl/default.php b/component/admin/views/addorder_detail/tmpl/default.php index 250c92588b9..6dcf61085ef 100644 --- a/component/admin/views/addorder_detail/tmpl/default.php +++ b/component/admin/views/addorder_detail/tmpl/default.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.calendar'); - $app = JFactory::getApplication(); $redconfig = Redconfiguration::getInstance(); @@ -156,7 +154,7 @@ function addNewproductRow(tblid) { validateUserDetail(); return false; } - submitform(pressbutton); + Joomla.submitform(pressbutton); } function validateUserDetail() { @@ -279,7 +277,7 @@ function validateUserDetail() { if (validateExtrafield(form) == false) { return false; } - submitform('guestuser'); + Joomla.submitform('guestuser'); } diff --git a/component/admin/views/addorder_detail/view.html.php b/component/admin/views/addorder_detail/view.html.php index 3bf3c84c26c..c5eb13bcbc9 100644 --- a/component/admin/views/addorder_detail/view.html.php +++ b/component/admin/views/addorder_detail/view.html.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; /** @@ -46,16 +48,16 @@ public function display($tpl = null) $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_ORDER')); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/json.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.validation.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.order.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.admin.common.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/ajaxupload.min.js', false, true); + + HTMLHelper::script('com_redshop/json.min.js', ['relative' => true]); + + HTMLHelper::script('com_redshop/redshop.validation.min.js', ['relative' => true]); + + HTMLHelper::script('com_redshop/redshop.order.min.js', ['relative' => true]); + + HTMLHelper::script('com_redshop/redshop.admin.common.min.js', ['relative' => true]); + + HTMLHelper::script('com_redshop/ajaxupload.min.js', ['relative' => true]); $uri = JUri::getInstance(); $lists = array(); diff --git a/component/admin/views/addquotation_detail/tmpl/default.php b/component/admin/views/addquotation_detail/tmpl/default.php index f8e5db7a005..643e51fe6a6 100644 --- a/component/admin/views/addquotation_detail/tmpl/default.php +++ b/component/admin/views/addquotation_detail/tmpl/default.php @@ -77,7 +77,7 @@ function addNewproductRow(tblid) { var form = document.adminForm; if (pressbutton == 'cancel') { - submitform(pressbutton); + Joomla.submitform(pressbutton); return; } @@ -101,7 +101,7 @@ function addNewproductRow(tblid) { return false; } } - submitform(pressbutton); + Joomla.submitform(pressbutton); } function validateUserDetail() { diff --git a/component/admin/views/addquotation_detail/view.html.php b/component/admin/views/addquotation_detail/view.html.php index 8df07830c50..a6bceec4536 100644 --- a/component/admin/views/addquotation_detail/view.html.php +++ b/component/admin/views/addquotation_detail/view.html.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; @@ -32,16 +34,12 @@ public function display($tpl = null) $document->setTitle(JText::_('COM_REDSHOP_QUOTATION_MANAGEMENT')); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/json.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.validation.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.order.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.admin.common.min.js', false, true); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/ajaxupload.min.js', false, true); + HTMLHelper::script('com_redshop/json.min.js', ['relative' => true]); + HTMLHelper::script('com_redshop/redshop.validation.min.js', ['relative' => true]); + HTMLHelper::script('com_redshop/redshop.order.min.js', ['relative' => true]); + HTMLHelper::script('com_redshop/redshop.admin.common.min.js', ['relative' => true]); + HTMLHelper::script('com_redshop/ajaxupload.min.js', ['relative' => true]); + $session = JFactory::getSession(); $uri = JUri::getInstance(); diff --git a/component/admin/views/alert/tmpl/default.php b/component/admin/views/alert/tmpl/default.php index 372c5bb9215..3e1e49c7d88 100644 --- a/component/admin/views/alert/tmpl/default.php +++ b/component/admin/views/alert/tmpl/default.php @@ -115,11 +115,9 @@ - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/alert/view.html.php b/component/admin/views/alert/view.html.php index 4b138f7041c..a1e102440de 100644 --- a/component/admin/views/alert/view.html.php +++ b/component/admin/views/alert/view.html.php @@ -43,7 +43,7 @@ public function display($tpl = null) true ); - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $this->state = $this->get('State'); $optiontype = array(); diff --git a/component/admin/views/attribute_set/tmpl/default.php b/component/admin/views/attribute_set/tmpl/default.php index ef6b295551f..4300633cd63 100644 --- a/component/admin/views/attribute_set/tmpl/default.php +++ b/component/admin/views/attribute_set/tmpl/default.php @@ -81,11 +81,9 @@ } ?> - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/attribute_set/view.html.php b/component/admin/views/attribute_set/view.html.php index 389c71c6577..a1581304c0c 100644 --- a/component/admin/views/attribute_set/view.html.php +++ b/component/admin/views/attribute_set/view.html.php @@ -30,7 +30,7 @@ public function display($tpl = null) JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $filter_order = $app->getUserStateFromRequest( $context . 'filter_order', diff --git a/component/admin/views/attribute_set_detail/tmpl/default.php b/component/admin/views/attribute_set_detail/tmpl/default.php index 8ba9bff1c9e..87adf6fbce2 100644 --- a/component/admin/views/attribute_set_detail/tmpl/default.php +++ b/component/admin/views/attribute_set_detail/tmpl/default.php @@ -7,8 +7,13 @@ * @copyright Copyright (C) 2008 - 2020 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); + $url = JURI::getInstance()->root(); ?> diff --git a/component/admin/views/attributeprices_detail/view.html.php b/component/admin/views/attributeprices_detail/view.html.php index 775c8a471f7..c0e2fc46e00 100644 --- a/component/admin/views/attributeprices_detail/view.html.php +++ b/component/admin/views/attributeprices_detail/view.html.php @@ -25,7 +25,7 @@ public function display($tpl = null) $this->detail = $this->get('data'); $model = $this->getModel('attributeprices_detail'); $this->property = $model->getPropertyName(); - $this->request_url = JFactory::getURI()->toString(); + $this->request_url = \Joomla\CMS\Uri\Uri::getInstance()->toString(); $this->lists['shopper_group_name'] = RedshopHelperShopper_Group::listAll( "shopper_group_id", diff --git a/component/admin/views/attributes/tmpl/default.php b/component/admin/views/attributes/tmpl/default.php index f4b8d800f02..961fa812627 100644 --- a/component/admin/views/attributes/tmpl/default.php +++ b/component/admin/views/attributes/tmpl/default.php @@ -132,11 +132,9 @@ class="hasTooltip" - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/catalog_request/tmpl/default.php b/component/admin/views/catalog_request/tmpl/default.php index 91e5a4a7bf6..f9b05802587 100644 --- a/component/admin/views/catalog_request/tmpl/default.php +++ b/component/admin/views/catalog_request/tmpl/default.php @@ -137,11 +137,9 @@ function clearreset() { ?> - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/catalog_request/view.html.php b/component/admin/views/catalog_request/view.html.php index 2bdaa7991d2..e39692b008a 100644 --- a/component/admin/views/catalog_request/view.html.php +++ b/component/admin/views/catalog_request/view.html.php @@ -26,7 +26,7 @@ public function display($tpl = null) JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'catalog_user_id'); $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', ''); diff --git a/component/admin/views/catalogs/tmpl/default.php b/component/admin/views/catalogs/tmpl/default.php index 436659d236e..6970c2f0667 100644 --- a/component/admin/views/catalogs/tmpl/default.php +++ b/component/admin/views/catalogs/tmpl/default.php @@ -9,6 +9,4 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', '.joom-box'); - echo RedshopLayoutHelper::render('view.list', array('data' => $this)); diff --git a/component/admin/views/category/tmpl/edit.php b/component/admin/views/category/tmpl/edit.php index ed57c54dc61..c18335d8871 100644 --- a/component/admin/views/category/tmpl/edit.php +++ b/component/admin/views/category/tmpl/edit.php @@ -9,7 +9,7 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal'); +JHtml::_('bootstrap.modal'); JHtml::_('behavior.formvalidator'); ?> + '.ModalConfigDetailButton', + 'modalFrame' => 'ModalConfigDetail', + ] +); + diff --git a/component/admin/views/configuration/tmpl/default_cart_template_image_setting.php b/component/admin/views/configuration/tmpl/default_cart_template_image_setting.php index 99176c83fe4..f056876ecd3 100644 --- a/component/admin/views/configuration/tmpl/default_cart_template_image_setting.php +++ b/component/admin/views/configuration/tmpl/default_cart_template_image_setting.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); - $url = JUri::root(); $addToCartPath = "/components/com_redshop/assets/images/"; ?> diff --git a/component/admin/views/configuration/tmpl/default_cattab_nplinks.php b/component/admin/views/configuration/tmpl/default_cattab_nplinks.php index 2d426954cfc..c2b2dcc8b4b 100644 --- a/component/admin/views/configuration/tmpl/default_cattab_nplinks.php +++ b/component/admin/views/configuration/tmpl/default_cattab_nplinks.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', '.joom-box'); - $url = JUri::root(); $link_path = "/components/com_redshop/assets/images/"; diff --git a/component/admin/views/configuration/tmpl/default_procat_images.php b/component/admin/views/configuration/tmpl/default_procat_images.php index c05b02647ea..673b5d3b2ed 100644 --- a/component/admin/views/configuration/tmpl/default_procat_images.php +++ b/component/admin/views/configuration/tmpl/default_procat_images.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', '.joom-box'); - $uri = JURI::getInstance(); $url = $uri->root(); $cat_path = "/components/com_redshop/assets/images/category/"; diff --git a/component/admin/views/configuration/tmpl/default_product_template_image_settings.php b/component/admin/views/configuration/tmpl/default_product_template_image_settings.php index 6a5197e1186..b199a816e59 100644 --- a/component/admin/views/configuration/tmpl/default_product_template_image_settings.php +++ b/component/admin/views/configuration/tmpl/default_product_template_image_settings.php @@ -9,7 +9,6 @@ */ defined('_JEXEC') or die; -JHtmlBehavior::modal('.joom-box'); $ord_path = "/components/com_redshop/assets/images/"; echo RedshopLayoutHelper::render( diff --git a/component/admin/views/configuration/tmpl/default_registration.php b/component/admin/views/configuration/tmpl/default_registration.php index 6e9c2df2b41..19d10b2b06a 100644 --- a/component/admin/views/configuration/tmpl/default_registration.php +++ b/component/admin/views/configuration/tmpl/default_registration.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', '.joom-box'); - echo RedshopLayoutHelper::render( 'config.config', array( @@ -60,19 +58,19 @@ $js = "function jSelectArticle_terms_article_id(id, title, catid) { document.getElementById('terms_article_id_id').value = id; document.getElementById('terms_article_id_name').value = title; - SqueezeBox.close(); + (function($){ + $('#ModalConfigDetail').modal('hide'); + })(jQuery); }"; $doc->addScriptDeclaration($js); $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_terms_article_id'; $html = '
' - . '' - . '' - . '' . JText::_( - 'COM_REDSHOP_Select' - ) . '' - . '
'; + . '' + . '' + . '' + . ''; echo RedshopLayoutHelper::render( 'config.config', diff --git a/component/admin/views/configuration/tmpl/default_shopper_group.php b/component/admin/views/configuration/tmpl/default_shopper_group.php index 689beffa6f0..4c3a74069e4 100644 --- a/component/admin/views/configuration/tmpl/default_shopper_group.php +++ b/component/admin/views/configuration/tmpl/default_shopper_group.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', '.joom-box'); - $uri = JURI::getInstance(); $url = $uri->root(); $shopperlogo_path = "components/com_redshop/assets/images/shopperlogo"; diff --git a/component/admin/views/configuration/view.html.php b/component/admin/views/configuration/view.html.php index 5c814ebc344..91fbda25200 100644 --- a/component/admin/views/configuration/view.html.php +++ b/component/admin/views/configuration/view.html.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; class RedshopViewConfiguration extends RedshopViewAdmin @@ -39,8 +41,7 @@ public function display($tpl = null) } $document->setTitle(JText::_('COM_REDSHOP_CONFIG')); - /** @scrutinizer ignore-deprecated */ - JHtml::script('com_redshop/redshop.validation.min.js', false, true); + HTMLHelper::script('com_redshop/redshop.validation.min.js', ['relative' => true]); /** @var RedshopModelConfiguration $model */ $model = $this->getModel('configuration'); @@ -1011,7 +1012,49 @@ public function display($tpl = null) } } - $script .= "function changeStateList() + $script .= "window.writeDynaList = function ( selectParams, source, key, orig_key, orig_val, element ) { + var select = document.createElement('select'); + var params = selectParams.split(' '); + + for (var l = 0; l < params.length; l++) { + var par = params[l].split('='); + + // make sure the attribute / content can not be used for scripting + if (par[0].trim().substr(0, 2).toLowerCase() === \"on\" + || par[0].trim().toLowerCase() === \"href\") { + continue; + } + + select.setAttribute(par[0], par[1].replace(/\\\"/g, '')); + } + + var hasSelection = key == orig_key, i, selected, item; + + for (i = 0; i < source.length; i++) { + item = source[i]; + + if (item[0] != key) { continue; } + + selected = hasSelection ? orig_val == item[1] : i === 0; + + var el = document.createElement('option'); + el.setAttribute('value', item[1]); + el.innerText = item[2]; + + if (selected) { + el.setAttribute('selected', 'selected'); + } + + select.appendChild(el); + } + + if (element) { + element.appendChild(select); + } else { + document.body.appendChild(select); + } + }; + function changeStateList() { var selected_country = null; for (var i=0; i true]); // Initialise variables. $this->form = $this->get('Form'); diff --git a/component/admin/views/giftcard/tmpl/edit.php b/component/admin/views/giftcard/tmpl/edit.php index 5d0b6a45cbe..bc742602df6 100644 --- a/component/admin/views/giftcard/tmpl/edit.php +++ b/component/admin/views/giftcard/tmpl/edit.php @@ -10,7 +10,6 @@ defined('_JEXEC') or die; JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.modal', 'a.joom-box'); if ($this->item->giftcard_id) { $this->form->setValue('giftcard_price', null, RedshopHelperProduct::redpriceDecimal($this->item->giftcard_price)); diff --git a/component/admin/views/giftcards/tmpl/default.php b/component/admin/views/giftcards/tmpl/default.php index 694cc31109f..3e6895e4ab2 100644 --- a/component/admin/views/giftcards/tmpl/default.php +++ b/component/admin/views/giftcards/tmpl/default.php @@ -9,8 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); - // Create product Helper object $listOrder = $this->escape($this->state->get('list.ordering')); @@ -219,11 +217,9 @@ class="hasTooltip" - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/import/tmpl/default.php b/component/admin/views/import/tmpl/default.php index f1584fc78a4..2f02dc6912f 100755 --- a/component/admin/views/import/tmpl/default.php +++ b/component/admin/views/import/tmpl/default.php @@ -7,13 +7,14 @@ * @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; JHtml::_('redshopjquery.ui'); -/** @scrutinizer ignore-deprecated */ -JHtml::script('com_redshop/jquery.iframe-transport.min.js', false, true); -/** @scrutinizer ignore-deprecated */ -JHtml::script('com_redshop/jquery.fileupload.min.js', false, true); +HTMLHelper::script('com_redshop/jquery.iframe-transport.min.js', ['relative' => true]); +HTMLHelper::script('com_redshop/jquery.fileupload.min.js', ['relative' => true]); $allowFileTypes = explode(',', Redshop::getConfig()->get('IMPORT_FILE_MIME', 'text/csv,application/vnd.ms-excel')); $allowMaxFileSize = (int)Redshop::getConfig()->get('IMPORT_MAX_FILE_SIZE', 2000000); diff --git a/component/admin/views/media/tmpl/additionalfile.php b/component/admin/views/media/tmpl/additionalfile.php index 731ebfbbd0d..3751b3d32ae 100644 --- a/component/admin/views/media/tmpl/additionalfile.php +++ b/component/admin/views/media/tmpl/additionalfile.php @@ -11,8 +11,6 @@ jimport('joomla.filesystem.file'); -JHtml::_('behavior.modal', 'a.joom-box'); - $mediaId = JFactory::getApplication()->input->getInt('media_id'); ?> diff --git a/component/admin/views/media/tmpl/default.php b/component/admin/views/media/tmpl/default.php index f913c3f8eba..5f6925beb74 100644 --- a/component/admin/views/media/tmpl/default.php +++ b/component/admin/views/media/tmpl/default.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); - jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); @@ -323,11 +321,9 @@ class="width-20 text-area-order"/> - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/media/view.html.php b/component/admin/views/media/view.html.php index d256f86ce73..f3aafcd2ee1 100644 --- a/component/admin/views/media/view.html.php +++ b/component/admin/views/media/view.html.php @@ -7,6 +7,8 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; @@ -36,11 +38,10 @@ class RedshopViewMedia extends RedshopViewAdmin public function display($tpl = null) { - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $document = JFactory::getDocument(); - /** @scrutinizer ignore-deprecated */ - JHtml::stylesheet('com_redshop/redshop.medialist-thumbs.min.css', array(), true); + HTMLHelper::stylesheet('com_redshop/redshop.medialist-thumbs.min.css', ['relative' => true]); JToolBarHelper::title(JText::_('COM_REDSHOP_MEDIA_MANAGEMENT'), 'camera redshop_media48'); JToolbarHelper::addNew(); @@ -103,8 +104,6 @@ public function display($tpl = null) $this->pagination = $pagination; $this->request_url = $uri->toString(); - $this->assign('baseURL', JURI::root()); - if (JFactory::getApplication()->input->get('layout') == 'thumbs') { $this->images = $this->get('images'); $this->documents = $this->get('documents'); diff --git a/component/admin/views/media_detail/tmpl/default.php b/component/admin/views/media_detail/tmpl/default.php index 8f99d0a3dc4..0ae3f000577 100644 --- a/component/admin/views/media_detail/tmpl/default.php +++ b/component/admin/views/media_detail/tmpl/default.php @@ -7,11 +7,14 @@ * @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); -$editor = JFactory::getEditor(); +$editor = \Joomla\CMS\Editor\Editor::getInstance(); $jinput = JFactory::getApplication()->input; $post = $jinput->post->getArray(); @@ -101,7 +104,7 @@ function jdownload_file(path, filename) { ?>
- product_id, 0, 1); ?> - - <?php echo JText::_('COM_REDSHOP_WRAPPER'); ?> - + visited; ?> @@ -416,7 +422,7 @@ function resetFilter() { ); ?> - product_id ?>"> @@ -431,11 +437,9 @@ function resetFilter() { - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> @@ -449,3 +453,12 @@ function resetFilter() { + '.ModalSelectButton', + 'modalFrame' => 'ModalSelect', + ] +); diff --git a/component/admin/views/product/tmpl/element.php b/component/admin/views/product/tmpl/element.php index 8f065f64aa8..7f4fd35a5a9 100644 --- a/component/admin/views/product/tmpl/element.php +++ b/component/admin/views/product/tmpl/element.php @@ -169,11 +169,9 @@ - =')): ?> -
- pagination->getLimitBox() ?> -
- +
+ pagination->getLimitBox() ?> +
pagination->getListFooter() ?> diff --git a/component/admin/views/product/tmpl/ins_product.php b/component/admin/views/product/tmpl/ins_product.php index 170891fba0c..19bb73e2591 100644 --- a/component/admin/views/product/tmpl/ins_product.php +++ b/component/admin/views/product/tmpl/ins_product.php @@ -127,11 +127,9 @@ function insertProduct(pid) { - =')): ?> -
- pagination->getLimitBox(); ?> -
- +
+ pagination->getLimitBox(); ?> +
pagination->getListFooter(); ?> diff --git a/component/admin/views/product/tmpl/listing.php b/component/admin/views/product/tmpl/listing.php index 27f982a2f2b..972bec4996d 100644 --- a/component/admin/views/product/tmpl/listing.php +++ b/component/admin/views/product/tmpl/listing.php @@ -9,7 +9,6 @@ */ defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); JHtml::_('behavior.formvalidator'); $model = $this->getModel('product'); @@ -178,11 +177,9 @@ class="form-control validate-discountPrice" - =')): ?> -
- pagination->getLimitBox() ?> -
- +
+ pagination->getLimitBox() ?> +
pagination->getListFooter() ?> diff --git a/component/admin/views/product_attribute_price/view.html.php b/component/admin/views/product_attribute_price/view.html.php index 6a7c4df8ed7..3d30dbaf344 100644 --- a/component/admin/views/product_attribute_price/view.html.php +++ b/component/admin/views/product_attribute_price/view.html.php @@ -19,7 +19,7 @@ public function display($tpl = null) $section_id = $jinput->get('section_id'); $section = $jinput->get('section'); $cid = $jinput->get('cid'); - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_REDSHOP_PRODUCT_PRICE')); @@ -33,7 +33,7 @@ public function display($tpl = null) $sql = "SELECT g.*,p.product_price,p.price_id,p.price_quantity_end,p.price_quantity_start FROM #__redshop_shopper_group g LEFT JOIN #__redshop_product_attribute_price p ON g.id = p.shopper_group_id AND section_id = '$section_id'"; $db->setQuery($sql); $prices = $db->loadObjectList(); - $uri = JFactory::getURI(); + $uri = \Joomla\CMS\Uri\Uri::getInstance(); $this->product = $product; diff --git a/component/admin/views/product_detail/tmpl/attribute_color.php b/component/admin/views/product_detail/tmpl/attribute_color.php index 63b6e9a51da..c6d6fd86139 100644 --- a/component/admin/views/product_detail/tmpl/attribute_color.php +++ b/component/admin/views/product_detail/tmpl/attribute_color.php @@ -25,7 +25,7 @@ submitbutton = function (pressbutton) { if (pressbutton == 'save') { - submitform('subattribute_color'); + Joomla.submitform('subattribute_color'); } } @@ -33,7 +33,7 @@
- +
@@ -325,3 +328,11 @@ function jimage_insert(main_path, fid, fsec) { } } + '.ModalProductDetailButton', + 'modalFrame' => 'ModalProductDetail', + ] +); diff --git a/component/admin/views/product_detail/tmpl/default_calculator.php b/component/admin/views/product_detail/tmpl/default_calculator.php index 592364b4915..bb4b7303186 100644 --- a/component/admin/views/product_detail/tmpl/default_calculator.php +++ b/component/admin/views/product_detail/tmpl/default_calculator.php @@ -21,7 +21,7 @@ $lists['discount_calc_oprand'] = str_replace($removeFormat['format.eol'], "", $lists['discount_calc_oprand']); $app = JFactory::getApplication(); -$cId = $app->input->getInt('cid'); +$cId = $app->input->get('cid', [], 'array')[0] ?? 0; unset($options); @@ -188,7 +188,7 @@ function deleteDiscountElementExtra(r) {
@@ -32,13 +36,9 @@ @@ -61,13 +61,9 @@ diff --git a/component/admin/views/product_detail/tmpl/default_general_data.php b/component/admin/views/product_detail/tmpl/default_general_data.php index 3b8fde870b8..b1a150647dd 100644 --- a/component/admin/views/product_detail/tmpl/default_general_data.php +++ b/component/admin/views/product_detail/tmpl/default_general_data.php @@ -7,15 +7,17 @@ * @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; -JHtml::_('behavior.modal', 'a.joom-box'); -/** @scrutinizer ignore-deprecated */ -JHtml::script('com_redshop/jquery.inputmask.min.js', false, true); +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); +HTMLHelper::script('com_redshop/jquery.inputmask.min.js', ['relative' => true]); $priceDecimal = Redshop::getConfig()->get('PRICE_DECIMAL', '.'); $priceThousand = Redshop::getConfig()->get('THOUSAND_SEPERATOR', ','); -$editor = JFactory::getEditor(); +$editor = \Joomla\CMS\Editor\Editor::getInstance(); $calendarFormat = Redshop::getConfig()->getString('DEFAULT_DATEFORMAT', 'Y-m-d'); $config = JFactory::getConfig(); $tz = new \DateTimeZone($config->get('offset')); @@ -45,7 +47,7 @@ dataType: "json", success: function (data) { document.formvalidator.setHandler("productNumber", function (value) { - return !data.contains(value); + return !data.includes(value); }); } }); @@ -99,19 +101,19 @@ "removeMaskOnSubmit": true }); - SqueezeBox.presets.onClose = function (e) { - if (this.options.classWindow == 'additional-media-popup') { - var reloading_img = '
'; - - setUserState( - 'com_redshop.product_detail.selectedTabPosition', - 'general_data' - ) ?> - - $('#general_data').html(reloading_img); - window.location.reload(); - } - }; + //SqueezeBox.presets.onClose = function (e) { + // if (this.options.classWindow == 'additional-media-popup') { + // var reloading_img = '
'; + // + // setUserState( + // 'com_redshop.product_detail.selectedTabPosition', + // 'general_data' + // ) ?> + // + // $('#general_data').html(reloading_img); + // window.location.reload(); + // } + //}; }); })(jQuery); @@ -142,13 +144,9 @@ * * @@ -180,13 +174,9 @@ class="star text-danger"> * @@ -198,13 +188,9 @@ class="star text-danger"> * * @@ -215,13 +201,9 @@ class="star text-danger"> * @@ -238,13 +220,9 @@ class="star text-danger"> * @@ -262,13 +240,9 @@ class="star text-danger"> * @@ -279,13 +253,9 @@ class="star text-danger"> * @@ -373,13 +343,9 @@ class="star text-danger"> * @@ -448,10 +414,11 @@ class="star text-danger"> * detail->product_id . '&showbuttons=1&media_section=product'; ?>
@@ -487,13 +454,9 @@ class="star text-danger"> * (get('DEFAULT_VOLUME_UNIT'); ?>3) @@ -512,13 +475,9 @@ class="star text-danger"> * (get('DEFAULT_VOLUME_UNIT'); ?>) @@ -537,13 +496,9 @@ class="star text-danger"> * (get('DEFAULT_VOLUME_UNIT'); ?>) @@ -562,13 +517,9 @@ class="star text-danger"> * (get('DEFAULT_VOLUME_UNIT'); ?>) @@ -587,13 +538,9 @@ class="star text-danger"> * (get('DEFAULT_VOLUME_UNIT'); ?>) @@ -612,13 +559,9 @@ class="star text-danger"> * (get('DEFAULT_WEIGHT_UNIT'); ?>) @@ -643,13 +586,9 @@ class="star text-danger"> * @@ -660,13 +599,9 @@ class="star text-danger"> * @@ -692,13 +627,9 @@ class="star text-danger"> * @@ -709,13 +640,9 @@ class="star text-danger"> * @@ -726,13 +653,9 @@ class="star text-danger"> * @@ -743,13 +666,9 @@ class="star text-danger"> * @@ -760,13 +679,9 @@ class="star text-danger"> * @@ -777,13 +692,9 @@ class="star text-danger"> * @@ -803,13 +714,9 @@ class="star text-danger"> * @@ -836,13 +743,9 @@ class="star text-danger"> * @@ -862,13 +765,9 @@ class="star text-danger"> * diff --git a/component/admin/views/product_detail/tmpl/default_product_images.php b/component/admin/views/product_detail/tmpl/default_product_images.php index fb0c02dd484..ff5659db355 100644 --- a/component/admin/views/product_detail/tmpl/default_product_images.php +++ b/component/admin/views/product_detail/tmpl/default_product_images.php @@ -7,7 +7,12 @@ * @copyright Copyright (C) 2008 - 2019 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ + +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; + +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); ?>
@@ -21,13 +26,9 @@ @@ -49,13 +50,9 @@ @@ -77,13 +74,9 @@ @@ -105,13 +98,9 @@ diff --git a/component/admin/views/product_detail/tmpl/default_product_meta_data.php b/component/admin/views/product_detail/tmpl/default_product_meta_data.php index 2c13132e490..1e2ec9fc1d6 100644 --- a/component/admin/views/product_detail/tmpl/default_product_meta_data.php +++ b/component/admin/views/product_detail/tmpl/default_product_meta_data.php @@ -7,7 +7,11 @@ * @license GNU General Public License version 2 or later; see LICENSE */ +use Joomla\CMS\HTML\HTMLHelper; + defined('_JEXEC') or die; + +HTMLHelper::_('bootstrap.tooltip', '.hasTooltip'); ?>
@@ -21,13 +25,9 @@ @@ -37,13 +37,9 @@

@@ -121,13 +105,9 @@ class="form-control" @@ -143,13 +123,9 @@ class="form-control"